From 0ae13ac1b9e80cb5f8055b7884511264768ca7e3 Mon Sep 17 00:00:00 2001 From: whitequark Date: Thu, 2 Jul 2015 22:38:55 +0300 Subject: [PATCH] Style fixes. --- artiq/compiler/module.py | 8 ++++---- artiq/compiler/testbench/inferencer.py | 6 +++--- artiq/compiler/testbench/module.py | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/artiq/compiler/module.py b/artiq/compiler/module.py index 7b5e67bf5..d5d21391b 100644 --- a/artiq/compiler/module.py +++ b/artiq/compiler/module.py @@ -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() diff --git a/artiq/compiler/testbench/inferencer.py b/artiq/compiler/testbench/inferencer.py index 7380270bc..eda38c90e 100644 --- a/artiq/compiler/testbench/inferencer.py +++ b/artiq/compiler/testbench/inferencer.py @@ -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() diff --git a/artiq/compiler/testbench/module.py b/artiq/compiler/testbench/module.py index 681d90d7c..b5eab3861 100644 --- a/artiq/compiler/testbench/module.py +++ b/artiq/compiler/testbench/module.py @@ -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()