orionis 0.299.0__py3-none-any.whl → 0.300.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.
@@ -219,7 +219,7 @@ class ReflectionInstance(IReflectionInstance):
219
219
 
220
220
  # Ensure the value is not callable
221
221
  if callable(value):
222
- raise ReflectionAttributeError(f"Cannot set attribute '{name}' to a callable. Use setMacro instead.")
222
+ raise ReflectionAttributeError(f"Cannot set attribute '{name}' to a callable. Use setMethod instead.")
223
223
 
224
224
  # Handle private attribute name mangling
225
225
  if name.startswith("__") and not name.endswith("__"):
@@ -379,23 +379,7 @@ class ReflectionInstance(IReflectionInstance):
379
379
  bool
380
380
  True if the method exists, False otherwise
381
381
  """
382
- # Handle private method name mangling
383
- if name.startswith("__") and not name.endswith("__"):
384
- class_name = self.getClassName()
385
- name = f"_{class_name}{name}"
386
-
387
- # Check if the method is callable
388
- if hasattr(self._instance, name):
389
- return callable(getattr(self._instance, name, None))
390
-
391
- # Check if the method is a class method or static method
392
- cls = self._instance.__class__
393
- if hasattr(cls, name):
394
- attr = inspect.getattr_static(cls, name)
395
- return isinstance(attr, (classmethod, staticmethod)) and callable(attr.__func__)
396
-
397
- # If not found, return False
398
- return False
382
+ return name in self.getMethods()
399
383
 
400
384
  def callMethod(self, name: str, *args: Any, **kwargs: Any) -> Any:
401
385
  """
@@ -451,15 +435,15 @@ class ReflectionInstance(IReflectionInstance):
451
435
  # Call the method with provided arguments
452
436
  return method(*args, **kwargs)
453
437
 
454
- def setMethod(self, name: str, value: Callable) -> bool:
438
+ def setMethod(self, name: str, method: Callable) -> bool:
455
439
  """
456
- Set a callable attribute value.
440
+ Set a callable attribute method.
457
441
 
458
442
  Parameters
459
443
  ----------
460
444
  name : str
461
445
  The attribute name
462
- value : Callable
446
+ method : Callable
463
447
  The callable to set
464
448
 
465
449
  Raises
@@ -471,10 +455,26 @@ class ReflectionInstance(IReflectionInstance):
471
455
  if not isinstance(name, str) or not name.isidentifier() or keyword.iskeyword(name):
472
456
  raise ReflectionAttributeError(f"Invalid method name '{name}'. Must be a valid Python identifier and not a keyword.")
473
457
 
474
- # Ensure the value is callable
475
- if not callable(value):
458
+ # Ensure the method is callable
459
+ if not callable(method):
476
460
  raise ReflectionAttributeError(f"Cannot set attribute '{name}' to a non-callable value.")
477
461
 
462
+ # Extarct the signature of the method and classtype
463
+ sign = inspect.signature(method)
464
+ classtype = self.getClass()
465
+
466
+ # Check first parameter is 'cls'
467
+ params = list(sign.parameters.values())
468
+ if not params or params[0].name != "cls":
469
+ raise ReflectionAttributeError(f"The first (or only) argument of the method must be named 'cls' and must be of type {classtype}.")
470
+
471
+ # Get the expected type from the first parameter's annotation
472
+ annotation = params[0].annotation
473
+ if annotation != classtype:
474
+ raise ReflectionAttributeError(
475
+ f"The first argument has an incorrect annotation. Expected '{classtype}', but got '{annotation}'."
476
+ )
477
+
478
478
  # Handle private method name mangling
479
479
  if name.startswith("__") and not name.endswith("__"):
480
480
  class_name = self.getClassName()
@@ -485,7 +485,7 @@ class ReflectionInstance(IReflectionInstance):
485
485
  raise ReflectionAttributeError(f"Attribute '{name}' already exists on '{self.getClassName()}'.")
486
486
 
487
487
  # Set the method on the instance
488
- setattr(self._instance, name, value)
488
+ setattr(self._instance.__class__, name, method)
489
489
 
490
490
  # Return True
491
491
  return True
@@ -506,7 +506,7 @@ class ReflectionInstance(IReflectionInstance):
506
506
  """
507
507
  if not self.hasMethod(name):
508
508
  raise ReflectionAttributeError(f"Method '{name}' does not exist on '{self.getClassName()}'.")
509
- delattr(self._instance, name)
509
+ delattr(self._instance.__class__, name)
510
510
 
511
511
  def getMethodSignature(self, name: str) -> inspect.Signature:
512
512
  """
@@ -528,7 +528,7 @@ class ReflectionInstance(IReflectionInstance):
528
528
  name = f"_{self.getClassName()}{name}"
529
529
 
530
530
  # Check if the method exists and is callable
531
- method = getattr(self._instance, name)
531
+ method = getattr(self._instance.__class__, name)
532
532
  if callable(method):
533
533
  return inspect.signature(method)
534
534
 
@@ -573,7 +573,7 @@ class ReflectionInstance(IReflectionInstance):
573
573
  class_methods = set()
574
574
  for name in dir(cls):
575
575
  attr = inspect.getattr_static(cls, name)
576
- if isinstance(attr, classmethod):
576
+ if isinstance(attr, (staticmethod, classmethod)):
577
577
  class_methods.add(name)
578
578
 
579
579
  # Collect public instance methods (not static, not class, not private/protected/magic)
@@ -622,9 +622,14 @@ class ReflectionInstance(IReflectionInstance):
622
622
  List of protected method names
623
623
  """
624
624
  protected_methods = []
625
+ cls = self._instance.__class__
625
626
 
626
627
  # Collect protected instance methods (starting with a single underscore)
627
628
  for name, method in inspect.getmembers(self._instance, predicate=inspect.ismethod):
629
+ # Skip static and class methods
630
+ attr = inspect.getattr_static(cls, name)
631
+ if isinstance(attr, (staticmethod, classmethod)):
632
+ continue
628
633
  if name.startswith("_") and not name.startswith("__") and not name.startswith(f"_{self.getClassName()}"):
629
634
  protected_methods.append(name)
630
635
 
@@ -665,9 +670,13 @@ class ReflectionInstance(IReflectionInstance):
665
670
  """
666
671
  class_name = self.getClassName()
667
672
  private_methods = []
673
+ cls = self._instance.__class__
668
674
 
669
675
  # Collect private instance methods (starting with class name)
670
676
  for name, method in inspect.getmembers(self._instance, predicate=inspect.ismethod):
677
+ attr = inspect.getattr_static(cls, name)
678
+ if isinstance(attr, (staticmethod, classmethod)):
679
+ continue
671
680
  if name.startswith(f"_{class_name}") and not name.startswith("__"):
672
681
  private_methods.append(name.replace(f"_{class_name}", ""))
673
682
 
@@ -685,7 +694,12 @@ class ReflectionInstance(IReflectionInstance):
685
694
  """
686
695
  class_name = self.getClassName()
687
696
  private_methods = []
697
+ cls = self._instance.__class__
698
+
688
699
  for name, method in inspect.getmembers(self._instance, predicate=inspect.ismethod):
700
+ attr = inspect.getattr_static(cls, name)
701
+ if isinstance(attr, (staticmethod, classmethod)):
702
+ continue
689
703
  if name.startswith(f"_{class_name}") and not name.startswith("__"):
690
704
  # Remove the class name prefix for the returned name
691
705
  short_name = name.replace(f"_{class_name}", "")
@@ -704,7 +718,12 @@ class ReflectionInstance(IReflectionInstance):
704
718
  """
705
719
  class_name = self.getClassName()
706
720
  private_methods = []
721
+ cls = self._instance.__class__
722
+
707
723
  for name, method in inspect.getmembers(self._instance, predicate=inspect.ismethod):
724
+ attr = inspect.getattr_static(cls, name)
725
+ if isinstance(attr, (staticmethod, classmethod)):
726
+ continue
708
727
  if name.startswith(f"_{class_name}") and not name.startswith("__"):
709
728
  # Remove the class name prefix for the returned name
710
729
  short_name = name.replace(f"_{class_name}", "")
@@ -1259,9 +1278,12 @@ class ReflectionInstance(IReflectionInstance):
1259
1278
  List of dunder method names
1260
1279
  """
1261
1280
  dunder_methods = []
1281
+ exclude = []
1262
1282
 
1263
1283
  # Collect dunder methods (starting and ending with double underscores)
1264
1284
  for name in dir(self._instance):
1285
+ if name in exclude:
1286
+ continue
1265
1287
  if name.startswith("__") and name.endswith("__"):
1266
1288
  dunder_methods.append(name)
1267
1289
 
@@ -1278,7 +1300,7 @@ class ReflectionInstance(IReflectionInstance):
1278
1300
  """
1279
1301
  return self.getDunderMethods()
1280
1302
 
1281
- def getProperties(self) -> Dict:
1303
+ def getProperties(self) -> List:
1282
1304
  """
1283
1305
  Get all properties of the instance.
1284
1306
 
@@ -1288,59 +1310,60 @@ class ReflectionInstance(IReflectionInstance):
1288
1310
  List of property names
1289
1311
  """
1290
1312
 
1291
- properties = {}
1313
+ properties = []
1292
1314
  for name, prop in self._instance.__class__.__dict__.items():
1293
1315
  if isinstance(prop, property):
1294
- name = name.replace(f"_{self.getClassName()}", "")
1295
- properties[name] = getattr(self._instance, name, None)
1316
+ name_prop = name.replace(f"_{self.getClassName()}", "")
1317
+ properties.append(name_prop)
1296
1318
  return properties
1297
1319
 
1298
- def getPublicProperties(self) -> Dict:
1320
+ def getPublicProperties(self) -> List:
1299
1321
  """
1300
1322
  Get all public properties of the instance.
1301
1323
 
1302
1324
  Returns
1303
1325
  -------
1304
- Dict[str]
1305
- Dictionary of public property names and their values
1326
+ List:
1327
+ List of public property names and their values
1306
1328
  """
1307
- properties = {}
1329
+ properties = []
1330
+ cls_name = self.getClassName()
1308
1331
  for name, prop in self._instance.__class__.__dict__.items():
1309
1332
  if isinstance(prop, property):
1310
- if not name.startswith(f"_"):
1311
- properties[name] = getattr(self._instance, name, None)
1333
+ if not name.startswith(f"_") and not name.startswith(f"_{cls_name}"):
1334
+ properties.append(name.replace(f"_{cls_name}", ""))
1312
1335
  return properties
1313
1336
 
1314
- def getProtectedProperties(self) -> Dict:
1337
+ def getProtectedProperties(self) -> List:
1315
1338
  """
1316
1339
  Get all protected properties of the instance.
1317
1340
 
1318
1341
  Returns
1319
1342
  -------
1320
- Dict[str]
1321
- Dictionary of protected property names and their values
1343
+ List
1344
+ List of protected property names and their values
1322
1345
  """
1323
- properties = {}
1346
+ properties = []
1324
1347
  for name, prop in self._instance.__class__.__dict__.items():
1325
1348
  if isinstance(prop, property):
1326
1349
  if name.startswith(f"_") and not name.startswith("__") and not name.startswith(f"_{self.getClassName()}"):
1327
- properties[name] = getattr(self._instance, name, None)
1350
+ properties.append(name)
1328
1351
  return properties
1329
1352
 
1330
- def getPrivateProperties(self) -> Dict:
1353
+ def getPrivateProperties(self) -> List:
1331
1354
  """
1332
1355
  Get all private properties of the instance.
1333
1356
 
1334
1357
  Returns
1335
1358
  -------
1336
- Dict[str]
1337
- Dictionary of private property names and their values
1359
+ List
1360
+ List of private property names and their values
1338
1361
  """
1339
- properties = {}
1362
+ properties = []
1340
1363
  for name, prop in self._instance.__class__.__dict__.items():
1341
1364
  if isinstance(prop, property):
1342
1365
  if name.startswith(f"_{self.getClassName()}") and not name.startswith("__"):
1343
- properties[name.replace(f"_{self.getClassName()}", "")] = getattr(self._instance, name, None)
1366
+ properties.append(name.replace(f"_{self.getClassName()}", ""))
1344
1367
  return properties
1345
1368
 
1346
1369
  def getPropierty(self, name: str) -> Any:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orionis
3
- Version: 0.299.0
3
+ Version: 0.300.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
@@ -226,7 +226,7 @@ orionis/foundation/config/testing/entities/testing.py,sha256=AuhPU9O15Aeqs8jQVHW
226
226
  orionis/foundation/config/testing/enums/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
227
227
  orionis/foundation/config/testing/enums/test_mode.py,sha256=IbFpauu7J-iSAfmC8jDbmTEYl8eZr-AexL-lyOh8_74,337
228
228
  orionis/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
229
- orionis/metadata/framework.py,sha256=V0Njw6A_n77pfzcsuWrz9OHH5PO8Y2DrOHT7w8Yq2lw,4960
229
+ orionis/metadata/framework.py,sha256=R-JsoGLrxcrd1Lg3XxLUWlT6tmNZ4uyXPhYfASmQP3A,4960
230
230
  orionis/metadata/package.py,sha256=tqLfBRo-w1j_GN4xvzUNFyweWYFS-qhSgAEc-AmCH1M,5452
231
231
  orionis/patterns/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
232
232
  orionis/patterns/singleton/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -249,6 +249,8 @@ orionis/services/environment/exceptions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5J
249
249
  orionis/services/environment/exceptions/environment_value_error.py,sha256=Y3QTwzUrn0D5FqT7hI_9uCACVz473YhhoAFOx1-rcXE,627
250
250
  orionis/services/environment/exceptions/environment_value_exception.py,sha256=zlxRFJwi0Yj-xFHQUvZ8X1ZlxRDDVv7Xcw-w4qCocL4,646
251
251
  orionis/services/introspection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
252
+ orionis/services/introspection/concretes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
253
+ orionis/services/introspection/concretes/reflection_concrete.py,sha256=5vCwokfKJerpUnFRz_IVDMj-5BdbbIy4OUkTJ7KxB4E,49050
252
254
  orionis/services/introspection/dependencies/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
253
255
  orionis/services/introspection/dependencies/reflect_dependencies.py,sha256=HL2cX7_SSIWeKxzBDUMEdmfjetrZmMfPZvqM34DvJMg,7145
254
256
  orionis/services/introspection/dependencies/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -262,7 +264,7 @@ orionis/services/introspection/exceptions/reflection_attribute_error.py,sha256=7
262
264
  orionis/services/introspection/exceptions/reflection_type_error.py,sha256=6BizQOgt50qlLPDBvBJfUWgAwAr_8GAk1FhownPs-8A,747
263
265
  orionis/services/introspection/exceptions/reflection_value_error.py,sha256=X38649JMKSPbdpa1lmo69RhhTATH8ykTF-UAqe7IAaU,748
264
266
  orionis/services/introspection/instances/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
265
- orionis/services/introspection/instances/reflection_instance.py,sha256=EXs9CNH8n09LsEc3kB0jhim4n6qFSE5z_6pmoJdMAi0,50832
267
+ orionis/services/introspection/instances/reflection_instance.py,sha256=j8VA7zIfIZbz4orMxcBWU9qCxZi4eC5glu9tlUKjMXI,51807
266
268
  orionis/services/introspection/instances/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
267
269
  orionis/services/introspection/instances/contracts/reflection_instance.py,sha256=zc-uOHDixR4Wg2PwF4mX9lpl-AGMKtMvJUN7_Pixr2Q,20938
268
270
  orionis/services/parsers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -353,7 +355,7 @@ orionis/test/suites/contracts/test_suite.py,sha256=eluzYwkNBbKjxYStj_tHN_Fm3YDPp
353
355
  orionis/test/suites/contracts/test_unit.py,sha256=l1LQllODyvcSByXMl1lGrUkoLsXbBHZZLWZI4A-mlQg,5881
354
356
  orionis/test/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
355
357
  orionis/test/view/render.py,sha256=jXZkbITBknbUwm_mD8bcTiwLDvsFkrO9qrf0ZgPwqxc,4903
356
- orionis-0.299.0.dist-info/licenses/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
358
+ orionis-0.300.0.dist-info/licenses/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
357
359
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
358
360
  tests/example/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
359
361
  tests/example/test_example.py,sha256=vt4UsQ1sDWZU9zFjrO2zcfZNDFj8h9TgnCRGtdNN358,601
@@ -450,15 +452,15 @@ tests/support/inspection/test_reflection_concrete_with_abstract.py,sha256=Qzd87J
450
452
  tests/support/inspection/test_reflection_instance_with_abstract.py,sha256=L3nQy2l95yEIyvAHErqxGRVVF5x8YkyM82uGm0wUlxk,4064
451
453
  tests/support/inspection/fakes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
452
454
  tests/support/inspection/fakes/fake_reflect_abstract.py,sha256=woE15uLmoD3fLgPBMjNh5XkwvMDmW2VDbADYPIS_88o,6387
453
- tests/support/inspection/fakes/fake_reflect_instance.py,sha256=E2omio0BHq6uzPHPj90mLkWLqeDXWubV0ZBmbv-9LYQ,5069
455
+ tests/support/inspection/fakes/fake_reflect_instance.py,sha256=g2Uo0aSAOnro0t4ipoFsEAE2WunpOwTN3WaNlsX5k0g,12397
454
456
  tests/support/inspection/fakes/fake_reflection_concrete.py,sha256=j6gzsxE3xq5oJ30H_Hm1RsUwEY3jOYBu4sclxtD1ayo,1047
455
457
  tests/support/inspection/fakes/fake_reflection_concrete_with_abstract.py,sha256=ibCjrtNM6BMf5Z5VMvat7E6zOAk5g9z--gj4ykKJWY8,2118
456
458
  tests/support/inspection/fakes/fake_reflection_instance_with_abstract.py,sha256=SfL8FuFmr650RlzXTrP4tGMfsPVZLhOxVnBXu_g1POg,1471
457
459
  tests/testing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
458
460
  tests/testing/test_testing_result.py,sha256=MrGK3ZimedL0b5Ydu69Dg8Iul017AzLTm7VPxpXlpfU,4315
459
461
  tests/testing/test_testing_unit.py,sha256=A6QkiOkP7GPC1Szh_GqsrV7GxjWjK8cIwFez6YfrzmM,7683
460
- orionis-0.299.0.dist-info/METADATA,sha256=PjQHJoRlvFmjKkrTsGZK8VNV-SJRbO12VsBeS5QRKVU,4772
461
- orionis-0.299.0.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
462
- orionis-0.299.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
463
- orionis-0.299.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
464
- orionis-0.299.0.dist-info/RECORD,,
462
+ orionis-0.300.0.dist-info/METADATA,sha256=RPubn8dwFyV0kTRUWgJOWGixxR86EorukI_6qlaa9BI,4772
463
+ orionis-0.300.0.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
464
+ orionis-0.300.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
465
+ orionis-0.300.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
466
+ orionis-0.300.0.dist-info/RECORD,,