Skip to content

Commit 7683468

Browse files
committed
chore(python): support for python3 only
1 parent 36ddf66 commit 7683468

14 files changed

Lines changed: 27 additions & 35 deletions

ioc/component.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def is_frozen(self):
108108

109109
class ParameterResolver(object):
110110
def __init__(self, logger=None):
111-
self.re = re.compile("%%|%([^%\s]+)%")
111+
self.re = re.compile(r"%%|%([^%\s]+)%")
112112
self.logger = logger
113113
self.stack = []
114114

ioc/extra/tornado/handler.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,14 @@ def dispatch(self):
103103
if self.is_finish():
104104
return
105105

106-
except RequestRedirect, e:
106+
except RequestRedirect as e:
107107
if self.logger:
108108
self.logger.debug("%s: redirect: %s" % (__name__, e.new_url))
109109

110110
self.redirect(e.new_url, True, 301)
111111
return
112112

113-
except NotFound, e:
113+
except NotFound as e:
114114
if self.logger:
115115
self.logger.critical("%s: NotFound: %s" % (__name__, self.request.uri))
116116

@@ -121,7 +121,7 @@ def dispatch(self):
121121
'request': self.request,
122122
'exception': e,
123123
})
124-
except Exception, e:
124+
except Exception as e:
125125
self.set_status(500)
126126

127127
import traceback

ioc/helper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def walk(data):
102102
if not isinstance(data, dict):
103103
return data
104104

105-
for v, d in data.iteritems():
105+
for v, d in data.items():
106106
if isinstance(d, Dict):
107107
all[v] = d.all()
108108
else:
@@ -116,7 +116,7 @@ def walk(data):
116116
return walk(self.data)
117117

118118
def iteritems(self):
119-
return self.data.iteritems()
119+
return self.data.items()
120120

121121
def __iter__(self):
122122
return iter(self.data)

requirements_python2.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

requirements_python3.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

setup.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,18 @@
2828
packages = find_packages(),
2929
install_requires=["pyyaml"],
3030
platforms='any',
31+
python_requires='>=3.6',
32+
classifiers=[
33+
'Development Status :: 4 - Beta',
34+
'Intended Audience :: Developers',
35+
'License :: OSI Approved :: Apache Software License',
36+
'Programming Language :: Python :: 3',
37+
'Programming Language :: Python :: 3.6',
38+
'Programming Language :: Python :: 3.7',
39+
'Programming Language :: Python :: 3.8',
40+
'Programming Language :: Python :: 3.9',
41+
'Programming Language :: Python :: 3.10',
42+
'Programming Language :: Python :: 3.11',
43+
'Programming Language :: Python :: 3.12',
44+
],
3145
)

tests/ioc/test_component.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# License for the specific language governing permissions and limitations
1414
# under the License.
1515

16-
import unittest2 as unittest
16+
import unittest
1717
import ioc.component, ioc.exceptions
1818
import tests.ioc.service
1919

tests/ioc/test_event.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# License for the specific language governing permissions and limitations
1414
# under the License.
1515

16-
import unittest2 as unittest
16+
import unittest
1717
import ioc.event
1818

1919
class EventTest(unittest.TestCase):

tests/ioc/test_helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
import ioc
1717
import os
18-
import unittest2 as unittest
18+
import unittest
1919
import yaml
2020

2121
current_dir = os.path.dirname(os.path.realpath(__file__))

tests/ioc/test_loader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
import os
1717
import ioc.loader, ioc.component
18-
import unittest2 as unittest
18+
import unittest
1919

2020
current_dir = os.path.dirname(os.path.realpath(__file__))
2121

0 commit comments

Comments
 (0)