Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Reuse of “exc” name in __init__.py confuses Pylint #1587

Closed
@Hawk777

Description

@Hawk777

It’s not entirely clear how one is supposed to name GitPython’s exceptions:

  • According tothe API reference, they live in thegit.exc module.
  • In__init__.py, the very first line doesfrom git.exp import *, meaning they can actually just be referenced in thegit module instead if one wishes (is that intentional/public knowledge?).

Then, further down__init__.py, there are two places whereexcept 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 toexcept git.exc.InvalidGitRepositoryError in my own code and then lint it, Pylint complains thatInstance of 'GitError' has no 'InvalidGitRepositoryError' member, because it believes the namegit.exc itself might actually be an instance ofGitError (as it would be ifthisexcept clause were taken).

Is it intended that we refer to exception classes fromgit rather thangit.exc? If so, could the documentation be updated? If not—if we are not supposed to know about thefrom git.exc import *—could the variable names used in thoseexcept blocks be modified to not collide with a submodule name?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp