potato-util 0.0.4__py3-none-any.whl → 0.1.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.
- potato_util/__version__.py +1 -1
- potato_util/_base.py +50 -0
- {potato_util-0.0.4.dist-info → potato_util-0.1.0.dist-info}/METADATA +9 -9
- {potato_util-0.0.4.dist-info → potato_util-0.1.0.dist-info}/RECORD +7 -7
- {potato_util-0.0.4.dist-info → potato_util-0.1.0.dist-info}/WHEEL +0 -0
- {potato_util-0.0.4.dist-info → potato_util-0.1.0.dist-info}/licenses/LICENSE.txt +0 -0
- {potato_util-0.0.4.dist-info → potato_util-0.1.0.dist-info}/top_level.txt +0 -0
potato_util/__version__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.0
|
|
1
|
+
__version__ = "0.1.0"
|
potato_util/_base.py
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
1
3
|
import re
|
|
2
4
|
import copy
|
|
3
5
|
import logging
|
|
4
6
|
|
|
5
7
|
from pydantic import validate_call
|
|
6
8
|
|
|
9
|
+
from .validator import is_truthy
|
|
10
|
+
|
|
7
11
|
|
|
8
12
|
logger = logging.getLogger(__name__)
|
|
9
13
|
|
|
@@ -51,7 +55,53 @@ def camel_to_snake(val: str) -> str:
|
|
|
51
55
|
return val
|
|
52
56
|
|
|
53
57
|
|
|
58
|
+
@validate_call
|
|
59
|
+
def get_slug_name(file_path: str | None = None) -> str:
|
|
60
|
+
"""Slugify the file name from the given file path or the current script's file path.
|
|
61
|
+
|
|
62
|
+
Args:
|
|
63
|
+
file_path (str | None, optional): The file path to slugify. If None, uses the current script's file path.
|
|
64
|
+
Defaults to None.
|
|
65
|
+
|
|
66
|
+
Returns:
|
|
67
|
+
str: The slugified file name.
|
|
68
|
+
"""
|
|
69
|
+
|
|
70
|
+
if not file_path:
|
|
71
|
+
file_path = sys.argv[0]
|
|
72
|
+
|
|
73
|
+
_slug_name = (
|
|
74
|
+
os.path.splitext(os.path.basename(file_path))[0]
|
|
75
|
+
.strip()
|
|
76
|
+
.replace(" ", "-")
|
|
77
|
+
.replace("_", "-")
|
|
78
|
+
.lower()
|
|
79
|
+
)
|
|
80
|
+
return _slug_name
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def is_debug_mode() -> bool:
|
|
84
|
+
"""Check if the application is running in debug mode based on environment variables.
|
|
85
|
+
|
|
86
|
+
Returns:
|
|
87
|
+
bool: True if in debug mode, False otherwise.
|
|
88
|
+
"""
|
|
89
|
+
|
|
90
|
+
_is_debug = False
|
|
91
|
+
_debug = os.getenv("DEBUG", "").strip().lower()
|
|
92
|
+
if _debug and is_truthy(_debug):
|
|
93
|
+
_is_debug = True
|
|
94
|
+
|
|
95
|
+
_env = os.getenv("ENV", "").strip().lower()
|
|
96
|
+
if (_env == "development") and (_debug == ""):
|
|
97
|
+
_is_debug = True
|
|
98
|
+
|
|
99
|
+
return _is_debug
|
|
100
|
+
|
|
101
|
+
|
|
54
102
|
__all__ = [
|
|
55
103
|
"deep_merge",
|
|
56
104
|
"camel_to_snake",
|
|
105
|
+
"get_slug_name",
|
|
106
|
+
"is_debug_mode",
|
|
57
107
|
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: potato_util
|
|
3
|
-
Version: 0.0
|
|
3
|
+
Version: 0.1.0
|
|
4
4
|
Summary: 'potato_util' is collection of simple useful utils package for python.
|
|
5
5
|
Author-email: Batkhuu Byambajav <batkhuu10@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/bybatkhuu/module-python-utils
|
|
@@ -25,22 +25,22 @@ Requires-Dist: python-dotenv<2.0.0,>=1.0.1
|
|
|
25
25
|
Requires-Dist: pydantic[email,timezone]<3.0.0,>=2.0.3
|
|
26
26
|
Requires-Dist: pydantic-settings<3.0.0,>=2.2.1
|
|
27
27
|
Provides-Extra: async
|
|
28
|
-
Requires-Dist: aiofiles<
|
|
28
|
+
Requires-Dist: aiofiles<26.0.0,>=24.1.0; extra == "async"
|
|
29
29
|
Requires-Dist: aioshutil<2.0.0,>=1.5; extra == "async"
|
|
30
30
|
Requires-Dist: aiohttp<4.0.0,>=3.11.18; extra == "async"
|
|
31
31
|
Provides-Extra: fastapi
|
|
32
32
|
Requires-Dist: fastapi<1.0.0,>=0.109.2; extra == "fastapi"
|
|
33
33
|
Provides-Extra: all
|
|
34
|
-
Requires-Dist: aiofiles<
|
|
34
|
+
Requires-Dist: aiofiles<26.0.0,>=24.1.0; extra == "all"
|
|
35
35
|
Requires-Dist: aioshutil<2.0.0,>=1.5; extra == "all"
|
|
36
36
|
Requires-Dist: aiohttp<4.0.0,>=3.11.18; extra == "all"
|
|
37
37
|
Requires-Dist: fastapi<1.0.0,>=0.109.2; extra == "all"
|
|
38
38
|
Provides-Extra: test
|
|
39
|
-
Requires-Dist: aiofiles<
|
|
39
|
+
Requires-Dist: aiofiles<26.0.0,>=24.1.0; extra == "test"
|
|
40
40
|
Requires-Dist: aioshutil<2.0.0,>=1.5; extra == "test"
|
|
41
41
|
Requires-Dist: aiohttp<4.0.0,>=3.11.18; extra == "test"
|
|
42
42
|
Requires-Dist: fastapi<1.0.0,>=0.109.2; extra == "test"
|
|
43
|
-
Requires-Dist: pytest<
|
|
43
|
+
Requires-Dist: pytest<10.0.0,>=8.0.2; extra == "test"
|
|
44
44
|
Requires-Dist: pytest-cov<8.0.0,>=5.0.0; extra == "test"
|
|
45
45
|
Requires-Dist: pytest-xdist<4.0.0,>=3.6.1; extra == "test"
|
|
46
46
|
Requires-Dist: pytest-benchmark<6.0.0,>=5.0.1; extra == "test"
|
|
@@ -50,17 +50,17 @@ Requires-Dist: wheel<1.0.0,>=0.43.0; extra == "build"
|
|
|
50
50
|
Requires-Dist: build<2.0.0,>=1.1.1; extra == "build"
|
|
51
51
|
Requires-Dist: twine<7.0.0,>=6.0.1; extra == "build"
|
|
52
52
|
Provides-Extra: docs
|
|
53
|
-
Requires-Dist: pylint<
|
|
53
|
+
Requires-Dist: pylint<5.0.0,>=3.0.4; extra == "docs"
|
|
54
54
|
Requires-Dist: mkdocs-material<10.0.0,>=9.5.50; extra == "docs"
|
|
55
55
|
Requires-Dist: mkdocs-awesome-nav<4.0.0,>=3.0.0; extra == "docs"
|
|
56
56
|
Requires-Dist: mkdocstrings[python]<1.0.0,>=0.24.3; extra == "docs"
|
|
57
57
|
Requires-Dist: mike<3.0.0,>=2.1.3; extra == "docs"
|
|
58
58
|
Provides-Extra: dev
|
|
59
|
-
Requires-Dist: aiofiles<
|
|
59
|
+
Requires-Dist: aiofiles<26.0.0,>=24.1.0; extra == "dev"
|
|
60
60
|
Requires-Dist: aioshutil<2.0.0,>=1.5; extra == "dev"
|
|
61
61
|
Requires-Dist: aiohttp<4.0.0,>=3.11.18; extra == "dev"
|
|
62
62
|
Requires-Dist: fastapi<1.0.0,>=0.109.2; extra == "dev"
|
|
63
|
-
Requires-Dist: pytest<
|
|
63
|
+
Requires-Dist: pytest<10.0.0,>=8.0.2; extra == "dev"
|
|
64
64
|
Requires-Dist: pytest-cov<8.0.0,>=5.0.0; extra == "dev"
|
|
65
65
|
Requires-Dist: pytest-xdist<4.0.0,>=3.6.1; extra == "dev"
|
|
66
66
|
Requires-Dist: pytest-benchmark<6.0.0,>=5.0.1; extra == "dev"
|
|
@@ -68,7 +68,7 @@ Requires-Dist: setuptools<81.0.0,>=70.3.0; extra == "dev"
|
|
|
68
68
|
Requires-Dist: wheel<1.0.0,>=0.43.0; extra == "dev"
|
|
69
69
|
Requires-Dist: build<2.0.0,>=1.1.1; extra == "dev"
|
|
70
70
|
Requires-Dist: twine<7.0.0,>=6.0.1; extra == "dev"
|
|
71
|
-
Requires-Dist: pylint<
|
|
71
|
+
Requires-Dist: pylint<5.0.0,>=3.0.4; extra == "dev"
|
|
72
72
|
Requires-Dist: mkdocs-material<10.0.0,>=9.5.50; extra == "dev"
|
|
73
73
|
Requires-Dist: mkdocs-awesome-nav<4.0.0,>=3.0.0; extra == "dev"
|
|
74
74
|
Requires-Dist: mkdocstrings[python]<1.0.0,>=0.24.3; extra == "dev"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
potato_util/__init__.py,sha256=xl4th2Z_OmTk-3aO1w05Vh8ob0BnX4RcY1fT9tGX61c,74
|
|
2
|
-
potato_util/__version__.py,sha256=
|
|
3
|
-
potato_util/_base.py,sha256=
|
|
2
|
+
potato_util/__version__.py,sha256=kUR5RAFc7HCeiqdlX36dZOHkUI5wI6V_43RpEcD8b-0,22
|
|
3
|
+
potato_util/_base.py,sha256=oKLzp_NheI7kQAKC5xAm77OI_UmBXRuEEpulZTVBg5w,2549
|
|
4
4
|
potato_util/dt.py,sha256=DatLzuXOxdanplBv-Kf3qOaomrTCUUBSYv_QgTtQB6U,7635
|
|
5
5
|
potato_util/generator.py,sha256=vdvHj1UrCOQI2WXQHQ2H63PMLQ6yOXAZPNl0m-6BgtY,1572
|
|
6
6
|
potato_util/sanitizer.py,sha256=pZuMDvZxKKIdwFKTcqfmHb9ji-UefSgRgJ8ynHG6UFs,2267
|
|
@@ -18,8 +18,8 @@ potato_util/http/fastapi.py,sha256=iqCxZcQDIVtcqCN9dZ4itcoUs6KzsfRGgK7sRd5EmOA,6
|
|
|
18
18
|
potato_util/io/__init__.py,sha256=FoGcN7t0uArQV4hbMR1X5aeC8Yq-h_ds4xooNpkmgG0,209
|
|
19
19
|
potato_util/io/_async.py,sha256=XVNFDCRII-ib32tksxj5G3nDLsV-ylTW2Hw3_seIY-k,10012
|
|
20
20
|
potato_util/io/_sync.py,sha256=ZVRukOYWWvXtVlU_Gf8GoKnQZqSI2LISHPMmxXi4-2U,9644
|
|
21
|
-
potato_util-0.0.
|
|
22
|
-
potato_util-0.0.
|
|
23
|
-
potato_util-0.0.
|
|
24
|
-
potato_util-0.0.
|
|
25
|
-
potato_util-0.0.
|
|
21
|
+
potato_util-0.1.0.dist-info/licenses/LICENSE.txt,sha256=CUTK-r0BWIg1r0bBiemAcMhakgV0N7HuRhw6rQ-A9A4,1074
|
|
22
|
+
potato_util-0.1.0.dist-info/METADATA,sha256=q0H54xuFPSMp-VMTBytUC4e7i7xPE4uEPjrBZ3H3Jl0,15636
|
|
23
|
+
potato_util-0.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
24
|
+
potato_util-0.1.0.dist-info/top_level.txt,sha256=pLMnSfT6rhlYBpo2Gnd8kKMDxcuvxdVizqsv1dd1frw,12
|
|
25
|
+
potato_util-0.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|