Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

Commit

Permalink
Use consistent file handle naming
Browse files Browse the repository at this point in the history
Fix variable names that violate pylint C0103 and use the same
name for all file handles.

Signed-off-by: Major Hayden <[email protected]>
  • Loading branch information
major committed May 22, 2018
1 parent 289a563 commit b55ec91
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
8 changes: 4 additions & 4 deletions skt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,8 @@ def merge_patchwork_patch(self, uri):
if retcode != 0:
self.git_cmd("am", "--abort")

with open(self.mergelog, "w") as fp:
fp.write(stdout)
with open(self.mergelog, "w") as fileh:
fileh.write(stdout)

raise Exception("Failed to apply patch %s" %
os.path.basename(os.path.normpath(uri)))
Expand All @@ -375,8 +375,8 @@ def merge_patch_file(self, path):
except subprocess.CalledProcessError as exc:
self.git_cmd("am", "--abort")

with open(self.mergelog, "w") as fp:
fp.write(exc.output)
with open(self.mergelog, "w") as fileh:
fileh.write(exc.output)

raise Exception("Failed to apply patch %s" % path)

Expand Down
12 changes: 6 additions & 6 deletions skt/executable.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ def save_state(cfg, state):
logging.debug("state: %s -> %s", key, val)
config.set('state', key, val)

with open(cfg.get('rc'), 'w') as fp:
config.write(fp)
with open(cfg.get('rc'), 'w') as fileh:
config.write(fileh)


def junit(func):
Expand Down Expand Up @@ -352,8 +352,8 @@ def cmd_cleanup(cfg):
config = cfg.get('_parser')
if config.has_section('state'):
config.remove_section('state')
with open(cfg.get('rc'), 'w') as fp:
config.write(fp)
with open(cfg.get('rc'), 'w') as fileh:
config.write(fileh)

if cfg.get('buildinfo'):
try:
Expand Down Expand Up @@ -858,8 +858,8 @@ def main():
args.func(cfg)
if cfg.get('junit'):
ts = junit_xml.TestSuite("skt", cfg.get('_testcases'))
with open("%s/%s.xml" % (cfg.get('junit'), args._name), 'w') as fp:
junit_xml.TestSuite.to_file(fp, [ts])
with open("%s/%s.xml" % (cfg.get('junit'), args._name), 'w') as fileh:
junit_xml.TestSuite.to_file(fileh, [ts])

sys.exit(retcode)

Expand Down
12 changes: 6 additions & 6 deletions skt/reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ def update_mergedata(self):
if response:
mergedata['config'] = response.text
else:
with open("%s/.config" % self.cfg.get("workdir"), "r") as fp:
mergedata['config'] = fp.read()
with open("%s/.config" % self.cfg.get("workdir"), "r") as fileh:
mergedata['config'] = fileh.read()

self.mergedata = mergedata

Expand Down Expand Up @@ -329,8 +329,8 @@ def getmergefailure(self):
'failed with the',
'following output:\n']

with open(self.cfg.get("mergelog"), 'r') as fp:
for line in fp:
with open(self.cfg.get("mergelog"), 'r') as fileh:
for line in fileh:
# Skip the useless part of the 'git am' output
if "The copy of the patch" in line:
break
Expand All @@ -348,8 +348,8 @@ def getbuildfailure(self):
'output for',
'more information (%s).' % attname]

with open(self.cfg.get("buildlog"), 'r') as fp:
self.attach.append((attname, gzipdata(fp.read())))
with open(self.cfg.get("buildlog"), 'r') as fileh:
self.attach.append((attname, gzipdata(fileh.read())))

return result

Expand Down
8 changes: 4 additions & 4 deletions skt/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ def getxml(self, replacements):
The job XML text with template replacements applied.
"""
xml = ''
with open(self.template, 'r') as f:
for line in f:
with open(self.template, 'r') as fileh:
for line in fileh:
for match in re.finditer(r"##(\w+)##", line):
if match.group(1) in replacements:
line = line.replace(match.group(0),
Expand Down Expand Up @@ -128,8 +128,8 @@ def dumpjunitresults(self, jobid, junit):
args.append(jobid)

fname = "%s/%s.xml" % (junit, jobid.replace(":", "_").lower())
with open(fname, 'w') as fp:
bkr = subprocess.Popen(args, stdout=fp)
with open(fname, 'w') as fileh:
bkr = subprocess.Popen(args, stdout=fileh)
bkr.communicate()

def getconsolelog(self, jobid=None):
Expand Down

0 comments on commit b55ec91

Please sign in to comment.