arpakitlib 1.6.62__py3-none-any.whl → 1.6.63__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.
- arpakitlib/_cli.py +20 -0
- arpakitlib/ar_hello_world.py +11 -0
- arpakitlib/ar_parse_command.py +12 -1
- {arpakitlib-1.6.62.dist-info → arpakitlib-1.6.63.dist-info}/METADATA +1 -1
- {arpakitlib-1.6.62.dist-info → arpakitlib-1.6.63.dist-info}/RECORD +9 -6
- arpakitlib-1.6.63.dist-info/entry_points.txt +3 -0
- {arpakitlib-1.6.62.dist-info → arpakitlib-1.6.63.dist-info}/LICENSE +0 -0
- {arpakitlib-1.6.62.dist-info → arpakitlib-1.6.63.dist-info}/NOTICE +0 -0
- {arpakitlib-1.6.62.dist-info → arpakitlib-1.6.63.dist-info}/WHEEL +0 -0
arpakitlib/_cli.py
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# arpakit
|
2
|
+
|
3
|
+
import sys
|
4
|
+
|
5
|
+
from arpakitlib.ar_parse_command import parse_command
|
6
|
+
|
7
|
+
|
8
|
+
def cli():
|
9
|
+
parsed_command = parse_command(text=" ".join(sys.argv))
|
10
|
+
parsed_command.raise_for_command(needed_command="arpakitlib", lower_=True)
|
11
|
+
|
12
|
+
print(parsed_command)
|
13
|
+
|
14
|
+
|
15
|
+
def __example():
|
16
|
+
pass
|
17
|
+
|
18
|
+
|
19
|
+
if __name__ == '__main__':
|
20
|
+
__example()
|
arpakitlib/ar_parse_command.py
CHANGED
@@ -5,6 +5,8 @@ from typing import Optional
|
|
5
5
|
|
6
6
|
from pydantic import BaseModel
|
7
7
|
|
8
|
+
from arpakitlib.ar_enumeration_util import ValuesForParseType
|
9
|
+
|
8
10
|
_ARPAKIT_LIB_MODULE_VERSION = "3.0"
|
9
11
|
|
10
12
|
|
@@ -14,9 +16,18 @@ class BadCommandFormat(Exception):
|
|
14
16
|
|
15
17
|
class ParsedCommand(BaseModel):
|
16
18
|
command: str
|
17
|
-
key_to_value: dict[str,
|
19
|
+
key_to_value: dict[str, str | None] = {}
|
18
20
|
values_without_key: list[str] = []
|
19
21
|
|
22
|
+
def raise_for_command(self, needed_command: str, lower_: bool = True):
|
23
|
+
needed_command = needed_command.strip()
|
24
|
+
|
25
|
+
if (
|
26
|
+
(self.command.lower() if lower_ else self.command)
|
27
|
+
!= (needed_command.lower() if lower_ else needed_command)
|
28
|
+
):
|
29
|
+
raise ValuesForParseType(f"needed_command != {self.command}, lower_={lower_}")
|
30
|
+
|
20
31
|
@property
|
21
32
|
def keys(self) -> list[str]:
|
22
33
|
return [k for k, v in self.key_to_value.items() if v is not None]
|
@@ -1,4 +1,5 @@
|
|
1
1
|
arpakitlib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
+
arpakitlib/_cli.py,sha256=7Fg0gUuF_NHOk3eAisyPYFba0h04mI0jsqXcvCO-aSk,329
|
2
3
|
arpakitlib/ar_additional_model_util.py,sha256=tNzZhZtvtJ1qC6Cn4UnyoEL58HudfpCdQy5ftkCqyik,473
|
3
4
|
arpakitlib/ar_aiogram_util.py,sha256=yOqH-Xmifw4niRtIy4EeP9xdeUA_0I-3ZrUrlE4cw_c,12508
|
4
5
|
arpakitlib/ar_arpakit_lib_module_util.py,sha256=V_mc3Ml73Tzz3arxmwEfIxruKMyrwbe8XZ9FfVDtUXY,5446
|
@@ -34,6 +35,7 @@ arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui.js.map,sha256=9UhIW7MqCOZPAz1
|
|
34
35
|
arpakitlib/ar_fastapi_util.py,sha256=UDPaLaQECwAf_luYxSMC3wsBMebeq7U1I-fzF1g1v08,21458
|
35
36
|
arpakitlib/ar_file_storage_in_dir_util.py,sha256=D3e3rGuHoI6xqAA5mVvEpVVpOWY1jyjNsjj2UhyHRbE,3674
|
36
37
|
arpakitlib/ar_hash_util.py,sha256=Iqy6KBAOLBQMFLWv676boI5sV7atT2B-fb7aCdHOmIQ,340
|
38
|
+
arpakitlib/ar_hello_world.py,sha256=5B3GTgxGIFh_s6ttyB4UKn78ncyA_8blRnDT04l-ELg,158
|
37
39
|
arpakitlib/ar_http_request_util.py,sha256=hMzu2yedUvwIg6gafSakDjXUEC7WH5iplDGiRW9fgPw,3322
|
38
40
|
arpakitlib/ar_ip_util.py,sha256=aEAa1Hvobh9DWX7cmBAPLqnXSTiKe2hRk-WJaiKMaI8,1009
|
39
41
|
arpakitlib/ar_json_db_util.py,sha256=CEyhIU4WuNmX5mqwBVYxUKSdpFelXvWmf_tJ1fuxMSE,7187
|
@@ -46,7 +48,7 @@ arpakitlib/ar_mongodb_util.py,sha256=2ECkTnGAZ92qxioL-fmN6R4yZOSr3bXdXLWTzT1C3vk
|
|
46
48
|
arpakitlib/ar_need_type_util.py,sha256=n2kBETxzOSVhSVoy7qUtHtuQzgrrxzgi1_iVQimPb9o,1615
|
47
49
|
arpakitlib/ar_openai_util.py,sha256=dHUbfg1sVVCjsNl_fra3iCMEz1bR-Hk9fE-DdYbu7Wc,1215
|
48
50
|
arpakitlib/ar_operation_execution_util.py,sha256=w_dz4XYEM4WbTxpBoYVkknG3U3_391cJmitgljJJTO0,12373
|
49
|
-
arpakitlib/ar_parse_command.py,sha256=
|
51
|
+
arpakitlib/ar_parse_command.py,sha256=rQ0Z7q3LIIq7b6kJ0ht7wLb1rNjVnl3YHmqP2paK0x0,3155
|
50
52
|
arpakitlib/ar_postgresql_util.py,sha256=1AuLjEaa1Lg4pzn-ukCVnDi35Eg1k91APRTqZhIJAdo,945
|
51
53
|
arpakitlib/ar_run_cmd_util.py,sha256=D_rPavKMmWkQtwvZFz-Io5Ak8eSODHkcFeLPzNVC68g,1072
|
52
54
|
arpakitlib/ar_schedule_uust_api_client_util.py,sha256=0X4yACjt8cxMvuoZUq4S0HuVhVUQW5fGmiPcG7vwM8Y,6027
|
@@ -59,8 +61,9 @@ arpakitlib/ar_str_util.py,sha256=xSEzmsDvRiZVaxyqFFjcgzpphktCbXg2FHcvsd1DYpA,188
|
|
59
61
|
arpakitlib/ar_type_util.py,sha256=5nDnXL5Oyozlg8XvxMrogsoYiG8_atItg46A0mtv-pk,2025
|
60
62
|
arpakitlib/ar_yookassa_api_client_util.py,sha256=5GMvu8paByni8buhc1vpHB7n6oXe0gPfj1LSvnyZCrQ,5307
|
61
63
|
arpakitlib/ar_zabbix_util.py,sha256=Q-VR4MvoZ9aHwZeYZr9G3LwN-ANx1T5KFmF6pvPM-9M,6402
|
62
|
-
arpakitlib-1.6.
|
63
|
-
arpakitlib-1.6.
|
64
|
-
arpakitlib-1.6.
|
65
|
-
arpakitlib-1.6.
|
66
|
-
arpakitlib-1.6.
|
64
|
+
arpakitlib-1.6.63.dist-info/LICENSE,sha256=GPEDQMam2r7FSTYqM1mm7aKnxLaWcBotH7UvQtea-ec,11355
|
65
|
+
arpakitlib-1.6.63.dist-info/METADATA,sha256=OysWA57qQT4ps2QSC0rPdvASK2FFHb5DiRYdTf2cQAk,2749
|
66
|
+
arpakitlib-1.6.63.dist-info/NOTICE,sha256=PxM7bI06pP5flh9MDCUc2LzY3zTeunamwwPihBCLfjU,51
|
67
|
+
arpakitlib-1.6.63.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
68
|
+
arpakitlib-1.6.63.dist-info/entry_points.txt,sha256=w1j8DKaUZGWNKa9vkS36LtXXiYCm8HgCGJRnW7zqlQQ,50
|
69
|
+
arpakitlib-1.6.63.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|