Skip to content

Fix deprecated use of collections module #94

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 12, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix deprecated use of collections module
In Python 3.8 imports of abstract base classes directly from the `collections` module will stop working entirely. This change maintains existing behaviour whilst providing backwards compatibility.
  • Loading branch information
amrishparmar authored Sep 18, 2019
commit c60ba11d2526fa39ba2cd43ef1b221c7d4f8e2e0
11 changes: 8 additions & 3 deletions nameparser/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,13 @@
unexpected results. See `Customizing the Parser <customize.html>`_.
"""
from __future__ import unicode_literals
import collections

import sys
try:
# Python 3.3+
from collections.abc import Set
except ImportError:
from collections import Set

from nameparser.util import binary_type
from nameparser.util import lc
Expand All @@ -45,10 +50,10 @@

DEFAULT_ENCODING = 'UTF-8'

class SetManager(collections.Set):
class SetManager(Set):
'''
Easily add and remove config variables per module or instance. Subclass of
``collections.Set``.
``collections.abc.Set``.

Only special functionality beyond that provided by set() is
to normalize constants for comparison (lower case, no periods)
Expand Down