Add types to git/config.py by Yobmod · Pull Request #1234 · gitpython-developers/GitPython
Repository navigation
Add types to git/config.py - #1234
Merged
Byron merged 14 commits into gitpython-developers:main from Yobmod:addtypes May 13, 2021
Merged
Add types to git/config.py #1234 Byron merged 14 commits into gitpython-developers:main from Yobmod:addtypes
Conversation
Yobmod commented May 12, 2021 · edited Loading
Copy link Copy Markdown
Contributor
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)
Add types to config.py CONFIG_LEVELS, MetaParserBuilder.__new__() .ne...
efe6833
...eds_values() .set_dirty_and_flush_changes()
Add types to config.py class SectionConstraint
6e331a0
Add types to config.py class _OMD
e21d96a
Add types to config.py GitConfigParser .__init__() .aquire_lock()
efc2598
Add types to config.py GitConfigParser .release() ._read() ._has_incl...
94b7ece
...udes() ._included_paths() .__del__() .__exit__() .__enter__() ._optionform()
Add types to config.py GitConfigParser .read()
c6e458c
Add types to config.py GitConfigParser .write() ._write() .items() .i...
ab69b9a
...tems_all()
Add types to config.py GitConfigParser ._assure_writable .add_section...
c2f9f4e
... .read_only .get_value .get_values ._string_to_value ._value_to_string .add_value .rename_section
Add typing section to cmd.py
3473060
Add types to cmd.py Git
887f249
Add types to cmd.py AutoInterrupt
f1ace25
Add types to cmd.py CatFileContentStream
39eb0e6
Add types to cmd.py Git
f62c8d8
flake8 and mypy fixes
96c4365
Byron commented May 13, 2021
Copy link Copy Markdown
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 diff 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. |
96c4365
into
gitpython-developers : main
May 13, 2021
EliahKagan
mentioned this pull request
Dec 26, 2023
In handle_process_output don't forward finalizer result
#1788
Merged
Sign up for free
to join this conversation on GitHub .
Already have an account?
Sign in to comment