Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add types to git/config.py#1234

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Byron merged 14 commits intogitpython-developers:mainfromYobmod:addtypes
May 13, 2021
Merged

Add types to git/config.py#1234

Byron merged 14 commits intogitpython-developers:mainfromYobmod:addtypes
May 13, 2021

Conversation

Yobmod
Copy link
Contributor

@YobmodYobmod commentedMay 12, 2021
edited
Loading

Adding types to config.py and cmd.py
Functions annotated all listed in commit titles.

I had to use a few casts in this one, due to the use of hassattr to distinguish strings from file objects.
If anyone knows a better way, let me know. (Its an open issue on mypy, and Guido recomends rewriting and doing type checks - a job for the future!)python/mypy#1424 (comment)

Some minor logic changes, all for type checks (e.g. because str is a subtype of Sequence, have to check for it before other sequences) or to try to separate strings from bytes.

All check pass and mypy happy. I also ran some basic scripts against it, and no errors.

Might be worth cutting a release after this PR, in case an errors are hiding?
(No rush, I only submitted this one so fast as it was waiting in my fork already)

Byron reacted with rocket emoji
Yobmod added14 commitsMay 8, 2021 20:28
…udes() ._included_paths() .__del__() .__exit__() .__enter__() ._optionform()
… .read_only .get_value .get_values ._string_to_value ._value_to_string .add_value .rename_section
@Byron
Copy link
Member

Thanks for the additional explanation - it definitely helps. My workflow is to checkout the PR and try the types locally, possibly changing some types to see what mypy thinks about that just to realize that the types presented here are the one (or only) way to make it happy.

In the very first file fo the diffsafe_decode also can be called with None which is strange to see, but currently required due to call sites not properly checking what they try to decode. Very interesting, and a lot of potential for future improvements.

Maybe I can also direct your attention to#1235 in case there is a chance it might be related to typing.

In any case, I will cut a release momentarily.

And last but not least: Thank you for all the work you put into GitPython types! They should help making the codebase more maintainable.

@ByronByron merged commit96c4365 intogitpython-developers:mainMay 13, 2021
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@Yobmod@Byron

[8]ページ先頭

©2009-2025 Movatter.jp