arpakitlib 1.8.35__py3-none-any.whl → 1.8.37__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.
Files changed (73) hide show
  1. arpakitlib/_arpakit_project_template_v_5/command/emojize.py +9 -0
  2. arpakitlib/_arpakit_project_template_v_5/project/api/create_api_app.py +12 -2
  3. arpakitlib/_arpakit_project_template_v_5/project/api/exception_handler.py +1 -1
  4. arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/create_operation.py +78 -0
  5. arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/get_arpakitlib_project_template_info.py +8 -2
  6. arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/get_auth_data.py +8 -2
  7. arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/get_operation.py +63 -0
  8. arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/get_operation_allowed_statuses.py +40 -0
  9. arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/get_operation_allowed_types.py +40 -0
  10. arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/get_sqlalchemy_db_table_name_to_amount.py +39 -0
  11. arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/get_story_log.py +14 -4
  12. arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/init_sqlalchemy_db.py +8 -2
  13. arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/main_router.py +27 -1
  14. arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/raise_fake_error.py +1 -2
  15. arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/reinit_sqlalchemy_db.py +8 -2
  16. arpakitlib/_arpakit_project_template_v_5/project/api/router/client/get_current_user.py +11 -3
  17. arpakitlib/_arpakit_project_template_v_5/project/api/router/client/get_current_user_token.py +10 -3
  18. arpakitlib/_arpakit_project_template_v_5/project/api/router/client/main_router.py +1 -11
  19. arpakitlib/_arpakit_project_template_v_5/project/api/router/general/check_authorization.py +46 -0
  20. arpakitlib/_arpakit_project_template_v_5/project/api/router/{client → general}/get_current_api_key.py +9 -3
  21. arpakitlib/_arpakit_project_template_v_5/project/api/router/{client → general}/get_errors_info.py +10 -8
  22. arpakitlib/_arpakit_project_template_v_5/project/api/router/general/healthcheck.py +12 -3
  23. arpakitlib/_arpakit_project_template_v_5/project/api/router/general/main_router.py +18 -1
  24. arpakitlib/_arpakit_project_template_v_5/project/api/router/general/now_utc_datetime.py +14 -2
  25. arpakitlib/_arpakit_project_template_v_5/project/api/schema/common.py +11 -0
  26. arpakitlib/_arpakit_project_template_v_5/project/api/schema/out/admin/common.py +1 -0
  27. arpakitlib/_arpakit_project_template_v_5/project/api/schema/out/admin/operation.py +6 -3
  28. arpakitlib/_arpakit_project_template_v_5/project/api/schema/out/admin/story_log.py +8 -6
  29. arpakitlib/_arpakit_project_template_v_5/project/api/schema/out/client/common.py +3 -1
  30. arpakitlib/_arpakit_project_template_v_5/project/api/schema/out/client/user.py +14 -5
  31. arpakitlib/_arpakit_project_template_v_5/project/api/schema/out/client/user_token.py +5 -3
  32. arpakitlib/_arpakit_project_template_v_5/project/api/schema/out/{client → general}/api_key.py +5 -3
  33. arpakitlib/_arpakit_project_template_v_5/project/api/schema/out/general/user.py +31 -0
  34. arpakitlib/_arpakit_project_template_v_5/project/api/schema/out/general/user_token.py +16 -0
  35. arpakitlib/_arpakit_project_template_v_5/project/operation_execution/operation_executor_worker.py +2 -2
  36. arpakitlib/_arpakit_project_template_v_5/project/operation_execution/scheduled_operation_creator_worker.py +2 -1
  37. arpakitlib/_arpakit_project_template_v_5/project/sandbox/sandbox_1.py +6 -1
  38. arpakitlib/_arpakit_project_template_v_5/project/sqladmin_/model_view/api_key.py +4 -11
  39. arpakitlib/_arpakit_project_template_v_5/project/sqladmin_/model_view/common.py +1 -1
  40. arpakitlib/_arpakit_project_template_v_5/project/sqladmin_/model_view/operation.py +6 -18
  41. arpakitlib/_arpakit_project_template_v_5/project/sqladmin_/model_view/story_log.py +5 -15
  42. arpakitlib/_arpakit_project_template_v_5/project/sqladmin_/model_view/user.py +5 -15
  43. arpakitlib/_arpakit_project_template_v_5/project/sqladmin_/model_view/user_token.py +5 -11
  44. arpakitlib/_arpakit_project_template_v_5/project/sqlalchemy_db_/sqlalchemy_model/operation.py +6 -1
  45. arpakitlib/_arpakit_project_template_v_5/project/sqlalchemy_db_/sqlalchemy_model/story_log.py +6 -9
  46. arpakitlib/_arpakit_project_template_v_5/project/sqlalchemy_db_/sqlalchemy_model/user.py +30 -30
  47. arpakitlib/_arpakit_project_template_v_5/project/sqlalchemy_db_/sqlalchemy_model/user_token.py +4 -0
  48. arpakitlib/_arpakit_project_template_v_5/project/test_data/make_test_api_keys.py +2 -2
  49. arpakitlib/_arpakit_project_template_v_5/project/tg_bot/blank/{client.py → general.py} +7 -6
  50. arpakitlib/_arpakit_project_template_v_5/project/tg_bot/const.py +2 -2
  51. arpakitlib/_arpakit_project_template_v_5/project/tg_bot/kb/inline_/client/hello_world.py +1 -1
  52. arpakitlib/_arpakit_project_template_v_5/project/tg_bot/kb/static_/client/hello_world.py +1 -1
  53. arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/general/about.py +4 -4
  54. arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/general/author.py +4 -4
  55. arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/general/error_handler.py +2 -2
  56. arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/general/healthcheck.py +3 -3
  57. arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/general/hello_world.py +3 -3
  58. arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/general/raw_callback_query.py +1 -1
  59. arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/general/raw_message.py +1 -1
  60. arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/general/start.py +4 -4
  61. arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/general/support.py +4 -4
  62. arpakitlib/_arpakit_project_template_v_5/project/tg_bot/util/set_tg_bot_commands.py +14 -14
  63. arpakitlib/ar_enumeration_util.py +2 -2
  64. arpakitlib/ar_sqlalchemy_util.py +52 -24
  65. arpakitlib/ar_str_util.py +6 -0
  66. arpakitlib/ar_zabbix_api_client_util.py +56 -5
  67. {arpakitlib-1.8.35.dist-info → arpakitlib-1.8.37.dist-info}/METADATA +1 -1
  68. {arpakitlib-1.8.35.dist-info → arpakitlib-1.8.37.dist-info}/RECORD +71 -64
  69. arpakitlib/_arpakit_project_template_v_5/project/api/schema/out/general/errors_info_general.py +0 -6
  70. arpakitlib/_arpakit_project_template_v_5/project/api/schema/out/general/healthcheck.py +0 -5
  71. {arpakitlib-1.8.35.dist-info → arpakitlib-1.8.37.dist-info}/LICENSE +0 -0
  72. {arpakitlib-1.8.35.dist-info → arpakitlib-1.8.37.dist-info}/WHEEL +0 -0
  73. {arpakitlib-1.8.35.dist-info → arpakitlib-1.8.37.dist-info}/entry_points.txt +0 -0
@@ -1,3 +1,5 @@
1
+ import sqlalchemy
2
+
1
3
  from project.sqladmin_.model_view.common import SimpleMV
2
4
  from project.sqlalchemy_db_.sqlalchemy_model import UserTokenDBM
3
5
 
@@ -5,22 +7,16 @@ from project.sqlalchemy_db_.sqlalchemy_model import UserTokenDBM
5
7
  class UserTokenMV(SimpleMV, model=UserTokenDBM):
6
8
  name = "UserToken"
7
9
  name_plural = "UserTokens"
8
- column_list = [
9
- UserTokenDBM.id,
10
- UserTokenDBM.long_id,
11
- UserTokenDBM.slug,
12
- UserTokenDBM.creation_dt,
13
- UserTokenDBM.value,
14
- UserTokenDBM.user,
15
- UserTokenDBM.is_active,
16
- ]
10
+ column_list = sqlalchemy.inspect(UserTokenDBM).columns
17
11
  form_columns = [
18
12
  UserTokenDBM.slug,
19
13
  UserTokenDBM.creation_dt,
20
14
  UserTokenDBM.value,
21
15
  UserTokenDBM.user,
22
16
  UserTokenDBM.is_active,
17
+ UserTokenDBM.extra_data
23
18
  ]
19
+ column_sortable_list = sqlalchemy.inspect(UserTokenDBM).columns
24
20
  column_default_sort = [
25
21
  (UserTokenDBM.creation_dt, True)
26
22
  ]
@@ -29,6 +25,4 @@ class UserTokenMV(SimpleMV, model=UserTokenDBM):
29
25
  UserTokenDBM.long_id,
30
26
  UserTokenDBM.slug,
31
27
  UserTokenDBM.value,
32
- UserTokenDBM.user_id,
33
- UserTokenDBM.is_active,
34
28
  ]
@@ -5,7 +5,7 @@ from typing import Any, TYPE_CHECKING
5
5
 
6
6
  import sqlalchemy
7
7
  from sqlalchemy.dialects import postgresql
8
- from sqlalchemy.orm import mapped_column, Mapped
8
+ from sqlalchemy.orm import mapped_column, Mapped, validates
9
9
 
10
10
  from arpakitlib.ar_enumeration_util import Enumeration
11
11
  from project.sqlalchemy_db_.sqlalchemy_model.common import SimpleDBM
@@ -66,6 +66,11 @@ class OperationDBM(SimpleDBM):
66
66
  nullable=False
67
67
  )
68
68
 
69
+ @validates("status")
70
+ def _validate_status(self, key, value, *args, **kwargs):
71
+ self.Statuses.parse_and_validate_values(value)
72
+ return value
73
+
69
74
  def raise_if_executed_with_error(self):
70
75
  if self.status == self.Statuses.executed_with_error:
71
76
  raise Exception(
@@ -1,10 +1,9 @@
1
1
  from __future__ import annotations
2
2
 
3
- from typing import Any, TYPE_CHECKING
3
+ from typing import TYPE_CHECKING
4
4
 
5
5
  import sqlalchemy
6
- from sqlalchemy.dialects import postgresql
7
- from sqlalchemy.orm import mapped_column, Mapped
6
+ from sqlalchemy.orm import mapped_column, Mapped, validates
8
7
 
9
8
  from arpakitlib.ar_enumeration_util import Enumeration
10
9
  from project.sqlalchemy_db_.sqlalchemy_model.common import SimpleDBM
@@ -43,12 +42,10 @@ class StoryLogDBM(SimpleDBM):
43
42
  insert_default=None,
44
43
  nullable=True
45
44
  )
46
- data: Mapped[dict[str, Any]] = mapped_column(
47
- postgresql.JSON,
48
- insert_default={},
49
- server_default="{}",
50
- nullable=False
51
- )
45
+
46
+ @validates("level")
47
+ def _validate_level(self, key, value, *args, **kwargs):
48
+ self.Levels.parse_and_validate_values(value)
52
49
 
53
50
  @property
54
51
  def sdp_allowed_levels(self) -> list[str]:
@@ -99,76 +99,76 @@ class UserDBM(SimpleDBM):
99
99
  return bool(set(roles) & set(self.roles))
100
100
 
101
101
  @property
102
- def tg_first_name(self) -> str | None:
102
+ def tg_data_first_name(self) -> str | None:
103
103
  if self.tg_data and "first_name" in self.tg_data:
104
104
  return self.tg_data["first_name"]
105
105
  return None
106
106
 
107
107
  @property
108
- def sdp_tg_first_name(self) -> str | None:
109
- return self.tg_first_name
108
+ def sdp_tg_data_first_name(self) -> str | None:
109
+ return self.tg_data_first_name
110
110
 
111
111
  @property
112
- def tg_last_name(self) -> str | None:
112
+ def tg_data_last_name(self) -> str | None:
113
113
  if self.tg_data and "last_name" in self.tg_data:
114
114
  return self.tg_data["last_name"]
115
115
  return None
116
116
 
117
117
  @property
118
- def sdp_tg_last_name(self) -> str | None:
119
- return self.tg_last_name
118
+ def sdp_tg_data_last_name(self) -> str | None:
119
+ return self.tg_data_last_name
120
120
 
121
121
  @property
122
- def tg_language_code(self) -> str | None:
122
+ def tg_data_language_code(self) -> str | None:
123
123
  if self.tg_data and "language_code" in self.tg_data:
124
124
  return self.tg_data["language_code"]
125
125
  return None
126
126
 
127
127
  @property
128
- def sdp_tg_language_code(self) -> str | None:
129
- return self.tg_language_code
128
+ def sdp_tg_data_language_code(self) -> str | None:
129
+ return self.tg_data_language_code
130
130
 
131
131
  @property
132
- def tg_username(self) -> str | None:
132
+ def tg_data_username(self) -> str | None:
133
133
  if self.tg_data and "username" in self.tg_data:
134
134
  return self.tg_data["username"]
135
135
  return None
136
136
 
137
137
  @property
138
- def sdp_tg_username(self) -> str | None:
139
- return self.tg_username
138
+ def sdp_tg_data_username(self) -> str | None:
139
+ return self.tg_data_username
140
140
 
141
141
  @property
142
- def tg_at_username(self) -> str | None:
143
- if self.tg_username:
144
- return f"@{self.tg_username}"
142
+ def tg_data_at_username(self) -> str | None:
143
+ if self.tg_data_username:
144
+ return f"@{self.tg_data_username}"
145
145
  return None
146
146
 
147
147
  @property
148
- def sdp_tg_at_username(self) -> str | None:
149
- return self.tg_at_username
148
+ def sdp_tg_data_at_username(self) -> str | None:
149
+ return self.tg_data_at_username
150
150
 
151
151
  @property
152
- def tg_fullname(self) -> str | None:
153
- if not self.tg_first_name and not self.tg_last_name:
152
+ def tg_data_fullname(self) -> str | None:
153
+ if not self.tg_data_first_name and not self.tg_data_last_name:
154
154
  return None
155
155
  res = ""
156
- if self.tg_first_name:
157
- res += self.tg_first_name
158
- if self.tg_last_name:
159
- res += " " + self.tg_last_name
156
+ if self.tg_data_first_name:
157
+ res += self.tg_data_first_name
158
+ if self.tg_data_last_name:
159
+ res += " " + self.tg_data_last_name
160
160
  return res
161
161
 
162
162
  @property
163
- def sdp_tg_fullname(self) -> str | None:
164
- return self.tg_fullname
163
+ def sdp_tg_data_fullname(self) -> str | None:
164
+ return self.tg_data_fullname
165
165
 
166
166
  @property
167
- def tg_link_by_username(self) -> str | None:
168
- if not self.tg_username:
167
+ def tg_data_link_by_username(self) -> str | None:
168
+ if not self.tg_data_username:
169
169
  return None
170
- return f"https://t.me/{self.tg_username}"
170
+ return f"https://t.me/{self.tg_data_username}"
171
171
 
172
172
  @property
173
- def sdp_tg_link_by_username(self) -> str | None:
174
- return self.tg_link_by_username
173
+ def sdp_tg_data_link_by_username(self) -> str | None:
174
+ return self.tg_data_link_by_username
@@ -56,3 +56,7 @@ class UserTokenDBM(SimpleDBM):
56
56
  def __repr__(self) -> str:
57
57
  res = f"{self.entity_name} (id={self.id}, user_id={self.user_id})"
58
58
  return res
59
+
60
+ @property
61
+ def sdp_user(self) -> UserDBM:
62
+ return self.user
@@ -13,8 +13,8 @@ def make_test_data_1():
13
13
  with get_cached_sqlalchemy_db().new_session() as session:
14
14
  session.query(ApiKeyDBM).delete()
15
15
  session.commit()
16
- for i in range(10):
17
- api_key = ApiKeyDBM(value=str(i))
16
+ for i in range(1000):
17
+ api_key = ApiKeyDBM(value=str(i + 1))
18
18
  session.add(api_key)
19
19
  _logger.info(api_key)
20
20
  session.commit()
@@ -3,15 +3,16 @@ from functools import lru_cache
3
3
  from emoji import emojize
4
4
 
5
5
  from project.tg_bot.blank.common import SimpleBlankTgBot
6
- from project.tg_bot.const import ClientTgBotCommands
6
+ from project.tg_bot.const import GeneralTgBotCommands
7
7
 
8
8
 
9
9
  class ClientTgBotBlank(SimpleBlankTgBot):
10
10
  def command_to_desc(self) -> dict[str, str]:
11
11
  return {
12
- ClientTgBotCommands.start: emojize(":waving_hand: Начать"),
13
- ClientTgBotCommands.about: emojize(":information: О проекте"),
14
- ClientTgBotCommands.author: emojize(":bust_in_silhouette: Авторы"),
12
+ GeneralTgBotCommands.start: emojize(":waving_hand: Начать"),
13
+ GeneralTgBotCommands.about: emojize(":information: О проекте"),
14
+ GeneralTgBotCommands.author: emojize(":bust_in_silhouette: Авторы"),
15
+ GeneralTgBotCommands.support: emojize(":red_heart: Поддержка"),
15
16
  }
16
17
 
17
18
  def but_hello_world(self) -> str:
@@ -34,7 +35,7 @@ class ClientTgBotBlank(SimpleBlankTgBot):
34
35
 
35
36
  def author(self) -> str:
36
37
  res = "<b>ARPAKIT Company</b>"
37
- res += "\n\n<i>Мы создаём качественные IT продукты<i>"
38
+ res += "\n\n<i>Мы создаём качественные IT продукты</i>"
38
39
  res += "\n\n:link: https://arpakit.com/"
39
40
  res += "\n\n:e-mail: support@arpakit.com"
40
41
  return emojize(res.strip())
@@ -52,7 +53,7 @@ class ClientTgBotBlank(SimpleBlankTgBot):
52
53
  return emojize(res.strip())
53
54
 
54
55
  def support(self) -> str:
55
- res = ":red_heart: <b>Поддержка</b>"
56
+ res = ":red_heart: <b>Поддержка</b> :red_heart:"
56
57
  return emojize(res.strip())
57
58
 
58
59
  def keyboard_is_old(self) -> str:
@@ -1,7 +1,7 @@
1
1
  from arpakitlib.ar_enumeration_util import Enumeration
2
2
 
3
3
 
4
- class ClientTgBotCommands(Enumeration):
4
+ class GeneralTgBotCommands(Enumeration):
5
5
  start = "start"
6
6
  about = "about"
7
7
  author = "author"
@@ -28,7 +28,7 @@ class AdminTgBotCommands(Enumeration):
28
28
 
29
29
  def __example():
30
30
  print("ClientCommandsTgBot:")
31
- for v in ClientTgBotCommands.values_list():
31
+ for v in GeneralTgBotCommands.values_list():
32
32
  print(f"- {v}")
33
33
  print()
34
34
  print("AdminCommandsTgBot:")
@@ -1,7 +1,7 @@
1
1
  from aiogram.types import InlineKeyboardMarkup, InlineKeyboardButton
2
2
  from aiogram.utils.keyboard import InlineKeyboardBuilder
3
3
 
4
- from project.tg_bot.blank.client import get_cached_client_tg_bot_blank
4
+ from project.tg_bot.blank.general import get_cached_client_tg_bot_blank
5
5
  from project.tg_bot.callback.client import HelloWorldClientCD
6
6
 
7
7
 
@@ -1,7 +1,7 @@
1
1
  from aiogram.types import ReplyKeyboardMarkup, KeyboardButton
2
2
  from aiogram.utils.keyboard import ReplyKeyboardBuilder
3
3
 
4
- from project.tg_bot.blank.client import get_cached_client_tg_bot_blank
4
+ from project.tg_bot.blank.general import get_cached_client_tg_bot_blank
5
5
 
6
6
 
7
7
  def hello_world_client_static_kb_tg_bot() -> ReplyKeyboardMarkup:
@@ -4,8 +4,8 @@ import aiogram
4
4
  from aiogram import Router
5
5
  from aiogram.filters import Command, or_f
6
6
 
7
- from project.tg_bot.blank.client import get_cached_client_tg_bot_blank
8
- from project.tg_bot.const import ClientTgBotCommands
7
+ from project.tg_bot.blank.general import get_cached_client_tg_bot_blank
8
+ from project.tg_bot.const import GeneralTgBotCommands
9
9
  from project.tg_bot.filter_.message_text import MessageTextTgBotFilter
10
10
  from project.tg_bot.middleware.common import MiddlewareDataTgBot
11
11
 
@@ -15,9 +15,9 @@ _logger = logging.getLogger(__name__)
15
15
 
16
16
  @tg_bot_router.message(
17
17
  or_f(
18
- Command(ClientTgBotCommands.about),
18
+ Command(GeneralTgBotCommands.about),
19
19
  MessageTextTgBotFilter([
20
- ClientTgBotCommands.about,
20
+ GeneralTgBotCommands.about,
21
21
  "о проекте"
22
22
  ], ignore_case=True)
23
23
  ),
@@ -4,8 +4,8 @@ import aiogram
4
4
  from aiogram import Router
5
5
  from aiogram.filters import Command, or_f
6
6
 
7
- from project.tg_bot.blank.client import get_cached_client_tg_bot_blank
8
- from project.tg_bot.const import ClientTgBotCommands
7
+ from project.tg_bot.blank.general import get_cached_client_tg_bot_blank
8
+ from project.tg_bot.const import GeneralTgBotCommands
9
9
  from project.tg_bot.filter_.message_text import MessageTextTgBotFilter
10
10
  from project.tg_bot.middleware.common import MiddlewareDataTgBot
11
11
 
@@ -15,9 +15,9 @@ _logger = logging.getLogger(__name__)
15
15
 
16
16
  @tg_bot_router.message(
17
17
  or_f(
18
- Command(ClientTgBotCommands.author),
18
+ Command(GeneralTgBotCommands.author),
19
19
  MessageTextTgBotFilter([
20
- ClientTgBotCommands.about,
20
+ GeneralTgBotCommands.about,
21
21
  "автор",
22
22
  "авторы"
23
23
  ], ignore_case=True)
@@ -7,7 +7,7 @@ from aiogram.exceptions import TelegramBadRequest
7
7
  from arpakitlib.ar_exception_util import exception_to_traceback_str
8
8
  from project.sqlalchemy_db_.sqlalchemy_db import get_cached_sqlalchemy_db
9
9
  from project.sqlalchemy_db_.sqlalchemy_model import StoryLogDBM
10
- from project.tg_bot.blank.client import get_cached_client_tg_bot_blank
10
+ from project.tg_bot.blank.general import get_cached_client_tg_bot_blank
11
11
  from project.tg_bot.middleware.common import MiddlewareDataTgBot
12
12
 
13
13
  _logger = logging.getLogger(__name__)
@@ -81,7 +81,7 @@ async def _(
81
81
  level=StoryLogDBM.Levels.error,
82
82
  type=StoryLogDBM.Types.error_in_tg_bot,
83
83
  title=f"{type(error_event.exception)}",
84
- data={
84
+ extra_data={
85
85
  "exception": str(error_event.exception),
86
86
  "exception_traceback": exception_to_traceback_str(exception=error_event.exception)
87
87
  }
@@ -1,14 +1,14 @@
1
1
  import aiogram.filters
2
2
 
3
- from project.tg_bot.blank.client import get_cached_client_tg_bot_blank
4
- from project.tg_bot.const import ClientTgBotCommands
3
+ from project.tg_bot.blank.general import get_cached_client_tg_bot_blank
4
+ from project.tg_bot.const import GeneralTgBotCommands
5
5
  from project.tg_bot.middleware.common import MiddlewareDataTgBot
6
6
 
7
7
  tg_bot_router = aiogram.Router()
8
8
 
9
9
 
10
10
  @tg_bot_router.message(
11
- aiogram.filters.Command(ClientTgBotCommands.healthcheck),
11
+ aiogram.filters.Command(GeneralTgBotCommands.healthcheck),
12
12
  )
13
13
  async def _(
14
14
  m: aiogram.types.Message,
@@ -2,9 +2,9 @@ import aiogram.filters
2
2
  from aiogram.filters import or_f
3
3
 
4
4
  from arpakitlib.ar_str_util import remove_html
5
- from project.tg_bot.blank.client import get_cached_client_tg_bot_blank
5
+ from project.tg_bot.blank.general import get_cached_client_tg_bot_blank
6
6
  from project.tg_bot.callback.client import HelloWorldClientCD
7
- from project.tg_bot.const import ClientTgBotCommands
7
+ from project.tg_bot.const import GeneralTgBotCommands
8
8
  from project.tg_bot.filter_.message_text import MessageTextTgBotFilter
9
9
  from project.tg_bot.kb.inline_.client.hello_world import hello_world_client_inline_kb_tg_bot
10
10
  from project.tg_bot.kb.static_.client.hello_world import hello_world_client_static_kb_tg_bot
@@ -15,7 +15,7 @@ tg_bot_router = aiogram.Router()
15
15
 
16
16
  @tg_bot_router.message(
17
17
  or_f(
18
- aiogram.filters.Command(ClientTgBotCommands.hello_world),
18
+ aiogram.filters.Command(GeneralTgBotCommands.hello_world),
19
19
  MessageTextTgBotFilter(get_cached_client_tg_bot_blank().but_hello_world())
20
20
  ),
21
21
 
@@ -3,7 +3,7 @@ import logging
3
3
  import aiogram.filters
4
4
  from aiogram.exceptions import AiogramError
5
5
 
6
- from project.tg_bot.blank.client import get_cached_client_tg_bot_blank
6
+ from project.tg_bot.blank.general import get_cached_client_tg_bot_blank
7
7
  from project.tg_bot.middleware.common import MiddlewareDataTgBot
8
8
 
9
9
  _logger = logging.getLogger(__name__)
@@ -1,6 +1,6 @@
1
1
  import aiogram.filters
2
2
 
3
- from project.tg_bot.blank.client import get_cached_client_tg_bot_blank
3
+ from project.tg_bot.blank.general import get_cached_client_tg_bot_blank
4
4
  from project.tg_bot.middleware.common import MiddlewareDataTgBot
5
5
 
6
6
  tg_bot_router = aiogram.Router()
@@ -4,8 +4,8 @@ import aiogram
4
4
  from aiogram import Router
5
5
  from aiogram.filters import Command, or_f
6
6
 
7
- from project.tg_bot.blank.client import get_cached_client_tg_bot_blank
8
- from project.tg_bot.const import ClientTgBotCommands
7
+ from project.tg_bot.blank.general import get_cached_client_tg_bot_blank
8
+ from project.tg_bot.const import GeneralTgBotCommands
9
9
  from project.tg_bot.filter_.message_text import MessageTextTgBotFilter
10
10
  from project.tg_bot.middleware.common import MiddlewareDataTgBot
11
11
 
@@ -15,9 +15,9 @@ _logger = logging.getLogger(__name__)
15
15
 
16
16
  @tg_bot_router.message(
17
17
  or_f(
18
- Command(ClientTgBotCommands.start),
18
+ Command(GeneralTgBotCommands.start),
19
19
  MessageTextTgBotFilter([
20
- ClientTgBotCommands.start,
20
+ GeneralTgBotCommands.start,
21
21
  "начать",
22
22
  "старт",
23
23
  "привет",
@@ -4,8 +4,8 @@ import aiogram
4
4
  from aiogram import Router
5
5
  from aiogram.filters import Command, or_f
6
6
 
7
- from project.tg_bot.blank.client import get_cached_client_tg_bot_blank
8
- from project.tg_bot.const import ClientTgBotCommands
7
+ from project.tg_bot.blank.general import get_cached_client_tg_bot_blank
8
+ from project.tg_bot.const import GeneralTgBotCommands
9
9
  from project.tg_bot.filter_.message_text import MessageTextTgBotFilter
10
10
  from project.tg_bot.middleware.common import MiddlewareDataTgBot
11
11
 
@@ -15,9 +15,9 @@ _logger = logging.getLogger(__name__)
15
15
 
16
16
  @tg_bot_router.message(
17
17
  or_f(
18
- Command(ClientTgBotCommands.support),
18
+ Command(GeneralTgBotCommands.support),
19
19
  MessageTextTgBotFilter([
20
- ClientTgBotCommands.support,
20
+ GeneralTgBotCommands.support,
21
21
  "поддержка"
22
22
  ], ignore_case=True)
23
23
  )
@@ -8,8 +8,8 @@ from project.core.settings import get_cached_settings
8
8
  from project.core.util import setup_logging
9
9
  from project.sqlalchemy_db_.sqlalchemy_db import get_cached_sqlalchemy_db
10
10
  from project.sqlalchemy_db_.sqlalchemy_model import UserDBM
11
- from project.tg_bot.blank.client import get_cached_client_tg_bot_blank
12
- from project.tg_bot.const import ClientTgBotCommands, AdminTgBotCommands
11
+ from project.tg_bot.blank.general import get_cached_client_tg_bot_blank
12
+ from project.tg_bot.const import GeneralTgBotCommands, AdminTgBotCommands
13
13
  from project.tg_bot.tg_bot import get_cached_tg_bot
14
14
 
15
15
  _logger = logging.getLogger(__name__)
@@ -18,31 +18,31 @@ _logger = logging.getLogger(__name__)
18
18
  def get_client_tg_bot_commands_to_set() -> list[BotCommand]:
19
19
  res = [
20
20
  BotCommand(
21
- command=ClientTgBotCommands.start,
21
+ command=GeneralTgBotCommands.start,
22
22
  description=return_str_if_none(
23
- get_cached_client_tg_bot_blank().command_to_desc().get(ClientTgBotCommands.start),
24
- ClientTgBotCommands.start
23
+ get_cached_client_tg_bot_blank().command_to_desc().get(GeneralTgBotCommands.start),
24
+ GeneralTgBotCommands.start
25
25
  )
26
26
  ),
27
27
  BotCommand(
28
- command=ClientTgBotCommands.about,
28
+ command=GeneralTgBotCommands.about,
29
29
  description=return_str_if_none(
30
- get_cached_client_tg_bot_blank().command_to_desc().get(ClientTgBotCommands.about),
31
- ClientTgBotCommands.about
30
+ get_cached_client_tg_bot_blank().command_to_desc().get(GeneralTgBotCommands.about),
31
+ GeneralTgBotCommands.about
32
32
  )
33
33
  ),
34
34
  BotCommand(
35
- command=ClientTgBotCommands.support,
35
+ command=GeneralTgBotCommands.support,
36
36
  description=return_str_if_none(
37
- get_cached_client_tg_bot_blank().command_to_desc().get(ClientTgBotCommands.support),
38
- ClientTgBotCommands.support
37
+ get_cached_client_tg_bot_blank().command_to_desc().get(GeneralTgBotCommands.support),
38
+ GeneralTgBotCommands.support
39
39
  )
40
40
  ),
41
41
  BotCommand(
42
- command=ClientTgBotCommands.author,
42
+ command=GeneralTgBotCommands.author,
43
43
  description=return_str_if_none(
44
- get_cached_client_tg_bot_blank().command_to_desc().get(ClientTgBotCommands.author),
45
- ClientTgBotCommands.author
44
+ get_cached_client_tg_bot_blank().command_to_desc().get(GeneralTgBotCommands.author),
45
+ GeneralTgBotCommands.author
46
46
  )
47
47
  )
48
48
 
@@ -48,14 +48,14 @@ class Enumeration:
48
48
 
49
49
  if isinstance(value, str) or isinstance(value, int):
50
50
  if validate is True and value not in cls.values_set():
51
- raise ValueError(f"validate is True and {value} not in {cls.values_set()}")
51
+ raise ValueError(f"{value} not in {cls.values_set()}")
52
52
  res.append(value)
53
53
 
54
54
  elif isinstance(value, Iterable):
55
55
  for value_ in value:
56
56
  if isinstance(value_, str) or isinstance(value_, int):
57
57
  if validate is True and value_ not in cls.values_set():
58
- raise ValueError(f"validate is True and {value_} not in {cls.values_set()}")
58
+ raise ValueError(f"{value_} not in {cls.values_set()}")
59
59
  res.append(value_)
60
60
  else:
61
61
  raise TypeError(f"bad type, value={value}, type={type(value)}")