Skip to content

Commit 282282a

Browse files
authored
Fix: Docstrings hidden by slots. (GH-23352)
Some `__slots__` where before the docstring, hiding them.
1 parent 2a9eddf commit 282282a

1 file changed

Lines changed: 6 additions & 15 deletions

File tree

Lib/_collections_abc.py

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,6 @@ def __subclasshook__(cls, C):
430430

431431

432432
class Set(Collection):
433-
434433
"""A set is a finite, iterable container.
435434
436435
This class provides concrete generic implementations of all
@@ -657,17 +656,15 @@ def __isub__(self, it):
657656

658657

659658
class Mapping(Collection):
660-
661-
__slots__ = ()
662-
663659
"""A Mapping is a generic container for associating key/value
664660
pairs.
665661
666662
This class provides concrete generic implementations of all
667663
methods except for __getitem__, __iter__, and __len__.
668-
669664
"""
670665

666+
__slots__ = ()
667+
671668
@abstractmethod
672669
def __getitem__(self, key):
673670
raise KeyError
@@ -789,18 +786,16 @@ def __iter__(self):
789786

790787

791788
class MutableMapping(Mapping):
792-
793-
__slots__ = ()
794-
795789
"""A MutableMapping is a generic container for associating
796790
key/value pairs.
797791
798792
This class provides concrete generic implementations of all
799793
methods except for __getitem__, __setitem__, __delitem__,
800794
__iter__, and __len__.
801-
802795
"""
803796

797+
__slots__ = ()
798+
804799
@abstractmethod
805800
def __setitem__(self, key, value):
806801
raise KeyError
@@ -879,7 +874,6 @@ def setdefault(self, key, default=None):
879874

880875

881876
class Sequence(Reversible, Collection):
882-
883877
"""All the operations on a read-only sequence.
884878
885879
Concrete subclasses must override __new__ or __init__,
@@ -947,7 +941,6 @@ def count(self, value):
947941

948942

949943
class ByteString(Sequence):
950-
951944
"""This unifies bytes and bytearray.
952945
953946
XXX Should add all their methods.
@@ -960,16 +953,14 @@ class ByteString(Sequence):
960953

961954

962955
class MutableSequence(Sequence):
963-
964-
__slots__ = ()
965-
966956
"""All the operations on a read-write sequence.
967957
968958
Concrete subclasses must provide __new__ or __init__,
969959
__getitem__, __setitem__, __delitem__, __len__, and insert().
970-
971960
"""
972961

962+
__slots__ = ()
963+
973964
@abstractmethod
974965
def __setitem__(self, index, value):
975966
raise IndexError

0 commit comments

Comments
 (0)