orionis 0.546.0__py3-none-any.whl → 0.548.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 (160) hide show
  1. orionis/console/base/scheduler_event_listener.py +0 -17
  2. orionis/console/contracts/schedule_event_listener.py +0 -18
  3. orionis/foundation/config/app/entities/app.py +3 -2
  4. orionis/foundation/config/app/enums/ciphers.py +5 -19
  5. orionis/foundation/config/session/entities/session.py +2 -2
  6. orionis/metadata/framework.py +1 -1
  7. orionis/services/encrypter/encrypter.py +115 -0
  8. orionis/services/environment/dynamic/caster.py +35 -27
  9. orionis/services/environment/key/key_generator.py +32 -11
  10. {orionis-0.546.0.dist-info → orionis-0.548.0.dist-info}/METADATA +1 -1
  11. {orionis-0.546.0.dist-info → orionis-0.548.0.dist-info}/RECORD +14 -159
  12. {orionis-0.546.0.dist-info → orionis-0.548.0.dist-info}/top_level.txt +0 -1
  13. orionis-0.546.0.dist-info/zip-safe +0 -1
  14. tests/container/__init__.py +0 -0
  15. tests/container/context/__init__.py +0 -0
  16. tests/container/context/test_manager.py +0 -38
  17. tests/container/context/test_scope.py +0 -32
  18. tests/container/core/__init__.py +0 -0
  19. tests/container/core/test_advanced_async.py +0 -234
  20. tests/container/core/test_async_optimizations.py +0 -268
  21. tests/container/core/test_container.py +0 -453
  22. tests/container/core/test_singleton.py +0 -122
  23. tests/container/core/test_thread_safety.py +0 -90
  24. tests/container/entities/__init__.py +0 -0
  25. tests/container/entities/test_binding.py +0 -242
  26. tests/container/enums/__init__.py +0 -0
  27. tests/container/enums/test_lifetimes.py +0 -97
  28. tests/container/facades/__init__.py +0 -0
  29. tests/container/facades/test_facade.py +0 -78
  30. tests/container/mocks/__init__.py +0 -0
  31. tests/container/mocks/mock_advanced_async.py +0 -332
  32. tests/container/mocks/mock_async_optimizations.py +0 -407
  33. tests/container/mocks/mock_auto_resolution.py +0 -192
  34. tests/container/mocks/mock_complex_classes.py +0 -792
  35. tests/container/mocks/mock_simple_classes.py +0 -98
  36. tests/container/providers/__init__.py +0 -0
  37. tests/container/providers/test_providers.py +0 -55
  38. tests/container/validators/__init__.py +0 -0
  39. tests/container/validators/test_implements.py +0 -186
  40. tests/container/validators/test_is_abstract_class.py +0 -147
  41. tests/container/validators/test_is_callable.py +0 -102
  42. tests/container/validators/test_is_concrete_class.py +0 -160
  43. tests/container/validators/test_is_instance.py +0 -150
  44. tests/container/validators/test_is_not_subclass.py +0 -49
  45. tests/container/validators/test_is_subclass.py +0 -178
  46. tests/container/validators/test_is_valid_alias.py +0 -147
  47. tests/container/validators/test_lifetime.py +0 -106
  48. tests/example/__init__.py +0 -0
  49. tests/example/test_example.py +0 -725
  50. tests/foundation/__init__.py +0 -0
  51. tests/foundation/config/__init__.py +0 -0
  52. tests/foundation/config/app/__init__.py +0 -0
  53. tests/foundation/config/app/test_foundation_config_app.py +0 -262
  54. tests/foundation/config/auth/__init__.py +0 -0
  55. tests/foundation/config/auth/test_foundation_config_auth.py +0 -29
  56. tests/foundation/config/cache/__init__.py +0 -0
  57. tests/foundation/config/cache/test_foundation_config_cache.py +0 -143
  58. tests/foundation/config/cache/test_foundation_config_cache_file.py +0 -126
  59. tests/foundation/config/cache/test_foundation_config_cache_stores.py +0 -156
  60. tests/foundation/config/cors/__init__.py +0 -0
  61. tests/foundation/config/cors/test_foundation_config_cors.py +0 -190
  62. tests/foundation/config/database/__init__.py +0 -0
  63. tests/foundation/config/database/test_foundation_config_database.py +0 -158
  64. tests/foundation/config/database/test_foundation_config_database_connections.py +0 -203
  65. tests/foundation/config/database/test_foundation_config_database_mysql.py +0 -354
  66. tests/foundation/config/database/test_foundation_config_database_oracle.py +0 -288
  67. tests/foundation/config/database/test_foundation_config_database_pgsql.py +0 -257
  68. tests/foundation/config/database/test_foundation_config_database_sqlite.py +0 -207
  69. tests/foundation/config/filesystems/__init__.py +0 -0
  70. tests/foundation/config/filesystems/test_foundation_config_filesystems.py +0 -160
  71. tests/foundation/config/filesystems/test_foundation_config_filesystems_aws.py +0 -189
  72. tests/foundation/config/filesystems/test_foundation_config_filesystems_disks.py +0 -184
  73. tests/foundation/config/filesystems/test_foundation_config_filesystems_local.py +0 -143
  74. tests/foundation/config/filesystems/test_foundation_config_filesystems_public.py +0 -184
  75. tests/foundation/config/logging/__init__.py +0 -0
  76. tests/foundation/config/logging/test_foundation_config_logging.py +0 -112
  77. tests/foundation/config/logging/test_foundation_config_logging_channels.py +0 -246
  78. tests/foundation/config/logging/test_foundation_config_logging_chunked.py +0 -217
  79. tests/foundation/config/logging/test_foundation_config_logging_daily.py +0 -220
  80. tests/foundation/config/logging/test_foundation_config_logging_hourly.py +0 -196
  81. tests/foundation/config/logging/test_foundation_config_logging_monthly.py +0 -214
  82. tests/foundation/config/logging/test_foundation_config_logging_stack.py +0 -178
  83. tests/foundation/config/logging/test_foundation_config_logging_weekly.py +0 -224
  84. tests/foundation/config/mail/__init__.py +0 -0
  85. tests/foundation/config/mail/test_foundation_config_mail.py +0 -145
  86. tests/foundation/config/mail/test_foundation_config_mail_file.py +0 -97
  87. tests/foundation/config/mail/test_foundation_config_mail_mailers.py +0 -106
  88. tests/foundation/config/mail/test_foundation_config_mail_smtp.py +0 -146
  89. tests/foundation/config/queue/__init__.py +0 -0
  90. tests/foundation/config/queue/test_foundation_config_queue.py +0 -88
  91. tests/foundation/config/queue/test_foundation_config_queue_brokers.py +0 -72
  92. tests/foundation/config/queue/test_foundation_config_queue_database.py +0 -134
  93. tests/foundation/config/root/__init__.py +0 -0
  94. tests/foundation/config/root/test_foundation_config_root_paths.py +0 -112
  95. tests/foundation/config/session/__init__.py +0 -0
  96. tests/foundation/config/session/test_foundation_config_session.py +0 -213
  97. tests/foundation/config/startup/__init__.py +0 -0
  98. tests/foundation/config/startup/test_foundation_config_startup.py +0 -202
  99. tests/foundation/config/testing/__init__.py +0 -0
  100. tests/foundation/config/testing/test_foundation_config_testing.py +0 -235
  101. tests/metadata/__init__.py +0 -0
  102. tests/metadata/test_metadata_framework.py +0 -140
  103. tests/metadata/test_metadata_package.py +0 -139
  104. tests/services/__init__.py +0 -0
  105. tests/services/asynchrony/__init__.py +0 -0
  106. tests/services/asynchrony/test_services_asynchrony_coroutine.py +0 -85
  107. tests/services/environment/__init__.py +0 -0
  108. tests/services/environment/test_services_environment.py +0 -226
  109. tests/services/introspection/__init__.py +0 -0
  110. tests/services/introspection/dependencies/__init__.py +0 -0
  111. tests/services/introspection/dependencies/mocks/__init__.py +0 -0
  112. tests/services/introspection/dependencies/mocks/mock_user.py +0 -30
  113. tests/services/introspection/dependencies/mocks/mock_user_controller.py +0 -27
  114. tests/services/introspection/dependencies/mocks/mock_users_permissions.py +0 -41
  115. tests/services/introspection/dependencies/test_reflect_dependencies.py +0 -261
  116. tests/services/introspection/reflection/__init__.py +0 -0
  117. tests/services/introspection/reflection/mock/__init__.py +0 -0
  118. tests/services/introspection/reflection/mock/fake_reflect_instance.py +0 -1115
  119. tests/services/introspection/reflection/test_reflection_abstract.py +0 -1011
  120. tests/services/introspection/reflection/test_reflection_callable.py +0 -206
  121. tests/services/introspection/reflection/test_reflection_concrete.py +0 -952
  122. tests/services/introspection/reflection/test_reflection_instance.py +0 -1233
  123. tests/services/introspection/reflection/test_reflection_module.py +0 -567
  124. tests/services/introspection/test_reflection.py +0 -462
  125. tests/services/log/__init__.py +0 -0
  126. tests/services/log/test_log.py +0 -97
  127. tests/services/system/__init__.py +0 -0
  128. tests/services/system/test_services_system_imports.py +0 -204
  129. tests/services/system/test_services_system_workers.py +0 -131
  130. tests/support/__init__.py +0 -0
  131. tests/support/entities/__init__.py +0 -0
  132. tests/support/entities/mock_dataclass.py +0 -40
  133. tests/support/entities/test_base.py +0 -64
  134. tests/support/patterns/__init__.py +0 -0
  135. tests/support/patterns/singleton/__init__.py +0 -0
  136. tests/support/patterns/singleton/test_patterns_singleton.py +0 -39
  137. tests/support/standard/__init__.py +0 -0
  138. tests/support/standard/test_services_std.py +0 -226
  139. tests/support/wrapper/__init__.py +0 -0
  140. tests/support/wrapper/test_services_wrapper_docdict.py +0 -202
  141. tests/testing/__init__.py +0 -0
  142. tests/testing/cases/__init__.py +0 -0
  143. tests/testing/cases/test_testing_asynchronous.py +0 -63
  144. tests/testing/cases/test_testing_synchronous.py +0 -57
  145. tests/testing/entities/__init__.py +0 -0
  146. tests/testing/entities/test_testing_result.py +0 -146
  147. tests/testing/enums/__init__.py +0 -0
  148. tests/testing/enums/test_testing_status.py +0 -63
  149. tests/testing/output/__init__.py +0 -0
  150. tests/testing/output/test_testing_dumper.py +0 -29
  151. tests/testing/output/test_testing_printer.py +0 -42
  152. tests/testing/records/__init__.py +0 -0
  153. tests/testing/records/test_testing_records.py +0 -171
  154. tests/testing/test_testing_unit.py +0 -164
  155. tests/testing/validators/__init__.py +0 -0
  156. tests/testing/validators/test_testing_validators.py +0 -392
  157. tests/testing/view/__init__.py +0 -0
  158. tests/testing/view/test_render.py +0 -30
  159. {orionis-0.546.0.dist-info → orionis-0.548.0.dist-info}/WHEEL +0 -0
  160. {orionis-0.546.0.dist-info → orionis-0.548.0.dist-info}/licenses/LICENCE +0 -0
@@ -1,332 +0,0 @@
1
- from abc import ABC, abstractmethod
2
- import asyncio
3
- import time
4
-
5
- class IPerformanceService(ABC):
6
- """
7
- Interface for a performance service that provides both synchronous and asynchronous operations.
8
-
9
- Methods
10
- -------
11
- sync_operation() -> str
12
- Performs a synchronous operation and returns the result as a string.
13
- async async_operation() -> str
14
- Performs an asynchronous operation and returns the result as a string.
15
- """
16
-
17
- @abstractmethod
18
- def sync_operation(self) -> str:
19
- """
20
- Performs a synchronous operation.
21
-
22
- Returns
23
- -------
24
- str
25
- A string representing the result of the synchronous operation.
26
- """
27
- pass # To be implemented by subclasses
28
-
29
- @abstractmethod
30
- async def async_operation(self) -> str:
31
- """
32
- Performs an asynchronous operation.
33
-
34
- Returns
35
- -------
36
- str
37
- A string representing the result of the asynchronous operation.
38
- """
39
- pass # To be implemented by subclasses
40
-
41
- class PerformanceService(IPerformanceService):
42
- """
43
- Mock implementation of the IPerformanceService interface for testing performance-related tasks.
44
-
45
- This class provides both synchronous and asynchronous operations to simulate performance scenarios.
46
- It is intended for use in test environments where simulating delays and asynchronous behavior is required.
47
-
48
- Methods
49
- -------
50
- sync_operation() -> str
51
- Simulates a synchronous operation with a delay and returns a completion message.
52
- async async_operation() -> str
53
- Simulates an asynchronous operation with a delay and returns a completion message.
54
- """
55
-
56
- def sync_operation(self) -> str:
57
- """
58
- Simulates a synchronous operation by introducing a short blocking delay.
59
-
60
- The method blocks the current thread for a brief period to mimic a time-consuming synchronous task.
61
-
62
- Returns
63
- -------
64
- str
65
- A message indicating that the synchronous operation has completed.
66
- """
67
- time.sleep(0.1) # Simulate a blocking delay
68
- return "Sync operation completed"
69
-
70
- async def async_operation(self) -> str:
71
- """
72
- Simulates an asynchronous operation by introducing a short non-blocking delay.
73
-
74
- The method asynchronously waits for a brief period to mimic a time-consuming asynchronous task.
75
-
76
- Returns
77
- -------
78
- str
79
- A message indicating that the asynchronous operation has completed.
80
- """
81
- await asyncio.sleep(0.1) # Simulate a non-blocking delay
82
- return "Async operation completed"
83
-
84
- class ErrorService:
85
- """
86
- Service for simulating error scenarios in both synchronous and asynchronous contexts.
87
-
88
- This class provides methods that intentionally raise exceptions, useful for testing error handling
89
- in synchronous and asynchronous code paths.
90
-
91
- Methods
92
- -------
93
- sync_error_method()
94
- Synchronously raises a ValueError to simulate an error in synchronous code.
95
- async async_error_method()
96
- Asynchronously raises a ValueError after a short delay to simulate an error in asynchronous code.
97
- """
98
-
99
- def sync_error_method(self):
100
- """
101
- Synchronously raises a ValueError to simulate an error in synchronous code.
102
-
103
- Raises
104
- ------
105
- ValueError
106
- Always raised with the message "Sync error occurred".
107
-
108
- Returns
109
- -------
110
- None
111
- This method does not return; it always raises an exception.
112
- """
113
- # Raise a synchronous error for testing purposes
114
- raise ValueError("Sync error occurred")
115
-
116
- async def async_error_method(self):
117
- """
118
- Asynchronously raises a ValueError after a short delay to simulate an error in asynchronous code.
119
-
120
- The method awaits for 0.1 seconds before raising the exception, mimicking asynchronous error scenarios.
121
-
122
- Raises
123
- ------
124
- ValueError
125
- Always raised with the message "Async error occurred" after a 0.1 second delay.
126
-
127
- Returns
128
- -------
129
- None
130
- This method does not return; it always raises an exception.
131
- """
132
- # Simulate asynchronous delay before raising the error
133
- await asyncio.sleep(0.1)
134
- raise ValueError("Async error occurred")
135
-
136
- class SyncDependency:
137
- """
138
- Mock synchronous dependency for testing synchronous code paths.
139
-
140
- This class simulates a simple synchronous dependency that returns a fixed string value.
141
- It is intended for use in test scenarios where a synchronous service or resource is required.
142
-
143
- Methods
144
- -------
145
- get_data() -> str
146
- Returns a fixed string representing synchronous data.
147
- """
148
-
149
- def get_data(self) -> str:
150
- """
151
- Retrieve a fixed string representing synchronous data.
152
-
153
- This method simulates fetching data from a synchronous resource or service.
154
- It always returns the same string value for testing purposes.
155
-
156
- Returns
157
- -------
158
- str
159
- The string "sync data", representing the synchronous data provided by this dependency.
160
- """
161
-
162
- # Return a fixed string to simulate synchronous data retrieval
163
- return "sync data"
164
-
165
- class AsyncDependency:
166
- """
167
- An asynchronous dependency class that provides async data.
168
-
169
- Methods
170
- -------
171
- get_async_data() -> str
172
- Asynchronously retrieves a string representing data after a short delay.
173
- """
174
-
175
- async def get_async_data(self) -> str:
176
- """
177
- Asynchronously retrieves data after a short delay.
178
-
179
- This method simulates an asynchronous operation by waiting for a brief period
180
- before returning a fixed string value. It is useful for testing asynchronous
181
- code paths where a non-blocking dependency is required.
182
-
183
- Returns
184
- -------
185
- str
186
- The string "async data", representing the asynchronously retrieved data.
187
- """
188
-
189
- # Simulate a short asynchronous delay
190
- await asyncio.sleep(0.05)
191
-
192
- # Return a fixed string to represent async data retrieval
193
- return "async data"
194
-
195
- class MixedConsumer:
196
- """
197
- A consumer class that demonstrates usage of both synchronous and asynchronous dependencies.
198
-
199
- Parameters
200
- ----------
201
- sync_dep : SyncDependency
202
- A synchronous dependency providing data via `get_data()`.
203
- async_dep : AsyncDependency
204
- An asynchronous dependency providing data via `get_async_data()`.
205
-
206
- Methods
207
- -------
208
- sync_method() -> str
209
- Returns a string containing data from the synchronous dependency.
210
- async async_method() -> str
211
- Asynchronously retrieves data from the async dependency and combines it with data from the sync dependency.
212
- async complex_method(multiplier: int = 2) -> str
213
- Asynchronously retrieves data from the async dependency and returns a string with the data multiplied by the given multiplier.
214
- """
215
-
216
- def __init__(self, sync_dep: SyncDependency, async_dep: AsyncDependency):
217
- """
218
- Initialize MixedConsumer with synchronous and asynchronous dependencies.
219
-
220
- Parameters
221
- ----------
222
- sync_dep : SyncDependency
223
- The synchronous dependency to be injected.
224
- async_dep : AsyncDependency
225
- The asynchronous dependency to be injected.
226
- """
227
- self.sync_dep = sync_dep
228
- self.async_dep = async_dep
229
-
230
- def sync_method(self) -> str:
231
- """
232
- Retrieve data synchronously from the synchronous dependency and return it as a formatted string.
233
-
234
- Returns
235
- -------
236
- str
237
- A formatted string containing data from the synchronous dependency in the format 'Sync: <sync_data>'.
238
- """
239
-
240
- # Get data from the synchronous dependency and format it
241
- return f"Sync: {self.sync_dep.get_data()}"
242
-
243
- async def async_method(self) -> str:
244
- """
245
- Asynchronously retrieve data from both asynchronous and synchronous dependencies,
246
- and return a formatted string containing both results.
247
-
248
- Returns
249
- -------
250
- str
251
- A string containing both synchronous and asynchronous data in the format
252
- 'Mixed: sync=<sync_data>, async=<async_data>'.
253
- """
254
-
255
- # Await data from the asynchronous dependency
256
- async_data = await self.async_dep.get_async_data()
257
-
258
- # Get data from the synchronous dependency
259
- sync_data = self.sync_dep.get_data()
260
-
261
- # Combine both pieces of data into a formatted string
262
- return f"Mixed: sync={sync_data}, async={async_data}"
263
-
264
- async def complex_method(self, multiplier: int = 2) -> str:
265
- """
266
- Asynchronously retrieve data from the asynchronous dependency and return a formatted string
267
- that includes the data and the multiplier value.
268
-
269
- Parameters
270
- ----------
271
- multiplier : int, optional
272
- The value to multiply the async data by. Defaults to 2.
273
-
274
- Returns
275
- -------
276
- str
277
- A formatted string containing the async data and the multiplier in the format
278
- 'Complex: <async_data> * <multiplier>'.
279
- """
280
-
281
- # Await data from the asynchronous dependency
282
- async_data = await self.async_dep.get_async_data()
283
-
284
- # Return the formatted string with the async data and multiplier
285
- return f"Complex: {async_data} * {multiplier}"
286
-
287
- def sync_returns_coroutine():
288
- """
289
- Returns a coroutine object that performs an asynchronous sleep and yields a string result.
290
-
291
- This function is a synchronous callable that, when invoked, returns a coroutine object.
292
- The returned coroutine, when awaited, will asynchronously sleep for 0.05 seconds before
293
- returning a specific string. This pattern is useful for testing scenarios where a
294
- synchronous function is expected to return an awaitable.
295
-
296
- Returns
297
- -------
298
- coroutine
299
- A coroutine object that, when awaited, sleeps asynchronously for 0.05 seconds and
300
- returns the string "Sync function returning coroutine".
301
- """
302
-
303
- # Define an inner asynchronous function to perform the async operation
304
- async def inner():
305
-
306
- # Asynchronously sleep for 0.05 seconds
307
- await asyncio.sleep(0.05)
308
-
309
- # Return a fixed string after the delay
310
- return "Sync function returning coroutine"
311
-
312
- # Return the coroutine object (not awaited here)
313
- return inner()
314
-
315
- async def simple_async():
316
- """
317
- Asynchronously sleeps for a short duration and returns a fixed string message.
318
-
319
- This asynchronous function demonstrates a simple async operation by awaiting a short
320
- delay before returning a message indicating successful execution.
321
-
322
- Returns
323
- -------
324
- str
325
- The string "Simple async callable" after a 0.05 second asynchronous delay.
326
- """
327
-
328
- # Asynchronously sleep for 0.05 seconds
329
- await asyncio.sleep(0.05)
330
-
331
- # Return a fixed string after the delay
332
- return "Simple async callable"