| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 08a80aa commit bc48d26
6 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -58,7 +58,7 @@ class Object(LazyMixin): | |||
| 58 | 58 | def __init__(self, repo: "Repo", binsha: bytes): | |
| 59 | 59 | """Initialize an object by identifying it by its binary sha. | |
| 60 | 60 | ||
| 61 | - All keyword arguments will be set on demand if None. | ||
| 61 | + All keyword arguments will be set on demand if ``None``. | ||
| 62 | 62 | ||
| 63 | 63 | :param repo: | |
| 64 | 64 | Repository this object is located in. | |
@@ -83,7 +83,7 @@ def new(cls, repo: "Repo", id: Union[str, "Reference"]) -> Commit_ish: | |||
| 83 | 83 | input id may have been a `~git.refs.reference.Reference` or rev-spec. | |
| 84 | 84 | ||
| 85 | 85 | :param id: | |
| 86 | - :class:`~git.refs.reference.Reference`, rev-spec, or hexsha | ||
| 86 | + :class:`~git.refs.reference.Reference`, rev-spec, or hexsha. | ||
| 87 | 87 | ||
| 88 | 88 | :note: | |
| 89 | 89 | This cannot be a ``__new__`` method as it would always call :meth:`__init__` | |
@@ -119,13 +119,13 @@ def _set_cache_(self, attr: str) -> None: | |||
| 119 | 119 | super()._set_cache_(attr) | |
| 120 | 120 | ||
| 121 | 121 | def __eq__(self, other: Any) -> bool: | |
| 122 | - """:return: True if the objects have the same SHA1""" | ||
| 122 | + """:return: ``True`` if the objects have the same SHA1""" | ||
| 123 | 123 | if not hasattr(other, "binsha"): | |
| 124 | 124 | return False | |
| 125 | 125 | return self.binsha == other.binsha | |
| 126 | 126 | ||
| 127 | 127 | def __ne__(self, other: Any) -> bool: | |
| 128 | - """:return: True if the objects do not have the same SHA1""" | ||
| 128 | + """:return: ``True`` if the objects do not have the same SHA1""" | ||
| 129 | 129 | if not hasattr(other, "binsha"): | |
| 130 | 130 | return True | |
| 131 | 131 | return self.binsha != other.binsha | |
@@ -199,8 +199,8 @@ def __init__( | |||
| 199 | 199 | 20 byte sha1. | |
| 200 | 200 | ||
| 201 | 201 | :param mode: | |
| 202 | - The stat compatible file mode as int, use the :mod:`stat` module to evaluate | ||
| 203 | - the information. | ||
| 202 | + The stat-compatible file mode as :class:`int`. | ||
| 203 | + Use the :mod:`stat` module to evaluate the information. | ||
| 204 | 204 | ||
| 205 | 205 | :param path: | |
| 206 | 206 | The path to the file in the file system, relative to the git repository | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,7 +27,8 @@ class Blob(base.IndexObject): | |||
| 27 | 27 | @property | |
| 28 | 28 | def mime_type(self) -> str: | |
| 29 | 29 | """ | |
| 30 | - :return: String describing the mime type of this file (based on the filename) | ||
| 30 | + :return: | ||
| 31 | + String describing the mime type of this file (based on the filename) | ||
| 31 | 32 | ||
| 32 | 33 | :note: | |
| 33 | 34 | Defaults to ``text/plain`` in case the actual file type is unknown. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -108,20 +108,20 @@ def __init__( | |||
| 108 | 108 | encoding: Union[str, None] = None, | |
| 109 | 109 | gpgsig: Union[str, None] = None, | |
| 110 | 110 | ) -> None: | |
| 111 | - R"""Instantiate a new :class:`Commit`. All keyword arguments taking None as | ||
| 111 | + R"""Instantiate a new :class:`Commit`. All keyword arguments taking ``None`` as | ||
| 112 | 112 | default will be implicitly set on first query. | |
| 113 | 113 | ||
| 114 | 114 | :param binsha: | |
| 115 | - 20 byte sha1 | ||
| 115 | + 20 byte sha1. | ||
| 116 | 116 | ||
| 117 | 117 | :param parents: tuple(Commit, ...) | |
| 118 | 118 | A tuple of commit ids or actual :class:`Commit`\s. | |
| 119 | 119 | ||
| 120 | 120 | :param tree: | |
| 121 | 121 | A :class:`~git.objects.tree.Tree` object. | |
| 122 | 122 | ||
| 123 | - :param author: :class:`~git.util.Actor` | ||
| 124 | - The author Actor object | ||
| 123 | + :param author: | ||
| 124 | + The author :class:`~git.util.Actor` object. | ||
| 125 | 125 | ||
| 126 | 126 | :param authored_date: int_seconds_since_epoch | |
| 127 | 127 | The authored DateTime - use :func:`time.gmtime` to convert it into a | |
@@ -130,8 +130,8 @@ def __init__( | |||
| 130 | 130 | :param author_tz_offset: int_seconds_west_of_utc | |
| 131 | 131 | The timezone that the `authored_date` is in. | |
| 132 | 132 | ||
| 133 | - :param committer: :class:`~git.util.Actor` | ||
| 134 | - The committer string. | ||
| 133 | + :param committer: | ||
| 134 | + The committer string, as an :class:`~git.util.Actor` object. | ||
| 135 | 135 | ||
| 136 | 136 | :param committed_date: int_seconds_since_epoch | |
| 137 | 137 | The committed DateTime - use :func:`time.gmtime` to convert it into a | |
@@ -209,7 +209,7 @@ def _calculate_sha_(cls, repo: "Repo", commit: "Commit") -> bytes: | |||
| 209 | 209 | return istream.binsha | |
| 210 | 210 | ||
| 211 | 211 | def replace(self, **kwargs: Any) -> "Commit": | |
| 212 | - """Create new commit object from existing commit object. | ||
| 212 | + """Create new commit object from an existing commit object. | ||
| 213 | 213 | ||
| 214 | 214 | Any values provided as keyword arguments will replace the corresponding | |
| 215 | 215 | attribute in the new object. | |
@@ -295,7 +295,7 @@ def iter_items( | |||
| 295 | 295 | R"""Find all commits matching the given criteria. | |
| 296 | 296 | ||
| 297 | 297 | :param repo: | |
| 298 | - The Repo | ||
| 298 | + The :class:`~git.repo.base.Repo`. | ||
| 299 | 299 | ||
| 300 | 300 | :param rev: | |
| 301 | 301 | Revision specifier, see git-rev-parse for viable options. | |
@@ -378,7 +378,7 @@ def stats(self) -> Stats: | |||
| 378 | 378 | ||
| 379 | 379 | @property | |
| 380 | 380 | def trailers(self) -> Dict[str, str]: | |
| 381 | - """Get the trailers of the message as a dictionary | ||
| 381 | + """Deprecated. Get the trailers of the message as a dictionary. | ||
| 382 | 382 | ||
| 383 | 383 | :note: This property is deprecated, please use either :attr:`trailers_list` or | |
| 384 | 384 | :attr:`trailers_dict``. | |
@@ -396,7 +396,7 @@ def trailers_list(self) -> List[Tuple[str, str]]: | |||
| 396 | 396 | Git messages can contain trailer information that are similar to RFC 822 e-mail | |
| 397 | 397 | headers (see: https://git-scm.com/docs/git-interpret-trailers). | |
| 398 | 398 | ||
| 399 | - This functions calls ``git interpret-trailers --parse`` onto the message to | ||
| 399 | + This function calls ``git interpret-trailers --parse`` onto the message to | ||
| 400 | 400 | extract the trailer information, returns the raw trailer data as a list. | |
| 401 | 401 | ||
| 402 | 402 | Valid message with trailer:: | |
@@ -444,7 +444,7 @@ def trailers_dict(self) -> Dict[str, List[str]]: | |||
| 444 | 444 | Git messages can contain trailer information that are similar to RFC 822 e-mail | |
| 445 | 445 | headers (see: https://git-scm.com/docs/git-interpret-trailers). | |
| 446 | 446 | ||
| 447 | - This functions calls ``git interpret-trailers --parse`` onto the message to | ||
| 447 | + This function calls ``git interpret-trailers --parse`` onto the message to | ||
| 448 | 448 | extract the trailer information. The key value pairs are stripped of leading and | |
| 449 | 449 | trailing whitespaces before they get saved into a dictionary. | |
| 450 | 450 | ||
@@ -481,7 +481,7 @@ def trailers_dict(self) -> Dict[str, List[str]]: | |||
| 481 | 481 | def _iter_from_process_or_stream(cls, repo: "Repo", proc_or_stream: Union[Popen, IO]) -> Iterator["Commit"]: | |
| 482 | 482 | """Parse out commit information into a list of :class:`Commit` objects. | |
| 483 | 483 | ||
| 484 | - We expect one-line per commit, and parse the actual commit information directly | ||
| 484 | + We expect one line per commit, and parse the actual commit information directly | ||
| 485 | 485 | from our lighting fast object database. | |
| 486 | 486 | ||
| 487 | 487 | :param proc: | |
@@ -555,11 +555,11 @@ def create_from_tree( | |||
| 555 | 555 | :param parent_commits: | |
| 556 | 556 | Optional :class:`Commit` objects to use as parents for the new commit. If | |
| 557 | 557 | empty list, the commit will have no parents at all and become a root commit. | |
| 558 | - If None, the current head commit will be the parent of the new commit | ||
| 558 | + If ``None``, the current head commit will be the parent of the new commit | ||
| 559 | 559 | object. | |
| 560 | 560 | ||
| 561 | 561 | :param head: | |
| 562 | - If True, the HEAD will be advanced to the new commit automatically. | ||
| 562 | + If ``True``, the HEAD will be advanced to the new commit automatically. | ||
| 563 | 563 | Otherwise the HEAD will remain pointing on the previous commit. This could | |
| 564 | 564 | lead to undesired results when diffing files. | |
| 565 | 565 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -128,7 +128,7 @@ def tree_entries_from_data(data: bytes) -> List[EntryTup]: | |||
| 128 | 128 | ||
| 129 | 129 | ||
| 130 | 130 | def _find_by_name(tree_data: MutableSequence[EntryTupOrNone], name: str, is_dir: bool, start_at: int) -> EntryTupOrNone: | |
| 131 | - """Return data entry matching the given name and tree mode or None. | ||
| 131 | + """Return data entry matching the given name and tree mode or ``None``. | ||
| 132 | 132 | ||
| 133 | 133 | Before the item is returned, the respective data item is set None in the `tree_data` | |
| 134 | 134 | list to mark it done. | |
@@ -172,7 +172,8 @@ def traverse_trees_recursive( | |||
| 172 | 172 | odb: "GitCmdObjectDB", tree_shas: Sequence[Union[bytes, None]], path_prefix: str | |
| 173 | 173 | ) -> List[Tuple[EntryTupOrNone, ...]]: | |
| 174 | 174 | """ | |
| 175 | - :return: list of list with entries according to the given binary tree-shas. | ||
| 175 | + :return: | ||
| 176 | + List of list with entries according to the given binary tree-shas. | ||
| 176 | 177 | ||
| 177 | 178 | The result is encoded in a list | |
| 178 | 179 | of n tuple|None per blob/commit, (n == len(tree_shas)), where: | |
@@ -181,12 +182,12 @@ def traverse_trees_recursive( | |||
| 181 | 182 | * [1] == mode as int | |
| 182 | 183 | * [2] == path relative to working tree root | |
| 183 | 184 | ||
| 184 | - The entry tuple is None if the respective blob/commit did not exist in the given | ||
| 185 | - tree. | ||
| 185 | + The entry tuple is ``None`` if the respective blob/commit did not exist in the | ||
| 186 | + given tree. | ||
| 186 | 187 | ||
| 187 | 188 | :param tree_shas: | |
| 188 | 189 | Iterable of shas pointing to trees. All trees must be on the same level. A | |
| 189 | - tree-sha may be None in which case None. | ||
| 190 | + tree-sha may be ``None`` in which case ``None``. | ||
| 190 | 191 | ||
| 191 | 192 | :param path_prefix: | |
| 192 | 193 | A prefix to be added to the returned paths on this level. | |
@@ -257,7 +258,8 @@ def traverse_trees_recursive( | |||
| 257 | 258 | ||
| 258 | 259 | def traverse_tree_recursive(odb: "GitCmdObjectDB", tree_sha: bytes, path_prefix: str) -> List[EntryTup]: | |
| 259 | 260 | """ | |
| 260 | - :return: list of entries of the tree pointed to by the binary `tree_sha`. | ||
| 261 | + :return: | ||
| 262 | + List of entries of the tree pointed to by the binary `tree_sha`. | ||
| 261 | 263 | ||
| 262 | 264 | An entry has the following format: | |
| 263 | 265 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -97,17 +97,17 @@ def add(self, sha: bytes, mode: int, name: str, force: bool = False) -> "TreeMod | |||
| 97 | 97 | ||
| 98 | 98 | If an item with the given name already exists, nothing will be done, but a | |
| 99 | 99 | :class:`ValueError` will be raised if the sha and mode of the existing item do | |
| 100 | - not match the one you add, unless `force` is True. | ||
| 100 | + not match the one you add, unless `force` is ``True``. | ||
| 101 | 101 | ||
| 102 | 102 | :param sha: | |
| 103 | 103 | The 20 or 40 byte sha of the item to add. | |
| 104 | 104 | ||
| 105 | 105 | :param mode: | |
| 106 | - int representing the stat compatible mode of the item. | ||
| 106 | + :class:`int` representing the stat-compatible mode of the item. | ||
| 107 | 107 | ||
| 108 | 108 | :param force: | |
| 109 | - If True, an item with your name and information will overwrite any existing | ||
| 110 | - item with the same name, no matter which information it has. | ||
| 109 | + If ``True``, an item with your name and information will overwrite any | ||
| 110 | + existing item with the same name, no matter which information it has. | ||
| 111 | 111 | ||
| 112 | 112 | :return: | |
| 113 | 113 | self | |
@@ -164,11 +164,10 @@ class Tree(IndexObject, git_diff.Diffable, util.Traversable, util.Serializable): | |||
| 164 | 164 | R"""Tree objects represent an ordered list of :class:`~git.objects.blob.Blob`\s and | |
| 165 | 165 | other :class:`~git.objects.tree.Tree`\s. | |
| 166 | 166 | ||
| 167 | - Tree as a list:: | ||
| 167 | + Tree as a list: | ||
| 168 | 168 | ||
| 169 | - Access a specific blob using the ``tree['filename']`` notation. | ||
| 170 | - | ||
| 171 | - You may likewise access by index, like ``blob = tree[0]``. | ||
| 169 | + * Access a specific blob using the ``tree['filename']`` notation. | ||
| 170 | + * You may likewise access by index, like ``blob = tree[0]``. | ||
| 172 | 171 | """ | |
| 173 | 172 | ||
| 174 | 173 | type: Literal["tree"] = "tree" | |
@@ -235,7 +234,7 @@ def join(self, file: str) -> IndexObjUnion: | |||
| 235 | 234 | or :class:`~git.objects.submodule.base.Submodule` | |
| 236 | 235 | ||
| 237 | 236 | :raise KeyError: | |
| 238 | - If the given file or tree does not exist in tree. | ||
| 237 | + If the given file or tree does not exist in this tree. | ||
| 239 | 238 | """ | |
| 240 | 239 | msg = "Blob or Tree named %r not found" | |
| 241 | 240 | if "/" in file: | |
@@ -275,12 +274,12 @@ def __truediv__(self, file: str) -> IndexObjUnion: | |||
| 275 | 274 | ||
| 276 | 275 | @property | |
| 277 | 276 | def trees(self) -> List["Tree"]: | |
| 278 | - """:return: list(Tree, ...) list of trees directly below this tree""" | ||
| 277 | + """:return: list(Tree, ...) List of trees directly below this tree""" | ||
| 279 | 278 | return [i for i in self if i.type == "tree"] | |
| 280 | 279 | ||
| 281 | 280 | @property | |
| 282 | 281 | def blobs(self) -> List[Blob]: | |
| 283 | - """:return: list(Blob, ...) list of blobs directly below this tree""" | ||
| 282 | + """:return: list(Blob, ...) List of blobs directly below this tree""" | ||
| 284 | 283 | return [i for i in self if i.type == "blob"] | |
| 285 | 284 | ||
| 286 | 285 | @property | |
@@ -342,7 +341,7 @@ def list_traverse(self, *args: Any, **kwargs: Any) -> IterableList[IndexObjUnion | |||
| 342 | 341 | :class:`~git.util.IterableList`IterableList with the results of the | |
| 343 | 342 | traversal as produced by :meth:`traverse` | |
| 344 | 343 | ||
| 345 | - Tree -> IterableList[Union['Submodule', 'Tree', 'Blob']] | ||
| 344 | + Tree -> IterableList[Union[Submodule, Tree, Blob]] | ||
| 346 | 345 | """ | |
| 347 | 346 | return super()._list_traverse(*args, **kwargs) | |
| 348 | 347 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -95,9 +95,9 @@ def mode_str_to_int(modestr: Union[bytes, str]) -> int: | |||
| 95 | 95 | used. | |
| 96 | 96 | ||
| 97 | 97 | :return: | |
| 98 | - String identifying a mode compatible to the mode methods ids of the stat module | ||
| 99 | - regarding the rwx permissions for user, group and other, special flags and file | ||
| 100 | - system flags, such as whether it is a symlink. | ||
| 98 | + String identifying a mode compatible to the mode methods ids of the :mod:`stat` | ||
| 99 | + module regarding the rwx permissions for user, group and other, special flags | ||
| 100 | + and file system flags, such as whether it is a symlink. | ||
| 101 | 101 | """ | |
| 102 | 102 | mode = 0 | |
| 103 | 103 | for iteration, char in enumerate(reversed(modestr[-6:])): | |
@@ -401,7 +401,7 @@ class Tree:: (cls, Tree) -> Tuple[Tree, ...] | |||
| 401 | 401 | def list_traverse(self, *args: Any, **kwargs: Any) -> Any: | |
| 402 | 402 | """Traverse self and collect all items found. | |
| 403 | 403 | ||
| 404 | - Calling this directly only the abstract base class, including via a ``super()`` | ||
| 404 | + Calling this directly on the abstract base class, including via a ``super()`` | ||
| 405 | 405 | proxy, is deprecated. Only overridden implementations should be called. | |
| 406 | 406 | """ | |
| 407 | 407 | warnings.warn( | |
@@ -418,12 +418,13 @@ def _list_traverse( | |||
| 418 | 418 | ) -> IterableList[Union["Commit", "Submodule", "Tree", "Blob"]]: | |
| 419 | 419 | """Traverse self and collect all items found. | |
| 420 | 420 | ||
| 421 | - :return: :class:`~git.util.IterableList` with the results of the traversal as | ||
| 421 | + :return: | ||
| 422 | + :class:`~git.util.IterableList` with the results of the traversal as | ||
| 422 | 423 | produced by :meth:`traverse`:: | |
| 423 | 424 | ||
| 424 | - Commit -> IterableList["Commit"] | ||
| 425 | - Submodule -> IterableList["Submodule"] | ||
| 426 | - Tree -> IterableList[Union["Submodule", "Tree", "Blob"]] | ||
| 425 | + Commit -> IterableList[Commit] | ||
| 426 | + Submodule -> IterableList[Submodule] | ||
| 427 | + Tree -> IterableList[Union[Submodule, Tree, Blob]] | ||
| 427 | 428 | """ | |
| 428 | 429 | # Commit and Submodule have id.__attribute__ as IterableObj. | |
| 429 | 430 | # Tree has id.__attribute__ inherited from IndexObject. | |
@@ -476,32 +477,32 @@ def _traverse( | |||
| 476 | 477 | """Iterator yielding items found when traversing self. | |
| 477 | 478 | ||
| 478 | 479 | :param predicate: | |
| 479 | - A function ``f(i,d)`` that returns False if item i at depth ``d`` should not | ||
| 480 | - be included in the result. | ||
| 480 | + A function ``f(i,d)`` that returns ``False`` if item i at depth ``d`` should | ||
| 481 | + not be included in the result. | ||
| 481 | 482 | ||
| 482 | 483 | :param prune: | |
| 483 | - A function ``f(i,d)`` that returns True if the search should stop at item | ||
| 484 | - ``i`` at depth ``d``. Item ``i`` will not be returned. | ||
| 484 | + A function ``f(i,d)`` that returns ``True`` if the search should stop at | ||
| 485 | + item ``i`` at depth ``d``. Item ``i`` will not be returned. | ||
| 485 | 486 | ||
| 486 | 487 | :param depth: | |
| 487 | 488 | Defines at which level the iteration should not go deeper if -1, there is no | |
| 488 | 489 | limit if 0, you would effectively only get self, the root of the iteration | |
| 489 | 490 | i.e. if 1, you would only get the first level of predecessors/successors. | |
| 490 | 491 | ||
| 491 | 492 | :param branch_first: | |
| 492 | - If True, items will be returned branch first, otherwise depth first. | ||
| 493 | + If ``True``, items will be returned branch first, otherwise depth first. | ||
| 493 | 494 | ||
| 494 | 495 | :param visit_once: | |
| 495 | - If True, items will only be returned once, although they might be | ||
| 496 | + If ``True``, items will only be returned once, although they might be | ||
| 496 | 497 | encountered several times. Loops are prevented that way. | |
| 497 | 498 | ||
| 498 | 499 | :param ignore_self: | |
| 499 | - If True, self will be ignored and automatically pruned from the result. | ||
| 500 | - Otherwise it will be the first item to be returned. If `as_edge` is True, the | ||
| 501 | - source of the first edge is None | ||
| 500 | + If ``True``, self will be ignored and automatically pruned from the result. | ||
| 501 | + Otherwise it will be the first item to be returned. If `as_edge` is | ||
| 502 | + ``True``, the source of the first edge is ``None``. | ||
| 502 | 503 | ||
| 503 | 504 | :param as_edge: | |
| 504 | - If True, return a pair of items, first being the source, second the | ||
| 505 | + If ``True``, return a pair of items, first being the source, second the | ||
| 505 | 506 | destination, i.e. tuple(src, dest) with the edge spanning from source to | |
| 506 | 507 | destination. | |
| 507 | 508 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments