Mentions légales du service

Skip to content

Type hints and consistent typing

  • Missing type hints:

Sometimes, there are type hints, e.g.,

 def authenticate(
        self,
        base_url: str = None,
        username: str = None,
        password: str = None,
        verify: bool = True,
    ) -> Tuple[str, Dict]:

It would help to better understand the code if more or better all defs have type annotations.

  • Inconsistent types
base_url: str = None

should be

base_url: Optional[str] = None
  • Variable switching the type
def lookup_folder(project_data, folder_path):
    folder_path = Path(folder_path)

Here, folder_path is passed as a str and then the type is switching to Path. I find these type switches make it sometimes hard to read and understand the code.

  • mypy as a quality gate: If there is consistent typing, one could add mypy coverage as a precommit quality gate.
Edited by Patrick Stöckle
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information