Skip to content

Commit

Permalink
Remove compatibility code
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Dec 20, 2019
1 parent 892bfaf commit 1055044
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions jaraco/collections.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
# -*- coding: utf-8 -*-

from __future__ import absolute_import, unicode_literals, division

import re
import operator
import collections
import collections.abc
import itertools
import copy
import functools

try:
import collections.abc
except ImportError: # pragma: nocover
# Python 2.7
collections.abc = collections

import six
from jaraco.classes.properties import NonDataProperty
import jaraco.text

Expand Down Expand Up @@ -776,7 +765,7 @@ def __contains__(self, key):

# Hashable
def __hash__(self):
return hash(tuple(sorted(six.iteritems(self.__data))))
return hash(tuple(sorted(self.__data.items())))

# Mapping
def __iter__(self):
Expand Down Expand Up @@ -837,15 +826,15 @@ class Enumeration(ItemsAsAttributes, BijectiveMap):
"""

def __init__(self, names, codes=None):
if isinstance(names, six.string_types):
if isinstance(names, str):
names = names.split()
if codes is None:
codes = itertools.count()
super(Enumeration, self).__init__(zip(names, codes))

@property
def names(self):
return (key for key in self if isinstance(key, six.string_types))
return (key for key in self if isinstance(key, str))

@property
def codes(self):
Expand All @@ -871,7 +860,7 @@ def __contains__(self, other):
return True


class InstrumentedDict(six.moves.UserDict):
class InstrumentedDict(collections.UserDict):
"""
Instrument an existing dictionary with additional
functionality, but always reference and mutate
Expand All @@ -889,7 +878,7 @@ class InstrumentedDict(six.moves.UserDict):
"""

def __init__(self, data):
six.moves.UserDict.__init__(self)
super().__init__()
self.data = data


Expand Down

0 comments on commit 1055044

Please sign in to comment.