Skip to content

Commit a957ae7

Browse files
committed
Use the :exc: role for exceptions
Rather than the more general :class: role that was used for them.
1 parent 6626117 commit a957ae7

File tree

11 files changed

+20
-20
lines changed

11 files changed

+20
-20
lines changed

Diff for: git/db.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def partial_to_complete_sha_hex(self, partial_hexsha: str) -> bytes:
5959
:raise gitdb.exc.BadObject:
6060
6161
:note:
62-
Currently we only raise :class:`~gitdb.exc.BadObject` as git does not
62+
Currently we only raise :exc:`~gitdb.exc.BadObject` as git does not
6363
communicate ambiguous objects separately.
6464
"""
6565
try:

Diff for: git/index/base.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -550,8 +550,8 @@ def resolve_blobs(self, iter_blobs: Iterator[Blob]) -> "IndexFile":
550550
This will effectively remove the index entries of the respective path at all
551551
non-null stages and add the given blob as new stage null blob.
552552
553-
For each path there may only be one blob, otherwise a :class:`ValueError` will
554-
be raised claiming the path is already at stage 0.
553+
For each path there may only be one blob, otherwise a :exc:`ValueError` will be
554+
raised claiming the path is already at stage 0.
555555
556556
:raise ValueError:
557557
If one of the blobs already existed at stage 0.
@@ -644,8 +644,8 @@ def _process_diff_args(
644644
def _to_relative_path(self, path: PathLike) -> PathLike:
645645
"""
646646
:return:
647-
Version of path relative to our git directory or raise :class:`ValueError`
648-
if it is not within our git directory.
647+
Version of path relative to our git directory or raise :exc:`ValueError` if
648+
it is not within our git directory.
649649
650650
:raise ValueError:
651651
"""
@@ -1215,7 +1215,7 @@ def checkout(
12151215
:param force:
12161216
If ``True``, existing files will be overwritten even if they contain local
12171217
modifications.
1218-
If ``False``, these will trigger a :class:`~git.exc.CheckoutError`.
1218+
If ``False``, these will trigger a :exc:`~git.exc.CheckoutError`.
12191219
12201220
:param fprogress:
12211221
See :meth:`IndexFile.add` for signature and explanation.

Diff for: git/objects/submodule/util.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def mkhead(repo: "Repo", path: PathLike) -> "Head":
5252

5353
def find_first_remote_branch(remotes: Sequence["Remote"], branch_name: str) -> "RemoteReference":
5454
"""Find the remote branch matching the name of the given branch or raise
55-
:class:`~git.exc.InvalidGitRepositoryError`."""
55+
:exc:`~git.exc.InvalidGitRepositoryError`."""
5656
for remote in remotes:
5757
try:
5858
return remote.refs[branch_name]

Diff for: git/objects/tree.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ def add(self, sha: bytes, mode: int, name: str, force: bool = False) -> "TreeMod
100100
"""Add the given item to the tree.
101101
102102
If an item with the given name already exists, nothing will be done, but a
103-
:class:`ValueError` will be raised if the sha and mode of the existing item do
104-
not match the one you add, unless `force` is ``True``.
103+
:exc:`ValueError` will be raised if the sha and mode of the existing item do not
104+
match the one you add, unless `force` is ``True``.
105105
106106
:param sha:
107107
The 20 or 40 byte sha of the item to add.

Diff for: git/refs/head.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def checkout(self, force: bool = False, **kwargs: Any) -> Union["HEAD", "Head"]:
247247
248248
:param force:
249249
If ``True``, changes to the index and the working tree will be discarded.
250-
If ``False``, :class:`~git.exc.GitCommandError` will be raised in that
250+
If ``False``, :exc:`~git.exc.GitCommandError` will be raised in that
251251
situation.
252252
253253
:param kwargs:

Diff for: git/refs/reference.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222

2323
def require_remote_ref_path(func: Callable[..., _T]) -> Callable[..., _T]:
24-
"""A decorator raising :class:`ValueError` if we are not a valid remote, based on the
24+
"""A decorator raising :exc:`ValueError` if we are not a valid remote, based on the
2525
path."""
2626

2727
def wrapper(self: T_References, *args: Any) -> _T:

Diff for: git/refs/remote.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,5 @@ def delete(cls, repo: "Repo", *refs: "RemoteReference", **kwargs: Any) -> None:
7676

7777
@classmethod
7878
def create(cls, *args: Any, **kwargs: Any) -> NoReturn:
79-
"""Raise :class:`TypeError`. Defined so the ``create`` method is disabled."""
79+
"""Raise :exc:`TypeError`. Defined so the ``create`` method is disabled."""
8080
raise TypeError("Cannot explicitly create remote references")

Diff for: git/refs/symbolic.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ def create(
738738
739739
:param force:
740740
If ``True``, force creation even if a symbolic reference with that name
741-
already exists. Raise :class:`OSError` otherwise.
741+
already exists. Raise :exc:`OSError` otherwise.
742742
743743
:param logmsg:
744744
If not ``None``, the message to append to the reflog.

Diff for: git/repo/fun.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ def name_to_object(repo: "Repo", name: str, return_ref: bool = False) -> Union[A
153153
154154
:param return_ref:
155155
If ``True``, and name specifies a reference, we will return the reference
156-
instead of the object. Otherwise it will raise :class:`~gitdb.exc.BadObject` or
157-
:class:`~gitdb.exc.BadName`.
156+
instead of the object. Otherwise it will raise :exc:`~gitdb.exc.BadObject` or
157+
:exc:`~gitdb.exc.BadName`.
158158
"""
159159
hexsha: Union[None, str, bytes] = None
160160

Diff for: git/types.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def assert_never(inp: NoReturn, raise_error: bool = True, exc: Union[Exception,
190190
mismatch and cause a mypy error.
191191
192192
:param raise_error:
193-
If ``True``, will also raise :class:`ValueError` with a general "unhandled
193+
If ``True``, will also raise :exc:`ValueError` with a general "unhandled
194194
literal" message, or the exception object passed as `exc`.
195195
196196
:param exc:

Diff for: git/util.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ def _read_win_env_flag(name: str, default: bool) -> bool:
158158

159159

160160
def unbare_repo(func: Callable[..., T]) -> Callable[..., T]:
161-
"""Methods with this decorator raise
162-
:class:`~git.exc.InvalidGitRepositoryError` if they encounter a bare repository."""
161+
"""Methods with this decorator raise :exc:`~git.exc.InvalidGitRepositoryError` if
162+
they encounter a bare repository."""
163163

164164
from .exc import InvalidGitRepositoryError
165165

@@ -1094,8 +1094,8 @@ def __init__(
10941094
self._max_block_time = max_block_time_s
10951095

10961096
def _obtain_lock(self) -> None:
1097-
"""This method blocks until it obtained the lock, or raises :class:`IOError` if
1098-
it ran out of time or if the parent directory was not available anymore.
1097+
"""This method blocks until it obtained the lock, or raises :exc:`IOError` if it
1098+
ran out of time or if the parent directory was not available anymore.
10991099
11001100
If this method returns, you are guaranteed to own the lock.
11011101
"""

0 commit comments

Comments
 (0)