anydi 0.36.1a1__tar.gz → 0.36.1a3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {anydi-0.36.1a1 → anydi-0.36.1a3}/PKG-INFO +1 -1
- {anydi-0.36.1a1 → anydi-0.36.1a3}/anydi/_container.py +28 -14
- {anydi-0.36.1a1 → anydi-0.36.1a3}/pyproject.toml +1 -1
- {anydi-0.36.1a1 → anydi-0.36.1a3}/LICENSE +0 -0
- {anydi-0.36.1a1 → anydi-0.36.1a3}/README.md +0 -0
- {anydi-0.36.1a1 → anydi-0.36.1a3}/anydi/__init__.py +0 -0
- {anydi-0.36.1a1 → anydi-0.36.1a3}/anydi/_context.py +0 -0
- {anydi-0.36.1a1 → anydi-0.36.1a3}/anydi/_provider.py +0 -0
- {anydi-0.36.1a1 → anydi-0.36.1a3}/anydi/_types.py +0 -0
- {anydi-0.36.1a1 → anydi-0.36.1a3}/anydi/_utils.py +0 -0
- {anydi-0.36.1a1 → anydi-0.36.1a3}/anydi/ext/__init__.py +0 -0
- {anydi-0.36.1a1 → anydi-0.36.1a3}/anydi/ext/_utils.py +0 -0
- {anydi-0.36.1a1 → anydi-0.36.1a3}/anydi/ext/django/__init__.py +0 -0
- {anydi-0.36.1a1 → anydi-0.36.1a3}/anydi/ext/django/_container.py +0 -0
- {anydi-0.36.1a1 → anydi-0.36.1a3}/anydi/ext/django/_settings.py +0 -0
- {anydi-0.36.1a1 → anydi-0.36.1a3}/anydi/ext/django/_utils.py +0 -0
- {anydi-0.36.1a1 → anydi-0.36.1a3}/anydi/ext/django/apps.py +0 -0
- {anydi-0.36.1a1 → anydi-0.36.1a3}/anydi/ext/django/middleware.py +0 -0
- {anydi-0.36.1a1 → anydi-0.36.1a3}/anydi/ext/django/ninja/__init__.py +0 -0
- {anydi-0.36.1a1 → anydi-0.36.1a3}/anydi/ext/django/ninja/_operation.py +0 -0
- {anydi-0.36.1a1 → anydi-0.36.1a3}/anydi/ext/django/ninja/_signature.py +0 -0
- {anydi-0.36.1a1 → anydi-0.36.1a3}/anydi/ext/fastapi.py +0 -0
- {anydi-0.36.1a1 → anydi-0.36.1a3}/anydi/ext/faststream.py +0 -0
- {anydi-0.36.1a1 → anydi-0.36.1a3}/anydi/ext/pydantic_settings.py +0 -0
- {anydi-0.36.1a1 → anydi-0.36.1a3}/anydi/ext/pytest_plugin.py +0 -0
- {anydi-0.36.1a1 → anydi-0.36.1a3}/anydi/ext/starlette/__init__.py +0 -0
- {anydi-0.36.1a1 → anydi-0.36.1a3}/anydi/ext/starlette/middleware.py +0 -0
- {anydi-0.36.1a1 → anydi-0.36.1a3}/anydi/py.typed +0 -0
|
@@ -709,10 +709,9 @@ class Container:
|
|
|
709
709
|
if interface in self._override_instances:
|
|
710
710
|
return self._override_instances[interface]
|
|
711
711
|
|
|
712
|
-
if not hasattr(instance, "__dict__")
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
if hasattr(instance, "__patched__"):
|
|
712
|
+
if not hasattr(instance, "__dict__") or hasattr(
|
|
713
|
+
instance, "__resolver_getter__"
|
|
714
|
+
):
|
|
716
715
|
return instance
|
|
717
716
|
|
|
718
717
|
wrapped = {
|
|
@@ -721,20 +720,35 @@ class Container:
|
|
|
721
720
|
if isinstance(value, InstanceProxy)
|
|
722
721
|
}
|
|
723
722
|
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
_interface = wrapped[_name]
|
|
723
|
+
def __resolver_getter__(name: str) -> Any:
|
|
724
|
+
if name in wrapped:
|
|
725
|
+
_interface = wrapped[name]
|
|
728
726
|
# Resolve the dependency if it's wrapped
|
|
729
727
|
return self.resolve(_interface)
|
|
730
|
-
|
|
731
|
-
|
|
728
|
+
raise LookupError
|
|
729
|
+
|
|
730
|
+
if not hasattr(instance.__class__, "__getattribute_patched__"):
|
|
731
|
+
|
|
732
|
+
def __getattribute__(_self: Any, name: str) -> Any:
|
|
733
|
+
# Skip the resolver getter
|
|
734
|
+
if name in {"__resolver_getter__"}:
|
|
735
|
+
return object.__getattribute__(_self, name)
|
|
736
|
+
|
|
737
|
+
if hasattr(_self, "__resolver_getter__"):
|
|
738
|
+
try:
|
|
739
|
+
return _self.__resolver_getter__(name)
|
|
740
|
+
except LookupError:
|
|
741
|
+
pass
|
|
742
|
+
|
|
743
|
+
# Fall back to default behavior
|
|
744
|
+
return object.__getattribute__(_self, name)
|
|
732
745
|
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
instance.__class__.
|
|
746
|
+
# Apply the patched resolver if wrapped attributes exist
|
|
747
|
+
instance.__class__.__getattribute__ = __getattribute__
|
|
748
|
+
instance.__class__.__getattribute_patched__ = True
|
|
736
749
|
|
|
737
|
-
|
|
750
|
+
# Attach the resolver getter to the instance
|
|
751
|
+
instance.__resolver_getter__ = __resolver_getter__
|
|
738
752
|
|
|
739
753
|
return instance
|
|
740
754
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|