| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 4b04d8a commit 254c82a
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -36,8 +36,8 @@ def strip_quotes(string: str) -> str: | |||
| 36 | 36 | ||
| 37 | 37 | ||
| 38 | 38 | class HEAD(SymbolicReference): | |
| 39 | - """Special case of a SymbolicReference representing the repository's | ||
| 40 | - HEAD reference.""" | ||
| 39 | + """Special case of a SymbolicReference representing the repository's HEAD | ||
| 40 | + reference.""" | ||
| 41 | 41 | ||
| 42 | 42 | _HEAD_NAME = "HEAD" | |
| 43 | 43 | _ORIG_HEAD_NAME = "ORIG_HEAD" | |
@@ -66,22 +66,21 @@ def reset( | |||
| 66 | 66 | paths: Union[PathLike, Sequence[PathLike], None] = None, | |
| 67 | 67 | **kwargs: Any, | |
| 68 | 68 | ) -> "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. | ||
| 72 | 71 | ||
| 73 | 72 | :param commit: | |
| 74 | 73 | :class:`~git.objects.commit.Commit`, :class:`~git.refs.reference.Reference`, | |
| 75 | 74 | or string identifying a revision we should reset HEAD to. | |
| 76 | 75 | ||
| 77 | 76 | :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. | ||
| 79 | 78 | Otherwise it will not be touched. | |
| 80 | 79 | ||
| 81 | 80 | :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 | ||
| 83 | 82 | 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. | ||
| 85 | 84 | ||
| 86 | 85 | :param paths: | |
| 87 | 86 | Single path or list of paths relative to the git root directory | |
@@ -90,7 +89,8 @@ def reset( | |||
| 90 | 89 | :param kwargs: | |
| 91 | 90 | Additional arguments passed to ``git reset``. | |
| 92 | 91 | ||
| 93 | - :return: self | ||
| 92 | + :return: | ||
| 93 | + self | ||
| 94 | 94 | """ | |
| 95 | 95 | mode: Union[str, None] | |
| 96 | 96 | mode = "--soft" | |
@@ -151,8 +151,8 @@ def delete(cls, repo: "Repo", *heads: "Union[Head, str]", force: bool = False, * | |||
| 151 | 151 | """Delete the given heads. | |
| 152 | 152 | ||
| 153 | 153 | :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 | + the main development stream. Default ``False``. | ||
| 156 | 156 | """ | |
| 157 | 157 | flag = "-d" | |
| 158 | 158 | if force: | |
@@ -193,7 +193,7 @@ def set_tracking_branch(self, remote_reference: Union["RemoteReference", None]) | |||
| 193 | 193 | def tracking_branch(self) -> Union["RemoteReference", None]: | |
| 194 | 194 | """ | |
| 195 | 195 | :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 | ||
| 197 | 197 | branch. | |
| 198 | 198 | """ | |
| 199 | 199 | from .remote import RemoteReference | |
@@ -219,14 +219,14 @@ def rename(self, new_path: PathLike, force: bool = False) -> "Head": | |||
| 219 | 219 | The prefix ``refs/heads`` is implied. | |
| 220 | 220 | ||
| 221 | 221 | :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 | ||
| 223 | 223 | already exists. | |
| 224 | 224 | ||
| 225 | 225 | :return: | |
| 226 | 226 | self | |
| 227 | 227 | ||
| 228 | 228 | :note: | |
| 229 | - Respects the ref log as git commands are used. | ||
| 229 | + Respects the ref log, as git commands are used. | ||
| 230 | 230 | """ | |
| 231 | 231 | flag = "-m" | |
| 232 | 232 | if force: | |
@@ -244,8 +244,8 @@ def checkout(self, force: bool = False, **kwargs: Any) -> Union["HEAD", "Head"]: | |||
| 244 | 244 | The command will fail if changed working tree files would be overwritten. | |
| 245 | 245 | ||
| 246 | 246 | :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 | ||
| 249 | 249 | situation. | |
| 250 | 250 | ||
| 251 | 251 | :param kwargs: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -104,15 +104,15 @@ def new( | |||
| 104 | 104 | tz_offset: int, | |
| 105 | 105 | message: str, | |
| 106 | 106 | ) -> "RefLogEntry": # skipcq: PYL-W0621 | |
| 107 | - """:return: New instance of a RefLogEntry""" | ||
| 107 | + """:return: New instance of a :class:`RefLogEntry`""" | ||
| 108 | 108 | if not isinstance(actor, Actor): | |
| 109 | 109 | raise ValueError("Need actor instance, got %s" % actor) | |
| 110 | 110 | # END check types | |
| 111 | 111 | return RefLogEntry((oldhexsha, newhexsha, actor, (time, tz_offset), message)) | |
| 112 | 112 | ||
| 113 | 113 | @classmethod | |
| 114 | 114 | def from_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. | ||
| 116 | 116 | ||
| 117 | 117 | :param line: | |
| 118 | 118 | Line bytes without trailing newline | |
@@ -311,7 +311,7 @@ def append_entry( | |||
| 311 | 311 | :param config_reader: | |
| 312 | 312 | Configuration reader of the repository - used to obtain user information. | |
| 313 | 313 | May also be an :class:`~git.util.Actor` instance identifying the committer | |
| 314 | - directly or None. | ||
| 314 | + directly or ``None``. | ||
| 315 | 315 | ||
| 316 | 316 | :param filepath: | |
| 317 | 317 | Full path to the log file. | |
@@ -326,7 +326,7 @@ def append_entry( | |||
| 326 | 326 | Message describing the change to the reference. | |
| 327 | 327 | ||
| 328 | 328 | :param write: | |
| 329 | - If True, the changes will be written right away. | ||
| 329 | + If ``True``, the changes will be written right away. | ||
| 330 | 330 | Otherwise the change will not be written. | |
| 331 | 331 | ||
| 332 | 332 | :return: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -65,7 +65,7 @@ def __init__(self, repo: "Repo", path: PathLike, check_path: bool = True) -> Non | |||
| 65 | 65 | e.g. ``refs/heads/master``. | |
| 66 | 66 | ||
| 67 | 67 | :param check_path: | |
| 68 | - If False, you can provide any path. | ||
| 68 | + If ``False``, you can provide any path. | ||
| 69 | 69 | Otherwise the path must start with the default path prefix of this type. | |
| 70 | 70 | """ | |
| 71 | 71 | if check_path and not str(path).startswith(self._common_path_default + "/"): | |
@@ -141,8 +141,9 @@ def iter_items( | |||
| 141 | 141 | *args: Any, | |
| 142 | 142 | **kwargs: Any, | |
| 143 | 143 | ) -> 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.""" | ||
| 146 | 147 | return cls._iter_items(repo, common_path) | |
| 147 | 148 | ||
| 148 | 149 | # }END interface | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -56,7 +56,7 @@ def delete(cls, repo: "Repo", *refs: "RemoteReference", **kwargs: Any) -> None: | |||
| 56 | 56 | """Delete the given remote references. | |
| 57 | 57 | ||
| 58 | 58 | :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 | ||
| 60 | 60 | should not narrow the signature. | |
| 61 | 61 | """ | |
| 62 | 62 | repo.git.branch("-d", "-r", *refs) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -63,7 +63,7 @@ class SymbolicReference: | |||
| 63 | 63 | This does not point to a specific commit, but to another | |
| 64 | 64 | :class:`~git.refs.head.Head`, which itself specifies a commit. | |
| 65 | 65 | ||
| 66 | - A typical example for a symbolic reference is ``HEAD``. | ||
| 66 | + A typical example for a symbolic reference is :class:`~git.refs.head.HEAD`. | ||
| 67 | 67 | """ | |
| 68 | 68 | ||
| 69 | 69 | __slots__ = ("repo", "path") | |
@@ -115,8 +115,8 @@ def _get_packed_refs_path(cls, repo: "Repo") -> str: | |||
| 115 | 115 | ||
| 116 | 116 | @classmethod | |
| 117 | 117 | 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 the corresponding refs. | ||
| 118 | + """Return an iterator yielding pairs of sha1/path pairs (as strings) for the | ||
| 119 | + corresponding refs. | ||
| 120 | 120 | ||
| 121 | 121 | :note: | |
| 122 | 122 | The packed refs file will be kept open as long as we iterate. | |
@@ -226,9 +226,9 @@ def _get_ref_info_helper( | |||
| 226 | 226 | """ | |
| 227 | 227 | :return: | |
| 228 | 228 | (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``. | ||
| 230 | 230 | ||
| 231 | - target_ref_path is the reference we point to, or None. | ||
| 231 | + target_ref_path is the reference we point to, or ``None``. | ||
| 232 | 232 | """ | |
| 233 | 233 | if ref_path: | |
| 234 | 234 | 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 | |||
| 273 | 273 | :return: (str(sha), str(target_ref_path)) if available, the sha the file at | |
| 274 | 274 | rela_path points to, or None. | |
| 275 | 275 | ||
| 276 | - target_ref_path is the reference we point to, or None. | ||
| 276 | + target_ref_path is the reference we point to, or ``None``. | ||
| 277 | 277 | """ | |
| 278 | 278 | return cls._get_ref_info_helper(repo, ref_path) | |
| 279 | 279 | ||
@@ -313,7 +313,7 @@ def set_commit( | |||
| 313 | 313 | :class:`~git.objects.commit.Commit`. | |
| 314 | 314 | ||
| 315 | 315 | :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 | ||
| 317 | 317 | point to a commit. | |
| 318 | 318 | ||
| 319 | 319 | :return: | |
@@ -357,7 +357,7 @@ def set_object( | |||
| 357 | 357 | to. | |
| 358 | 358 | ||
| 359 | 359 | :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. | ||
| 361 | 361 | Otherwise the reflog is not altered. | |
| 362 | 362 | ||
| 363 | 363 | :note: | |
@@ -491,8 +491,8 @@ def set_reference( | |||
| 491 | 491 | def is_valid(self) -> bool: | |
| 492 | 492 | """ | |
| 493 | 493 | :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 | + valid object or reference. | ||
| 496 | 496 | """ | |
| 497 | 497 | try: | |
| 498 | 498 | self.object | |
@@ -505,7 +505,7 @@ def is_valid(self) -> bool: | |||
| 505 | 505 | def is_detached(self) -> bool: | |
| 506 | 506 | """ | |
| 507 | 507 | :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 | ||
| 509 | 509 | instead to another reference. | |
| 510 | 510 | """ | |
| 511 | 511 | try: | |
@@ -565,7 +565,7 @@ def log_append( | |||
| 565 | 565 | def log_entry(self, index: int) -> "RefLogEntry": | |
| 566 | 566 | """ | |
| 567 | 567 | :return: | |
| 568 | - RefLogEntry at the given index | ||
| 568 | + :class:`~git.refs.log.RefLogEntry` at the given index | ||
| 569 | 569 | ||
| 570 | 570 | :param index: | |
| 571 | 571 | Python list compatible positive or negative index. | |
@@ -582,7 +582,7 @@ def to_full_path(cls, path: Union[PathLike, "SymbolicReference"]) -> PathLike: | |||
| 582 | 582 | """ | |
| 583 | 583 | :return: | |
| 584 | 584 | 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 | ||
| 586 | 586 | :meth:`Reference.from_path <git.refs.reference.Reference.from_path>`. | |
| 587 | 587 | """ | |
| 588 | 588 | if isinstance(path, SymbolicReference): | |
@@ -666,7 +666,7 @@ def _create( | |||
| 666 | 666 | ) -> T_References: | |
| 667 | 667 | """Internal method used to create a new symbolic reference. | |
| 668 | 668 | ||
| 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 | ||
| 670 | 670 | symbolic reference. Otherwise it will be resolved to the corresponding object | |
| 671 | 671 | and a detached symbolic reference will be created instead. | |
| 672 | 672 | """ | |
@@ -722,12 +722,12 @@ def create( | |||
| 722 | 722 | If it is a commit-ish, the symbolic ref will be detached. | |
| 723 | 723 | ||
| 724 | 724 | :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 | + already exists. Raise :class:`OSError` otherwise. | ||
| 727 | 727 | ||
| 728 | 728 | :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. | ||
| 731 | 731 | ||
| 732 | 732 | :return: | |
| 733 | 733 | Newly created symbolic reference | |
@@ -751,8 +751,8 @@ def rename(self, new_path: PathLike, force: bool = False) -> "SymbolicReference" | |||
| 751 | 751 | In case this is a symbolic ref, there is no implied prefix. | |
| 752 | 752 | ||
| 753 | 753 | :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 | + already exists. It will be overwritten in that case. | ||
| 756 | 756 | ||
| 757 | 757 | :return: | |
| 758 | 758 | self | |
@@ -847,8 +847,8 @@ def iter_items( | |||
| 847 | 847 | :param common_path: | |
| 848 | 848 | Optional keyword argument to the path which is to be shared by all returned | |
| 849 | 849 | 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 | + suitable for the actual class are returned. | ||
| 852 | 852 | ||
| 853 | 853 | :return: | |
| 854 | 854 | A list of :class:`SymbolicReference`, each guaranteed to be a symbolic ref | |
| Back | FazBrowse Home | New Git URL |
0 commit comments