orionis 0.227.0__py3-none-any.whl → 0.228.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/framework.py CHANGED
@@ -5,7 +5,7 @@
5
5
  NAME = "orionis"
6
6
 
7
7
  # Current version of the framework
8
- VERSION = "0.227.0"
8
+ VERSION = "0.228.0"
9
9
 
10
10
  # Full name of the author or maintainer of the project
11
11
  AUTHOR = "Raul Mauricio Uñate Castro"
@@ -6,6 +6,7 @@ from orionis.luminate.support.environment.functions import (
6
6
  _initialize,
7
7
  _parse_value,
8
8
  _serialize_value,
9
+ _delete_file
9
10
  )
10
11
 
11
12
  class Env(IEnv):
@@ -103,3 +104,35 @@ class Env(IEnv):
103
104
  env_vars[key] = _parse_value(value)
104
105
 
105
106
  return env_vars
107
+
108
+ @staticmethod
109
+ def initialize() -> None:
110
+ """
111
+ Initializes the `.env` file if it does not exist.
112
+
113
+ Parameters
114
+ ----------
115
+ path : str or Path, optional
116
+ The path to the `.env` file. If None, a default path is used.
117
+
118
+ Returns
119
+ -------
120
+ None
121
+ """
122
+ _initialize()
123
+
124
+ @staticmethod
125
+ def destroy() -> None:
126
+ """
127
+ Deletes the `.env` file.
128
+
129
+ Parameters
130
+ ----------
131
+ path : str or Path, optional
132
+ The path to the `.env` file. If None, a default path is used.
133
+
134
+ Returns
135
+ -------
136
+ None
137
+ """
138
+ _delete_file()
@@ -38,4 +38,12 @@ def _serialize_value(value: Any) -> str:
38
38
  """
39
39
  if isinstance(value, (list, dict, bool, int, float)):
40
40
  return repr(value)
41
- return str(value)
41
+ return str(value)
42
+
43
+ def _delete_file() -> None:
44
+ """
45
+ Elimina el archivo especificado.
46
+ """
47
+ resolved_path = Path(os.getcwd()) / ".env"
48
+ if resolved_path.exists():
49
+ os.remove(resolved_path)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: orionis
3
- Version: 0.227.0
3
+ Version: 0.228.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
@@ -1,6 +1,6 @@
1
1
  orionis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  orionis/console.py,sha256=4gYWxf0fWYgJ4RKwARvnTPh06FL3GJ6SAZ7R2NzOICw,1342
3
- orionis/framework.py,sha256=0nR8w7tJGfgogJhNQFfagqqt9GL60Wa2Ejc306-4RgA,1458
3
+ orionis/framework.py,sha256=yvd4Qh0vImy8fXZUPVQya7sgXqCfXJMdu9FsRwpsthQ,1458
4
4
  orionis/installer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  orionis/installer/manager.py,sha256=Li4TVziRXWfum02xNG4JHwbnLk-u8xzHjdqKz-D894k,2755
6
6
  orionis/installer/output.py,sha256=7O9qa2xtXMB_4ZvVi-Klneom9YazwygAd_4uYAoxhbU,8548
@@ -161,8 +161,8 @@ orionis/luminate/support/asynchrony/async_io.py,sha256=IkgVrJnnvNExkhy9brfZpTq2E
161
161
  orionis/luminate/support/asynchrony/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
162
162
  orionis/luminate/support/asynchrony/contracts/async_coroutine.py,sha256=lwtDa6r7I6qbxzKr5MyJtMRaYW6e5j2dbymEPNaNIEo,614
163
163
  orionis/luminate/support/environment/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
164
- orionis/luminate/support/environment/env.py,sha256=CNzVq-UQL4hu7Fdu9xAhpd_4VVFhC16yJxK6MDQ1GFU,3366
165
- orionis/luminate/support/environment/functions.py,sha256=qiKc2oPaWwspSeUF0E8ZZYMsKlFDI1VGLl6vfpAnP4s,1129
164
+ orionis/luminate/support/environment/env.py,sha256=smBVhxIJr4U0RO6CzqtQJLEu_il2Exjpa_564o2PTcI,4085
165
+ orionis/luminate/support/environment/functions.py,sha256=L6gL4z3c89ZU17IWvOXyQ2_GdzA3XOmXeQpIpnQRios,1330
166
166
  orionis/luminate/support/environment/helper.py,sha256=G1670w1xkI1pj-rW_inv6D3XmU4oliwnWnrJO5CBm2E,818
167
167
  orionis/luminate/support/environment/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
168
168
  orionis/luminate/support/environment/contracts/env.py,sha256=buJfzebBOUuq2CnhQCWlnJuzJAEo06-S0_SPR4N_mOY,1647
@@ -226,8 +226,7 @@ tests/support/adapters/fakes/fake_dict.py,sha256=KD48_xBc8pqj3LAe1_v1esu-1Fdz8fL
226
226
  tests/support/async_io/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
227
227
  tests/support/async_io/test_async_coroutine.py,sha256=qXmpfyqaeNUSRQFdKVViGiF2FsRQle9VqyFeR-jAetg,1532
228
228
  tests/support/environment/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
229
- tests/support/environment/test_env.py,sha256=jRJ2Xa7_cEnZg-1KzHOIDvGa0vQ-GxIw3u-MhuC3Aks,1899
230
- tests/support/environment/test_helper.py,sha256=YDTJMl-zAivnchPJMDzDh520GP73OL-nbU_LzRuZCeA,414
229
+ tests/support/environment/test_env.py,sha256=w1TyhnM-xSgAmFr42pEuwGOyww16EboumndY_agDWPA,2662
231
230
  tests/support/inspection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
232
231
  tests/support/inspection/test_reflection_abstract.py,sha256=6w8vm8H_fR4Z-KYjQGm8bq-HcetlpQl0EsDmDy3WzQ8,9311
233
232
  tests/support/inspection/test_reflection_concrete.py,sha256=3BWSU7MkFEv2UgAVAwhiaMrzEwAyDBBJCa6edOENKSU,6782
@@ -250,9 +249,9 @@ tests/support/patterns/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
250
249
  tests/support/patterns/test_singleton.py,sha256=U5uwpgGcP7-fIazsnFLwg30mmc24S62udhVIHuL-scY,634
251
250
  tests/support/standard/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
252
251
  tests/support/standard/test_std.py,sha256=bJ5LV_OKEEZa_Bk3PTk9Kapk6qECLzcKf0hfR_x2QqM,2042
253
- orionis-0.227.0.dist-info/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
254
- orionis-0.227.0.dist-info/METADATA,sha256=BxMm8aSj3n5ZUXYQxq7ySfACGflGEX1qWyzk4bSARoM,3003
255
- orionis-0.227.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
256
- orionis-0.227.0.dist-info/entry_points.txt,sha256=a_e0faeSqyUCVZd0MqljQ2oaHHdlsz6g9sU_bMqi5zQ,49
257
- orionis-0.227.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
258
- orionis-0.227.0.dist-info/RECORD,,
252
+ orionis-0.228.0.dist-info/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
253
+ orionis-0.228.0.dist-info/METADATA,sha256=_wFvSjxKzyhc20WErhCgMTt0Hv9o9WpU8Qcsus_2PXk,3003
254
+ orionis-0.228.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
255
+ orionis-0.228.0.dist-info/entry_points.txt,sha256=a_e0faeSqyUCVZd0MqljQ2oaHHdlsz6g9sU_bMqi5zQ,49
256
+ orionis-0.228.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
257
+ orionis-0.228.0.dist-info/RECORD,,
@@ -19,6 +19,9 @@ class TestsEnvironment(TestCase):
19
19
  result = Env.get('NON_EXISTENT_KEY', True)
20
20
  self.assertEqual(result, True)
21
21
 
22
+ # Delete File .env
23
+ Env.destroy()
24
+
22
25
  async def testSetEnvVariable(self):
23
26
  """
24
27
  Test setting an environment variable in the `.env` file.
@@ -31,6 +34,9 @@ class TestsEnvironment(TestCase):
31
34
  result = Env.get('TEST_KEY')
32
35
  self.assertEqual(result, 'NEW_VALUE')
33
36
 
37
+ # Delete File .env
38
+ Env.destroy()
39
+
34
40
  async def testUnsetEnvVariable(self):
35
41
  """
36
42
  Test removing an environment variable from the `.env` file.
@@ -44,6 +50,27 @@ class TestsEnvironment(TestCase):
44
50
  result = Env.get('TEST_KEY')
45
51
  self.assertIsNone(result)
46
52
 
53
+ # Delete File .env
54
+ Env.destroy()
55
+
56
+ async def testGetEnvHelper(self):
57
+ """"
58
+ Test retrieving an environment variable using the env helper.
59
+ """
60
+
61
+ # Mock the environment setup
62
+ Env.set('FRAMEWORK', 'https://github.com/orionis-framework/framework')
63
+
64
+ # Import the env helper and retrieve the variable
65
+ from orionis.luminate.support.environment.helper import env as get_env
66
+ result = get_env('FRAMEWORK')
67
+
68
+ # Verify the result
69
+ self.assertEqual(result, 'https://github.com/orionis-framework/framework')
70
+
71
+ # Delete File .env
72
+ Env.destroy()
73
+
47
74
  async def test_get_all_env_variables(self):
48
75
  """
49
76
  Test retrieving all environment variables from the `.env` file.
@@ -60,5 +87,5 @@ class TestsEnvironment(TestCase):
60
87
  self.assertEqual(result.get('KEY1'), 'value1')
61
88
  self.assertEqual(result.get('KEY2'), 'value2')
62
89
 
63
- Env.unset('KEY1')
64
- Env.unset('KEY2')
90
+ # Delete File .env
91
+ Env.destroy()
@@ -1,11 +0,0 @@
1
- from orionis.luminate.support.environment.helper import env
2
- from orionis.luminate.test.test_case import TestCase
3
-
4
- class TestsEnvironmentHelper(TestCase):
5
-
6
- async def testGetEnvHelper(self):
7
- """"
8
- Test retrieving an environment variable using the env helper.
9
- """
10
- result = env('FRAMEWORK')
11
- self.assertEqual(result, 'https://github.com/orionis-framework/framework')