@@ -93,6 +93,7 @@ class SortedDict(dict):
9393 Sorted dicts may only be compared for equality and inequality.
9494
9595 """
96+
9697 def __init__ (self , * args , ** kwargs ):
9798 """Initialize sorted dict instance.
9899
@@ -168,7 +169,6 @@ def __init__(self, *args, **kwargs):
168169
169170 self ._update (* args , ** kwargs )
170171
171-
172172 @property
173173 def key (self ):
174174 """Function used to extract comparison key from keys.
@@ -178,7 +178,6 @@ def key(self):
178178 """
179179 return self ._key
180180
181-
182181 @property
183182 def iloc (self ):
184183 """Cached reference of sorted keys view.
@@ -192,17 +191,14 @@ def iloc(self):
192191 return self ._iloc
193192 except AttributeError :
194193 warnings .warn (
195- 'sorted_dict.iloc is deprecated.'
196- ' Use SortedDict.keys() instead.' ,
194+ 'sorted_dict.iloc is deprecated.' ' Use SortedDict.keys() instead.' ,
197195 DeprecationWarning ,
198196 stacklevel = 2 ,
199197 )
200198 _iloc = self ._iloc = SortedKeysView (self )
201199 return _iloc
202200
203-
204201 def clear (self ):
205-
206202 """Remove all items from sorted dict.
207203
208204 Runtime complexity: `O(n)`
@@ -211,7 +207,6 @@ def clear(self):
211207 dict .clear (self )
212208 self ._list_clear ()
213209
214-
215210 def __delitem__ (self , key ):
216211 """Remove item from sorted dict identified by `key`.
217212
@@ -235,7 +230,6 @@ def __delitem__(self, key):
235230 dict .__delitem__ (self , key )
236231 self ._list_remove (key )
237232
238-
239233 def __iter__ (self ):
240234 """Return an iterator over the keys of the sorted dict.
241235
@@ -247,7 +241,6 @@ def __iter__(self):
247241 """
248242 return self ._list_iter ()
249243
250-
251244 def __reversed__ (self ):
252245 """Return a reverse iterator over the keys of the sorted dict.
253246
@@ -259,7 +252,6 @@ def __reversed__(self):
259252 """
260253 return self ._list_reversed ()
261254
262-
263255 def __setitem__ (self , key , value ):
264256 """Store item in sorted dict with `key` and corresponding `value`.
265257
@@ -284,26 +276,22 @@ def __setitem__(self, key, value):
284276
285277 _setitem = __setitem__
286278
287-
288279 def __or__ (self , other ):
289280 if not isinstance (other , Mapping ):
290281 return NotImplemented
291282 items = chain (self .items (), other .items ())
292283 return self .__class__ (self ._key , items )
293284
294-
295285 def __ror__ (self , other ):
296286 if not isinstance (other , Mapping ):
297287 return NotImplemented
298288 items = chain (other .items (), self .items ())
299289 return self .__class__ (self ._key , items )
300290
301-
302291 def __ior__ (self , other ):
303292 self ._update (other )
304293 return self
305294
306-
307295 def copy (self ):
308296 """Return a shallow copy of the sorted dict.
309297
@@ -316,7 +304,6 @@ def copy(self):
316304
317305 __copy__ = copy
318306
319-
320307 @classmethod
321308 def fromkeys (cls , iterable , value = None ):
322309 """Return a new sorted dict initailized from `iterable` and `value`.
@@ -331,7 +318,6 @@ def fromkeys(cls, iterable, value=None):
331318 """
332319 return cls ((key , value ) for key in iterable )
333320
334-
335321 def keys (self ):
336322 """Return new sorted keys view of the sorted dict's keys.
337323
@@ -342,7 +328,6 @@ def keys(self):
342328 """
343329 return SortedKeysView (self )
344330
345-
346331 def items (self ):
347332 """Return new sorted items view of the sorted dict's items.
348333
@@ -353,7 +338,6 @@ def items(self):
353338 """
354339 return SortedItemsView (self )
355340
356-
357341 def values (self ):
358342 """Return new sorted values view of the sorted dict's values.
359343
@@ -405,7 +389,6 @@ def pop(self, key, default=__not_given):
405389 raise KeyError (key )
406390 return default
407391
408-
409392 def popitem (self , index = - 1 ):
410393 """Remove and return ``(key, value)`` pair at `index` from sorted dict.
411394
@@ -441,7 +424,6 @@ def popitem(self, index=-1):
441424 value = dict .pop (self , key )
442425 return (key , value )
443426
444-
445427 def peekitem (self , index = - 1 ):
446428 """Return ``(key, value)`` pair at `index` in sorted dict.
447429
@@ -472,7 +454,6 @@ def peekitem(self, index=-1):
472454 key = self ._list [index ]
473455 return key , self [key ]
474456
475-
476457 def setdefault (self , key , default = None ):
477458 """Return value for item identified by `key` in sorted dict.
478459
@@ -503,7 +484,6 @@ def setdefault(self, key, default=None):
503484 self ._list_add (key )
504485 return default
505486
506-
507487 def update (self , * args , ** kwargs ):
508488 """Update sorted dict with items from `args` and `kwargs`.
509489
@@ -537,7 +517,6 @@ def update(self, *args, **kwargs):
537517
538518 _update = update
539519
540-
541520 def __reduce__ (self ):
542521 """Support for pickle.
543522
@@ -548,7 +527,6 @@ def __reduce__(self):
548527 items = dict .copy (self )
549528 return (type (self ), (self ._key , items ))
550529
551-
552530 @recursive_repr ()
553531 def __repr__ (self ):
554532 """Return string representation of sorted dict.
@@ -565,7 +543,6 @@ def __repr__(self):
565543 items = ', ' .join (item_format (key , self [key ]) for key in self ._list )
566544 return f'{ type_name } ({ key_arg } {{{ items } }})'
567545
568-
569546 def _check (self ):
570547 """Check invariants of sorted dict.
571548
@@ -624,14 +601,13 @@ class SortedKeysView(KeysView, Sequence):
624601 The keys view implements the set and sequence abstract base classes.
625602
626603 """
627- __slots__ = ()
628604
605+ __slots__ = ()
629606
630607 @classmethod
631608 def _from_iterable (cls , it ):
632609 return SortedSet (it )
633610
634-
635611 def __getitem__ (self , index ):
636612 """Lookup key at `index` in sorted keys views.
637613
@@ -661,7 +637,6 @@ def __getitem__(self, index):
661637 """
662638 return self ._mapping ._list [index ]
663639
664-
665640 __delitem__ = _view_delitem
666641
667642
@@ -673,14 +648,13 @@ class SortedItemsView(ItemsView, Sequence):
673648 The items view implements the set and sequence abstract base classes.
674649
675650 """
676- __slots__ = ()
677651
652+ __slots__ = ()
678653
679654 @classmethod
680655 def _from_iterable (cls , it ):
681656 return SortedSet (it )
682657
683-
684658 def __getitem__ (self , index ):
685659 """Lookup item at `index` in sorted items view.
686660
@@ -718,7 +692,6 @@ def __getitem__(self, index):
718692 key = _mapping_list [index ]
719693 return key , _mapping [key ]
720694
721-
722695 __delitem__ = _view_delitem
723696
724697
@@ -730,8 +703,8 @@ class SortedValuesView(ValuesView, Sequence):
730703 The values view implements the sequence abstract base class.
731704
732705 """
733- __slots__ = ()
734706
707+ __slots__ = ()
735708
736709 def __getitem__ (self , index ):
737710 """Lookup value at `index` in sorted values view.
@@ -770,5 +743,4 @@ def __getitem__(self, index):
770743 key = _mapping_list [index ]
771744 return _mapping [key ]
772745
773-
774746 __delitem__ = _view_delitem
0 commit comments