mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Fix obvious typos in docstrings (#5151)
This commit is contained in:
parent
2cba6b8579
commit
d55209d5b1
1 changed files with 7 additions and 6 deletions
|
@ -570,7 +570,7 @@ def _process_class(cls, repr, eq, order, hash, init, frozen):
|
||||||
|
|
||||||
|
|
||||||
# _cls should never be specified by keyword, so start it with an
|
# _cls should never be specified by keyword, so start it with an
|
||||||
# underscore. The presense of _cls is used to detect if this
|
# underscore. The presence of _cls is used to detect if this
|
||||||
# decorator is being called with parameters or not.
|
# decorator is being called with parameters or not.
|
||||||
def dataclass(_cls=None, *, init=True, repr=True, eq=True, order=False,
|
def dataclass(_cls=None, *, init=True, repr=True, eq=True, order=False,
|
||||||
hash=None, frozen=False):
|
hash=None, frozen=False):
|
||||||
|
@ -677,7 +677,7 @@ def astuple(obj, *, tuple_factory=tuple):
|
||||||
y: int
|
y: int
|
||||||
|
|
||||||
c = C(1, 2)
|
c = C(1, 2)
|
||||||
assert asdtuple(c) == (1, 2)
|
assert astuple(c) == (1, 2)
|
||||||
|
|
||||||
If given, 'tuple_factory' will be used instead of built-in tuple.
|
If given, 'tuple_factory' will be used instead of built-in tuple.
|
||||||
The function applies recursively to field values that are
|
The function applies recursively to field values that are
|
||||||
|
@ -714,16 +714,17 @@ def make_dataclass(cls_name, fields, *, bases=(), namespace=None, init=True,
|
||||||
omitted, use the string 'typing.Any'. Field objects are created by
|
omitted, use the string 'typing.Any'. Field objects are created by
|
||||||
the equivalent of calling 'field(name, type [, Field-info])'.
|
the equivalent of calling 'field(name, type [, Field-info])'.
|
||||||
|
|
||||||
C = make_class('C', ['x', ('y', int'), ('z', int, Field(init=False))], bases=[Base])
|
C = make_dataclass('C', ['x', ('y', int), ('z', int, field(init=False))], bases=(Base,))
|
||||||
|
|
||||||
is equivalent to:
|
is equivalent to:
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class C(Base):
|
class C(Base):
|
||||||
a: int
|
x: 'typing.Any'
|
||||||
b: int = field(init=False)
|
y: int
|
||||||
|
z: int = field(init=False)
|
||||||
|
|
||||||
For the bases and namespace paremeters, see the builtin type() function.
|
For the bases and namespace parameters, see the builtin type() function.
|
||||||
|
|
||||||
The parameters init, repr, eq, order, hash, and frozen are passed to
|
The parameters init, repr, eq, order, hash, and frozen are passed to
|
||||||
dataclass().
|
dataclass().
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue