mirror of
https://github.com/koloideal/Argenta.git
synced 2026-06-10 18:15:28 +03:00
ruff format
This commit is contained in:
@@ -3,7 +3,7 @@ __all__ = [
|
||||
"benchmark_many_routers",
|
||||
"benchmark_many_commands_per_router",
|
||||
"benchmark_many_aliases_per_command",
|
||||
"benchmark_extreme_routers"
|
||||
"benchmark_extreme_routers",
|
||||
]
|
||||
|
||||
from argenta import App
|
||||
@@ -14,14 +14,17 @@ from argenta.router import Router
|
||||
from .entity import benchmarks
|
||||
|
||||
|
||||
@benchmarks.register(type_="validate_routers_for_collisions", description="With few routers (3 routers, 1 command each)")
|
||||
@benchmarks.register(
|
||||
type_="validate_routers_for_collisions",
|
||||
description="With few routers (3 routers, 1 command each)",
|
||||
)
|
||||
def benchmark_few_routers() -> None:
|
||||
app = App(override_system_messages=True)
|
||||
|
||||
for i in range(3):
|
||||
router = Router()
|
||||
|
||||
@router.command(Command(f'cmd{i}'))
|
||||
@router.command(Command(f"cmd{i}"))
|
||||
def handler(_res: Response) -> None:
|
||||
pass
|
||||
|
||||
@@ -31,14 +34,17 @@ def benchmark_few_routers() -> None:
|
||||
app._validate_routers_for_collisions()
|
||||
|
||||
|
||||
@benchmarks.register(type_="validate_routers_for_collisions", description="With many routers (10 routers, 1 command each)")
|
||||
@benchmarks.register(
|
||||
type_="validate_routers_for_collisions",
|
||||
description="With many routers (10 routers, 1 command each)",
|
||||
)
|
||||
def benchmark_many_routers() -> None:
|
||||
app = App(override_system_messages=True)
|
||||
|
||||
for i in range(10):
|
||||
router = Router()
|
||||
|
||||
@router.command(Command(f'cmd{i}'))
|
||||
@router.command(Command(f"cmd{i}"))
|
||||
def handler(_res: Response) -> None:
|
||||
pass
|
||||
|
||||
@@ -48,7 +54,10 @@ def benchmark_many_routers() -> None:
|
||||
app._validate_routers_for_collisions()
|
||||
|
||||
|
||||
@benchmarks.register(type_="validate_routers_for_collisions", description="With many commands per router (3 routers, 10 commands each)")
|
||||
@benchmarks.register(
|
||||
type_="validate_routers_for_collisions",
|
||||
description="With many commands per router (3 routers, 10 commands each)",
|
||||
)
|
||||
def benchmark_many_commands_per_router() -> None:
|
||||
app = App(override_system_messages=True)
|
||||
|
||||
@@ -56,7 +65,8 @@ def benchmark_many_commands_per_router() -> None:
|
||||
router = Router()
|
||||
|
||||
for j in range(10):
|
||||
@router.command(Command(f'cmd{i}_{j}'))
|
||||
|
||||
@router.command(Command(f"cmd{i}_{j}"))
|
||||
def handler(_res: Response) -> None:
|
||||
pass
|
||||
|
||||
@@ -66,7 +76,10 @@ def benchmark_many_commands_per_router() -> None:
|
||||
app._validate_routers_for_collisions()
|
||||
|
||||
|
||||
@benchmarks.register(type_="validate_routers_for_collisions", description="With many aliases (3 routers, 5 commands, 10 aliases each)")
|
||||
@benchmarks.register(
|
||||
type_="validate_routers_for_collisions",
|
||||
description="With many aliases (3 routers, 5 commands, 10 aliases each)",
|
||||
)
|
||||
def benchmark_many_aliases_per_command() -> None:
|
||||
app = App(override_system_messages=True)
|
||||
|
||||
@@ -74,7 +87,10 @@ def benchmark_many_aliases_per_command() -> None:
|
||||
router = Router()
|
||||
|
||||
for j in range(5):
|
||||
@router.command(Command(f'cmd{i}_{j}', aliases={f'alias{i}_{j}_{k}' for k in range(10)}))
|
||||
|
||||
@router.command(
|
||||
Command(f"cmd{i}_{j}", aliases={f"alias{i}_{j}_{k}" for k in range(10)})
|
||||
)
|
||||
def handler(_res: Response) -> None:
|
||||
pass
|
||||
|
||||
@@ -84,7 +100,10 @@ def benchmark_many_aliases_per_command() -> None:
|
||||
app._validate_routers_for_collisions()
|
||||
|
||||
|
||||
@benchmarks.register(type_="validate_routers_for_collisions", description="Extreme (20 routers, 10 commands, 20 aliases each)")
|
||||
@benchmarks.register(
|
||||
type_="validate_routers_for_collisions",
|
||||
description="Extreme (20 routers, 10 commands, 20 aliases each)",
|
||||
)
|
||||
def benchmark_extreme_routers() -> None:
|
||||
app = App(override_system_messages=True)
|
||||
|
||||
@@ -92,7 +111,10 @@ def benchmark_extreme_routers() -> None:
|
||||
router = Router()
|
||||
|
||||
for j in range(10):
|
||||
@router.command(Command(f'cmd{i}_{j}', aliases={f'alias{i}_{j}_{k}' for k in range(20)}))
|
||||
|
||||
@router.command(
|
||||
Command(f"cmd{i}_{j}", aliases={f"alias{i}_{j}_{k}" for k in range(20)})
|
||||
)
|
||||
def handler(_res: Response) -> None:
|
||||
pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user