Skip to content

Commit ee1f4de

Browse files
committed
Fix ikotler#46 by guyadini: PEP8 Fixes + Replace except Exception, e with except Exception as e everywhere
1 parent aa2aabb commit ee1f4de

5 files changed

Lines changed: 35 additions & 35 deletions

File tree

pythonect/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
del _version
1212

13-
except ImportError, e:
13+
except ImportError as e:
1414

1515
from internal.version import get_version
1616

@@ -27,7 +27,7 @@
2727

2828
from internal.eval import eval, parse
2929

30-
except ImportError, e:
30+
except ImportError as e:
3131

3232
# When imported by setup.py, it's expected that not all the dependencies will be there
3333

pythonect/internal/eval.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def __isiter(object):
3838

3939
return True
4040

41-
except TypeError, e:
41+
except TypeError as e:
4242

4343
return False
4444

@@ -115,7 +115,7 @@ def __run(expression, globals_, locals_, return_value_queue, iterate_literal_arr
115115

116116
object_or_objects = python.eval(atom, globals_, locals_)
117117

118-
except NameError, e:
118+
except NameError as e:
119119

120120
try:
121121

@@ -129,11 +129,11 @@ def __run(expression, globals_, locals_, return_value_queue, iterate_literal_arr
129129

130130
object_or_objects = python.eval(atom, globals_, locals_)
131131

132-
except Exception, e1:
132+
except Exception as e1:
133133

134134
raise e1
135135

136-
except TypeError, e:
136+
except TypeError as e:
137137

138138
# Due to eval()?
139139

pythonect/internal/lang.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def evaluate_host(self, globals_, locals_):
9797

9898
self.__host = eval(self.__host, globals_, locals_)
9999

100-
except SyntaxError, e:
100+
except SyntaxError as e:
101101

102102
# CONST? As it is
103103

@@ -176,7 +176,7 @@ def __call__(self, globals_, locals_):
176176

177177
exec self.__statement in globals_, locals_
178178

179-
except NameError, e:
179+
except NameError as e:
180180

181181
try:
182182

@@ -190,7 +190,7 @@ def __call__(self, globals_, locals_):
190190

191191
exec self.__statement in globals_, locals_
192192

193-
except Exception, e1:
193+
except Exception as e1:
194194

195195
# raise original Exception
196196

pythonect/internal/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def get_version():
3434

3535
version = version + '.post' + git_ver.group('POST')
3636

37-
except Exception, e:
37+
except Exception as e:
3838

3939
pass
4040

pythonect/test/eval_test_gen.py

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,29 @@
1414
import internal.eval
1515

1616

17-
ATOM = [ \
18-
('literal_underscore', '_'),
19-
('literal_true_expr', '1 == 1'),
20-
('literal_false_expr', '1 != 1'),
21-
('literal_int', '1'),
22-
('literal_float', '0.5'),
23-
('literal_string', '\"foobar\"'),
24-
('literal_true', 'True'),
25-
('literal_false', 'False'),
26-
('literal_none', 'None'),
27-
('import_stmt', 'import math'),
28-
('assignment_stmt', 'x = 0'),
29-
('python_expr', '1+1'),
30-
('pythonect_expr', '$[1->1]')
31-
]
32-
33-
34-
OPERATOR = [ \
35-
(None, None),
36-
('comma', ','),
37-
('async', '->'),
38-
('sync', '|')
39-
]
17+
ATOM = [
18+
('literal_underscore', '_'),
19+
('literal_true_expr', '1 == 1'),
20+
('literal_false_expr', '1 != 1'),
21+
('literal_int', '1'),
22+
('literal_float', '0.5'),
23+
('literal_string', '\"foobar\"'),
24+
('literal_true', 'True'),
25+
('literal_false', 'False'),
26+
('literal_none', 'None'),
27+
('import_stmt', 'import math'),
28+
('assignment_stmt', 'x = 0'),
29+
('python_expr', '1+1'),
30+
('pythonect_expr', '$[1->1]')
31+
]
32+
33+
34+
OPERATOR = [
35+
(None, None),
36+
('comma', ','),
37+
('async', '->'),
38+
('sync', '|')
39+
]
4040

4141

4242
# ATOM OPERATOR ATOM OPERATOR ATOM
@@ -103,9 +103,9 @@ def main():
103103
try:
104104

105105
print '\tdef test_%s(self):\n\n\t\tself.assertEqual( internal.eval.eval(\'%s\', {}, {}) , %s )\n' % \
106-
('_'.join(name), ' '.join(expr), __type_wrapper(internal.eval.eval(' '.join(expr), {}, {})))
106+
('_'.join(name), ' '.join(expr), __type_wrapper(internal.eval.eval(' '.join(expr), {}, {})))
107107

108-
except Exception, e:
108+
except Exception as e:
109109

110110
print "%s raises Exception %s" % (' '.join(expr), str(e))
111111

0 commit comments

Comments
 (0)