File tree Expand file tree Collapse file tree 1 file changed +2
-13
lines changed Expand file tree Collapse file tree 1 file changed +2
-13
lines changed Original file line number Diff line number Diff line change @@ -165,17 +165,6 @@ def __missing__(self, node_class):
165
165
return fields
166
166
167
167
168
- def counter (items ):
169
- """
170
- Simplest required implementation of collections.Counter. Required as 2.6
171
- does not have Counter in collections.
172
- """
173
- results = {}
174
- for item in items :
175
- results [item ] = results .get (item , 0 ) + 1
176
- return results
177
-
178
-
179
168
def iter_child_nodes (node , omit = None , _fields_order = _FieldsOrder ()):
180
169
"""
181
170
Yield all direct child nodes of *node*, that is, all fields that
@@ -1777,7 +1766,7 @@ def DICT(self, node):
1777
1766
convert_to_value (key ) for key in node .keys
1778
1767
]
1779
1768
1780
- key_counts = counter (keys )
1769
+ key_counts = collections . Counter (keys )
1781
1770
duplicate_keys = [
1782
1771
key for key , count in key_counts .items ()
1783
1772
if count > 1
@@ -1786,7 +1775,7 @@ def DICT(self, node):
1786
1775
for key in duplicate_keys :
1787
1776
key_indices = [i for i , i_key in enumerate (keys ) if i_key == key ]
1788
1777
1789
- values = counter (
1778
+ values = collections . Counter (
1790
1779
convert_to_value (node .values [index ])
1791
1780
for index in key_indices
1792
1781
)
You can’t perform that action at this time.
0 commit comments