| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 679d2e8 commit ee0301a
7 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -127,7 +127,7 @@ def refresh(path: Optional[PathLike] = None) -> None: | |||
| 127 | 127 | immediately, relative to the current directory. | |
| 128 | 128 | ||
| 129 | 129 | :note: | |
| 130 | - The *path* parameter is usually omitted and cannot be used to specify a custom | ||
| 130 | + The `path` parameter is usually omitted and cannot be used to specify a custom | ||
| 131 | 131 | command whose location is looked up in a path search on each call. See | |
| 132 | 132 | :meth:`Git.refresh <git.cmd.Git.refresh>` for details on how to achieve this. | |
| 133 | 133 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -106,7 +106,7 @@ def handle_process_output( | |||
| 106 | 106 | decode_streams: bool = True, | |
| 107 | 107 | kill_after_timeout: Union[None, float] = None, | |
| 108 | 108 | ) -> None: | |
| 109 | - """Register for notifications to learn that process output is ready to read, and | ||
| 109 | + R"""Register for notifications to learn that process output is ready to read, and | ||
| 110 | 110 | dispatch lines to the respective line handlers. | |
| 111 | 111 | ||
| 112 | 112 | This function returns once the finalizer returns. | |
@@ -126,8 +126,11 @@ def handle_process_output( | |||
| 126 | 126 | :param decode_streams: | |
| 127 | 127 | Assume stdout/stderr streams are binary and decode them before pushing their | |
| 128 | 128 | contents to handlers. | |
| 129 | - Set this to ``False`` if ``universal_newlines == True`` (then streams are in | ||
| 130 | - text mode) or if decoding must happen later (i.e. for :class:`~git.diff.Diff`s). | ||
| 129 | + | ||
| 130 | + This defaults to ``True``. Set it to ``False``: | ||
| 131 | + | ||
| 132 | + - if ``universal_newlines == True``, as then streams are in text mode, or | ||
| 133 | + - if decoding must happen later, such as for :class:`~git.diff.Diff`\s. | ||
| 131 | 134 | ||
| 132 | 135 | :param kill_after_timeout: | |
| 133 | 136 | :class:`float` or ``None``, Default = ``None`` | |
@@ -379,15 +382,14 @@ def __setstate__(self, d: Dict[str, Any]) -> None: | |||
| 379 | 382 | ||
| 380 | 383 | :note: | |
| 381 | 384 | The git executable is actually found during the refresh step in the top level | |
| 382 | - :mod:`__init__`. It can also be changed by explicitly calling | ||
| 383 | - :func:`git.refresh`. | ||
| 385 | + ``__init__``. It can also be changed by explicitly calling :func:`git.refresh`. | ||
| 384 | 386 | """ | |
| 385 | 387 | ||
| 386 | 388 | _refresh_token = object() # Since None would match an initial _version_info_token. | |
| 387 | 389 | ||
| 388 | 390 | @classmethod | |
| 389 | 391 | def refresh(cls, path: Union[None, PathLike] = None) -> bool: | |
| 390 | - """This gets called by the refresh function (see the top level __init__). | ||
| 392 | + """This gets called by the refresh function (see the top level ``__init__``). | ||
| 391 | 393 | ||
| 392 | 394 | :param path: | |
| 393 | 395 | Optional path to the git executable. If not absolute, it is resolved | |
@@ -868,8 +870,7 @@ def __init__(self, working_dir: Union[None, PathLike] = None): | |||
| 868 | 870 | self.cat_file_all: Union[None, TBD] = None | |
| 869 | 871 | ||
| 870 | 872 | def __getattr__(self, name: str) -> Any: | |
| 871 | - """A convenience method as it allows to call the command as if it was | ||
| 872 | - an object. | ||
| 873 | + """A convenience method as it allows to call the command as if it was an object. | ||
| 873 | 874 | ||
| 874 | 875 | :return: | |
| 875 | 876 | Callable object that will execute call :meth:`_call_process` with your | |
@@ -899,7 +900,7 @@ def working_dir(self) -> Union[None, PathLike]: | |||
| 899 | 900 | @property | |
| 900 | 901 | def version_info(self) -> Tuple[int, ...]: | |
| 901 | 902 | """ | |
| 902 | - :return: tuple with integers representing the major, minor and additional | ||
| 903 | + :return: Tuple with integers representing the major, minor and additional | ||
| 903 | 904 | version numbers as parsed from ``git version``. Up to four fields are used. | |
| 904 | 905 | ||
| 905 | 906 | This value is generated on demand and is cached. | |
@@ -1021,7 +1022,7 @@ def execute( | |||
| 1021 | 1022 | :param output_stream: | |
| 1022 | 1023 | If set to a file-like object, data produced by the git command will be | |
| 1023 | 1024 | copied to the given stream instead of being returned as a string. | |
| 1024 | - This feature only has any effect if `as_process` is False. | ||
| 1025 | + This feature only has any effect if `as_process` is ``False``. | ||
| 1025 | 1026 | ||
| 1026 | 1027 | :param stdout_as_string: | |
| 1027 | 1028 | If ``False``, the command's standard output will be bytes. Otherwise, it | |
@@ -1030,10 +1031,10 @@ def execute( | |||
| 1030 | 1031 | ||
| 1031 | 1032 | :param kill_after_timeout: | |
| 1032 | 1033 | Specifies a timeout in seconds for the git command, after which the process | |
| 1033 | - should be killed. This will have no effect if `as_process` is set to True. | ||
| 1034 | - It is set to None by default and will let the process run until the timeout | ||
| 1035 | - is explicitly specified. Uses of this feature should be carefully | ||
| 1036 | - considered, due to the following limitations: | ||
| 1034 | + should be killed. This will have no effect if `as_process` is set to | ||
| 1035 | + ``True``. It is set to ``None`` by default and will let the process run | ||
| 1036 | + until the timeout is explicitly specified. Uses of this feature should be | ||
| 1037 | + carefully considered, due to the following limitations: | ||
| 1037 | 1038 | ||
| 1038 | 1039 | 1. This feature is not supported at all on Windows. | |
| 1039 | 1040 | 2. Effectiveness may vary by operating system. ``ps --ppid`` is used to | |
@@ -1099,7 +1100,7 @@ def execute( | |||
| 1099 | 1100 | ||
| 1100 | 1101 | :note: | |
| 1101 | 1102 | If you add additional keyword arguments to the signature of this method, | |
| 1102 | - you must update the execute_kwargs tuple housed in this module. | ||
| 1103 | + you must update the ``execute_kwargs`` variable housed in this module. | ||
| 1103 | 1104 | """ | |
| 1104 | 1105 | # Remove password for the command if present. | |
| 1105 | 1106 | redacted_command = remove_password_if_present(command) | |
@@ -1420,9 +1421,10 @@ def _call_process( | |||
| 1420 | 1421 | :param kwargs: | |
| 1421 | 1422 | Contains key-values for the following: | |
| 1422 | 1423 | ||
| 1423 | - - The :meth:`execute()` kwds, as listed in :var:`execute_kwargs`. | ||
| 1424 | + - The :meth:`execute()` kwds, as listed in ``execute_kwargs``. | ||
| 1424 | 1425 | - "Command options" to be converted by :meth:`transform_kwargs`. | |
| 1425 | - - The ``insert_kwargs_after`` key which its value must match one of ``*args``. | ||
| 1426 | + - The ``insert_kwargs_after`` key which its value must match one of | ||
| 1427 | + ``*args``. | ||
| 1426 | 1428 | ||
| 1427 | 1429 | It also contains any command options, to be appended after the matched arg. | |
| 1428 | 1430 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -411,7 +411,7 @@ def release(self) -> None: | |||
| 411 | 411 | not be used anymore afterwards. | |
| 412 | 412 | ||
| 413 | 413 | In Python 3, it's required to explicitly release locks and flush changes, as | |
| 414 | - :meth:`__del__` is not called deterministically anymore. | ||
| 414 | + ``__del__`` is not called deterministically anymore. | ||
| 415 | 415 | """ | |
| 416 | 416 | # Checking for the lock here makes sure we do not raise during write() | |
| 417 | 417 | # in case an invalid parser was created who could not get a lock. | |
@@ -539,7 +539,7 @@ def _included_paths(self) -> List[Tuple[str, str]]: | |||
| 539 | 539 | """List all paths that must be included to configuration. | |
| 540 | 540 | ||
| 541 | 541 | :return: | |
| 542 | - The list of paths, where each path is a tuple of ``(option, value)``. | ||
| 542 | + The list of paths, where each path is a tuple of (option, value). | ||
| 543 | 543 | """ | |
| 544 | 544 | paths = [] | |
| 545 | 545 | ||
@@ -591,9 +591,6 @@ def read(self) -> None: # type: ignore[override] | |||
| 591 | 591 | This will ignore files that cannot be read, possibly leaving an empty | |
| 592 | 592 | configuration. | |
| 593 | 593 | ||
| 594 | - :return: | ||
| 595 | - Nothing | ||
| 596 | - | ||
| 597 | 594 | :raise IOError: | |
| 598 | 595 | If a file cannot be handled. | |
| 599 | 596 | """ | |
@@ -765,7 +762,7 @@ def add_section(self, section: str) -> None: | |||
| 765 | 762 | ||
| 766 | 763 | @property | |
| 767 | 764 | def read_only(self) -> bool: | |
| 768 | - """:return: True if this instance may change the configuration file""" | ||
| 765 | + """:return: ``True`` if this instance may change the configuration file""" | ||
| 769 | 766 | return self._read_only | |
| 770 | 767 | ||
| 771 | 768 | # FIXME: Figure out if default or return type can really include bool. | |
@@ -918,7 +915,7 @@ def add_value(self, section: str, option: str, value: Union[str, bytes, int, flo | |||
| 918 | 915 | return self | |
| 919 | 916 | ||
| 920 | 917 | def rename_section(self, section: str, new_name: str) -> "GitConfigParser": | |
| 921 | - """Rename the given section to new_name. | ||
| 918 | + """Rename the given section to `new_name`. | ||
| 922 | 919 | ||
| 923 | 920 | :raise ValueError: | |
| 924 | 921 | If: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -54,7 +54,8 @@ def stream(self, binsha: bytes) -> OStream: | |||
| 54 | 54 | ||
| 55 | 55 | def partial_to_complete_sha_hex(self, partial_hexsha: str) -> bytes: | |
| 56 | 56 | """ | |
| 57 | - :return: Full binary 20 byte sha from the given partial hexsha | ||
| 57 | + :return: | ||
| 58 | + Full binary 20 byte sha from the given partial hexsha | ||
| 58 | 59 | ||
| 59 | 60 | :raise gitdb.exc.AmbiguousObjectName: | |
| 60 | 61 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -121,9 +121,9 @@ def diff( | |||
| 121 | 121 | * If ``None``, we will be compared to the working tree. | |
| 122 | 122 | * If :class:`~git.index.base.Treeish`, it will be compared against the | |
| 123 | 123 | respective tree. | |
| 124 | - * If :class:`~Diffable.Index`, it will be compared against the index. | ||
| 124 | + * If :class:`Diffable.Index`, it will be compared against the index. | ||
| 125 | 125 | * If :attr:`git.NULL_TREE`, it will compare against the empty tree. | |
| 126 | - * It defaults to :class:`~Diffable.Index` so that the method will not by | ||
| 126 | + * It defaults to :class:`Diffable.Index` so that the method will not by | ||
| 127 | 127 | default fail on bare repositories. | |
| 128 | 128 | ||
| 129 | 129 | :param paths: | |
@@ -280,11 +280,11 @@ class Diff: | |||
| 280 | 280 | Working Tree Blobs: | |
| 281 | 281 | ||
| 282 | 282 | When comparing to working trees, the working tree blob will have a null hexsha | |
| 283 | - as a corresponding object does not yet exist. The mode will be null as well. | ||
| 284 | - The path will be available, though. | ||
| 283 | + as a corresponding object does not yet exist. The mode will be null as well. The | ||
| 284 | + path will be available, though. | ||
| 285 | 285 | ||
| 286 | - If it is listed in a diff, the working tree version of the file must | ||
| 287 | - differ from the version in the index or tree, and hence has been modified. | ||
| 286 | + If it is listed in a diff, the working tree version of the file must differ from | ||
| 287 | + the version in the index or tree, and hence has been modified. | ||
| 288 | 288 | """ | |
| 289 | 289 | ||
| 290 | 290 | # Precompiled regex. | |
@@ -468,7 +468,8 @@ def rename_to(self) -> Optional[str]: | |||
| 468 | 468 | ||
| 469 | 469 | @property | |
| 470 | 470 | def renamed(self) -> bool: | |
| 471 | - """ | ||
| 471 | + """Deprecated, use :attr:`renamed_file` instead. | ||
| 472 | + | ||
| 472 | 473 | :return: | |
| 473 | 474 | ``True`` if the blob of our diff has been renamed | |
| 474 | 475 | ||
@@ -480,7 +481,7 @@ def renamed(self) -> bool: | |||
| 480 | 481 | ||
| 481 | 482 | @property | |
| 482 | 483 | def renamed_file(self) -> bool: | |
| 483 | - """:return: True if the blob of our diff has been renamed""" | ||
| 484 | + """:return: ``True`` if the blob of our diff has been renamed""" | ||
| 484 | 485 | return self.rename_from != self.rename_to | |
| 485 | 486 | ||
| 486 | 487 | @classmethod | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -338,7 +338,7 @@ class FetchInfo(IterableObj): | |||
| 338 | 338 | ||
| 339 | 339 | @classmethod | |
| 340 | 340 | def refresh(cls) -> Literal[True]: | |
| 341 | - """This gets called by the refresh function (see the top level __init__).""" | ||
| 341 | + """This gets called by the refresh function (see the top level ``__init__``).""" | ||
| 342 | 342 | # Clear the old values in _flag_map. | |
| 343 | 343 | with contextlib.suppress(KeyError): | |
| 344 | 344 | del cls._flag_map["t"] | |
@@ -386,19 +386,22 @@ def _from_line(cls, repo: "Repo", line: str, fetch_line: str) -> "FetchInfo": | |||
| 386 | 386 | """Parse information from the given line as returned by ``git-fetch -v`` and | |
| 387 | 387 | return a new :class:`FetchInfo` object representing this information. | |
| 388 | 388 | ||
| 389 | - We can handle a line as follows: | ||
| 390 | - "%c %-\\*s %-\\*s -> %s%s" | ||
| 389 | + We can handle a line as follows:: | ||
| 391 | 390 | ||
| 392 | - Where c is either ' ', !, +, -, \\*, or = | ||
| 393 | - ! means error | ||
| 394 | - + means success forcing update | ||
| 395 | - - means a tag was updated | ||
| 396 | - * means birth of new branch or tag | ||
| 397 | - = means the head was up to date (and not moved) | ||
| 398 | - ' ' means a fast-forward | ||
| 391 | + %c %-*s %-*s -> %s%s | ||
| 399 | 392 | ||
| 400 | - fetch line is the corresponding line from FETCH_HEAD, like | ||
| 401 | - acb0fa8b94ef421ad60c8507b634759a472cd56c not-for-merge branch '0.1.7RC' of /tmp/tmpya0vairemote_repo | ||
| 393 | + Where ``c`` is either a space, ``!``, ``+``, ``-``, ``*``, or ``=``: | ||
| 394 | + | ||
| 395 | + - '!' means error | ||
| 396 | + - '+' means success forcing update | ||
| 397 | + - '-' means a tag was updated | ||
| 398 | + - '*' means birth of new branch or tag | ||
| 399 | + - '=' means the head was up to date (and not moved) | ||
| 400 | + - ' ' means a fast-forward | ||
| 401 | + | ||
| 402 | + `fetch_line` is the corresponding line from FETCH_HEAD, like:: | ||
| 403 | + | ||
| 404 | + acb0fa8b94ef421ad60c8507b634759a472cd56c not-for-merge branch '0.1.7RC' of /tmp/tmpya0vairemote_repo | ||
| 402 | 405 | """ | |
| 403 | 406 | match = cls._re_fetch_result.match(line) | |
| 404 | 407 | if match is None: | |
@@ -625,7 +628,7 @@ def exists(self) -> bool: | |||
| 625 | 628 | ||
| 626 | 629 | @classmethod | |
| 627 | 630 | def iter_items(cls, repo: "Repo", *args: Any, **kwargs: Any) -> Iterator["Remote"]: | |
| 628 | - """:return: Iterator yielding Remote objects of the given repository""" | ||
| 631 | + """:return: Iterator yielding :class:`Remote` objects of the given repository""" | ||
| 629 | 632 | for section in repo.config_reader("repository").sections(): | |
| 630 | 633 | if not section.startswith("remote "): | |
| 631 | 634 | continue | |
@@ -639,7 +642,7 @@ def iter_items(cls, repo: "Repo", *args: Any, **kwargs: Any) -> Iterator["Remote | |||
| 639 | 642 | def set_url( | |
| 640 | 643 | self, new_url: str, old_url: Optional[str] = None, allow_unsafe_protocols: bool = False, **kwargs: Any | |
| 641 | 644 | ) -> "Remote": | |
| 642 | - """Configure URLs on current remote (cf command ``git remote set-url``). | ||
| 645 | + """Configure URLs on current remote (cf. command ``git remote set-url``). | ||
| 643 | 646 | ||
| 644 | 647 | This command manages URLs on the remote. | |
| 645 | 648 | ||
@@ -1020,7 +1023,7 @@ def fetch( | |||
| 1020 | 1023 | facility. | |
| 1021 | 1024 | ||
| 1022 | 1025 | :param progress: | |
| 1023 | - See :meth:`push` method. | ||
| 1026 | + See the :meth:`push` method. | ||
| 1024 | 1027 | ||
| 1025 | 1028 | :param verbose: | |
| 1026 | 1029 | Boolean for verbose output. | |
@@ -1081,8 +1084,8 @@ def pull( | |||
| 1081 | 1084 | allow_unsafe_options: bool = False, | |
| 1082 | 1085 | **kwargs: Any, | |
| 1083 | 1086 | ) -> IterableList[FetchInfo]: | |
| 1084 | - """Pull changes from the given branch, being the same as a fetch followed | ||
| 1085 | - by a merge of branch with your local branch. | ||
| 1087 | + """Pull changes from the given branch, being the same as a fetch followed by a | ||
| 1088 | + merge of branch with your local branch. | ||
| 1086 | 1089 | ||
| 1087 | 1090 | :param refspec: | |
| 1088 | 1091 | See :meth:`fetch` method. | |
@@ -1157,7 +1160,7 @@ def push( | |||
| 1157 | 1160 | ||
| 1158 | 1161 | :param kill_after_timeout: | |
| 1159 | 1162 | To specify a timeout in seconds for the git command, after which the process | |
| 1160 | - should be killed. It is set to None by default. | ||
| 1163 | + should be killed. It is set to ``None`` by default. | ||
| 1161 | 1164 | ||
| 1162 | 1165 | :param allow_unsafe_protocols: | |
| 1163 | 1166 | Allow unsafe protocols to be used, like ``ext``. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -762,9 +762,9 @@ def update(self, *args: Any, **kwargs: Any) -> None: | |||
| 762 | 762 | ||
| 763 | 763 | ||
| 764 | 764 | class Actor: | |
| 765 | - """Actors hold information about a person acting on the repository. They | ||
| 766 | - can be committers and authors or anything with a name and an email as mentioned in | ||
| 767 | - the git log entries.""" | ||
| 765 | + """Actors hold information about a person acting on the repository. They can be | ||
| 766 | + committers and authors or anything with a name and an email as mentioned in the git | ||
| 767 | + log entries.""" | ||
| 768 | 768 | ||
| 769 | 769 | # PRECOMPILED REGEX | |
| 770 | 770 | name_only_regex = re.compile(r"<(.*)>") | |
| Back | FazBrowse Home | New Git URL |
0 commit comments