1
0
forked from VimPlug/jedi

Magic methods fixes for reverse methods

This commit is contained in:
Dave Halter
2020-05-16 15:39:48 +02:00
parent 09dbbc6361
commit b3fc10a6e4
2 changed files with 27 additions and 4 deletions

View File

@@ -661,15 +661,19 @@ def _infer_comparison_part(inference_state, context, left, operator, right):
method_name = operator_to_magic_method[str_operator]
magic_methods = left.py__getattribute__(method_name)
if not magic_methods:
reverse_method_name = reverse_operator_to_magic_method[str_operator]
magic_methods = left.py__getattribute__(reverse_method_name)
if magic_methods:
result = magic_methods.execute_with_values(right)
if result:
return result
if not magic_methods:
reverse_method_name = reverse_operator_to_magic_method[str_operator]
magic_methods = right.py__getattribute__(reverse_method_name)
result = magic_methods.execute_with_values(left)
if result:
return result
result = ValueSet([left, right])
debug.dbg('Used operator %s resulting in %s', operator, result)
return result