PyEnvToolsKit 1.0.0__tar.gz
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.
- pyenvtoolskit-1.0.0/PKG-INFO +5 -0
- pyenvtoolskit-1.0.0/PyEnv/config.py +15 -0
- pyenvtoolskit-1.0.0/PyEnv/env.py +14 -0
- pyenvtoolskit-1.0.0/PyEnv/environement.py +20 -0
- pyenvtoolskit-1.0.0/PyEnv/getVars.py +8 -0
- pyenvtoolskit-1.0.0/PyEnv/seeder.py +18 -0
- pyenvtoolskit-1.0.0/PyEnv/test.py +15 -0
- pyenvtoolskit-1.0.0/PyEnv/variablesEnv.py +12 -0
- pyenvtoolskit-1.0.0/PyEnvToolsKit.egg-info/PKG-INFO +5 -0
- pyenvtoolskit-1.0.0/PyEnvToolsKit.egg-info/SOURCES.txt +13 -0
- pyenvtoolskit-1.0.0/PyEnvToolsKit.egg-info/dependency_links.txt +1 -0
- pyenvtoolskit-1.0.0/PyEnvToolsKit.egg-info/requires.txt +1 -0
- pyenvtoolskit-1.0.0/PyEnvToolsKit.egg-info/top_level.txt +2 -0
- pyenvtoolskit-1.0.0/pyproject.toml +15 -0
- pyenvtoolskit-1.0.0/setup.cfg +4 -0
|
@@ -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
|
|
@@ -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
|
|
@@ -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]
|
|
@@ -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
|
|
@@ -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
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
pyproject.toml
|
|
2
|
+
PyEnv/config.py
|
|
3
|
+
PyEnv/env.py
|
|
4
|
+
PyEnv/environement.py
|
|
5
|
+
PyEnv/getVars.py
|
|
6
|
+
PyEnv/seeder.py
|
|
7
|
+
PyEnv/test.py
|
|
8
|
+
PyEnv/variablesEnv.py
|
|
9
|
+
PyEnvToolsKit.egg-info/PKG-INFO
|
|
10
|
+
PyEnvToolsKit.egg-info/SOURCES.txt
|
|
11
|
+
PyEnvToolsKit.egg-info/dependency_links.txt
|
|
12
|
+
PyEnvToolsKit.egg-info/requires.txt
|
|
13
|
+
PyEnvToolsKit.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
DecoratorsToolKit>=1.0.0
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "PyEnvToolsKit"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "Bibliothèque permettant de simuler un environement"
|
|
9
|
+
|
|
10
|
+
dependencies = [
|
|
11
|
+
"DecoratorsToolKit>=1.0.0"
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
[tool.setuptools.packages.find]
|
|
15
|
+
where = ["."]
|