Enable flake8-annotations linting rules (#267)

See https://docs.astral.sh/ruff/rules/#flake8-annotations-ann.
This commit is contained in:
Marc Wrobel
2023-12-30 10:38:17 +01:00
parent 0e8fe135e4
commit f49e3dff15
12 changed files with 51 additions and 47 deletions

View File

@@ -21,7 +21,7 @@ VERSIONS_PATH = os.environ.get("VERSIONS_PATH", "releases")
class AutoConfig:
def __init__(self, method: str, config: dict):
def __init__(self, method: str, config: dict) -> None:
self.method = method
self.url = config[method]
self.version_template = Template(config.get("template", DEFAULT_VERSION_TEMPLATE))
@@ -41,7 +41,7 @@ class AutoConfig:
class ProductFrontmatter:
def __init__(self, name: str):
def __init__(self, name: str) -> None:
self.name: str = name
self.path: str = f"{PRODUCTS_PATH}/{name}.md"
@@ -72,13 +72,13 @@ class ProductFrontmatter:
class Product:
def __init__(self, name: str):
def __init__(self, name: str) -> None:
self.name: str = name
self.versions_path: str = f"{VERSIONS_PATH}/{name}.json"
self.versions = {}
@staticmethod
def from_file(name: str):
def from_file(name: str) -> "Product":
product = Product(name)
if not os.path.isfile(product.versions_path):
@@ -137,7 +137,7 @@ class Product:
return f"<{self.name}>"
def list_products(method, products_filter=None) -> list[str]:
def list_products(method: str, products_filter: str = None) -> list[str]:
"""Return a list of products that are using the same given update method.
"""
products = []