forked from M-Labs/artiq
Style fixes.
This commit is contained in:
parent
7c833f0727
commit
0ae13ac1b9
|
@ -27,13 +27,13 @@ class Module:
|
|||
self.globals = asttyped_rewriter.globals
|
||||
|
||||
@classmethod
|
||||
def from_string(klass, source_string, name="input.py", first_line=1, engine=None):
|
||||
return klass(source.Buffer(source_string + "\n", name, first_line), engine=engine)
|
||||
def from_string(cls, source_string, name="input.py", first_line=1, engine=None):
|
||||
return cls(source.Buffer(source_string + "\n", name, first_line), engine=engine)
|
||||
|
||||
@classmethod
|
||||
def from_filename(klass, filename, engine=None):
|
||||
def from_filename(cls, filename, engine=None):
|
||||
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):
|
||||
printer = types.TypePrinter()
|
||||
|
|
|
@ -42,16 +42,16 @@ class Printer(algorithm.Visitor):
|
|||
":{}".format(self.type_printer.name(node.type)))
|
||||
|
||||
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]
|
||||
def process_diagnostic(diag):
|
||||
print("\n".join(diag.render(only_line=True)))
|
||||
if diag.level == 'fatal':
|
||||
if diag.level == "fatal":
|
||||
exit()
|
||||
else:
|
||||
def process_diagnostic(diag):
|
||||
print("\n".join(diag.render()))
|
||||
if diag.level in ('fatal', 'error'):
|
||||
if diag.level in ("fatal", "error"):
|
||||
exit(1)
|
||||
|
||||
engine = diagnostic.Engine()
|
||||
|
|
|
@ -3,16 +3,16 @@ from pythonparser import diagnostic
|
|||
from .. import Module
|
||||
|
||||
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]
|
||||
def process_diagnostic(diag):
|
||||
print("\n".join(diag.render(only_line=True)))
|
||||
if diag.level == 'fatal':
|
||||
if diag.level == "fatal":
|
||||
exit()
|
||||
else:
|
||||
def process_diagnostic(diag):
|
||||
print("\n".join(diag.render()))
|
||||
if diag.level in ('fatal', 'error'):
|
||||
if diag.level in ("fatal", "error"):
|
||||
exit(1)
|
||||
|
||||
engine = diagnostic.Engine()
|
||||
|
|
Loading…
Reference in New Issue