Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tab completion is not working with the default python interpreter #289

Open
diego-hayashi opened this issue May 25, 2024 · 0 comments
Open

Comments

@diego-hayashi
Copy link

Describe the bug
The default python interpreter (python) is not performing tab completion for ufl.

Steps to Reproduce

  1. Run the default python interpreter in the terminal:
python
  1. Then, run:
>>> import ufl
>>> ufl.

Then, press tab two times. Notice that tab completion does not work.

Expected behavior
Tab completion should have worked.

Error message
Nothing appears on the terminal when tapping the tab key from the keyboard.

Additional Info
Tab completion seems to work fine if the measure.py file is patched by initially checking the instance of the input object of the __eq__ method from Measure:

diff --git a/ufl/measure.py b/ufl/measure.py
index 08f1fa80..df88a0b2 100644
--- a/ufl/measure.py
+++ b/ufl/measure.py
@@ -316,12 +316,13 @@ class Measure(object):
 
     def __eq__(self, other):
         """Checks if two Measures are equal."""
+        if not isinstance(other, Measure):
+            return False
         sorted_metadata = sorted((k, id(v)) for k, v in list(self._metadata.items()))
         sorted_other_metadata = sorted((k, id(v)) for k, v in list(other._metadata.items()))
 
         return (
-            isinstance(other, Measure)
-            and self._integral_type == other._integral_type
+            self._integral_type == other._integral_type
             and self._subdomain_id == other._subdomain_id
             and self._domain == other._domain
             and id_or_none(self._subdomain_data) == id_or_none(other._subdomain_data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant