arpakitlib 1.5.19__tar.gz → 1.5.20__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.
Potentially problematic release.
This version of arpakitlib might be problematic. Click here for more details.
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/PKG-INFO +1 -1
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_datetime_util.py +1 -1
- arpakitlib-1.5.19/arpakitlib/ar_sqlalchemy_util.py → arpakitlib-1.5.20/arpakitlib/ar_easy_sqlalchemy_util.py +8 -39
- arpakitlib-1.5.20/arpakitlib/ar_sqlalchemy_model_util.py +42 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/pyproject.toml +1 -1
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/LICENSE +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/NOTICE +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/README.md +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/AUTHOR.md +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/LICENSE +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/NOTICE +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/README.md +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/__init__.py +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_additional_model_util.py +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_aiogram_util.py +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_arpakit_lib_module_util.py +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_arpakit_schedule_uust_api_client.py +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_arpakitlib_info.py +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_base64_util.py +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_base_worker.py +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_cache_file.py +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_dict_util.py +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_dream_ai_api_client.py +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_encrypt_and_decrypt_util.py +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_enumeration.py +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_fastapi_static/redoc/redoc.standalone.js +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_fastapi_static/swagger-ui/favicon-16x16.png +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_fastapi_static/swagger-ui/favicon-32x32.png +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_fastapi_static/swagger-ui/index.css +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_fastapi_static/swagger-ui/index.html +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_fastapi_static/swagger-ui/oauth2-redirect.html +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-initializer.js +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui-bundle.js +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui-bundle.js.map +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui-es-bundle-core.js +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui-es-bundle-core.js.map +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui-es-bundle.js +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui-es-bundle.js.map +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui-standalone-preset.js +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui-standalone-preset.js.map +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui.css +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui.css.map +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui.js +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui.js.map +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_fastapi_util.py +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_file_storage_in_dir.py +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_generate_env_example.py +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_hash_util.py +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_http_request_util.py +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_ip_util.py +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_json_db.py +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_json_util.py +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_jwt_util.py +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_list_of_dicts_to_xlsx.py +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_list_util.py +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_logging_util.py +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_mongodb_util.py +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_need_type_util.py +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_openai_util.py +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_parse_command.py +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_postgresql_util.py +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_run_cmd.py +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_safe_sleep.py +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_schedule_uust_api_client.py +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_ssh_runner.py +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_str_util.py +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_type_util.py +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_yookassa_api_client.py +0 -0
- {arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_zabbix_util.py +0 -0
|
@@ -1,49 +1,15 @@
|
|
|
1
1
|
import logging
|
|
2
|
-
from datetime import timedelta
|
|
2
|
+
from datetime import timedelta
|
|
3
3
|
from typing import Any
|
|
4
4
|
from uuid import uuid4
|
|
5
5
|
|
|
6
|
-
from sqlalchemy import create_engine, QueuePool, text, func
|
|
7
|
-
from sqlalchemy.orm import sessionmaker
|
|
6
|
+
from sqlalchemy import create_engine, QueuePool, text, func
|
|
7
|
+
from sqlalchemy.orm import sessionmaker
|
|
8
8
|
from sqlalchemy.orm.session import Session
|
|
9
9
|
|
|
10
|
-
from arpakitlib.ar_datetime_util import now_utc_dt
|
|
11
|
-
from arpakitlib.ar_json_util import safely_transfer_to_json_str
|
|
12
|
-
|
|
13
10
|
_ARPAKIT_LIB_MODULE_VERSION = "3.0"
|
|
14
11
|
|
|
15
12
|
|
|
16
|
-
class BaseDBM(DeclarativeBase):
|
|
17
|
-
__abstract__ = True
|
|
18
|
-
_bus_data: dict[str, Any] | None = None
|
|
19
|
-
|
|
20
|
-
@property
|
|
21
|
-
def bus_data(self) -> dict[str, Any]:
|
|
22
|
-
if self._bus_data is None:
|
|
23
|
-
self._bus_data = {}
|
|
24
|
-
return self._bus_data
|
|
25
|
-
|
|
26
|
-
def simple_dict(self) -> dict[str, Any]:
|
|
27
|
-
return {c.key: getattr(self, c.key) for c in inspect(self).mapper.column_attrs}
|
|
28
|
-
|
|
29
|
-
def simple_json(self) -> str:
|
|
30
|
-
return safely_transfer_to_json_str(self.simple_dict())
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
class SimpleDBM(BaseDBM):
|
|
34
|
-
__abstract__ = True
|
|
35
|
-
|
|
36
|
-
id: Mapped[int] = mapped_column(
|
|
37
|
-
INTEGER, primary_key=True, autoincrement=True, nullable=False
|
|
38
|
-
)
|
|
39
|
-
long_id: Mapped[str] = mapped_column(
|
|
40
|
-
TEXT, insert_default=uuid4, unique=True, nullable=False
|
|
41
|
-
)
|
|
42
|
-
creation_dt: Mapped[datetime] = mapped_column(
|
|
43
|
-
TIMESTAMP(timezone=True), insert_default=now_utc_dt, index=True, nullable=False
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
|
|
47
13
|
class EasySQLAlchemyDB:
|
|
48
14
|
def __init__(self, *, db_url: str, echo: bool = False):
|
|
49
15
|
self._logger = logging.getLogger(self.__class__.__name__)
|
|
@@ -73,14 +39,17 @@ class EasySQLAlchemyDB:
|
|
|
73
39
|
self._logger.info("celery tables data were removed")
|
|
74
40
|
|
|
75
41
|
def init(self):
|
|
42
|
+
from arpakitlib.ar_sqlalchemy_model_util import BaseDBM
|
|
76
43
|
BaseDBM.metadata.create_all(bind=self.engine, checkfirst=True)
|
|
77
44
|
self._logger.info("db was inited")
|
|
78
45
|
|
|
79
46
|
def drop(self):
|
|
47
|
+
from arpakitlib.ar_sqlalchemy_model_util import BaseDBM
|
|
80
48
|
BaseDBM.metadata.drop_all(bind=self.engine, checkfirst=True)
|
|
81
49
|
self._logger.info("db was dropped")
|
|
82
50
|
|
|
83
51
|
def reinit(self):
|
|
52
|
+
from arpakitlib.ar_sqlalchemy_model_util import BaseDBM
|
|
84
53
|
BaseDBM.metadata.drop_all(bind=self.engine, checkfirst=True)
|
|
85
54
|
BaseDBM.metadata.create_all(bind=self.engine, checkfirst=True)
|
|
86
55
|
self._logger.info("db was reinited")
|
|
@@ -101,14 +70,14 @@ class EasySQLAlchemyDB:
|
|
|
101
70
|
return False
|
|
102
71
|
return True
|
|
103
72
|
|
|
104
|
-
def generate_unique_id(self, *, class_dbm:
|
|
73
|
+
def generate_unique_id(self, *, class_dbm: Any):
|
|
105
74
|
with self.new_session() as session:
|
|
106
75
|
res: int = session.query(func.max(class_dbm.id)).scalar()
|
|
107
76
|
while session.query(class_dbm).filter(class_dbm.id == res).first() is not None:
|
|
108
77
|
res += 1
|
|
109
78
|
return res
|
|
110
79
|
|
|
111
|
-
def generate_unique_long_id(self, *, class_dbm:
|
|
80
|
+
def generate_unique_long_id(self, *, class_dbm: Any):
|
|
112
81
|
with self.new_session() as session:
|
|
113
82
|
res: str = str(uuid4())
|
|
114
83
|
while session.query(class_dbm).filter(class_dbm.long_id == res).first() is not None:
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
from typing import Any
|
|
3
|
+
from uuid import uuid4
|
|
4
|
+
|
|
5
|
+
from sqlalchemy import inspect, INTEGER, TEXT, TIMESTAMP
|
|
6
|
+
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
|
|
7
|
+
|
|
8
|
+
from arpakitlib.ar_datetime_util import now_utc_dt
|
|
9
|
+
from arpakitlib.ar_json_util import safely_transfer_to_json_str
|
|
10
|
+
|
|
11
|
+
_ARPAKIT_LIB_MODULE_VERSION = "3.0"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class BaseDBM(DeclarativeBase):
|
|
15
|
+
__abstract__ = True
|
|
16
|
+
_bus_data: dict[str, Any] | None = None
|
|
17
|
+
|
|
18
|
+
@property
|
|
19
|
+
def bus_data(self) -> dict[str, Any]:
|
|
20
|
+
if self._bus_data is None:
|
|
21
|
+
self._bus_data = {}
|
|
22
|
+
return self._bus_data
|
|
23
|
+
|
|
24
|
+
def simple_dict(self) -> dict[str, Any]:
|
|
25
|
+
return {c.key: getattr(self, c.key) for c in inspect(self).mapper.column_attrs}
|
|
26
|
+
|
|
27
|
+
def simple_json(self) -> str:
|
|
28
|
+
return safely_transfer_to_json_str(self.simple_dict())
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class SimpleDBM(BaseDBM):
|
|
32
|
+
__abstract__ = True
|
|
33
|
+
|
|
34
|
+
id: Mapped[int] = mapped_column(
|
|
35
|
+
INTEGER, primary_key=True, autoincrement=True, nullable=False
|
|
36
|
+
)
|
|
37
|
+
long_id: Mapped[str] = mapped_column(
|
|
38
|
+
TEXT, insert_default=uuid4, unique=True, nullable=False
|
|
39
|
+
)
|
|
40
|
+
creation_dt: Mapped[datetime] = mapped_column(
|
|
41
|
+
TIMESTAMP(timezone=True), insert_default=now_utc_dt, index=True, nullable=False
|
|
42
|
+
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_fastapi_static/redoc/redoc.standalone.js
RENAMED
|
File without changes
|
{arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_fastapi_static/swagger-ui/favicon-16x16.png
RENAMED
|
File without changes
|
{arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_fastapi_static/swagger-ui/favicon-32x32.png
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_fastapi_static/swagger-ui/oauth2-redirect.html
RENAMED
|
File without changes
|
|
File without changes
|
{arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui-bundle.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui.css
RENAMED
|
File without changes
|
{arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui.css.map
RENAMED
|
File without changes
|
{arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui.js
RENAMED
|
File without changes
|
{arpakitlib-1.5.19 → arpakitlib-1.5.20}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui.js.map
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|