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.
@@ -1,146 +1,381 @@
1
1
  import asyncio
2
2
 
3
3
  class BaseFakeClass:
4
+ """
5
+ A base class for creating fake or mock classes in tests.
6
+
7
+ This class serves as a simple parent class for test doubles used in inspection-related tests.
8
+ """
4
9
  pass
5
10
 
6
11
  class FakeClass(BaseFakeClass):
7
12
  """
8
- FakeClass is a test double for inspection and reflection scenarios.
9
- Attributes:
10
- class_attr (str): A class-level attribute with a default value "class_value".
11
- Instance Attributes:
12
- public_attr (int): A public instance attribute initialized to 42.
13
- _protected_attr (str): A protected instance attribute initialized to "protected".
14
- __private_attr (str): A private instance attribute initialized to "private".
15
- dynamic_attr: An instance attribute initialized to None.
16
- __dd__ (str): A dunder-named attribute initialized to "dunder_value".
13
+ FakeClass is a test double class designed to simulate a variety of attribute and method visibilities for inspection and testing purposes.
14
+ This class provides:
15
+ - Public, protected, and private class-level and instance-level attributes.
16
+ - Public, protected, and private properties.
17
+ - Synchronous and asynchronous instance methods with varying visibilities.
18
+ - Synchronous and asynchronous class methods with varying visibilities.
19
+ - Synchronous and asynchronous static methods with varying visibilities.
20
+ public_attr (int): A public class and instance attribute set to 42.
21
+ dynamic_attr: A public attribute initialized to None, can be set dynamically.
22
+ _protected_attr (str): A protected class and instance attribute set to "protected".
23
+ __private_attr (str): A private class and instance attribute set to "private".
24
+ Properties:
25
+ computed_public_property (str): Returns "public property".
26
+ _computed_property_protected (str): Returns "protected property".
27
+ __computed_property_private (str): Returns "private property".
17
28
  Methods:
18
- instanceMethod(x: int, y: int) -> int:
19
- Adds two numbers and returns the result.
20
- computed_property -> str:
21
- A computed property that returns a string based on public_attr.
22
- classMethod() -> str:
23
- Class method returning a string representation of the class attribute.
24
- _classMethodProte() -> str:
25
- Protected class method returning a string representation of the class attribute.
26
- __classMethodPP() -> str:
27
- Private class method returning a string representation of the class attribute.
29
+ instanceSyncMethod(x: int, y: int) -> int:
30
+ instanceAsyncMethod(x: int, y: int) -> int:
31
+ _protectedsyncMethod(x: int, y: int) -> int:
32
+ Protected synchronous addition method.
33
+ _protectedAsyncMethod(x: int, y: int) -> int:
34
+ Protected asynchronous addition method.
35
+ __privateSyncMethod(x: int, y: int) -> int:
36
+ Private synchronous addition method.
37
+ __privateAsyncMethod(x: int, y: int) -> int:
38
+ Private asynchronous addition method.
39
+ Class Methods:
40
+ classSyncMethod(x: int, y: int) -> int:
41
+ classAsyncMethod(x: int, y: int) -> int:
42
+ _classMethodProtected(x: int, y: int) -> int:
43
+ Protected synchronous class addition method.
44
+ _classAsyncMethodProtected(x: int, y: int) -> int:
45
+ Protected asynchronous class addition method.
46
+ __classMethodPrivate(x: int, y: int) -> int:
47
+ Private synchronous class addition method.
48
+ __classAsyncMethodPrivate(x: int, y: int) -> int:
49
+ Private asynchronous class addition method.
50
+ Static Methods:
28
51
  staticMethod(text: str) -> str:
29
- Static method that returns the uppercase version of the input text.
30
- __staticMethodPP(text: str) -> str:
31
- Private static method that returns the uppercase version of the input text.
32
- staticAsyncMethod(text: str) -> Awaitable[str]:
33
- Asynchronous static method that returns the uppercase version of the input text after a delay.
34
- __privateMethod() -> str:
35
- Private instance method returning a string indicating it is private.
36
- _protectedMethod() -> str:
37
- Protected instance method returning a string indicating it is protected.
38
- asyncMethod() -> Awaitable[str]:
39
- Asynchronous instance method returning a string indicating it is async.
40
- __str__() -> Awaitable[str]:
41
- Asynchronous string representation of the instance.
52
+ Synchronously converts the input text to uppercase.
53
+ staticAsyncMethod(text: str) -> str:
54
+ Asynchronously converts the input text to uppercase.
55
+ _staticMethodProtected(text: str) -> str:
56
+ Protected synchronous static method to uppercase text.
57
+ _staticAsyncMethodProtected(text: str) -> str:
58
+ Protected asynchronous static method to uppercase text.
59
+ __staticMethodPrivate(text: str) -> str:
60
+ Private synchronous static method to uppercase text.
61
+ __staticAsyncMethodPrivate(text: str) -> str:
62
+ Private asynchronous static method to uppercase text.
63
+ Note:
64
+ This class is intended for testing and inspection of attribute and method visibility, including Python's name mangling for private members.
42
65
  """
43
66
 
44
- class_attr: str = "class_value"
67
+ # Class-level attribute (Public)
68
+ public_attr: int = 42
69
+ dynamic_attr = None
45
70
 
46
- def __init__(self) -> None:
47
- self.public_attr = 42
48
- self._protected_attr = "protected"
49
- self.__private_attr = "private"
50
- self.dynamic_attr = None
51
- self.__dd__ = "dunder_value"
71
+ # Class-level attribute (Protected)
72
+ _protected_attr: str = "protected"
52
73
 
53
- def instanceMethod(self, x: int, y: int) -> int:
54
- """Adds two numbers."""
55
- return x + y
74
+ # Class-level attribute (Private)
75
+ __private_attr: str = "private"
76
+ __dd__: str = "dunder_value"
56
77
 
57
78
  @property
58
- def computed_property(self) -> str:
59
- """A computed property."""
60
- return f"public"
79
+ def computed_public_property(self) -> str:
80
+ """
81
+ Returns the string "public" as a computed property.
82
+
83
+ Returns:
84
+ str: The string "public".
85
+ """
86
+ return f"public property"
61
87
 
62
88
  @property
63
89
  def _computed_property_protected(self) -> str:
90
+ """
91
+ Returns a string indicating that this is a protected computed property.
92
+
93
+ Returns:
94
+ str: The string "protected".
95
+ """
64
96
  """A computed property."""
65
- return f"protected"
97
+ return f"protected property"
66
98
 
67
99
  @property
68
100
  def __computed_property_private(self) -> str:
69
- """A computed property."""
70
- return f"private"
101
+ """
102
+ Returns the string "private".
103
+
104
+ This is a private computed property method, typically used for internal logic or testing purposes.
105
+
106
+ Returns:
107
+ str: The string "private".
108
+ """
109
+ return f"private property"
110
+
111
+ def __init__(self) -> None:
112
+ """
113
+ Initializes the instance with various attributes for testing attribute visibility.
114
+
115
+ Attributes:
116
+ public_attr (int): A public attribute set to 42.
117
+ _protected_attr (str): A protected attribute set to "protected".
118
+ __private_attr (str): A private attribute set to "private".
119
+ dynamic_attr: An attribute initialized to None, can be set dynamically.
120
+ __dd__ (str): A dunder (double underscore) attribute set to "dunder_value".
121
+ """
122
+
123
+ # Initialize attributes (Publics)
124
+ self.public_attr = 42
125
+ self.dynamic_attr = None
126
+
127
+ # Initialize attributes (Protected)
128
+ self._protected_attr = "protected"
129
+
130
+ # Initialize attributes (Private)
131
+ self.__private_attr = "private"
132
+ self.__dd__ = "dunder_value"
133
+
134
+ def instanceSyncMethod(self, x: int, y: int) -> int:
135
+ """
136
+ Synchronously adds two integers and returns the result.
137
+
138
+ Args:
139
+ x (int): The first integer to add.
140
+ y (int): The second integer to add.
141
+
142
+ Returns:
143
+ int: The sum of x and y.
144
+ """
145
+ return x + y
146
+
147
+ async def instanceAsyncMethod(self, x: int, y: int) -> int:
148
+ """
149
+ Asynchronously adds two integers and returns the result.
150
+
151
+ Args:
152
+ x (int): The first integer to add.
153
+ y (int): The second integer to add.
154
+
155
+ Returns:
156
+ int: The sum of x and y.
157
+ """
158
+ await asyncio.sleep(0.1)
159
+ return x + y
160
+
161
+ def _protectedsyncMethod(self, x: int, y: int) -> int:
162
+ """
163
+ Synchronously adds two integers and returns the result (protected method).
164
+
165
+ Args:
166
+ x (int): The first integer to add.
167
+ y (int): The second integer to add.
168
+
169
+ Returns:
170
+ int: The sum of x and y.
171
+ """
172
+ return x + y
173
+
174
+ async def _protectedAsyncMethod(self, x: int, y: int) -> int:
175
+ """
176
+ Asynchronously adds two integers and returns the result (protected method).
177
+
178
+ Args:
179
+ x (int): The first integer to add.
180
+ y (int): The second integer to add.
181
+
182
+ Returns:
183
+ int: The sum of x and y.
184
+ """
185
+ await asyncio.sleep(0.1)
186
+ return x + y
187
+
188
+ def __privateSyncMethod(self, x: int, y: int) -> int:
189
+ """
190
+ Synchronously adds two integers and returns the result (private method).
191
+
192
+ Args:
193
+ x (int): The first integer to add.
194
+ y (int): The second integer to add.
195
+
196
+ Returns:
197
+ int: The sum of x and y.
198
+ """
199
+ return x + y
200
+
201
+ async def __privateAsyncMethod(self, x: int, y: int) -> int:
202
+ """
203
+ Asynchronously adds two integers and returns the result (private method).
204
+
205
+ Args:
206
+ x (int): The first integer to add.
207
+ y (int): The second integer to add.
208
+
209
+ Returns:
210
+ int: The sum of x and y.
211
+ """
212
+ await asyncio.sleep(0.1)
213
+ return x + y
71
214
 
72
215
  @classmethod
73
- def classMethod(cls) -> str:
74
- """A class method."""
75
- return f"Class attr: {cls.class_attr}"
216
+ def classSyncMethod(cls, x: int, y: int) -> int:
217
+ """
218
+ Synchronously adds two integers and returns the result (class method).
219
+
220
+ Args:
221
+ x (int): The first integer to add.
222
+ y (int): The second integer to add.
223
+
224
+ Returns:
225
+ int: The sum of x and y.
226
+ """
227
+ return x + y
76
228
 
77
229
  @classmethod
78
- async def classMethodAsync(cls) -> str:
79
- """A class method."""
80
- return f"Class attr: {cls.class_attr}"
230
+ async def classAsyncMethod(cls, x: int, y: int) -> int:
231
+ """
232
+ Asynchronously adds two integers and returns the result (class method).
233
+
234
+ Args:
235
+ x (int): The first integer to add.
236
+ y (int): The second integer to add.
237
+
238
+ Returns:
239
+ int: The sum of x and y.
240
+ """
241
+ await asyncio.sleep(0.1)
242
+ return x + y
81
243
 
82
244
  @classmethod
83
- def _classMethodProte(cls) -> str:
84
- """A class method."""
85
- return f"Class attr: {cls.class_attr}"
245
+ def _classMethodProtected(cls, x: int, y: int) -> int:
246
+ """
247
+ Synchronously adds two integers and returns the result (protected class method).
248
+
249
+ Args:
250
+ x (int): The first integer to add.
251
+ y (int): The second integer to add.
252
+
253
+ Returns:
254
+ int: The sum of x and y.
255
+ """
256
+ return x + y
86
257
 
87
258
  @classmethod
88
- async def _classMethodProteAsync(cls) -> str:
89
- """A class method."""
90
- return f"Class attr: {cls.class_attr}"
259
+ async def _classAsyncMethodProtected(cls, x: int, y: int) -> int:
260
+ """
261
+ Asynchronously adds two integers and returns the result (protected class method).
262
+
263
+ Args:
264
+ x (int): The first integer to add.
265
+ y (int): The second integer to add.
266
+
267
+ Returns:
268
+ int: The sum of x and y.
269
+ """
270
+ await asyncio.sleep(0.1)
271
+ return x + y
91
272
 
92
273
  @classmethod
93
- def __classMethodPP(cls) -> str:
94
- """A class method."""
95
- return f"Class attr: {cls.class_attr}"
274
+ def __classMethodPrivate(cls, x: int, y: int) -> int:
275
+ """
276
+ Synchronously adds two integers and returns the result (private class method).
277
+
278
+ Args:
279
+ x (int): The first integer to add.
280
+ y (int): The second integer to add.
281
+
282
+ Returns:
283
+ int: The sum of x and y.
284
+ """
285
+ return x + y
96
286
 
97
287
  @classmethod
98
- async def __classMethodPPAsync(cls) -> str:
99
- """A class method."""
100
- return f"Class attr: {cls.class_attr}"
288
+ async def __classAsyncMethodPrivate(cls, x: int, y: int) -> int:
289
+ """
290
+ Asynchronously adds two integers and returns the result (private class method).
291
+
292
+ Args:
293
+ x (int): The first integer to add.
294
+ y (int): The second integer to add.
295
+
296
+ Returns:
297
+ int: The sum of x and y.
298
+ """
299
+ await asyncio.sleep(0.1)
300
+ return x + y
101
301
 
102
302
  @staticmethod
103
303
  def staticMethod(text: str) -> str:
104
- """A static method."""
105
- return text.upper()
304
+ """
305
+ Synchronously converts the input text to uppercase (static method).
106
306
 
107
- @staticmethod
108
- def __staticMethodSYNC(text: str) -> str:
109
- """A static method. Ejemplo de método privado."""
307
+ Args:
308
+ text (str): The input string.
309
+
310
+ Returns:
311
+ str: The uppercase version of the input string.
312
+ """
110
313
  return text.upper()
111
314
 
112
315
  @staticmethod
113
316
  async def staticAsyncMethod(text: str) -> str:
114
- """An asynchronous static method."""
317
+ """
318
+ Asynchronously converts the input text to uppercase (static method).
319
+
320
+ Args:
321
+ text (str): The input string.
322
+
323
+ Returns:
324
+ str: The uppercase version of the input string.
325
+ """
115
326
  await asyncio.sleep(0.1)
116
327
  return text.upper()
117
328
 
118
329
  @staticmethod
119
- def _staticMethodPro(text: str) -> str:
120
- """A static method."""
330
+ def _staticMethodProtected(text: str) -> str:
331
+ """
332
+ Synchronously converts the input text to uppercase (protected static method).
333
+
334
+ Args:
335
+ text (str): The input string.
336
+
337
+ Returns:
338
+ str: The uppercase version of the input string.
339
+ """
121
340
  return text.upper()
122
341
 
123
342
  @staticmethod
124
- async def _staticMethodProAsync(text: str) -> str:
125
- """A static method."""
343
+ async def _staticAsyncMethodProtected(text: str) -> str:
344
+ """
345
+ Asynchronously converts the input text to uppercase (protected static method).
346
+
347
+ Args:
348
+ text (str): The input string.
349
+
350
+ Returns:
351
+ str: The uppercase version of the input string.
352
+ """
353
+ await asyncio.sleep(0.1)
126
354
  return text.upper()
127
355
 
128
356
  @staticmethod
129
- async def __staticMethodPrivateAsync(text: str) -> str:
130
- """A static method."""
131
- return text.upper()
357
+ def __staticMethodPrivate(text: str) -> str:
358
+ """
359
+ Synchronously converts the input text to uppercase (private static method).
132
360
 
133
- def __privateMethod(self) -> str:
134
- """A 'private' method."""
135
- return "This is private"
361
+ Args:
362
+ text (str): The input string.
136
363
 
137
- def _protectedMethod(self) -> str:
138
- """A 'protected' method."""
139
- return "This is protected"
364
+ Returns:
365
+ str: The uppercase version of the input string.
366
+ """
367
+ return text.upper()
140
368
 
141
- async def asyncMethod(self) -> str:
142
- """An async method."""
143
- return "This is async"
369
+ @staticmethod
370
+ async def __staticAsyncMethodPrivate(text: str) -> str:
371
+ """
372
+ Asynchronously converts the input text to uppercase (private static method).
144
373
 
145
- async def __str__(self):
146
- return super().__str__()
374
+ Args:
375
+ text (str): The input string.
376
+
377
+ Returns:
378
+ str: The uppercase version of the input string.
379
+ """
380
+ await asyncio.sleep(0.1)
381
+ return text.upper()