Skip to content

Commit

Permalink
Merge pull request #19 from okurz/feature/black
Browse files Browse the repository at this point in the history
Apply current black style suggestions
  • Loading branch information
okurz authored Jan 30, 2024
2 parents 7a42363 + 7623c99 commit 4758e7e
Show file tree
Hide file tree
Showing 19 changed files with 3 additions and 35 deletions.
1 change: 0 additions & 1 deletion mtui/commands/downgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ def _add_arguments(cls, parser) -> None:

@requires_update
def __call__(self):

targets = self.parse_hosts()
if not targets:
raise NoRefhostsDefinedError
Expand Down
1 change: 0 additions & 1 deletion mtui/commands/hostsunlock.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ def _add_arguments(cls, parser):
return parser

def __call__(self):

hosts = self.parse_hosts()
hosts.unlock(force=self.args.force)

Expand Down
1 change: 0 additions & 1 deletion mtui/commands/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ def _add_arguments(cls, parser) -> None:

@requires_update
def __call__(self):

targets = self.parse_hosts()
if not targets:
raise NoRefhostsDefinedError
Expand Down
1 change: 0 additions & 1 deletion mtui/commands/quit.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ def _close_target(self, target, args):
self.targets.pop(target)

def __call__(self):

args_ = [self.args.bootarg] if self.args.bootarg else []

with concurrent.futures.ThreadPoolExecutor() as executor:
Expand Down
1 change: 0 additions & 1 deletion mtui/commands/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def _add_arguments(cls, parser) -> None:
cls._add_hosts_arg(parser)

def __call__(self):

targets = self.parse_hosts()
if not targets:
raise NoRefhostsDefinedError
Expand Down
2 changes: 0 additions & 2 deletions mtui/commands/setrepo.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class SetRepo(Command):

@classmethod
def _add_arguments(cls, parser) -> None:

group = parser.add_mutually_exclusive_group(required=True)
group.add_argument(
"-A",
Expand All @@ -36,7 +35,6 @@ def _add_arguments(cls, parser) -> None:

@requires_update
def __call__(self):

operation = self.args.operation
hosts = self.parse_hosts()

Expand Down
2 changes: 0 additions & 2 deletions mtui/commands/showdiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class ShowDiff(Command):

@requires_update
def __call__(self):

diff = self.metadata.report_wd() / "source.diff"
text = diff.read_text().split("\n")
page(text, self.prompt.interactive)
Expand All @@ -32,7 +31,6 @@ class AnalyzeDiff(Command):

@requires_update
def __call__(self):

patchdef = re.compile(r"[+-]Patch(\d*):\s+(.*\.patch)$", flags=re.M)
patchapply = re.compile(r"[+-]%patch(\d+|)\s+(?:-p\d*|)", flags=re.M)

Expand Down
3 changes: 0 additions & 3 deletions mtui/commands/simplelists.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class ListLocks(Command):
command = "list_locks"

def __call__(self):

self.hosts.select(enabled=True).report_locks(self.display.list_locks)


Expand All @@ -37,7 +36,6 @@ class ListHosts(Command):
command = "list_hosts"

def __call__(self):

self.targets.report_self(self.display.list_host)


Expand All @@ -49,7 +47,6 @@ class ListTimeout(Command):
command = "list_timeout"

def __call__(self):

self.targets.report_timeout(self.display.list_timeout)


Expand Down
5 changes: 0 additions & 5 deletions mtui/commands/simpleset.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class SessionName(Command):

@classmethod
def _add_arguments(cls, parser) -> None:

parser.add_argument(
"name",
action="store",
Expand All @@ -45,13 +44,11 @@ class SetLocation(Command):

@classmethod
def _add_arguments(cls, parser) -> None:

parser.add_argument(
"site", action="store", type=str, nargs=1, help="location name"
)

def __call__(self):

old = self.config.location
new = str(self.args.site[0])
self.config.location = new
Expand Down Expand Up @@ -80,7 +77,6 @@ class SetLogLevel(Command):

@classmethod
def _add_arguments(cls, parser) -> None:

parser.add_argument(
"level",
action="store",
Expand Down Expand Up @@ -135,7 +131,6 @@ def _add_arguments(cls, parser) -> None:
cls._add_hosts_arg(parser)

def __call__(self):

value = self.args.timeout[0]
targets = self.parse_hosts()

Expand Down
2 changes: 0 additions & 2 deletions mtui/commands/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class Update(Command):

@classmethod
def _add_arguments(cls, parser) -> None:

parser.add_argument(
"--newpackage",
action="store_const",
Expand All @@ -47,7 +46,6 @@ def _add_arguments(cls, parser) -> None:

@requires_update
def __call__(self):

logger.info("Updating")

targets = self.parse_hosts()
Expand Down
2 changes: 1 addition & 1 deletion mtui/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def location(self):
def location(self, x):
try:
self.refhosts(self).check_location_sanity(x)
except (InvalidLocationError) as e:
except InvalidLocationError as e:
logger.error(e)
return
except RefhostsResolveFailed:
Expand Down
1 change: 0 additions & 1 deletion mtui/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,6 @@ def get(self, remote, local):

# Similar to 'get' but handles folders.
def get_folder(self, remote_folder, local_folder):

remote_folder = str(remote_folder)
local_folder = str(local_folder)
sftp = self.__sftp_reconnect()
Expand Down
2 changes: 0 additions & 2 deletions mtui/connector/smelt.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def __init__(self, rrid, apiurl="https://smelt.suse.de/graphql/"):
self.data = self._get_data()

def _get_data(self):

query_incident = f"""{{
incidents(incidentId: {self.rrid.maintenance_id} ) {{
edges {{
Expand Down Expand Up @@ -127,7 +126,6 @@ def openqa_links_verbose(self):

@staticmethod
def _comments(data):

if not data:
return None
if "comments" not in data:
Expand Down
5 changes: 2 additions & 3 deletions mtui/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@ def println(self, msg="", eol="\n"):
return self.output.write(msg + eol)

def list_bugs(self, bugs, jira, url):

ids = sorted(bugs.keys())
if ids == [""]:
self.println("No bugs associated with Release Request.")
else:
self.println(f'Buglist: {url}/buglist.cgi?bug_id={",".join(ids)}')
for (bug, summary) in [(bug, bugs[bug]) for bug in ids]:
for bug, summary in [(bug, bugs[bug]) for bug in ids]:
self.println()
self.println("Bug #{0:5}: {1}".format(bug, summary))
self.println(f"{url}/show_bug.cgi?id={bug}")
Expand All @@ -28,7 +27,7 @@ def list_bugs(self, bugs, jira, url):
self.println()
self.println("No Jira issues associated with Release Request.")
else:
for (issue, summary) in [(issue, jira[issue]) for issue in ids]:
for issue, summary in [(issue, jira[issue]) for issue in ids]:
self.println()
self.println("Jira #{0:5}: {1}".format(issue, summary))
self.println(f"https://jira.suse.com/browse/{issue}")
Expand Down
1 change: 0 additions & 1 deletion mtui/export/manual.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ def _fillup_hosts_to_template(self):
self.template[index + 1] = "=> PASSED\n"

def _host_installog_to_template(self, target):

t = []
try:
host_log = [host for host in self.results if host.hostname == target][0]
Expand Down
1 change: 0 additions & 1 deletion mtui/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ def main():


def run_mtui(sys, config, logger, Prompt, Display, args):

if args.debug:
logger.setLevel(level=logging.DEBUG)

Expand Down
5 changes: 0 additions & 5 deletions mtui/target/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,11 @@ def query_versions(self, packages=None) -> None:
else:
self.packages[p].current = None
elif self.state == "dryrun":

logger.info(
'dryrun: {} running "rpm -q {}"'.format(self.hostname, packages)
)
self.out.append(["rpm -q {}".format(packages), "dryrun\n", "", 0, 0])
elif self.state == "disabled":

self.out.append(["", "", "", 0, 0])

def query_package_versions(self, packages) -> Optional[Dict[str, RPMVersion]]:
Expand Down Expand Up @@ -256,11 +254,9 @@ def run(self, command, lock=None) -> None:
]
)
elif self.state == "dryrun":

logger.info('dryrun: {} running "{}"'.format(self.hostname, command))
self.out.append([command, "dryrun\n", "", 0, 0])
elif self.state == "disabled":

self.out.append(["", "", "", 0, 0])

def shell(self):
Expand All @@ -287,7 +283,6 @@ def put(self, local, remote):
logger.info("dryrun: put {} {}:{}".format(local, self.hostname, remote))

def get(self, remote, local):

if remote.endswith("/"):
f = self.connection.get_folder
s = "folder"
Expand Down
1 change: 0 additions & 1 deletion mtui/template/testreport.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ def _parse(self, tpl: str) -> None:
self._warn_missing_fields()

def _parse_json(self, data, tpl: str) -> None:

if self.path:
raise TestReportAlreadyLoaded(self.path)

Expand Down
1 change: 0 additions & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ def create_temp(tmpdir_factory):


class TestEnsureDirExists(object):

_callback_paths = []

def test_create(self, create_temp):
Expand Down

0 comments on commit 4758e7e

Please sign in to comment.