Skip to content

Commit

Permalink
fix imp deprecation
Browse files Browse the repository at this point in the history
Co-authored-with: Leonardo Rochael Almeida <leorochael@gmail.com>
  • Loading branch information
mmerickel authored and leorochael committed Feb 25, 2021
1 parent ab59cdf commit 1ecfab0
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/pyramid/path.py
@@ -1,20 +1,28 @@
import os
import pkg_resources
import sys
import imp

from zope.interface import implementer

from pyramid.interfaces import IAssetDescriptor

from pyramid._compat import string_types

ignore_types = [imp.C_EXTENSION, imp.C_BUILTIN]
init_names = [
'__init__%s' % x[0]
for x in imp.get_suffixes()
if x[0] and x[2] not in ignore_types
]
try:
from importlib.machinery import SOURCE_SUFFIXES
except ImportError:
# `importlib.machinery` is missing on Python < 3.3
# `imp` is deprecated on Python > 3.4
import imp

ignore_types = [imp.C_EXTENSION, imp.C_BUILTIN]
SOURCE_SUFFIXES = [
_suffix
for _suffix, _, _type in imp.get_suffixes()
if _suffix and _type not in ignore_types
]

init_names = ['__init__%s' % x for x in SOURCE_SUFFIXES]


def caller_path(path, level=2):
Expand Down

0 comments on commit 1ecfab0

Please sign in to comment.