2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-29 05:03:34 +08:00

Style fixes.

This commit is contained in:
whitequark 2015-07-02 22:38:55 +03:00
parent 7c833f0727
commit 0ae13ac1b9
3 changed files with 10 additions and 10 deletions

View File

@ -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()

View File

@ -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()

View File

@ -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()