orionis 0.450.0__py3-none-any.whl → 0.451.0__py3-none-any.whl

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.
Files changed (42) hide show
  1. orionis/console/base/contracts/command.py +0 -2
  2. orionis/console/core/__init__.py +0 -0
  3. orionis/container/container.py +1577 -69
  4. orionis/container/contracts/container.py +184 -33
  5. orionis/foundation/config/database/entities/mysql.py +0 -1
  6. orionis/metadata/framework.py +1 -1
  7. orionis/services/inspirational/contracts/__init__.py +0 -0
  8. orionis/services/introspection/abstract/contracts/reflection.py +5 -6
  9. orionis/services/introspection/abstract/reflection.py +5 -6
  10. orionis/services/introspection/callables/contracts/reflection.py +3 -2
  11. orionis/services/introspection/callables/reflection.py +4 -4
  12. orionis/services/introspection/concretes/contracts/reflection.py +5 -6
  13. orionis/services/introspection/concretes/reflection.py +5 -6
  14. orionis/services/introspection/dependencies/contracts/reflection.py +87 -23
  15. orionis/services/introspection/dependencies/entities/argument.py +95 -0
  16. orionis/services/introspection/dependencies/entities/resolve_argument.py +82 -0
  17. orionis/services/introspection/dependencies/reflection.py +176 -106
  18. orionis/services/introspection/instances/contracts/reflection.py +5 -6
  19. orionis/services/introspection/instances/reflection.py +5 -6
  20. orionis/test/core/unit_test.py +150 -48
  21. {orionis-0.450.0.dist-info → orionis-0.451.0.dist-info}/METADATA +1 -1
  22. {orionis-0.450.0.dist-info → orionis-0.451.0.dist-info}/RECORD +34 -37
  23. tests/container/mocks/mock_auto_resolution.py +192 -0
  24. tests/services/introspection/dependencies/test_reflect_dependencies.py +135 -58
  25. tests/services/introspection/reflection/test_reflection_abstract.py +5 -4
  26. tests/services/introspection/reflection/test_reflection_callable.py +3 -3
  27. tests/services/introspection/reflection/test_reflection_concrete.py +4 -4
  28. tests/services/introspection/reflection/test_reflection_instance.py +5 -5
  29. orionis/console/args/parser.py +0 -40
  30. orionis/container/contracts/resolver.py +0 -115
  31. orionis/container/resolver/resolver.py +0 -602
  32. orionis/services/introspection/dependencies/entities/callable_dependencies.py +0 -54
  33. orionis/services/introspection/dependencies/entities/class_dependencies.py +0 -61
  34. orionis/services/introspection/dependencies/entities/known_dependencies.py +0 -67
  35. orionis/services/introspection/dependencies/entities/method_dependencies.py +0 -61
  36. tests/container/resolver/test_resolver.py +0 -62
  37. /orionis/{container/resolver → console/commands}/__init__.py +0 -0
  38. {tests/container/resolver → orionis/console/contracts}/__init__.py +0 -0
  39. {orionis-0.450.0.dist-info → orionis-0.451.0.dist-info}/WHEEL +0 -0
  40. {orionis-0.450.0.dist-info → orionis-0.451.0.dist-info}/licenses/LICENCE +0 -0
  41. {orionis-0.450.0.dist-info → orionis-0.451.0.dist-info}/top_level.txt +0 -0
  42. {orionis-0.450.0.dist-info → orionis-0.451.0.dist-info}/zip-safe +0 -0
@@ -1,7 +1,8 @@
1
1
  from abc import ABC, abstractmethod
2
- from typing import Any, Callable
2
+ from typing import Any, Callable, Optional
3
3
  from orionis.container.enums.lifetimes import Lifetime
4
4
  from orionis.container.entities.binding import Binding
5
+ from orionis.services.introspection.dependencies.entities.resolve_argument import ResolveArguments
5
6
 
6
7
  class IContainer(ABC):
7
8
  """
@@ -17,7 +18,7 @@ class IContainer(ABC):
17
18
  *,
18
19
  alias: str = None,
19
20
  enforce_decoupling: bool = False
20
- ) -> bool:
21
+ ) -> Optional[bool]:
21
22
  """
22
23
  Registers a service with a singleton lifetime.
23
24
 
@@ -47,7 +48,7 @@ class IContainer(ABC):
47
48
  *,
48
49
  alias: str = None,
49
50
  enforce_decoupling: bool = False
50
- ) -> bool:
51
+ ) -> Optional[bool]:
51
52
  """
52
53
  Registers a service with a transient lifetime.
53
54
 
@@ -77,7 +78,7 @@ class IContainer(ABC):
77
78
  *,
78
79
  alias: str = None,
79
80
  enforce_decoupling: bool = False
80
- ) -> bool:
81
+ ) -> Optional[bool]:
81
82
  """
82
83
  Registers a service with a scoped lifetime.
83
84
 
@@ -107,7 +108,7 @@ class IContainer(ABC):
107
108
  *,
108
109
  alias: str = None,
109
110
  enforce_decoupling: bool = False
110
- ) -> bool:
111
+ ) -> Optional[bool]:
111
112
  """
112
113
  Registers an instance of a class or interface in the container.
113
114
 
@@ -137,7 +138,7 @@ class IContainer(ABC):
137
138
  fn: Callable[..., Any],
138
139
  *,
139
140
  lifetime: Lifetime = Lifetime.TRANSIENT
140
- ) -> bool:
141
+ ) -> Optional[bool]:
141
142
  """
142
143
  Registers a function or factory under a given alias.
143
144
 
@@ -157,32 +158,6 @@ class IContainer(ABC):
157
158
  """
158
159
  pass
159
160
 
160
- @abstractmethod
161
- def make(
162
- self,
163
- abstract_or_alias: Any,
164
- *args: tuple,
165
- **kwargs: dict
166
- ) -> Any:
167
- """
168
- Resolves and returns an instance of the requested service.
169
-
170
- Parameters
171
- ----------
172
- abstract_or_alias : Any
173
- The abstract class, interface, or alias (str) to resolve.
174
- *args : tuple
175
- Positional arguments to pass to the constructor of the resolved service.
176
- **kwargs : dict
177
- Keyword arguments to pass to the constructor of the resolved service.
178
-
179
- Returns
180
- -------
181
- Any
182
- An instance of the requested service.
183
- """
184
- pass
185
-
186
161
  @abstractmethod
187
162
  def bound(
188
163
  self,
@@ -207,7 +182,7 @@ class IContainer(ABC):
207
182
  def getBinding(
208
183
  self,
209
184
  abstract_or_alias: Any
210
- ) -> Binding:
185
+ ) -> Optional[Binding]:
211
186
  """
212
187
  Retrieves the binding for the requested abstract type or alias.
213
188
 
@@ -268,4 +243,180 @@ class IContainer(ABC):
268
243
  ...
269
244
  # Scoped services are automatically disposed here
270
245
  """
246
+ pass
247
+
248
+ @abstractmethod
249
+ def resolveDependencyArguments(
250
+ self,
251
+ name: Optional[str],
252
+ dependencies: Optional[ResolveArguments]
253
+ ) -> dict:
254
+ """
255
+ Public method to resolve dependencies for a given class or callable.
256
+
257
+ This method serves as the public interface for resolving dependencies.
258
+ It wraps the internal dependency resolution logic and provides error
259
+ handling to ensure that any exceptions are communicated clearly.
260
+
261
+ Parameters
262
+ ----------
263
+ name : str or None
264
+ The name of the class or callable whose dependencies are being resolved.
265
+ Used for error reporting and context.
266
+ dependencies : ResolveArguments or None
267
+ The dependencies object containing resolved and unresolved arguments,
268
+ as extracted by reflection from the target's signature.
269
+
270
+ Returns
271
+ -------
272
+ dict
273
+ A dictionary mapping parameter names to their resolved values. Each key
274
+ is the name of a constructor or callable parameter, and each value is
275
+ the resolved dependency instance or value.
276
+
277
+ Raises
278
+ ------
279
+ OrionisContainerException
280
+ If any required dependency cannot be resolved, if there are unresolved
281
+ arguments, or if a dependency refers to a built-in type.
282
+ """
283
+ pass
284
+
285
+ @abstractmethod
286
+ def make(
287
+ self,
288
+ type_: Any,
289
+ *args: tuple,
290
+ **kwargs: dict
291
+ ) -> Any:
292
+ """
293
+ Resolve and instantiate a service or type.
294
+
295
+ This method attempts to resolve and instantiate the requested service or type.
296
+ It first checks if the type is registered in the container and, if so, resolves
297
+ it according to its binding and lifetime. If the type is not registered but is
298
+ a class, it attempts to auto-resolve it by constructing it and resolving its
299
+ dependencies recursively. If neither approach is possible, an exception is raised.
300
+
301
+ Parameters
302
+ ----------
303
+ type_ : Any
304
+ The abstract type, class, or alias to resolve. This can be a class, interface,
305
+ or a string alias registered in the container.
306
+ *args : tuple
307
+ Positional arguments to pass to the constructor or factory function.
308
+ **kwargs : dict
309
+ Keyword arguments to pass to the constructor or factory function.
310
+
311
+ Returns
312
+ -------
313
+ Any
314
+ The resolved and instantiated service or object. If the type is registered,
315
+ the instance is created according to its binding's lifetime (singleton,
316
+ transient, or scoped). If the type is not registered but is a class,
317
+ a new instance is created with its dependencies resolved automatically.
318
+
319
+ Raises
320
+ ------
321
+ OrionisContainerException
322
+ If the requested service or type is not registered in the container and
323
+ cannot be auto-resolved.
324
+
325
+ Notes
326
+ -----
327
+ - If the type is registered, the container's binding and lifetime rules are used.
328
+ - If the type is not registered but is a class, auto-resolution is attempted.
329
+ - If the type cannot be resolved by either method, an exception is raised.
330
+ """
331
+ pass
332
+
333
+ @abstractmethod
334
+ def resolve(
335
+ self,
336
+ binding: Binding,
337
+ *args,
338
+ **kwargs
339
+ ):
340
+ """
341
+ Resolves an instance from a binding according to its lifetime.
342
+
343
+ Parameters
344
+ ----------
345
+ binding : Binding
346
+ The binding to resolve.
347
+ *args : tuple
348
+ Additional positional arguments to pass to the constructor.
349
+ **kwargs : dict
350
+ Additional keyword arguments to pass to the constructor.
351
+
352
+ Returns
353
+ -------
354
+ Any
355
+ The resolved instance.
356
+
357
+ Raises
358
+ ------
359
+ OrionisContainerException
360
+ If the binding is not an instance of Binding or if the lifetime is not supported.
361
+ """
362
+ pass
363
+
364
+ @abstractmethod
365
+ def resolveWithoutContainer(
366
+ self,
367
+ type_: Callable[..., Any],
368
+ *args,
369
+ **kwargs
370
+ ) -> Any:
371
+ """
372
+ Forces resolution of a type whether it's registered in the container or not.
373
+
374
+ Parameters
375
+ ----------
376
+ type_ : Callable[..., Any]
377
+ The type or callable to resolve.
378
+ *args : tuple
379
+ Positional arguments to pass to the constructor/callable.
380
+ **kwargs : dict
381
+ Keyword arguments to pass to the constructor/callable.
382
+
383
+ Returns
384
+ -------
385
+ Any
386
+ The resolved instance.
387
+
388
+ Raises
389
+ ------
390
+ OrionisContainerException
391
+ If the type cannot be resolved.
392
+ """
393
+ pass
394
+
395
+ @abstractmethod
396
+ def call(
397
+ self,
398
+ instance: Any,
399
+ method_name: str,
400
+ *args,
401
+ **kwargs
402
+ ) -> Any:
403
+ """
404
+ Call a method on an instance with automatic dependency injection.
405
+
406
+ Parameters
407
+ ----------
408
+ instance : Any
409
+ The instance on which to call the method.
410
+ method_name : str
411
+ The name of the method to call.
412
+ *args : tuple
413
+ Positional arguments to pass to the method.
414
+ **kwargs : dict
415
+ Keyword arguments to pass to the method.
416
+
417
+ Returns
418
+ -------
419
+ Any
420
+ The result of the method call.
421
+ """
271
422
  pass
@@ -1,5 +1,4 @@
1
1
  from dataclasses import dataclass, field
2
- from typing import Optional
3
2
  from orionis.foundation.config.database.enums import (
4
3
  MySQLCharset,
5
4
  MySQLCollation,
@@ -5,7 +5,7 @@
5
5
  NAME = "orionis"
6
6
 
7
7
  # Current version of the framework
8
- VERSION = "0.450.0"
8
+ VERSION = "0.451.0"
9
9
 
10
10
  # Full name of the author or maintainer of the project
11
11
  AUTHOR = "Raul Mauricio Uñate Castro"
File without changes
@@ -1,8 +1,7 @@
1
1
  from abc import ABC, abstractmethod
2
2
  import inspect
3
3
  from typing import List, Type
4
- from orionis.services.introspection.dependencies.entities.class_dependencies import ClassDependency
5
- from orionis.services.introspection.dependencies.entities.method_dependencies import MethodDependency
4
+ from orionis.services.introspection.dependencies.entities.resolve_argument import ResolveArguments
6
5
 
7
6
  class IReflectionAbstract(ABC):
8
7
  """
@@ -822,13 +821,13 @@ class IReflectionAbstract(ABC):
822
821
  pass
823
822
 
824
823
  @abstractmethod
825
- def getConstructorDependencies(self) -> ClassDependency:
824
+ def getConstructorDependencies(self) -> ResolveArguments:
826
825
  """
827
826
  Get the resolved and unresolved dependencies from the constructor of the reflected class.
828
827
 
829
828
  Returns
830
829
  -------
831
- ClassDependency
830
+ ResolveArguments
832
831
  A structured representation of the constructor dependencies containing:
833
832
  - resolved: Dictionary of resolved dependencies with their names and values
834
833
  - unresolved: List of unresolved dependencies (parameter names without default values or annotations)
@@ -836,7 +835,7 @@ class IReflectionAbstract(ABC):
836
835
  pass
837
836
 
838
837
  @abstractmethod
839
- def getMethodDependencies(self, method_name: str) -> MethodDependency:
838
+ def getMethodDependencies(self, method_name: str) -> ResolveArguments:
840
839
  """
841
840
  Get the resolved and unresolved dependencies from a specific method of the reflected class.
842
841
 
@@ -847,7 +846,7 @@ class IReflectionAbstract(ABC):
847
846
 
848
847
  Returns
849
848
  -------
850
- MethodDependency
849
+ ResolveArguments
851
850
  A structured representation of the method dependencies containing:
852
851
  - resolved: Dictionary of resolved dependencies with their names and values
853
852
  - unresolved: List of unresolved dependencies (parameter names without default values or annotations)
@@ -3,8 +3,7 @@ import keyword
3
3
  from abc import ABC
4
4
  from typing import List, Type
5
5
  from orionis.services.introspection.abstract.contracts.reflection import IReflectionAbstract
6
- from orionis.services.introspection.dependencies.entities.class_dependencies import ClassDependency
7
- from orionis.services.introspection.dependencies.entities.method_dependencies import MethodDependency
6
+ from orionis.services.introspection.dependencies.entities.resolve_argument import ResolveArguments
8
7
  from orionis.services.introspection.dependencies.reflection import ReflectDependencies
9
8
  from orionis.services.introspection.exceptions import (
10
9
  ReflectionAttributeError,
@@ -1382,20 +1381,20 @@ class ReflectionAbstract(IReflectionAbstract):
1382
1381
 
1383
1382
  return prop.fget.__doc__ if prop.fget else None
1384
1383
 
1385
- def getConstructorDependencies(self) -> ClassDependency:
1384
+ def getConstructorDependencies(self) -> ResolveArguments:
1386
1385
  """
1387
1386
  Get the resolved and unresolved dependencies from the constructor.
1388
1387
 
1389
1388
  Returns
1390
1389
  -------
1391
- ClassDependency
1390
+ ResolveArguments
1392
1391
  A structured representation of the constructor dependencies containing
1393
1392
  resolved dependencies (with names and values) and unresolved dependencies
1394
1393
  (parameter names without default values or annotations).
1395
1394
  """
1396
1395
  return ReflectDependencies(self.__abstract).getConstructorDependencies()
1397
1396
 
1398
- def getMethodDependencies(self, method_name: str) -> MethodDependency:
1397
+ def getMethodDependencies(self, method_name: str) -> ResolveArguments:
1399
1398
  """
1400
1399
  Get the resolved and unresolved dependencies from a specific method.
1401
1400
 
@@ -1406,7 +1405,7 @@ class ReflectionAbstract(IReflectionAbstract):
1406
1405
 
1407
1406
  Returns
1408
1407
  -------
1409
- MethodDependency
1408
+ ResolveArguments
1410
1409
  A structured representation of the method dependencies containing
1411
1410
  resolved dependencies (with names and values) and unresolved dependencies
1412
1411
  (parameter names without default values or annotations).
@@ -1,4 +1,5 @@
1
1
  from abc import ABC, abstractmethod
2
+ from orionis.services.introspection.dependencies.entities.resolve_argument import ResolveArguments
2
3
 
3
4
  class IReflectionCallable(ABC):
4
5
  """
@@ -156,7 +157,7 @@ class IReflectionCallable(ABC):
156
157
  pass
157
158
 
158
159
  @abstractmethod
159
- def getDependencies(self):
160
+ def getDependencies(self) -> ResolveArguments:
160
161
  """
161
162
  Analyze the callable and retrieve its dependency information.
162
163
 
@@ -166,7 +167,7 @@ class IReflectionCallable(ABC):
166
167
 
167
168
  Returns
168
169
  -------
169
- CallableDependency
170
+ ResolveArguments
170
171
  An object containing information about the callable's dependencies:
171
172
  - resolved : dict
172
173
  A dictionary mapping parameter names to their resolved values
@@ -1,7 +1,7 @@
1
1
  import inspect
2
2
  from orionis.services.asynchrony.coroutines import Coroutine
3
3
  from orionis.services.introspection.callables.contracts.reflection import IReflectionCallable
4
- from orionis.services.introspection.dependencies.entities.callable_dependencies import CallableDependency
4
+ from orionis.services.introspection.dependencies.entities.resolve_argument import ResolveArguments
5
5
  from orionis.services.introspection.dependencies.reflection import ReflectDependencies
6
6
  from orionis.services.introspection.exceptions import (
7
7
  ReflectionAttributeError,
@@ -210,7 +210,7 @@ class ReflectionCallable(IReflectionCallable):
210
210
  """
211
211
  return inspect.signature(self.__function)
212
212
 
213
- def getDependencies(self) -> CallableDependency:
213
+ def getDependencies(self) -> ResolveArguments:
214
214
  """
215
215
  Analyze the callable and retrieve its dependency information.
216
216
 
@@ -220,7 +220,7 @@ class ReflectionCallable(IReflectionCallable):
220
220
 
221
221
  Returns
222
222
  -------
223
- CallableDependency
223
+ ResolveArguments
224
224
  An object containing information about the callable's dependencies:
225
225
  - resolved : dict
226
226
  A dictionary mapping parameter names to their resolved values
@@ -235,4 +235,4 @@ class ReflectionCallable(IReflectionCallable):
235
235
  the callable and determine which dependencies are satisfied and
236
236
  which remain unresolved for dependency injection purposes.
237
237
  """
238
- return ReflectDependencies().getCallableDependencies(self.__function)
238
+ return ReflectDependencies(self.__function).getCallableDependencies()
@@ -1,8 +1,7 @@
1
1
  from abc import ABC, abstractmethod
2
2
  import inspect
3
3
  from typing import Any, Callable, List, Type
4
- from orionis.services.introspection.dependencies.entities.class_dependencies import ClassDependency
5
- from orionis.services.introspection.dependencies.entities.method_dependencies import MethodDependency
4
+ from orionis.services.introspection.dependencies.entities.resolve_argument import ResolveArguments
6
5
  from orionis.services.introspection.instances.reflection import ReflectionInstance
7
6
 
8
7
  class IReflectionConcrete(ABC):
@@ -952,13 +951,13 @@ class IReflectionConcrete(ABC):
952
951
  pass
953
952
 
954
953
  @abstractmethod
955
- def getConstructorDependencies(self) -> ClassDependency:
954
+ def getConstructorDependencies(self) -> ResolveArguments:
956
955
  """
957
956
  Get the resolved and unresolved dependencies from the constructor of the instance's class.
958
957
 
959
958
  Returns
960
959
  -------
961
- ClassDependency
960
+ ResolveArguments
962
961
  A structured representation of the constructor dependencies, containing:
963
962
  - resolved: Dictionary of resolved dependencies with their names and values.
964
963
  - unresolved: List of unresolved dependencies (parameter names without default values or annotations).
@@ -966,7 +965,7 @@ class IReflectionConcrete(ABC):
966
965
  pass
967
966
 
968
967
  @abstractmethod
969
- def getMethodDependencies(self, method_name: str) -> MethodDependency:
968
+ def getMethodDependencies(self, method_name: str) -> ResolveArguments:
970
969
  """
971
970
  Get the resolved and unresolved dependencies from a method of the instance's class.
972
971
 
@@ -977,7 +976,7 @@ class IReflectionConcrete(ABC):
977
976
 
978
977
  Returns
979
978
  -------
980
- MethodDependency
979
+ ResolveArguments
981
980
  A structured representation of the method dependencies, containing:
982
981
  - resolved: Dictionary of resolved dependencies with their names and values.
983
982
  - unresolved: List of unresolved dependencies (parameter names without default values or annotations).
@@ -4,8 +4,7 @@ import keyword
4
4
  from typing import Any, Callable, List, Type
5
5
  from orionis.services.asynchrony.coroutines import Coroutine
6
6
  from orionis.services.introspection.concretes.contracts.reflection import IReflectionConcrete
7
- from orionis.services.introspection.dependencies.entities.class_dependencies import ClassDependency
8
- from orionis.services.introspection.dependencies.entities.method_dependencies import MethodDependency
7
+ from orionis.services.introspection.dependencies.entities.resolve_argument import ResolveArguments
9
8
  from orionis.services.introspection.dependencies.reflection import ReflectDependencies
10
9
  from orionis.services.introspection.exceptions import (
11
10
  ReflectionAttributeError,
@@ -1538,7 +1537,7 @@ class ReflectionConcrete(IReflectionConcrete):
1538
1537
  """
1539
1538
  return inspect.signature(self._concrete.__init__)
1540
1539
 
1541
- def getConstructorDependencies(self) -> ClassDependency:
1540
+ def getConstructorDependencies(self) -> ResolveArguments:
1542
1541
  """
1543
1542
  Get dependency analysis for the class constructor.
1544
1543
 
@@ -1547,14 +1546,14 @@ class ReflectionConcrete(IReflectionConcrete):
1547
1546
 
1548
1547
  Returns
1549
1548
  -------
1550
- ClassDependency
1549
+ ResolveArguments
1551
1550
  A structured representation containing resolved dependencies
1552
1551
  (with default values/annotations) and unresolved dependencies
1553
1552
  (parameters without defaults or type information).
1554
1553
  """
1555
1554
  return ReflectDependencies(self._concrete).getConstructorDependencies()
1556
1555
 
1557
- def getMethodDependencies(self, method_name: str) -> MethodDependency:
1556
+ def getMethodDependencies(self, method_name: str) -> ResolveArguments:
1558
1557
  """
1559
1558
  Get dependency analysis for a specific method.
1560
1559
 
@@ -1568,7 +1567,7 @@ class ReflectionConcrete(IReflectionConcrete):
1568
1567
 
1569
1568
  Returns
1570
1569
  -------
1571
- MethodDependency
1570
+ ResolveArguments
1572
1571
  A structured representation containing resolved dependencies
1573
1572
  (with default values/annotations) and unresolved dependencies
1574
1573
  (parameters without defaults or type information).
@@ -1,6 +1,5 @@
1
1
  from abc import ABC, abstractmethod
2
- from orionis.services.introspection.dependencies.entities.class_dependencies import ClassDependency
3
- from orionis.services.introspection.dependencies.entities.method_dependencies import MethodDependency
2
+ from orionis.services.introspection.dependencies.entities.resolve_argument import ResolveArguments
4
3
 
5
4
  class IReflectDependencies(ABC):
6
5
  """
@@ -12,41 +11,106 @@ class IReflectDependencies(ABC):
12
11
  """
13
12
 
14
13
  @abstractmethod
15
- def getConstructorDependencies(self) -> ClassDependency:
14
+ def getConstructorDependencies(self) -> ResolveArguments:
16
15
  """
17
- Retrieve dependency information from the class constructor.
16
+ Inspects the constructor (__init__) method of the target class to identify and categorize
17
+ its parameter dependencies into resolved and unresolved categories.
18
+
19
+ This method analyzes the constructor's signature to determine which parameters can be
20
+ automatically resolved (those with type annotations or default values) and which require
21
+ explicit provision during instantiation.
18
22
 
19
23
  Returns
20
24
  -------
21
- ClassDependency
22
- An object containing details about the constructor's dependencies.
23
- The object includes:
24
- - resolved : dict
25
- Mapping of dependency names to their resolved values.
26
- - unresolved : list
27
- List of dependency names that are unresolved (i.e., lacking
28
- default values or type annotations).
25
+ ResolveArguments
26
+ An object containing two dictionaries:
27
+ - resolved: Dict[str, Argument] mapping parameter names to Argument objects for
28
+ parameters that have type annotations or default values and can be automatically resolved.
29
+ - unresolved: Dict[str, Argument] mapping parameter names to Argument objects for
30
+ parameters that lack both type annotations and default values, requiring manual resolution.
31
+
32
+ Raises
33
+ ------
34
+ ReflectionValueError
35
+ If the target object's constructor signature cannot be inspected or if the target
36
+ is not callable.
37
+
38
+ Notes
39
+ -----
40
+ Parameters named 'self', 'cls', 'args', 'kwargs', and variadic parameters (*args, **kwargs)
41
+ are automatically excluded from dependency analysis as they are not relevant for
42
+ dependency injection purposes.
29
43
  """
30
44
  pass
31
45
 
32
- def getMethodDependencies(self, method_name: str) -> MethodDependency:
46
+ @abstractmethod
47
+ def getMethodDependencies(self, method_name: str) -> ResolveArguments:
33
48
  """
34
- Retrieve dependency information from a specified method.
49
+ Inspects a specific method of the target class to identify and categorize
50
+ its parameter dependencies into resolved and unresolved categories.
51
+
52
+ This method analyzes the specified method's signature to determine which parameters
53
+ can be automatically resolved (those with type annotations or default values) and
54
+ which require explicit provision during method invocation.
35
55
 
36
56
  Parameters
37
57
  ----------
38
58
  method_name : str
39
- The name of the method whose dependencies are to be inspected.
59
+ The name of the method within the target class to inspect for dependencies.
60
+ The method must exist as an attribute of the target object.
40
61
 
41
62
  Returns
42
63
  -------
43
- MethodDependency
44
- An object containing details about the method's dependencies.
45
- The object includes:
46
- - resolved : dict
47
- Mapping of dependency names to their resolved values.
48
- - unresolved : list
49
- List of dependency names that are unresolved (i.e., lacking
50
- default values or type annotations).
64
+ ResolveArguments
65
+ An object containing two dictionaries:
66
+ - resolved: Dict[str, Argument] mapping parameter names to Argument objects for
67
+ parameters that have type annotations or default values and can be automatically resolved.
68
+ - unresolved: Dict[str, Argument] mapping parameter names to Argument objects for
69
+ parameters that lack both type annotations and default values, requiring manual resolution.
70
+
71
+ Raises
72
+ ------
73
+ ReflectionValueError
74
+ If the specified method does not exist on the target object, if the method's
75
+ signature cannot be inspected, or if the target is not callable.
76
+ AttributeError
77
+ If the method_name does not correspond to an existing attribute on the target object.
78
+
79
+ Notes
80
+ -----
81
+ Parameters named 'self', 'cls', 'args', 'kwargs', and variadic parameters (*args, **kwargs)
82
+ are automatically excluded from dependency analysis as they are not relevant for
83
+ dependency injection purposes.
84
+ """
85
+ pass
86
+
87
+ def getCallableDependencies(self) -> ResolveArguments:
88
+ """
89
+ Inspects a callable target (function, lambda, or other callable object) to identify
90
+ and categorize its parameter dependencies into resolved and unresolved categories.
91
+
92
+ This method analyzes the callable's signature to determine which parameters can be
93
+ automatically resolved (those with type annotations or default values) and which
94
+ require explicit provision during function invocation.
95
+
96
+ Returns
97
+ -------
98
+ ResolveArguments
99
+ An object containing two dictionaries:
100
+ - resolved: Dict[str, Argument] mapping parameter names to Argument objects for
101
+ parameters that have type annotations or default values and can be automatically resolved.
102
+ - unresolved: Dict[str, Argument] mapping parameter names to Argument objects for
103
+ parameters that lack both type annotations and default values, requiring manual resolution.
104
+
105
+ Raises
106
+ ------
107
+ ReflectionValueError
108
+ If the target object is not callable or if the callable's signature cannot be inspected.
109
+
110
+ Notes
111
+ -----
112
+ Parameters named 'self', 'cls', 'args', 'kwargs', and variadic parameters (*args, **kwargs)
113
+ are automatically excluded from dependency analysis as they are not relevant for
114
+ dependency injection purposes.
51
115
  """
52
116
  pass