refactor: add return type annotations to address, routing, and co2only methods

This commit adds return type annotations to the `address`, `routing`, and `co2only` methods in the `CarbonTracer` class. This helps improve code readability and provides better documentation by specifying the expected return types for these methods.
This commit is contained in:
Kumi 2023-08-23 10:17:44 +02:00
parent c5d9c6f946
commit 22a13889d2
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -47,7 +47,7 @@ class CarbonTracer:
return request.execute() return request.execute()
def address(self, postalCode: str, city: str, street: str): def address(self, postalCode: str, city: str, street: str) -> dict:
"""Request an (Austrian) address from a postal code, city and street. """Request an (Austrian) address from a postal code, city and street.
Args: Args:
@ -63,7 +63,7 @@ class CarbonTracer:
return request.execute() return request.execute()
def routing(self, type: str, start: str, dest: str, waypoints: bool = False, bbox: bool = False, airports: bool = False): def routing(self, type: str, start: str, dest: str, waypoints: bool = False, bbox: bool = False, airports: bool = False) -> dict:
"""Make a routing request. """Make a routing request.
Args: Args:
@ -98,7 +98,7 @@ class CarbonTracer:
return request.execute() return request.execute()
def co2only(self, type: str, distance_km: int): def co2only(self, type: str, distance_km: int) -> dict:
"""Only calculate the CO2 emissions for a given distance for a given transport type. """Only calculate the CO2 emissions for a given distance for a given transport type.
Args: Args: