Skip to content

Commit 1c9bda2

Browse files
committed
Improve relative order of import groups, and __all__, in git.index
1 parent 4badc19 commit 1c9bda2

File tree

4 files changed

+23
-33
lines changed

4 files changed

+23
-33
lines changed

Diff for: git/index/base.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
import sys
2020
import tempfile
2121

22+
from gitdb.base import IStream
23+
from gitdb.db import MemoryDB
24+
2225
from git.compat import defenc, force_bytes
2326
import git.diff as git_diff
2427
from git.exc import CheckoutError, GitCommandError, GitError, InvalidGitRepositoryError
@@ -33,8 +36,6 @@
3336
unbare_repo,
3437
to_bin_sha,
3538
)
36-
from gitdb.base import IStream
37-
from gitdb.db import MemoryDB
3839

3940
from .fun import (
4041
S_IFGITLINK,

Diff for: git/index/fun.py

+16-25
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,28 @@
44
"""Standalone functions to accompany the index implementation and make it more
55
versatile."""
66

7+
__all__ = (
8+
"write_cache",
9+
"read_cache",
10+
"write_tree_from_cache",
11+
"entry_key",
12+
"stat_mode_to_index_mode",
13+
"S_IFGITLINK",
14+
"run_commit_hook",
15+
"hook_path",
16+
)
17+
718
from io import BytesIO
819
import os
920
import os.path as osp
1021
from pathlib import Path
11-
from stat import (
12-
S_IFDIR,
13-
S_IFLNK,
14-
S_ISLNK,
15-
S_ISDIR,
16-
S_IFMT,
17-
S_IFREG,
18-
S_IXUSR,
19-
)
22+
from stat import S_IFDIR, S_IFLNK, S_IFMT, S_IFREG, S_ISDIR, S_ISLNK, S_IXUSR
2023
import subprocess
2124
import sys
2225

26+
from gitdb.base import IStream
27+
from gitdb.typ import str_tree_type
28+
2329
from git.cmd import handle_process_output, safer_popen
2430
from git.compat import defenc, force_bytes, force_text, safe_decode
2531
from git.exc import HookExecutionError, UnmergedEntriesError
@@ -29,8 +35,6 @@
2935
tree_to_stream,
3036
)
3137
from git.util import IndexFileSHA1Writer, finalize_process
32-
from gitdb.base import IStream
33-
from gitdb.typ import str_tree_type
3438

3539
from .typ import BaseIndexEntry, IndexEntry, CE_NAMEMASK, CE_STAGESHIFT
3640
from .util import pack, unpack
@@ -42,31 +46,18 @@
4246
from git.types import PathLike
4347

4448
if TYPE_CHECKING:
45-
from .base import IndexFile
4649
from git.db import GitCmdObjectDB
4750
from git.objects.tree import TreeCacheTup
4851

49-
# from git.objects.fun import EntryTupOrNone
52+
from .base import IndexFile
5053

5154
# ------------------------------------------------------------------------------------
5255

53-
5456
S_IFGITLINK = S_IFLNK | S_IFDIR
5557
"""Flags for a submodule."""
5658

5759
CE_NAMEMASK_INV = ~CE_NAMEMASK
5860

59-
__all__ = (
60-
"write_cache",
61-
"read_cache",
62-
"write_tree_from_cache",
63-
"entry_key",
64-
"stat_mode_to_index_mode",
65-
"S_IFGITLINK",
66-
"run_commit_hook",
67-
"hook_path",
68-
)
69-
7061

7162
def hook_path(name: str, git_dir: PathLike) -> str:
7263
""":return: path to the given named hook in the given git repository directory"""

Diff for: git/index/typ.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
from binascii import b2a_hex
99
from pathlib import Path
1010

11-
from .util import pack, unpack
1211
from git.objects import Blob
1312

13+
from .util import pack, unpack
14+
1415
# typing ----------------------------------------------------------------------
1516

1617
from typing import NamedTuple, Sequence, TYPE_CHECKING, Tuple, Union, cast

Diff for: git/index/util.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
"""Index utilities."""
55

6+
__all__ = ("TemporaryFileSwap", "post_clear_cache", "default_index", "git_working_dir")
7+
68
import contextlib
79
from functools import wraps
810
import os
@@ -22,14 +24,9 @@
2224

2325
# ---------------------------------------------------------------------------------
2426

25-
26-
__all__ = ("TemporaryFileSwap", "post_clear_cache", "default_index", "git_working_dir")
27-
2827
# { Aliases
2928
pack = struct.pack
3029
unpack = struct.unpack
31-
32-
3330
# } END aliases
3431

3532

0 commit comments

Comments
 (0)