File tree Expand file tree Collapse file tree 5 files changed +27
-14
lines changed
Expand file tree Collapse file tree 5 files changed +27
-14
lines changed Original file line number Diff line number Diff line change 1919import argparse
2020import os
2121import sys
22- import imp
22+ # imp was deprecated in python 3.6
23+ if sys .version_info >= (3 , 6 ):
24+ import importlib as imp
25+ else :
26+ import imp
2327import runpy
2428from io import StringIO
2529from pkgutil import ImpImporter , ImpLoader
Original file line number Diff line number Diff line change 6262
6363import sys
6464import logging
65+ # imp was deprecated in python 3.6
66+ if sys .version_info >= (3 , 6 ):
67+ import importlib as imp
68+ else :
69+ import imp
6570import contextlib
6671import copy
6772import os
7782
7883from future .utils import PY2 , PY3
7984
80- if PY2 :
81- import imp
82-
8385# The modules that are defined under the same names on Py3 but with
8486# different contents in a significant way (e.g. submodules) are:
8587# pickle (fast one)
Original file line number Diff line number Diff line change 11from __future__ import unicode_literals
22
33import inspect
4+ import sys
45import math
56import numbers
67
78from future .utils import PY2 , PY3 , exec_
89
10+
911if PY2 :
1012 from collections import Mapping
1113else :
@@ -103,13 +105,12 @@ def oct(number):
103105 return '0' + builtins .oct (number )[2 :]
104106
105107 raw_input = input
106-
107- try :
108+ # imp was deprecated in python 3.6
109+ if sys . version_info >= ( 3 , 6 ) :
108110 from importlib import reload
109- except ImportError :
111+ else :
110112 # for python2, python3 <= 3.4
111113 from imp import reload
112-
113114 unicode = str
114115 unichr = chr
115116 xrange = range
Original file line number Diff line number Diff line change 3232Inspired by and based on ``uprefix`` by Vinay M. Sajip.
3333"""
3434
35+ import sys
36+ # imp was deprecated in python 3.6
37+ if sys .version_info >= (3 , 6 ):
38+ import importlib as imp
39+ else :
40+ import imp
3541import logging
3642import os
37- import sys
3843import copy
3944from lib2to3 .pgen2 .parse import ParseError
4045from lib2to3 .refactor import RefactoringTool
Original file line number Diff line number Diff line change @@ -447,11 +447,12 @@ def test_reload(self):
447447 """
448448 reload has been moved to the imp module
449449 """
450- try :
451- from importlib import reload
452- except ImportError :
453- from imp import reload
454- reload (sys )
450+ # imp was deprecated in python 3.6
451+ if sys .version_info >= (3 , 6 ):
452+ import importlib as imp
453+ else :
454+ import imp
455+ imp .reload (sys )
455456 self .assertTrue (True )
456457
457458 def test_install_aliases (self ):
You can’t perform that action at this time.
0 commit comments