forked from M-Labs/artiq
1
0
Fork 0

transforms: PEP8

This commit is contained in:
Sebastien Bourdeauducq 2014-11-21 15:55:39 -08:00
parent 65567e1201
commit 35d4f75b65
7 changed files with 12 additions and 7 deletions

View File

@ -1,4 +1,5 @@
"""This transform implements time management functions (delay/now/at) """
This transform implements time management functions (delay/now/at)
using an accumulator 'now' and simple replacement rules: using an accumulator 'now' and simple replacement rules:
delay(t) -> now += t delay(t) -> now += t

View File

@ -1,4 +1,5 @@
"""This transform turns calls to delay/now/at that use non-integer time """
This transform turns calls to delay/now/at that use non-integer time
expressed in seconds into calls that use int64 time expressed in multiples of expressed in seconds into calls that use int64 time expressed in multiples of
ref_period. ref_period.

View File

@ -4,6 +4,7 @@ from collections import defaultdict
from artiq.transforms.tools import is_ref_transparent, count_all_nodes from artiq.transforms.tools import is_ref_transparent, count_all_nodes
class _TargetLister(ast.NodeVisitor): class _TargetLister(ast.NodeVisitor):
def __init__(self): def __init__(self):
self.targets = set() self.targets = set()

View File

@ -104,7 +104,8 @@ def _is_ref_transparent(dependencies, expr):
return all(_is_ref_transparent(dependencies, v) for v in expr.values) return all(_is_ref_transparent(dependencies, v) for v in expr.values)
elif isinstance(expr, ast.Call): elif isinstance(expr, ast.Call):
return (expr.func.id in _replaceable_funcs and return (expr.func.id in _replaceable_funcs and
all(_is_ref_transparent(dependencies, arg) for arg in expr.args)) all(_is_ref_transparent(dependencies, arg)
for arg in expr.args))
else: else:
return False return False

View File

@ -385,7 +385,8 @@ class _Unparser:
self.dispatch(k) self.dispatch(k)
self.write(": ") self.write(": ")
self.dispatch(v) self.dispatch(v)
_interleave(lambda: self.write(", "), write_pair, zip(t.keys, t.values)) _interleave(lambda: self.write(", "), write_pair,
zip(t.keys, t.values))
self.write("}") self.write("}")
def _Tuple(self, t): def _Tuple(self, t):