| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent a5a1b2c commit 018ebaf
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -102,9 +102,9 @@ class BlameEntry(NamedTuple): | |||
| 102 | 102 | ||
| 103 | 103 | ||
| 104 | 104 | class Repo: | |
| 105 | - """Represents a git repository and allows you to query references, | ||
| 106 | - gather commit information, generate diffs, create and clone repositories, and query | ||
| 107 | - the log. | ||
| 105 | + """Represents a git repository and allows you to query references, father | ||
| 106 | + commit information, generate diffs, create and clone repositories, and query the | ||
| 107 | + log. | ||
| 108 | 108 | ||
| 109 | 109 | The following attributes are worth using: | |
| 110 | 110 | ||
@@ -188,16 +188,18 @@ def __init__( | |||
| 188 | 188 | repo = Repo(R"C:\Users\mtrier\Development\git-python\.git") | |
| 189 | 189 | ||
| 190 | 190 | - In *Cygwin*, `path` may be a ``cygdrive/...`` prefixed path. | |
| 191 | - - If `path` is None or an empty string, :envvar:`GIT_DIR` is used. If that | ||
| 192 | - environment variable is absent or empty, the current directory is used. | ||
| 191 | + - If `path` is ``None`` or an empty string, :envvar:`GIT_DIR` is used. If | ||
| 192 | + that environment variable is absent or empty, the current directory is | ||
| 193 | + used. | ||
| 193 | 194 | ||
| 194 | 195 | :param odbt: | |
| 195 | 196 | Object DataBase type - a type which is constructed by providing the | |
| 196 | 197 | directory containing the database objects, i.e. ``.git/objects``. It will be | |
| 197 | - used to access all object data | ||
| 198 | + used to access all object data. | ||
| 198 | 199 | ||
| 199 | 200 | :param search_parent_directories: | |
| 200 | - If True, all parent directories will be searched for a valid repo as well. | ||
| 201 | + If ``True``, all parent directories will be searched for a valid repo as | ||
| 202 | + well. | ||
| 201 | 203 | ||
| 202 | 204 | Please note that this was the default behaviour in older versions of | |
| 203 | 205 | GitPython, which is considered a bug though. | |
@@ -372,7 +374,7 @@ def working_tree_dir(self) -> Optional[PathLike]: | |||
| 372 | 374 | """ | |
| 373 | 375 | :return: | |
| 374 | 376 | The working tree directory of our git repository. | |
| 375 | - If this is a bare repository, None is returned. | ||
| 377 | + If this is a bare repository, ``None`` is returned. | ||
| 376 | 378 | """ | |
| 377 | 379 | return self._working_tree_dir | |
| 378 | 380 | ||
@@ -387,7 +389,7 @@ def common_dir(self) -> PathLike: | |||
| 387 | 389 | ||
| 388 | 390 | @property | |
| 389 | 391 | def bare(self) -> bool: | |
| 390 | - """:return: True if the repository is bare""" | ||
| 392 | + """:return: ``True`` if the repository is bare""" | ||
| 391 | 393 | return self._bare | |
| 392 | 394 | ||
| 393 | 395 | @property | |
@@ -450,7 +452,7 @@ def remotes(self) -> "IterableList[Remote]": | |||
| 450 | 452 | def remote(self, name: str = "origin") -> "Remote": | |
| 451 | 453 | """:return: The remote with the specified name | |
| 452 | 454 | ||
| 453 | - :raise ValueError | ||
| 455 | + :raise ValueError: | ||
| 454 | 456 | If no remote with such a name exists. | |
| 455 | 457 | """ | |
| 456 | 458 | r = Remote(self, name) | |
@@ -494,10 +496,13 @@ def create_submodule(self, *args: Any, **kwargs: Any) -> Submodule: | |||
| 494 | 496 | return Submodule.add(self, *args, **kwargs) | |
| 495 | 497 | ||
| 496 | 498 | def iter_submodules(self, *args: Any, **kwargs: Any) -> Iterator[Submodule]: | |
| 497 | - """An iterator yielding Submodule instances, see Traversable interface | ||
| 498 | - for a description of args and kwargs. | ||
| 499 | + """An iterator yielding Submodule instances. | ||
| 499 | 500 | ||
| 500 | - :return: Iterator | ||
| 501 | + See the `~git.objects.util.Traversable` interface for a description of `args` | ||
| 502 | + and `kwargs`. | ||
| 503 | + | ||
| 504 | + :return: | ||
| 505 | + Iterator | ||
| 501 | 506 | """ | |
| 502 | 507 | return RootModule(self).traverse(*args, **kwargs) | |
| 503 | 508 | ||
@@ -554,7 +559,8 @@ def create_head( | |||
| 554 | 559 | ) -> "Head": | |
| 555 | 560 | """Create a new head within the repository. | |
| 556 | 561 | ||
| 557 | - :note: For more documentation, please see the | ||
| 562 | + :note: | ||
| 563 | + For more documentation, please see the | ||
| 558 | 564 | :meth:`Head.create <git.refs.head.Head.create>` method. | |
| 559 | 565 | ||
| 560 | 566 | :return: | |
@@ -648,7 +654,7 @@ def config_reader( | |||
| 648 | 654 | configuration files. | |
| 649 | 655 | ||
| 650 | 656 | :param config_level: | |
| 651 | - For possible values, see the :meth:`config_writer` method. If None, all | ||
| 657 | + For possible values, see the :meth:`config_writer` method. If ``None``, all | ||
| 652 | 658 | applicable levels will be used. Specify a level in case you know which file | |
| 653 | 659 | you wish to read to prevent reading multiple files. | |
| 654 | 660 | ||
@@ -744,7 +750,7 @@ def iter_commits( | |||
| 744 | 750 | ||
| 745 | 751 | :param rev: | |
| 746 | 752 | Revision specifier, see ``git rev-parse`` for viable options. | |
| 747 | - If None, the active branch will be used. | ||
| 753 | + If ``None``, the active branch will be used. | ||
| 748 | 754 | ||
| 749 | 755 | :param paths: | |
| 750 | 756 | An optional path or a list of paths. If set, only commits that include the | |
@@ -759,7 +765,7 @@ def iter_commits( | |||
| 759 | 765 | ``"revA...revB"`` revision specifier. | |
| 760 | 766 | ||
| 761 | 767 | :return: | |
| 762 | - Iterator of :class:`~git.objects.commit.Commit` objects | ||
| 768 | + Iterator of :class:`~git.objects.commit.Commit` objects | ||
| 763 | 769 | """ | |
| 764 | 770 | if rev is None: | |
| 765 | 771 | rev = self.head.commit | |
@@ -819,7 +825,7 @@ def is_ancestor(self, ancestor_rev: "Commit", rev: "Commit") -> bool: | |||
| 819 | 825 | Rev to test against `ancestor_rev`. | |
| 820 | 826 | ||
| 821 | 827 | :return: | |
| 822 | - True if `ancestor_rev` is an ancestor to `rev`. | ||
| 828 | + ``True`` if `ancestor_rev` is an ancestor to `rev`. | ||
| 823 | 829 | """ | |
| 824 | 830 | try: | |
| 825 | 831 | self.git.merge_base(ancestor_rev, rev, is_ancestor=True) | |
@@ -923,9 +929,9 @@ def is_dirty( | |||
| 923 | 929 | ) -> bool: | |
| 924 | 930 | """ | |
| 925 | 931 | :return: | |
| 926 | - True if the repository is considered dirty. By default it will react like a | ||
| 927 | - git-status without untracked files, hence it is dirty if the index or the | ||
| 928 | - working copy have changes. | ||
| 932 | + ``True`` if the repository is considered dirty. By default it will react | ||
| 933 | + like a git-status without untracked files, hence it is dirty if the index or | ||
| 934 | + the working copy have changes. | ||
| 929 | 935 | """ | |
| 930 | 936 | if self._bare: | |
| 931 | 937 | # Bare repositories with no associated working directory are | |
@@ -1036,9 +1042,9 @@ def blame_incremental(self, rev: str | HEAD | None, file: str, **kwargs: Any) -> | |||
| 1036 | 1042 | stream of :class:`BlameEntry` tuples. | |
| 1037 | 1043 | ||
| 1038 | 1044 | :param rev: | |
| 1039 | - Revision specifier. If None, the blame will include all the latest | ||
| 1040 | - uncommitted changes. Otherwise, anything successfully parsed by ``git | ||
| 1041 | - rev-parse`` is a valid option. | ||
| 1045 | + Revision specifier. If ``None``, the blame will include all the latest | ||
| 1046 | + uncommitted changes. Otherwise, anything successfully parsed by | ||
| 1047 | + ``git rev-parse`` is a valid option. | ||
| 1042 | 1048 | ||
| 1043 | 1049 | :return: | |
| 1044 | 1050 | Lazy iterator of :class:`BlameEntry` tuples, where the commit indicates the | |
@@ -1132,9 +1138,9 @@ def blame( | |||
| 1132 | 1138 | """The blame information for the given file at the given revision. | |
| 1133 | 1139 | ||
| 1134 | 1140 | :param rev: | |
| 1135 | - Revision specifier. If None, the blame will include all the latest | ||
| 1141 | + Revision specifier. If ``None``, the blame will include all the latest | ||
| 1136 | 1142 | uncommitted changes. Otherwise, anything successfully parsed by | |
| 1137 | - git-rev-parse is a valid option. | ||
| 1143 | + ``git rev-parse`` is a valid option. | ||
| 1138 | 1144 | ||
| 1139 | 1145 | :return: | |
| 1140 | 1146 | list: [git.Commit, list: [<line>]] | |
@@ -1286,9 +1292,9 @@ def init( | |||
| 1286 | 1292 | """Initialize a git repository at the given path if specified. | |
| 1287 | 1293 | ||
| 1288 | 1294 | :param path: | |
| 1289 | - The full path to the repo (traditionally ends with ``/<name>.git``). | ||
| 1290 | - Or None, in which case the repository will be created in the current working | ||
| 1291 | - directory. | ||
| 1295 | + The full path to the repo (traditionally ends with ``/<name>.git``). Or | ||
| 1296 | + ``None``, in which case the repository will be created in the current | ||
| 1297 | + working directory. | ||
| 1292 | 1298 | ||
| 1293 | 1299 | :param mkdir: | |
| 1294 | 1300 | If specified, will create the repository directory if it doesn't already | |
@@ -1445,7 +1451,7 @@ def clone( | |||
| 1445 | 1451 | Allow unsafe options to be used, like ``--upload-pack``. | |
| 1446 | 1452 | ||
| 1447 | 1453 | :param kwargs: | |
| 1448 | - * odbt = ObjectDatabase Type, allowing to determine the object database | ||
| 1454 | + * ``odbt`` = ObjectDatabase Type, allowing to determine the object database | ||
| 1449 | 1455 | implementation used by the returned Repo instance. | |
| 1450 | 1456 | * All remaining keyword arguments are given to the ``git clone`` command. | |
| 1451 | 1457 | ||
@@ -1547,9 +1553,9 @@ def archive( | |||
| 1547 | 1553 | :param kwargs: | |
| 1548 | 1554 | Additional arguments passed to ``git archive``: | |
| 1549 | 1555 | ||
| 1550 | - * Use the 'format' argument to define the kind of format. Use specialized | ||
| 1556 | + * Use the ``format`` argument to define the kind of format. Use specialized | ||
| 1551 | 1557 | ostreams to write any format supported by Python. | |
| 1552 | - * You may specify the special **path** keyword, which may either be a | ||
| 1558 | + * You may specify the special ``path`` keyword, which may either be a | ||
| 1553 | 1559 | repository-relative path to a directory or file to place into the archive, | |
| 1554 | 1560 | or a list or tuple of multiple paths. | |
| 1555 | 1561 | ||
@@ -1581,7 +1587,7 @@ def has_separate_working_tree(self) -> bool: | |||
| 1581 | 1587 | to. | |
| 1582 | 1588 | ||
| 1583 | 1589 | :note: | |
| 1584 | - Bare repositories will always return False here. | ||
| 1590 | + Bare repositories will always return ``False`` here. | ||
| 1585 | 1591 | """ | |
| 1586 | 1592 | if self.bare: | |
| 1587 | 1593 | return False | |
@@ -1601,7 +1607,7 @@ def currently_rebasing_on(self) -> Commit | None: | |||
| 1601 | 1607 | :return: | |
| 1602 | 1608 | The commit which is currently being replayed while rebasing. | |
| 1603 | 1609 | ||
| 1604 | - None if we are not currently rebasing. | ||
| 1610 | + ``None`` if we are not currently rebasing. | ||
| 1605 | 1611 | """ | |
| 1606 | 1612 | if self.git_dir: | |
| 1607 | 1613 | rebase_head_file = osp.join(self.git_dir, "REBASE_HEAD") | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -128,7 +128,7 @@ def find_submodule_git_dir(d: "PathLike") -> Optional["PathLike"]: | |||
| 128 | 128 | def short_to_long(odb: "GitCmdObjectDB", hexsha: str) -> Optional[bytes]: | |
| 129 | 129 | """ | |
| 130 | 130 | :return: | |
| 131 | - Long hexadecimal sha1 from the given less than 40 byte hexsha or None if no | ||
| 131 | + Long hexadecimal sha1 from the given less than 40 byte hexsha, or ``None`` if no | ||
| 132 | 132 | candidate could be found. | |
| 133 | 133 | ||
| 134 | 134 | :param hexsha: | |
@@ -150,7 +150,7 @@ def name_to_object( | |||
| 150 | 150 | references are supported. | |
| 151 | 151 | ||
| 152 | 152 | :param return_ref: | |
| 153 | - If True, and name specifies a reference, we will return the reference | ||
| 153 | + If ``True``, and name specifies a reference, we will return the reference | ||
| 154 | 154 | instead of the object. Otherwise it will raise `~gitdb.exc.BadObject` o | |
| 155 | 155 | `~gitdb.exc.BadName`. | |
| 156 | 156 | """ | |
@@ -202,7 +202,7 @@ def name_to_object( | |||
| 202 | 202 | ||
| 203 | 203 | ||
| 204 | 204 | def deref_tag(tag: "Tag") -> "TagObject": | |
| 205 | - """Recursively dereference a tag and return the resulting object""" | ||
| 205 | + """Recursively dereference a tag and return the resulting object.""" | ||
| 206 | 206 | while True: | |
| 207 | 207 | try: | |
| 208 | 208 | tag = tag.object | |
@@ -213,7 +213,7 @@ def deref_tag(tag: "Tag") -> "TagObject": | |||
| 213 | 213 | ||
| 214 | 214 | ||
| 215 | 215 | def to_commit(obj: Object) -> Union["Commit", "TagObject"]: | |
| 216 | - """Convert the given object to a commit if possible and return it""" | ||
| 216 | + """Convert the given object to a commit if possible and return it.""" | ||
| 217 | 217 | if obj.type == "tag": | |
| 218 | 218 | obj = deref_tag(obj) | |
| 219 | 219 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments