PyEnvToolsKit 1.0.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.
PyEnv/config.py ADDED
@@ -0,0 +1,15 @@
1
+ from .environement import Environement
2
+
3
+ def Config(env: str="dev"):
4
+
5
+ def decorator(function: callable):
6
+
7
+ def execute(*args, **kwargs):
8
+ return function(*args, **kwargs)
9
+
10
+ environement = Environement().env
11
+
12
+ if environement == env:
13
+ return execute
14
+
15
+ return decorator
PyEnv/env.py ADDED
@@ -0,0 +1,14 @@
1
+ import sys
2
+ from .environement import Environement
3
+
4
+ def Env(env: str="dev"):
5
+ def decorator(cls):
6
+
7
+ if sys.modules.get(cls.__module__) is sys.modules["__main__"]:
8
+
9
+ cls.env = Environement(env)
10
+ return cls
11
+ else:
12
+ return cls
13
+
14
+ return decorator
PyEnv/environement.py ADDED
@@ -0,0 +1,20 @@
1
+ from DecoratorsToolKit.Singleton import Singleton #type: ignore
2
+ from DecoratorsToolKit.NoChange import NoChange #type: ignore
3
+ from typing import Any
4
+
5
+ @Singleton()
6
+ @NoChange()
7
+ class Environement:
8
+
9
+ def __init__(self, env: str="dev"):
10
+ self.env = env
11
+ self.vars: list[dict] = []
12
+
13
+ def add(self, value: dict):
14
+ self.vars.append(value)
15
+
16
+ def get(self, key: str):
17
+
18
+ for value in self.vars:
19
+ if key in value:
20
+ return value[key]
PyEnv/getVars.py ADDED
@@ -0,0 +1,8 @@
1
+ from .environement import Environement
2
+
3
+
4
+ def getEnvVars(key: str):
5
+
6
+ env = Environement()
7
+
8
+ return env.get(key)
PyEnv/seeder.py ADDED
@@ -0,0 +1,18 @@
1
+ from .environement import Environement
2
+
3
+ from functools import wraps
4
+
5
+ def Seeder(env: list[str]):
6
+ def decorator(function: callable):
7
+ environement = Environement()
8
+
9
+ @wraps(function)
10
+ def execute(*args, **kwargs):
11
+ if environement.env not in env:
12
+ return None
13
+
14
+ return function(*args, **kwargs)
15
+
16
+ return execute
17
+
18
+ return decorator
PyEnv/test.py ADDED
@@ -0,0 +1,15 @@
1
+ from .environement import Environement
2
+
3
+ def Test():
4
+ def decorator(function: callable):
5
+
6
+ def execute(*args, **kwargs):
7
+ return function(*args, **kwargs)
8
+ env = Environement()
9
+
10
+ if env.env == "test":
11
+ return execute
12
+
13
+ else:
14
+ return None
15
+ return decorator
PyEnv/variablesEnv.py ADDED
@@ -0,0 +1,12 @@
1
+ from typing import Any
2
+
3
+ from .environement import Environement
4
+
5
+ class VarEnv:
6
+
7
+ def __init__(self, key: str, value: Any):
8
+
9
+ env = Environement().add({key : value})
10
+
11
+ self.key = key
12
+ self.value = value
@@ -0,0 +1,5 @@
1
+ Metadata-Version: 2.4
2
+ Name: PyEnvToolsKit
3
+ Version: 1.0.0
4
+ Summary: Bibliothèque permettant de simuler un environement
5
+ Requires-Dist: DecoratorsToolKit>=1.0.0
@@ -0,0 +1,11 @@
1
+ PyEnv/config.py,sha256=tOKCbNbcU0-x3budVvqHtTU1h_Ax1ask5YOXi2ggqs8,330
2
+ PyEnv/env.py,sha256=hSL1OkX1kLZ0iNkClZvx30lgAMq94hVmLiTz4Ew5qzg,307
3
+ PyEnv/environement.py,sha256=UD_uF7g125zaYgj0ctIQriW3cFGeylA6EKObew1XykM,503
4
+ PyEnv/getVars.py,sha256=fEWp8flDS_Q5jkJ5xQKT4W-QfO3wPOMJe17q5K4GWt4,124
5
+ PyEnv/seeder.py,sha256=xSTxIUOsuzIU_vTSiS3uKd0y6KI5NQFEIpsYduuogWE,418
6
+ PyEnv/test.py,sha256=XSK6YoWBFQgZDen1EKL2zzYvanADUWcuW1sgP6nopLs,335
7
+ PyEnv/variablesEnv.py,sha256=VcCYZq3FJ13TLM9p4yrSNElWCj0mU71vf9PAAFjDJJI,235
8
+ pyenvtoolskit-1.0.0.dist-info/METADATA,sha256=cVYq6WPvdVzjAnhaaSFl49_l2ktNzEIEvYe-z5qK584,163
9
+ pyenvtoolskit-1.0.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
10
+ pyenvtoolskit-1.0.0.dist-info/top_level.txt,sha256=w17jU2h7j7mxOCpO8lbQaZJgiL0h48l1X-ooNu7jcjk,6
11
+ pyenvtoolskit-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ PyEnv