Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita5fc1d8

Browse files
committed
Improve consistency of "END" comments
In the git module (including modules it contains).This does not add any new "# end" or "# END" comments. Instead, itimproves the consistency and clarity of existing ones by convertingeach "# end" comment to "# END" (since capitalization was not usedsystematically to indicate nesting level or other semanticinformation, and capitalizing "END" makes clear the nature of thecomment), and by adding some information to a few of the comments.This also removes end comments that did not provide information orsignificant visual indication that a "section" was ending, or wherethe visual indication they provided was at least as well providedby replacing them with a blank line. However, it does *not* attemptto apply this change everywhere it might be applicable.
1 parent8d3efc5 commita5fc1d8

File tree

13 files changed

+64
-70
lines changed

13 files changed

+64
-70
lines changed

‎git/cmd.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ def execute(
979979
else:
980980
cmd_not_found_exception=FileNotFoundError# NOQA # exists, flake8 unknown @UndefinedVariable
981981
maybe_patch_caller_env=contextlib.nullcontext()
982-
#end handle
982+
#END handle
983983

984984
stdout_sink=PIPEifwith_stdoutelsegetattr(subprocess,"DEVNULL",None)oropen(os.devnull,"wb")
985985
ifshellisNone:
@@ -1048,7 +1048,7 @@ def kill_process(pid: int) -> None:
10481048
pass
10491049
return
10501050

1051-
#end
1051+
#END def kill_process
10521052

10531053
ifkill_after_timeoutisnotNone:
10541054
kill_check=threading.Event()
@@ -1100,7 +1100,7 @@ def kill_process(pid: int) -> None:
11001100
defas_text(stdout_value:Union[bytes,str])->str:
11011101
returnnotoutput_streamandsafe_decode(stdout_value)or"<OUTPUT_STREAM>"
11021102

1103-
#end
1103+
#END def as_text
11041104

11051105
ifstderr_value:
11061106
log.info(
@@ -1304,9 +1304,9 @@ def _call_process(
13041304
"Couldn't find argument '%s' in args %s to insert cmd options after"
13051305
% (insert_after_this_arg,str(ext_args))
13061306
)fromerr
1307-
#end handle error
1307+
#END handle error
13081308
args_list=ext_args[:index+1]+opt_args+ext_args[index+1 :]
1309-
#end handle opts_kwargs
1309+
#END handle opts_kwargs
13101310

13111311
call= [self.GIT_PYTHON_GIT_EXECUTABLE]
13121312

‎git/config.py

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -446,12 +446,11 @@ def _read(self, fp: Union[BufferedReader, IO[bytes]], fpname: str) -> None:
446446
defstring_decode(v:str)->str:
447447
ifv[-1]=="\\":
448448
v=v[:-1]
449-
#end cut trailing escapes to prevent decode error
449+
#END cut trailing escapes to prevent decode error
450450

451451
returnv.encode(defenc).decode("unicode_escape")
452-
# end
453452

454-
#end
453+
#END def string_decode
455454

456455
whileTrue:
457456
# We assume to read binary!
@@ -496,12 +495,12 @@ def string_decode(v: str) -> str:
496495
optval=optval.strip()
497496
ifoptval=='""':
498497
optval=""
499-
#end handle empty string
498+
#END handle empty string
500499
optname=self.optionxform(optname.rstrip())
501500
iflen(optval)>1andoptval[0]=='"'andoptval[-1]!='"':
502501
is_multi_line=True
503502
optval=string_decode(optval[1:])
504-
#end handle multi-line
503+
#END handle multi-line
505504
# Preserves multiple values for duplicate optnames.
506505
cursect.add(optname,optval)
507506
else:
@@ -516,7 +515,7 @@ def string_decode(v: str) -> str:
516515
ifline.endswith('"'):
517516
is_multi_line=False
518517
line=line[:-1]
519-
#end handle quotations
518+
#END handle quotations
520519
optval=cursect.getlast(optname)
521520
cursect.setlast(optname,optval+string_decode(line))
522521
# END parse section or option
@@ -600,7 +599,7 @@ def read(self) -> None: # type: ignore[override]
600599
files_to_read= [self._file_or_files]
601600
else:# for lists or tuples
602601
files_to_read=list(self._file_or_files)
603-
#end ensure we have a copy of the paths to handle
602+
#END ensure we have a copy of the paths to handle
604603

605604
seen=set(files_to_read)
606605
num_read_include_files=0
@@ -631,27 +630,26 @@ def read(self) -> None: # type: ignore[override]
631630
ifnotosp.isabs(include_path):
632631
ifnotfile_ok:
633632
continue
634-
#end ignore relative paths if we don't know the configuration file path
633+
#END ignore relative paths if we don't know the configuration file path
635634
file_path=cast(PathLike,file_path)
636635
assertosp.isabs(file_path),"Need absolute paths to be sure our cycle checks will work"
637636
include_path=osp.join(osp.dirname(file_path),include_path)
638-
#end make include path absolute
637+
#END make include path absolute
639638
include_path=osp.normpath(include_path)
640639
ifinclude_pathinseenornotos.access(include_path,os.R_OK):
641640
continue
642641
seen.add(include_path)
643642
# Insert included file to the top to be considered first.
644643
files_to_read.insert(0,include_path)
645644
num_read_include_files+=1
646-
# each include path in configuration file
647-
#end handle includes
645+
#ENDeach include path in configuration file
646+
#END handle includes
648647
# END for each file object to read
649648

650649
# If there was no file included, we can safely write back (potentially) the
651650
# configuration file without altering its meaning.
652651
ifnum_read_include_files==0:
653652
self._merge_includes=False
654-
# end
655653

656654
def_write(self,fp:IO)->None:
657655
"""Write an .ini-format representation of the configuration state in
@@ -714,15 +712,15 @@ def write(self) -> None:
714712
"Cannot write back if there is not exactly a single file to write to, have %i files"
715713
%len(self._file_or_files)
716714
)
717-
#end assert multiple files
715+
#END assert multiple files
718716

719717
ifself._has_includes():
720718
log.debug(
721719
"Skipping write-back of configuration file as include files were merged in."
722720
+"Set merge_includes=False to prevent this."
723721
)
724722
returnNone
725-
#end
723+
#END stop if we have include files
726724

727725
fp=self._file_or_files
728726

@@ -904,7 +902,7 @@ def rename_section(self, section: str, new_name: str) -> "GitConfigParser":
904902
new_section=self._sections[new_name]
905903
fork,vsinself.items_all(section):
906904
new_section.setall(k,vs)
907-
#end for each value to copy
905+
#END for each value to copy
908906

909907
# This call writes back the changes, which is why we don't have the respective decorator.
910908
self.remove_section(section)

‎git/diff.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ def __str__(self) -> str:
442442
msg+=self.diff.decode(defenc)ifisinstance(self.diff,bytes)elseself.diff
443443
exceptUnicodeDecodeError:
444444
msg+="OMITTED BINARY DATA"
445-
#end handle encoding
445+
#END handle encoding
446446
msg+="\n---"
447447
# END diff info
448448

@@ -543,7 +543,7 @@ def _index_from_patch_format(cls, repo: "Repo", proc: Union["Popen", "Git.AutoIn
543543
# and then retro-actively assign it to our index.
544544
ifprevious_headerisnotNone:
545545
index[-1].diff=text[previous_header.end() :_header.start()]
546-
#end assign actual diff
546+
#END assign actual diff
547547

548548
# Make sure the mode is set if the path is set. Otherwise the resulting blob is invalid.
549549
# We just use the one mode we should have parsed.
@@ -571,10 +571,10 @@ def _index_from_patch_format(cls, repo: "Repo", proc: Union["Popen", "Git.AutoIn
571571

572572
previous_header=_header
573573
header=_header
574-
#end for each header we parse
574+
#END for each header we parse
575575
ifindexandheader:
576576
index[-1].diff=text[header.end() :]
577-
#end assign last diff
577+
#END assign last diff
578578

579579
returnindex
580580

‎git/index/base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ def raise_exc(e: Exception) -> NoReturn:
406406
ifS_ISLNK(st.st_mode):
407407
yieldabs_path.replace(rs,"")
408408
continue
409-
#end check symlink
409+
#END check symlink
410410

411411
# If the path is not already pointing to an existing file, resolve globs if possible.
412412
ifnotos.path.exists(abs_path)and ("?"inabs_pathor"*"inabs_pathor"["inabs_path):
@@ -689,7 +689,7 @@ def _entries_for_paths(
689689
gitrelative_path=path
690690
ifself.repo.working_tree_dir:
691691
abspath=osp.join(self.repo.working_tree_dir,gitrelative_path)
692-
#end obtain relative and absolute paths
692+
#END obtain relative and absolute paths
693693

694694
blob=Blob(
695695
self.repo,
@@ -867,7 +867,7 @@ def handle_null_entries(self: "IndexFile") -> None:
867867
)
868868
# END for each entry index
869869

870-
#end closure
870+
#END closure
871871
handle_null_entries(self)
872872
# END null_entry handling
873873

‎git/index/fun.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def run_commit_hook(name: str, index: "IndexFile", *args: str) -> None:
123123
stdout=force_text(stdout,defenc)
124124
stderr=force_text(stderr,defenc)
125125
raiseHookExecutionError(hp,process.returncode,stderr,stdout)
126-
#end handle return code
126+
#END handle return code
127127

128128

129129
defstat_mode_to_index_mode(mode:int)->int:

‎git/objects/commit.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ def create_from_tree(
553553
forpinparent_commits:
554554
ifnotisinstance(p,cls):
555555
raiseValueError(f"Parent commit '{p!r}' must be of type{cls}")
556-
#end check parent commit types
556+
#END check parent commit types
557557
# END if parent commits are unset
558558

559559
# Retrieve all additional information, create a commit object, and serialize it.
@@ -730,7 +730,7 @@ def _deserialize(self, stream: BytesIO) -> "Commit":
730730
next_line=readline()
731731
whilenext_line.startswith(b" "):
732732
next_line=readline()
733-
#end skip mergetags
733+
#END skip mergetags
734734

735735
# Now we can have the encoding line, or an empty line followed by the optional message.
736736
self.encoding=self.default_encoding
@@ -754,7 +754,7 @@ def _deserialize(self, stream: BytesIO) -> "Commit":
754754
is_next_header=True
755755
break
756756
sig+=sigbuf[1:]
757-
#end read all signature
757+
#END read all signature
758758
self.gpgsig=sig.rstrip(b"\n").decode(self.encoding,"ignore")
759759
ifis_next_header:
760760
continue

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp