From 98efc2bda70d959bf92d7bbcaa88cdac5c68fb76 Mon Sep 17 00:00:00 2001 From: Kirill Klenov Date: Wed, 31 Jul 2024 17:02:39 +0300 Subject: [PATCH] feat: py39 --- muffin/app.py | 4 ++-- muffin/handler.py | 6 +++--- muffin/manage.py | 4 ++-- muffin/utils.py | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/muffin/app.py b/muffin/app.py index 886f5fa..b0fdd1d 100644 --- a/muffin/app.py +++ b/muffin/app.py @@ -5,7 +5,7 @@ from contextvars import ContextVar from inspect import isawaitable, stack from logging.config import dictConfig -from typing import TYPE_CHECKING, Any, Dict, Final, Mapping, Union +from typing import TYPE_CHECKING, Any, Final, Mapping, Union from asgi_tools import App as BaseApp from asgi_tools._compat import aio_wait @@ -57,7 +57,7 @@ def __init__(self, *cfg_mods: Union[str, ModuleType], **options): :param **options: Configuration options """ - self.plugins: Dict[str, BasePlugin] = {} + self.plugins: dict[str, BasePlugin] = {} # Setup the configuration self.cfg = Config(**self.defaults, config_config={"update_from_env": False}) diff --git a/muffin/handler.py b/muffin/handler.py index 07b2c4d..75d3e45 100644 --- a/muffin/handler.py +++ b/muffin/handler.py @@ -3,7 +3,7 @@ from __future__ import annotations import inspect -from typing import TYPE_CHECKING, Any, Awaitable, Callable, Dict, Optional, Tuple, Type, cast +from typing import TYPE_CHECKING, Any, Awaitable, Callable, Optional, cast from asgi_tools.utils import is_awaitable from asgi_tools.view import HTTP_METHODS, HTTPView @@ -20,9 +20,9 @@ class HandlerMeta(type): """Prepare handlers.""" - def __new__(mcs: Type[HandlerMeta], name: str, bases: Tuple[type], params: Dict[str, Any]): + def __new__(mcs: type[HandlerMeta], name: str, bases: tuple[type], params: dict[str, Any]): """Prepare a Handler Class.""" - cls = cast(Type["Handler"], super().__new__(mcs, name, bases, params)) + cls = cast(type["Handler"], super().__new__(mcs, name, bases, params)) # Ensure that the class methods are exist and iterable if not cls.methods: diff --git a/muffin/manage.py b/muffin/manage.py index 9a768d9..8b21f5d 100644 --- a/muffin/manage.py +++ b/muffin/manage.py @@ -9,7 +9,7 @@ from contextlib import AsyncExitStack, suppress from importlib import metadata from pathlib import Path -from typing import TYPE_CHECKING, AsyncContextManager, Callable, Dict, Optional, overload +from typing import TYPE_CHECKING, AsyncContextManager, Callable, Optional, overload from muffin.constants import CONFIG_ENV_VARIABLE from muffin.errors import AsyncRequiredError @@ -70,7 +70,7 @@ def __init__(self, app: "Application"): ) self.subparsers = self.parser.add_subparsers(dest="subparser") - self.commands: Dict[str, Callable] = {} + self.commands: dict[str, Callable] = {} self.shell( getattr( diff --git a/muffin/utils.py b/muffin/utils.py index b36ff01..c44abfe 100644 --- a/muffin/utils.py +++ b/muffin/utils.py @@ -11,7 +11,7 @@ from collections import OrderedDict from contextlib import suppress from logging import getLogger -from typing import TYPE_CHECKING, Callable, Coroutine, Dict, Iterable, TypeVar +from typing import TYPE_CHECKING, Callable, Coroutine, Iterable, TypeVar from asgi_tools.utils import is_awaitable, to_awaitable from sniffio import current_async_library @@ -35,7 +35,7 @@ AIOLIB = threading.local() AIOLIB.current = None -AIOLIBS: Dict[str, ModuleType] = OrderedDict() +AIOLIBS: dict[str, ModuleType] = OrderedDict() with suppress(ImportError): import curio @@ -78,7 +78,7 @@ def aio_run(corofn: Callable[..., Coroutine[None, None, TV]], *args, **kwargs) - def import_submodules( package_name: str, *module_names: str, silent: bool = False, exclude: Iterable[str] = () -) -> Dict[str, ModuleType]: +) -> dict[str, ModuleType]: """Import all submodules by the given package name.""" package = sys.modules[package_name] res = {}