From 470723f0e5328b1cf07b68c83413107ced111a21 Mon Sep 17 00:00:00 2001 From: alexholliz Date: Thu, 17 Nov 2022 19:16:42 -0800 Subject: [PATCH] updated collections to collections.abc for python 3.10 --- lib/babelfish/converters/__init__.py | 6 +++--- lib/dateutil/parser.py | 8 ++++---- lib/rebulk/match.py | 3 ++- lib/rebulk/utils.py | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/babelfish/converters/__init__.py b/lib/babelfish/converters/__init__.py index feb687b..e09430d 100644 --- a/lib/babelfish/converters/__init__.py +++ b/lib/babelfish/converters/__init__.py @@ -8,11 +8,11 @@ # from https://github.com/kennethreitz/requests/blob/master/requests/structures.py -class CaseInsensitiveDict(collections.MutableMapping): +class CaseInsensitiveDict(collections.abc.MutableMapping): """A case-insensitive ``dict``-like object. Implements all methods and operations of - ``collections.MutableMapping`` as well as dict's ``copy``. Also + ``collections.abc.MutableMapping`` as well as dict's ``copy``. Also provides ``lower_items``. All keys are expected to be strings. The structure remembers the @@ -63,7 +63,7 @@ def lower_items(self): ) def __eq__(self, other): - if isinstance(other, collections.Mapping): + if isinstance(other, collections.abc.Mapping): other = CaseInsensitiveDict(other) else: return NotImplemented diff --git a/lib/dateutil/parser.py b/lib/dateutil/parser.py index 8b6c2d2..9d3259c 100644 --- a/lib/dateutil/parser.py +++ b/lib/dateutil/parser.py @@ -37,8 +37,8 @@ def __init__(self, instream): self.instream = instream self.wordchars = ('abcdfeghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_' - 'ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ' - 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ') + '��������������������������������' + '������������������������������') self.numchars = '0123456789' self.whitespace = ' \t\r\n' self.charstack = [] @@ -311,9 +311,9 @@ def parse(self, timestr, default=None, ignoretz=False, tzinfos=None, if res.weekday is not None and not res.day: ret = ret+relativedelta.relativedelta(weekday=res.weekday) if not ignoretz: - if (isinstance(tzinfos, collections.Callable) or + if (isinstance(tzinfos, collections.abc.Callable) or tzinfos and res.tzname in tzinfos): - if isinstance(tzinfos, collections.Callable): + if isinstance(tzinfos, collections.abc.Callable): tzdata = tzinfos(res.tzname, res.tzoffset) else: tzdata = tzinfos.get(res.tzname) diff --git a/lib/rebulk/match.py b/lib/rebulk/match.py index a786df4..ce73886 100644 --- a/lib/rebulk/match.py +++ b/lib/rebulk/match.py @@ -5,7 +5,8 @@ """ import copy import itertools -from collections import defaultdict, MutableSequence +from collections import defaultdict +from collections.abc import MutableSequence try: from collections import OrderedDict # pylint:disable=ungrouped-imports diff --git a/lib/rebulk/utils.py b/lib/rebulk/utils.py index 9aaf56d..19243e5 100644 --- a/lib/rebulk/utils.py +++ b/lib/rebulk/utils.py @@ -3,7 +3,7 @@ """ Various utilities functions """ -from collections import MutableSet +from collections.abc import MutableSet from types import GeneratorType