Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f444470

Browse files
committed
More wording improvements (in git module)
This futher improves some wording in docstrings and comments in a handful of places within the git module.
1 parent b5c3ca4 commit f444470

File tree

8 files changed

+23
-26
lines changed

8 files changed

+23
-26
lines changed

git/cmd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ class CatFileContentStream:
610610
stream once our sized content region is empty.
611611
612612
If not all data are read to the end of the object's lifetime, we read the
613-
rest to assure the underlying stream continues to work.
613+
rest to ensure the underlying stream continues to work.
614614
"""
615615

616616
__slots__: Tuple[str, ...] = ("_stream", "_nbr", "_size")

git/config.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
T_OMD_value = TypeVar("T_OMD_value", str, bytes, int, float, bool)
5757

5858
if sys.version_info[:3] < (3, 7, 2):
59-
# typing.Ordereddict not added until py 3.7.2
59+
# typing.Ordereddict not added until Python 3.7.2.
6060
from collections import OrderedDict
6161

6262
OrderedDict_OMD = OrderedDict
@@ -73,13 +73,10 @@
7373
log = logging.getLogger("git.config")
7474
log.addHandler(logging.NullHandler())
7575

76-
# invariants
77-
# represents the configuration level of a configuration file
78-
7976

77+
# The configuration level of a configuration file.
8078
CONFIG_LEVELS: ConfigLevels_Tup = ("system", "user", "global", "repository")
8179

82-
8380
# Section pattern to detect conditional includes.
8481
# https://git-scm.com/docs/git-config#_conditional_includes
8582
CONDITIONAL_INCLUDE_REGEXP = re.compile(r"(?<=includeIf )\"(gitdir|gitdir/i|onbranch):(.+)\"")
@@ -603,7 +600,7 @@ def read(self) -> None: # type: ignore[override]
603600
files_to_read = [self._file_or_files]
604601
else: # for lists or tuples
605602
files_to_read = list(self._file_or_files)
606-
# end assure we have a copy of the paths to handle
603+
# end ensure we have a copy of the paths to handle
607604

608605
seen = set(files_to_read)
609606
num_read_include_files = 0
@@ -612,7 +609,7 @@ def read(self) -> None: # type: ignore[override]
612609
file_ok = False
613610

614611
if hasattr(file_path, "seek"):
615-
# Must be a file objectfile-object.
612+
# Must be a file-object.
616613
file_path = cast(IO[bytes], file_path) # TODO: Replace with assert to narrow type, once sure.
617614
self._read(file_path, file_path.name)
618615
else:
@@ -626,7 +623,7 @@ def read(self) -> None: # type: ignore[override]
626623
continue
627624

628625
# Read includes and append those that we didn't handle yet.
629-
# We expect all paths to be normalized and absolute (and will assure that is the case).
626+
# We expect all paths to be normalized and absolute (and will ensure that is the case).
630627
if self._has_includes():
631628
for _, include_path in self._included_paths():
632629
if include_path.startswith("~"):

git/diff.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ def diff(
122122
the respective tree.
123123
* If :class:`Index <Diffable.Index>`, it will be compared against the index.
124124
* If :attr:`git.NULL_TREE`, it will compare against the empty tree.
125-
* It defaults to :class:`Index <Diffable.Index>` to assure the method will
126-
not by-default fail on bare repositories.
125+
* It defaults to :class:`Index <Diffable.Index>` so that the method will not
126+
by default fail on bare repositories.
127127
128128
:param paths:
129129
This a list of paths or a single path to limit the diff to. It will only

git/index/base.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,9 +340,9 @@ def from_tree(cls, repo: "Repo", *treeish: Treeish, **kwargs: Any) -> "IndexFile
340340
resolve more cases in a commonly correct manner. Specify trivial=True as kwarg
341341
to override that.
342342
343-
As the underlying git-read-tree command takes into account the current index,
344-
it will be temporarily moved out of the way to assure there are no unsuspected
345-
interferences.
343+
As the underlying git-read-tree command takes into account the current
344+
index, it will be temporarily moved out of the way to prevent any unexpected
345+
interference.
346346
"""
347347
if len(treeish) == 0 or len(treeish) > 3:
348348
raise ValueError("Please specify between 1 and 3 treeish, got %i" % len(treeish))
@@ -366,7 +366,7 @@ def from_tree(cls, repo: "Repo", *treeish: Treeish, **kwargs: Any) -> "IndexFile
366366
# Move current index out of the way - otherwise the merge may fail
367367
# as it considers existing entries. Moving it essentially clears the index.
368368
# Unfortunately there is no 'soft' way to do it.
369-
# The TemporaryFileSwap assure the original file get put back.
369+
# The TemporaryFileSwap ensures the original file gets put back.
370370

371371
stack.enter_context(TemporaryFileSwap(join_path_native(repo.git_dir, "index")))
372372
repo.git.read_tree(*arg_list, **kwargs)

git/objects/submodule/root.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def update(
133133

134134
if progress is None:
135135
progress = RootUpdateProgress()
136-
# END assure progress is set
136+
# END ensure progress is set
137137

138138
prefix = ""
139139
if dry_run:
@@ -300,7 +300,7 @@ def update(
300300
smr.rename(orig_name)
301301

302302
# Early on, we verified that the our current tracking branch
303-
# exists in the remote. Now we have to assure that the
303+
# exists in the remote. Now we have to ensure that the
304304
# sha we point to is still contained in the new remote
305305
# tracking branch.
306306
smsha = sm.binsha
@@ -367,7 +367,7 @@ def update(
367367
except OSError:
368368
# ...or reuse the existing one.
369369
tbr = git.Head(smm, sm.branch_path)
370-
# END assure tracking branch exists
370+
# END ensure tracking branch exists
371371

372372
tbr.set_tracking_branch(find_first_remote_branch(smmr, sm.branch_name))
373373
# NOTE: All head-resetting is done in the base implementation of update

git/objects/tree.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ def add(self, sha: bytes, mode: int, name: str, force: bool = False) -> "TreeMod
180180
return self
181181

182182
def add_unchecked(self, binsha: bytes, mode: int, name: str) -> None:
183-
"""Add the given item to the tree. Its correctness is assumed, which
184-
puts the caller into responsibility to assure the input is correct.
183+
"""Add the given item to the tree. Its correctness is assumed, so it is the
184+
caller's responsibility to ensure that the input is correct.
185185
186186
For more information on the parameters, see :meth:`add`.
187187

git/repo/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1448,7 +1448,7 @@ def archive(
14481448
path = cast(Union[PathLike, List[PathLike], Tuple[PathLike, ...]], path)
14491449
if not isinstance(path, (tuple, list)):
14501450
path = [path]
1451-
# end assure paths is list
1451+
# end ensure paths is list (or tuple)
14521452
self.git.archive("--", treeish, *path, **kwargs)
14531453
return self
14541454

git/util.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ def to_native_path_linux(path: PathLike) -> str:
283283
def join_path_native(a: PathLike, *p: PathLike) -> PathLike:
284284
R"""Like join_path, but makes sure an OS native path is returned.
285285
286-
This is only needed to play it safe on Windows and to assure nice paths that only
286+
This is only needed to play it safe on Windows and to ensure nice paths that only
287287
use '\'.
288288
"""
289289
return to_native_path(join_path(a, *p))
@@ -1185,8 +1185,8 @@ def __init__(cls, name: str, bases: Tuple, clsdict: Dict) -> None:
11851185

11861186

11871187
class Iterable(metaclass=IterableClassWatcher):
1188-
"""Defines an interface for iterable items which is to assure a uniform
1189-
way to retrieve and iterate items within the git repository."""
1188+
"""Defines an interface for iterable items, so there is a uniform way to retrieve
1189+
and iterate items within the git repository."""
11901190

11911191
__slots__ = ()
11921192

@@ -1221,8 +1221,8 @@ def iter_items(cls, repo: "Repo", *args: Any, **kwargs: Any) -> Any:
12211221

12221222
@runtime_checkable
12231223
class IterableObj(Protocol):
1224-
"""Defines an interface for iterable items which is to assure a uniform
1225-
way to retrieve and iterate items within the git repository.
1224+
"""Defines an interface for iterable items, so there is a uniform way to retrieve
1225+
and iterate items within the git repository.
12261226
12271227
Subclasses = [Submodule, Commit, Reference, PushInfo, FetchInfo, Remote]
12281228
"""

0 commit comments

Comments
 (0)