ethanfurman / aenum

Advanced Enumerations for Python
179 stars 13 forks source link

Autocomplete on Windows fails with #39

Closed developer992 closed 4 months ago

developer992 commented 5 months ago
  File "C:\Users\...\.pyenv\pyenv-win\versions\3.11.5\Lib\rlcompleter.py", line 94, in complete
    self.matches = self.global_matches(text)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\...\.pyenv\pyenv-win\versions\3.11.5\Lib\rlcompleter.py", line 135, in global_matches
    matches.append(self._callable_postfix(val, word))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\...\.pyenv\pyenv-win\versions\3.11.5\Lib\rlcompleter.py", line 104, in _callable_postfix
    if not inspect.signature(val).parameters:
           ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\...\.pyenv\pyenv-win\versions\3.11.5\Lib\inspect.py", line 3280, in signature
    return Signature.from_callable(obj, follow_wrapped=follow_wrapped,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\...\.pyenv\pyenv-win\versions\3.11.5\Lib\inspect.py", line 3028, in from_callable
    return _signature_from_callable(obj, sigcls=cls,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\...\.pyenv\pyenv-win\versions\3.11.5\Lib\inspect.py", line 2480, in _signature_from_callable
    raise TypeError(
TypeError: unexpected object <bound method __signature__ of <aenum 'Language'>> in __signature__ attribute
class Language(aenum.MultiValueEnum):
    SI = "SI", _("Slovene")
    EN = "EN", _("English")
    HR = "HR", _("Croatian")
    DE = "DE", _("German")
    RU = "RU", _("Russian")

    def __init__(self, code: str, name: str):
        self._code = code
        self._name = name

    @property
    def code(self):
        return self._code

    @property
    def name(self):
        return self._name

    @property
    def value(self):
        return self.code

import Language Lang... and then tab tab tab

ethanfurman commented 4 months ago

@developer992 Does this happen when using the built-in Enum?

developer992 commented 4 months ago

Thanks, the built-in Enum does not raise error when TAB is pressed although it also doesn't offer a list of values. Might be just my windows env broken.