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