orionis 0.304.0__py3-none-any.whl → 0.306.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.
- orionis/metadata/framework.py +1 -1
- orionis/services/introspection/modules/{reflection_instance.py → reflection_module.py} +1 -1
- orionis/services/introspection/reflection.py +90 -0
- orionis/{services → support}/standard/std.py +2 -2
- orionis/test/{facade/test_suite.py → test_suite.py} +1 -2
- orionis/unittesting.py +1 -1
- {orionis-0.304.0.dist-info → orionis-0.306.0.dist-info}/METADATA +1 -1
- {orionis-0.304.0.dist-info → orionis-0.306.0.dist-info}/RECORD +28 -65
- tests/{services → support}/standard/test_services_std.py +3 -3
- tests/{services → support}/wrapper/test_services_wrapper_docdict.py +2 -2
- orionis/support/abstracts/entities/abstract_class_attributes.py +0 -37
- orionis/support/abstracts/reflect_abstract.py +0 -556
- orionis/support/helpers/functions.py +0 -285
- orionis/support/introspection/container_integrity.py +0 -292
- orionis/support/introspection/contracts/__init__.py +0 -0
- orionis/support/introspection/contracts/reflection.py +0 -187
- orionis/support/introspection/contracts/reflexion_abstract.py +0 -264
- orionis/support/introspection/helpers/__init__.py +0 -0
- orionis/support/introspection/helpers/functions.py +0 -281
- orionis/support/introspection/instances/__init__.py +0 -0
- orionis/support/introspection/instances/contracts/__init__.py +0 -0
- orionis/support/introspection/instances/contracts/reflection_instance.py +0 -649
- orionis/support/introspection/instances/entities/__init__.py +0 -0
- orionis/support/introspection/instances/reflection_instance.py +0 -758
- orionis/support/introspection/reflect_decorators.py +0 -335
- orionis/support/introspection/reflection.py +0 -216
- orionis/support/introspection/reflexion_concrete.py +0 -276
- orionis/support/introspection/reflexion_concrete_with_abstract.py +0 -185
- orionis/support/introspection/reflexion_instance_with_abstract.py +0 -230
- orionis/support/introspection/reflexion_module.py +0 -19
- orionis/support/introspection/reflexion_module_with_classname.py +0 -22
- orionis/support/reflection.py +0 -216
- orionis/test/facade/__init__.py +0 -0
- orionis/test/facade/contracts/__init__.py +0 -0
- orionis/test/facade/contracts/test_suite.py +0 -25
- tests/services/standard/__init__.py +0 -0
- tests/services/wrapper/__init__.py +0 -0
- tests/support/inspection/__init__.py +0 -0
- tests/support/inspection/fakes/__init__.py +0 -0
- tests/support/inspection/fakes/fake_reflect_abstract.py +0 -276
- tests/support/inspection/fakes/fake_reflection_concrete.py +0 -44
- tests/support/inspection/fakes/fake_reflection_concrete_with_abstract.py +0 -78
- tests/support/inspection/fakes/fake_reflection_instance_with_abstract.py +0 -45
- tests/support/inspection/test_reflect_abstract.py +0 -334
- tests/support/inspection/test_reflect_instance.py +0 -288
- tests/support/inspection/test_reflection_concrete.py +0 -142
- tests/support/inspection/test_reflection_concrete_with_abstract.py +0 -87
- tests/support/inspection/test_reflection_instance_with_abstract.py +0 -79
- /orionis/services/introspection/modules/contracts/{reflection_instance.py → reflection_module.py} +0 -0
- /orionis/{services → support}/standard/__init__.py +0 -0
- /orionis/{services → support}/standard/contracts/__init__.py +0 -0
- /orionis/{services → support}/standard/contracts/std.py +0 -0
- /orionis/{services → support}/standard/exceptions/__init__.py +0 -0
- /orionis/{services → support}/standard/exceptions/std_value_exception.py +0 -0
- /orionis/{services → support}/wrapper/__init__.py +0 -0
- /orionis/{services → support}/wrapper/dicts/__init__.py +0 -0
- /orionis/{services → support}/wrapper/dicts/dot_dict.py +0 -0
- {orionis-0.304.0.dist-info → orionis-0.306.0.dist-info}/WHEEL +0 -0
- {orionis-0.304.0.dist-info → orionis-0.306.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.304.0.dist-info → orionis-0.306.0.dist-info}/top_level.txt +0 -0
- {orionis-0.304.0.dist-info → orionis-0.306.0.dist-info}/zip-safe +0 -0
- {orionis/support/abstracts → tests/services/inspection/reflection}/__init__.py +0 -0
- {orionis/support/abstracts/entities → tests/services/inspection/reflection/mock}/__init__.py +0 -0
- /tests/{support/inspection/fakes → services/inspection/reflection/mock}/fake_reflect_instance.py +0 -0
- {orionis/support/helpers → tests/support/standard}/__init__.py +0 -0
- {orionis/support/introspection → tests/support/wrapper}/__init__.py +0 -0
@@ -1,19 +0,0 @@
|
|
1
|
-
class ReflexionModule:
|
2
|
-
"""A reflection object encapsulating a module.
|
3
|
-
|
4
|
-
Parameters
|
5
|
-
----------
|
6
|
-
module : str
|
7
|
-
The module name being reflected upon
|
8
|
-
|
9
|
-
Attributes
|
10
|
-
----------
|
11
|
-
_module : str
|
12
|
-
The encapsulated module name
|
13
|
-
"""
|
14
|
-
|
15
|
-
def __init__(self, module: str) -> None:
|
16
|
-
"""Initialize with the module name."""
|
17
|
-
self._module = module
|
18
|
-
|
19
|
-
|
@@ -1,22 +0,0 @@
|
|
1
|
-
class ReflexionModuleWithClassName:
|
2
|
-
"""A reflection object encapsulating a module and a class name.
|
3
|
-
|
4
|
-
Parameters
|
5
|
-
----------
|
6
|
-
module : str
|
7
|
-
The module name being reflected upon
|
8
|
-
class_name : str
|
9
|
-
The class name in the module
|
10
|
-
|
11
|
-
Attributes
|
12
|
-
----------
|
13
|
-
_module : str
|
14
|
-
The encapsulated module name
|
15
|
-
_class_name : str
|
16
|
-
The encapsulated class name
|
17
|
-
"""
|
18
|
-
|
19
|
-
def __init__(self, module: str, class_name: str) -> None:
|
20
|
-
"""Initialize with the module name and class name."""
|
21
|
-
self._module = module
|
22
|
-
self._class_name = class_name
|
orionis/support/reflection.py
DELETED
@@ -1,216 +0,0 @@
|
|
1
|
-
import abc
|
2
|
-
from typing import Any, Type, TypeVar
|
3
|
-
from orionis._contracts.support.reflection import IReflection
|
4
|
-
from orionis.support.introspection.helpers.functions import HelpersReflection
|
5
|
-
from orionis.support.introspection.abstracts.reflect_abstract import ReflexionAbstract
|
6
|
-
from orionis.support.introspection.reflexion_concrete import ReflexionConcrete
|
7
|
-
from orionis.support.introspection.reflexion_concrete_with_abstract import ReflexionConcreteWithAbstract
|
8
|
-
from orionis.support.introspection.instances.reflection_instance import ReflectionInstance
|
9
|
-
from orionis.support.introspection.reflexion_instance_with_abstract import ReflexionInstanceWithAbstract
|
10
|
-
from orionis.support.introspection.reflexion_module import ReflexionModule
|
11
|
-
from orionis.support.introspection.reflexion_module_with_classname import ReflexionModuleWithClassName
|
12
|
-
|
13
|
-
T = TypeVar('T')
|
14
|
-
ABC = TypeVar('ABC', bound=abc.ABC)
|
15
|
-
|
16
|
-
class Reflection(IReflection):
|
17
|
-
"""A static class providing factory methods for creating reflection objects.
|
18
|
-
|
19
|
-
This class provides methods to create various types of reflection objects
|
20
|
-
that encapsulate different aspects of Python's reflection capabilities.
|
21
|
-
Each method validates its inputs before creating the appropriate reflection object.
|
22
|
-
|
23
|
-
Methods
|
24
|
-
-------
|
25
|
-
instance(instance: Any) -> ReflexionInstance
|
26
|
-
Creates a reflection object for a class instance
|
27
|
-
instanceWithAbstract(instance: Any, abstract: Type[ABC]) -> ReflexionInstanceWithAbstract
|
28
|
-
Creates a reflection object for a class instance with its abstract parent
|
29
|
-
abstract(abstract: Type[ABC]) -> ReflexionAbstract
|
30
|
-
Creates a reflection object for an abstract class
|
31
|
-
concrete(concrete: Type[T]) -> ReflexionConcrete
|
32
|
-
Creates a reflection object for a concrete class
|
33
|
-
concreteWithAbstract(concrete: Type[T], abstract: Type[ABC]) -> ReflexionConcreteWithAbstract
|
34
|
-
Creates a reflection object for a concrete class with its abstract parent
|
35
|
-
module(module: str) -> ReflexionModule
|
36
|
-
Creates a reflection object for a module
|
37
|
-
moduleWithClassName(module: str, class_name: str) -> ReflexionModuleWithClassName
|
38
|
-
Creates a reflection object for a module with a specific class name
|
39
|
-
"""
|
40
|
-
|
41
|
-
@staticmethod
|
42
|
-
def instance(instance: Any) -> 'ReflectionInstance':
|
43
|
-
"""Create a reflection object for a class instance.
|
44
|
-
|
45
|
-
Parameters
|
46
|
-
----------
|
47
|
-
instance : Any
|
48
|
-
The instance to reflect upon
|
49
|
-
|
50
|
-
Returns
|
51
|
-
-------
|
52
|
-
ReflectionInstance
|
53
|
-
A reflection object encapsulating the instance
|
54
|
-
|
55
|
-
Raises
|
56
|
-
------
|
57
|
-
TypeError
|
58
|
-
If the input is not an object instance
|
59
|
-
ValueError
|
60
|
-
If the instance is from builtins, abc, or __main__
|
61
|
-
"""
|
62
|
-
HelpersReflection.ensureUserDefinedClassInstance(instance)
|
63
|
-
return ReflectionInstance(instance)
|
64
|
-
|
65
|
-
@staticmethod
|
66
|
-
def instanceWithAbstract(instance: Any, abstract: Type[ABC]) -> 'ReflexionInstanceWithAbstract':
|
67
|
-
"""Create a reflection object for a class instance with its abstract parent.
|
68
|
-
|
69
|
-
Parameters
|
70
|
-
----------
|
71
|
-
instance : Any
|
72
|
-
The instance to reflect upon
|
73
|
-
abstract : Type[ABC]
|
74
|
-
The abstract parent class
|
75
|
-
|
76
|
-
Returns
|
77
|
-
-------
|
78
|
-
ReflexionInstanceWithAbstract
|
79
|
-
A reflection object encapsulating the instance and its abstract parent
|
80
|
-
|
81
|
-
Raises
|
82
|
-
------
|
83
|
-
TypeError
|
84
|
-
If the instance is not an object or abstract is not a class
|
85
|
-
ValueError
|
86
|
-
If the instance is invalid or abstract is not actually abstract
|
87
|
-
"""
|
88
|
-
HelpersReflection.ensureUserDefinedClassInstance(instance)
|
89
|
-
HelpersReflection.ensureAbstractClass(abstract)
|
90
|
-
return ReflexionInstanceWithAbstract(instance, abstract)
|
91
|
-
|
92
|
-
@staticmethod
|
93
|
-
def abstract(abstract: Type[ABC]) -> 'ReflexionAbstract':
|
94
|
-
"""Create a reflection object for an abstract class.
|
95
|
-
|
96
|
-
Parameters
|
97
|
-
----------
|
98
|
-
abstract : Type[ABC]
|
99
|
-
The abstract class to reflect upon
|
100
|
-
|
101
|
-
Returns
|
102
|
-
-------
|
103
|
-
ReflexionAbstract
|
104
|
-
A reflection object encapsulating the abstract class
|
105
|
-
|
106
|
-
Raises
|
107
|
-
------
|
108
|
-
TypeError
|
109
|
-
If the input is not a class
|
110
|
-
ValueError
|
111
|
-
If the class is not abstract
|
112
|
-
"""
|
113
|
-
HelpersReflection.ensureAbstractClass(abstract)
|
114
|
-
return ReflexionAbstract(abstract)
|
115
|
-
|
116
|
-
@staticmethod
|
117
|
-
def concrete(concrete: Type[T]) -> 'ReflexionConcrete':
|
118
|
-
"""Create a reflection object for a concrete class.
|
119
|
-
|
120
|
-
Parameters
|
121
|
-
----------
|
122
|
-
concrete : Type[T]
|
123
|
-
The concrete class to reflect upon
|
124
|
-
|
125
|
-
Returns
|
126
|
-
-------
|
127
|
-
ReflexionConcrete
|
128
|
-
A reflection object encapsulating the concrete class
|
129
|
-
|
130
|
-
Raises
|
131
|
-
------
|
132
|
-
TypeError
|
133
|
-
If the input is not a class
|
134
|
-
ValueError
|
135
|
-
If the class is abstract or cannot be instantiated
|
136
|
-
"""
|
137
|
-
HelpersReflection.ensureInstantiableClass(concrete)
|
138
|
-
return ReflexionConcrete(concrete)
|
139
|
-
|
140
|
-
@staticmethod
|
141
|
-
def concreteWithAbstract(concrete: Type[T], abstract: Type[ABC]) -> 'ReflexionConcreteWithAbstract':
|
142
|
-
"""Create a reflection object for a concrete class with its abstract parent.
|
143
|
-
|
144
|
-
Parameters
|
145
|
-
----------
|
146
|
-
concrete : Type[T]
|
147
|
-
The concrete class to reflect upon
|
148
|
-
abstract : Type[ABC]
|
149
|
-
The abstract parent class
|
150
|
-
|
151
|
-
Returns
|
152
|
-
-------
|
153
|
-
ReflexionConcreteWithAbstract
|
154
|
-
A reflection object encapsulating the concrete class and its abstract parent
|
155
|
-
|
156
|
-
Raises
|
157
|
-
------
|
158
|
-
TypeError
|
159
|
-
If either input is not a class
|
160
|
-
ValueError
|
161
|
-
If concrete is not instantiable or abstract is not actually abstract
|
162
|
-
"""
|
163
|
-
HelpersReflection.ensureInstantiableClass(concrete)
|
164
|
-
HelpersReflection.ensureAbstractClass(abstract)
|
165
|
-
return ReflexionConcreteWithAbstract(concrete, abstract)
|
166
|
-
|
167
|
-
@staticmethod
|
168
|
-
def module(module: str) -> 'ReflexionModule':
|
169
|
-
"""Create a reflection object for a module.
|
170
|
-
|
171
|
-
Parameters
|
172
|
-
----------
|
173
|
-
module : str
|
174
|
-
The module name to reflect upon
|
175
|
-
|
176
|
-
Returns
|
177
|
-
-------
|
178
|
-
ReflexionModule
|
179
|
-
A reflection object encapsulating the module
|
180
|
-
|
181
|
-
Raises
|
182
|
-
------
|
183
|
-
TypeError
|
184
|
-
If the input is not a string
|
185
|
-
ValueError
|
186
|
-
If the module cannot be imported
|
187
|
-
"""
|
188
|
-
HelpersReflection.ensureValidModule(module)
|
189
|
-
return ReflexionModule(module)
|
190
|
-
|
191
|
-
@staticmethod
|
192
|
-
def moduleWithClassName(module: str, class_name: str) -> 'ReflexionModuleWithClassName':
|
193
|
-
"""Create a reflection object for a module with a specific class name.
|
194
|
-
|
195
|
-
Parameters
|
196
|
-
----------
|
197
|
-
module : str
|
198
|
-
The module name to reflect upon
|
199
|
-
class_name : str
|
200
|
-
The class name to look for in the module
|
201
|
-
|
202
|
-
Returns
|
203
|
-
-------
|
204
|
-
ReflexionModuleWithClassName
|
205
|
-
A reflection object encapsulating the module and class name
|
206
|
-
|
207
|
-
Raises
|
208
|
-
------
|
209
|
-
TypeError
|
210
|
-
If either input is not a string
|
211
|
-
ValueError
|
212
|
-
If the module cannot be imported or the class doesn't exist in it
|
213
|
-
"""
|
214
|
-
HelpersReflection.ensureValidModule(module)
|
215
|
-
HelpersReflection.ensureValidClassName(class_name)
|
216
|
-
return ReflexionModuleWithClassName(module, class_name)
|
orionis/test/facade/__init__.py
DELETED
File without changes
|
File without changes
|
@@ -1,25 +0,0 @@
|
|
1
|
-
from abc import ABC, abstractmethod
|
2
|
-
from orionis.test.suite.test_unit import UnitTest
|
3
|
-
|
4
|
-
class ITestSuite(ABC):
|
5
|
-
|
6
|
-
@abstractmethod
|
7
|
-
def run(self) -> UnitTest:
|
8
|
-
"""
|
9
|
-
Runs the test suite based on the provided configuration.
|
10
|
-
|
11
|
-
Initializes a UnitTest suite, configures it with parameters from the Configuration object,
|
12
|
-
discovers test folders matching the specified pattern, adds the discovered tests to the suite,
|
13
|
-
executes the test suite, and returns the results.
|
14
|
-
|
15
|
-
Returns
|
16
|
-
-------
|
17
|
-
UnitTest
|
18
|
-
The result of the executed test suite.
|
19
|
-
|
20
|
-
Raises
|
21
|
-
------
|
22
|
-
OrionisTestConfigException
|
23
|
-
If the provided configuration is not an instance of Configuration.
|
24
|
-
"""
|
25
|
-
pass
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,276 +0,0 @@
|
|
1
|
-
from abc import ABC, abstractmethod
|
2
|
-
from typing import Callable
|
3
|
-
from functools import wraps
|
4
|
-
|
5
|
-
def decorator_example(func: Callable) -> Callable:
|
6
|
-
"""Example decorator for testing purposes.
|
7
|
-
|
8
|
-
Parameters
|
9
|
-
----------
|
10
|
-
func : Callable
|
11
|
-
The function to be decorated
|
12
|
-
|
13
|
-
Returns
|
14
|
-
-------
|
15
|
-
Callable
|
16
|
-
The wrapped function
|
17
|
-
|
18
|
-
Notes
|
19
|
-
-----
|
20
|
-
This is a simple identity decorator used for testing decorator detection.
|
21
|
-
"""
|
22
|
-
@wraps(func)
|
23
|
-
def wrapper(*args, **kwargs):
|
24
|
-
return func(*args, **kwargs)
|
25
|
-
return wrapper
|
26
|
-
|
27
|
-
|
28
|
-
def another_decorator(func: Callable) -> Callable:
|
29
|
-
"""Another example decorator for testing multiple decorators.
|
30
|
-
|
31
|
-
Parameters
|
32
|
-
----------
|
33
|
-
func : Callable
|
34
|
-
The function to be decorated
|
35
|
-
|
36
|
-
Returns
|
37
|
-
-------
|
38
|
-
Callable
|
39
|
-
The wrapped function with added prefix
|
40
|
-
|
41
|
-
Examples
|
42
|
-
--------
|
43
|
-
>>> @another_decorator
|
44
|
-
... def test(): return "hello"
|
45
|
-
>>> test()
|
46
|
-
'Decorated: hello'
|
47
|
-
"""
|
48
|
-
@wraps(func)
|
49
|
-
def wrapper(*args, **kwargs):
|
50
|
-
return f"Decorated: {func(*args, **kwargs)}"
|
51
|
-
return wrapper
|
52
|
-
|
53
|
-
class FakeAbstractClass(ABC):
|
54
|
-
"""A fake abstract class for testing reflection capabilities.
|
55
|
-
|
56
|
-
This class contains all elements needed to test ReflexionAbstract functionality:
|
57
|
-
- Abstract methods
|
58
|
-
- Concrete methods
|
59
|
-
- Static methods
|
60
|
-
- Class methods
|
61
|
-
- Properties
|
62
|
-
- Decorated methods
|
63
|
-
- Type annotations
|
64
|
-
- Protected/private methods
|
65
|
-
|
66
|
-
Attributes
|
67
|
-
----------
|
68
|
-
class_attr : str
|
69
|
-
A class-level attribute with type annotation
|
70
|
-
_value : float
|
71
|
-
Protected attribute used by computed_property setter
|
72
|
-
"""
|
73
|
-
|
74
|
-
public_class_attribute: str = "class_value"
|
75
|
-
_protected_class_attribute: str = "protected_class_attr"
|
76
|
-
__private_class_attribute: str = "private_class_attr"
|
77
|
-
|
78
|
-
@abstractmethod
|
79
|
-
def abstract_method(self, x: int, y: int) -> int:
|
80
|
-
"""Required abstract method.
|
81
|
-
|
82
|
-
Parameters
|
83
|
-
----------
|
84
|
-
x : int
|
85
|
-
First integer parameter
|
86
|
-
y : int
|
87
|
-
Second integer parameter
|
88
|
-
|
89
|
-
Returns
|
90
|
-
-------
|
91
|
-
int
|
92
|
-
The result of some operation
|
93
|
-
|
94
|
-
Notes
|
95
|
-
-----
|
96
|
-
This method must be implemented by concrete subclasses.
|
97
|
-
"""
|
98
|
-
pass
|
99
|
-
|
100
|
-
@abstractmethod
|
101
|
-
def another_abstract(self, text: str) -> str:
|
102
|
-
"""Another required abstract method.
|
103
|
-
|
104
|
-
Parameters
|
105
|
-
----------
|
106
|
-
text : str
|
107
|
-
Input string to process
|
108
|
-
|
109
|
-
Returns
|
110
|
-
-------
|
111
|
-
str
|
112
|
-
Processed string result
|
113
|
-
"""
|
114
|
-
pass
|
115
|
-
|
116
|
-
def concrete_method(self, value: float) -> str:
|
117
|
-
"""Concrete implemented method.
|
118
|
-
|
119
|
-
Parameters
|
120
|
-
----------
|
121
|
-
value : float
|
122
|
-
Numeric value to format
|
123
|
-
|
124
|
-
Returns
|
125
|
-
-------
|
126
|
-
str
|
127
|
-
Formatted string representation
|
128
|
-
"""
|
129
|
-
return f"Value: {value}"
|
130
|
-
|
131
|
-
@staticmethod
|
132
|
-
def static_helper(flag: bool) -> str:
|
133
|
-
"""Static helper method.
|
134
|
-
|
135
|
-
Parameters
|
136
|
-
----------
|
137
|
-
flag : bool
|
138
|
-
Boolean flag to determine output
|
139
|
-
|
140
|
-
Returns
|
141
|
-
-------
|
142
|
-
str
|
143
|
-
"Enabled" if flag is True, "Disabled" otherwise
|
144
|
-
"""
|
145
|
-
return "Enabled" if flag else "Disabled"
|
146
|
-
|
147
|
-
@classmethod
|
148
|
-
def create_instance(cls) -> 'FakeAbstractClass':
|
149
|
-
"""Class method factory.
|
150
|
-
|
151
|
-
Returns
|
152
|
-
-------
|
153
|
-
FakeAbstractClass
|
154
|
-
New instance of the class
|
155
|
-
|
156
|
-
Notes
|
157
|
-
-----
|
158
|
-
This cannot actually instantiate the abstract class, but serves
|
159
|
-
as an example of a class method.
|
160
|
-
"""
|
161
|
-
return cls()
|
162
|
-
|
163
|
-
@property
|
164
|
-
def computed_property(self) -> float:
|
165
|
-
"""Computed property example.
|
166
|
-
|
167
|
-
Returns
|
168
|
-
-------
|
169
|
-
float
|
170
|
-
The value of pi approximation
|
171
|
-
"""
|
172
|
-
return 3.1416
|
173
|
-
|
174
|
-
@computed_property.setter
|
175
|
-
def computed_property(self, value: float):
|
176
|
-
"""Setter for computed property.
|
177
|
-
|
178
|
-
Parameters
|
179
|
-
----------
|
180
|
-
value : float
|
181
|
-
New value to set
|
182
|
-
"""
|
183
|
-
self._value = value
|
184
|
-
|
185
|
-
@decorator_example
|
186
|
-
@another_decorator
|
187
|
-
def decorated_method(self) -> str:
|
188
|
-
"""Method with multiple decorators.
|
189
|
-
|
190
|
-
Returns
|
191
|
-
-------
|
192
|
-
str
|
193
|
-
Always returns "decorated" with decorator transformations
|
194
|
-
|
195
|
-
Notes
|
196
|
-
-----
|
197
|
-
Used to test decorator inspection functionality.
|
198
|
-
"""
|
199
|
-
return "decorated"
|
200
|
-
|
201
|
-
def _protected_method(self) -> str:
|
202
|
-
"""Protected method (should be filtered in results).
|
203
|
-
|
204
|
-
Returns
|
205
|
-
-------
|
206
|
-
str
|
207
|
-
Constant string "protected"
|
208
|
-
"""
|
209
|
-
return "protected"
|
210
|
-
|
211
|
-
def __private_method(self) -> str:
|
212
|
-
"""Private method (should be filtered in results).
|
213
|
-
|
214
|
-
Returns
|
215
|
-
-------
|
216
|
-
str
|
217
|
-
Constant string "private"
|
218
|
-
"""
|
219
|
-
return "private"
|
220
|
-
|
221
|
-
async def asynchronous(self) -> str:
|
222
|
-
"""Asynchronous method example.
|
223
|
-
|
224
|
-
Returns
|
225
|
-
-------
|
226
|
-
str
|
227
|
-
Constant string "asynchronous"
|
228
|
-
"""
|
229
|
-
return "asynchronous"
|
230
|
-
|
231
|
-
@staticmethod
|
232
|
-
async def asynchronous_static() -> str:
|
233
|
-
"""Asynchronous static method example.
|
234
|
-
|
235
|
-
Returns
|
236
|
-
-------
|
237
|
-
str
|
238
|
-
Constant string "asynchronous static"
|
239
|
-
"""
|
240
|
-
return "asynchronous static"
|
241
|
-
|
242
|
-
@property
|
243
|
-
@abstractmethod
|
244
|
-
def abstract_properties(self) -> str:
|
245
|
-
"""Abstract property example.
|
246
|
-
|
247
|
-
Returns
|
248
|
-
-------
|
249
|
-
str
|
250
|
-
Abstract property value
|
251
|
-
"""
|
252
|
-
pass
|
253
|
-
|
254
|
-
@classmethod
|
255
|
-
@abstractmethod
|
256
|
-
def abstract_class_method(cls) -> str:
|
257
|
-
"""Abstract class method example.
|
258
|
-
|
259
|
-
Returns
|
260
|
-
-------
|
261
|
-
str
|
262
|
-
Abstract class method value
|
263
|
-
"""
|
264
|
-
pass
|
265
|
-
|
266
|
-
@staticmethod
|
267
|
-
@abstractmethod
|
268
|
-
def abstract_static_method() -> str:
|
269
|
-
"""Abstract static method example.
|
270
|
-
|
271
|
-
Returns
|
272
|
-
-------
|
273
|
-
str
|
274
|
-
Abstract static method value
|
275
|
-
"""
|
276
|
-
pass
|
@@ -1,44 +0,0 @@
|
|
1
|
-
class BaseExample:
|
2
|
-
"""Base class to test inheritance."""
|
3
|
-
|
4
|
-
def baseMethod(self) -> str:
|
5
|
-
return "Base method called"
|
6
|
-
|
7
|
-
class FakeExample(BaseExample):
|
8
|
-
"""This is a fake example class for testing reflection."""
|
9
|
-
|
10
|
-
class_attr: int = 42
|
11
|
-
another_attr = "hello"
|
12
|
-
|
13
|
-
def __init__(self, value: int = 10) -> None:
|
14
|
-
self.instance_attr = value
|
15
|
-
|
16
|
-
@property
|
17
|
-
def prop(self) -> int:
|
18
|
-
"""A read-only property returning a fixed number."""
|
19
|
-
return 10
|
20
|
-
|
21
|
-
@property
|
22
|
-
def prop_with_getter(self) -> str:
|
23
|
-
return "read-only"
|
24
|
-
|
25
|
-
def method_one(self, x: int) -> int:
|
26
|
-
return x * 2
|
27
|
-
|
28
|
-
def method_two(self, a: str, b: str = "default") -> str:
|
29
|
-
return a + b
|
30
|
-
|
31
|
-
@staticmethod
|
32
|
-
def static_method() -> str:
|
33
|
-
return "I am static"
|
34
|
-
|
35
|
-
@staticmethod
|
36
|
-
def _private_static():
|
37
|
-
pass
|
38
|
-
|
39
|
-
@classmethod
|
40
|
-
def class_method(cls) -> str:
|
41
|
-
return f"I am class method of {cls.__name__}"
|
42
|
-
|
43
|
-
def _private_method(self):
|
44
|
-
pass
|
@@ -1,78 +0,0 @@
|
|
1
|
-
import abc
|
2
|
-
from typing import Any, Dict, List
|
3
|
-
|
4
|
-
class AbstractService(abc.ABC):
|
5
|
-
"""
|
6
|
-
Abstract interface for service-like behavior.
|
7
|
-
|
8
|
-
Methods
|
9
|
-
-------
|
10
|
-
process(data: str) -> bool
|
11
|
-
Perform processing on input data.
|
12
|
-
|
13
|
-
reset() -> None
|
14
|
-
Reset the internal state of the service.
|
15
|
-
|
16
|
-
configure(options: Dict[str, Any]) -> None
|
17
|
-
Apply configuration settings to the service.
|
18
|
-
|
19
|
-
get_logs(limit: int = 10) -> List[str]
|
20
|
-
Retrieve a limited number of log messages.
|
21
|
-
|
22
|
-
Properties
|
23
|
-
----------
|
24
|
-
status : str
|
25
|
-
Current status of the service.
|
26
|
-
"""
|
27
|
-
|
28
|
-
@abc.abstractmethod
|
29
|
-
def process(self, data: str) -> bool:
|
30
|
-
"""Perform processing on input data."""
|
31
|
-
pass
|
32
|
-
|
33
|
-
@abc.abstractmethod
|
34
|
-
def reset(self) -> None:
|
35
|
-
"""Reset the internal state of the service."""
|
36
|
-
pass
|
37
|
-
|
38
|
-
@abc.abstractmethod
|
39
|
-
def configure(self, options: Dict[str, Any]) -> None:
|
40
|
-
"""Apply configuration settings to the service."""
|
41
|
-
pass
|
42
|
-
|
43
|
-
@abc.abstractmethod
|
44
|
-
def get_logs(self, limit: int = 10) -> List[str]:
|
45
|
-
"""Retrieve a limited number of log messages."""
|
46
|
-
pass
|
47
|
-
|
48
|
-
@property
|
49
|
-
@abc.abstractmethod
|
50
|
-
def status(self) -> str:
|
51
|
-
"""Current status of the service."""
|
52
|
-
pass
|
53
|
-
|
54
|
-
class PartiallyImplementedService:
|
55
|
-
"""
|
56
|
-
A partial implementation of AbstractService.
|
57
|
-
|
58
|
-
This class mimics the interface but lacks some methods/properties,
|
59
|
-
making it useful for testing reflection-based validation.
|
60
|
-
"""
|
61
|
-
|
62
|
-
def process(self, data: str) -> bool:
|
63
|
-
"""Basic processing implementation."""
|
64
|
-
return bool(data)
|
65
|
-
|
66
|
-
def get_logs(self, limit: int = 10) -> List[str]:
|
67
|
-
"""Return a fixed list of logs (mock implementation)."""
|
68
|
-
return [f"log {i}" for i in range(limit)]
|
69
|
-
|
70
|
-
# ❌ Missing: reset()
|
71
|
-
# ❌ Missing: configure()
|
72
|
-
# ❌ Missing: status (property)
|
73
|
-
|
74
|
-
def extra(self) -> str:
|
75
|
-
"""An extra method not part of the abstract interface."""
|
76
|
-
return "Just extra"
|
77
|
-
|
78
|
-
version: str = "1.0"
|