Title: Add initial types to repo/fun.py by Yobmod · Pull Request #1192 · gitpython-developers/GitPython · GitHub
Open Graph Title: Add initial types to repo/fun.py by Yobmod · Pull Request #1192 · gitpython-developers/GitPython
X Title: Add initial types to repo/fun.py by Yobmod · Pull Request #1192 · gitpython-developers/GitPython
Description: Hi, This adds types to base.py and fun.py. All annotations are consistant according to both mypy and pyright (but will need refining once whole lib is typed). I've used an alias (TBD, 'to be determined') for Any 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: e.g. where git_dir is initialised as None, then assigned later to a string, mypy showed places that needed to be checked that it was actually a string and not still None. This could probably be improved by initializing as "" instead but it touched too much code. changed Except (OSError, IOError) to just Except OSError, as typechecking says it was redundant for python 3. Separate tuple unpacking to seperate lines to provide specific types (unpacked tuples cant be typed yet)
Open Graph Description: Hi, This adds types to base.py and fun.py. All annotations are consistant according to both mypy and pyright (but will need refining once whole lib is typed). I've used an alias (TBD, '...
X Description: Hi, This adds types to base.py and fun.py. All annotations are consistant according to both mypy and pyright (but will need refining once whole lib is typed). I've used an alias (TBD, &...
Opengraph URL: https://github.com/gitpython-developers/GitPython/pull/1192
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/checks(.:format) |
| route-controller | pull_requests |
| route-action | checks |
| fetch-nonce | v2:2928c3de-9843-617b-c514-97153e311b89 |
| current-catalog-service-hash | 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a |
| request-id | 8732:181900:C57E2D:10D4EB9:6969E91D |
| html-safe-nonce | d76a20023a0c201e92c2aef9bfee8be68c34a92287dfd5ed372b7c0eed883dfb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NzMyOjE4MTkwMDpDNTdFMkQ6MTBENEVCOTo2OTY5RTkxRCIsInZpc2l0b3JfaWQiOiI2NDE1NjA1NDExNTk4NjkwNTg5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 254515f29b7a94b5197ac65edc7e45d2ad557eebaa2340308ff6d52440e95375 |
| hovercard-subject-tag | pull_request:585035918 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,checks,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/gitpython-developers/GitPython/pull/1192/checks |
| twitter:image | https://avatars.githubusercontent.com/u/22235459?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/22235459?s=400&v=4 |
| og:image:alt | Hi, This adds types to base.py and fun.py. All annotations are consistant according to both mypy and pyright (but will need refining once whole lib is typed). I've used an alias (TBD, '... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7b32f1c7c4549428ee399213e8345494fc55b5637195d3fc5f493657579235e8 |
| turbo-cache-control | no-preview |
| go-import | github.com/gitpython-developers/GitPython git https://github.com/gitpython-developers/GitPython.git |
| octolytics-dimension-user_id | 503709 |
| octolytics-dimension-user_login | gitpython-developers |
| octolytics-dimension-repository_id | 1126087 |
| octolytics-dimension-repository_nwo | gitpython-developers/GitPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1126087 |
| octolytics-dimension-repository_network_root_nwo | gitpython-developers/GitPython |
| turbo-body-classes | logged-out env-production page-responsive full-width full-width-p-0 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | bdde15ad1b403e23b08bbd89b53fbe6bdf688cad |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width