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

Overhaul noqa directives#1760

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Byron merged 3 commits intogitpython-developers:mainfromEliahKagan:noqa
Dec 9, 2023
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletionsgit/__init__.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,28 +3,27 @@
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

# flake8: noqa
# @PydevCodeAnalysisIgnore

from git.exc import * # @NoMove @IgnorePep8
from typing import List, Optional, Sequence, Tuple, Union, TYPE_CHECKING
from git.types import PathLike

__version__ = "git"

from typing import List, Optional, Sequence, Tuple, Union, TYPE_CHECKING

from gitdb.util import to_hex_sha
from git.exc import * # noqa: F403 # @NoMove @IgnorePep8
from git.types import PathLike

try:
from git.compat import safe_decode # @NoMove @IgnorePep8
from git.config import GitConfigParser # @NoMove @IgnorePep8
from git.objects import * # @NoMove @IgnorePep8
from git.refs import * # @NoMove @IgnorePep8
from git.diff import * # @NoMove @IgnorePep8
from git.db import * # @NoMove @IgnorePep8
from git.objects import * #noqa: F403 #@NoMove @IgnorePep8
from git.refs import * #noqa: F403 #@NoMove @IgnorePep8
from git.diff import * #noqa: F403 #@NoMove @IgnorePep8
from git.db import * #noqa: F403 #@NoMove @IgnorePep8
from git.cmd import Git # @NoMove @IgnorePep8
from git.repo import Repo # @NoMove @IgnorePep8
from git.remote import * # @NoMove @IgnorePep8
from git.index import * # @NoMove @IgnorePep8
from git.remote import * #noqa: F403 #@NoMove @IgnorePep8
from git.index import * #noqa: F403 #@NoMove @IgnorePep8
from git.util import ( # @NoMove @IgnorePep8
LockFile,
BlockingLockFile,
Expand All@@ -33,12 +32,12 @@
remove_password_if_present,
rmtree,
)
except GitError as _exc:
except GitError as _exc: # noqa: F405
raise ImportError("%s: %s" % (_exc.__class__.__name__, _exc)) from _exc

# __all__ must be statically defined by py.typed support
# __all__ = [name for name, obj in locals().items() if not (name.startswith("_") or inspect.ismodule(obj))]
__all__ = [
__all__ = [ # noqa: F405
"Actor",
"AmbiguousObjectName",
"BadName",
Expand DownExpand Up@@ -127,7 +126,7 @@ def refresh(path: Optional[PathLike] = None) -> None:

if not Git.refresh(path=path):
return
if not FetchInfo.refresh():
if not FetchInfo.refresh(): # noqa: F405
return # type: ignore [unreachable]

GIT_OK = True
Expand Down
2 changes: 1 addition & 1 deletiongit/cmd.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -965,7 +965,7 @@ def execute(
# Only search PATH, not CWD. This must be in the *caller* environment. The "1" can be any value.
maybe_patch_caller_env = patch_env("NoDefaultCurrentDirectoryInExePath", "1")
else:
cmd_not_found_exception = FileNotFoundError # NOQA # exists, flake8 unknown @UndefinedVariable
cmd_not_found_exception = FileNotFoundError
maybe_patch_caller_env = contextlib.nullcontext()
# END handle

Expand Down
9 changes: 2 additions & 7 deletionsgit/compat.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,20 +5,15 @@

"""Utilities to help provide compatibility with Python 3."""

# flake8: noqa

import locale
import os
import sys

from gitdb.utils.encoding import (
force_bytes, # @UnusedImport
force_text, # @UnusedImport
)
from gitdb.utils.encoding import force_bytes, force_text # noqa: F401 # @UnusedImport

# typing --------------------------------------------------------------------

from typing import (
from typing import ( # noqa: F401
Any,
AnyStr,
Dict,
Expand Down
6 changes: 2 additions & 4 deletionsgit/index/__init__.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,7 +3,5 @@

"""Initialize the index package."""

# flake8: noqa

from .baseimport*
from .typimport*
from .baseimport*# noqa: F401 F403
from .typimport*# noqa: F401 F403
20 changes: 9 additions & 11 deletionsgit/objects/__init__.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,23 +3,21 @@

"""Import all submodules' main classes into the package space."""

# flake8: noqa

importinspect

from .baseimport*
from .blobimport*
from .commitimport*
from .baseimport*# noqa: F403
from .blobimport*# noqa: F403
from .commitimport*# noqa: F403
from .submoduleimportutilassmutil
from .submodule.baseimport*
from .submodule.rootimport*
from .tagimport*
from .treeimport*
from .submodule.baseimport*# noqa: F403
from .submodule.rootimport*# noqa: F403
from .tagimport*# noqa: F403
from .treeimport*# noqa: F403

# Fix import dependency - add IndexObject to the util module, so that it can be
# imported by the submodule.base.
smutil.IndexObject=IndexObject# type: ignore[attr-defined]
smutil.Object=Object# type: ignore[attr-defined]
smutil.IndexObject=IndexObject# type: ignore[attr-defined] # noqa: F405
smutil.Object=Object# type: ignore[attr-defined] # noqa: F405
delsmutil

# Must come after submodule was made available.
Expand Down
14 changes: 7 additions & 7 deletionsgit/objects/submodule/base.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -958,7 +958,7 @@ def move(self, module_path: PathLike, configuration: bool = True, module: bool =
raise
# END handle undo rename

# Auto-rename submodule ifit's name was 'default', that is, the checkout directory.
# Auto-rename submodule ifits name was 'default', that is, the checkout directory.
ifprevious_sm_path==self.name:
self.rename(module_checkout_path)

Expand All@@ -976,19 +976,19 @@ def remove(
from the .gitmodules file and the entry in the .git/config file.
:param module: If True, the checked out module we point to will be deleted as
well.If that module is currently on a commit outside any branch in the
well.If that module is currently on a commit outside any branch in the
remote, or if it is ahead of its tracking branch, or if there are modified
or untracked files in its working tree, then the removal will fail.
In casethe removal of the repository fails for these reasons, the
submodule statuswill not have been altered.
or untracked files in its working tree, then the removal will fail. In case
the removal of the repository fails for these reasons, the submodule status
will not have been altered.
If this submodule has child modules of its own, these will be deleted prior
to touching the direct submodule.
:param force: Enforces the deletion of the module even though it contains
modifications. This basically enforces a brute-force file system based
deletion.
:param configuration: If True, the submodule is deleted from the configuration,
otherwise it isn't. Although this should be enabled most of the time,
thisflag enables you to safely delete the repository of your submodule.
otherwise it isn't. Although this should be enabled most of the time, this
flag enables you to safely delete the repository of your submodule.
:param dry_run: If True, we will not actually do anything, but throw the errors
we would usually throw.
:return: self
Expand Down
22 changes: 9 additions & 13 deletionsgit/objects/util.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,31 +5,27 @@

"""General utility functions."""

# flake8: noqa F401


fromabcimportABC,abstractmethod
importwarnings
fromgit.utilimportIterableList,IterableObj,Actor

importre
importcalendar
fromcollectionsimportdeque

fromdatetimeimportdatetime,timedelta,tzinfo
fromstringimportdigits
importre
importtime
importcalendar
fromdatetimeimportdatetime,timedelta,tzinfo
importwarnings

fromgit.utilimportIterableList,IterableObj,Actor

# typing ------------------------------------------------------------
fromtypingimport (
Any,
Callable,
Deque,
Iterator,
Generic,
#Generic,
NamedTuple,
overload,
Sequence,# NOQA: F401
Sequence,
TYPE_CHECKING,
Tuple,
Type,
Expand All@@ -38,7 +34,7 @@
cast,
)

fromgit.typesimportHas_id_attribute,Literal,_T# NOQA: F401
fromgit.typesimportHas_id_attribute,Literal# , _T

ifTYPE_CHECKING:
fromioimportBytesIO,StringIO
Expand Down
13 changes: 6 additions & 7 deletionsgit/refs/__init__.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

# flake8: noqa
# Import all modules in order, fix the names they require.

from .symbolic import *
from .reference import *
from .head import *
from .tag import *
from .remote import *
from .symbolic import * # noqa: F401 F403
from .reference import * # noqa: F401 F403
from .head import * # noqa: F401 F403
from .tag import * # noqa: F401 F403
from .remote import * # noqa: F401 F403

from .log import *
from .log import * # noqa: F401 F403
4 changes: 2 additions & 2 deletionsgit/refs/log.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,9 +31,9 @@
fromgit.typesimportPathLike

ifTYPE_CHECKING:
fromgit.refsimportSymbolicReference
fromioimportBytesIO
fromgit.configimportGitConfigParser,SectionConstraint# NOQA
fromgit.refsimportSymbolicReference
fromgit.configimportGitConfigParser,SectionConstraint

# ------------------------------------------------------------------------------

Expand Down
4 changes: 2 additions & 2 deletionsgit/refs/reference.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,8 +10,8 @@

# typing ------------------------------------------------------------------

from typing import Any, Callable, Iterator, Type, Union, TYPE_CHECKING # NOQA
from git.types import Commit_ish, PathLike, _T # NOQA
from typing import Any, Callable, Iterator, Type, Union, TYPE_CHECKING
from git.types import Commit_ish, PathLike, _T

if TYPE_CHECKING:
from git.repo import Repo
Expand Down
5 changes: 2 additions & 3 deletionsgit/refs/symbolic.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

fromgit.typesimportPathLike
importos

fromgit.compatimportdefenc
Expand DownExpand Up@@ -31,8 +30,8 @@
Union,
TYPE_CHECKING,
cast,
)# NOQA
fromgit.typesimportCommit_ish,PathLike# NOQA
)
fromgit.typesimportCommit_ish,PathLike

ifTYPE_CHECKING:
fromgit.repoimportRepo
Expand Down
4 changes: 1 addition & 3 deletionsgit/repo/__init__.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,6 +3,4 @@

"""Initialize the Repo package."""

# flake8: noqa

from .base import Repo as Repo
from .base import Repo as Repo # noqa: F401
14 changes: 6 additions & 8 deletionsgit/types.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

# flake8: noqa

importos
importsys
fromtypingimport (
fromtypingimport (# noqa: F401
Dict,
NoReturn,
SequenceasSequence,
Expand All@@ -16,24 +14,24 @@
Callable,
TYPE_CHECKING,
TypeVar,
)# noqa: F401
)

ifsys.version_info>= (3,8):
fromtypingimport (
fromtypingimport (# noqa: F401
Literal,
TypedDict,
Protocol,
SupportsIndexasSupportsIndex,
runtime_checkable,
)# noqa: F401
)
else:
fromtyping_extensionsimport (
fromtyping_extensionsimport (# noqa: F401
Literal,
SupportsIndexasSupportsIndex,
TypedDict,
Protocol,
runtime_checkable,
)# noqa: F401
)

# if sys.version_info >= (3, 10):
# from typing import TypeGuard # noqa: F401
Expand Down
8 changes: 4 additions & 4 deletionsgit/util.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -62,12 +62,9 @@
Has_id_attribute,
)

T_IterableObj = TypeVar("T_IterableObj", bound=Union["IterableObj", "Has_id_attribute"], covariant=True)
# So IterableList[Head] is subtype of IterableList[IterableObj]

# ---------------------------------------------------------------------

from gitdb.util import ( #NOQA @IgnorePep8
from gitdb.util import ( #noqa: F401 # @IgnorePep8
make_sha,
LockedFD, # @UnusedImport
file_contents_ro, # @UnusedImport
Expand All@@ -79,6 +76,9 @@
hex_to_bin, # @UnusedImport
)

T_IterableObj = TypeVar("T_IterableObj", bound=Union["IterableObj", "Has_id_attribute"], covariant=True)
# So IterableList[Head] is subtype of IterableList[IterableObj].

# NOTE: Some of the unused imports might be used/imported by others.
# Handle once test-cases are back up and running.
# Most of these are unused here, but are for use by git-python modules so these
Expand Down
4 changes: 2 additions & 2 deletionstest/lib/__init__.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,8 +3,8 @@
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

# flake8: noqa
importinspect
from .helperimport*

from .helperimport*# noqa: F401 F403

__all__= [nameforname,objinlocals().items()ifnot (name.startswith("_")orinspect.ismodule(obj))]
4 changes: 2 additions & 2 deletionstest/lib/helper.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -145,7 +145,7 @@ def repo_creator(self):
os.chdir(rw_repo.working_dir)
try:
return func(self, rw_repo)
except: # noqa E722
except: # noqa: E722 B001
log.info("Keeping repo after failure: %s", repo_dir)
repo_dir = None
raise
Expand DownExpand Up@@ -305,7 +305,7 @@ def remote_repo_creator(self):
with cwd(rw_repo.working_dir):
try:
return func(self, rw_repo, rw_daemon_repo)
except: # noqa E722
except: # noqa: E722 B001
log.info(
"Keeping repos after failure: \n rw_repo_dir: %s \n rw_daemon_repo_dir: %s",
rw_repo_dir,
Expand Down
2 changes: 1 addition & 1 deletiontest/test_commit.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -475,7 +475,7 @@ def test_datetimes(self):
commit.authored_datetime,
datetime(2009, 10, 8, 18, 17, 5, tzinfo=tzoffset(-7200)),
commit.authored_datetime,
) # noqa
)
self.assertEqual(
commit.authored_datetime,
datetime(2009, 10, 8, 16, 17, 5, tzinfo=utc),
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp