diff options
author | Mike Taves <mwtoews@gmail.com> | 2021-03-08 22:25:15 +1300 |
---|---|---|
committer | Mike Taves <mwtoews@gmail.com> | 2021-03-08 22:25:15 +1300 |
commit | 8045d1c79bd0615c8760d2423976196a1ca32d65 (patch) | |
tree | 982c3044085a0bddb073d61607a1927aece311c9 /numpy/core/records.py | |
parent | 4af35a75b313411753b037f040d0eaf234321c5b (diff) | |
download | numpy-8045d1c79bd0615c8760d2423976196a1ca32d65.tar.gz |
MAINT: OrderedDict is no longer necessary from Python 3.7
Diffstat (limited to 'numpy/core/records.py')
-rw-r--r-- | numpy/core/records.py | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/numpy/core/records.py b/numpy/core/records.py index a626a0589..a32f5abf1 100644 --- a/numpy/core/records.py +++ b/numpy/core/records.py @@ -35,7 +35,7 @@ Record arrays allow us to access fields as properties:: """ import os import warnings -from collections import Counter, OrderedDict +from collections import Counter from contextlib import nullcontext from . import numeric as sb @@ -75,23 +75,12 @@ _byteorderconv = {'b':'>', numfmt = nt.typeDict -# taken from OrderedDict recipes in the Python documentation -# https://docs.python.org/3.3/library/collections.html#ordereddict-examples-and-recipes -class _OrderedCounter(Counter, OrderedDict): - """Counter that remembers the order elements are first encountered""" - - def __repr__(self): - return '%s(%r)' % (self.__class__.__name__, OrderedDict(self)) - - def __reduce__(self): - return self.__class__, (OrderedDict(self),) - def find_duplicate(list): """Find duplication in a list, return a list of duplicated elements""" return [ item - for item, counts in _OrderedCounter(list).items() + for item, counts in Counter(list).items() if counts > 1 ] |