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

Creating with Generic[T] Interfaces #47

Open
adishavit opened this issue Jun 3, 2021 · 1 comment
Open

Creating with Generic[T] Interfaces #47

adishavit opened this issue Jun 3, 2021 · 1 comment

Comments

@adishavit
Copy link

I have a generic interface class using typing.Generic: class MyInterface(Generic[T]).
I want to use python-interface for better conformance and checking.

However, if I add Interface as a base class: class MyInterface(Generic[T], Interface) it fails with:

...
    class MyInterface(Generic[T], Interface):  # Does not (currently) derive from ABC to avoid serialization issues.
  File "C:\Users\adishavit\Miniconda3\envs\roomassignments\lib\site-packages\interface\interface.py", line 106, in __new__
    signatures = _merge_parent_signatures(bases)
  File "C:\Users\adishavit\Miniconda3\envs\roomassignments\lib\site-packages\interface\interface.py", line 91, in _merge_parent_signatures
    return merge(filter(None, (getattr(b, "_signatures") for b in bases)))
  File "C:\Users\adishavit\Miniconda3\envs\roomassignments\lib\site-packages\interface\functional.py", line 52, in merge
    dicts = list(dicts)
  File "C:\Users\adishavit\Miniconda3\envs\roomassignments\lib\site-packages\interface\interface.py", line 91, in <genexpr>
    return merge(filter(None, (getattr(b, "_signatures") for b in bases)))
AttributeError: type object 'Generic' has no attribute '_signatures'

Any suggestions?

@hasii2011
Copy link

hasii2011 commented Mar 16, 2022

Is this project still active?

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

2 participants