arpakitlib 1.8.284__py3-none-any.whl → 1.8.295__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.

Potentially problematic release.


This version of arpakitlib might be problematic. Click here for more details.

@@ -1,8 +1,10 @@
1
1
  import asyncio
2
2
 
3
+ from project.sqlalchemy_db_.sqlalchemy_model import UserDBM
4
+
3
5
 
4
6
  def __sandbox():
5
- pass
7
+ print(UserDBM.get_sd_property_names())
6
8
 
7
9
 
8
10
  async def __async_sandbox():
@@ -73,7 +73,7 @@ class BaseDBM(DeclarativeBase):
73
73
  *,
74
74
  include_pk: bool = True,
75
75
  exclude_names: list[str] | None = None,
76
- exclude_if_have_foreign_keys: bool = False
76
+ exclude_if_have_foreign_keys: bool = False
77
77
  ) -> list[str]:
78
78
  if exclude_names is None:
79
79
  exclude_names = []
@@ -123,7 +123,7 @@ class BaseDBM(DeclarativeBase):
123
123
  include_column_names: bool = True,
124
124
  include_column_pk: bool = True,
125
125
  exclude_column_names: list[str] | None = None,
126
- exclude_column_names_if_have_foreign_keys: bool = False,
126
+ exclude_column_names_if_have_foreign_keys: bool = False,
127
127
 
128
128
  include_relationship_names: bool = True,
129
129
  exclude_relationship_one_to_many: bool = False,
@@ -152,16 +152,26 @@ class BaseDBM(DeclarativeBase):
152
152
  cls,
153
153
  *,
154
154
  prefix: str = "sdp_",
155
- remove_prefix: bool = False
155
+ remove_prefix: bool = False,
156
+ exclude_property_names: list[str] | None = None,
156
157
  ) -> list[str]:
157
- props = [
158
- name
159
- for name, attr in vars(cls).items()
160
- if isinstance(attr, property) and name.startswith(prefix)
161
- ]
162
- if remove_prefix:
163
- return [name[len(prefix):] for name in props]
164
- return props
158
+ exclude_property_names = set(exclude_property_names or [])
159
+ res: list[str] = []
160
+
161
+ # идём от потомка к базам, переопределения потомка «побеждают»
162
+ for c in cls.__mro__:
163
+ if c is object:
164
+ continue
165
+ for name, attr in c.__dict__.items():
166
+ if not isinstance(attr, property):
167
+ continue
168
+ if not name.startswith(prefix):
169
+ continue
170
+ if name in exclude_property_names or name in res:
171
+ continue
172
+ res.append(name)
173
+
174
+ return [n[len(prefix):] for n in res] if remove_prefix else res
165
175
 
166
176
  def simple_dict(
167
177
  self,
@@ -0,0 +1,74 @@
1
+ from __future__ import annotations
2
+
3
+ import re
4
+ from pathlib import Path
5
+ from typing import Optional
6
+
7
+ LINE_RE = re.compile(r"""
8
+ ^(?P<lead>\s*)
9
+ (?:(?P<export>export)\s+)? # optional 'export '
10
+ (?P<key>[A-Za-z_][A-Za-z0-9_]*?) # KEY
11
+ (?P<eq>\s*=\s*) # equals with any spaces around
12
+ (?P<val>.*) # value (raw, keep as-is)
13
+ $
14
+ """, re.VERBOSE)
15
+
16
+ COMMENT_RE = re.compile(r"^\s*#")
17
+
18
+
19
+ def uppercase_env_keys(*, path: str | Path,
20
+ output: Optional[str | Path] = None,
21
+ backup: bool = False) -> Path:
22
+ """
23
+ Преобразует имена переменных в .env в верхний регистр.
24
+
25
+ :param path: путь к исходному .env
26
+ :param output: путь к файлу вывода. Если None — правит на месте.
27
+ :param backup: делать .bak при in-place
28
+ :return: путь к записанному файлу
29
+ """
30
+ src = Path(path)
31
+ if not src.exists():
32
+ raise FileNotFoundError(src)
33
+
34
+ text = src.read_text(encoding="utf-8-sig").splitlines(keepends=True)
35
+
36
+ seen_upper = set()
37
+ out_lines = []
38
+
39
+ for line in text:
40
+ # комментарии и пустые строки — как есть
41
+ if not line.strip() or COMMENT_RE.match(line):
42
+ out_lines.append(line)
43
+ continue
44
+
45
+ m = LINE_RE.match(line.rstrip("\n"))
46
+ if not m:
47
+ # строки без "=" или нестандартные — не трогаем
48
+ out_lines.append(line)
49
+ continue
50
+
51
+ lead = m.group("lead") or ""
52
+ export_kw = m.group("export") or ""
53
+ key = m.group("key")
54
+ eq = m.group("eq")
55
+ val = m.group("val")
56
+
57
+ key_up = key.upper()
58
+ # аккуратно соберем строку обратно (сохраняя пробелы/формат)
59
+ new_line = f"{lead}{(export_kw + ' ') if export_kw else ''}{key_up}{eq}{val}\n"
60
+ out_lines.append(new_line)
61
+
62
+ seen_upper.add(key_up)
63
+
64
+ # запись
65
+ if output is None:
66
+ if backup:
67
+ bak = src.with_suffix(src.suffix + ".bak")
68
+ bak.write_text("".join(text), encoding="utf-8")
69
+ dst = src
70
+ else:
71
+ dst = Path(output)
72
+
73
+ dst.write_text("".join(out_lines), encoding="utf-8")
74
+ return dst
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: arpakitlib
3
- Version: 1.8.284
3
+ Version: 1.8.295
4
4
  Summary: arpakitlib
5
5
  License: Apache-2.0
6
6
  License-File: LICENSE
@@ -35,7 +35,6 @@ Requires-Dist: gunicorn (>=23.0.0,<24.0.0)
35
35
  Requires-Dist: itsdangerous (>=2.2.0,<3.0.0)
36
36
  Requires-Dist: jupyter (>=1.1.1,<2.0.0)
37
37
  Requires-Dist: markdown (>=3.7,<4.0)
38
- Requires-Dist: matplotlib (>=3.10.0,<4.0.0)
39
38
  Requires-Dist: openai (>=2.2.0,<3.0.0)
40
39
  Requires-Dist: openpyxl (>=3.1.5,<4.0.0)
41
40
  Requires-Dist: orjson (>=3.10.15,<4.0.0)
@@ -43,6 +42,7 @@ Requires-Dist: pandas (>=2.2.3,<3.0.0)
43
42
  Requires-Dist: paramiko (>=4.0.0,<5.0.0)
44
43
  Requires-Dist: pika (>=1.3.2,<2.0.0)
45
44
  Requires-Dist: poetry (>=2.0.1,<3.0.0)
45
+ Requires-Dist: poetry-plugin-export (>=1.9.0)
46
46
  Requires-Dist: psycopg2-binary (>=2.9.10,<3.0.0)
47
47
  Requires-Dist: pulp (>=2.9.0,<3.0.0)
48
48
  Requires-Dist: pydantic (>=2.10.5,<3.0.0)
@@ -52,13 +52,11 @@ Requires-Dist: pymongo (>=4.10.1,<5.0.0)
52
52
  Requires-Dist: pytelegrambotapi (>=4.27.0,<5.0.0)
53
53
  Requires-Dist: pytest (>=8.4.2,<9.0.0)
54
54
  Requires-Dist: pytz (>=2024.2,<2025.0)
55
- Requires-Dist: pyzabbix (>=1.3.1,<2.0.0)
56
55
  Requires-Dist: qrcode (>=8.2,<9.0)
57
56
  Requires-Dist: rapidfuzz (>=3.14.1,<4.0.0)
58
57
  Requires-Dist: redis (>=6.4.0,<7.0.0)
59
58
  Requires-Dist: requests-ntlm (>=1.3.0,<2.0.0)
60
59
  Requires-Dist: requests[socks] (>=2.32.3,<3.0.0)
61
- Requires-Dist: scipy (>=1.15.1,<2.0.0)
62
60
  Requires-Dist: speechrecognition (>=3.14.3,<4.0.0)
63
61
  Requires-Dist: sqladmin (>=0.21.0,<0.22.0)
64
62
  Requires-Dist: sqlalchemy (>=2.0.37,<3.0.0)
@@ -69,7 +67,7 @@ Requires-Dist: xlsxwriter (>=3.2.5,<4.0.0)
69
67
  Project-URL: Documentation, https://github.com/ARPAKIT-Company/arpakitlib
70
68
  Project-URL: Homepage, https://github.com/ARPAKIT-Company/arpakitlib
71
69
  Project-URL: Repository, https://github.com/ARPAKIT-Company/arpakitlib
72
- Project-URL: arpakit_company_site, https://arpakit.com/
70
+ Project-URL: arpakit_company_site, https://arpakit.com
73
71
  Project-URL: telegram_channel, https://t.me/arpakitlib
74
72
  Description-Content-Type: text/markdown
75
73
 
@@ -236,7 +236,7 @@ arpakitlib/_arpakit_project_template_v_5/project/resource/templates/healthcheck.
236
236
  arpakitlib/_arpakit_project_template_v_5/project/resource/templates/simple_email.html,sha256=NNfrRzQFrymBSjWZdO-nkNSKk68hyPP9XgvQXpNQI4I,1112
237
237
  arpakitlib/_arpakit_project_template_v_5/project/sandbox/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
238
238
  arpakitlib/_arpakit_project_template_v_5/project/sandbox/sandbox_1.py,sha256=xKSp7tIBu3Ffp_kgJkwVtdam3BcoFZ44JPVHoRRaP0E,163
239
- arpakitlib/_arpakit_project_template_v_5/project/sandbox/sandbox_2.py,sha256=xKSp7tIBu3Ffp_kgJkwVtdam3BcoFZ44JPVHoRRaP0E,163
239
+ arpakitlib/_arpakit_project_template_v_5/project/sandbox/sandbox_2.py,sha256=ASf9gG8xIhMIW6yH218C_NF4WITND9UgTJ07FlR4o5Y,258
240
240
  arpakitlib/_arpakit_project_template_v_5/project/sandbox/sandbox_3.py,sha256=CIv4vQfBLhlIh92fiLhmyTXSZXjDovxTFZtUBDnWyFY,427
241
241
  arpakitlib/_arpakit_project_template_v_5/project/sandbox/sandbox_4.py,sha256=Oalf7__usi-AkxjoeKQgrbdvaK7Mevh6i92u0Upoq50,460
242
242
  arpakitlib/_arpakit_project_template_v_5/project/sandbox/sandbox_5.py,sha256=xKSp7tIBu3Ffp_kgJkwVtdam3BcoFZ44JPVHoRRaP0E,163
@@ -428,11 +428,12 @@ arpakitlib/ar_settings_util.py,sha256=Y5wi_cmsjDjfJpM0VJHjbo0NoVPKfypKaD1USowwDt
428
428
  arpakitlib/ar_sleep_util.py,sha256=ggaj7ML6QK_ADsHMcyu6GUmUpQ_9B9n-SKYH17h-9lM,1045
429
429
  arpakitlib/ar_sqladmin_util.py,sha256=SEoaowAPF3lhxPsNjwmOymNJ55Ty9rmzvsDm7gD5Ceo,861
430
430
  arpakitlib/ar_sqlalchemy_drop_check_constraints.py,sha256=XEqnMrIwSYasW_UOJ8xU-JhsVrcYeyehalFuSvmJMak,3518
431
- arpakitlib/ar_sqlalchemy_util.py,sha256=nUDCxhu0l8P0eBCdLyXej3_yLvBlB3LrGhMWzAekm5E,16532
431
+ arpakitlib/ar_sqlalchemy_util.py,sha256=vWNCzFv13YsGRZaemkNI1_BF__4Z1_Vqm-gqQL1PRrQ,17034
432
432
  arpakitlib/ar_str_util.py,sha256=2lGpnXDf2h1cBZpVf5i1tX_HCv5iBd6IGnrCw4QWWlY,4350
433
433
  arpakitlib/ar_type_util.py,sha256=Cs_tef-Fc5xeyAF54KgISCsP11NHyzIsglm4S3Xx7iM,4049
434
- arpakitlib-1.8.284.dist-info/METADATA,sha256=jjRkpN6Ct7o8RdfteryNYbvb98iZcm7uvd5lXHZ5BnI,4060
435
- arpakitlib-1.8.284.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
436
- arpakitlib-1.8.284.dist-info/entry_points.txt,sha256=36xqR3PJFT2kuwjkM_EqoIy0qFUDPKSm_mJaI7emewE,87
437
- arpakitlib-1.8.284.dist-info/licenses/LICENSE,sha256=GPEDQMam2r7FSTYqM1mm7aKnxLaWcBotH7UvQtea-ec,11355
438
- arpakitlib-1.8.284.dist-info/RECORD,,
434
+ arpakitlib/uppercase_env_keys.py,sha256=UFHLGIR70UB02eD7IAIBrZIbycwWCx3OP_W4J2cx2Jw,2395
435
+ arpakitlib-1.8.295.dist-info/METADATA,sha256=0KxhTELlPr1jeVlIPJbSo3X5tHeNtLJfU2j5mbSxMQk,3981
436
+ arpakitlib-1.8.295.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
437
+ arpakitlib-1.8.295.dist-info/entry_points.txt,sha256=36xqR3PJFT2kuwjkM_EqoIy0qFUDPKSm_mJaI7emewE,87
438
+ arpakitlib-1.8.295.dist-info/licenses/LICENSE,sha256=GPEDQMam2r7FSTYqM1mm7aKnxLaWcBotH7UvQtea-ec,11355
439
+ arpakitlib-1.8.295.dist-info/RECORD,,