Fix typing issues in some other places

This commit is contained in:
Illia Volochii 2022-04-13 21:35:27 +03:00
parent 8add4ddf2e
commit b007d3483b
No known key found for this signature in database
GPG Key ID: 9BC2D949988CE605
3 changed files with 6 additions and 6 deletions

View File

@ -106,7 +106,7 @@ Key features of the ``Dependency Injector``:
@inject @inject
def main(service: Service = Provide[Container.service]): def main(service: Service = Provide[Container.service]) -> None:
... ...

View File

@ -3,18 +3,18 @@ import os
class ApiClient: 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.api_key = api_key # <-- dependency is injected
self.timeout = timeout # <-- dependency is injected self.timeout = timeout # <-- dependency is injected
class Service: class Service:
def __init__(self, api_client: ApiClient): def __init__(self, api_client: ApiClient) -> None:
self.api_client = api_client # <-- dependency is injected self.api_client = api_client # <-- dependency is injected
def main(service: Service): # <-- dependency is injected def main(service: Service) -> None: # <-- dependency is injected
... ...
@ -23,7 +23,7 @@ if __name__ == "__main__":
service=Service( service=Service(
api_client=ApiClient( api_client=ApiClient(
api_key=os.getenv("API_KEY"), api_key=os.getenv("API_KEY"),
timeout=os.getenv("TIMEOUT"), timeout=int(os.getenv("TIMEOUT")),
), ),
), ),
) )

View File

@ -23,7 +23,7 @@ class Container(containers.DeclarativeContainer):
@inject @inject
def main(service: Service = Provide[Container.service]): def main(service: Service = Provide[Container.service]) -> None:
... ...