Skip to content

Commit

Permalink
删除无用代码
Browse files Browse the repository at this point in the history
  • Loading branch information
ssttkkl committed Nov 16, 2023
1 parent 8f4c909 commit 98f129a
Show file tree
Hide file tree
Showing 23 changed files with 98 additions and 550 deletions.
7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "nonebot-plugin-access-control-api"
version = "1.1.0"
version = "1.1.1"
description = ""
authors = ["ssttkkl <[email protected]>"]
license = "MIT"
Expand All @@ -11,9 +11,8 @@ packages = [
]

[tool.poetry.dependencies]
python = "^3.9"
python = "^3.8"
nonebot2 = "^2.1.0"
nonebot-plugin-session = "^0.2.0"
ssttkkl-nonebot-utils = ">=0.1.17"

[tool.poetry.group.dev.dependencies]
Expand Down Expand Up @@ -54,7 +53,7 @@ select = ["E", "W", "F", "UP", "C", "T", "PYI", "PT", "Q"]
ignore = ["C901", "E402", "F403", "T201"]

line-length = 160
target-version = "py39"
target-version = "py38"

[tool.ruff.flake8-pytest-style]
fixture-parentheses = false
Expand Down
9 changes: 7 additions & 2 deletions src/nonebot_plugin_access_control_api/service/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
from . import _dummy # noqa
from .methods import get_nonebot_service, create_plugin_service, get_plugin_service, get_service_by_qualified_name
from .methods import (
get_nonebot_service,
create_plugin_service,
get_plugin_service,
get_service_by_qualified_name,
)
from .nonebot_service import NoneBotService
from .plugin_service import PluginService
from .service import Service
Expand All @@ -13,5 +18,5 @@
"Service",
"NoneBotService",
"PluginService",
"SubService"
"SubService",
)
12 changes: 9 additions & 3 deletions src/nonebot_plugin_access_control_api/service/_dummy/factory.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
from nonebot_plugin_access_control_api.context import context
from nonebot_plugin_access_control_api.service.interface import IService
from nonebot_plugin_access_control_api.service.interface.factory import IServiceComponentFactory
from nonebot_plugin_access_control_api.service.interface.factory import (
IServiceComponentFactory,
)
from nonebot_plugin_access_control_api.service.interface.patcher import IServicePatcher
from nonebot_plugin_access_control_api.service.interface.permission import IServicePermission
from nonebot_plugin_access_control_api.service.interface.rate_limit import IServiceRateLimit
from nonebot_plugin_access_control_api.service.interface.permission import (
IServicePermission,
)
from nonebot_plugin_access_control_api.service.interface.rate_limit import (
IServiceRateLimit,
)

from .patcher import ServicePatcherImpl
from .permission import ServicePermissionImpl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,20 @@ def on_remove_permission(self, func: Optional[T_Listener] = None):
)

async def get_permission_by_subject(
self, *subject: str, trace: bool = True
self, *subject: str, trace: bool = True
) -> Optional[Permission]:
return
yield None # noqa

async def get_permissions(
self, *, trace: bool = True
self, *, trace: bool = True
) -> AsyncGenerator[Permission, None]:
return
yield None # noqa

@classmethod
async def get_all_permissions_by_subject(
cls, *subject: str
cls, *subject: str
) -> AsyncGenerator[Permission, None]:
return
yield None # noqa
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,20 @@ def on_remove_rate_limit_rule(self, func: Optional[T_Listener] = None):
)

async def get_rate_limit_rules_by_subject(
self, *subject: str, trace: bool = True
self, *subject: str, trace: bool = True
) -> AsyncGenerator[RateLimitRule, None]:
return
yield None # noqa

async def get_rate_limit_rules(
self, *, trace: bool = True
self, *, trace: bool = True
) -> AsyncGenerator[RateLimitRule, None]:
return
yield None # noqa

@classmethod
async def get_all_rate_limit_rules_by_subject(
cls, *subject: str
cls, *subject: str
) -> AsyncGenerator[RateLimitRule, None]:
return
yield None # noqa
Expand All @@ -62,7 +62,7 @@ async def get_all_rate_limit_rules(cls) -> AsyncGenerator[RateLimitRule, None]:
yield None # noqa

async def add_rate_limit_rule(
self, subject: str, time_span: timedelta, limit: int, overwrite: bool = False
self, subject: str, time_span: timedelta, limit: int, overwrite: bool = False
) -> RateLimitRule:
raise NotImplementedError()

Expand All @@ -71,7 +71,7 @@ async def remove_rate_limit_rule(cls, rule_id: str) -> bool:
raise NotImplementedError()

async def acquire_token_for_rate_limit_by_subjects_receiving_result(
self, *subject: str
self, *subject: str
) -> AcquireTokenResult:
return AcquireTokenResult(success=True, token=RateLimitTokenImpl())

Expand Down
186 changes: 0 additions & 186 deletions src/nonebot_plugin_access_control_api/service/delegate.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,10 @@
from .subservice import ISubService
from .subservice_owner import ISubServiceOwner

__all__ = ("IService", "INoneBotService", "IPluginService", "ISubService", "ISubServiceOwner")
__all__ = (
"IService",
"INoneBotService",
"IPluginService",
"ISubService",
"ISubServiceOwner",
)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from abc import ABC, abstractmethod
from typing import Any, Callable, Optional
from collections.abc import Awaitable, AsyncGenerator
from typing import Optional
from collections.abc import AsyncGenerator

from ...event_bus import T_Listener
from ...models.permission import Permission
Expand All @@ -21,20 +21,20 @@ def on_remove_permission(self, func: Optional[T_Listener] = None):

@abstractmethod
async def get_permission_by_subject(
self, *subject: str, trace: bool = True
self, *subject: str, trace: bool = True
) -> Optional[Permission]:
raise NotImplementedError()

@abstractmethod
def get_permissions(
self, *, trace: bool = True
self, *, trace: bool = True
) -> AsyncGenerator[Permission, None]:
raise NotImplementedError()

@classmethod
@abstractmethod
def get_all_permissions_by_subject(
cls, *subject: str
cls, *subject: str
) -> AsyncGenerator[Permission, None]:
raise NotImplementedError()

Expand Down
Loading

0 comments on commit 98f129a

Please sign in to comment.