Title: RemoteProgress._parse_progress_line may merit a broader return type · Issue #1834 · gitpython-developers/GitPython · GitHub
Open Graph Title: RemoteProgress._parse_progress_line may merit a broader return type · Issue #1834 · gitpython-developers/GitPython
X Title: RemoteProgress._parse_progress_line may merit a broader return type · Issue #1834 · gitpython-developers/GitPython
Description: RemoteProgress._parse_progress_line is conceptually a "protected" method: code outside GitPython may subclass RemoteProgress and override it with another implementation (which may also reasonably call the base class implementation). The ...
Open Graph Description: RemoteProgress._parse_progress_line is conceptually a "protected" method: code outside GitPython may subclass RemoteProgress and override it with another implementation (which may also reasonably c...
X Description: RemoteProgress._parse_progress_line is conceptually a "protected" method: code outside GitPython may subclass RemoteProgress and override it with another implementation (which may also re...
Opengraph URL: https://github.com/gitpython-developers/GitPython/issues/1834
X: @github
Domain: redirect.github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"RemoteProgress._parse_progress_line may merit a broader return type","articleBody":"`RemoteProgress._parse_progress_line` is conceptually a \"protected\" method: code outside GitPython may subclass `RemoteProgress` and override it with another implementation (which may also reasonably call the base class implementation).\r\n\r\nThe method is [conceptually void](https://github.com/gitpython-developers/GitPython/pull/1755) as implemented in the base class, always implicitly returning `None`, and it is annotated accordingly:\r\n\r\nhttps://github.com/gitpython-developers/GitPython/blob/afa575454f85b34800460881cc9c3cd7fe78c8e3/git/util.py#L582\r\n\r\nHowever, while it would not ordinarily be useful to do so, it is--or *has* been--also intended that it be overridable to return a non-`None` value. This is mostly for compatibility with existing code that may have done so in the past, but it may be that reasonable cases for doing so in new code can still arise. This is reflected in code of GitPython:\r\n\r\nhttps://github.com/gitpython-developers/GitPython/blob/afa575454f85b34800460881cc9c3cd7fe78c8e3/git/util.py#L685-L697\r\n\r\nAnd in the subclass of `RemoteProgress` introduced in the test suite, which overrides the method:\r\n\r\nhttps://github.com/gitpython-developers/GitPython/blob/afa575454f85b34800460881cc9c3cd7fe78c8e3/test/test_remote.py#L54-L59\r\n\r\nBut any override that returns a non-`None` value is currently inconsistent with the return type annotation on the base class, which is written as `-\u003e None`. For Liskov substitutability, an overridden method's return type must be the same or a subclass of the base method's return type, and if a subclass has type annotations, and the return type is specified as a non-`Any` type, type checkers such as `mypy` and `pyright` will report a non-`None` return type as a violation.\r\n\r\nIf possible, the return type in `RemoteProgress` should be broadened, but in a way that does not unduly encourage subclasses to return non-`None`. **See comments on #1788, starting at https://github.com/gitpython-developers/GitPython/pull/1788#issuecomment-1869653326, for a discussion and analysis of this.** This issue, and the above recommendation, is based on the findings and discussion there.","author":{"url":"https://github.com/EliahKagan","@type":"Person","name":"EliahKagan"},"datePublished":"2024-02-20T23:39:26.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/1834/GitPython/issues/1834"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:52550a9c-8836-bfe8-925f-943d37d8ed57 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D7F0:18F725:4F04503:6B4CDA7:69731F91 |
| html-safe-nonce | 1f99723ae0accd8a70398e9c7cd4606eabe4e463122fab48051578c97e3fab95 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEN0YwOjE4RjcyNTo0RjA0NTAzOjZCNENEQTc6Njk3MzFGOTEiLCJ2aXNpdG9yX2lkIjoiMjYxNDY3NTUyOTIwOTY4Mzg1NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 17cd6ead8684ee283d257cdcd88af18c5a6f17fff49f249d4e7e12f23375d247 |
| hovercard-subject-tag | issue:2145472326 |
| github-keyboard-shortcuts | repository,issues,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/_view_fragments/issues/show/gitpython-developers/GitPython/1834/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ebe71f5c0fd7d6cf00eb60eabc259a9b0298fc33d878e810dbf5aad15c2bdec6/gitpython-developers/GitPython/issues/1834 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ebe71f5c0fd7d6cf00eb60eabc259a9b0298fc33d878e810dbf5aad15c2bdec6/gitpython-developers/GitPython/issues/1834 |
| og:image:alt | RemoteProgress._parse_progress_line is conceptually a "protected" method: code outside GitPython may subclass RemoteProgress and override it with another implementation (which may also reasonably c... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | EliahKagan |
| hostname | github.com |
| expected-hostname | github.com |
| None | 44ab3188c1dcfe3be0f9c3feca2e04e14fb79f120939ce2395e4f15ab96ec1d4 |
| 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 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | a5e2b48bd1260476599758f5d253b5d24092ab84 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width