Skip to content

Commit 95142ef

Browse files
committed
✏️ Fix typo and reST syntax
1 parent b89d4e0 commit 95142ef

File tree

13 files changed

+125
-101
lines changed

13 files changed

+125
-101
lines changed

docs/control-flows/exceptions.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,6 @@ Checks
9292
* If :class:`MyError` inherits from :class:`Exception`, what is the difference
9393
between ``except Exception as e`` and ``except MyError as e``?
9494

95-
The first catches every exception that inherits from :class:`Exception`, while
96-
the second only catches :class:`MyError` exceptions.
97-
9895
* Write a simple program that receives a number and then uses the :func:`assert`
9996
statement to throw an :class:`python3:Exception` if the number is ``0``.
10097

docs/document/sphinx/uml/class-diagram.rst

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,29 @@ Class diagram
33

44

55
``abstract class``, ``abstract``
6-
76
Example:
87

98
.. code-block:: rest
109
1110
.. uml::
1211
13-
abstract class "Abstract class"
12+
abstract class "Abstract class"
1413
1514
.. image:: abstract-class.svg
1615

1716
``annotation``
17+
Example:
1818

1919
.. code-block:: rest
2020
2121
.. uml::
2222
23-
annotation Annotation
23+
annotation Annotation
2424
2525
.. image:: annotation.svg
2626

2727
``circle``, ``()``
28+
Example:
2829

2930
.. code-block:: rest
3031
@@ -35,12 +36,13 @@ Class diagram
3536
.. image:: circle.svg
3637

3738
``class``
39+
Example:
3840

3941
.. code-block:: rest
4042
4143
.. uml::
4244
43-
class Class
45+
class Class
4446
4547
.. image:: class.svg
4648

@@ -52,21 +54,23 @@ Class diagram
5254
5355
.. uml::
5456
55-
diamond Association
57+
diamond Association
5658
5759
.. image:: diamond.svg
5860

5961
``entity``
62+
Example:
6063

6164
.. code-block:: rest
6265
6366
.. uml::
6467
65-
entity Entity
68+
entity Entity
6669
6770
.. image:: entity.svg
6871

6972
``enum``
73+
Example:
7074

7175
.. code-block:: rest
7276
@@ -77,6 +81,7 @@ Class diagram
7781
.. image:: enum.svg
7882

7983
``interface``
84+
Example:
8085

8186
.. code-block:: rest
8287

docs/document/sphinx/uml/index.rst

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,22 @@ Installation
1818
1919
$ brew install plantuml
2020
21+
.. tab:: Windows
22+
23+
.. code-block:: ps1
24+
25+
$ choco install plantuml
26+
2127
#. Install `sphinxcontrib-plantuml
2228
<https://pypi.org/project/sphinxcontrib-plantuml/>`_:
2329

24-
.. tab:: Linux/macOS
30+
.. tab:: Linux
31+
32+
.. code-block:: console
33+
34+
$ python -m pip install sphinxcontrib-plantuml
35+
36+
.. tab:: macOS
2537

2638
.. code-block:: console
2739

docs/install.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,6 @@ installed, this should not be a problem.
2929
One disadvantage is that you have to return to the website regularly to
3030
check for security updates as there is no integrated auto-updater.
3131

32-
.. _various-python-versions:
33-
34-
If different Python versions are required, for example to test libraries with
35-
:doc:`test/tox`, I use `uv <https://docs.astral.sh/uv/guides/install-python/>`_.
36-
This allows not only older CPython versions to be installed but also `PyPy
37-
<https://pypy.org>`_ or free-threaded Python 3.13 with ``uv python install
38-
[email protected]`` or ``uv python install 3.13t``.
39-
4032
.. tab:: macOS
4133

4234
You can obtain Python directly from https://www.python.org/downloads/macos/.
@@ -79,6 +71,14 @@ [email protected]`` or ``uv python install 3.13t``.
7971
One disadvantage is that you have to return to the website regularly to
8072
check for security updates, as there is no integrated auto-updater.
8173

74+
.. _various-python-versions:
75+
76+
If different Python versions are required, for example to test libraries with
77+
:doc:`test/tox`, I use `uv <https://docs.astral.sh/uv/guides/install-python/>`_.
78+
This allows not only older CPython versions to be installed but also `PyPy
79+
<https://pypy.org>`_ or free-threaded Python 3.13 with ``uv python install
80+
[email protected]`` or ``uv python install 3.13t``.
81+
8282
.. tip::
8383
`direnv <https://direnv.net>`_ allows you to set environment variables
8484
depending on the directory. This allows you to install environment variables

docs/libs/batteries.rst

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ different data types: Modules for strings, datatypes and numbers.
2626
String modules
2727
~~~~~~~~~~~~~~
2828

29-
.. include:: ../types/strings.rst
30-
:start-after: string-modules
29+
.. include:: ../types/strings/index.rst
30+
:start-after: string-modules:
31+
:end-before: end-string-modules:
3132

3233
Modules for data types
3334
~~~~~~~~~~~~~~~~~~~~~~
@@ -61,15 +62,17 @@ Modules for numbers
6162
~~~~~~~~~~~~~~~~~~~
6263

6364
.. include:: ../types/numbers.rst
64-
:start-after: number-modules
65+
:start-after: number-modules:
66+
:end-before: end-number-modules:
6567

6668
.. _files-storage:
6769

6870
Changing files
6971
--------------
7072

7173
.. include:: ../types/files.rst
72-
:start-after: file-modules
74+
:start-after: file-modules:
75+
:end-before: end-file-modules:
7376

7477
.. _os:
7578

docs/oop/design/command.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ containing a list of functions for future calls, for example:
5858
.. literalinclude:: caller.py
5959
:language: python
6060
:linenos:
61+
:emphasize-lines: 4-5, 7-8
6162

6263
Lines 4–5
6364
creates a list from the command arguments and ensures that it is iterable.

docs/oop/design/strategy.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ concrete strategies with simple functions and removing the abstract
8484
:language: python
8585
:linenos:
8686
:lines: 1-57
87+
:emphasize-lines: 33, 40
8788

8889
Line 33:
8990
To calculate a discount, simply call the function :func:`self.promotion`.

docs/oop/summary.rst

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -6,94 +6,94 @@ will now summarise these basics in a single example:
66

77
#. First, we create a base class:
88

9-
.. literalinclude:: form.py
10-
:language: python
11-
:linenos:
12-
:lines: 4-13
13-
:lineno-start: 4
14-
15-
Line 7
16-
The ``__init__`` method requires one instance (``self``) and two
17-
parameters.
18-
Lines 8 and 9
19-
The two instance variables ``x`` and ``y``, which are accessed via
20-
``self``.
21-
Line 11
22-
The ``move`` method requires one instance (``self``) and two parameters.
23-
Lines 12 and 13
24-
Instance variables that are set in the ``move`` method.
9+
.. literalinclude:: form.py
10+
:language: python
11+
:linenos:
12+
:lines: 4-13
13+
:lineno-start: 4
14+
15+
Line 7
16+
The ``__init__`` method requires one instance (``self``) and two
17+
parameters.
18+
Lines 8 and 9
19+
The two instance variables ``x`` and ``y``, which are accessed via
20+
``self``.
21+
Line 11
22+
The ``move`` method requires one instance (``self``) and two parameters.
23+
Lines 12 and 13
24+
Instance variables that are set in the ``move`` method.
2525

2626
#. Next, create a subclass that inherits from the base class ``Form``:
2727

28-
.. literalinclude:: form.py
29-
:language: python
30-
:linenos:
31-
:lines: 16-21
32-
:lineno-start: 16
33-
34-
Line 16
35-
The class ``Square`` inherits from the class ``Form``.
36-
Line 19
37-
``Square``’s ``__init__`` takes one instance (``self``) and three
38-
parameters, all with defaults.
39-
Line 20
40-
``Circle``’s ``__init__`` uses ``super()`` to call ``Form``’s
41-
``__init__``.
28+
.. literalinclude:: form.py
29+
:language: python
30+
:linenos:
31+
:lines: 16-21
32+
:lineno-start: 16
33+
34+
Line 16
35+
The class ``Square`` inherits from the class ``Form``.
36+
Line 19
37+
``Square``’s ``__init__`` takes one instance (``self``) and three
38+
parameters, all with defaults.
39+
Line 20
40+
``Circle``’s ``__init__`` uses ``super()`` to call ``Form``’s
41+
``__init__``.
4242

4343
#. Finally, we create another subclass that also contains a static method:
4444

45-
.. literalinclude:: form.py
46-
:language: python
47-
:linenos:
48-
:lines: 27-
49-
:lineno-start: 27
50-
51-
Lines 30 and 31
52-
``pi`` and ``circles`` are class variables for ``Circle``.
53-
Line 33
54-
In the ``__init__`` method, the instance inserts itself into the
55-
``circles`` list.
56-
Lines 38 and 39
57-
``circumferences`` is a class method and takes the class itself
58-
(``cls``) as a parameter.
59-
Line 42
60-
uses the parameter ``cls`` to access the class variable ``circles``.
45+
.. literalinclude:: form.py
46+
:language: python
47+
:linenos:
48+
:lines: 27-
49+
:lineno-start: 27
50+
51+
Lines 30 and 31
52+
``pi`` and ``circles`` are class variables for ``Circle``.
53+
Line 33
54+
In the ``__init__`` method, the instance inserts itself into the
55+
``circles`` list.
56+
Lines 38 and 39
57+
``circumferences`` is a class method and takes the class itself
58+
(``cls``) as a parameter.
59+
Line 42
60+
uses the parameter ``cls`` to access the class variable ``circles``.
6161

6262
Now you can create some instances of the class ``Circle`` and analyse them.
6363
Since the ``__init__`` method of ``Circle`` has default parameters, you can
6464
create a circle without specifying any parameters:
6565

66-
.. code-block:: pycon
66+
.. code-block:: pycon
6767
68-
>>> import form
69-
>>> c1 = form.Circle()
70-
>>> c1.diameter, c1.x, c1.y
71-
(1, 0, 0)
68+
>>> import form
69+
>>> c1 = form.Circle()
70+
>>> c1.diameter, c1.x, c1.y
71+
(1, 0, 0)
7272
7373
If you specify parameters, they are used to set the values of the instance:
7474

75-
.. code-block:: pycon
75+
.. code-block:: pycon
7676
77-
>>> c2 = form.Circle(2, 3, 4)
78-
>>> c2.diameter, c2.x, c2.y
79-
(2, 3, 4)
77+
>>> c2 = form.Circle(2, 3, 4)
78+
>>> c2.diameter, c2.x, c2.y
79+
(2, 3, 4)
8080
8181
When you call the ``move()`` method, Python does not find a ``move()`` method in
8282
the ``Circle`` class, so it goes up the inheritance hierarchy and uses the
8383
``move()`` method of ``Form``:
8484

85-
.. code-block:: pycon
85+
.. code-block:: pycon
8686
87-
>>> c2.move(5, 6)
88-
>>> c2.diameter, c2.x, c2.y
89-
(2, 8, 10)
87+
>>> c2.move(5, 6)
88+
>>> c2.diameter, c2.x, c2.y
89+
(2, 8, 10)
9090
9191
You can also call the class method ``circumferences()`` of the class ``Circle``,
9292
either through the class itself or through an instance:
9393

94-
.. code-block:: pycon
94+
.. code-block:: pycon
9595
96-
>>> form.Circle.circumferences()
97-
9.424769999999999
98-
>>> c2.circumferences()
99-
9.424769999999999
96+
>>> form.Circle.circumferences()
97+
9.424769999999999
98+
>>> c2.circumferences()
99+
9.424769999999999

docs/test/pytest/markers.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ have. This requires three steps:
753753

754754
.. code-block:: python
755755
:linenos:
756-
:emphasize-lines: 5, 13-
756+
:emphasize-lines: 5, 12-
757757
758758
import os
759759
from pathlib import Path
@@ -787,22 +787,22 @@ have. This requires three steps:
787787
Line 13
788788
We have added ``request`` and ``faker`` to the list of ``items_db``
789789
parameters.
790-
Line 17
790+
Line 18
791791
This sets the randomness of faker so that we get the same data every time.
792792
We are not using faker here for very random data, but to avoid having to
793793
invent data ourselves.
794-
Line 18
794+
Line 19
795795
Here we use ``request``, more precisely ``request.node`` for the pytest
796796
representation of a test. ``get_closest_marker('num_items')`` returns a
797797
marker object if the test is marked with ``num_items``, otherwise it returns
798798
``None``. The :func:`get_closest_marker` function returns the marker closest
799799
t545o the test, which is usually what we want.
800-
Line 19
800+
Line 20
801801
The expression is true if the test is marked with ``num_items`` and an
802802
argument is given. The additional ``len`` check is there so that if someone
803803
accidentally just uses ``pytest.mark.num_items`` without specifying the
804804
number of items, this part is skipped.
805-
Line 20–22
805+
Line 22–24
806806
Once we know how many items we need to create, we let Faker create some data
807807
for us. Faker provides the Faker fixture.
808808

docs/types/files.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ use to manage files:
299299
| :py:mod:`tarfile` | |
300300
+-----------------------------------+-------------------------------------------------------------------------------+
301301

302+
.. _end-file-modules:
302303

303304
.. seealso::
304305
* :doc:`Python4DataScience:data-processing/pandas-io`

0 commit comments

Comments
 (0)