Skip to content

add annotations for resolve container#193

Open
chesnokpeter wants to merge 1 commit into
bobthemighty:mainfrom
chesnokpeter:main
Open

add annotations for resolve container#193
chesnokpeter wants to merge 1 commit into
bobthemighty:mainfrom
chesnokpeter:main

Conversation

@chesnokpeter

Copy link
Copy Markdown

before:

import punq
import abc
cont = punq.Container()

class AbsConnector(abc.ABC):
@abc.abstractmethod
def connect(self):
raise NotImplementedError

class HelloConnector(AbsConnector):
def init(self):
print('init...')
def connect(self):
print('connect to hello ...')

cont.register(AbsConnector, HelloConnector, scope=punq.Scope.singleton)
conn = cont.resolve(AbsConnector)

conn.connect() # no hints

after:

conn.connect() # with hints for AbsConnector

@bobthemighty

Copy link
Copy Markdown
Owner

Hey friend! I'm thinking I want to do this for a breaking version 1.0, since it will require deprecating the ability to use non-type keys, so I will come back to this in due course. Thanks for the starter!

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

Successfully merging this pull request may close these issues.

2 participants