Skip to content

Add initial types to base and fun #1191

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 13 commits into from
Closed

Add initial types to base and fun #1191

wants to merge 13 commits into from

Conversation

Yobmod
Copy link
Contributor

@Yobmod Yobmod commented Mar 4, 2021

Hi,
this add types to repo/base.py and repo/fun.py.

  • All annotations are consistant according to both mypy and pyright.
  • I've used an alias for Any type (TBD, 'to be determined') to show places where I was unsure of the type, but i'm sure it should be more specific than Any
  • i've avoided changing any runtime code as much as possible, except:
    • i've used Union[str, os._pathlike] to annotate path arguments. Where this showed errors due to use of string-only methods, i've then wrapped the arg in str() within the function. This should mean they are all compatible with pathlib.Paths and pathlib.Purepaths, but that will require tests writing before its official.
    • Adding typeguards eg. where git_dir is initialised as None, then assigned later Type checking showed places that needed to be checked that it was actually a string and not None.
    • changed Except OSError, IOError to just OSError, as typechecking says it was redundant for python 3.

@Yobmod Yobmod closed this Mar 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant