question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Usage of containers.override decorator

See original GitHub issue

Hi, I think in previous versions is was possible to do something like:

containers.override(BaseContainer):
class OverrideContainer: ....

Afterwards

c = BaseContainer()

would contain all the overrides. However, the typing now complains that containers.override wants a Container instance and not a class. Has overriding containers on the class level been deprecated, as it also seems to have been removed from the documentation?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
rmk135commented, Oct 25, 2020

Done in 4.1.0.

Btw, there are two new providers: https://python-dependency-injector.ets-labs.org/providers/resource.html and https://python-dependency-injector.ets-labs.org/providers/dict.html.

Closing the issue. Comment / re-open if needed.

1reaction
JarnoRFBcommented, Oct 21, 2020

@rmk135 Yes I believe that “un-deprecating” @containers.override() makes probably sense, until we have a better solution. Thanks a lot for going through the discussion!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Container overriding - Dependency Injector
Decorator @containers.override() takes a container for overriding as an argument. This container providers will be overridden by the providers with the same ...
Read more >
python __getattribute__ override and @property decorator
I have some classes which inherit Container base class and some of their methods have @property decorator. class Response(Container): @property ...
Read more >
How to Decorate Services (Symfony Docs)
Decoration Priority; Stacking Decorators; Control the Behavior When the Decorated ... When overriding an existing definition, the original service is lost:.
Read more >
PEP 698 – Override Decorator for Static Typing
This will allow type checkers to prevent a class of bugs that occur when a base class changes methods that are inherited by...
Read more >
Container class - widgets library - Flutter - Dart API docs
A container first surrounds the child with padding (inflated by any borders present in the decoration) and then applies additional constraints to the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found