Skip to content

Commit 3955534

Browse files
committed
sort imports with "ruff check --select I --fix"
1 parent 58d1271 commit 3955534

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+189
-154
lines changed

pygit2/__init__.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,29 @@
3030
import os
3131
import typing
3232

33-
# Low level API
34-
from ._pygit2 import *
35-
from ._pygit2 import _cache_enums
36-
3733
# High level API
3834
from . import enums
3935
from ._build import __version__
36+
37+
# Low level API
38+
from ._pygit2 import *
39+
from ._pygit2 import _cache_enums
4040
from .blame import Blame, BlameHunk
4141
from .blob import BlobIO
42-
from .callbacks import Payload, RemoteCallbacks, CheckoutCallbacks, StashApplyCallbacks
4342
from .callbacks import (
43+
CheckoutCallbacks,
44+
Payload,
45+
RemoteCallbacks,
46+
StashApplyCallbacks,
47+
get_credentials,
4448
git_clone_options,
4549
git_fetch_options,
4650
git_proxy_options,
47-
get_credentials,
4851
)
4952
from .config import Config
5053
from .credentials import *
51-
from .errors import check_error, Passthrough
52-
from .ffi import ffi, C
54+
from .errors import Passthrough, check_error
55+
from .ffi import C, ffi
5356
from .filter import Filter
5457
from .index import Index, IndexEntry
5558
from .legacyenums import *
@@ -60,7 +63,6 @@
6063
from .submodules import Submodule
6164
from .utils import to_bytes, to_str
6265

63-
6466
# Features
6567
features = enums.Feature(C.git_libgit2_features())
6668

pygit2/_libgit2/ffi.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
# the Free Software Foundation, 51 Franklin Street, Fifth Floor,
2424
# Boston, MA 02110-1301, USA.
2525

26-
from typing import Literal, overload, NewType, TypeVar, Generic, Any, SupportsIndex
27-
from typing import NewType, Literal, TypeVar, Generic, overload
26+
from typing import Any, Generic, Literal, NewType, SupportsIndex, TypeVar, overload
27+
2828
from pygit2._pygit2 import Repository
2929

3030
T = TypeVar('T')

pygit2/_pygit2.pyi

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,37 @@
1+
import tarfile
2+
from collections.abc import Generator
3+
from io import DEFAULT_BUFFER_SIZE, IOBase
4+
from pathlib import Path
5+
from queue import Queue
6+
from threading import Event
17
from typing import (
8+
Generic,
29
Iterator,
310
Literal,
411
Optional,
5-
overload,
612
Type,
713
TypedDict,
814
TypeVar,
9-
Generic,
15+
overload,
1016
)
11-
from io import IOBase, DEFAULT_BUFFER_SIZE
12-
from pathlib import Path
13-
from queue import Queue
14-
import tarfile
15-
from threading import Event
17+
1618
from . import Index
19+
from ._libgit2.ffi import (
20+
GitCommitC,
21+
GitObjectC,
22+
GitProxyOptionsC,
23+
GitRepositoryC,
24+
GitSignatureC,
25+
_Pointer,
26+
)
27+
from .blame import Blame
28+
from .callbacks import CheckoutCallbacks
1729
from .enums import (
18-
AttrCheck,
1930
ApplyLocation,
20-
BranchType,
21-
BlobFilter,
31+
AttrCheck,
2232
BlameFlag,
33+
BlobFilter,
34+
BranchType,
2335
CheckoutStrategy,
2436
DeltaStatus,
2537
DiffFind,
@@ -36,22 +48,9 @@ from .enums import (
3648
ResetMode,
3749
SortMode,
3850
)
39-
from collections.abc import Generator
40-
41-
from ._libgit2.ffi import (
42-
_Pointer,
43-
GitObjectC,
44-
GitCommitC,
45-
GitRepositoryC,
46-
GitProxyOptionsC,
47-
GitSignatureC,
48-
)
49-
50-
from .repository import BaseRepository
51-
from .submodules import SubmoduleCollection, Submodule
5251
from .remotes import Remote
53-
from .callbacks import CheckoutCallbacks
54-
from .blame import Blame
52+
from .repository import BaseRepository
53+
from .submodules import Submodule, SubmoduleCollection
5554

5655
GIT_OBJ_BLOB = Literal[3]
5756
GIT_OBJ_COMMIT = Literal[1]

pygit2/_run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929

3030
# Import from the Standard Library
3131
import codecs
32-
from pathlib import Path
3332
import sys
33+
from pathlib import Path
3434

3535
# Import from cffi
3636
from cffi import FFI # type: ignore

pygit2/blame.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,16 @@
2323
# the Free Software Foundation, 51 Franklin Street, Fifth Floor,
2424
# Boston, MA 02110-1301, USA.
2525

26-
from typing import Iterator, TYPE_CHECKING
26+
from typing import TYPE_CHECKING, Iterator
27+
28+
from ._pygit2 import Oid, Repository, Signature
2729

2830
# Import from pygit2
29-
from .ffi import ffi, C
31+
from .ffi import C, ffi
3032
from .utils import GenericIterator
31-
from ._pygit2 import Signature, Oid, Repository
3233

3334
if TYPE_CHECKING:
34-
from ._libgit2.ffi import GitSignatureC, GitHunkC, GitBlameC
35+
from ._libgit2.ffi import GitBlameC, GitHunkC, GitSignatureC
3536

3637

3738
def wrap_signature(csig: 'GitSignatureC') -> None | Signature:

pygit2/blob.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
import threading
33
import time
44
from contextlib import AbstractContextManager
5-
from typing import Optional
65
from queue import Queue
6+
from typing import Optional
77

88
from ._pygit2 import Blob, Oid
99
from .enums import BlobFilter

pygit2/branches.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@
2424
# Boston, MA 02110-1301, USA.
2525

2626
from __future__ import annotations
27+
2728
from typing import TYPE_CHECKING
2829

29-
from .enums import BranchType, ReferenceType
3030
from ._pygit2 import Commit, Oid
31+
from .enums import BranchType, ReferenceType
3132

3233
# Need BaseRepository for type hints, but don't let it cause a circular dependency
3334
if TYPE_CHECKING:

pygit2/callbacks.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,22 +65,23 @@
6565
# Standard Library
6666
from contextlib import contextmanager
6767
from functools import wraps
68-
from typing import Optional, Union, TYPE_CHECKING, Callable, Generator
68+
from typing import TYPE_CHECKING, Callable, Generator, Optional, Union
6969

7070
# pygit2
71-
from ._pygit2 import Oid, DiffFile
71+
from ._pygit2 import DiffFile, Oid
72+
from .credentials import Keypair, Username, UserPass
7273
from .enums import CheckoutNotify, CheckoutStrategy, CredentialType, StashApplyProgress
73-
from .errors import check_error, Passthrough
74-
from .ffi import ffi, C
75-
from .utils import maybe_string, to_bytes, ptr_to_bytes, StrArray
76-
from .credentials import Username, UserPass, Keypair
74+
from .errors import Passthrough, check_error
75+
from .ffi import C, ffi
76+
from .utils import StrArray, maybe_string, ptr_to_bytes, to_bytes
7777

7878
_Credentials = Username | UserPass | Keypair
7979

8080
if TYPE_CHECKING:
81-
from .remotes import TransferProgress
82-
from ._pygit2 import PushOptions, CloneOptions
8381
from pygit2._libgit2.ffi import GitProxyOptionsC
82+
83+
from ._pygit2 import CloneOptions, PushOptions
84+
from .remotes import TransferProgress
8485
#
8586
# The payload is the way to pass information from the pygit2 API, through
8687
# libgit2, to the Python callbacks. And back.

pygit2/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
# Import from pygit2
3232
from .errors import check_error
33-
from .ffi import ffi, C
33+
from .ffi import C, ffi
3434
from .utils import to_bytes
3535

3636

pygit2/credentials.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929

3030
from .enums import CredentialType
3131

32-
3332
if TYPE_CHECKING:
3433
from pathlib import Path
3534

0 commit comments

Comments
 (0)