Skip to content

Commit cc9cdf0

Browse files
authored
Minor style and formatting fixes
Removed repeated example, fixed formatting, removed stray "the".
1 parent fbd2031 commit cc9cdf0

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

docs/guides/writing_stubs.rst

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -234,15 +234,7 @@ follow the following guidelines:
234234
can be left unannotated.
235235
* Do not use ``Any`` to mark unannotated or partially annotated values. Leave
236236
function parameters and return values unannotated. In all other cases, use
237-
``_typeshed.Incomplete``::
238-
239-
from _typeshed import Incomplete
240-
241-
field1: Incomplete
242-
field2: dict[str, Incomplete]
243-
244-
def foo(x): ...
245-
237+
``_typeshed.Incomplete``.
246238
* Partial classes should include a ``__getattr__()`` method marked with
247239
``_typeshed.Incomplete`` (see example below).
248240
* Partial modules (i.e. modules that are missing some or all classes,
@@ -782,6 +774,7 @@ Using ``Any`` and ``object``
782774

783775
When adding type hints, avoid using the ``Any`` type when possible. Reserve
784776
the use of ``Any`` for when:
777+
785778
* the correct type cannot be expressed in the current type system; and
786779
* to avoid union returns (see above).
787780

@@ -830,7 +823,7 @@ context manager is meant to be subclassed, pick ``bool | None``.
830823
See https://github.com/python/mypy/issues/7214 for more details.
831824

832825
``__enter__`` methods and other methods that return ``self`` or ``cls(...)``
833-
should be annotated with the `typing.Self`
826+
should be annotated with ``typing.Self``
834827
(`example <https://github.com/python/typeshed/blob/3581846/stdlib/contextlib.pyi#L151>`_).
835828

836829
Naming

0 commit comments

Comments
 (0)