We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Let's say I have an AbstractFormatter class.
AbstractFormatter
I register the base binding:
self.container.register(AbstractFormatter, JsonFormatter)
class Processor: def __init__( self, json_formatter: AbstractFormatter, ): self.json_formatter = json_formatter
But one specific class wants another implementation by the same contract:
class CustomProcessor: def __init__( self, markdown_formatter: AbstractFormatter, ): self.markdown_formatter = markdown_formatter
Now, I want to do the following:
(self.container.when(CustomProcessor) .wants(AbstractFormatter) .give(MarkdownFormatter))
I.e. only CustomProcessor should receive the markdown formatter.
CustomProcessor
P.S. Maybe there are other ways to do the same? Inspired by this.
The text was updated successfully, but these errors were encountered:
If it makes you feel any better, btw, this one is uncontroversial and - I think - related to #35 .
Sorry, something went wrong.
No branches or pull requests
Let's say I have an
AbstractFormatter
class.I register the base binding:
But one specific class wants another implementation by the same contract:
Now, I want to do the following:
I.e. only
CustomProcessor
should receive the markdown formatter.P.S. Maybe there are other ways to do the same? Inspired by this.
The text was updated successfully, but these errors were encountered: