diff options
| author | 2024-04-01 15:42:47 +0800 | |
|---|---|---|
| committer | 2024-04-01 15:42:47 +0800 | |
| commit | 1cbd9bd2dd16ddaa263f2eb69970dd8e45dfa370 (patch) | |
| tree | f3bd007163341037caed344a1c79c970a31fb215 /src | |
| parent | 4634be1aef800bf4c435d04bb11a2e31e847e604 (diff) | |
| download | infini-1cbd9bd2dd16ddaa263f2eb69970dd8e45dfa370.tar.gz infini-1cbd9bd2dd16ddaa263f2eb69970dd8e45dfa370.zip | |
feat(injector): allow complex and instance annocation
Diffstat (limited to 'src')
| -rw-r--r-- | src/infini/injector.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/infini/injector.py b/src/infini/injector.py index 73d96566..62032bb5 100644 --- a/src/infini/injector.py +++ b/src/infini/injector.py @@ -28,7 +28,11 @@ class Injector: else: param_types = (origin,) - if type(parameters[param_name]) not in param_types: + if not any( + isinstance(parameters[param_name], param_type) + for param_type in param_types + if not isinstance(param_type, typing._SpecialForm) + ): raise ValueError( f"Parameter with name '{param_name}' has a mismatch type, " f"expected '{param.annotation!r}' but got '{type(parameters[param_name])!r}'." |
