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

Commit254c82a

Browse files
committed
More docstring revisions within git.refs
1 parent4b04d8a commit254c82a

File tree

5 files changed

+47
-46
lines changed

5 files changed

+47
-46
lines changed

‎git/refs/head.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ def strip_quotes(string: str) -> str:
3636

3737

3838
classHEAD(SymbolicReference):
39-
"""Special case of a SymbolicReference representing the repository's
40-
HEADreference."""
39+
"""Special case of a SymbolicReference representing the repository's HEAD
40+
reference."""
4141

4242
_HEAD_NAME="HEAD"
4343
_ORIG_HEAD_NAME="ORIG_HEAD"
@@ -66,22 +66,21 @@ def reset(
6666
paths:Union[PathLike,Sequence[PathLike],None]=None,
6767
**kwargs:Any,
6868
)->"HEAD":
69-
"""Reset our HEAD to the given commit optionally synchronizing
70-
the index and working tree. The reference we refer to will be set to commit as
71-
well.
69+
"""Reset our HEAD to the given commit optionally synchronizing the index and
70+
working tree. The reference we refer to will be set to commit as well.
7271
7372
:param commit:
7473
:class:`~git.objects.commit.Commit`, :class:`~git.refs.reference.Reference`,
7574
or string identifying a revision we should reset HEAD to.
7675
7776
:param index:
78-
If True, the index will be set to match the given commit.
77+
If``True``, the index will be set to match the given commit.
7978
Otherwise it will not be touched.
8079
8180
:param working_tree:
82-
If True, the working tree will be forcefully adjusted to match the given
81+
If``True``, the working tree will be forcefully adjusted to match the given
8382
commit, possibly overwriting uncommitted changes without warning.
84-
If `working_tree` is True, `index` must be True as well.
83+
If `working_tree` is``True``, `index` must be``True`` as well.
8584
8685
:param paths:
8786
Single path or list of paths relative to the git root directory
@@ -90,7 +89,8 @@ def reset(
9089
:param kwargs:
9190
Additional arguments passed to ``git reset``.
9291
93-
:return: self
92+
:return:
93+
self
9494
"""
9595
mode:Union[str,None]
9696
mode="--soft"
@@ -151,8 +151,8 @@ def delete(cls, repo: "Repo", *heads: "Union[Head, str]", force: bool = False, *
151151
"""Delete the given heads.
152152
153153
:param force:
154-
If True, the heads will be deleted even if they are not yet merged into the
155-
main development stream. Default False.
154+
If``True``, the heads will be deleted even if they are not yet merged into
155+
themain development stream. Default``False``.
156156
"""
157157
flag="-d"
158158
ifforce:
@@ -193,7 +193,7 @@ def set_tracking_branch(self, remote_reference: Union["RemoteReference", None])
193193
deftracking_branch(self)->Union["RemoteReference",None]:
194194
"""
195195
:return:
196-
The remote reference we are tracking, or None if we are not a tracking
196+
The remote reference we are tracking, or``None`` if we are not a tracking
197197
branch.
198198
"""
199199
from .remoteimportRemoteReference
@@ -219,14 +219,14 @@ def rename(self, new_path: PathLike, force: bool = False) -> "Head":
219219
The prefix ``refs/heads`` is implied.
220220
221221
:param force:
222-
If True, the rename will succeed even if a head with the target name
222+
If``True``, the rename will succeed even if a head with the target name
223223
already exists.
224224
225225
:return:
226226
self
227227
228228
:note:
229-
Respects the ref log as git commands are used.
229+
Respects the ref log, as git commands are used.
230230
"""
231231
flag="-m"
232232
ifforce:
@@ -244,8 +244,8 @@ def checkout(self, force: bool = False, **kwargs: Any) -> Union["HEAD", "Head"]:
244244
The command will fail if changed working tree files would be overwritten.
245245
246246
:param force:
247-
If True, changes to the index and the working tree will be discarded.
248-
If False, :class:`~git.exc.GitCommandError` will be raised in that
247+
If``True``, changes to the index and the working tree will be discarded.
248+
If``False``, :class:`~git.exc.GitCommandError` will be raised in that
249249
situation.
250250
251251
:param kwargs:

‎git/refs/log.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,15 @@ def new(
104104
tz_offset:int,
105105
message:str,
106106
)->"RefLogEntry":# skipcq: PYL-W0621
107-
""":return: New instance of a RefLogEntry"""
107+
""":return: New instance of a:class:`RefLogEntry`"""
108108
ifnotisinstance(actor,Actor):
109109
raiseValueError("Need actor instance, got %s"%actor)
110110
# END check types
111111
returnRefLogEntry((oldhexsha,newhexsha,actor, (time,tz_offset),message))
112112

113113
@classmethod
114114
deffrom_line(cls,line:bytes)->"RefLogEntry":
115-
""":return: New RefLogEntry instance from the given revlog line.
115+
""":return: New:class:`RefLogEntry` instance from the given revlog line.
116116
117117
:param line:
118118
Line bytes without trailing newline
@@ -311,7 +311,7 @@ def append_entry(
311311
:param config_reader:
312312
Configuration reader of the repository - used to obtain user information.
313313
May also be an :class:`~git.util.Actor` instance identifying the committer
314-
directly or None.
314+
directly or``None``.
315315
316316
:param filepath:
317317
Full path to the log file.
@@ -326,7 +326,7 @@ def append_entry(
326326
Message describing the change to the reference.
327327
328328
:param write:
329-
If True, the changes will be written right away.
329+
If``True``, the changes will be written right away.
330330
Otherwise the change will not be written.
331331
332332
:return:

‎git/refs/reference.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def __init__(self, repo: "Repo", path: PathLike, check_path: bool = True) -> Non
6565
e.g. ``refs/heads/master``.
6666
6767
:param check_path:
68-
If False, you can provide any path.
68+
If``False``, you can provide any path.
6969
Otherwise the path must start with the default path prefix of this type.
7070
"""
7171
ifcheck_pathandnotstr(path).startswith(self._common_path_default+"/"):
@@ -141,8 +141,9 @@ def iter_items(
141141
*args:Any,
142142
**kwargs:Any,
143143
)->Iterator[T_References]:
144-
"""Equivalent to SymbolicReference.iter_items, but will return non-detached
145-
references as well."""
144+
"""Equivalent to
145+
:meth:`SymbolicReference.iter_items <git.refs.symbolic.SymbolicReference.iter_items>`,
146+
but will return non-detached references as well."""
146147
returncls._iter_items(repo,common_path)
147148

148149
# }END interface

‎git/refs/remote.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def delete(cls, repo: "Repo", *refs: "RemoteReference", **kwargs: Any) -> None:
5656
"""Delete the given remote references.
5757
5858
:note:
59-
kwargs are given for comparability with the base class method as we
59+
`kwargs` are given for comparability with the base class method as we
6060
should not narrow the signature.
6161
"""
6262
repo.git.branch("-d","-r",*refs)

‎git/refs/symbolic.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class SymbolicReference:
6363
This does not point to a specific commit, but to another
6464
:class:`~git.refs.head.Head`, which itself specifies a commit.
6565
66-
A typical example for a symbolic reference is``HEAD``.
66+
A typical example for a symbolic reference is:class:`~git.refs.head.HEAD`.
6767
"""
6868

6969
__slots__= ("repo","path")
@@ -115,8 +115,8 @@ def _get_packed_refs_path(cls, repo: "Repo") -> str:
115115

116116
@classmethod
117117
def_iter_packed_refs(cls,repo:"Repo")->Iterator[Tuple[str,str]]:
118-
"""Return an iterator yielding pairs of sha1/path pairs (as strings)
119-
for thecorresponding refs.
118+
"""Return an iterator yielding pairs of sha1/path pairs (as strings) for the
119+
corresponding refs.
120120
121121
:note:
122122
The packed refs file will be kept open as long as we iterate.
@@ -226,9 +226,9 @@ def _get_ref_info_helper(
226226
"""
227227
:return:
228228
(str(sha), str(target_ref_path)) if available, the sha the file at rela_path
229-
points to, or None.
229+
points to, or``None``.
230230
231-
target_ref_path is the reference we point to, or None.
231+
target_ref_path is the reference we point to, or``None``.
232232
"""
233233
ifref_path:
234234
cls._check_ref_name_valid(ref_path)
@@ -273,7 +273,7 @@ def _get_ref_info(cls, repo: "Repo", ref_path: Union[PathLike, None]) -> Union[T
273273
:return: (str(sha), str(target_ref_path)) if available, the sha the file at
274274
rela_path points to, or None.
275275
276-
target_ref_path is the reference we point to, or None.
276+
target_ref_path is the reference we point to, or``None``.
277277
"""
278278
returncls._get_ref_info_helper(repo,ref_path)
279279

@@ -313,7 +313,7 @@ def set_commit(
313313
:class:`~git.objects.commit.Commit`.
314314
315315
:raise ValueError:
316-
If `commit` is not a :class:`~git.objects.commit.Commit` object or doesn't
316+
If `commit` is not a :class:`~git.objects.commit.Commit` object, nor does it
317317
point to a commit.
318318
319319
:return:
@@ -357,7 +357,7 @@ def set_object(
357357
to.
358358
359359
:param logmsg:
360-
If not None, the message will be used in the reflog entry to be written.
360+
If not``None``, the message will be used in the reflog entry to be written.
361361
Otherwise the reflog is not altered.
362362
363363
:note:
@@ -491,8 +491,8 @@ def set_reference(
491491
defis_valid(self)->bool:
492492
"""
493493
:return:
494-
True if the reference is valid, hence it can be read and points to a valid
495-
object or reference.
494+
``True`` if the reference is valid, hence it can be read and points to a
495+
validobject or reference.
496496
"""
497497
try:
498498
self.object
@@ -505,7 +505,7 @@ def is_valid(self) -> bool:
505505
defis_detached(self)->bool:
506506
"""
507507
:return:
508-
True if we are a detached reference, hence we point to a specific commit
508+
``True`` if we are a detached reference, hence we point to a specific commit
509509
instead to another reference.
510510
"""
511511
try:
@@ -565,7 +565,7 @@ def log_append(
565565
deflog_entry(self,index:int)->"RefLogEntry":
566566
"""
567567
:return:
568-
RefLogEntry at the given index
568+
:class:`~git.refs.log.RefLogEntry` at the given index
569569
570570
:param index:
571571
Python list compatible positive or negative index.
@@ -582,7 +582,7 @@ def to_full_path(cls, path: Union[PathLike, "SymbolicReference"]) -> PathLike:
582582
"""
583583
:return:
584584
String with a full repository-relative path which can be used to initialize
585-
a Reference instance, for instance by using
585+
a:class:`~git.refs.reference.Reference` instance, for instance by using
586586
:meth:`Reference.from_path <git.refs.reference.Reference.from_path>`.
587587
"""
588588
ifisinstance(path,SymbolicReference):
@@ -666,7 +666,7 @@ def _create(
666666
)->T_References:
667667
"""Internal method used to create a new symbolic reference.
668668
669-
If `resolve` is False, the reference will be taken as is, creating a proper
669+
If `resolve` is``False``, the reference will be taken as is, creating a proper
670670
symbolic reference. Otherwise it will be resolved to the corresponding object
671671
and a detached symbolic reference will be created instead.
672672
"""
@@ -722,12 +722,12 @@ def create(
722722
If it is a commit-ish, the symbolic ref will be detached.
723723
724724
:param force:
725-
If True, force creation even if a symbolic reference with that name already
726-
exists. Raise :class:`OSError` otherwise.
725+
If``True``, force creation even if a symbolic reference with that name
726+
alreadyexists. Raise :class:`OSError` otherwise.
727727
728728
:param logmsg:
729-
If not None, the message to append to the reflog.
730-
If None, no reflog entry is written.
729+
If not``None``, the message to append to the reflog.
730+
If``None``, no reflog entry is written.
731731
732732
:return:
733733
Newly created symbolic reference
@@ -751,8 +751,8 @@ def rename(self, new_path: PathLike, force: bool = False) -> "SymbolicReference"
751751
In case this is a symbolic ref, there is no implied prefix.
752752
753753
:param force:
754-
If True, the rename will succeed even if a head with the target name already
755-
exists. It will be overwritten in that case.
754+
If``True``, the rename will succeed even if a head with the target name
755+
alreadyexists. It will be overwritten in that case.
756756
757757
:return:
758758
self
@@ -847,8 +847,8 @@ def iter_items(
847847
:param common_path:
848848
Optional keyword argument to the path which is to be shared by all returned
849849
Ref objects.
850-
Defaults to class specific portion if None, ensuring that only refs suitable
851-
for the actual class are returned.
850+
Defaults to class specific portion if``None``, ensuring that only refs
851+
suitablefor the actual class are returned.
852852
853853
:return:
854854
A list of :class:`SymbolicReference`, each guaranteed to be a symbolic ref

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp