From b540527c68470f93a373c9750b9cd0b49a939e10 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Sat, 5 Aug 2023 10:41:12 +0800 Subject: [PATCH] :recycle: Change to git submodule --- README.md | 25 ++++++++------ gram_core/__init__.py => __init__.py | 0 gram_core/application.py => application.py | 0 gram_core/base_service.py => base_service.py | 0 gram_core/basemodel.py => basemodel.py | 0 {gram_core/builtins => builtins}/__init__.py | 0 {gram_core/builtins => builtins}/contexts.py | 0 .../builtins => builtins}/dispatcher.py | 0 {gram_core/builtins => builtins}/executor.py | 0 {gram_core/builtins => builtins}/reloader.py | 0 gram_core/config.py => config.py | 0 .../dependence => dependence}/__init__.py | 0 .../dependence => dependence}/aiobrowser.py | 0 .../dependence => dependence}/aiobrowser.pyi | 0 .../dependence => dependence}/database.py | 0 .../dependence => dependence}/mtproto.py | 0 .../dependence => dependence}/mtproto.pyi | 0 .../dependence => dependence}/redisdb.py | 0 gram_core/error.py => error.py | 0 gram_core/README.md | 22 ------------ gram_core/version.py | 1 - {gram_core/handler => handler}/__init__.py | 0 .../handler => handler}/adminhandler.py | 0 .../callbackqueryhandler.py | 0 .../handler => handler}/limiterhandler.py | 0 gram_core/manager.py => manager.py | 0 {gram_core/override => override}/__init__.py | 0 {gram_core/override => override}/telegram.py | 0 {gram_core/plugin => plugin}/__init__.py | 0 {gram_core/plugin => plugin}/_funcs.py | 0 {gram_core/plugin => plugin}/_handler.py | 0 {gram_core/plugin => plugin}/_job.py | 0 {gram_core/plugin => plugin}/_plugin.py | 0 gram_core/ratelimiter.py => ratelimiter.py | 0 {gram_core/services => services}/__init__.py | 0 .../services => services}/cookies/__init__.py | 0 .../services => services}/cookies/cache.py | 0 .../services => services}/cookies/error.py | 0 .../services => services}/cookies/models.py | 0 .../cookies/repositories.py | 0 .../services => services}/cookies/services.py | 0 .../services => services}/devices/__init__.py | 0 .../services => services}/devices/models.py | 0 .../devices/repositories.py | 0 .../services => services}/devices/services.py | 0 .../services => services}/players/__init__.py | 0 .../services => services}/players/error.py | 0 .../services => services}/players/models.py | 0 .../players/repositories.py | 0 .../services => services}/players/services.py | 0 .../services => services}/task/__init__.py | 0 .../services => services}/task/models.py | 0 .../task/repositories.py | 0 .../services => services}/task/services.py | 0 .../services => services}/template/README.md | 0 .../template/__init__.py | 0 .../services => services}/template/cache.py | 0 .../services => services}/template/error.py | 0 .../services => services}/template/models.py | 0 .../template/services.py | 0 .../services => services}/users/__init__.py | 0 .../services => services}/users/cache.py | 0 .../services => services}/users/models.py | 0 .../users/repositories.py | 0 .../services => services}/users/services.py | 0 setup.py | 34 ------------------- {gram_core/sqlmodel => sqlmodel}/__init__.py | 0 {gram_core/sqlmodel => sqlmodel}/session.py | 0 68 files changed, 15 insertions(+), 67 deletions(-) rename gram_core/__init__.py => __init__.py (100%) rename gram_core/application.py => application.py (100%) rename gram_core/base_service.py => base_service.py (100%) rename gram_core/basemodel.py => basemodel.py (100%) rename {gram_core/builtins => builtins}/__init__.py (100%) rename {gram_core/builtins => builtins}/contexts.py (100%) rename {gram_core/builtins => builtins}/dispatcher.py (100%) rename {gram_core/builtins => builtins}/executor.py (100%) rename {gram_core/builtins => builtins}/reloader.py (100%) rename gram_core/config.py => config.py (100%) rename {gram_core/dependence => dependence}/__init__.py (100%) rename {gram_core/dependence => dependence}/aiobrowser.py (100%) rename {gram_core/dependence => dependence}/aiobrowser.pyi (100%) rename {gram_core/dependence => dependence}/database.py (100%) rename {gram_core/dependence => dependence}/mtproto.py (100%) rename {gram_core/dependence => dependence}/mtproto.pyi (100%) rename {gram_core/dependence => dependence}/redisdb.py (100%) rename gram_core/error.py => error.py (100%) delete mode 100644 gram_core/README.md delete mode 100644 gram_core/version.py rename {gram_core/handler => handler}/__init__.py (100%) rename {gram_core/handler => handler}/adminhandler.py (100%) rename {gram_core/handler => handler}/callbackqueryhandler.py (100%) rename {gram_core/handler => handler}/limiterhandler.py (100%) rename gram_core/manager.py => manager.py (100%) rename {gram_core/override => override}/__init__.py (100%) rename {gram_core/override => override}/telegram.py (100%) rename {gram_core/plugin => plugin}/__init__.py (100%) rename {gram_core/plugin => plugin}/_funcs.py (100%) rename {gram_core/plugin => plugin}/_handler.py (100%) rename {gram_core/plugin => plugin}/_job.py (100%) rename {gram_core/plugin => plugin}/_plugin.py (100%) rename gram_core/ratelimiter.py => ratelimiter.py (100%) rename {gram_core/services => services}/__init__.py (100%) rename {gram_core/services => services}/cookies/__init__.py (100%) rename {gram_core/services => services}/cookies/cache.py (100%) rename {gram_core/services => services}/cookies/error.py (100%) rename {gram_core/services => services}/cookies/models.py (100%) rename {gram_core/services => services}/cookies/repositories.py (100%) rename {gram_core/services => services}/cookies/services.py (100%) rename {gram_core/services => services}/devices/__init__.py (100%) rename {gram_core/services => services}/devices/models.py (100%) rename {gram_core/services => services}/devices/repositories.py (100%) rename {gram_core/services => services}/devices/services.py (100%) rename {gram_core/services => services}/players/__init__.py (100%) rename {gram_core/services => services}/players/error.py (100%) rename {gram_core/services => services}/players/models.py (100%) rename {gram_core/services => services}/players/repositories.py (100%) rename {gram_core/services => services}/players/services.py (100%) rename {gram_core/services => services}/task/__init__.py (100%) rename {gram_core/services => services}/task/models.py (100%) rename {gram_core/services => services}/task/repositories.py (100%) rename {gram_core/services => services}/task/services.py (100%) rename {gram_core/services => services}/template/README.md (100%) rename {gram_core/services => services}/template/__init__.py (100%) rename {gram_core/services => services}/template/cache.py (100%) rename {gram_core/services => services}/template/error.py (100%) rename {gram_core/services => services}/template/models.py (100%) rename {gram_core/services => services}/template/services.py (100%) rename {gram_core/services => services}/users/__init__.py (100%) rename {gram_core/services => services}/users/cache.py (100%) rename {gram_core/services => services}/users/models.py (100%) rename {gram_core/services => services}/users/repositories.py (100%) rename {gram_core/services => services}/users/services.py (100%) delete mode 100644 setup.py rename {gram_core/sqlmodel => sqlmodel}/__init__.py (100%) rename {gram_core/sqlmodel => sqlmodel}/session.py (100%) diff --git a/README.md b/README.md index ec7acad..0f1200d 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,22 @@ -# GramCore +# core 目录说明 -## 1. Overview +## 关于 `Service` -telegram robot base core. +服务 `Service` 需定义在 `services` 文件夹下, 并继承 `core.service.Service` -## 2. Usage +每个 `Service` 都应包含 `start` 和 `stop` 方法, 且这两个方法都为异步方法 -### 2.1 init project +```python +from core.service import Service -```bash -poetry install -v -``` -### 2.2 usage +class TestService(Service): + def __init__(self): + """do something""" -TODO + async def start(self, *args, **kwargs): + """do something""" + + async def stop(self, *args, **kwargs): + """do something""" +``` \ No newline at end of file diff --git a/gram_core/__init__.py b/__init__.py similarity index 100% rename from gram_core/__init__.py rename to __init__.py diff --git a/gram_core/application.py b/application.py similarity index 100% rename from gram_core/application.py rename to application.py diff --git a/gram_core/base_service.py b/base_service.py similarity index 100% rename from gram_core/base_service.py rename to base_service.py diff --git a/gram_core/basemodel.py b/basemodel.py similarity index 100% rename from gram_core/basemodel.py rename to basemodel.py diff --git a/gram_core/builtins/__init__.py b/builtins/__init__.py similarity index 100% rename from gram_core/builtins/__init__.py rename to builtins/__init__.py diff --git a/gram_core/builtins/contexts.py b/builtins/contexts.py similarity index 100% rename from gram_core/builtins/contexts.py rename to builtins/contexts.py diff --git a/gram_core/builtins/dispatcher.py b/builtins/dispatcher.py similarity index 100% rename from gram_core/builtins/dispatcher.py rename to builtins/dispatcher.py diff --git a/gram_core/builtins/executor.py b/builtins/executor.py similarity index 100% rename from gram_core/builtins/executor.py rename to builtins/executor.py diff --git a/gram_core/builtins/reloader.py b/builtins/reloader.py similarity index 100% rename from gram_core/builtins/reloader.py rename to builtins/reloader.py diff --git a/gram_core/config.py b/config.py similarity index 100% rename from gram_core/config.py rename to config.py diff --git a/gram_core/dependence/__init__.py b/dependence/__init__.py similarity index 100% rename from gram_core/dependence/__init__.py rename to dependence/__init__.py diff --git a/gram_core/dependence/aiobrowser.py b/dependence/aiobrowser.py similarity index 100% rename from gram_core/dependence/aiobrowser.py rename to dependence/aiobrowser.py diff --git a/gram_core/dependence/aiobrowser.pyi b/dependence/aiobrowser.pyi similarity index 100% rename from gram_core/dependence/aiobrowser.pyi rename to dependence/aiobrowser.pyi diff --git a/gram_core/dependence/database.py b/dependence/database.py similarity index 100% rename from gram_core/dependence/database.py rename to dependence/database.py diff --git a/gram_core/dependence/mtproto.py b/dependence/mtproto.py similarity index 100% rename from gram_core/dependence/mtproto.py rename to dependence/mtproto.py diff --git a/gram_core/dependence/mtproto.pyi b/dependence/mtproto.pyi similarity index 100% rename from gram_core/dependence/mtproto.pyi rename to dependence/mtproto.pyi diff --git a/gram_core/dependence/redisdb.py b/dependence/redisdb.py similarity index 100% rename from gram_core/dependence/redisdb.py rename to dependence/redisdb.py diff --git a/gram_core/error.py b/error.py similarity index 100% rename from gram_core/error.py rename to error.py diff --git a/gram_core/README.md b/gram_core/README.md deleted file mode 100644 index 0f1200d..0000000 --- a/gram_core/README.md +++ /dev/null @@ -1,22 +0,0 @@ -# core 目录说明 - -## 关于 `Service` - -服务 `Service` 需定义在 `services` 文件夹下, 并继承 `core.service.Service` - -每个 `Service` 都应包含 `start` 和 `stop` 方法, 且这两个方法都为异步方法 - -```python -from core.service import Service - - -class TestService(Service): - def __init__(self): - """do something""" - - async def start(self, *args, **kwargs): - """do something""" - - async def stop(self, *args, **kwargs): - """do something""" -``` \ No newline at end of file diff --git a/gram_core/version.py b/gram_core/version.py deleted file mode 100644 index 3dc1f76..0000000 --- a/gram_core/version.py +++ /dev/null @@ -1 +0,0 @@ -__version__ = "0.1.0" diff --git a/gram_core/handler/__init__.py b/handler/__init__.py similarity index 100% rename from gram_core/handler/__init__.py rename to handler/__init__.py diff --git a/gram_core/handler/adminhandler.py b/handler/adminhandler.py similarity index 100% rename from gram_core/handler/adminhandler.py rename to handler/adminhandler.py diff --git a/gram_core/handler/callbackqueryhandler.py b/handler/callbackqueryhandler.py similarity index 100% rename from gram_core/handler/callbackqueryhandler.py rename to handler/callbackqueryhandler.py diff --git a/gram_core/handler/limiterhandler.py b/handler/limiterhandler.py similarity index 100% rename from gram_core/handler/limiterhandler.py rename to handler/limiterhandler.py diff --git a/gram_core/manager.py b/manager.py similarity index 100% rename from gram_core/manager.py rename to manager.py diff --git a/gram_core/override/__init__.py b/override/__init__.py similarity index 100% rename from gram_core/override/__init__.py rename to override/__init__.py diff --git a/gram_core/override/telegram.py b/override/telegram.py similarity index 100% rename from gram_core/override/telegram.py rename to override/telegram.py diff --git a/gram_core/plugin/__init__.py b/plugin/__init__.py similarity index 100% rename from gram_core/plugin/__init__.py rename to plugin/__init__.py diff --git a/gram_core/plugin/_funcs.py b/plugin/_funcs.py similarity index 100% rename from gram_core/plugin/_funcs.py rename to plugin/_funcs.py diff --git a/gram_core/plugin/_handler.py b/plugin/_handler.py similarity index 100% rename from gram_core/plugin/_handler.py rename to plugin/_handler.py diff --git a/gram_core/plugin/_job.py b/plugin/_job.py similarity index 100% rename from gram_core/plugin/_job.py rename to plugin/_job.py diff --git a/gram_core/plugin/_plugin.py b/plugin/_plugin.py similarity index 100% rename from gram_core/plugin/_plugin.py rename to plugin/_plugin.py diff --git a/gram_core/ratelimiter.py b/ratelimiter.py similarity index 100% rename from gram_core/ratelimiter.py rename to ratelimiter.py diff --git a/gram_core/services/__init__.py b/services/__init__.py similarity index 100% rename from gram_core/services/__init__.py rename to services/__init__.py diff --git a/gram_core/services/cookies/__init__.py b/services/cookies/__init__.py similarity index 100% rename from gram_core/services/cookies/__init__.py rename to services/cookies/__init__.py diff --git a/gram_core/services/cookies/cache.py b/services/cookies/cache.py similarity index 100% rename from gram_core/services/cookies/cache.py rename to services/cookies/cache.py diff --git a/gram_core/services/cookies/error.py b/services/cookies/error.py similarity index 100% rename from gram_core/services/cookies/error.py rename to services/cookies/error.py diff --git a/gram_core/services/cookies/models.py b/services/cookies/models.py similarity index 100% rename from gram_core/services/cookies/models.py rename to services/cookies/models.py diff --git a/gram_core/services/cookies/repositories.py b/services/cookies/repositories.py similarity index 100% rename from gram_core/services/cookies/repositories.py rename to services/cookies/repositories.py diff --git a/gram_core/services/cookies/services.py b/services/cookies/services.py similarity index 100% rename from gram_core/services/cookies/services.py rename to services/cookies/services.py diff --git a/gram_core/services/devices/__init__.py b/services/devices/__init__.py similarity index 100% rename from gram_core/services/devices/__init__.py rename to services/devices/__init__.py diff --git a/gram_core/services/devices/models.py b/services/devices/models.py similarity index 100% rename from gram_core/services/devices/models.py rename to services/devices/models.py diff --git a/gram_core/services/devices/repositories.py b/services/devices/repositories.py similarity index 100% rename from gram_core/services/devices/repositories.py rename to services/devices/repositories.py diff --git a/gram_core/services/devices/services.py b/services/devices/services.py similarity index 100% rename from gram_core/services/devices/services.py rename to services/devices/services.py diff --git a/gram_core/services/players/__init__.py b/services/players/__init__.py similarity index 100% rename from gram_core/services/players/__init__.py rename to services/players/__init__.py diff --git a/gram_core/services/players/error.py b/services/players/error.py similarity index 100% rename from gram_core/services/players/error.py rename to services/players/error.py diff --git a/gram_core/services/players/models.py b/services/players/models.py similarity index 100% rename from gram_core/services/players/models.py rename to services/players/models.py diff --git a/gram_core/services/players/repositories.py b/services/players/repositories.py similarity index 100% rename from gram_core/services/players/repositories.py rename to services/players/repositories.py diff --git a/gram_core/services/players/services.py b/services/players/services.py similarity index 100% rename from gram_core/services/players/services.py rename to services/players/services.py diff --git a/gram_core/services/task/__init__.py b/services/task/__init__.py similarity index 100% rename from gram_core/services/task/__init__.py rename to services/task/__init__.py diff --git a/gram_core/services/task/models.py b/services/task/models.py similarity index 100% rename from gram_core/services/task/models.py rename to services/task/models.py diff --git a/gram_core/services/task/repositories.py b/services/task/repositories.py similarity index 100% rename from gram_core/services/task/repositories.py rename to services/task/repositories.py diff --git a/gram_core/services/task/services.py b/services/task/services.py similarity index 100% rename from gram_core/services/task/services.py rename to services/task/services.py diff --git a/gram_core/services/template/README.md b/services/template/README.md similarity index 100% rename from gram_core/services/template/README.md rename to services/template/README.md diff --git a/gram_core/services/template/__init__.py b/services/template/__init__.py similarity index 100% rename from gram_core/services/template/__init__.py rename to services/template/__init__.py diff --git a/gram_core/services/template/cache.py b/services/template/cache.py similarity index 100% rename from gram_core/services/template/cache.py rename to services/template/cache.py diff --git a/gram_core/services/template/error.py b/services/template/error.py similarity index 100% rename from gram_core/services/template/error.py rename to services/template/error.py diff --git a/gram_core/services/template/models.py b/services/template/models.py similarity index 100% rename from gram_core/services/template/models.py rename to services/template/models.py diff --git a/gram_core/services/template/services.py b/services/template/services.py similarity index 100% rename from gram_core/services/template/services.py rename to services/template/services.py diff --git a/gram_core/services/users/__init__.py b/services/users/__init__.py similarity index 100% rename from gram_core/services/users/__init__.py rename to services/users/__init__.py diff --git a/gram_core/services/users/cache.py b/services/users/cache.py similarity index 100% rename from gram_core/services/users/cache.py rename to services/users/cache.py diff --git a/gram_core/services/users/models.py b/services/users/models.py similarity index 100% rename from gram_core/services/users/models.py rename to services/users/models.py diff --git a/gram_core/services/users/repositories.py b/services/users/repositories.py similarity index 100% rename from gram_core/services/users/repositories.py rename to services/users/repositories.py diff --git a/gram_core/services/users/services.py b/services/users/services.py similarity index 100% rename from gram_core/services/users/services.py rename to services/users/services.py diff --git a/setup.py b/setup.py deleted file mode 100644 index 65cc592..0000000 --- a/setup.py +++ /dev/null @@ -1,34 +0,0 @@ -"""Run setuptools.""" - -from setuptools import find_packages, setup - -from gram_core.version import __version__ - - -def get_setup_kwargs(): - """Builds a dictionary of kwargs for the setup function""" - kwargs = dict( - script_name="setup.py", - name="gram_core", - version=__version__, - author="PaiGramTeam", - url="https://github.com/PaiGramTeam/GramCore", - keywords="telegram robot base core", - description="telegram robot base core.", - long_description=open("README.md", "r", encoding="utf-8").read(), - long_description_content_type="text/markdown", - packages=find_packages(exclude=["tests*"]), - install_requires=[], - include_package_data=True, - python_requires=">=3.8", - ) - - return kwargs - - -def main(): # skipcq: PY-D0003 - setup(**get_setup_kwargs()) - - -if __name__ == "__main__": - main() diff --git a/gram_core/sqlmodel/__init__.py b/sqlmodel/__init__.py similarity index 100% rename from gram_core/sqlmodel/__init__.py rename to sqlmodel/__init__.py diff --git a/gram_core/sqlmodel/session.py b/sqlmodel/session.py similarity index 100% rename from gram_core/sqlmodel/session.py rename to sqlmodel/session.py