Fix unused and conflicting variables

Prefix '_' to denote unused variables

Suffix '_' to avoid conflicting with Python built-in funcs

Change-Id: I4e0d0b8f88e5c93222fbd7f8dc7cf626923f738e
This commit is contained in:
Changbin Liu
2015-01-15 12:08:10 -05:00
parent 4561710908
commit 3968508616
6 changed files with 8 additions and 8 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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