arpakitlib 1.8.4__py3-none-any.whl → 1.8.6__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 (240) hide show
  1. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/alembic/env.py +2 -2
  2. arpakitlib/_arpakit_project_template_v_2/arpakitlib_project_template_info.json +3 -0
  3. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/check_logging.py +1 -1
  4. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/check_sqlalchemy_db.py +2 -2
  5. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/drop_json_db.py +3 -3
  6. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/drop_sqlalchemy_db.py +4 -3
  7. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/generate_settings_env_example.py +2 -2
  8. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/init_json_db.py +2 -2
  9. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/init_sqlalchemy_db.py +2 -2
  10. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/reinit_json_db.py +3 -3
  11. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/reinit_sqlalchemy_db.py +3 -3
  12. arpakitlib/_arpakit_project_template_v_2/command/remove_operations.py +13 -0
  13. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/remove_story_logs.py +4 -4
  14. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/rm_all_records_in_json_db.py +3 -3
  15. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/show_settings.py +1 -1
  16. arpakitlib/{_arpakit_project_template_v_1/command/start_api_without_reload.py → _arpakit_project_template_v_2/command/start_api_for_not_prod.py} +3 -3
  17. arpakitlib/_arpakit_project_template_v_2/command/start_api_for_prod.py +19 -0
  18. arpakitlib/{_arpakit_project_template_v_1/command/start_api_with_reload.py → _arpakit_project_template_v_2/command/start_api_with_reload_for_not_prod.py} +3 -3
  19. arpakitlib/_arpakit_project_template_v_2/command/start_operation_executor_worker_for_not_prod.py +15 -0
  20. arpakitlib/{_arpakit_project_template_v_1/command/start_sync_operation_executor_workers.py → _arpakit_project_template_v_2/command/start_operation_executor_workers_for_not_prod.py} +3 -3
  21. arpakitlib/{_arpakit_project_template_v_1/command/start_sync_scheduled_operation_creator_worker.py → _arpakit_project_template_v_2/command/start_scheduled_operation_creator_worker_for_not_prod.py} +2 -2
  22. arpakitlib/_arpakit_project_template_v_2/command/start_tg_bot_for_prod.py +11 -0
  23. arpakitlib/_arpakit_project_template_v_2/project/api/asgi.py +3 -0
  24. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/api/auth.py +34 -5
  25. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/api/create_api_app.py +8 -8
  26. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/api/event.py +8 -8
  27. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/api/exception.py +2 -2
  28. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/api/exception_handler.py +7 -7
  29. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/api/response.py +1 -1
  30. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/api/router/main_router.py +1 -4
  31. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/api/router/v1/check_auth.py +2 -2
  32. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/api/router/v1/clear_log_file.py +6 -7
  33. arpakitlib/{_arpakit_project_template_v_1/api/router/v1/arpakitlib_project_template.py → _arpakit_project_template_v_2/project/api/router/v1/get_arpakitlib_project_template_info.py} +3 -3
  34. arpakitlib/_arpakit_project_template_v_2/project/api/router/v1/get_errors_info.py +33 -0
  35. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/api/router/v1/get_log_file.py +5 -6
  36. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/api/router/v1/healthcheck.py +2 -2
  37. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/api/router/v1/main_router.py +14 -23
  38. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/api/router/v1/now_utc_datetime.py +1 -1
  39. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/api/router/v1/raise_fake_error.py +5 -6
  40. arpakitlib/_arpakit_project_template_v_2/project/api/router/v1/reinit_sqlalchemy_db.py +33 -0
  41. arpakitlib/_arpakit_project_template_v_2/project/api/schema/common/in_.py +5 -0
  42. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/api/schema/common/out.py +1 -1
  43. arpakitlib/_arpakit_project_template_v_2/project/api/schema/v1/in_.py +5 -0
  44. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/api/schema/v1/out.py +2 -2
  45. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/business_service/hello_world.py +2 -2
  46. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/business_service/remove_operations.py +2 -2
  47. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/core/cache_file_storage_in_dir.py +1 -1
  48. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/core/const.py +8 -4
  49. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/core/dump_file_storage_in_dir.py +1 -1
  50. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/core/jinja2_templates.py +1 -1
  51. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/core/media_file_storage_in_dir.py +1 -1
  52. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/core/settings.py +3 -3
  53. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/core/util.py +1 -1
  54. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/json_db/json_db.py +1 -1
  55. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/operation_execution/operation_executor_worker.py +2 -2
  56. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/operation_execution/scheduled_operation_creator_worker.py +3 -3
  57. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/operation_execution/scheduled_operations.py +2 -2
  58. arpakitlib/_arpakit_project_template_v_2/project/resource/static/helloworld +1 -0
  59. arpakitlib/_arpakit_project_template_v_2/project/resource/static/openapi-favicon.png +0 -0
  60. arpakitlib/_arpakit_project_template_v_2/project/site/asgi.py +3 -0
  61. arpakitlib/_arpakit_project_template_v_2/project/site/create_site_app.py +5 -0
  62. arpakitlib/_arpakit_project_template_v_2/project/site/event.py +19 -0
  63. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/sqladmin_/add_admin_in_app.py +4 -4
  64. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/sqladmin_/admin_auth.py +1 -1
  65. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/sqladmin_/model_view.py +1 -1
  66. arpakitlib/_arpakit_project_template_v_2/project/sqlalchemy_db_/const.py +1 -0
  67. arpakitlib/{_arpakit_project_template_v_1/sqlalchemy_db → _arpakit_project_template_v_2/project/sqlalchemy_db_}/sqlalchemy_db.py +2 -2
  68. arpakitlib/{_arpakit_project_template_v_1/sqlalchemy_db → _arpakit_project_template_v_2/project/sqlalchemy_db_}/sqlalchemy_model.py +7 -4
  69. arpakitlib/_arpakit_project_template_v_2/project/tg_bot/blank/blank.py +24 -0
  70. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/tg_bot/const.py +1 -1
  71. arpakitlib/_arpakit_project_template_v_2/project/tg_bot/event.py +77 -0
  72. arpakitlib/_arpakit_project_template_v_2/project/tg_bot/filter_.py +69 -0
  73. arpakitlib/_arpakit_project_template_v_2/project/tg_bot/kb/inline_/callback.py +37 -0
  74. arpakitlib/_arpakit_project_template_v_2/project/tg_bot/kb/inline_/common.py +15 -0
  75. arpakitlib/_arpakit_project_template_v_2/project/tg_bot/kb/static_/common.py +14 -0
  76. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/tg_bot/middleware/init_user.py +0 -3
  77. arpakitlib/_arpakit_project_template_v_2/project/tg_bot/middleware/middleware.py +12 -0
  78. arpakitlib/_arpakit_project_template_v_2/project/tg_bot/router/arpakitlib_project_template_info.py +14 -0
  79. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/tg_bot/router/error.py +4 -3
  80. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/tg_bot/router/healthcheck.py +3 -2
  81. arpakitlib/_arpakit_project_template_v_2/project/tg_bot/router/main_router.py +12 -0
  82. arpakitlib/_arpakit_project_template_v_2/project/tg_bot/start_tg_bot.py +39 -0
  83. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/tg_bot/tg_bot.py +1 -1
  84. arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/tg_bot/tg_bot_dispatcher.py +5 -4
  85. arpakitlib/_arpakit_project_template_v_2/project/tg_bot/util.py +1 -0
  86. arpakitlib/_arpakit_project_template_v_2/project/util/arpakitlib_project_template.py +17 -0
  87. arpakitlib/ar_aiogram_util.py +3 -123
  88. {arpakitlib-1.8.4.dist-info → arpakitlib-1.8.6.dist-info}/METADATA +1 -1
  89. arpakitlib-1.8.6.dist-info/RECORD +260 -0
  90. arpakitlib/_arpakit_project_template_v_1/api/asgi.py +0 -3
  91. arpakitlib/_arpakit_project_template_v_1/api/router/v1/get_errors_info.py +0 -24
  92. arpakitlib/_arpakit_project_template_v_1/api/schema/common/in_.py +0 -5
  93. arpakitlib/_arpakit_project_template_v_1/api/schema/v1/in_.py +0 -5
  94. arpakitlib/_arpakit_project_template_v_1/arpakitlib_project_template.json +0 -3
  95. arpakitlib/_arpakit_project_template_v_1/command/remove_operations.py +0 -13
  96. arpakitlib/_arpakit_project_template_v_1/command/start_async_operation_executor_worker.py +0 -14
  97. arpakitlib/_arpakit_project_template_v_1/command/start_async_scheduled_operation_creator_worker.py +0 -14
  98. arpakitlib/_arpakit_project_template_v_1/command/start_sync_operation_executor_worker.py +0 -15
  99. arpakitlib/_arpakit_project_template_v_1/operation_execution/const.py +0 -0
  100. arpakitlib/_arpakit_project_template_v_1/resource/static/openapi-favicon.png +0 -0
  101. arpakitlib/_arpakit_project_template_v_1/site/asgi.py +0 -0
  102. arpakitlib/_arpakit_project_template_v_1/site/create_site_app.py +0 -0
  103. arpakitlib/_arpakit_project_template_v_1/site/event.py +0 -0
  104. arpakitlib/_arpakit_project_template_v_1/tg_bot/blank/blank.py +0 -5
  105. arpakitlib/_arpakit_project_template_v_1/tg_bot/blank/util.py +0 -12
  106. arpakitlib/_arpakit_project_template_v_1/tg_bot/event.py +0 -51
  107. arpakitlib/_arpakit_project_template_v_1/tg_bot/filter/not_prod_mode.py +0 -8
  108. arpakitlib/_arpakit_project_template_v_1/tg_bot/filter/prod_mode.py +0 -8
  109. arpakitlib/_arpakit_project_template_v_1/tg_bot/kb/inline_/callback.py +0 -0
  110. arpakitlib/_arpakit_project_template_v_1/tg_bot/kb/inline_/common.py +0 -0
  111. arpakitlib/_arpakit_project_template_v_1/tg_bot/kb/static_/common.py +0 -0
  112. arpakitlib/_arpakit_project_template_v_1/tg_bot/middleware/middleware.py +0 -12
  113. arpakitlib/_arpakit_project_template_v_1/tg_bot/router/arpakitlib_.py +0 -10
  114. arpakitlib/_arpakit_project_template_v_1/tg_bot/router/main_router.py +0 -14
  115. arpakitlib/_arpakit_project_template_v_1/tg_bot/start_tg_bot.py +0 -34
  116. arpakitlib/_arpakit_project_template_v_1/tg_bot/transmitted_tg_data.py +0 -58
  117. arpakitlib/_arpakit_project_template_v_1/tg_bot/util.py +0 -0
  118. arpakitlib/_arpakit_project_template_v_1/util/__init__.py +0 -0
  119. arpakitlib/_arpakit_project_template_v_1/util/read_arpakitlib_project_template_file.py +0 -17
  120. arpakitlib-1.8.4.dist-info/RECORD +0 -262
  121. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/.gitignore +0 -0
  122. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/.python-version +0 -0
  123. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/LICENSE +0 -0
  124. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/README.md +0 -0
  125. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/alembic/README +0 -0
  126. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/alembic/script.py.mako +0 -0
  127. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/alembic.ini +0 -0
  128. /arpakitlib/{_arpakit_project_template_v_1/additional_model → _arpakit_project_template_v_2/command}/__init__.py +0 -0
  129. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/alembic_history.sh +0 -0
  130. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/alembic_revision_autogenerate.sh +0 -0
  131. /arpakitlib/{_arpakit_project_template_v_1/command/alembic_upgrade_head .sh → _arpakit_project_template_v_2/command/alembic_upgrade_head.sh} +0 -0
  132. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/beautify_json.py +0 -0
  133. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/docker_ps_a.sh +0 -0
  134. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/docker_rm_postgres.sh +0 -0
  135. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/docker_run_postgres.sh +0 -0
  136. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/docker_start_postgres.sh +0 -0
  137. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/docker_stop_postgres.sh +0 -0
  138. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/git_commit.sh +0 -0
  139. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/git_push_arpakit_company_github_1.sh +0 -0
  140. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/git_push_arpakit_company_gitlab_1.sh +0 -0
  141. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/git_push_arpakit_github_1.sh +0 -0
  142. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/git_push_arpakit_gitlab_1.sh +0 -0
  143. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/git_remote_v.sh +0 -0
  144. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/git_set_arpakit_company_origin.sh +0 -0
  145. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/git_set_arpakit_origin.sh +0 -0
  146. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/git_set_divarteam_origin.sh +0 -0
  147. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/git_status.sh +0 -0
  148. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/hello_world.py +0 -0
  149. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/poetry_check.sh +0 -0
  150. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/poetry_clear_cache.sh +0 -0
  151. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/poetry_config.sh +0 -0
  152. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/poetry_install.sh +0 -0
  153. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/poetry_lock.sh +0 -0
  154. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/poetry_remove_and_add_arpakitlib.sh +0 -0
  155. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/poetry_show.sh +0 -0
  156. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/poetry_show_arpakitlib.sh +0 -0
  157. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/poetry_update.sh +0 -0
  158. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/command/poetry_update_arpakitlib.sh +0 -0
  159. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2}/example.env +0 -0
  160. /arpakitlib/{_arpakit_project_template_v_1/api → _arpakit_project_template_v_2/project}/__init__.py +0 -0
  161. /arpakitlib/{_arpakit_project_template_v_1/api/router → _arpakit_project_template_v_2/project/additional_model}/__init__.py +0 -0
  162. /arpakitlib/{_arpakit_project_template_v_1/additional_model/additional_model.py → _arpakit_project_template_v_2/project/additional_model/common.py} +0 -0
  163. /arpakitlib/{_arpakit_project_template_v_1/api/router/v1 → _arpakit_project_template_v_2/project/api}/__init__.py +0 -0
  164. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/api/const.py +0 -0
  165. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/api/openapi_ui.py +0 -0
  166. /arpakitlib/{_arpakit_project_template_v_1/api/schema → _arpakit_project_template_v_2/project/api/router}/__init__.py +0 -0
  167. /arpakitlib/{_arpakit_project_template_v_1/api/schema/common → _arpakit_project_template_v_2/project/api/router/v1}/__init__.py +0 -0
  168. /arpakitlib/{_arpakit_project_template_v_1/api/schema/v1 → _arpakit_project_template_v_2/project/api/schema}/__init__.py +0 -0
  169. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/api/schema/base_schema.py +0 -0
  170. /arpakitlib/{_arpakit_project_template_v_1/business_service → _arpakit_project_template_v_2/project/api/schema/common}/__init__.py +0 -0
  171. /arpakitlib/{_arpakit_project_template_v_1/celery_ → _arpakit_project_template_v_2/project/api/schema/v1}/__init__.py +0 -0
  172. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/api/util.py +0 -0
  173. /arpakitlib/{_arpakit_project_template_v_1/command → _arpakit_project_template_v_2/project/business_service}/__init__.py +0 -0
  174. /arpakitlib/{_arpakit_project_template_v_1/core → _arpakit_project_template_v_2/project/celery_}/__init__.py +0 -0
  175. /arpakitlib/{_arpakit_project_template_v_1/json_db → _arpakit_project_template_v_2/project/core}/__init__.py +0 -0
  176. /arpakitlib/{_arpakit_project_template_v_1/note → _arpakit_project_template_v_2/project/json_db}/__init__.py +0 -0
  177. /arpakitlib/{_arpakit_project_template_v_1/resource/static → _arpakit_project_template_v_2/project/more}/helloworld +0 -0
  178. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/note/note_1.txt +0 -0
  179. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/note/note_2.txt +0 -0
  180. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/note/note_3.txt +0 -0
  181. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/note/note_4.txt +0 -0
  182. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/note/note_5.txt +0 -0
  183. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/operation_execution/__init__.py +0 -0
  184. /arpakitlib/{_arpakit_project_template_v_1/sqlalchemy_db → _arpakit_project_template_v_2/project/operation_execution}/const.py +0 -0
  185. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/operation_execution/util.py +0 -0
  186. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/resource/__init__.py +0 -0
  187. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/resource/static/1 +0 -0
  188. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/resource/static/healthcheck +0 -0
  189. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/resource/static/redoc/redoc.standalone.js +0 -0
  190. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/resource/static/swagger-ui/favicon-16x16.png +0 -0
  191. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/resource/static/swagger-ui/favicon-32x32.png +0 -0
  192. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/resource/static/swagger-ui/index.css +0 -0
  193. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/resource/static/swagger-ui/index.html +0 -0
  194. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/resource/static/swagger-ui/oauth2-redirect.html +0 -0
  195. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/resource/static/swagger-ui/swagger-initializer.js +0 -0
  196. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/resource/static/swagger-ui/swagger-ui-bundle.js +0 -0
  197. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/resource/static/swagger-ui/swagger-ui-bundle.js.map +0 -0
  198. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/resource/static/swagger-ui/swagger-ui-es-bundle-core.js +0 -0
  199. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/resource/static/swagger-ui/swagger-ui-es-bundle-core.js.map +0 -0
  200. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/resource/static/swagger-ui/swagger-ui-es-bundle.js +0 -0
  201. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/resource/static/swagger-ui/swagger-ui-es-bundle.js.map +0 -0
  202. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/resource/static/swagger-ui/swagger-ui-standalone-preset.js +0 -0
  203. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/resource/static/swagger-ui/swagger-ui-standalone-preset.js.map +0 -0
  204. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/resource/static/swagger-ui/swagger-ui.css +0 -0
  205. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/resource/static/swagger-ui/swagger-ui.css.map +0 -0
  206. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/resource/static/swagger-ui/swagger-ui.js +0 -0
  207. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/resource/static/swagger-ui/swagger-ui.js.map +0 -0
  208. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/sandbox/__init__.py +0 -0
  209. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/sandbox/sandbox_1.py +0 -0
  210. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/sandbox/sandbox_2.py +0 -0
  211. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/sandbox/sandbox_3.py +0 -0
  212. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/sandbox/sandbox_4.py +0 -0
  213. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/sandbox/sandbox_5.py +0 -0
  214. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/sandbox/sandbox_6.py +0 -0
  215. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/sandbox/sandbox_7.py +0 -0
  216. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/site/__init__.py +0 -0
  217. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/site/consts.py +0 -0
  218. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/site/exception_handler.py +0 -0
  219. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/site/router/__init__.py +0 -0
  220. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/site/router/main_router.py +0 -0
  221. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/sqladmin_/__init__.py +0 -0
  222. /arpakitlib/{_arpakit_project_template_v_1/sqlalchemy_db → _arpakit_project_template_v_2/project/sqlalchemy_db_}/__init__.py +0 -0
  223. /arpakitlib/{_arpakit_project_template_v_1/sqlalchemy_db → _arpakit_project_template_v_2/project/sqlalchemy_db_}/util.py +0 -0
  224. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/test_data/__init__.py +0 -0
  225. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/test_data/make_test_data_1.py +0 -0
  226. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/test_data/make_test_data_2.py +0 -0
  227. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/test_data/make_test_data_3.py +0 -0
  228. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/test_data/make_test_data_4.py +0 -0
  229. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/test_data/make_test_data_5.py +0 -0
  230. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/tg_bot/__init__.py +0 -0
  231. /arpakitlib/{_arpakit_project_template_v_1 → _arpakit_project_template_v_2/project}/tg_bot/blank/__init__.py +0 -0
  232. /arpakitlib/{_arpakit_project_template_v_1/tg_bot/filter → _arpakit_project_template_v_2/project/tg_bot/kb}/__init__.py +0 -0
  233. /arpakitlib/{_arpakit_project_template_v_1/tg_bot/kb → _arpakit_project_template_v_2/project/tg_bot/kb/inline_}/__init__.py +0 -0
  234. /arpakitlib/{_arpakit_project_template_v_1/tg_bot/kb/inline_ → _arpakit_project_template_v_2/project/tg_bot/kb/static_}/__init__.py +0 -0
  235. /arpakitlib/{_arpakit_project_template_v_1/tg_bot/kb/static_ → _arpakit_project_template_v_2/project/tg_bot/middleware}/__init__.py +0 -0
  236. /arpakitlib/{_arpakit_project_template_v_1/tg_bot/middleware → _arpakit_project_template_v_2/project/tg_bot/router}/__init__.py +0 -0
  237. /arpakitlib/{_arpakit_project_template_v_1/tg_bot/router → _arpakit_project_template_v_2/project/util}/__init__.py +0 -0
  238. {arpakitlib-1.8.4.dist-info → arpakitlib-1.8.6.dist-info}/LICENSE +0 -0
  239. {arpakitlib-1.8.4.dist-info → arpakitlib-1.8.6.dist-info}/WHEEL +0 -0
  240. {arpakitlib-1.8.4.dist-info → arpakitlib-1.8.6.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,69 @@
1
+ from typing import Iterable
2
+
3
+ import aiogram.types
4
+ from aiogram.filters import Filter
5
+
6
+ from arpakitlib.ar_type_util import raise_for_type
7
+ from project.core.settings import get_cached_settings
8
+
9
+
10
+ class NotProdModeFilterTgBotFilter(Filter):
11
+ async def __call__(self, *args, **kwargs) -> bool:
12
+ return get_cached_settings().is_mode_type_not_prod
13
+
14
+
15
+ class ProdModeFilterTgBotFilter(Filter):
16
+ async def __call__(self, *args, **kwargs) -> bool:
17
+ return get_cached_settings().is_mode_type_prod
18
+
19
+
20
+ class TextFilterTgBotFilter(Filter):
21
+
22
+ def __init__(
23
+ self,
24
+ *texts: str | Iterable[str],
25
+ ignore_case: bool = True
26
+ ) -> None:
27
+ self.ignore_case = ignore_case
28
+ self.texts = set()
29
+
30
+ for text in texts:
31
+
32
+ if isinstance(text, str):
33
+ if ignore_case is True:
34
+ text = text.lower()
35
+ text = text.strip()
36
+ self.texts.add(text)
37
+
38
+ elif isinstance(text, Iterable):
39
+ for text_ in text:
40
+ raise_for_type(text_, str)
41
+ if ignore_case is True:
42
+ text_ = text_.lower()
43
+ text_ = text_.strip()
44
+ self.texts.add(text_)
45
+
46
+ else:
47
+ raise TypeError(f"text has bad type = {type(text)}")
48
+
49
+ async def __call__(self, message: aiogram.types.Message, *args, **kwargs) -> bool:
50
+ raise_for_type(message, aiogram.types.Message)
51
+
52
+ if message.text is None:
53
+ return False
54
+
55
+ text = message.text.strip()
56
+ if self.ignore_case is True:
57
+ text = text.lower()
58
+
59
+ return text in self.texts
60
+
61
+
62
+ class IsPrivateChatTgBotFilter(Filter):
63
+ async def __call__(self, update: aiogram.types.Message | aiogram.types.CallbackQuery) -> bool:
64
+ if isinstance(update, aiogram.types.Message):
65
+ return update.chat.type == aiogram.enums.ChatType.PRIVATE
66
+ elif isinstance(update, aiogram.types.CallbackQuery):
67
+ return update.message.chat.type == aiogram.enums.ChatType.PRIVATE
68
+ else:
69
+ return False
@@ -0,0 +1,37 @@
1
+ from aiogram.filters.callback_data import CallbackData
2
+
3
+ _used_cd_prefixes = set()
4
+
5
+
6
+ def get_used_cd_prefixes() -> set[str]:
7
+ return _used_cd_prefixes
8
+
9
+
10
+ def generate_callback_data_prefix(string: str) -> str:
11
+ res = 0
12
+ for s_ in string:
13
+ res += ord(s_)
14
+ res += len(string)
15
+ res = str(res)
16
+ return res
17
+
18
+
19
+ class BaseCD(CallbackData, prefix="BaseCD"):
20
+
21
+ def __init_subclass__(cls, **kwargs):
22
+ if not cls.__name__.endswith("CD"):
23
+ raise ValueError("callback data class should ends with CD")
24
+
25
+ if "prefix" not in kwargs:
26
+ kwargs["prefix"] = str(generate_callback_data_prefix(cls.__name__.lower().removesuffix("cd")))
27
+ prefix = kwargs["prefix"]
28
+
29
+ if prefix in _used_cd_prefixes:
30
+ raise ValueError(f"prefix({prefix}) already in _used_cd_prefixes({_used_cd_prefixes})")
31
+ _used_cd_prefixes.add(prefix)
32
+
33
+ super().__init_subclass__(**kwargs)
34
+
35
+
36
+ class WithFromCD(BaseCD, prefix="WithFromCD"):
37
+ from_: str | None = None
@@ -0,0 +1,15 @@
1
+ from aiogram.types import InlineKeyboardMarkup, InlineKeyboardButton
2
+ from aiogram.utils.keyboard import InlineKeyboardBuilder
3
+
4
+ from project.tg_bot.blank.blank import get_cached_tg_bot_blank
5
+
6
+
7
+ def groups_inline_kb() -> InlineKeyboardMarkup:
8
+ kb_builder = InlineKeyboardBuilder()
9
+
10
+ kb_builder.row(InlineKeyboardButton(
11
+ text=get_cached_tg_bot_blank().hello_world(),
12
+ callback_data="Hello world"
13
+ ))
14
+
15
+ return kb_builder.as_markup()
@@ -0,0 +1,14 @@
1
+ from aiogram.types import ReplyKeyboardMarkup, KeyboardButton
2
+ from aiogram.utils.keyboard import ReplyKeyboardBuilder
3
+
4
+ from project.tg_bot.blank.blank import get_cached_tg_bot_blank
5
+
6
+
7
+ def hello_world_static_kb() -> ReplyKeyboardMarkup:
8
+ kb_builder = ReplyKeyboardBuilder()
9
+
10
+ kb_builder.row(KeyboardButton(
11
+ text=get_cached_tg_bot_blank().hello_world()
12
+ ))
13
+
14
+ return kb_builder.as_markup(resize_keyboard=True, one_time_keyboard=False)
@@ -4,8 +4,6 @@ from typing import Any, Awaitable, Callable, Dict
4
4
  from aiogram import BaseMiddleware
5
5
  from aiogram.types import TelegramObject
6
6
 
7
- from tg_bot.transmitted_tg_data import TransmittedTgBotData
8
-
9
7
  _logger = logging.getLogger(__name__)
10
8
 
11
9
 
@@ -18,7 +16,6 @@ class InitUserTgBotMiddleware(BaseMiddleware):
18
16
  data: Dict[str, Any],
19
17
  ) -> Any:
20
18
  _logger.info("start")
21
- transmitted_tg_bot_data: TransmittedTgBotData = data["transmitted_tg_bot_data"]
22
19
  # ...
23
20
  _logger.info("finish")
24
21
  return await handler(event, data)
@@ -0,0 +1,12 @@
1
+ import aiogram
2
+
3
+ from project.tg_bot.middleware.init_user import InitUserTgBotMiddleware
4
+
5
+
6
+ def register_middlewares_to_tg_bot(
7
+ *,
8
+ tg_bot_dispatcher: aiogram.Dispatcher,
9
+ **kwargs
10
+ ) -> aiogram.Dispatcher:
11
+ tg_bot_dispatcher.update.outer_middleware.register(InitUserTgBotMiddleware())
12
+ return tg_bot_dispatcher
@@ -0,0 +1,14 @@
1
+ import aiogram.filters
2
+
3
+ from arpakitlib.ar_json_util import safely_transfer_obj_to_json_str
4
+ from project.tg_bot.const import TgBotCommands
5
+ from project.util.arpakitlib_project_template import get_arpakitlib_project_template_info
6
+
7
+ tg_bot_router = aiogram.Router()
8
+
9
+
10
+ @tg_bot_router.message(aiogram.filters.Command(TgBotCommands.arpakitlib_project_template_info))
11
+ async def _(m: aiogram.types.Message, **kwargs):
12
+ await m.answer(
13
+ text=safely_transfer_obj_to_json_str(data=get_arpakitlib_project_template_info())
14
+ )
@@ -1,7 +1,9 @@
1
+ import logging
2
+
1
3
  import aiogram
2
4
  from aiogram import Router
3
5
 
4
- from tg_bot.transmitted_tg_data import TransmittedTgBotData
6
+ _logger = logging.getLogger(__name__)
5
7
 
6
8
  tg_bot_router = Router()
7
9
 
@@ -9,7 +11,6 @@ tg_bot_router = Router()
9
11
  @tg_bot_router.error()
10
12
  async def _(
11
13
  event: aiogram.types.ErrorEvent,
12
- transmitted_tg_bot_data: TransmittedTgBotData,
13
14
  **kwargs
14
15
  ):
15
- pass
16
+ _logger.exception(event.exception)
@@ -1,10 +1,11 @@
1
1
  import aiogram.filters
2
2
 
3
- from tg_bot.const import TgBotCommands
3
+ from project.tg_bot.blank.blank import get_cached_tg_bot_blank
4
+ from project.tg_bot.const import TgBotCommands
4
5
 
5
6
  tg_bot_router = aiogram.Router()
6
7
 
7
8
 
8
9
  @tg_bot_router.message(aiogram.filters.Command(TgBotCommands.healthcheck))
9
10
  async def _(m: aiogram.types.Message, **kwargs):
10
- await m.answer(text="healthcheck")
11
+ await m.answer(text=get_cached_tg_bot_blank().healthcheck())
@@ -0,0 +1,12 @@
1
+ from aiogram import Router
2
+
3
+ from project.tg_bot.router import arpakitlib_project_template_info
4
+ from project.tg_bot.router import error, healthcheck
5
+
6
+ main_tg_bot_router = Router()
7
+
8
+ main_tg_bot_router.include_router(router=error.tg_bot_router)
9
+
10
+ main_tg_bot_router.include_router(router=healthcheck.tg_bot_router)
11
+
12
+ main_tg_bot_router.include_router(router=arpakitlib_project_template_info.tg_bot_router)
@@ -0,0 +1,39 @@
1
+ import asyncio
2
+
3
+ import aiohttp
4
+ import aiohttp.web
5
+ from aiogram.webhook.aiohttp_server import SimpleRequestHandler, setup_application
6
+
7
+ from project.core.settings import get_cached_settings
8
+ from project.core.util import setup_logging
9
+ from project.tg_bot.tg_bot import create_tg_bot
10
+ from project.tg_bot.tg_bot_dispatcher import create_tg_bot_dispatcher
11
+
12
+
13
+ def start_tg_bot():
14
+ setup_logging()
15
+
16
+ tg_bot = create_tg_bot()
17
+
18
+ tg_bot_dispatcher = create_tg_bot_dispatcher()
19
+
20
+ if not get_cached_settings().tg_bot_webhook_enabled:
21
+ asyncio.run(tg_bot_dispatcher.start_polling(tg_bot))
22
+ else:
23
+ app = aiohttp.web.Application()
24
+ simple_requests_handler = SimpleRequestHandler(
25
+ dispatcher=tg_bot_dispatcher,
26
+ bot=tg_bot,
27
+ secret_token=get_cached_settings().tg_bot_webhook_secret
28
+ )
29
+ simple_requests_handler.register(app, path=get_cached_settings().tg_bot_webhook_path)
30
+ setup_application(app, tg_bot_dispatcher, bot=tg_bot)
31
+ aiohttp.web.run_app(
32
+ app=app,
33
+ host=get_cached_settings().tg_bot_webhook_server_hostname,
34
+ port=get_cached_settings().tg_bot_webhook_server_port
35
+ )
36
+
37
+
38
+ if __name__ == '__main__':
39
+ start_tg_bot()
@@ -3,7 +3,7 @@ from aiogram.client.default import DefaultBotProperties
3
3
  from aiogram.client.session.aiohttp import AiohttpSession
4
4
  from aiogram.enums import ParseMode
5
5
 
6
- from core.settings import get_cached_settings
6
+ from project.core.settings import get_cached_settings
7
7
 
8
8
 
9
9
  def create_tg_bot() -> aiogram.Bot:
@@ -1,19 +1,20 @@
1
1
  import aiogram
2
2
  from aiogram.fsm.storage.memory import MemoryStorage
3
3
 
4
- from tg_bot.event import add_events_to_tg_bot_dispatcher
5
- from tg_bot.router.main_router import main_tg_bot_router
6
- from tg_bot.transmitted_tg_data import get_cached_transmitted_tg_bot_data
4
+ from project.tg_bot.event import add_events_to_tg_bot_dispatcher
5
+ from project.tg_bot.middleware.middleware import register_middlewares_to_tg_bot
6
+ from project.tg_bot.router.main_router import main_tg_bot_router
7
7
 
8
8
 
9
9
  def create_tg_bot_dispatcher() -> aiogram.Dispatcher:
10
10
  tg_bot_dispatcher = aiogram.Dispatcher(
11
11
  storage=MemoryStorage(),
12
- transmitted_tg_bot_data=get_cached_transmitted_tg_bot_data()
13
12
  )
14
13
 
15
14
  add_events_to_tg_bot_dispatcher(tg_bot_dispatcher=tg_bot_dispatcher)
16
15
 
16
+ register_middlewares_to_tg_bot(tg_bot_dispatcher=tg_bot_dispatcher)
17
+
17
18
  tg_bot_dispatcher.include_router(router=main_tg_bot_router)
18
19
 
19
20
  return tg_bot_dispatcher
@@ -0,0 +1,17 @@
1
+ import json
2
+ from typing import Any
3
+
4
+ from project.core.const import ProjectPaths
5
+
6
+
7
+ def get_arpakitlib_project_template_info() -> dict[str, Any]:
8
+ with open(ProjectPaths.arpakit_lib_project_template_info_filepath, mode="r", encoding="utf-8") as fr:
9
+ return json.load(fp=fr)
10
+
11
+
12
+ def __example():
13
+ print(get_arpakitlib_project_template_info())
14
+
15
+
16
+ if __name__ == '__main__':
17
+ __example()
@@ -2,118 +2,22 @@
2
2
 
3
3
  import asyncio
4
4
  import logging
5
- from typing import Optional, Any, Union, Callable, Iterable
5
+ from typing import Optional, Any, Callable
6
6
 
7
- import aiogram
8
- import aiohttp
9
- import aiohttp.web
10
7
  from aiogram import types
11
- from aiogram.enums import ChatType
12
8
  from aiogram.exceptions import AiogramError
13
- from aiogram.filters import CommandObject, Filter
14
- from aiogram.filters.callback_data import CallbackData
15
- from aiogram.webhook.aiohttp_server import SimpleRequestHandler, setup_application
16
- from aiohttp import web
9
+ from aiogram.filters import CommandObject
17
10
  from pydantic import BaseModel
18
11
 
19
12
  from arpakitlib.ar_need_type_util import parse_need_type, NeedTypes
20
13
  from arpakitlib.ar_parse_command import BadCommandFormat, parse_command
21
- from arpakitlib.ar_type_util import raise_for_types, raise_for_type
14
+ from arpakitlib.ar_type_util import raise_for_types
22
15
 
23
16
  _ARPAKIT_LIB_MODULE_VERSION = "3.0"
24
17
 
25
18
  _logger = logging.getLogger(__name__)
26
19
 
27
20
 
28
- class TextFilter(Filter):
29
-
30
- def __init__(
31
- self,
32
- *texts: Union[str, Iterable[str]],
33
- ignore_case: bool = True
34
- ) -> None:
35
- self.ignore_case = ignore_case
36
- self.texts = set()
37
-
38
- for text in texts:
39
-
40
- if isinstance(text, str):
41
- if ignore_case is True:
42
- text = text.lower()
43
- text = text.strip()
44
- self.texts.add(text)
45
-
46
- elif isinstance(text, Iterable):
47
- for text_ in text:
48
- raise_for_type(text_, str)
49
- if ignore_case is True:
50
- text_ = text_.lower()
51
- text_ = text_.strip()
52
- self.texts.add(text_)
53
-
54
- else:
55
- raise TypeError(f"text has bad type = {type(text)}")
56
-
57
- async def __call__(self, message: types.Message, *args, **kwargs) -> bool:
58
- raise_for_type(message, types.Message)
59
-
60
- if message.text is None:
61
- return False
62
-
63
- text = message.text.strip()
64
- if self.ignore_case is True:
65
- text = text.lower()
66
-
67
- return text in self.texts
68
-
69
-
70
- class IsPrivateChat(Filter):
71
- async def __call__(self, update: types.Message | types.CallbackQuery) -> bool:
72
- if isinstance(update, types.Message):
73
- return update.chat.type == ChatType.PRIVATE
74
- elif isinstance(update, types.CallbackQuery):
75
- return update.message.chat.type == ChatType.PRIVATE
76
- else:
77
- return False
78
-
79
-
80
- _used_cd_prefixes = set()
81
-
82
-
83
- def get_used_cd_prefixes() -> set[str]:
84
- return _used_cd_prefixes
85
-
86
-
87
- def generate_cd_prefix(string: str) -> str:
88
- res = 0
89
- for s_ in string:
90
- res += ord(s_)
91
- res += len(string)
92
- res = str(res)
93
- return res
94
-
95
-
96
- class BaseCD(CallbackData, prefix="BaseCD"):
97
-
98
- def __init_subclass__(cls, **kwargs):
99
- if not cls.__name__.endswith("CD"):
100
- raise ValueError("callback data class should ends with CD")
101
-
102
- if "prefix" not in kwargs:
103
- kwargs["prefix"] = str(generate_cd_prefix(cls.__name__.lower().removesuffix("cd")))
104
- prefix = kwargs["prefix"]
105
-
106
- if prefix in _used_cd_prefixes:
107
- raise ValueError(f"prefix({prefix}) already in _used_cd_prefixes({_used_cd_prefixes})")
108
- _used_cd_prefixes.add(prefix)
109
-
110
- super().__init_subclass__(**kwargs)
111
-
112
-
113
- class WithFromCD(BaseCD, prefix="WithFromCD"):
114
- from_: Optional[str] = None
115
-
116
-
117
21
  class BadTgCommandFormat(BadCommandFormat):
118
22
  pass
119
23
 
@@ -314,30 +218,6 @@ def as_tg_command(
314
218
  return decorator
315
219
 
316
220
 
317
- def start_aiogram_tg_bot_with_webhook(
318
- *,
319
- dispatcher: aiogram.Dispatcher,
320
- bot: aiogram.Bot,
321
- webhook_secret: str = "123",
322
- webhook_path: str = "/tg_bot_webhook",
323
- webhook_server_hostname: str = "127.0.0.1",
324
- webhook_server_port: int = 8080
325
- ):
326
- app = aiohttp.web.Application()
327
- simple_requests_handler = SimpleRequestHandler(
328
- dispatcher=dispatcher,
329
- bot=bot,
330
- secret_token=webhook_secret
331
- )
332
- simple_requests_handler.register(app, path=webhook_path)
333
- setup_application(app, dispatcher, bot=bot)
334
- web.run_app(
335
- app=app,
336
- host=webhook_server_hostname,
337
- port=webhook_server_port
338
- )
339
-
340
-
341
221
  def __example():
342
222
  pass
343
223
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: arpakitlib
3
- Version: 1.8.4
3
+ Version: 1.8.6
4
4
  Summary: arpakitlib
5
5
  License: Apache-2.0
6
6
  Keywords: arpakitlib,arpakit,arpakit-company,arpakitcompany,arpakit_company