python: reformat with black-23.7.0-2.fc39.noarch
The base image for the "check-tree" test got bumped to Fedora 39. This brings a new python-black version (23.7.0 vs. 22.8.0) and requires reformatting. Maybe we should stick to 22.8.0, via `pip install`. But it seems better to just follow the latest black version (the one from current Fedora). So do the reformatting instead. https://black.readthedocs.io/en/stable/change_log.html#id38
This commit is contained in:
@@ -71,6 +71,7 @@ def error_is_cancelled(e):
|
||||
|
||||
###############################################################################
|
||||
|
||||
|
||||
# A Context manager for running a mainloop. Of course, this does
|
||||
# not do anything magically. You can run the context/mainloop without
|
||||
# this context object.
|
||||
@@ -265,7 +266,6 @@ def create_nmc(dbus_connection):
|
||||
|
||||
|
||||
def make_call(nmc):
|
||||
|
||||
log("[make_call]: make some async D-Bus call")
|
||||
|
||||
if not nmc:
|
||||
@@ -273,7 +273,6 @@ def make_call(nmc):
|
||||
return
|
||||
|
||||
with MainLoopRun("make_call", nmc.get_main_context(), 1) as r:
|
||||
|
||||
# There are two reasons why async operations are preferable with
|
||||
# D-Bus and libnm:
|
||||
#
|
||||
@@ -405,7 +404,6 @@ def destroy_nmc(nmc_holder, destroy_mode):
|
||||
raise Exception("Failure to destroy NMClient: something keeps it alive")
|
||||
|
||||
else:
|
||||
|
||||
if destroy_mode == 1:
|
||||
ctx = GLib.MainContext.default()
|
||||
else:
|
||||
|
@@ -49,7 +49,6 @@ def die(msg, print_usage=False):
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
main_loop = GLib.MainLoop()
|
||||
|
||||
nm_client = NM.Client.new(None)
|
||||
|
@@ -51,7 +51,6 @@ def nmc_new(io_priority=GLib.PRIORITY_DEFAULT, cancellable=None):
|
||||
result = []
|
||||
|
||||
def cb(source_object, res):
|
||||
|
||||
try:
|
||||
source_object.init_finish(res)
|
||||
except Exception as e:
|
||||
@@ -73,7 +72,6 @@ def nmc_new(io_priority=GLib.PRIORITY_DEFAULT, cancellable=None):
|
||||
|
||||
|
||||
def nmc_destroy(nmc_transfer_ref):
|
||||
|
||||
# Just for fun, show how to completely cleanup a NMClient instance.
|
||||
# An NMClient instance registers D-Bus signals and unrefing the instance
|
||||
# will cancel/unsubscribe those signals, but there might still be some
|
||||
@@ -106,7 +104,6 @@ def nmc_destroy(nmc_transfer_ref):
|
||||
|
||||
|
||||
def find_connections(nmc, argv):
|
||||
|
||||
# parse the inpurt argv and select the connection profiles to activate.
|
||||
# The arguments are either "connection.id" or "connection.uuid", possibly
|
||||
# qualified by "id" or "uuid".
|
||||
@@ -173,7 +170,6 @@ class Activation(object):
|
||||
return "%s (%s)" % (self.con.get_id(), self.con.get_uuid())
|
||||
|
||||
def is_done(self, log=log):
|
||||
|
||||
if self.state == Activation.ACTIVATION_STATE_DONE:
|
||||
return True
|
||||
|
||||
@@ -206,7 +202,6 @@ class Activation(object):
|
||||
return False
|
||||
|
||||
def start(self, nmc, cancellable=None, activated_callback=None, log=log):
|
||||
|
||||
# Call nmc.activate_connection_async() and return a user data
|
||||
# with the information about the pending operation.
|
||||
|
||||
@@ -242,7 +237,6 @@ class Activation(object):
|
||||
)
|
||||
|
||||
def wait(self, done_callback=None, log=log):
|
||||
|
||||
assert self.state == Activation.ACTIVATION_STATE_WAITING
|
||||
assert self.result_ac
|
||||
assert self.wait_id is None
|
||||
@@ -259,7 +253,6 @@ class Activation(object):
|
||||
|
||||
class Manager(object):
|
||||
def __init__(self, nmc, cons):
|
||||
|
||||
self.nmc = nmc
|
||||
|
||||
self.ac_start = [Activation(c) for c in cons]
|
||||
@@ -268,7 +261,6 @@ class Manager(object):
|
||||
self.ac_done = []
|
||||
|
||||
def _log(self, msg):
|
||||
|
||||
lists = [self.ac_start, self.ac_starting, self.ac_waiting, self.ac_done]
|
||||
|
||||
n = sum(len(l) for l in lists)
|
||||
@@ -278,11 +270,9 @@ class Manager(object):
|
||||
log("%s: %s" % (prefix, msg))
|
||||
|
||||
def ac_run(self):
|
||||
|
||||
loop = GLib.MainLoop(self.nmc.get_main_context())
|
||||
|
||||
while self.ac_start or self.ac_starting or self.ac_waiting:
|
||||
|
||||
rate_limit_parallel_in_progress = (
|
||||
len(self.ac_starting) + len(self.ac_waiting) >= NUM_PARALLEL_IN_PROGRESS
|
||||
)
|
||||
|
@@ -52,7 +52,6 @@ def die(msg, print_usage=False):
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
main_loop = GLib.MainLoop()
|
||||
|
||||
nm_client = NM.Client.new(None)
|
||||
|
@@ -146,7 +146,6 @@ def print_hint(nm_client):
|
||||
|
||||
|
||||
def argv_get_one(argv, idx, type_ctor=None, topic=None):
|
||||
|
||||
if topic is not None:
|
||||
try:
|
||||
v = argv_get_one(argv, idx, type_ctor, None)
|
||||
@@ -479,7 +478,6 @@ def do_set(nm_client, conn, argv):
|
||||
###############################################################################
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
nm_client = NM.Client.new(None)
|
||||
|
||||
argv = sys.argv
|
||||
|
@@ -111,7 +111,6 @@ def mainloop_run(timeout_msec=0, mainloop=None):
|
||||
|
||||
|
||||
def connection_update2(remote_connection, connection):
|
||||
|
||||
mainloop = GLib.MainLoop()
|
||||
result_error = []
|
||||
|
||||
@@ -160,7 +159,6 @@ def device_get_applied_connection(device):
|
||||
|
||||
|
||||
def device_reapply(device, connection, version_id):
|
||||
|
||||
mainloop = GLib.MainLoop()
|
||||
result_error = []
|
||||
|
||||
@@ -443,7 +441,6 @@ def connection_print(connection, mode, ids_arg, dbus_path, prefix=""):
|
||||
_print("%s %s" % (prefix, dbus_path))
|
||||
|
||||
for data_type in [DataTypeE, DataTypeO]:
|
||||
|
||||
if data_type.setting_type is None:
|
||||
continue
|
||||
|
||||
@@ -465,7 +462,6 @@ def connection_print(connection, mode, ids_arg, dbus_path, prefix=""):
|
||||
|
||||
|
||||
def sett_update(connection, ids_arg):
|
||||
|
||||
for d in ids_arg:
|
||||
op = d[0][0]
|
||||
key = d[0][1:]
|
||||
@@ -554,7 +550,6 @@ def do_get(connections, ids_arg):
|
||||
|
||||
|
||||
def do_set(nmc, connection, ids_arg, do_test):
|
||||
|
||||
remote_connection = connection
|
||||
connection = NM.SimpleConnection.new_clone(remote_connection)
|
||||
|
||||
@@ -611,7 +606,6 @@ def do_set(nmc, connection, ids_arg, do_test):
|
||||
|
||||
|
||||
def do_apply(nmc, device, ids_arg, do_test):
|
||||
|
||||
try:
|
||||
connection_orig, version_id = device_get_applied_connection(device)
|
||||
except Exception as e:
|
||||
@@ -677,13 +671,11 @@ def do_apply(nmc, device, ids_arg, do_test):
|
||||
###############################################################################
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
args = parse_args(sys.argv)
|
||||
|
||||
nmc = NM.Client.new(None)
|
||||
|
||||
if args["mode"] == MODE_APPLY:
|
||||
|
||||
devices = devices_filter(nmc.get_devices(), args["select_arg"])
|
||||
|
||||
if len(devices) != 1:
|
||||
@@ -695,7 +687,6 @@ if __name__ == "__main__":
|
||||
do_apply(nmc, devices[0], args["ids_arg"], do_test=args["do_test"])
|
||||
|
||||
else:
|
||||
|
||||
connections = connections_filter(nmc.get_connections(), args["select_arg"])
|
||||
|
||||
if args["mode"] == MODE_SET:
|
||||
|
Reference in New Issue
Block a user