From 8add4ddf2e3289900336ccba1b5b686f077b1e92 Mon Sep 17 00:00:00 2001 From: Illia Volochii Date: Sat, 9 Apr 2022 16:22:32 +0300 Subject: [PATCH] Specify the `None` return type where it is missed --- README.rst | 2 +- docs/introduction/di_in_python.rst | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.rst b/README.rst index f9be191d..e3b11e7a 100644 --- a/README.rst +++ b/README.rst @@ -100,7 +100,7 @@ Key features of the ``Dependency Injector``: @inject - def main(service: Service = Provide[Container.service]): + def main(service: Service = Provide[Container.service]) -> None: ... diff --git a/docs/introduction/di_in_python.rst b/docs/introduction/di_in_python.rst index e7076bc2..503caa67 100644 --- a/docs/introduction/di_in_python.rst +++ b/docs/introduction/di_in_python.rst @@ -66,14 +66,14 @@ Before: class ApiClient: - def __init__(self): + def __init__(self) -> None: self.api_key = os.getenv("API_KEY") # <-- dependency self.timeout = int(os.getenv("TIMEOUT")) # <-- dependency class Service: - def __init__(self): + def __init__(self) -> None: self.api_client = ApiClient() # <-- dependency @@ -94,18 +94,18 @@ After: class ApiClient: - def __init__(self, api_key: str, timeout: int): + def __init__(self, api_key: str, timeout: int) -> None: self.api_key = api_key # <-- dependency is injected self.timeout = timeout # <-- dependency is injected class Service: - def __init__(self, api_client: ApiClient): + def __init__(self, api_client: ApiClient) -> None: self.api_client = api_client # <-- dependency is injected - def main(service: Service): # <-- dependency is injected + def main(service: Service) -> None: # <-- dependency is injected ... @@ -182,7 +182,7 @@ the dependency. @inject - def main(service: Service = Provide[Container.service]): + def main(service: Service = Provide[Container.service]) -> None: ...