Title: Refactor Git.{AutoInterrupt,CatFileContentStream} nesting by EliahKagan · Pull Request #2037 · gitpython-developers/GitPython · GitHub
Open Graph Title: Refactor Git.{AutoInterrupt,CatFileContentStream} nesting by EliahKagan · Pull Request #2037 · gitpython-developers/GitPython
X Title: Refactor Git.{AutoInterrupt,CatFileContentStream} nesting by EliahKagan · Pull Request #2037 · gitpython-developers/GitPython
Description: This makes Git.AutoInterrupt and Git.CatFileContentStream transparent aliases to top-level nonpublic _AutoInterrupt and _CatFileContentStream classes in the cmd module. This does not change the "public" interface. It also does not change metadata relevant to documentation: the __name__ and __qualname__ attributes are set explicitly to the values they had before when these classes were defined nested, so that Sphinx continues to document them (and to do so in full) in Git and as Git.AutoInterrupt and Git.CatFileContentStream. The purpose of this is to increase readability. The Git class is big and complex, with a number of long members and various forms of nesting. Since these two classes can be understood even without reading the code of the Git class, moving the definitions out of the Git class into top-level nonpublic classes will hopefully increase readability and help with maintenance. I originally intended this as just the first commit of several. But I realized that change is probably the only one that might be controversial. So I figured I'd open a PR for it by itself. In my view: The flatter layout and physical separation makes for easier reading and emphasizes that, even as they are nested classes of the Git class as far as the interface is concerned, these classes are uses by the Git and do not themselves use the Git class. The conceptual burden of setting __name__ and __qualname__ to make Sphinx continue working as desired (while still having the metadata at runtime the same as Sphinx claims) is not too big of a conceptual burden. But whether this is better is a subjective question, so I figured it would be good to get a review. I have verified that the intended effect in Sphinx documentation--the effect that the classes continue to be presented, in full, as nested classes of Git, just as they may (and should!) continue to be used when they are accessed both within GitPython and by other code that uses GitPython--is what we get. Specifically: I observed this locally, and It can be seen in the readthedocs cloud build for this PR, for Git.AutoInterrupt and Git.CatFileContentStream. (They can be compared to the latest release versions of the Git.AutoInterrupt and Git.CatFileContentStream classes.)
Open Graph Description: This makes Git.AutoInterrupt and Git.CatFileContentStream transparent aliases to top-level nonpublic _AutoInterrupt and _CatFileContentStream classes in the cmd module. This does not change the &qu...
X Description: This makes Git.AutoInterrupt and Git.CatFileContentStream transparent aliases to top-level nonpublic _AutoInterrupt and _CatFileContentStream classes in the cmd module. This does not change the &am...
Opengraph URL: https://github.com/gitpython-developers/GitPython/pull/2037
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:ead7e441-d368-2d75-a4e5-c019158d56bd |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | C08C:28FA53:373C0CE:37F2141:696856B5 |
| html-safe-nonce | 20957e19c391a352ec0df64c60337081e105e09d48d5fba817c7f9fe56c0d8c7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMDhDOjI4RkE1MzozNzNDMENFOjM3RjIxNDE6Njk2ODU2QjUiLCJ2aXNpdG9yX2lkIjoiNjYzODgzMTA3NTQ3MzI0OTk3MyIsInJlZ2lvbl9lZGdlIjoic2VhIiwicmVnaW9uX3JlbmRlciI6InNlYSJ9 |
| visitor-hmac | 9058782bee48b6f423da69d3b7eedd297514c00bd7af41798ca20c20ac5471d7 |
| hovercard-subject-tag | pull_request:2575057082 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/2037/files |
| twitter:image | https://avatars.githubusercontent.com/u/1771172?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/1771172?s=400&v=4 |
| og:image:alt | This makes Git.AutoInterrupt and Git.CatFileContentStream transparent aliases to top-level nonpublic _AutoInterrupt and _CatFileContentStream classes in the cmd module. This does not change the &qu... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | f16c57f41ed243e5b4dfe9b9bcd6828bd83080b1b6dbb4ff239bbe9745f12e0c |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | cfa7062cc6d4fe8fcb156bd33f4c97bd3b2470af |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width