From 39685086165e459e6e644b011e5d2417f0c17098 Mon Sep 17 00:00:00 2001 From: Changbin Liu Date: Thu, 15 Jan 2015 12:08:10 -0500 Subject: [PATCH] Fix unused and conflicting variables Prefix '_' to denote unused variables Suffix '_' to avoid conflicting with Python built-in funcs Change-Id: I4e0d0b8f88e5c93222fbd7f8dc7cf626923f738e --- taskflow/engines/action_engine/compiler.py | 2 +- taskflow/examples/fake_billing.py | 6 +++--- taskflow/examples/resume_many_flows.py | 2 +- taskflow/examples/resume_vm_boot.py | 2 +- taskflow/examples/wbe_mandelbrot.py | 2 +- taskflow/types/fsm.py | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/taskflow/engines/action_engine/compiler.py b/taskflow/engines/action_engine/compiler.py index c55a1e7f..fb81ba80 100644 --- a/taskflow/engines/action_engine/compiler.py +++ b/taskflow/engines/action_engine/compiler.py @@ -342,7 +342,7 @@ class PatternCompiler(object): node.add(tr.Node(flow.retry)) decomposed_members = {} for item in flow: - subgraph, subnode = self._flatten(item, node) + subgraph, _subnode = self._flatten(item, node) decomposed_members[item] = subgraph if subgraph.number_of_nodes(): graph = gr.merge_graphs([graph, subgraph]) diff --git a/taskflow/examples/fake_billing.py b/taskflow/examples/fake_billing.py index 0fbe81f7..5889a2cd 100644 --- a/taskflow/examples/fake_billing.py +++ b/taskflow/examples/fake_billing.py @@ -149,9 +149,9 @@ class DeclareSuccess(task.Task): class DummyUser(object): - def __init__(self, user, id): + def __init__(self, user, id_): self.user = user - self.id = id + self.id = id_ # Resources (db handles and similar) of course can *not* be persisted so we @@ -174,7 +174,7 @@ flow.add(sub_flow) # prepopulating this allows the tasks that dependent on the 'request' variable # to start processing (in this case this is the ExtractInputRequest task). store = { - 'request': DummyUser(user="bob", id="1.35"), + 'request': DummyUser(user="bob", id_="1.35"), } eng = engines.load(flow, engine='serial', store=store) diff --git a/taskflow/examples/resume_many_flows.py b/taskflow/examples/resume_many_flows.py index 08cc1740..88e55510 100644 --- a/taskflow/examples/resume_many_flows.py +++ b/taskflow/examples/resume_many_flows.py @@ -48,7 +48,7 @@ def _exec(cmd, add_env=None): stdout=subprocess.PIPE, stderr=sys.stderr) - stdout, stderr = proc.communicate() + stdout, _stderr = proc.communicate() rc = proc.returncode if rc != 0: raise RuntimeError("Could not run %s [%s]", cmd, rc) diff --git a/taskflow/examples/resume_vm_boot.py b/taskflow/examples/resume_vm_boot.py index f400d0d1..50714ec1 100644 --- a/taskflow/examples/resume_vm_boot.py +++ b/taskflow/examples/resume_vm_boot.py @@ -143,7 +143,7 @@ class AllocateIP(task.Task): def execute(self, vm_spec): ips = [] - for i in range(0, vm_spec.get('ips', 0)): + for _i in range(0, vm_spec.get('ips', 0)): ips.append("192.168.0.%s" % (random.randint(1, 254))) return ips diff --git a/taskflow/examples/wbe_mandelbrot.py b/taskflow/examples/wbe_mandelbrot.py index f21465e3..c59b85ce 100644 --- a/taskflow/examples/wbe_mandelbrot.py +++ b/taskflow/examples/wbe_mandelbrot.py @@ -131,7 +131,7 @@ def calculate(engine_conf): task_names = [] # Compose our workflow. - height, width = IMAGE_SIZE + height, _width = IMAGE_SIZE chunk_size = int(math.ceil(height / float(CHUNK_COUNT))) for i in compat_range(0, CHUNK_COUNT): chunk_name = 'chunk_%s' % i diff --git a/taskflow/types/fsm.py b/taskflow/types/fsm.py index 2519e840..6ca22909 100644 --- a/taskflow/types/fsm.py +++ b/taskflow/types/fsm.py @@ -205,7 +205,7 @@ class FSM(object): def run(self, event, initialize=True): """Runs the state machine, using reactions only.""" - for transition in self.run_iter(event, initialize=initialize): + for _transition in self.run_iter(event, initialize=initialize): pass def copy(self):