@@ -489,7 +489,8 @@ def _insert_arg_helper(args):
489
489
490
490
return kvlist
491
491
492
- try :
492
+
493
+ try : # noqa: C901
493
494
# In order to access super class attributes for our derived class, we must
494
495
# import the native Python version, instead of the default Cython version.
495
496
from multidict ._multidict_py import MultiDict
@@ -500,30 +501,31 @@ class PVLMultiDict(MultiDict, MutableMappingSequence):
500
501
OrderedMultiDict).
501
502
502
503
Here is a summary of the differences:
503
- - OrderedMultiDict.getall('k') where k is not in the structure returns
504
- an empty list, PVLMultiDict.getall('k') properly returns a KeyError.
505
- - The .items(), .keys(), and .values() are proper iterators
506
- and don't return sequences like OrderedMultiDict did.
507
- - Calling list() on an OrderedMultiDict returns a list of tuples, which
508
- is like calling list() on the results of a dict.items() iterator.
509
- Calling list() on a PVLMultiDict returns just a list of keys,
510
- which is semantically identical to calling list() on a dict.
511
- - OrderedMultiDict.pop(k) removed all keys that matched k,
512
- PVLMultiDict.pop(k) just removes the first occurrence.
513
- PVLMultiDict.popall(k) would pop all.
514
- - OrderedMultiDict.popitem() removes the last item from the underlying
515
- list, PVLMultiDict.popitem() removes an arbitrary key, value pair,
516
- semantically identical to .popitem() on a dict.
517
- - OrderedMultiDict.__repr__() and .__str__() return identical strings,
518
- PVLMultiDict provides a .__str__() that is pretty-printed similar
519
- to OrderedMultiDict, but also a .__repr__() with a more compact
520
- representation.
521
- - equality is different: OrderedMultiDict has an isinstance()
522
- check in the __eq__() operator, which I don't think was right,
523
- since equality is about values, not about type. PVLMultiDict
524
- has a value-based notion of equality. So an empty PVLGroup and an
525
- empty PVLObject derived from PVLMultiDict could test equal,
526
- but would fail an isinstance() check.
504
+
505
+ * OrderedMultiDict.getall('k') where k is not in the structure returns
506
+ an empty list, PVLMultiDict.getall('k') properly returns a KeyError.
507
+ * The .items(), .keys(), and .values() are proper iterators
508
+ and don't return sequences like OrderedMultiDict did.
509
+ * Calling list() on an OrderedMultiDict returns a list of tuples, which
510
+ is like calling list() on the results of a dict.items() iterator.
511
+ Calling list() on a PVLMultiDict returns just a list of keys,
512
+ which is semantically identical to calling list() on a dict.
513
+ * OrderedMultiDict.pop(k) removed all keys that matched k,
514
+ PVLMultiDict.pop(k) just removes the first occurrence.
515
+ PVLMultiDict.popall(k) would pop all.
516
+ * OrderedMultiDict.popitem() removes the last item from the underlying
517
+ list, PVLMultiDict.popitem() removes an arbitrary key, value pair,
518
+ semantically identical to .popitem() on a dict.
519
+ * OrderedMultiDict.__repr__() and .__str__() return identical strings,
520
+ PVLMultiDict provides a .__str__() that is pretty-printed similar
521
+ to OrderedMultiDict, but also a .__repr__() with a more compact
522
+ representation.
523
+ * Equality is different: OrderedMultiDict has an isinstance()
524
+ check in the __eq__() operator, which I don't think was right,
525
+ since equality is about values, not about type. PVLMultiDict
526
+ has a value-based notion of equality. So an empty PVLGroup and an
527
+ empty PVLObject derived from PVLMultiDict could test equal,
528
+ but would fail an isinstance() check.
527
529
"""
528
530
# Also evaluated the boltons.OrderedMultiDict, but its semantics were
529
531
# too different #52
@@ -669,15 +671,12 @@ def append(self, key, value):
669
671
class PVLModuleNew (PVLMultiDict ):
670
672
pass
671
673
672
-
673
674
class PVLAggregationNew (PVLMultiDict ):
674
675
pass
675
676
676
-
677
677
class PVLGroupNew (PVLAggregationNew ):
678
678
pass
679
679
680
-
681
680
class PVLObjectNew (PVLAggregationNew ):
682
681
pass
683
682
0 commit comments