Skip to content

Commit 674f439

Browse files
committed
Fix pylint on Fedora 33
Signed-off-by: Cole Robinson <crobinso@redhat.com>
1 parent a3893e6 commit 674f439

7 files changed

Lines changed: 12 additions & 10 deletions

File tree

bugzilla/_authfiles.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ def _build_cookiejar(self, cookiefile):
203203
cj.load()
204204
return cj
205205
except LoadError:
206-
raise BugzillaError("cookiefile=%s not in Mozilla format" %
207-
cookiefile)
206+
msg = "cookiefile=%s not in Mozilla format" % cookiefile
207+
raise BugzillaError(msg) from None
208208

209209
def set_filename(self, cookiefile):
210210
log.debug("Using cookiefile=%s", cookiefile)

bugzilla/_backendxmlrpc.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def __request_helper(self, url, request_body):
3939
"""
4040
response = None
4141
# pylint: disable=try-except-raise
42+
# pylint: disable=raise-missing-from
4243
try:
4344
session = self.__bugzillasession.get_requests_session()
4445
response = session.post(url, data=request_body)

bugzilla/_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def open_without_clobber(name, *args):
6262
name = "%s.%i" % (orig_name, count)
6363
count += 1
6464
else: # pragma: no cover
65-
raise IOError(err.errno, err.strerror, err.filename)
65+
raise IOError(err.errno, err.strerror, err.filename) from None
6666
fobj = open(name, *args)
6767
if fd != fobj.fileno():
6868
os.close(fd)

bugzilla/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ def login(self, user=None, password=None, restrict_login=None):
618618
except Exception as e:
619619
log.debug("Login exception: %s", str(e), exc_info=True)
620620
raise BugzillaError("Login failed: %s" %
621-
BugzillaError.get_bugzilla_error_string(e))
621+
BugzillaError.get_bugzilla_error_string(e)) from None
622622

623623
def interactive_save_api_key(self):
624624
"""
@@ -1322,7 +1322,7 @@ def query(self, query):
13221322
raise
13231323
raise BugzillaError("%s\nYour bugzilla instance does not "
13241324
"appear to support API queries derived from bugzilla "
1325-
"web URL queries." % e)
1325+
"web URL queries." % e) from None
13261326

13271327
log.debug("Query returned %s bugs", len(r['bugs']))
13281328
return [Bug(self, dict=b,

tests/test_api_authfiles.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,9 @@ def test_authfiles_saving(monkeypatch):
169169
# On RHEL7 the cookie comment header is different. Strip off leading
170170
# comments
171171
def strip_comments(f):
172-
return "".join([l for l in open(f).readlines() if
173-
not l.startswith("#")])
172+
return "".join([
173+
line for line in open(f).readlines() if
174+
not line.startswith("#")])
174175

175176
tests.utils.diff_compare(strip_comments(bzapi.cookiefile),
176177
None, expect_out=strip_comments(output_cookies))

tests/test_rw_functional.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ def _test8Attachments(run_cli, backends):
575575
out = run_cli(cmd + "--getall %s" % getbug.id, bz).splitlines()
576576

577577
assert len(out) == numattach
578-
fnames = [l.split(" ", 1)[1].strip() for l in out]
578+
fnames = [line.split(" ", 1)[1].strip() for line in out]
579579
assert len(fnames) == numattach
580580
for f in fnames:
581581
if not os.path.exists(f):
@@ -587,7 +587,7 @@ def _test8Attachments(run_cli, backends):
587587
out = run_cli(ignorecmd, bz).splitlines()
588588

589589
assert len(out) == (numattach - 1)
590-
fnames = [l.split(" ", 1)[1].strip() for l in out]
590+
fnames = [line.split(" ", 1)[1].strip() for line in out]
591591
assert len(fnames) == (numattach - 1)
592592
for f in fnames:
593593
if not os.path.exists(f):

tests/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def monkeypatch_getpass(monkeypatch):
4949
def sanitize_json(rawout):
5050
# py2.7 leaves trailing whitespace after commas. strip it so
5151
# tests pass on both python versions
52-
return "\n".join([l.rstrip() for l in rawout.splitlines()])
52+
return "\n".join([line.rstrip() for line in rawout.splitlines()])
5353

5454

5555
def open_functional_bz(bzclass, url, kwargs):

0 commit comments

Comments
 (0)