Title: Reuse of “exc” name in __init__.py confuses Pylint · Issue #1587 · gitpython-developers/GitPython · GitHub
Open Graph Title: Reuse of “exc” name in __init__.py confuses Pylint · Issue #1587 · gitpython-developers/GitPython
X Title: Reuse of “exc” name in __init__.py confuses Pylint · Issue #1587 · gitpython-developers/GitPython
Description: It’s not entirely clear how one is supposed to name GitPython’s exceptions: According to the API reference, they live in the git.exc module. In __init__.py, the very first line does from git.exp import *, meaning they can actually just b...
Open Graph Description: It’s not entirely clear how one is supposed to name GitPython’s exceptions: According to the API reference, they live in the git.exc module. In __init__.py, the very first line does from git.exp im...
X Description: It’s not entirely clear how one is supposed to name GitPython’s exceptions: According to the API reference, they live in the git.exc module. In __init__.py, the very first line does from git.exp im...
Opengraph URL: https://github.com/gitpython-developers/GitPython/issues/1587
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Reuse of “exc” name in __init__.py confuses Pylint","articleBody":"It’s not entirely clear how one is supposed to name GitPython’s exceptions:\r\n* According to [the API reference](https://gitpython.readthedocs.io/en/stable/reference.html#module-git.exc), they live in the `git.exc` module.\r\n* In `__init__.py`, the very first line does `from git.exp import *`, meaning they can actually just be referenced in the `git` module instead if one wishes (is that intentional/public knowledge?).\r\n\r\nThen, further down `__init__.py`, there are two places where `except Something as exc` is done in module-level code. While those won’t execute on success (and will prevent the module from importing on failure), they do confuse Pylint: if I try to `except git.exc.InvalidGitRepositoryError` in my own code and then lint it, Pylint complains that `Instance of 'GitError' has no 'InvalidGitRepositoryError' member`, because it believes the name `git.exc` itself might actually be an instance of `GitError` (as it would be if [this `except` clause](https://github.com/gitpython-developers/GitPython/blob/main/git/__init__.py#L59) were taken).\r\n\r\nIs it intended that we refer to exception classes from `git` rather than `git.exc`? If so, could the documentation be updated? If not—if we are not supposed to know about the `from git.exc import *`—could the variable names used in those `except` blocks be modified to not collide with a submodule name?","author":{"url":"https://github.com/Hawk777","@type":"Person","name":"Hawk777"},"datePublished":"2023-05-13T00:26:44.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/1587/GitPython/issues/1587"}
| 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:d0ead28f-c567-54fd-f1ca-6d93740fc83b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C18A:1D435A:ED3A2C:13CFF73:6968844F |
| html-safe-nonce | a04a67ac0046f67d2b7a4b9ee6229dcd62809cba5482bc0f53d4a67227a4fa4a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMThBOjFENDM1QTpFRDNBMkM6MTNDRkY3Mzo2OTY4ODQ0RiIsInZpc2l0b3JfaWQiOiIyOTgzODc4MTY2NjE0MTkwODciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 8f69f1f529216303560336f1e90f0edf8f74c8f814310bd58329ba5d12044579 |
| hovercard-subject-tag | issue:1708365741 |
| 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/1587/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e4b3f7e086a86a9658f1ff2a0c2fd3b4b07e86818cec78fdf9dc8f5ceac42c38/gitpython-developers/GitPython/issues/1587 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e4b3f7e086a86a9658f1ff2a0c2fd3b4b07e86818cec78fdf9dc8f5ceac42c38/gitpython-developers/GitPython/issues/1587 |
| og:image:alt | It’s not entirely clear how one is supposed to name GitPython’s exceptions: According to the API reference, they live in the git.exc module. In __init__.py, the very first line does from git.exp im... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Hawk777 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 50f46dc2d6192249fd8ebf20e76c800f4f2596d4a5f3ab63dd63a754df154f54 |
| 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 | fef287f17234b4529a4b112a3d47fe8551e32ddd |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width