mirror of https://github.com/m-labs/artiq.git
Style fixes.
This commit is contained in:
parent
7c833f0727
commit
0ae13ac1b9
|
@ -27,13 +27,13 @@ class Module:
|
||||||
self.globals = asttyped_rewriter.globals
|
self.globals = asttyped_rewriter.globals
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_string(klass, source_string, name="input.py", first_line=1, engine=None):
|
def from_string(cls, source_string, name="input.py", first_line=1, engine=None):
|
||||||
return klass(source.Buffer(source_string + "\n", name, first_line), engine=engine)
|
return cls(source.Buffer(source_string + "\n", name, first_line), engine=engine)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_filename(klass, filename, engine=None):
|
def from_filename(cls, filename, engine=None):
|
||||||
with open(filename) as f:
|
with open(filename) as f:
|
||||||
return klass(source.Buffer(f.read(), filename, 1), engine=engine)
|
return cls(source.Buffer(f.read(), filename, 1), engine=engine)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
printer = types.TypePrinter()
|
printer = types.TypePrinter()
|
||||||
|
|
|
@ -42,16 +42,16 @@ class Printer(algorithm.Visitor):
|
||||||
":{}".format(self.type_printer.name(node.type)))
|
":{}".format(self.type_printer.name(node.type)))
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
if len(sys.argv) > 1 and sys.argv[1] == '+diag':
|
if len(sys.argv) > 1 and sys.argv[1] == "+diag":
|
||||||
del sys.argv[1]
|
del sys.argv[1]
|
||||||
def process_diagnostic(diag):
|
def process_diagnostic(diag):
|
||||||
print("\n".join(diag.render(only_line=True)))
|
print("\n".join(diag.render(only_line=True)))
|
||||||
if diag.level == 'fatal':
|
if diag.level == "fatal":
|
||||||
exit()
|
exit()
|
||||||
else:
|
else:
|
||||||
def process_diagnostic(diag):
|
def process_diagnostic(diag):
|
||||||
print("\n".join(diag.render()))
|
print("\n".join(diag.render()))
|
||||||
if diag.level in ('fatal', 'error'):
|
if diag.level in ("fatal", "error"):
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
engine = diagnostic.Engine()
|
engine = diagnostic.Engine()
|
||||||
|
|
|
@ -3,16 +3,16 @@ from pythonparser import diagnostic
|
||||||
from .. import Module
|
from .. import Module
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
if len(sys.argv) > 1 and sys.argv[1] == '+diag':
|
if len(sys.argv) > 1 and sys.argv[1] == "+diag":
|
||||||
del sys.argv[1]
|
del sys.argv[1]
|
||||||
def process_diagnostic(diag):
|
def process_diagnostic(diag):
|
||||||
print("\n".join(diag.render(only_line=True)))
|
print("\n".join(diag.render(only_line=True)))
|
||||||
if diag.level == 'fatal':
|
if diag.level == "fatal":
|
||||||
exit()
|
exit()
|
||||||
else:
|
else:
|
||||||
def process_diagnostic(diag):
|
def process_diagnostic(diag):
|
||||||
print("\n".join(diag.render()))
|
print("\n".join(diag.render()))
|
||||||
if diag.level in ('fatal', 'error'):
|
if diag.level in ("fatal", "error"):
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
engine = diagnostic.Engine()
|
engine = diagnostic.Engine()
|
||||||
|
|
Loading…
Reference in New Issue