Skip to content

Commit

Permalink
gh-35955: links for Python standard errors using class role in src/doc
Browse files Browse the repository at this point in the history
<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes #1234" use "Introduce new method to
calculate 1+1"
-->
<!-- Describe your changes here in detail -->

In `src/doc`, Let us use `:class:...Error` to make links to python's own
documentation

<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes #12345". -->
<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->

- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
- [ ] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- #12345: short description why this is a dependency
- #34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

URL: #35955
Reported by: Frédéric Chapoton
Reviewer(s): Matthias Köppe
  • Loading branch information
Release Manager committed Jul 19, 2023
2 parents 25eb671 + 9d12aa5 commit 9852094
Show file tree
Hide file tree
Showing 15 changed files with 24 additions and 22 deletions.
6 changes: 3 additions & 3 deletions build/pkgs/configure/checksums.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tarball=configure-VERSION.tar.gz
sha1=354d134d4bcdedba55ed2bcb1eac6ea33146ca15
md5=2143a40fdce9ed5cb8b29a6232be4789
cksum=304076036
sha1=556e5e5a03146223da4c540532f2744b5f020aae
md5=43e504a3833767059afc054b8be73a1e
cksum=3293099866
2 changes: 1 addition & 1 deletion build/pkgs/configure/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
37fa2da8e75716793e91c384237a5e9f67ed83e8
68e7d744a31fa469d9b2746353041faa409877d2
2 changes: 1 addition & 1 deletion src/doc/de/tutorial/interactive_shell.rst
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ Fehlerbehandlung
Wenn irgendetwas schief geht, werden Sie normalerweise eine
Python-Fehlermeldung sehen. Python macht sogar einen Vorschlag, was den
Fehler ausgelöst hat. Oft sehen Sie den Namen der Fehlermeldung,
z.B. ``NameError`` oder ``ValueError`` (vgl. Python Library Reference
z.B. :class:`NameError` oder :class:`ValueError` (vgl. Python Library Reference
[PyLR]_ für eine komplette Liste der Fehlermeldungen). Zum Beispiel:

.. skip
Expand Down
4 changes: 2 additions & 2 deletions src/doc/en/faq/faq-usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ issue these commands:
import _tkinter
import Tkinter
If they do not raise an ``ImportError`` then it worked.
If they do not raise an :class:`ImportError` then it worked.


How do I import Sage into a Python script?
Expand Down Expand Up @@ -663,7 +663,7 @@ With objects a and b and a function f, I accidentally typed f(a) = b instead of
It is because of how functions are defined in Sage with the
``f(x) = expr`` notation using the preparser. Also notice that if you
make this mistake inside of an ``if`` statement, you will get a
``SyntaxError`` before anything else goes wrong. So in this case,
:class:`SyntaxError` before anything else goes wrong. So in this case,
there is no problem.


Expand Down
2 changes: 1 addition & 1 deletion src/doc/en/installation/source.rst
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ If
sage: import _tkinter
sage: import Tkinter
does not raise an ``ImportError``, then it worked.
does not raise an :class:`ImportError`, then it worked.

.. _build-from-source-step-by-step:

Expand Down
2 changes: 1 addition & 1 deletion src/doc/en/reference/coercion/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ Methods to implement
this case ``r * s`` gets handled as ``r._act_on_(s, True)`` or
``s._acted_upon_(r, False)`` and ``s * r`` as ``r._act_on_(s, False)`` or
``s._acted_upon_(r, True)``. There is no constraint on the type or parents
of objects passed to these methods; raise a ``TypeError`` or ``ValueError``
of objects passed to these methods; raise a :class:`TypeError` or :class:`ValueError`
if the wrong kind of object is passed in to indicate the action is not
appropriate here.

Expand Down
4 changes: 2 additions & 2 deletions src/doc/en/thematic_tutorials/tutorial-programming-python.rst
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ indentation. Most of the time a new block is introduced by

.. CODE-BLOCK:: python
raise <ErrorType> [, error message]
raise <ErrorType>[("error message")]
Usual errors include ``ValueError`` and ``TypeError``.
Usual errors include :class:`ValueError` and :class:`TypeError`.

Functions
=========
Expand Down
2 changes: 1 addition & 1 deletion src/doc/en/tutorial/interactive_shell.rst
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ Errors and Exceptions
When something goes wrong, you will usually see a Python
"exception". Python even tries to suggest what raised the
exception. Often you see the name of the exception, e.g.,
``NameError`` or ``ValueError`` (see the Python Library Reference [PyLR]_
:class:`NameError` or :class:`ValueError` (see the Python Library Reference [PyLR]_
for a complete list of exceptions). For example,

.. skip
Expand Down
2 changes: 1 addition & 1 deletion src/doc/en/tutorial/tour_algebra.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ functions are defined to be ``var(...)``. As an example:
sage: diff(sin(u), u)
cos(u)

If you get a ``NameError``, check to see if you misspelled something,
If you get a :class:`NameError`, check to see if you misspelled something,
or forgot to define a variable with ``var(...)``.


Expand Down
2 changes: 1 addition & 1 deletion src/doc/en/tutorial/tour_functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ These functions can be plotted, but not differentiated or integrated.
Graphics object consisting of 1 graphics primitive

In the last line, note the syntax. Using ``plot(f(z), 0, 2)`` instead
will give a ``NameError``, because ``z`` is a dummy variable in the
will give a :class:`NameError`, because ``z`` is a dummy variable in the
definition of ``f`` and is not defined outside of that definition.
In order to be able to use ``f(z)`` in the plot command, ``z``
(or whatever is desired) needs to be defined as a variable. We
Expand Down
5 changes: 3 additions & 2 deletions src/doc/fr/tutorial/interactive_shell.rst
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,9 @@ Erreurs et exceptions
Quand quelque chose ne marche pas, cela se manifeste habituellement par
une « exception » Python. Python essaie de plus de donner une idée de ce
qui a pu déclencher l'exception. Bien souvent, il affiche le nom de
l'exception (par exemple ``NameError`` ou ``ValueError``, voir le manuel
de référence de la bibliothèque de Python [PyLR]_ pour une liste complète). Par exemple :
l'exception (par exemple :class:`NameError` ou :class:`ValueError`, voir
le manuel de référence de la bibliothèque de Python [PyLR]_ pour une liste
complète). Par exemple :

.. skip
Expand Down
4 changes: 2 additions & 2 deletions src/doc/it/faq/faq-usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ lancia i seguenti comandi dall'interfaccia a riga di comando di Sage::
import _tkinter
import Tkinter

Se non ti viene segnalato alcun errore di ``ImportError``
Se non ti viene segnalato alcun errore di :class:`ImportError`
allora il problema è risolto.


Expand Down Expand Up @@ -662,7 +662,7 @@ Con degli oggetti "a" e "b" ed una funzione "f" ho digitato accidentalmente "f(a

Questo è dovuto a come sono definite le funzioni in Sage con la
notazione ``f(x)=expr`` usando il preparser. Nota anche che se fai
quest'errore in un costrutto ``if``, avrai un errore ``SyntaxError``
quest'errore in un costrutto ``if``, avrai un errore :class:`SyntaxError`
prima di qualunque altro comportamento errato, quindi, in questo caso,
non hai il problema.

Expand Down
2 changes: 1 addition & 1 deletion src/doc/ja/tutorial/interactive_shell.rst
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ IPythonのクイック レファレンスガイドを見たければ, ``%quick
=====================

処理中に何かまずいことが起きると,Pythonはふつう『例外』(exception)を発生し,その例外を引き起こした原因を教えてくれることもある.
よくお目にかかることになるのは, ``NameError````ValueError`` といった名称の例外だ(Pythonライブラリーリファレンス [PyLR]_ に例外名の包括的なリストがある).
よくお目にかかることになるのは, :class:`NameError` や :class:`ValueError` といった名称の例外だ(Pythonライブラリーリファレンス [PyLR]_ に例外名の包括的なリストがある).
実例を見てみよう:

::
Expand Down
2 changes: 1 addition & 1 deletion src/doc/pt/tutorial/interactive_shell.rst
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ Erros e Exceções

Quando algo errado ocorre, você usualmente verá uma "exceção" do
Python. O Python até mesmo tenta sugerir o que ocasionou a exceção,
por exemplo, ``NameError`` ou ``ValueError`` (veja o Referência da
por exemplo, :class:`NameError` ou :class:`ValueError` (veja o Referência da
Biblioteca Python [PyLR]_ para uma lista completa de exceções). Por
exemplo,

Expand Down
5 changes: 3 additions & 2 deletions src/doc/ru/tutorial/interactive_shell.rst
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,9 @@ Wall time. Однако, если существует существенная

Когда что-то идет не так, обычно можно увидеть исключение Python (Python
"exception"). Python даже попытается предположить, что вызвало ошибку. Часто
вы можете видеть имя исключения, например, ``NameError`` или ``ValueError``
(см. Python Library Reference [PyLR]_ для полного списка исключений). Например,
вы можете видеть имя исключения, например, :class:`NameError` или
:class:`ValueError` (см. Python Library Reference [PyLR]_ для полного списка
исключений). Например,

.. skip
Expand Down

0 comments on commit 9852094

Please sign in to comment.