Skip to content

Commit a20e058

Browse files
committed
Convert to use Sphinx modifiers for type, returns, and rtype.
1 parent 550aa6d commit a20e058

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

Doc/library/string.templatelib.rst

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ It is also possible to create a :class:`Template` directly, using its constructo
6060
('', '', '')
6161

6262
.. attribute:: strings
63+
:type: tuple[str, ...]
6364

6465
A :ref:`tuple <tut-tuples>` of the static strings in the template.
6566

@@ -73,7 +74,8 @@ It is also possible to create a :class:`Template` directly, using its constructo
7374
>>> print(t"Hello {name}{name}!".strings)
7475
('Hello ', '', '!')
7576

76-
.. attribute:: interpolations: tuple[Interpolation, ...]
77+
.. attribute:: interpolations
78+
:type: tuple[Interpolation, ...]
7779

7880
A tuple of the interpolations in the template.
7981

@@ -82,15 +84,16 @@ It is also possible to create a :class:`Template` directly, using its constructo
8284
(Interpolation('World'),)
8385

8486

85-
.. attribute:: values: tuple[Any, ...]
87+
.. attribute:: values
88+
:type: tuple[Any, ...]
8689

8790
A tuple of all interpolated values in the template.
8891

8992
>>> name = "World"
9093
>>> print(t"Hello {name}!".values)
9194
('World',)
9295

93-
.. method:: __iter__() -> typing.Iterator[str | Interpolation]
96+
.. method:: __iter__()
9497

9598
Iterate over the template, yielding each string and :class:`Interpolation` in order.
9699

@@ -104,6 +107,9 @@ It is also possible to create a :class:`Template` directly, using its constructo
104107
>>> print(list(t"Hello {name}{name}"))
105108
['Hello ', Interpolation('World'), Interpolation('World')]
106109

110+
:returns: An iterable of all the parts in the template.
111+
:rtype: typing.Iterator[str | Interpolation]
112+
107113
.. class:: Interpolation(*args)
108114

109115
Create a new :class:`Interpolation` object.
@@ -144,6 +150,7 @@ It is also possible to create a :class:`Template` directly, using its constructo
144150
>> template.interpolations[0].value
145151
42
146152

147-
.. property:: __match_args__: (Literal["value"], Literal["expression"], Literal["conversion"], Literal["format_spec"])
153+
.. property:: __match_args__
148154

149-
The allowed positional arguments used by destructuring during structural pattern matching.
155+
:returns: A tuple of the attributes to use for structural pattern matching.
156+
:rtype: (Literal["value"], Literal["expression"], Literal["conversion"], Literal["format_spec"])

0 commit comments

Comments
 (0)