orionis 0.449.0__py3-none-any.whl → 0.450.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.
@@ -1,22 +1,12 @@
1
1
  import threading
2
- from typing import Any, Callable
2
+ from typing import Any, Callable, Optional
3
3
  from orionis.container.context.manager import ScopeManager
4
4
  from orionis.container.contracts.container import IContainer
5
5
  from orionis.container.entities.binding import Binding
6
6
  from orionis.container.enums.lifetimes import Lifetime
7
7
  from orionis.container.exceptions import OrionisContainerException
8
8
  from orionis.container.resolver.resolver import Resolver
9
- from orionis.container.validators import (
10
- ImplementsAbstractMethods,
11
- IsAbstractClass,
12
- IsCallable,
13
- IsConcreteClass,
14
- IsInstance,
15
- IsNotSubclass,
16
- IsSubclass,
17
- IsValidAlias,
18
- LifetimeValidator
19
- )
9
+ from orionis.container.validators import *
20
10
  from orionis.services.introspection.abstract.reflection import ReflectionAbstract
21
11
  from orionis.services.introspection.callables.reflection import ReflectionCallable
22
12
 
@@ -71,6 +61,7 @@ class Container(IContainer):
71
61
  # This write is protected by the lock, ensuring memory visibility
72
62
  cls._instances[cls] = instance
73
63
 
64
+ # Return the newly created instance
74
65
  return instance
75
66
 
76
67
  def __init__(self) -> None:
@@ -106,7 +97,7 @@ class Container(IContainer):
106
97
  *,
107
98
  alias: str = None,
108
99
  enforce_decoupling: bool = False
109
- ) -> bool:
100
+ ) -> Optional[bool]:
110
101
  """
111
102
  Registers a service with a transient lifetime.
112
103
 
@@ -192,7 +183,7 @@ class Container(IContainer):
192
183
  *,
193
184
  alias: str = None,
194
185
  enforce_decoupling: bool = False
195
- ) -> bool:
186
+ ) -> Optional[bool]:
196
187
  """
197
188
  Registers a service with a singleton lifetime.
198
189
 
@@ -275,7 +266,7 @@ class Container(IContainer):
275
266
  *,
276
267
  alias: str = None,
277
268
  enforce_decoupling: bool = False
278
- ) -> bool:
269
+ ) -> Optional[bool]:
279
270
  """
280
271
  Registers a service with a scoped lifetime.
281
272
 
@@ -358,7 +349,7 @@ class Container(IContainer):
358
349
  *,
359
350
  alias: str = None,
360
351
  enforce_decoupling: bool = False
361
- ) -> bool:
352
+ ) -> Optional[bool]:
362
353
  """
363
354
  Registers an instance of a class or interface in the container.
364
355
  Parameters
@@ -438,7 +429,7 @@ class Container(IContainer):
438
429
  fn: Callable[..., Any],
439
430
  *,
440
431
  lifetime: Lifetime = Lifetime.TRANSIENT
441
- ) -> bool:
432
+ ) -> Optional[bool]:
442
433
  """
443
434
  Registers a function or factory under a given alias.
444
435
 
@@ -527,21 +518,54 @@ class Container(IContainer):
527
518
  def getBinding(
528
519
  self,
529
520
  abstract_or_alias: Any
530
- ) -> Binding:
521
+ ) -> Optional[Binding]:
531
522
  """
532
523
  Retrieves the binding for the requested abstract type or alias.
533
524
 
525
+ This method performs a lookup in the container's internal binding dictionaries
526
+ to find the binding associated with the provided abstract type or alias.
527
+ It first searches in the primary bindings dictionary, then in the aliases
528
+ dictionary if no direct binding is found.
529
+
534
530
  Parameters
535
531
  ----------
536
532
  abstract_or_alias : Any
537
- The abstract class, interface, or alias (str) to retrieve.
533
+ The abstract class, interface, or alias (str) to retrieve the binding for.
534
+ This can be either a class type or a string alias that was registered
535
+ with the container.
538
536
 
539
537
  Returns
540
538
  -------
541
- Binding
542
- The binding associated with the requested abstract type or alias.
539
+ Binding or None
540
+ The binding object associated with the requested abstract type or alias.
541
+ Returns None if no binding is found for the provided abstract_or_alias.
542
+ The binding contains information about the service registration including
543
+ the concrete implementation, lifetime, and other configuration details.
544
+
545
+ Notes
546
+ -----
547
+ The method searches in the following order:
548
+ 1. Direct lookup in the bindings dictionary using the abstract type
549
+ 2. Lookup in the aliases dictionary using the provided alias
550
+
551
+ This method does not raise exceptions for missing bindings; it returns None
552
+ instead, allowing the caller to handle the absence of a binding appropriately.
543
553
  """
544
- return self.__bindings.get(abstract_or_alias) or self.__aliasses.get(abstract_or_alias)
554
+
555
+ # First, attempt to find the binding directly using the abstract type
556
+ # This handles cases where the service was registered with its abstract class
557
+ binding = self.__bindings.get(abstract_or_alias)
558
+ if binding:
559
+ return binding
560
+
561
+ # If no direct binding found, search in the aliases dictionary
562
+ # This handles cases where the service is being requested by its alias
563
+ binding = self.__aliasses.get(abstract_or_alias)
564
+ if binding:
565
+ return binding
566
+
567
+ # Return None if no binding is found for the requested abstract type or alias
568
+ return None
545
569
 
546
570
  def drop(
547
571
  self,
@@ -6,7 +6,7 @@ class ScopedContext:
6
6
  """
7
7
 
8
8
  _active_scope = contextvars.ContextVar(
9
- "orionis_context_scope",
9
+ "x-orionis-container-context-scope",
10
10
  default=None
11
11
  )
12
12
 
@@ -5,7 +5,7 @@
5
5
  NAME = "orionis"
6
6
 
7
7
  # Current version of the framework
8
- VERSION = "0.449.0"
8
+ VERSION = "0.450.0"
9
9
 
10
10
  # Full name of the author or maintainer of the project
11
11
  AUTHOR = "Raul Mauricio Uñate Castro"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orionis
3
- Version: 0.449.0
3
+ Version: 0.450.0
4
4
  Summary: Orionis Framework – Elegant, Fast, and Powerful.
5
5
  Home-page: https://github.com/orionis-framework/framework
6
6
  Author: Raul Mauricio Uñate Castro
@@ -36,10 +36,10 @@ orionis/console/output/contracts/executor.py,sha256=7l3kwnvv6GlH9EYk0v94YE1olex_
36
36
  orionis/console/output/enums/__init__.py,sha256=LAaAxg-DpArCjf_jqZ0_9s3p8899gntDYkSU_ppTdC8,66
37
37
  orionis/console/output/enums/styles.py,sha256=6a4oQCOBOKMh2ARdeq5GlIskJ3wjiylYmh66tUKKmpQ,4053
38
38
  orionis/container/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
39
- orionis/container/container.py,sha256=ICKSeaXA_IL15jV6Ofe1wIb1QyX-F-8oaGuk7hj955I,22773
39
+ orionis/container/container.py,sha256=cF9iu-Q8CMllnDTTL8DnJBcr40GgET6SG2ITnzirWDI,24366
40
40
  orionis/container/context/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
41
  orionis/container/context/manager.py,sha256=I08K_jKXSKmrq18Pv33qYyMKIlAovVOwIgmfiVm-J7c,2971
42
- orionis/container/context/scope.py,sha256=_qwGMLV_zPVEvxESY18PCY8FS7AsSg_NlflwWGyOYOw,1143
42
+ orionis/container/context/scope.py,sha256=p_oCzR7dDz-5ZAd16ab4vfLc3gBf34CaN0f4iR9D0bQ,1155
43
43
  orionis/container/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
44
44
  orionis/container/contracts/container.py,sha256=QV_seo8mKrZJG2Ytr2u0RSiRaTaSPw6zUxgJ_tq6oP4,8301
45
45
  orionis/container/contracts/resolver.py,sha256=cbzzLvUuv5FD8DHnjs8VGCjDnCHXPWezRPHS_qr93xs,3193
@@ -181,7 +181,7 @@ orionis/foundation/providers/progress_bar_provider.py,sha256=X4Ke7mPr0MgVp6WDNaQ
181
181
  orionis/foundation/providers/testing_provider.py,sha256=YTubcNnWrG3SPx5NM5HgYefvUYoXdlzXcjljnjavUwM,6462
182
182
  orionis/foundation/providers/workers_provider.py,sha256=5CvlUETdIblh7Wx8pT0MswTeTCGhYah-EvFqOrLu8Mo,4113
183
183
  orionis/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
184
- orionis/metadata/framework.py,sha256=0G9f0nfa5xLDZkU7zSFNtjf5kUF9WlHCUBWupRMxfbI,4088
184
+ orionis/metadata/framework.py,sha256=SwwdGkSoqfg2mdA0GAeC1WFurIhx9-TS526fHUrN7AU,4088
185
185
  orionis/metadata/package.py,sha256=k7Yriyp5aUcR-iR8SK2ec_lf0_Cyc-C7JczgXa-I67w,16039
186
186
  orionis/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
187
187
  orionis/services/asynchrony/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -347,7 +347,7 @@ orionis/test/validators/web_report.py,sha256=n9BfzOZz6aEiNTypXcwuWbFRG0OdHNSmCNu
347
347
  orionis/test/validators/workers.py,sha256=rWcdRexINNEmGaO7mnc1MKUxkHKxrTsVuHgbnIfJYgc,1206
348
348
  orionis/test/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
349
349
  orionis/test/view/render.py,sha256=f-zNhtKSg9R5Njqujbg2l2amAs2-mRVESneLIkWOZjU,4082
350
- orionis-0.449.0.dist-info/licenses/LICENCE,sha256=JhC-z_9mbpUrCfPjcl3DhDA8trNDMzb57cvRSam1avc,1463
350
+ orionis-0.450.0.dist-info/licenses/LICENCE,sha256=JhC-z_9mbpUrCfPjcl3DhDA8trNDMzb57cvRSam1avc,1463
351
351
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
352
352
  tests/container/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
353
353
  tests/container/context/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -491,8 +491,8 @@ tests/testing/validators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
491
491
  tests/testing/validators/test_testing_validators.py,sha256=WPo5GxTP6xE-Dw3X1vZoqOMpb6HhokjNSbgDsDRDvy4,16588
492
492
  tests/testing/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
493
493
  tests/testing/view/test_render.py,sha256=tnnMBwS0iKUIbogLvu-7Rii50G6Koddp3XT4wgdFEYM,1050
494
- orionis-0.449.0.dist-info/METADATA,sha256=Kia9-lqn-tR4K7i-mUN6aGDnKF4936Dx7PVc6G80tcE,4772
495
- orionis-0.449.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
496
- orionis-0.449.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
497
- orionis-0.449.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
498
- orionis-0.449.0.dist-info/RECORD,,
494
+ orionis-0.450.0.dist-info/METADATA,sha256=yCYH8b-NPXkXb-GpHWqk9jBq5yC5FGXbxk0pvDUmVqI,4772
495
+ orionis-0.450.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
496
+ orionis-0.450.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
497
+ orionis-0.450.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
498
+ orionis-0.450.0.dist-info/RECORD,,