Skip to content

Commit 11df39f

Browse files
hoeflingGuido van Rossum
authored andcommitted
Fix ReST linters warnings (#7650)
Signed-off-by: Oleg Höfling <[email protected]>
1 parent c0b0cc3 commit 11df39f

File tree

6 files changed

+25
-25
lines changed

6 files changed

+25
-25
lines changed

docs/source/class_basics.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ to it explicitly using ``self``:
7878
a = self
7979
a.x = 1 # Error: 'x' not defined
8080
81-
Annotating `__init__` methods
82-
*****************************
81+
Annotating ``__init__`` methods
82+
*******************************
8383

8484
The ``__init__`` method is somewhat special -- it doesn't return a
8585
value. This is best expressed as ``-> None``. However, since many feel

docs/source/command_line.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ definitions or calls.
285285
None and Optional handling
286286
**************************
287287

288-
The following flags adjust how mypy handles values of type `None`.
288+
The following flags adjust how mypy handles values of type ``None``.
289289
For more details, see :ref:`no_strict_optional`.
290290

291291
.. _no-implicit-optional:

docs/source/config_file.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ See below for a list of import discovery options that may be used
189189

190190
Used in conjunction with ``follow_imports=skip``, this can be used
191191
to suppress the import of a module from ``typeshed``, replacing it
192-
with `Any`.
192+
with ``Any``.
193193

194194
Used in conjunction with ``follow_imports=error``, this can be used
195195
to make any use of a particular ``typeshed`` module an error.

docs/source/getting_started.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ The typing module
165165

166166
So far, we've added type hints that use only basic concrete types like
167167
``str`` and ``float``. What if we want to express more complex types,
168-
such as "a list of strings" or "an iterable of ints"?
168+
such as "a list of strings" or "an iterable of ints"?
169169

170170
You can find many of these more complex static types inside of the ``typing``
171171
module. For example, to indicate that some function can accept a list of
@@ -181,7 +181,7 @@ strings, use the ``List`` type from the ``typing`` module:
181181
182182
names = ["Alice", "Bob", "Charlie"]
183183
ages = [10, 20, 30]
184-
184+
185185
greet_all(names) # Ok!
186186
greet_all(ages) # Error due to incompatible types
187187
@@ -234,12 +234,12 @@ to help function signatures look a little cleaner:
234234
return 'Hello, ' + name
235235
236236
The ``typing`` module contains many other useful types. You can find a
237-
quick overview by looking through the :ref:`mypy cheatsheets <overview-cheat-sheets>`
237+
quick overview by looking through the :ref:`mypy cheatsheets <overview-cheat-sheets>`
238238
and a more detailed overview (including information on how to make your own
239239
generic types or your own type aliases) by looking through the
240240
:ref:`type system reference <overview-type-system-reference>`.
241241

242-
One final note: when adding types, the convention is to import types
242+
One final note: when adding types, the convention is to import types
243243
using the form ``from typing import Iterable`` (as opposed to doing
244244
just ``import typing`` or ``import typing as t`` or ``from typing import *``).
245245

@@ -252,7 +252,7 @@ Local type inference
252252

253253
Once you have added type hints to a function (i.e. made it statically typed),
254254
mypy will automatically type check that function's body. While doing so,
255-
mypy will try and *infer* as many details as possible.
255+
mypy will try and *infer* as many details as possible.
256256

257257
We saw an example of this in the ``normalize_id`` function above -- mypy understands
258258
basic ``isinstance`` checks and so can infer that the ``user_id`` variable was of

docs/source/literal_types.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ So, ``Literal[-3, b"foo", True]`` is equivalent to
6767
more complex types involving literals a little more convenient.
6868

6969
Literal types may also contain ``None``. Mypy will treat ``Literal[None]`` as being
70-
equivalent to just ``None``. This means that ``Literal[4, None]``,
70+
equivalent to just ``None``. This means that ``Literal[4, None]``,
7171
``Union[Literal[4], None]``, and ``Optional[Literal[4]]`` are all equivalent.
7272

7373
Literals may also contain aliases to other literal types. For example, the
@@ -85,7 +85,7 @@ following program is legal:
8585
paint("turquoise") # Does not type check
8686
8787
Literals may not contain any other kind of type or expression. This means doing
88-
``Literal[my_instance]``, ``Literal[Any]``, ``Literal[3.14]``, or
88+
``Literal[my_instance]``, ``Literal[Any]``, ``Literal[3.14]``, or
8989
``Literal[{"foo": 2, "bar": 5}]`` are all illegal.
9090

9191
Future versions of mypy may relax some of these restrictions. For example, we

docs/source/running_mypy.rst

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ and recommendations on how to handle any issues you may encounter
1515
along the way.
1616

1717
If you are interested in learning about how to configure the
18-
actual way mypy type checks your code, see our
18+
actual way mypy type checks your code, see our
1919
:ref:`command-line` guide.
2020

2121

@@ -51,7 +51,7 @@ different ways.
5151

5252
Mypy will use an algorithm very similar to the one Python uses to
5353
find where modules and imports are located on the file system.
54-
For more details, see :ref:`finding-imports`.
54+
For more details, see :ref:`finding-imports`.
5555

5656
3. Third, you can use the ``-p`` (long form: ``--package``) flag to
5757
specify a package to be (recursively) type checked. This flag
@@ -97,16 +97,16 @@ you can use this instead::
9797

9898
This file can technically also contain any command line flag, not
9999
just file paths. However, if you want to configure many different
100-
flags, the recommended approach is to use a
100+
flags, the recommended approach is to use a
101101
:ref:`configuration file <config-file>` instead.
102102

103103

104104

105105
How mypy handles imports
106106
************************
107107

108-
When mypy encounters an ``import`` statement, it will first
109-
:ref:`attempt to locate <finding-imports>` that module
108+
When mypy encounters an ``import`` statement, it will first
109+
:ref:`attempt to locate <finding-imports>` that module
110110
or type stubs for that module in the file system. Mypy will then
111111
type check the imported module. There are three different outcomes
112112
of this process:
@@ -173,9 +173,9 @@ are trying to use has done neither of these things. In that case, you can try:
173173

174174
2. :ref:`Writing your own stub files <stub-files>` containing type hints for
175175
the library. You can point mypy at your type hints either by passing
176-
them in via the command line, by adding the location to the
177-
`MYPYPATH` environment variable, or by using the ``mypy_path``
178-
:ref:`config file option <config-file-import-discovery-global>`.
176+
them in via the command line, by adding the location to the
177+
``MYPYPATH`` environment variable, or by using the ``mypy_path``
178+
:ref:`config file option <config-file-import-discovery-global>`.
179179

180180
Note that if you decide to write your own stub files, they don't need
181181
to be complete! A good strategy is to add stubs for just the parts
@@ -188,7 +188,7 @@ are trying to use has done neither of these things. In that case, you can try:
188188
If the module is a third party library, but you cannot find any existing
189189
type hints nor have time to write your own, you can *silence* the errors:
190190

191-
1. To silence a *single* missing import error, add a `# type: ignore` at the end of the
191+
1. To silence a *single* missing import error, add a ``# type: ignore`` at the end of the
192192
line containing the import.
193193

194194
2. To silence *all* missing import imports errors from a single library, add
@@ -233,7 +233,7 @@ If the module is a part of the standard library, try:
233233
errors. After upgrading, we recommend running mypy using the
234234
``--warn-unused-ignores`` flag to help you find any ``# type: ignore``
235235
annotations you no longer need.
236-
236+
237237
.. _follow-imports:
238238

239239
Following imports
@@ -243,15 +243,15 @@ Mypy is designed to :ref:`doggedly follow all imports <finding-imports>`,
243243
even if the imported module is not a file you explicitly wanted mypy to check.
244244

245245
For example, suppose we have two modules ``mycode.foo`` and ``mycode.bar``:
246-
the former has type hints and the latter does not. We run
246+
the former has type hints and the latter does not. We run
247247
``mypy -m mycode.foo`` and mypy discovers that ``mycode.foo`` imports
248248
``mycode.bar``.
249249

250250
How do we want mypy to type check ``mycode.bar``? We can configure the
251251
desired behavior by using the ``--follow-imports`` flag. This flag
252252
accepts one of four string values:
253253

254-
- ``normal`` (the default) follows all imports normally and
254+
- ``normal`` (the default) follows all imports normally and
255255
type checks all top level code (as well as the bodies of all
256256
functions and methods with at least one type annotation in
257257
the signature).
@@ -330,12 +330,12 @@ to modules to type check.
330330
One more thing about checking modules and packages: if the directory
331331
*containing* a module or package specified on the command line has an
332332
``__init__.py[i]`` file, mypy assigns these an absolute module name by
333-
crawling up the path until no ``__init__.py[i]`` file is found.
333+
crawling up the path until no ``__init__.py[i]`` file is found.
334334

335335
For example, suppose we run the command ``mypy foo/bar/baz.py`` where
336336
``foo/bar/__init__.py`` exists but ``foo/__init__.py`` does not. Then
337337
the module name assumed is ``bar.baz`` and the directory ``foo`` is
338-
added to mypy's module search path.
338+
added to mypy's module search path.
339339

340340
On the other hand, if ``foo/bar/__init__.py`` did not exist, ``foo/bar``
341341
would be added to the module search path instead, and the module name

0 commit comments

Comments
 (0)