GeezerVison is showing github.com — Improve order of imports and __all__ in git.refs submodules · gitpython-developers/GitPython@8b51af3
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: git/refs/head.py +6-6Lines changed: 6 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 6 | 6 | Note the distinction between the :class:`HEAD` and :class:`Head` classes. | 7 | 7 | """ | 8 | 8 |
| | 9 | +__all__ = ["HEAD", "Head"] | | 10 | + | 9 | 11 | from git.config import GitConfigParser, SectionConstraint | 10 | | -from git.util import join_path | 11 | 12 | from git.exc import GitCommandError | | 13 | +from git.util import join_path | 12 | 14 |
| 13 | | -from .symbolic import SymbolicReference | 14 | 15 | from .reference import Reference | | 16 | +from .symbolic import SymbolicReference | 15 | 17 |
| 16 | 18 | # typing --------------------------------------------------- | 17 | 19 |
| | 26 | 28 |
| 27 | 29 | # ------------------------------------------------------------------- | 28 | 30 |
| 29 | | -__all__ = ["HEAD", "Head"] | 30 | | - | 31 | 31 |
| 32 | 32 | def strip_quotes(string: str) -> str: | 33 | 33 | if string.startswith('"') and string.endswith('"'): | @@ -36,8 +36,8 @@ def strip_quotes(string: str) -> str: | 36 | 36 |
| 37 | 37 |
| 38 | 38 | class HEAD(SymbolicReference): | 39 | | - """Special case of a SymbolicReference representing the repository's HEAD | 40 | | - reference.""" | | 39 | + """Special case of a :class:`~git.refs.symbolic.SymbolicReference` representing the | | 40 | + repository's HEAD reference.""" | 41 | 41 |
| 42 | 42 | _HEAD_NAME = "HEAD" | 43 | 43 | _ORIG_HEAD_NAME = "ORIG_HEAD" | |
Collapse file Copy file name to clipboardExpand all lines: git/refs/log.py +8-9Lines changed: 8 additions & 9 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | # This module is part of GitPython and is released under the | 2 | 2 | # 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/ | 3 | 3 |
| | 4 | +__all__ = ["RefLog", "RefLogEntry"] | | 5 | + | 4 | 6 | from mmap import mmap | | 7 | +import os.path as osp | 5 | 8 | import re | 6 | 9 | import time as _time | 7 | 10 |
| 8 | 11 | from git.compat import defenc | 9 | 12 | from git.objects.util import ( | 10 | | - parse_date, | 11 | 13 | Serializable, | 12 | 14 | altz_to_utctz_str, | | 15 | + parse_date, | 13 | 16 | ) | 14 | 17 | from git.util import ( | 15 | 18 | Actor, | 16 | 19 | LockedFD, | 17 | 20 | LockFile, | 18 | 21 | assure_directory_exists, | 19 | | - to_native_path, | 20 | 22 | bin_to_hex, | 21 | 23 | file_contents_ro_filepath, | | 24 | + to_native_path, | 22 | 25 | ) | 23 | 26 |
| 24 | | -import os.path as osp | 25 | | - | 26 | | - | 27 | 27 | # typing ------------------------------------------------------------------ | 28 | 28 |
| 29 | | -from typing import Iterator, List, Tuple, Union, TYPE_CHECKING | | 29 | +from typing import Iterator, List, Tuple, TYPE_CHECKING, Union | 30 | 30 |
| 31 | 31 | from git.types import PathLike | 32 | 32 |
| 33 | 33 | if TYPE_CHECKING: | 34 | 34 | from io import BytesIO | 35 | | - from git.refs import SymbolicReference | | 35 | + | 36 | 36 | from git.config import GitConfigParser, SectionConstraint | | 37 | + from git.refs import SymbolicReference | 37 | 38 |
| 38 | 39 | # ------------------------------------------------------------------------------ | 39 | 40 |
| 40 | | -__all__ = ["RefLog", "RefLogEntry"] | 41 | | - | 42 | 41 |
| 43 | 42 | class RefLogEntry(Tuple[str, str, Actor, Tuple[int, int], str]): | 44 | 43 | """Named tuple allowing easy access to the revlog data fields.""" | |
Collapse file Copy file name to clipboardExpand all lines: git/refs/reference.py +5-4Lines changed: 5 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | # This module is part of GitPython and is released under the | 2 | 2 | # 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/ | 3 | 3 |
| | 4 | +__all__ = ["Reference"] | | 5 | + | 4 | 6 | from git.util import IterableObj, LazyMixin | | 7 | + | 5 | 8 | from .symbolic import SymbolicReference, T_References | 6 | 9 |
| 7 | 10 | # typing ------------------------------------------------------------------ | | 15 | 18 |
| 16 | 19 | # ------------------------------------------------------------------------------ | 17 | 20 |
| 18 | | -__all__ = ["Reference"] | 19 | | - | 20 | 21 | # { Utilities | 21 | 22 |
| 22 | 23 |
| @@ -34,7 +35,7 @@ def wrapper(self: T_References, *args: Any) -> _T: | 34 | 35 | return wrapper | 35 | 36 |
| 36 | 37 |
| 37 | | -# }END utilities | | 38 | +# } END utilities | 38 | 39 |
| 39 | 40 |
| 40 | 41 | class Reference(SymbolicReference, LazyMixin, IterableObj): | @@ -142,7 +143,7 @@ def iter_items( | 142 | 143 | but will return non-detached references as well.""" | 143 | 144 | return cls._iter_items(repo, common_path) | 144 | 145 |
| 145 | | - # }END interface | | 146 | + # } END interface | 146 | 147 |
| 147 | 148 | # { Remote Interface | 148 | 149 |
| |
Collapse file Copy file name to clipboardExpand all lines: git/refs/remote.py +5-6Lines changed: 5 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 3 | 3 |
| 4 | 4 | """Module implementing a remote object allowing easy access to git remotes.""" | 5 | 5 |
| | 6 | +__all__ = ["RemoteReference"] | | 7 | + | 6 | 8 | import os | 7 | 9 |
| 8 | 10 | from git.util import join_path | 9 | 11 |
| 10 | 12 | from .head import Head | 11 | 13 |
| 12 | | - | 13 | | -__all__ = ["RemoteReference"] | 14 | | - | 15 | 14 | # typing ------------------------------------------------------------------ | 16 | 15 |
| 17 | | -from typing import Any, Iterator, NoReturn, Union, TYPE_CHECKING | 18 | | -from git.types import PathLike | | 16 | +from typing import Any, Iterator, NoReturn, TYPE_CHECKING, Union | 19 | 17 |
| | 18 | +from git.types import PathLike | 20 | 19 |
| 21 | 20 | if TYPE_CHECKING: | | 21 | + from git.remote import Remote | 22 | 22 | from git.repo import Repo | 23 | | - from git import Remote | 24 | 23 |
| 25 | 24 | # ------------------------------------------------------------------------------ | 26 | 25 |
| |
Collapse file Copy file name to clipboardExpand all lines: git/refs/symbolic.py +6-5Lines changed: 6 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | # This module is part of GitPython and is released under the | 2 | 2 | # 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/ | 3 | 3 |
| | 4 | +__all__ = ["SymbolicReference"] | | 5 | + | 4 | 6 | import os | 5 | 7 |
| | 8 | +from gitdb.exc import BadName, BadObject | | 9 | + | 6 | 10 | from git.compat import defenc | 7 | | -from git.objects import Object | | 11 | +from git.objects.base import Object | 8 | 12 | from git.objects.commit import Commit | 9 | 13 | from git.refs.log import RefLog | 10 | 14 | from git.util import ( | | 15 | 19 | join_path_native, | 16 | 20 | to_native_path_linux, | 17 | 21 | ) | 18 | | -from gitdb.exc import BadName, BadObject | 19 | 22 |
| 20 | 23 | # typing ------------------------------------------------------------------ | 21 | 24 |
| | 30 | 33 | Union, | 31 | 34 | cast, | 32 | 35 | ) | | 36 | + | 33 | 37 | from git.types import AnyGitObject, PathLike | 34 | 38 |
| 35 | 39 | if TYPE_CHECKING: | | 45 | 49 | # ------------------------------------------------------------------------------ | 46 | 50 |
| 47 | 51 |
| 48 | | -__all__ = ["SymbolicReference"] | 49 | | - | 50 | | - | 51 | 52 | def _git_dir(repo: "Repo", path: Union[PathLike, None]) -> PathLike: | 52 | 53 | """Find the git dir that is appropriate for the path.""" | 53 | 54 | name = f"{path}" | |
Collapse file Copy file name to clipboardExpand all lines: git/refs/tag.py +3-5Lines changed: 3 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 8 | 8 | :mod:`git.objects.tag` module. | 9 | 9 | """ | 10 | 10 |
| 11 | | -from .reference import Reference | 12 | | - | 13 | 11 | __all__ = ["TagReference", "Tag"] | 14 | 12 |
| | 13 | +from .reference import Reference | | 14 | + | 15 | 15 | # typing ------------------------------------------------------------------ | 16 | 16 |
| 17 | 17 | from typing import Any, TYPE_CHECKING, Type, Union | 18 | 18 |
| 19 | 19 | from git.types import AnyGitObject, PathLike | 20 | 20 |
| 21 | 21 | if TYPE_CHECKING: | 22 | | - from git.objects import Commit | 23 | | - from git.objects import TagObject | | 22 | + from git.objects import Commit, TagObject | 24 | 23 | from git.refs import SymbolicReference | 25 | 24 | from git.repo import Repo | 26 | 25 |
| 27 | | - | 28 | 26 | # ------------------------------------------------------------------------------ | 29 | 27 |
| 30 | 28 |
| |
|