yta-programming-env 0.0.1__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.
@@ -0,0 +1,49 @@
1
+ from yta_programming_path import DevPathHandler
2
+ from yta_validation.parameter import ParameterValidator
3
+ from dotenv import load_dotenv
4
+ from typing import Union
5
+
6
+ import os
7
+
8
+
9
+ class Environment:
10
+ """
11
+ Class to handle the environment of the project in
12
+ which you are executing this code perfectly.
13
+ """
14
+
15
+ @staticmethod
16
+ def load_current_project_dotenv(
17
+ ):
18
+ """
19
+ Load the current project environment '.env' configuration
20
+ file. The current project is the one in which the code
21
+ is being executed (the code in which you call this method,
22
+ not the library in which it is written).
23
+
24
+ Any project in which you are importing this library, the
25
+ '.env' file on its main folder will be loaded.
26
+ """
27
+ load_dotenv(os.path.join(DevPathHandler.get_project_abspath(), '.env'))
28
+
29
+ @staticmethod
30
+ def get_current_project_env(
31
+ variable: str,
32
+ default_value: Union[str, bool, float, int, None] = None
33
+ ):
34
+ """
35
+ Load the current project environment '.env' configuration
36
+ file and get the value of the 'variable' if existing.
37
+
38
+ This method makes a 'load_dotenv' call within the current
39
+ project absolute path any time you call it, so it ensures
40
+ the value is correctly loaded if available.
41
+
42
+ You don't need to do 'load_dotenv()' to call this method,
43
+ it will do for you =).
44
+ """
45
+ ParameterValidator.validate_mandatory_string('variable', variable, do_accept_empty = False)
46
+
47
+ Environment.load_current_project_dotenv()
48
+
49
+ return os.getenv(variable, default_value)
@@ -0,0 +1,18 @@
1
+ Metadata-Version: 2.4
2
+ Name: yta-programming-env
3
+ Version: 0.0.1
4
+ Summary: Youtube Autonomous Programming Dependencies Module
5
+ License-File: LICENSE
6
+ Author: danialcala94
7
+ Author-email: danielalcalavalera@gmail.com
8
+ Requires-Python: ==3.9
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.9
11
+ Requires-Dist: python-dotenv (>=1.0.0,<9.0.0)
12
+ Requires-Dist: yta_programming_path (>=0.0.1,<1.0.0)
13
+ Requires-Dist: yta_validation (>=0.0.1,<1.0.0)
14
+ Description-Content-Type: text/markdown
15
+
16
+ # Youtube Autonomous Programming Environment add-on
17
+
18
+ The way to work internally with some of the functionalities we need related to handling environment variables.
@@ -0,0 +1,5 @@
1
+ yta_programming_env/__init__.py,sha256=-F11U_gE3KHe53QqJOlc9qI-AgNBgVAo30s1-YoAAY0,1685
2
+ yta_programming_env-0.0.1.dist-info/licenses/LICENSE,sha256=6kbiFSfobTZ7beWiKnHpN902HgBx-Jzgcme0SvKqhKY,1091
3
+ yta_programming_env-0.0.1.dist-info/METADATA,sha256=r7BC2WFc3pVCbdj802vLfbETCgfvE4wYjOPYuNQ4jEo,681
4
+ yta_programming_env-0.0.1.dist-info/WHEEL,sha256=M5asmiAlL6HEcOq52Yi5mmk9KmTVjY2RDPtO4p9DMrc,88
5
+ yta_programming_env-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: poetry-core 2.2.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2018 The Python Packaging Authority
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.