potato-util 0.0.4__tar.gz → 0.1.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.
Files changed (40) hide show
  1. {potato_util-0.0.4/src/potato_util.egg-info → potato_util-0.1.0}/PKG-INFO +9 -9
  2. {potato_util-0.0.4 → potato_util-0.1.0}/requirements/requirements.async.txt +1 -1
  3. {potato_util-0.0.4 → potato_util-0.1.0}/requirements/requirements.docs.txt +1 -1
  4. {potato_util-0.0.4 → potato_util-0.1.0}/requirements/requirements.test.txt +1 -1
  5. potato_util-0.1.0/src/potato_util/__version__.py +1 -0
  6. {potato_util-0.0.4 → potato_util-0.1.0}/src/potato_util/_base.py +50 -0
  7. {potato_util-0.0.4 → potato_util-0.1.0/src/potato_util.egg-info}/PKG-INFO +9 -9
  8. {potato_util-0.0.4 → potato_util-0.1.0}/src/potato_util.egg-info/requires.txt +8 -8
  9. potato_util-0.0.4/src/potato_util/__version__.py +0 -1
  10. {potato_util-0.0.4 → potato_util-0.1.0}/.python-version +0 -0
  11. {potato_util-0.0.4 → potato_util-0.1.0}/LICENSE.txt +0 -0
  12. {potato_util-0.0.4 → potato_util-0.1.0}/README.md +0 -0
  13. {potato_util-0.0.4 → potato_util-0.1.0}/pyproject.toml +0 -0
  14. {potato_util-0.0.4 → potato_util-0.1.0}/requirements/requirements.build.txt +0 -0
  15. {potato_util-0.0.4 → potato_util-0.1.0}/requirements/requirements.dev.txt +0 -0
  16. {potato_util-0.0.4 → potato_util-0.1.0}/requirements/requirements.fastapi.txt +0 -0
  17. {potato_util-0.0.4 → potato_util-0.1.0}/requirements.txt +0 -0
  18. {potato_util-0.0.4 → potato_util-0.1.0}/setup.cfg +0 -0
  19. {potato_util-0.0.4 → potato_util-0.1.0}/setup.py +0 -0
  20. {potato_util-0.0.4 → potato_util-0.1.0}/src/potato_util/__init__.py +0 -0
  21. {potato_util-0.0.4 → potato_util-0.1.0}/src/potato_util/constants/__init__.py +0 -0
  22. {potato_util-0.0.4 → potato_util-0.1.0}/src/potato_util/constants/_base.py +0 -0
  23. {potato_util-0.0.4 → potato_util-0.1.0}/src/potato_util/constants/_enum.py +0 -0
  24. {potato_util-0.0.4 → potato_util-0.1.0}/src/potato_util/constants/_regex.py +0 -0
  25. {potato_util-0.0.4 → potato_util-0.1.0}/src/potato_util/dt.py +0 -0
  26. {potato_util-0.0.4 → potato_util-0.1.0}/src/potato_util/generator.py +0 -0
  27. {potato_util-0.0.4 → potato_util-0.1.0}/src/potato_util/http/__init__.py +0 -0
  28. {potato_util-0.0.4 → potato_util-0.1.0}/src/potato_util/http/_async.py +0 -0
  29. {potato_util-0.0.4 → potato_util-0.1.0}/src/potato_util/http/_base.py +0 -0
  30. {potato_util-0.0.4 → potato_util-0.1.0}/src/potato_util/http/_sync.py +0 -0
  31. {potato_util-0.0.4 → potato_util-0.1.0}/src/potato_util/http/fastapi.py +0 -0
  32. {potato_util-0.0.4 → potato_util-0.1.0}/src/potato_util/io/__init__.py +0 -0
  33. {potato_util-0.0.4 → potato_util-0.1.0}/src/potato_util/io/_async.py +0 -0
  34. {potato_util-0.0.4 → potato_util-0.1.0}/src/potato_util/io/_sync.py +0 -0
  35. {potato_util-0.0.4 → potato_util-0.1.0}/src/potato_util/sanitizer.py +0 -0
  36. {potato_util-0.0.4 → potato_util-0.1.0}/src/potato_util/secure.py +0 -0
  37. {potato_util-0.0.4 → potato_util-0.1.0}/src/potato_util/validator.py +0 -0
  38. {potato_util-0.0.4 → potato_util-0.1.0}/src/potato_util.egg-info/SOURCES.txt +0 -0
  39. {potato_util-0.0.4 → potato_util-0.1.0}/src/potato_util.egg-info/dependency_links.txt +0 -0
  40. {potato_util-0.0.4 → potato_util-0.1.0}/src/potato_util.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: potato_util
3
- Version: 0.0.4
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<25.0.0,>=24.1.0; extra == "async"
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<25.0.0,>=24.1.0; extra == "all"
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<25.0.0,>=24.1.0; extra == "test"
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<9.0.0,>=8.0.2; extra == "test"
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<4.0.0,>=3.0.4; extra == "docs"
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<25.0.0,>=24.1.0; extra == "dev"
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<9.0.0,>=8.0.2; extra == "dev"
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<4.0.0,>=3.0.4; extra == "dev"
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,3 +1,3 @@
1
- aiofiles>=24.1.0,<25.0.0
1
+ aiofiles>=24.1.0,<26.0.0
2
2
  aioshutil>=1.5,<2.0.0
3
3
  aiohttp>=3.11.18,<4.0.0
@@ -1,4 +1,4 @@
1
- pylint>=3.0.4,<4.0.0
1
+ pylint>=3.0.4,<5.0.0
2
2
  mkdocs-material>=9.5.50,<10.0.0
3
3
  mkdocs-awesome-nav>=3.0.0,<4.0.0
4
4
  mkdocstrings[python]>=0.24.3,<1.0.0
@@ -1,4 +1,4 @@
1
- pytest>=8.0.2,<9.0.0
1
+ pytest>=8.0.2,<10.0.0
2
2
  pytest-cov>=5.0.0,<8.0.0
3
3
  pytest-xdist>=3.6.1,<4.0.0
4
4
  pytest-benchmark>=5.0.1,<6.0.0
@@ -0,0 +1 @@
1
+ __version__ = "0.1.0"
@@ -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.4
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<25.0.0,>=24.1.0; extra == "async"
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<25.0.0,>=24.1.0; extra == "all"
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<25.0.0,>=24.1.0; extra == "test"
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<9.0.0,>=8.0.2; extra == "test"
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<4.0.0,>=3.0.4; extra == "docs"
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<25.0.0,>=24.1.0; extra == "dev"
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<9.0.0,>=8.0.2; extra == "dev"
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<4.0.0,>=3.0.4; extra == "dev"
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"
@@ -3,13 +3,13 @@ pydantic[email,timezone]<3.0.0,>=2.0.3
3
3
  pydantic-settings<3.0.0,>=2.2.1
4
4
 
5
5
  [all]
6
- aiofiles<25.0.0,>=24.1.0
6
+ aiofiles<26.0.0,>=24.1.0
7
7
  aioshutil<2.0.0,>=1.5
8
8
  aiohttp<4.0.0,>=3.11.18
9
9
  fastapi<1.0.0,>=0.109.2
10
10
 
11
11
  [async]
12
- aiofiles<25.0.0,>=24.1.0
12
+ aiofiles<26.0.0,>=24.1.0
13
13
  aioshutil<2.0.0,>=1.5
14
14
  aiohttp<4.0.0,>=3.11.18
15
15
 
@@ -20,11 +20,11 @@ build<2.0.0,>=1.1.1
20
20
  twine<7.0.0,>=6.0.1
21
21
 
22
22
  [dev]
23
- aiofiles<25.0.0,>=24.1.0
23
+ aiofiles<26.0.0,>=24.1.0
24
24
  aioshutil<2.0.0,>=1.5
25
25
  aiohttp<4.0.0,>=3.11.18
26
26
  fastapi<1.0.0,>=0.109.2
27
- pytest<9.0.0,>=8.0.2
27
+ pytest<10.0.0,>=8.0.2
28
28
  pytest-cov<8.0.0,>=5.0.0
29
29
  pytest-xdist<4.0.0,>=3.6.1
30
30
  pytest-benchmark<6.0.0,>=5.0.1
@@ -32,7 +32,7 @@ setuptools<81.0.0,>=70.3.0
32
32
  wheel<1.0.0,>=0.43.0
33
33
  build<2.0.0,>=1.1.1
34
34
  twine<7.0.0,>=6.0.1
35
- pylint<4.0.0,>=3.0.4
35
+ pylint<5.0.0,>=3.0.4
36
36
  mkdocs-material<10.0.0,>=9.5.50
37
37
  mkdocs-awesome-nav<4.0.0,>=3.0.0
38
38
  mkdocstrings[python]<1.0.0,>=0.24.3
@@ -41,7 +41,7 @@ pyright<2.0.0,>=1.1.392
41
41
  pre-commit<5.0.0,>=4.0.1
42
42
 
43
43
  [docs]
44
- pylint<4.0.0,>=3.0.4
44
+ pylint<5.0.0,>=3.0.4
45
45
  mkdocs-material<10.0.0,>=9.5.50
46
46
  mkdocs-awesome-nav<4.0.0,>=3.0.0
47
47
  mkdocstrings[python]<1.0.0,>=0.24.3
@@ -51,11 +51,11 @@ mike<3.0.0,>=2.1.3
51
51
  fastapi<1.0.0,>=0.109.2
52
52
 
53
53
  [test]
54
- aiofiles<25.0.0,>=24.1.0
54
+ aiofiles<26.0.0,>=24.1.0
55
55
  aioshutil<2.0.0,>=1.5
56
56
  aiohttp<4.0.0,>=3.11.18
57
57
  fastapi<1.0.0,>=0.109.2
58
- pytest<9.0.0,>=8.0.2
58
+ pytest<10.0.0,>=8.0.2
59
59
  pytest-cov<8.0.0,>=5.0.0
60
60
  pytest-xdist<4.0.0,>=3.6.1
61
61
  pytest-benchmark<6.0.0,>=5.0.1
@@ -1 +0,0 @@
1
- __version__ = "0.0.4"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes