arpakitlib 1.7.250__py3-none-any.whl → 1.7.253__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/_arpakit_project_template/alembic/README +1 -0
- arpakitlib/_arpakit_project_template/alembic/env.py +83 -0
- arpakitlib/_arpakit_project_template/alembic/script.py.mako +26 -0
- arpakitlib/_arpakit_project_template/alembic.ini +119 -0
- arpakitlib/_arpakit_project_template/example.env +5 -14
- arpakitlib/_arpakit_project_template/manage/docker_rm_postgres.sh +3 -0
- arpakitlib/_arpakit_project_template/manage/docker_run_postgres.sh +4 -3
- arpakitlib/_arpakit_project_template/manage/docker_start_postgres.sh +2 -1
- arpakitlib/_arpakit_project_template/manage/docker_stop_postgres.sh +2 -1
- arpakitlib/_arpakit_project_template/manage/git_set_arpakit_company_origin.sh +4 -2
- arpakitlib/_arpakit_project_template/manage/git_set_arpakit_origin.sh +4 -2
- arpakitlib/_arpakit_project_template/src/additional_model/additional_model.py +0 -7
- arpakitlib/_arpakit_project_template/src/api/auth.py +52 -0
- arpakitlib/_arpakit_project_template/src/api/create_api_app.py +22 -15
- arpakitlib/_arpakit_project_template/src/api/create_handle_exception_.py +13 -13
- arpakitlib/_arpakit_project_template/src/api/event.py +28 -6
- arpakitlib/_arpakit_project_template/src/api/transmitted_api_data.py +3 -11
- arpakitlib/_arpakit_project_template/src/core/settings.py +3 -111
- arpakitlib/_arpakit_project_template/src/just_script/example.py +16 -0
- arpakitlib/_arpakit_project_template/src/operation_execution/_start_operation_executor_worker.py +1 -1
- arpakitlib/_arpakit_project_template/src/operation_execution/_start_scheduled_operation_creator_worker.py +1 -1
- arpakitlib/_arpakit_project_template/src/sql_db/__init__.py +0 -0
- arpakitlib/_arpakit_project_template/src/{db → sql_db}/_check_conn_sqlalchemy_db.py +1 -1
- arpakitlib/_arpakit_project_template/src/{db → sql_db}/_drop_sqlalchemy_db.py +1 -1
- arpakitlib/_arpakit_project_template/src/{db → sql_db}/_init_sqlalchemy_db.py +1 -1
- arpakitlib/_arpakit_project_template/src/{db → sql_db}/_reinit_sqlalchemy_db.py +1 -1
- arpakitlib/_arpakit_project_template/src/{operation_execution → sql_db}/_remove_operations.py +1 -1
- arpakitlib/_arpakit_project_template/src/sql_db/_remove_story_logs.py +16 -0
- arpakitlib/_arpakit_project_template/src/{db → sql_db}/util.py +6 -8
- arpakitlib/_arpakit_project_template/src/tg_bot/transmitted_tg_data.py +3 -14
- arpakitlib/ar_aiogram_util.py +27 -4
- arpakitlib/ar_arpakit_project_template_util.py +8 -18
- arpakitlib/ar_arpakit_schedule_uust_api_client_util.py +5 -4
- arpakitlib/ar_arpakitlib_cli_util.py +10 -22
- arpakitlib/ar_class_util.py +0 -1
- arpakitlib/ar_cryptomus_api_client_util.py +21 -0
- arpakitlib/ar_fastapi_util.py +106 -73
- arpakitlib/ar_operation_execution_util.py +7 -7
- arpakitlib/ar_schedule_uust_api_client_util.py +24 -24
- arpakitlib/ar_settings_util.py +166 -14
- arpakitlib/ar_sqlalchemy_model_util.py +1 -1
- arpakitlib/ar_sqlalchemy_util.py +4 -4
- arpakitlib/ar_steam_payment_api_client_util.py +21 -0
- arpakitlib/ar_wata_api_client.py +21 -0
- {arpakitlib-1.7.250.dist-info → arpakitlib-1.7.253.dist-info}/METADATA +1 -1
- {arpakitlib-1.7.250.dist-info → arpakitlib-1.7.253.dist-info}/RECORD +53 -42
- /arpakitlib/_arpakit_project_template/src/core/{_check_settings.py → _show_settings.py} +0 -0
- /arpakitlib/_arpakit_project_template/src/{db → just_script}/__init__.py +0 -0
- /arpakitlib/_arpakit_project_template/src/{db → sql_db}/const.py +0 -0
- /arpakitlib/_arpakit_project_template/src/{db → sql_db}/sqlalchemy_model.py +0 -0
- {arpakitlib-1.7.250.dist-info → arpakitlib-1.7.253.dist-info}/LICENSE +0 -0
- {arpakitlib-1.7.250.dist-info → arpakitlib-1.7.253.dist-info}/WHEEL +0 -0
- {arpakitlib-1.7.250.dist-info → arpakitlib-1.7.253.dist-info}/entry_points.txt +0 -0
@@ -1,121 +1,13 @@
|
|
1
1
|
import os
|
2
2
|
from functools import lru_cache
|
3
|
-
from typing import Any
|
4
|
-
|
5
|
-
import pytz
|
6
|
-
from pydantic import field_validator
|
7
|
-
from pydantic_core.core_schema import ValidationInfo
|
8
3
|
|
9
4
|
from arpakitlib.ar_json_util import safely_transfer_obj_to_json_str
|
10
|
-
from arpakitlib.ar_settings_util import
|
11
|
-
from arpakitlib.ar_sqlalchemy_util import generate_sqlalchemy_url
|
5
|
+
from arpakitlib.ar_settings_util import AdvancedSettings
|
12
6
|
from src.core.const import ProjectPaths
|
13
7
|
|
14
8
|
|
15
|
-
class Settings(
|
16
|
-
|
17
|
-
|
18
|
-
sql_db_user: str | None = project_name
|
19
|
-
|
20
|
-
sql_db_password: str | None = project_name
|
21
|
-
|
22
|
-
sql_db_port: int | None = int("{{SQL_DB_PORT}}") if "{{SQL_DB_PORT}}".strip().isdigit() else None
|
23
|
-
|
24
|
-
sql_db_database: str | None = project_name
|
25
|
-
|
26
|
-
sql_db_url: str | None = None
|
27
|
-
|
28
|
-
@field_validator("sql_db_url", mode="after")
|
29
|
-
def validate_sql_db_url(cls, v: Any, validation_info: ValidationInfo, **kwargs) -> str | None:
|
30
|
-
if v is not None:
|
31
|
-
return v
|
32
|
-
|
33
|
-
user = validation_info.data.get("sql_db_user")
|
34
|
-
password = validation_info.data.get("sql_db_password")
|
35
|
-
port = validation_info.data.get("sql_db_port")
|
36
|
-
database = validation_info.data.get("sql_db_database")
|
37
|
-
|
38
|
-
return generate_sqlalchemy_url(
|
39
|
-
base="postgresql",
|
40
|
-
user=user,
|
41
|
-
password=password,
|
42
|
-
port=port,
|
43
|
-
database=database
|
44
|
-
)
|
45
|
-
|
46
|
-
async_sql_db_url: str | None = None
|
47
|
-
|
48
|
-
@field_validator("async_sql_db_url", mode="after")
|
49
|
-
def validate_async_sql_db_url(cls, v: Any, validation_info: ValidationInfo, **kwargs) -> str | None:
|
50
|
-
if v is not None:
|
51
|
-
return v
|
52
|
-
|
53
|
-
user = validation_info.data.get("sql_db_user")
|
54
|
-
password = validation_info.data.get("sql_db_password")
|
55
|
-
port = validation_info.data.get("sql_db_port")
|
56
|
-
database = validation_info.data.get("sql_db_database")
|
57
|
-
|
58
|
-
return generate_sqlalchemy_url(
|
59
|
-
base="postgresql+asyncpg",
|
60
|
-
user=user,
|
61
|
-
password=password,
|
62
|
-
port=port,
|
63
|
-
database=database
|
64
|
-
)
|
65
|
-
|
66
|
-
sql_db_echo: bool = False
|
67
|
-
|
68
|
-
api_init_sql_db_at_start: bool = True
|
69
|
-
|
70
|
-
api_title: str | None = project_name
|
71
|
-
|
72
|
-
api_description: str | None = f"{project_name} (arpakitlib)"
|
73
|
-
|
74
|
-
api_logging_func_before_response: bool = True
|
75
|
-
|
76
|
-
api_story_log_func_before_response: bool = True
|
77
|
-
|
78
|
-
api_start_operation_executor_worker: bool = False
|
79
|
-
|
80
|
-
api_start_scheduled_operation_creator_worker: bool = False
|
81
|
-
|
82
|
-
api_port: int | None = int("{{API_PORT}}") if "{{API_PORT}}".strip().isdigit() else None
|
83
|
-
|
84
|
-
api_correct_api_key: str | None = "1"
|
85
|
-
|
86
|
-
api_correct_token: str | None = "1"
|
87
|
-
|
88
|
-
api_enable_admin1: bool = True
|
89
|
-
|
90
|
-
var_dirname: str | None = "var"
|
91
|
-
|
92
|
-
var_dirpath: str | None = os.path.join(ProjectPaths.base_dirpath, var_dirname)
|
93
|
-
|
94
|
-
log_filename: str | None = "story.log"
|
95
|
-
|
96
|
-
log_filepath: str | None = os.path.join(var_dirpath, log_filename)
|
97
|
-
|
98
|
-
cache_dirname: str | None = "cache"
|
99
|
-
|
100
|
-
cache_dirpath: str | None = os.path.join(var_dirpath, cache_dirname)
|
101
|
-
|
102
|
-
media_dirname: str | None = "media"
|
103
|
-
|
104
|
-
media_dirpath: str | None = os.path.join(var_dirpath, media_dirname)
|
105
|
-
|
106
|
-
dump_dirname: str | None = "dump"
|
107
|
-
|
108
|
-
dump_dirpath: str | None = os.path.join(var_dirpath, dump_dirname)
|
109
|
-
|
110
|
-
local_timezone: str | None = None
|
111
|
-
|
112
|
-
@property
|
113
|
-
def local_timezone_as_pytz(self) -> Any:
|
114
|
-
return pytz.timezone(self.local_timezone)
|
115
|
-
|
116
|
-
admin1_secret_key: str | None = "85a9583cb91c4de7a78d7eb1e5306a04418c9c43014c447ea8ec8dd5deb4cf71"
|
117
|
-
|
118
|
-
# ...
|
9
|
+
class Settings(AdvancedSettings):
|
10
|
+
var_dirpath: str | None = os.path.join(ProjectPaths.base_dirpath, "var")
|
119
11
|
|
120
12
|
|
121
13
|
@lru_cache()
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import logging
|
2
|
+
|
3
|
+
from src.core.util import setup_logging
|
4
|
+
|
5
|
+
_logger = logging.getLogger(__name__)
|
6
|
+
|
7
|
+
|
8
|
+
def send_msg_to_users():
|
9
|
+
setup_logging()
|
10
|
+
input("r u sure?")
|
11
|
+
_logger.info("sending")
|
12
|
+
_logger.info("sent")
|
13
|
+
|
14
|
+
|
15
|
+
if __name__ == '__main__':
|
16
|
+
send_msg_to_users()
|
arpakitlib/_arpakit_project_template/src/operation_execution/_start_operation_executor_worker.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
from arpakitlib.ar_operation_execution_util import OperationExecutorWorker
|
2
2
|
from src.core.util import setup_logging
|
3
|
-
from src.db.util import get_cached_sqlalchemy_db
|
4
3
|
from src.operation_execution.operation_executor import OperationExecutor
|
4
|
+
from src.sql_db.util import get_cached_sqlalchemy_db
|
5
5
|
|
6
6
|
|
7
7
|
def _start_operation_executor_worker():
|
@@ -1,7 +1,7 @@
|
|
1
1
|
from arpakitlib.ar_operation_execution_util import ScheduledOperationCreatorWorker
|
2
2
|
from src.core.util import setup_logging
|
3
|
-
from src.db.util import get_cached_sqlalchemy_db
|
4
3
|
from src.operation_execution.scheduled_operations import SCHEDULED_OPERATIONS
|
4
|
+
from src.sql_db.util import get_cached_sqlalchemy_db
|
5
5
|
|
6
6
|
|
7
7
|
def _start_scheduled_operation_creator_worker():
|
File without changes
|
arpakitlib/_arpakit_project_template/src/{operation_execution → sql_db}/_remove_operations.py
RENAMED
@@ -1,7 +1,7 @@
|
|
1
1
|
from arpakitlib.ar_operation_execution_util import remove_operations
|
2
2
|
from src.core.settings import get_cached_settings
|
3
3
|
from src.core.util import setup_logging
|
4
|
-
from src.
|
4
|
+
from src.sql_db.util import get_cached_sqlalchemy_db
|
5
5
|
|
6
6
|
|
7
7
|
def _remove_operations():
|
@@ -0,0 +1,16 @@
|
|
1
|
+
from arpakitlib.ar_sqlalchemy_model_util import StoryLogDBM
|
2
|
+
from src.core.settings import get_cached_settings
|
3
|
+
from src.core.util import setup_logging
|
4
|
+
from src.sql_db.util import get_cached_sqlalchemy_db
|
5
|
+
|
6
|
+
|
7
|
+
def _remove_story_logs():
|
8
|
+
setup_logging()
|
9
|
+
get_cached_settings().raise_if_mode_type_prod()
|
10
|
+
with get_cached_sqlalchemy_db().new_session() as session:
|
11
|
+
session.query(StoryLogDBM).delete()
|
12
|
+
session.commit()
|
13
|
+
|
14
|
+
|
15
|
+
if __name__ == '__main__':
|
16
|
+
_remove_story_logs()
|
@@ -1,21 +1,21 @@
|
|
1
1
|
from functools import lru_cache
|
2
2
|
|
3
3
|
from arpakitlib.ar_sqlalchemy_model_util import BaseDBM
|
4
|
-
from arpakitlib.ar_sqlalchemy_util import
|
4
|
+
from arpakitlib.ar_sqlalchemy_util import SQLAlchemyDb
|
5
5
|
from src.core.settings import get_cached_settings
|
6
|
-
from src.db.sqlalchemy_model import import_project_sqlalchemy_models
|
7
6
|
|
8
7
|
|
9
8
|
def get_base_dbm() -> type[BaseDBM]:
|
10
9
|
from arpakitlib.ar_sqlalchemy_model_util import import_ar_sqlalchemy_models
|
11
10
|
import_ar_sqlalchemy_models()
|
11
|
+
from src.sql_db.sqlalchemy_model import import_project_sqlalchemy_models
|
12
12
|
import_project_sqlalchemy_models()
|
13
13
|
return BaseDBM
|
14
14
|
|
15
15
|
|
16
|
-
def create_sqlalchemy_db() ->
|
17
|
-
return
|
18
|
-
|
16
|
+
def create_sqlalchemy_db() -> SQLAlchemyDb:
|
17
|
+
return SQLAlchemyDb(
|
18
|
+
sync_db_url=get_cached_settings().sync_sql_db_url,
|
19
19
|
async_db_url=get_cached_settings().async_sql_db_url,
|
20
20
|
db_echo=get_cached_settings().sql_db_echo,
|
21
21
|
base_dbm=get_base_dbm()
|
@@ -23,7 +23,5 @@ def create_sqlalchemy_db() -> SQLAlchemyDB:
|
|
23
23
|
|
24
24
|
|
25
25
|
@lru_cache()
|
26
|
-
def get_cached_sqlalchemy_db() ->
|
26
|
+
def get_cached_sqlalchemy_db() -> SQLAlchemyDb:
|
27
27
|
return create_sqlalchemy_db()
|
28
|
-
|
29
|
-
# ...
|
@@ -1,17 +1,6 @@
|
|
1
|
-
from
|
2
|
-
|
3
|
-
from arpakitlib.ar_aiogram_util import BaseTransmittedTgBotData
|
4
|
-
from arpakitlib.ar_file_storage_in_dir_util import FileStorageInDir
|
5
|
-
from arpakitlib.ar_sqlalchemy_util import SQLAlchemyDB
|
1
|
+
from arpakitlib.ar_aiogram_util import AdvancedTransmittedTgBotData
|
6
2
|
from src.core.settings import Settings
|
7
3
|
|
8
4
|
|
9
|
-
class TransmittedTgData(
|
10
|
-
settings: Settings
|
11
|
-
sqlalchemy_db: SQLAlchemyDB | None = None
|
12
|
-
media_file_storage_in_dir: FileStorageInDir | None = None
|
13
|
-
cache_file_storage_in_dir: FileStorageInDir | None = None
|
14
|
-
dump_file_storage_in_dir: FileStorageInDir | None = None
|
15
|
-
tg_bot: Bot
|
16
|
-
|
17
|
-
# ...
|
5
|
+
class TransmittedTgData(AdvancedTransmittedTgBotData):
|
6
|
+
settings: Settings | None = None
|
arpakitlib/ar_aiogram_util.py
CHANGED
@@ -4,7 +4,7 @@ import asyncio
|
|
4
4
|
import logging
|
5
5
|
from typing import Optional, Any, Union, Callable, Iterable
|
6
6
|
|
7
|
-
from aiogram import types, Bot
|
7
|
+
from aiogram import types, Bot, Dispatcher
|
8
8
|
from aiogram.client.default import DefaultBotProperties
|
9
9
|
from aiogram.client.session.aiohttp import AiohttpSession
|
10
10
|
from aiogram.enums import ChatType, ParseMode
|
@@ -13,8 +13,12 @@ from aiogram.filters import CommandObject, Filter
|
|
13
13
|
from aiogram.filters.callback_data import CallbackData
|
14
14
|
from pydantic import BaseModel, ConfigDict
|
15
15
|
|
16
|
+
from arpakitlib.ar_file_storage_in_dir_util import FileStorageInDir
|
17
|
+
from arpakitlib.ar_json_db_util import JSONDb
|
16
18
|
from arpakitlib.ar_need_type_util import parse_need_type, NeedTypes
|
17
19
|
from arpakitlib.ar_parse_command import BadCommandFormat, parse_command
|
20
|
+
from arpakitlib.ar_settings_util import SimpleSettings, BaseSettings2
|
21
|
+
from arpakitlib.ar_sqlalchemy_util import SQLAlchemyDb
|
18
22
|
from arpakitlib.ar_type_util import raise_for_types, raise_for_type
|
19
23
|
|
20
24
|
_ARPAKIT_LIB_MODULE_VERSION = "3.0"
|
@@ -315,6 +319,18 @@ class BaseTransmittedTgBotData(BaseModel):
|
|
315
319
|
model_config = ConfigDict(extra="ignore", arbitrary_types_allowed=True, from_attributes=True)
|
316
320
|
|
317
321
|
|
322
|
+
class SimpleTransmittedTgBotData(BaseTransmittedTgBotData):
|
323
|
+
settings: BaseSettings2 | None = None
|
324
|
+
|
325
|
+
|
326
|
+
class AdvancedTransmittedTgBotData(SimpleTransmittedTgBotData):
|
327
|
+
sqlalchemy_db: SQLAlchemyDb | None = None
|
328
|
+
json_db: JSONDb | None = None
|
329
|
+
media_file_storage_in_dir: FileStorageInDir | None = None
|
330
|
+
cache_file_storage_in_dir: FileStorageInDir | None = None
|
331
|
+
dump_file_storage_in_dir: FileStorageInDir | None = None
|
332
|
+
|
333
|
+
|
318
334
|
def create_aiogram_tg_bot(*, token: str, proxy_url_: str | None = None, **kwargs) -> Bot:
|
319
335
|
kwargs["token"] = token
|
320
336
|
|
@@ -333,9 +349,16 @@ def create_aiogram_tg_bot(*, token: str, proxy_url_: str | None = None, **kwargs
|
|
333
349
|
return tg_bot
|
334
350
|
|
335
351
|
|
336
|
-
def create_tg_bot_dispatcher(
|
337
|
-
|
338
|
-
|
352
|
+
# def create_tg_bot_dispatcher(
|
353
|
+
# *,
|
354
|
+
# settings:
|
355
|
+
# ):
|
356
|
+
# tg_dp = Dispatcher(
|
357
|
+
# storage=MemoryStorage(),
|
358
|
+
# settings=get_settings(),
|
359
|
+
# db=db,
|
360
|
+
# transmitted_tg_bot_data=transmitted_tg_bot_data
|
361
|
+
# )
|
339
362
|
|
340
363
|
|
341
364
|
def __example():
|
@@ -3,7 +3,7 @@
|
|
3
3
|
import logging
|
4
4
|
import os
|
5
5
|
|
6
|
-
from arpakitlib.ar_str_util import
|
6
|
+
from arpakitlib.ar_str_util import raise_if_string_blank
|
7
7
|
from arpakitlib.ar_type_util import raise_for_type
|
8
8
|
|
9
9
|
_ARPAKIT_LIB_MODULE_VERSION = "3.0"
|
@@ -15,23 +15,17 @@ def init_arpakit_project_template(
|
|
15
15
|
*,
|
16
16
|
project_dirpath: str = "./",
|
17
17
|
overwrite_if_exists: bool = False,
|
18
|
-
|
19
|
-
sql_db_port: int | None = None,
|
20
|
-
api_port: int | None = None,
|
18
|
+
params: dict[str, str] | None = None,
|
21
19
|
ignore_paths_startswith: list[str] | str | None = None,
|
22
20
|
only_paths_startswith: list[str] | str | None = None,
|
23
21
|
):
|
24
22
|
raise_if_string_blank(project_dirpath)
|
25
23
|
|
26
|
-
|
27
|
-
project_name = project_name.strip()
|
28
|
-
project_name = make_none_if_blank(project_name)
|
24
|
+
raise_for_type(overwrite_if_exists, bool)
|
29
25
|
|
30
|
-
if
|
31
|
-
|
32
|
-
|
33
|
-
if api_port is not None:
|
34
|
-
raise_for_type(api_port, int)
|
26
|
+
if params is None:
|
27
|
+
params = {}
|
28
|
+
raise_for_type(params, dict)
|
35
29
|
|
36
30
|
if isinstance(ignore_paths_startswith, str):
|
37
31
|
ignore_paths_startswith = [ignore_paths_startswith]
|
@@ -68,12 +62,8 @@ def init_arpakit_project_template(
|
|
68
62
|
continue
|
69
63
|
with open(os.path.join(root, file), "r", encoding="utf-8") as _file:
|
70
64
|
_content = _file.read()
|
71
|
-
|
72
|
-
_content = _content.replace("{{
|
73
|
-
if sql_db_port is not None:
|
74
|
-
_content = _content.replace("{{SQL_DB_PORT}}", str(sql_db_port))
|
75
|
-
if api_port is not None:
|
76
|
-
_content = _content.replace("{{API_PORT}}", str(api_port))
|
65
|
+
for key, value in params.items():
|
66
|
+
_content = _content.replace("{{" + key.upper().strip() + "}}", value)
|
77
67
|
res[rel_path] = _content
|
78
68
|
return res
|
79
69
|
|
@@ -225,10 +225,6 @@ class ARPAKITScheduleUUSTAPIClient:
|
|
225
225
|
else:
|
226
226
|
self.ttl_cache = None
|
227
227
|
|
228
|
-
def clear_cache(self):
|
229
|
-
if self.ttl_cache is not None:
|
230
|
-
self.ttl_cache.clear()
|
231
|
-
|
232
228
|
async def _async_make_http_request(
|
233
229
|
self,
|
234
230
|
*,
|
@@ -242,11 +238,16 @@ class ARPAKITScheduleUUSTAPIClient:
|
|
242
238
|
url=url,
|
243
239
|
headers=self.headers,
|
244
240
|
params=params,
|
241
|
+
max_tries_=5,
|
245
242
|
raise_for_status_=True,
|
246
243
|
**kwargs
|
247
244
|
)
|
248
245
|
return response
|
249
246
|
|
247
|
+
def clear_cache(self):
|
248
|
+
if self.ttl_cache is not None:
|
249
|
+
self.ttl_cache.clear()
|
250
|
+
|
250
251
|
async def check_auth(self) -> dict[str, Any]:
|
251
252
|
response = await self._async_make_http_request(
|
252
253
|
method="GET", url=urljoin(self.base_url, "check_auth")
|
@@ -29,46 +29,34 @@ def execute_arpakitlib_cli(*, full_command: str | None = None):
|
|
29
29
|
print("-c init_arpakit_project_template")
|
30
30
|
print("-project_dirpath ...")
|
31
31
|
print("-overwrite_if_exists ...")
|
32
|
-
print("-project_name ...")
|
33
|
-
print("-sql_db_port ...")
|
34
|
-
print("-api_port ...")
|
35
32
|
print("-ignore_paths_startswith ...")
|
36
33
|
print("-only_paths_startswith ...")
|
37
34
|
print("\n")
|
38
35
|
|
39
36
|
elif command == "init_arpakit_project_template":
|
40
|
-
project_dirpath = raise_if_string_blank(parsed_command.get_value_by_keys(keys=["
|
37
|
+
project_dirpath = raise_if_string_blank(parsed_command.get_value_by_keys(keys=["project_dirpath"]))
|
41
38
|
overwrite_if_exists: bool = parse_need_type(
|
42
|
-
value=parsed_command.get_value_by_keys(keys=["
|
39
|
+
value=parsed_command.get_value_by_keys(keys=["overwrite_if_exists"]),
|
43
40
|
need_type=NeedTypes.bool_,
|
44
41
|
allow_none=False
|
45
42
|
)
|
46
|
-
|
47
|
-
project_name = project_name.strip() if project_name and project_name.strip() else None
|
48
|
-
sql_db_port: int | None = parse_need_type(
|
49
|
-
value=parsed_command.get_value_by_keys(keys=["sdp", "sql_db_port"]),
|
50
|
-
need_type=NeedTypes.int_,
|
51
|
-
allow_none=True
|
52
|
-
)
|
53
|
-
api_port: int | None = parse_need_type(
|
54
|
-
value=parsed_command.get_value_by_keys(keys=["ap", "api_port"]),
|
55
|
-
need_type=NeedTypes.int_,
|
56
|
-
allow_none=True
|
57
|
-
)
|
43
|
+
params = parsed_command.key_to_value
|
58
44
|
ignore_paths_startswith: list[str] | None = parse_need_type(
|
59
|
-
value=parsed_command.get_value_by_keys(keys=["
|
45
|
+
value=parsed_command.get_value_by_keys(keys=["ignore_paths_startswith"]),
|
60
46
|
need_type=NeedTypes.list_of_str,
|
61
47
|
allow_none=True
|
62
48
|
)
|
63
49
|
only_paths_startswith: list[str] | None = parse_need_type(
|
64
|
-
value=parsed_command.get_value_by_keys(keys=["
|
50
|
+
value=parsed_command.get_value_by_keys(keys=["only_paths_startswith"]),
|
65
51
|
need_type=NeedTypes.list_of_str,
|
66
52
|
allow_none=True
|
67
53
|
)
|
68
54
|
init_arpakit_project_template(
|
69
|
-
project_dirpath=project_dirpath,
|
70
|
-
|
71
|
-
|
55
|
+
project_dirpath=project_dirpath,
|
56
|
+
overwrite_if_exists=overwrite_if_exists,
|
57
|
+
params=params,
|
58
|
+
ignore_paths_startswith=ignore_paths_startswith,
|
59
|
+
only_paths_startswith=only_paths_startswith
|
72
60
|
)
|
73
61
|
|
74
62
|
else:
|
arpakitlib/ar_class_util.py
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
# arpakit
|
2
|
+
import asyncio
|
3
|
+
|
4
|
+
_ARPAKIT_LIB_MODULE_VERSION = "3.0"
|
5
|
+
|
6
|
+
|
7
|
+
class CryptomusAPIClient:
|
8
|
+
pass
|
9
|
+
|
10
|
+
|
11
|
+
def __example():
|
12
|
+
pass
|
13
|
+
|
14
|
+
|
15
|
+
async def __async_example():
|
16
|
+
pass
|
17
|
+
|
18
|
+
|
19
|
+
if __name__ == '__main__':
|
20
|
+
__example()
|
21
|
+
asyncio.run(__async_example())
|