Skip to content

Commit 2d0158c

Browse files
committed
apply ruff-format
1 parent 517f83a commit 2d0158c

File tree

8 files changed

+52
-84
lines changed

8 files changed

+52
-84
lines changed

‎git/cmd.py‎

Lines changed: 29 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -495,9 +495,8 @@ def refresh(cls, path: Union[None, PathLike] = None) -> bool:
495495
ifmodeinquiet:
496496
pass
497497
elifmodeinwarnormodeinerror:
498-
err= (
499-
dedent(
500-
"""\
498+
err=dedent(
499+
"""\
501500
%s
502501
All git commands will error until this is rectified.
503502
@@ -510,40 +509,35 @@ def refresh(cls, path: Union[None, PathLike] = None) -> bool:
510509
Example:
511510
export %s=%s
512511
"""
513-
)
514-
% (
515-
err,
516-
cls._refresh_env_var,
517-
"|".join(quiet),
518-
"|".join(warn),
519-
"|".join(error),
520-
cls._refresh_env_var,
521-
quiet[0],
522-
)
512+
) % (
513+
err,
514+
cls._refresh_env_var,
515+
"|".join(quiet),
516+
"|".join(warn),
517+
"|".join(error),
518+
cls._refresh_env_var,
519+
quiet[0],
523520
)
524521

525522
ifmodeinwarn:
526523
_logger.critical(err)
527524
else:
528525
raiseImportError(err)
529526
else:
530-
err= (
531-
dedent(
532-
"""\
527+
err=dedent(
528+
"""\
533529
%s environment variable has been set but it has been set with an invalid value.
534530
535531
Use only the following values:
536532
- %s: for no message or exception
537533
- %s: for a warning message (logging level CRITICAL, displayed by default)
538534
- %s: for a raised exception
539535
"""
540-
)
541-
% (
542-
cls._refresh_env_var,
543-
"|".join(quiet),
544-
"|".join(warn),
545-
"|".join(error),
546-
)
536+
) % (
537+
cls._refresh_env_var,
538+
"|".join(quiet),
539+
"|".join(warn),
540+
"|".join(error),
547541
)
548542
raiseImportError(err)
549543

@@ -565,13 +559,11 @@ def is_cygwin(cls) -> bool:
565559

566560
@overload
567561
@classmethod
568-
defpolish_url(cls, url: str, is_cygwin: Literal[False] = ...) ->str:
569-
...
562+
defpolish_url(cls, url: str, is_cygwin: Literal[False] = ...) ->str: ...
570563

571564
@overload
572565
@classmethod
573-
defpolish_url(cls, url: str, is_cygwin: Union[None, bool] =None) ->str:
574-
...
566+
defpolish_url(cls, url: str, is_cygwin: Union[None, bool] =None) ->str: ...
575567

576568
@classmethod
577569
defpolish_url(cls, url: str, is_cygwin: Union[None, bool] =None) ->PathLike:
@@ -932,8 +924,7 @@ def execute(
932924
command: Union[str, Sequence[Any]],
933925
*,
934926
as_process: Literal[True],
935-
) ->"AutoInterrupt":
936-
...
927+
) ->"AutoInterrupt": ...
937928

938929
@overload
939930
defexecute(
@@ -942,8 +933,7 @@ def execute(
942933
*,
943934
as_process: Literal[False] =False,
944935
stdout_as_string: Literal[True],
945-
) ->Union[str, Tuple[int, str, str]]:
946-
...
936+
) ->Union[str, Tuple[int, str, str]]: ...
947937

948938
@overload
949939
defexecute(
@@ -952,8 +942,7 @@ def execute(
952942
*,
953943
as_process: Literal[False] =False,
954944
stdout_as_string: Literal[False] =False,
955-
) ->Union[bytes, Tuple[int, bytes, str]]:
956-
...
945+
) ->Union[bytes, Tuple[int, bytes, str]]: ...
957946

958947
@overload
959948
defexecute(
@@ -963,8 +952,7 @@ def execute(
963952
with_extended_output: Literal[False],
964953
as_process: Literal[False],
965954
stdout_as_string: Literal[True],
966-
) ->str:
967-
...
955+
) ->str: ...
968956

969957
@overload
970958
defexecute(
@@ -974,8 +962,7 @@ def execute(
974962
with_extended_output: Literal[False],
975963
as_process: Literal[False],
976964
stdout_as_string: Literal[False],
977-
) ->bytes:
978-
...
965+
) ->bytes: ...
979966

980967
defexecute(
981968
self,
@@ -1387,8 +1374,9 @@ def __call__(self, **kwargs: Any) -> "Git":
13871374
returnself
13881375

13891376
@overload
1390-
def_call_process(self, method: str, *args: None, **kwargs: None) ->str:
1391-
... # If no args were given, execute the call with all defaults.
1377+
def_call_process(
1378+
self, method: str, *args: None, **kwargs: None
1379+
) ->str: ... # If no args were given, execute the call with all defaults.
13921380

13931381
@overload
13941382
def_call_process(
@@ -1398,14 +1386,12 @@ def _call_process(
13981386
as_process: Literal[True],
13991387
*args: Any,
14001388
**kwargs: Any,
1401-
) ->"Git.AutoInterrupt":
1402-
...
1389+
) ->"Git.AutoInterrupt": ...
14031390

14041391
@overload
14051392
def_call_process(
14061393
self, method: str, *args: Any, **kwargs: Any
1407-
) ->Union[str, bytes, Tuple[int, Union[str, bytes], str], "Git.AutoInterrupt"]:
1408-
...
1394+
) ->Union[str, bytes, Tuple[int, Union[str, bytes], str], "Git.AutoInterrupt"]: ...
14091395

14101396
def_call_process(
14111397
self, method: str, *args: Any, **kwargs: Any

‎git/compat.py‎

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,11 @@
6969

7070

7171
@overload
72-
defsafe_decode(s: None) ->None:
73-
...
72+
defsafe_decode(s: None) ->None: ...
7473

7574

7675
@overload
77-
defsafe_decode(s: AnyStr) ->str:
78-
...
76+
defsafe_decode(s: AnyStr) ->str: ...
7977

8078

8179
defsafe_decode(s: Union[AnyStr, None]) ->Optional[str]:
@@ -91,13 +89,11 @@ def safe_decode(s: Union[AnyStr, None]) -> Optional[str]:
9189

9290

9391
@overload
94-
defsafe_encode(s: None) ->None:
95-
...
92+
defsafe_encode(s: None) ->None: ...
9693

9794

9895
@overload
99-
defsafe_encode(s: AnyStr) ->bytes:
100-
...
96+
defsafe_encode(s: AnyStr) ->bytes: ...
10197

10298

10399
defsafe_encode(s: Optional[AnyStr]) ->Optional[bytes]:
@@ -113,13 +109,11 @@ def safe_encode(s: Optional[AnyStr]) -> Optional[bytes]:
113109

114110

115111
@overload
116-
defwin_encode(s: None) ->None:
117-
...
112+
defwin_encode(s: None) ->None: ...
118113

119114

120115
@overload
121-
defwin_encode(s: AnyStr) ->bytes:
122-
...
116+
defwin_encode(s: AnyStr) ->bytes: ...
123117

124118

125119
defwin_encode(s: Optional[AnyStr]) ->Optional[bytes]:

‎git/index/fun.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,9 +286,9 @@ def read_cache(
286286
# 4 bytes length of chunk
287287
# Repeated 0 - N times
288288
extension_data=stream.read(~0)
289-
assert (
290-
len(extension_data)>19
291-
), "Index Footer was not at least a sha on content as it was only %i bytes in size"%len(extension_data)
289+
assertlen(extension_data) >19, (
290+
"Index Footer was not at least a sha on content as it was only %i bytes in size"%len(extension_data)
291+
)
292292

293293
content_sha=extension_data[-20:]
294294

‎git/objects/fun.py‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,11 @@ def _find_by_name(tree_data: MutableSequence[EntryTupOrNone], name: str, is_dir:
152152

153153

154154
@overload
155-
def_to_full_path(item: None, path_prefix: str) ->None:
156-
...
155+
def_to_full_path(item: None, path_prefix: str) ->None: ...
157156

158157

159158
@overload
160-
def_to_full_path(item: EntryTup, path_prefix: str) ->EntryTup:
161-
...
159+
def_to_full_path(item: EntryTup, path_prefix: str) ->EntryTup: ...
162160

163161

164162
def_to_full_path(item: EntryTupOrNone, path_prefix: str) ->EntryTupOrNone:

‎git/objects/tree.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ class Tree(IndexObject, git_diff.Diffable, util.Traversable, util.Serializable):
188188
_map_id_to_type: Dict[int, Type[IndexObjUnion]] ={
189189
commit_id: Submodule,
190190
blob_id: Blob,
191-
symlink_id: Blob
191+
symlink_id: Blob,
192192
# Tree ID added once Tree is defined.
193193
}
194194

‎git/objects/util.py‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -620,8 +620,7 @@ def list_traverse(self: T_TIobj, *args: Any, **kwargs: Any) -> IterableList[T_TI
620620
returnsuper()._list_traverse(*args, **kwargs)
621621

622622
@overload# type: ignore
623-
deftraverse(self: T_TIobj) ->Iterator[T_TIobj]:
624-
...
623+
deftraverse(self: T_TIobj) ->Iterator[T_TIobj]: ...
625624

626625
@overload
627626
deftraverse(
@@ -633,8 +632,7 @@ def traverse(
633632
visit_once: bool,
634633
ignore_self: Literal[True],
635634
as_edge: Literal[False],
636-
) ->Iterator[T_TIobj]:
637-
...
635+
) ->Iterator[T_TIobj]: ...
638636

639637
@overload
640638
deftraverse(
@@ -646,8 +644,7 @@ def traverse(
646644
visit_once: bool,
647645
ignore_self: Literal[False],
648646
as_edge: Literal[True],
649-
) ->Iterator[Tuple[Union[T_TIobj, None], T_TIobj]]:
650-
...
647+
) ->Iterator[Tuple[Union[T_TIobj, None], T_TIobj]]: ...
651648

652649
@overload
653650
deftraverse(
@@ -659,8 +656,7 @@ def traverse(
659656
visit_once: bool,
660657
ignore_self: Literal[True],
661658
as_edge: Literal[True],
662-
) ->Iterator[Tuple[T_TIobj, T_TIobj]]:
663-
...
659+
) ->Iterator[Tuple[T_TIobj, T_TIobj]]: ...
664660

665661
deftraverse(
666662
self: T_TIobj,

‎git/remote.py‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,22 +93,19 @@ def add_progress(
9393

9494

9595
@overload
96-
defto_progress_instance(progress: None) ->RemoteProgress:
97-
...
96+
defto_progress_instance(progress: None) ->RemoteProgress: ...
9897

9998

10099
@overload
101-
defto_progress_instance(progress: Callable[..., Any]) ->CallableRemoteProgress:
102-
...
100+
defto_progress_instance(progress: Callable[..., Any]) ->CallableRemoteProgress: ...
103101

104102

105103
@overload
106-
defto_progress_instance(progress: RemoteProgress) ->RemoteProgress:
107-
...
104+
defto_progress_instance(progress: RemoteProgress) ->RemoteProgress: ...
108105

109106

110107
defto_progress_instance(
111-
progress: Union[Callable[..., Any], RemoteProgress, None]
108+
progress: Union[Callable[..., Any], RemoteProgress, None],
112109
) ->Union[RemoteProgress, CallableRemoteProgress]:
113110
"""Given the `progress` return a suitable object derived from
114111
:class:`~git.util.RemoteProgress`."""

‎git/util.py‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -441,13 +441,11 @@ def decygpath(path: PathLike) -> str:
441441

442442

443443
@overload
444-
defis_cygwin_git(git_executable: None) ->Literal[False]:
445-
...
444+
defis_cygwin_git(git_executable: None) ->Literal[False]: ...
446445

447446

448447
@overload
449-
defis_cygwin_git(git_executable: PathLike) ->bool:
450-
...
448+
defis_cygwin_git(git_executable: PathLike) ->bool: ...
451449

452450

453451
defis_cygwin_git(git_executable: Union[None, PathLike]) ->bool:
@@ -494,8 +492,7 @@ def finalize_process(proc: Union[subprocess.Popen, "Git.AutoInterrupt"], **kwarg
494492

495493

496494
@overload
497-
defexpand_path(p: None, expand_vars: bool= ...) ->None:
498-
...
495+
defexpand_path(p: None, expand_vars: bool= ...) ->None: ...
499496

500497

501498
@overload

0 commit comments

Comments
(0)