FEniCS / ufl

UFL - Unified Form Language

Home Page:https://fenicsproject.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tab completion is not working with the default python interpreter

diego-hayashi opened this issue · comments

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)