mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-12 15:41:09 +00:00
Implement conventions found by pylint
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
This commit is contained in:
parent
444b319c12
commit
069a6926c0
@ -150,7 +150,7 @@ def main():
|
||||
)
|
||||
if not args.lpapi and not mailserver_host:
|
||||
try:
|
||||
import DNS
|
||||
import DNS # pylint: disable=import-outside-toplevel
|
||||
|
||||
DNS.DiscoverNameServers()
|
||||
mxlist = DNS.mxlookup(bug_mail_domain)
|
||||
@ -167,6 +167,7 @@ def main():
|
||||
mailserver_pass = config.get_value("SMTP_PASS", compat_keys=["UBUSMTP_PASS", "DEBSMTP_PASS"])
|
||||
|
||||
# import the needed requestsync module
|
||||
# pylint: disable=import-outside-toplevel
|
||||
if args.lpapi:
|
||||
from ubuntutools.lp.lpapicache import Distribution, Launchpad
|
||||
from ubuntutools.requestsync.lp import (
|
||||
@ -259,7 +260,7 @@ def main():
|
||||
# Stop if Ubuntu has already the version from Debian or a newer version
|
||||
if (ubuntu_version >= debian_version) and args.lpapi:
|
||||
# try rmadison
|
||||
import ubuntutools.requestsync.mail
|
||||
import ubuntutools.requestsync.mail # pylint: disable=import-outside-toplevel
|
||||
|
||||
try:
|
||||
debian_srcpkg = ubuntutools.requestsync.mail.get_debian_srcpkg(srcpkg, distro)
|
||||
|
@ -82,8 +82,8 @@ def add_fixed_bugs(changes, bugs):
|
||||
# Remove duplicates
|
||||
bugs = set(str(bug) for bug in bugs)
|
||||
|
||||
for i in range(len(changes)):
|
||||
if changes[i].startswith("Launchpad-Bugs-Fixed:"):
|
||||
for i, change in enumerate(changes):
|
||||
if change.startswith("Launchpad-Bugs-Fixed:"):
|
||||
bugs.update(changes[i][22:].strip().split(" "))
|
||||
changes[i] = "Launchpad-Bugs-Fixed: %s" % (" ".join(bugs))
|
||||
break
|
||||
@ -285,7 +285,7 @@ def fetch_source_pkg(package, dist, version, component, ubuntu_release, mirror):
|
||||
dist = "unstable"
|
||||
|
||||
requested_version = version
|
||||
if type(version) == str:
|
||||
if isinstance(version, str):
|
||||
version = Version(version)
|
||||
|
||||
if version is None or component is None:
|
||||
|
@ -97,7 +97,7 @@ def input_number(question, min_number, max_number, default=None):
|
||||
print("Please input a number between %i and %i." % (min_number, max_number))
|
||||
except ValueError:
|
||||
print("Please input a number.")
|
||||
assert type(selected) == int
|
||||
assert isinstance(selected, int)
|
||||
return selected
|
||||
|
||||
|
||||
|
@ -245,8 +245,8 @@ def get_open_ubuntu_bug_task(launchpad, bug, branch=None):
|
||||
Logger.info(
|
||||
"https://launchpad.net/bugs/%i has %i Ubuntu tasks:", bug_id, len(ubuntu_tasks)
|
||||
)
|
||||
for i in range(len(ubuntu_tasks)):
|
||||
print("%i) %s" % (i + 1, ubuntu_tasks[i].get_package_and_series()))
|
||||
for i, ubuntu_task in enumerate(ubuntu_tasks):
|
||||
print("%i) %s" % (i + 1, ubuntu_task.get_package_and_series()))
|
||||
selected = input_number(
|
||||
"To which Ubuntu task does the patch belong", 1, len(ubuntu_tasks)
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user