Skip to content

Commit eb76f59

Browse files
author
whitequark
committedJun 5, 2015
Replace single-quoted strings with double-quoted.
1 parent 6c3b5a9 commit eb76f59

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed
 

Diff for: ‎artiq/py2llvm/asttyped.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class commontyped(ast.commonloc):
1010
"""A mixin for typed AST nodes."""
1111

12-
_types = ('type',)
12+
_types = ("type",)
1313

1414
def _reprfields(self):
1515
return self._fields + self._locs + self._types

Diff for: ‎artiq/py2llvm/typing.py

+20-20
Original file line numberDiff line numberDiff line change
@@ -89,29 +89,29 @@ def visit_Name(self, node):
8989

9090
def _check_not_in(self, name, names, curkind, newkind, loc):
9191
if name in names:
92-
diag = diagnostic.Diagnostic('fatal',
92+
diag = diagnostic.Diagnostic("fatal",
9393
"name '{name}' cannot be {curkind} and {newkind} simultaneously",
9494
{"name": name, "curkind": curkind, "newkind": newkind}, loc)
9595
self.engine.process(diag)
9696

9797
def visit_Global(self, node):
9898
for name, loc in zip(node.names, node.name_locs):
99-
self._check_not_in(name, self.nonlocal_, 'nonlocal', 'global', loc)
100-
self._check_not_in(name, self.params, 'a parameter', 'global', loc)
99+
self._check_not_in(name, self.nonlocal_, "nonlocal", "global", loc)
100+
self._check_not_in(name, self.params, "a parameter", "global", loc)
101101
self.global_.add(name)
102102

103103
def visit_Nonlocal(self, node):
104104
for name, loc in zip(node.names, node.name_locs):
105-
self._check_not_in(name, self.global_, 'global', 'nonlocal', loc)
106-
self._check_not_in(name, self.params, 'a parameter', 'nonlocal', loc)
105+
self._check_not_in(name, self.global_, "global", "nonlocal", loc)
106+
self._check_not_in(name, self.params, "a parameter", "nonlocal", loc)
107107

108108
found = False
109109
for outer_env in reversed(self.env_stack):
110110
if name in outer_env:
111111
found = True
112112
break
113113
if not found:
114-
diag = diagnostic.Diagnostic('fatal',
114+
diag = diagnostic.Diagnostic("fatal",
115115
"can't declare name '{name}' as nonlocal: it is not bound in any outer scope",
116116
{"name": name},
117117
loc, [node.keyword_loc])
@@ -137,29 +137,29 @@ def _unify(self, typea, typeb, loca, locb, kind):
137137
except types.UnificationError as e:
138138
printer = types.TypePrinter()
139139

140-
if kind == 'generic':
141-
note1 = diagnostic.Diagnostic('note',
140+
if kind == "generic":
141+
note1 = diagnostic.Diagnostic("note",
142142
"expression of type {typea}",
143143
{"typea": printer.name(typea)},
144144
loca)
145-
elif kind == 'expects':
146-
note1 = diagnostic.Diagnostic('note',
145+
elif kind == "expects":
146+
note1 = diagnostic.Diagnostic("note",
147147
"expression expecting an operand of type {typea}",
148148
{"typea": printer.name(typea)},
149149
loca)
150150

151-
note2 = diagnostic.Diagnostic('note',
151+
note2 = diagnostic.Diagnostic("note",
152152
"expression of type {typeb}",
153153
{"typeb": printer.name(typeb)},
154154
locb)
155155

156156
if e.typea.find() == typea.find() and e.typeb.find() == typeb.find():
157-
diag = diagnostic.Diagnostic('fatal',
157+
diag = diagnostic.Diagnostic("fatal",
158158
"cannot unify {typea} with {typeb}",
159159
{"typea": printer.name(typea), "typeb": printer.name(typeb)},
160160
loca, [locb], notes=[note1, note2])
161161
else: # give more detail
162-
diag = diagnostic.Diagnostic('fatal',
162+
diag = diagnostic.Diagnostic("fatal",
163163
"cannot unify {typea} with {typeb}: {fraga} is incompatible with {fragb}",
164164
{"typea": printer.name(typea), "typeb": printer.name(typeb),
165165
"fraga": printer.name(e.typea), "fragb": printer.name(e.typeb)},
@@ -187,7 +187,7 @@ def _find_name(self, name, loc):
187187
for typing_env in reversed(self.env_stack):
188188
if name in typing_env:
189189
return typing_env[name]
190-
diag = diagnostic.Diagnostic('fatal',
190+
diag = diagnostic.Diagnostic("fatal",
191191
"name '{name}' is not bound to anything", {"name":name}, loc)
192192
self.engine.process(diag)
193193

@@ -204,7 +204,7 @@ def visit_Num(self, node):
204204
elif isinstance(node.n, float):
205205
typ = types.TFloat()
206206
else:
207-
diag = diagnostic.Diagnostic('fatal',
207+
diag = diagnostic.Diagnostic("fatal",
208208
"numeric type {type} is not supported", {"type": node.n.__class__.__name__},
209209
node.loc)
210210
self.engine.process(diag)
@@ -225,8 +225,8 @@ def visit_List(self, node):
225225
node = asttyped.ListT(type=types.TList(),
226226
elts=node.elts, ctx=node.ctx, loc=node.loc)
227227
for elt in node.elts:
228-
self._unify(node.type['elt'], elt.type,
229-
node.loc, elt.loc, kind='expects')
228+
self._unify(node.type["elt"], elt.type,
229+
node.loc, elt.loc, kind="expects")
230230
return node
231231

232232
def visit_Subscript(self, node):
@@ -236,7 +236,7 @@ def visit_Subscript(self, node):
236236
loc=node.loc)
237237
# TODO: support more than just lists
238238
self._unify(types.TList(node.type), node.value.type,
239-
node.loc, node.value.loc, kind='expects')
239+
node.loc, node.value.loc, kind="expects")
240240
return node
241241

242242
# Visitors that just unify types
@@ -267,7 +267,7 @@ def visit_For(self, node):
267267
# Unsupported visitors
268268
#
269269
def visit_unsupported(self, node):
270-
diag = diagnostic.Diagnostic('fatal',
270+
diag = diagnostic.Diagnostic("fatal",
271271
"this syntax is not supported", {},
272272
node.loc)
273273
self.engine.process(diag)
@@ -301,7 +301,7 @@ def rewrite(self):
301301
return self.rewriter.rewrite()
302302

303303
def generic_visit(self, node):
304-
if hasattr(node, 'type'):
304+
if hasattr(node, "type"):
305305
self.rewriter.insert_after(node.loc,
306306
":%s".format(self.type_printer.name(node.type)))
307307

0 commit comments

Comments
 (0)
Please sign in to comment.