mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2025-07-06 13:23:15 +03:00
Try another fix with metaclass
This commit is contained in:
parent
fec6e2b878
commit
142cd4bf93
|
@ -118,7 +118,14 @@ def _patch_with_injections(fn, injections):
|
||||||
return _patched
|
return _patched
|
||||||
|
|
||||||
|
|
||||||
class ConfigurationOption:
|
class ConfigurationOptionMeta(type):
|
||||||
|
|
||||||
|
def __getitem__(cls, item):
|
||||||
|
# Spike for Python 3.6
|
||||||
|
return cls(item)
|
||||||
|
|
||||||
|
|
||||||
|
class ConfigurationOption(metaclass=ConfigurationOptionMeta):
|
||||||
"""Configuration option marker."""
|
"""Configuration option marker."""
|
||||||
|
|
||||||
def __init__(self, selector: str):
|
def __init__(self, selector: str):
|
||||||
|
@ -126,8 +133,3 @@ class ConfigurationOption:
|
||||||
|
|
||||||
def __class_getitem__(cls, item):
|
def __class_getitem__(cls, item):
|
||||||
return cls(item)
|
return cls(item)
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def __getitem__(cls, item):
|
|
||||||
# Spike for Python 3.6
|
|
||||||
return cls(item)
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user