Skip to content

Commit fe082ad

Browse files
authored
Merge pull request #1755 from EliahKagan/void
Don't return with operand when conceptually void
2 parents b8ee9be + 39e2dff commit fe082ad

File tree

7 files changed

+16
-15
lines changed

7 files changed

+16
-15
lines changed

git/cmd.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -528,13 +528,13 @@ def _terminate(self) -> None:
528528
try:
529529
if proc.poll() is not None:
530530
self.status = self._status_code_if_terminate or proc.poll()
531-
return None
531+
return
532532
except OSError as ex:
533533
log.info("Ignored error after process had died: %r", ex)
534534

535535
# It can be that nothing really exists anymore...
536536
if os is None or getattr(os, "kill", None) is None:
537-
return None
537+
return
538538

539539
# Try to kill it.
540540
try:

git/config.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,8 @@ def __setitem__(self, key: str, value: _T) -> None:
203203
def add(self, key: str, value: Any) -> None:
204204
if key not in self:
205205
super().__setitem__(key, [value])
206-
return None
206+
return
207+
207208
super().__getitem__(key).append(value)
208209

209210
def setall(self, key: str, values: List[_T]) -> None:
@@ -579,7 +580,7 @@ def read(self) -> None: # type: ignore[override]
579580
:raise IOError: If a file cannot be handled
580581
"""
581582
if self._is_initialized:
582-
return None
583+
return
583584
self._is_initialized = True
584585

585586
files_to_read: List[Union[PathLike, IO]] = [""]
@@ -697,7 +698,7 @@ def write(self) -> None:
697698
a file lock"""
698699
self._assure_writable("write")
699700
if not self._dirty:
700-
return None
701+
return
701702

702703
if isinstance(self._file_or_files, (list, tuple)):
703704
raise AssertionError(
@@ -711,7 +712,7 @@ def write(self) -> None:
711712
"Skipping write-back of configuration file as include files were merged in."
712713
+ "Set merge_includes=False to prevent this."
713714
)
714-
return None
715+
return
715716
# END stop if we have include files
716717

717718
fp = self._file_or_files

git/index/base.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def _set_cache_(self, attr: str) -> None:
166166
except OSError:
167167
# In new repositories, there may be no index, which means we are empty.
168168
self.entries: Dict[Tuple[PathLike, StageType], IndexEntry] = {}
169-
return None
169+
return
170170
# END exception handling
171171

172172
try:
@@ -1210,9 +1210,9 @@ def checkout(
12101210
def handle_stderr(proc: "Popen[bytes]", iter_checked_out_files: Iterable[PathLike]) -> None:
12111211
stderr_IO = proc.stderr
12121212
if not stderr_IO:
1213-
return None # Return early if stderr empty.
1214-
else:
1215-
stderr_bytes = stderr_IO.read()
1213+
return # Return early if stderr empty.
1214+
1215+
stderr_bytes = stderr_IO.read()
12161216
# line contents:
12171217
stderr = stderr_bytes.decode(defenc)
12181218
# git-checkout-index: this already exists

git/index/fun.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def run_commit_hook(name: str, index: "IndexFile", *args: str) -> None:
8383
"""
8484
hp = hook_path(name, index.repo.git_dir)
8585
if not os.access(hp, os.X_OK):
86-
return None
86+
return
8787

8888
env = os.environ.copy()
8989
env["GIT_INDEX_FILE"] = safe_decode(str(index.path))

git/objects/tree.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def git_cmp(t1: TreeCacheTup, t2: TreeCacheTup) -> int:
6868

6969
def merge_sort(a: List[TreeCacheTup], cmp: Callable[[TreeCacheTup, TreeCacheTup], int]) -> None:
7070
if len(a) < 2:
71-
return None
71+
return
7272

7373
mid = len(a) // 2
7474
lefthalf = a[:mid]

git/objects/util.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -500,8 +500,8 @@ def addToStack(
500500
depth: int,
501501
) -> None:
502502
lst = self._get_intermediate_items(item)
503-
if not lst: # empty list
504-
return None
503+
if not lst: # Empty list
504+
return
505505
if branch_first:
506506
stack.extendleft(TraverseNT(depth, i, src_item) for i in lst)
507507
else:

git/util.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ def _parse_progress_line(self, line: AnyStr) -> None:
644644
self.line_dropped(line_str)
645645
# Note: Don't add this line to the other lines, as we have to silently
646646
# drop it.
647-
return None
647+
return
648648
# END handle op code
649649

650650
# Figure out stage.

0 commit comments

Comments
 (0)