From c08fdab2f835d38bbf83a8310e809d673aae5557 Mon Sep 17 00:00:00 2001 From: Dan Bungert Date: Tue, 25 Jul 2023 15:27:30 -0600 Subject: [PATCH] one-off format of long lines with black --- console_conf/cmd/tui.py | 2 +- console_conf/ui/views/chooser.py | 4 ++-- console_conf/ui/views/identity.py | 2 +- subiquity/client/controllers/ssh.py | 5 +---- subiquity/cmd/server.py | 2 +- subiquity/common/api/server.py | 5 +++-- subiquity/common/filesystem/actions.py | 12 +++++------- subiquity/common/filesystem/manipulator.py | 2 +- subiquity/models/keyboard.py | 4 ++-- subiquity/models/mirror.py | 2 +- subiquity/models/network.py | 5 ++--- subiquity/models/proxy.py | 4 +--- subiquity/models/tests/test_subiquity.py | 6 +++--- subiquity/server/controllers/filesystem.py | 6 +++--- subiquity/server/controllers/identity.py | 5 +++-- subiquity/server/controllers/install.py | 2 +- subiquity/server/controllers/mirror.py | 4 ++-- subiquity/server/controllers/oem.py | 2 +- subiquity/server/controllers/refresh.py | 2 +- subiquity/server/ubuntu_advantage.py | 6 ++++-- subiquity/ui/views/drivers.py | 3 +-- subiquity/ui/views/filesystem/compound.py | 5 ++--- subiquity/ui/views/filesystem/delete.py | 10 +++++----- subiquity/ui/views/filesystem/lvm.py | 6 ++---- subiquity/ui/views/filesystem/partition.py | 2 +- subiquity/ui/views/filesystem/raid.py | 6 +++--- subiquity/ui/views/identity.py | 4 ++-- subiquity/ui/views/mirror.py | 11 ++++------- subiquity/ui/views/ssh.py | 2 +- subiquity/ui/views/ubuntu_pro.py | 12 +++++------- subiquitycore/controllers/network.py | 3 +-- subiquitycore/ui/views/network.py | 4 ++-- subiquitycore/utils.py | 2 +- system_setup/cmd/server.py | 14 +++++++++----- system_setup/cmd/tui.py | 6 ++++-- system_setup/server/controllers/configure.py | 4 ++-- system_setup/ui/views/wslconfadvanced.py | 2 +- system_setup/ui/views/wslconfbase.py | 8 ++++---- 38 files changed, 89 insertions(+), 97 deletions(-) diff --git a/console_conf/cmd/tui.py b/console_conf/cmd/tui.py index ae002426..daa074d2 100755 --- a/console_conf/cmd/tui.py +++ b/console_conf/cmd/tui.py @@ -27,7 +27,7 @@ from subiquitycore.log import setup_logger def parse_options(argv): parser = argparse.ArgumentParser( - description=("console-conf - Pre-Ownership Configuration for Ubuntu Core"), + description="console-conf - Pre-Ownership Configuration for Ubuntu Core", prog="console-conf", ) parser.add_argument( diff --git a/console_conf/ui/views/chooser.py b/console_conf/ui/views/chooser.py index 6475b256..5b654a53 100644 --- a/console_conf/ui/views/chooser.py +++ b/console_conf/ui/views/chooser.py @@ -93,7 +93,7 @@ class ChooserCurrentSystemView(ChooserBaseView): class ChooserView(ChooserBaseView): excerpt = ( - "Select one of available recovery systems and a desired " "action to execute." + "Select one of available recovery systems and a desired action to execute." ) def __init__(self, controller, systems): @@ -173,7 +173,7 @@ class ChooserView(ChooserBaseView): class ChooserConfirmView(ChooserBaseView): canned_summary = { "run": "Continue running the system without any changes.", - "recover": ("You have requested to reboot the system into recovery " "mode."), + "recover": "You have requested to reboot the system into recovery mode.", "install": ( "You are about to {action_lower} the system version " "{version} for {model} from {publisher}.\n\n" diff --git a/console_conf/ui/views/identity.py b/console_conf/ui/views/identity.py index 9287bd8c..a80fe1b5 100644 --- a/console_conf/ui/views/identity.py +++ b/console_conf/ui/views/identity.py @@ -24,7 +24,7 @@ from subiquitycore.view import BaseView log = logging.getLogger("console_conf.ui.views.identity") sso_help = ( - "If you do not have an account, visit " "https://login.ubuntu.com to create one." + "If you do not have an account, visit https://login.ubuntu.com to create one." ) diff --git a/subiquity/client/controllers/ssh.py b/subiquity/client/controllers/ssh.py index a6365912..832f8c0a 100644 --- a/subiquity/client/controllers/ssh.py +++ b/subiquity/client/controllers/ssh.py @@ -82,10 +82,7 @@ class SSHController(SubiquityTuiController): elif response.status == SSHFetchIdStatus.FINGERPRINT_ERROR: if isinstance(self.ui.body, SSHView): self.ui.body.fetching_ssh_keys_failed( - _( - "ssh-keygen failed to show fingerprint of" - " downloaded keys:" - ), + _("ssh-keygen failed to show fingerprint of downloaded keys:"), response.error, ) return diff --git a/subiquity/cmd/server.py b/subiquity/cmd/server.py index 9b89aea8..fc9a1df1 100644 --- a/subiquity/cmd/server.py +++ b/subiquity/cmd/server.py @@ -119,7 +119,7 @@ def make_server_args_parser(): "--snap-section", action="store", default="server", - help=("Show snaps from this section of the store in the snap " "list screen."), + help="Show snaps from this section of the store in the snap list screen.", ) parser.add_argument("--source-catalog", dest="source_catalog", action="store") parser.add_argument( diff --git a/subiquity/common/api/server.py b/subiquity/common/api/server.py index 09914245..2420f906 100644 --- a/subiquity/common/api/server.py +++ b/subiquity/common/api/server.py @@ -109,8 +109,9 @@ def _make_handler( for param_name, param in def_params.items(): if param_name in ("request", "context"): raise Exception( - "api method {} cannot have parameter called request or " - "context".format(definition) + "api method {} cannot have parameter called request or context".format( + definition + ) ) if getattr(param.annotation, "__origin__", None) is Payload: data_arg = param_name diff --git a/subiquity/common/filesystem/actions.py b/subiquity/common/filesystem/actions.py index 38ed88ae..c0d7ae19 100644 --- a/subiquity/common/filesystem/actions.py +++ b/subiquity/common/filesystem/actions.py @@ -159,9 +159,7 @@ def _can_edit_generic(device): cd = device.constructed_device() if cd is None: return True - return _( - "Cannot edit {selflabel} as it is part of the {cdtype} " "{cdname}." - ).format( + return _("Cannot edit {selflabel} as it is part of the {cdtype} {cdname}.").format( selflabel=labels.label(device), cdtype=labels.desc(cd), cdname=labels.label(cd) ) @@ -193,7 +191,7 @@ def _can_edit_vg(vg): if vg.preserve: return _("Cannot edit pre-existing volume groups.") elif len(vg._partitions) > 0: - return _("Cannot edit {vglabel} because it has logical " "volumes.").format( + return _("Cannot edit {vglabel} because it has logical volumes.").format( vglabel=labels.label(vg) ) else: @@ -249,7 +247,7 @@ def _can_remove_device(device): return False if cd.preserve: return _( - "Cannot remove {selflabel} from pre-existing {cdtype} " "{cdlabel}." + "Cannot remove {selflabel} from pre-existing {cdtype} {cdlabel}." ).format( selflabel=labels.label(device), cdtype=labels.desc(cd), @@ -290,7 +288,7 @@ def _can_delete_generic(device): if cd is None: return True return _( - "Cannot delete {selflabel} as it is part of the {cdtype} " "{cdname}." + "Cannot delete {selflabel} as it is part of the {cdtype} {cdname}." ).format( selflabel=labels.label(device), cdtype=labels.desc(cd), cdname=labels.label(cd) ) @@ -330,7 +328,7 @@ def _can_delete_raid_vg(device): ) if mounted_partitions > 1: return _( - "Cannot delete {devicelabel} because it has {count} mounted " "partitions." + "Cannot delete {devicelabel} because it has {count} mounted partitions." ).format(devicelabel=labels.label(device), count=mounted_partitions) elif mounted_partitions == 1: return _( diff --git a/subiquity/common/filesystem/manipulator.py b/subiquity/common/filesystem/manipulator.py index 7d33e4a1..f9dfc6bb 100644 --- a/subiquity/common/filesystem/manipulator.py +++ b/subiquity/common/filesystem/manipulator.py @@ -83,7 +83,7 @@ class FilesystemManipulator: if gap.in_extended: if flag not in (None, "logical"): log.debug( - f"overriding flag {flag} " "due to being in an extended partition" + f"overriding flag {flag} due to being in an extended partition" ) flag = "logical" part = self.model.add_partition( diff --git a/subiquity/models/keyboard.py b/subiquity/models/keyboard.py index eac3ecbb..f5b8fbb3 100644 --- a/subiquity/models/keyboard.py +++ b/subiquity/models/keyboard.py @@ -46,7 +46,7 @@ class InconsistentMultiLayoutError(ValueError): def __init__(self, layouts: str, variants: str) -> None: super().__init__( - f'inconsistent multi-layout: layouts="{layouts}"' f' variants="{variants}"' + f'inconsistent multi-layout: layouts="{layouts}" variants="{variants}"' ) @@ -112,7 +112,7 @@ class KeyboardModel: kbd_variant.code == variant for kbd_variant in kbd_layout.variants ): raise ValueError( - f'Unknown keyboard variant "{variant}" ' f'for layout "{layout}"' + f'Unknown keyboard variant "{variant}" for layout "{layout}"' ) def render_config_file(self): diff --git a/subiquity/models/mirror.py b/subiquity/models/mirror.py index 825f0bc6..681d0329 100644 --- a/subiquity/models/mirror.py +++ b/subiquity/models/mirror.py @@ -284,7 +284,7 @@ class MirrorModel(object): if "primary" in data and "mirror-selection" in data: raise ValueError( - "apt->primary and apt->mirror-selection are" " mutually exclusive." + "apt->primary and apt->mirror-selection are mutually exclusive." ) self.legacy_primary = "primary" in data diff --git a/subiquity/models/network.py b/subiquity/models/network.py index 995b7cb8..19cc2d6f 100644 --- a/subiquity/models/network.py +++ b/subiquity/models/network.py @@ -53,7 +53,7 @@ class NetworkModel(CoreNetworkModel): r = { "write_files": { "etc_netplan_installer": { - "path": ("etc/cloud/cloud.cfg.d/90-installer-network.cfg"), + "path": "etc/cloud/cloud.cfg.d/90-installer-network.cfg", "content": self.stringify_config(netplan), "permissions": "0600", }, @@ -104,8 +104,7 @@ class NetworkModel(CoreNetworkModel): cp = await arun_command(("nmcli", "networking"), check=True) except subprocess.CalledProcessError as exc: log.warning( - "failed to run nmcli networking," - " considering NetworkManager disabled." + "failed to run nmcli networking, considering NetworkManager disabled." ) log.debug("stderr: %s", exc.stderr) return False diff --git a/subiquity/models/proxy.py b/subiquity/models/proxy.py index 3bc70aa3..883cf0b3 100644 --- a/subiquity/models/proxy.py +++ b/subiquity/models/proxy.py @@ -49,9 +49,7 @@ class ProxyModel(object): }, "write_files": { "snapd_dropin": { - "path": ( - "etc/systemd/system/" "snapd.service.d/snap_proxy.conf" - ), + "path": "etc/systemd/system/snapd.service.d/snap_proxy.conf", "content": self.proxy_systemd_dropin(), "permissions": 0o644, }, diff --git a/subiquity/models/tests/test_subiquity.py b/subiquity/models/tests/test_subiquity.py index db6852ee..c4fa26b4 100644 --- a/subiquity/models/tests/test_subiquity.py +++ b/subiquity/models/tests/test_subiquity.py @@ -243,7 +243,7 @@ class TestSubiquityModel(unittest.IsolatedAsyncioTestCase): with self.assertRaises(SchemaValidationError) as ctx: model._cloud_init_config() expected_error = ( - "Cloud config schema errors: bootcmd: 'nope' is not of type" " 'array'" + "Cloud config schema errors: bootcmd: 'nope' is not of type 'array'" ) self.assertEqual(expected_error, str(ctx.exception)) @@ -314,7 +314,7 @@ class TestSubiquityModel(unittest.IsolatedAsyncioTestCase): cfg_files.remove("/etc/cloud/cloud.cfg.d/90-installer-network.cfg") cfg_files.append("/etc/netplan/00-installer-config.yaml") cfg_files.append( - "/etc/cloud/cloud.cfg.d/" "subiquity-disable-cloudinit-networking.cfg" + "/etc/cloud/cloud.cfg.d/subiquity-disable-cloudinit-networking.cfg" ) expected_files[ "etc/cloud/clean.d/99-installer" @@ -379,7 +379,7 @@ class TestSubiquityModel(unittest.IsolatedAsyncioTestCase): data={"bootcmd": "nope"}, data_source="system info" ) expected_error = ( - "Cloud config schema errors: bootcmd: 'nope' is not of" " type 'array'" + "Cloud config schema errors: bootcmd: 'nope' is not of type 'array'" ) self.assertEqual(expected_error, str(ctx.exception)) diff --git a/subiquity/server/controllers/filesystem.py b/subiquity/server/controllers/filesystem.py index c959c1ac..12c4947b 100644 --- a/subiquity/server/controllers/filesystem.py +++ b/subiquity/server/controllers/filesystem.py @@ -401,7 +401,7 @@ class FilesystemController(SubiquityController, FilesystemManipulator): raise Exception("autoinstall config did not mount root") if self.model.needs_bootloader_partition(): raise Exception( - "autoinstall config did not create needed bootloader " "partition" + "autoinstall config did not create needed bootloader partition" ) def update_devices(self, device_map): @@ -1160,7 +1160,7 @@ class FilesystemController(SubiquityController, FilesystemManipulator): core_boot_caps.update(variation.capability_info.allowed) if not core_boot_caps: raise Exception( - "can only use name: hybrid when installing core boot " "classic" + "can only use name: hybrid when installing core boot classic" ) if "mode" in layout: raise Exception("cannot use 'mode' when installing core boot classic") @@ -1196,7 +1196,7 @@ class FilesystemController(SubiquityController, FilesystemManipulator): break else: raise Exception( - "must use name: hybrid when installing core boot " "classic" + "must use name: hybrid when installing core boot classic" ) mode = layout.get("mode", "reformat_disk") self.validate_layout_mode(mode) diff --git a/subiquity/server/controllers/identity.py b/subiquity/server/controllers/identity.py index 2bb15590..969851d1 100644 --- a/subiquity/server/controllers/identity.py +++ b/subiquity/server/controllers/identity.py @@ -110,8 +110,9 @@ class IdentityController(SubiquityController): validated = await self.validate_username_GET(data.username) if validated != UsernameValidation.OK: raise ValueError( - "Username <{}> is invalid and should not be" - " submitted.".format(data.username), + "Username <{}> is invalid and should not be submitted.".format( + data.username + ), validated, ) diff --git a/subiquity/server/controllers/install.py b/subiquity/server/controllers/install.py index c7625b75..d82657a4 100644 --- a/subiquity/server/controllers/install.py +++ b/subiquity/server/controllers/install.py @@ -666,7 +666,7 @@ class InstallController(SubiquityController): [ "chroot", self.tpath(), - "/usr/share/unattended-upgrades/" "unattended-upgrade-shutdown", + "/usr/share/unattended-upgrades/unattended-upgrade-shutdown", "--stop-only", ] ) diff --git a/subiquity/server/controllers/mirror.py b/subiquity/server/controllers/mirror.py index bbc32333..3f85f1da 100644 --- a/subiquity/server/controllers/mirror.py +++ b/subiquity/server/controllers/mirror.py @@ -231,7 +231,7 @@ class MirrorController(SubiquityController): fallback = self.model.fallback if fallback == MirrorSelectionFallback.ABORT: - log.error("aborting the install since no primary mirror is" " usable") + log.error("aborting the install since no primary mirror is usable") # TODO there is no guarantee that raising this exception will # actually abort the install. If this is raised from a request # handler, for instance, it will just return a HTTP 500 error. For @@ -240,7 +240,7 @@ class MirrorController(SubiquityController): raise RuntimeError("aborting install since no mirror is usable") elif fallback == MirrorSelectionFallback.OFFLINE_INSTALL: log.warning( - "reverting to an offline install since no primary" " mirror is usable" + "reverting to an offline install since no primary mirror is usable" ) self.app.base_model.network.force_offline = True elif fallback == MirrorSelectionFallback.CONTINUE_ANYWAY: diff --git a/subiquity/server/controllers/oem.py b/subiquity/server/controllers/oem.py index 793c752d..ddb2fc91 100644 --- a/subiquity/server/controllers/oem.py +++ b/subiquity/server/controllers/oem.py @@ -134,7 +134,7 @@ class OEMController(SubiquityController): variant: str = self.app.base_model.source.current.variant fs_controller = self.app.controllers.Filesystem if fs_controller.is_core_boot_classic(): - log.debug("listing of OEM meta-packages disabled on core boot" " classic") + log.debug("listing of OEM meta-packages disabled on core boot classic") self.model.metapkgs = [] return if not self.model.install_on[variant]: diff --git a/subiquity/server/controllers/refresh.py b/subiquity/server/controllers/refresh.py index 2d640da7..c37d8529 100644 --- a/subiquity/server/controllers/refresh.py +++ b/subiquity/server/controllers/refresh.py @@ -137,7 +137,7 @@ class RefreshController(SubiquityController): and snap.channel != expected_channel ): log.debug( - f"snap tracking {snap.channel}, not resetting based " "on .disk/info" + f"snap tracking {snap.channel}, not resetting based on .disk/info" ) return desc = "switching {} to {}".format(self.snap_name, channel) diff --git a/subiquity/server/ubuntu_advantage.py b/subiquity/server/ubuntu_advantage.py index bd962ae6..48abc8fd 100644 --- a/subiquity/server/ubuntu_advantage.py +++ b/subiquity/server/ubuntu_advantage.py @@ -154,8 +154,10 @@ class MockedUAInterfaceStrategy(UAInterfaceStrategy): "result": "failure", "errors": [ { - "title": "The magic attach token is invalid, has " - " expired or never existed", + "title": ( + "The magic attach token is invalid, has " + " expired or never existed" + ), "code": "magic-attach-token-error", }, ], diff --git a/subiquity/ui/views/drivers.py b/subiquity/ui/views/drivers.py index 200f9931..4a28cc03 100644 --- a/subiquity/ui/views/drivers.py +++ b/subiquity/ui/views/drivers.py @@ -155,8 +155,7 @@ class DriversView(BaseView): ) excerpt = _( - "The following third-party drivers were found. " - "Do you want to install them?" + "The following third-party drivers were found. Do you want to install them?" ) def on_cancel(_: DriversForm) -> None: diff --git a/subiquity/ui/views/filesystem/compound.py b/subiquity/ui/views/filesystem/compound.py index f34a128d..5dc81fde 100644 --- a/subiquity/ui/views/filesystem/compound.py +++ b/subiquity/ui/views/filesystem/compound.py @@ -194,9 +194,8 @@ class CompoundDiskForm(Form): potential_boot_disks.add(d) if not potential_boot_disks - set(mdc.value): return _( - "\ -If you put all disks into RAIDs or LVM VGs, there will be nowhere \ -to put the boot partition." + "If you put all disks into RAIDs or LVM VGs, there will be nowhere" + " to put the boot partition." ) diff --git a/subiquity/ui/views/filesystem/delete.py b/subiquity/ui/views/filesystem/delete.py index d2c5ed4e..e8e22c79 100644 --- a/subiquity/ui/views/filesystem/delete.py +++ b/subiquity/ui/views/filesystem/delete.py @@ -49,9 +49,9 @@ class ConfirmDeleteStretchy(Stretchy): if m is not None: lines.append( Text( - _( - "It is formatted as {fstype} and mounted at " "{path}" - ).format(fstype=fs.fstype, path=m.path) + _("It is formatted as {fstype} and mounted at {path}").format( + fstype=fs.fstype, path=m.path + ) ) ) else: @@ -127,7 +127,7 @@ class ConfirmReformatStretchy(Stretchy): m = fs.mount() if m is not None: lines.append( - _("It is formatted as {fstype} and mounted at " "{path}").format( + _("It is formatted as {fstype} and mounted at {path}").format( fstype=fs.fstype, path=m.path ) ) @@ -147,7 +147,7 @@ class ConfirmReformatStretchy(Stretchy): things=things, obj=labels.desc(obj) ) lines = [ - _("Do you really want to remove all {things} from " "{obj}?").format( + _("Do you really want to remove all {things} from {obj}?").format( things=things, obj=labels.label(obj) ), "", diff --git a/subiquity/ui/views/filesystem/lvm.py b/subiquity/ui/views/filesystem/lvm.py index a1e4fcb2..c6029f2d 100644 --- a/subiquity/ui/views/filesystem/lvm.py +++ b/subiquity/ui/views/filesystem/lvm.py @@ -88,7 +88,7 @@ class VolGroupForm(CompoundDiskForm): def validate_devices(self): if len(self.devices.value) < 1: - return _("Select at least one device to be part of the volume " "group.") + return _("Select at least one device to be part of the volume group.") def validate_name(self): v = self.name.value @@ -102,9 +102,7 @@ class VolGroupForm(CompoundDiskForm): ) if v in (".", "..", "md") or os.path.exists("/dev/" + v): if v not in self.deleted_vg_names: - return _("{name} is not a valid name for a volume " "group").format( - name=v - ) + return _("{name} is not a valid name for a volume group").format(name=v) def validate_passphrase(self): if self.encrypt.value and len(self.passphrase.value) < 1: diff --git a/subiquity/ui/views/filesystem/partition.py b/subiquity/ui/views/filesystem/partition.py index 7a71a8cf..1e7cd7f0 100644 --- a/subiquity/ui/views/filesystem/partition.py +++ b/subiquity/ui/views/filesystem/partition.py @@ -258,7 +258,7 @@ class PartitionForm(Form): ]: if substring in v: return _( - "The name of a logical volume may not contain " '"{substring}"' + 'The name of a logical volume may not contain "{substring}"' ).format(substring=substring) if v in self.lvm_names: return _("There is already a logical volume named {name}.").format( diff --git a/subiquity/ui/views/filesystem/raid.py b/subiquity/ui/views/filesystem/raid.py index 8ee28053..e4265393 100644 --- a/subiquity/ui/views/filesystem/raid.py +++ b/subiquity/ui/views/filesystem/raid.py @@ -55,7 +55,7 @@ class RaidnameEditor(StringEditor, WantsToKnowFormField): if len(ch) == 1 and ch == "/": self.bff.in_error = True self.bff.show_extra( - ("info_error", _("/ is not permitted " "in the name of a RAID device")) + ("info_error", _("/ is not permitted in the name of a RAID device")) ) return False elif len(ch) == 1 and ch.isspace(): @@ -63,7 +63,7 @@ class RaidnameEditor(StringEditor, WantsToKnowFormField): self.bff.show_extra( ( "info_error", - _("Whitespace is not permitted in the " "name of a RAID device"), + _("Whitespace is not permitted in the name of a RAID device"), ) ) return False @@ -104,7 +104,7 @@ class RaidForm(CompoundDiskForm): active_device_count = len(self.devices.widget.active_devices) if active_device_count < self.level.value.min_devices: return _( - 'RAID Level "{level}" requires at least {min_active} active' " devices" + 'RAID Level "{level}" requires at least {min_active} active devices' ).format( level=self.level.value.name, min_active=self.level.value.min_devices ) diff --git a/subiquity/ui/views/identity.py b/subiquity/ui/views/identity.py index a8a218b1..963f2be8 100644 --- a/subiquity/ui/views/identity.py +++ b/subiquity/ui/views/identity.py @@ -45,7 +45,7 @@ class RealnameEditor(StringEditor, WantsToKnowFormField): self.bff.show_extra( ( "info_error", - _("The characters : , and = are not permitted" " in this field"), + _("The characters : , and = are not permitted in this field"), ) ) return False @@ -91,7 +91,7 @@ class UsernameEditor(StringEditor, _AsyncValidatedMixin, WantsToKnowFormField): def __init__(self): self.valid_char_pat = r"[-a-z0-9_]" self.error_invalid_char = _( - "The only characters permitted in this " "field are a-z, 0-9, _ and -" + "The only characters permitted in this field are a-z, 0-9, _ and -" ) super().__init__() diff --git a/subiquity/ui/views/mirror.py b/subiquity/ui/views/mirror.py index 82076e45..560985a0 100644 --- a/subiquity/ui/views/mirror.py +++ b/subiquity/ui/views/mirror.py @@ -35,7 +35,7 @@ from subiquitycore.view import BaseView log = logging.getLogger("subiquity.ui.views.mirror") mirror_help = _( - "You may provide an archive mirror that will be used instead " "of the default." + "You may provide an archive mirror that will be used instead of the default." ) MIRROR_CHECK_CONFIRMATION_TEXTS = { @@ -80,11 +80,10 @@ class MirrorForm(Form): # * the status of the mirror check (or None if it hasn't started yet) MIRROR_CHECK_STATUS_TEXTS = { (False, None): _( - "The mirror location cannot be checked because no network" - " has been configured." + "The mirror location cannot be checked because no network has been configured." ), (True, None): _("The mirror location has not yet started."), - (True, MirrorCheckStatus.RUNNING): _("The mirror location is being" " tested."), + (True, MirrorCheckStatus.RUNNING): _("The mirror location is being tested."), (True, MirrorCheckStatus.OK): _("This mirror location passed tests."), (True, MirrorCheckStatus.FAILED): _( """\ @@ -98,9 +97,7 @@ explain the problem. You can try again once the issue has been fixed class MirrorView(BaseView): title = _("Configure Ubuntu archive mirror") - excerpt = _( - "If you use an alternative mirror for Ubuntu, enter its " "details here." - ) + excerpt = _("If you use an alternative mirror for Ubuntu, enter its details here.") def __init__( self, diff --git a/subiquity/ui/views/ssh.py b/subiquity/ui/views/ssh.py index dd339a2a..ecc270e3 100644 --- a/subiquity/ui/views/ssh.py +++ b/subiquity/ui/views/ssh.py @@ -47,7 +47,7 @@ _ssh_import_data = { "help": _("Enter your GitHub username."), "valid_char": r"[a-zA-Z0-9\-]", "error_invalid_char": _( - "A GitHub username may only contain " "alphanumeric characters or hyphens." + "A GitHub username may only contain alphanumeric characters or hyphens." ), }, "lp": { diff --git a/subiquity/ui/views/ubuntu_pro.py b/subiquity/ui/views/ubuntu_pro.py index a3733554..c50c25e9 100644 --- a/subiquity/ui/views/ubuntu_pro.py +++ b/subiquity/ui/views/ubuntu_pro.py @@ -193,7 +193,7 @@ class UpgradeYesNoForm(Form): group, _("Skip for now"), help="\n" - + _("You can always enable Ubuntu Pro later via the" " 'pro attach' command."), + + _("You can always enable Ubuntu Pro later via the 'pro attach' command."), ) @@ -388,9 +388,7 @@ class UbuntuProView(BaseView): " STIG, HIPAA and other compliance or hardening" " requirements." ) - excerpt_no_net = _( - "An Internet connection is required to enable" " Ubuntu Pro." - ) + excerpt_no_net = _("An Internet connection is required to enable Ubuntu Pro.") about_pro_btn = menu_btn( _("About Ubuntu Pro"), on_press=lambda unused: self.show_about_ubuntu_pro() @@ -688,7 +686,7 @@ class ExpiredTokenWidget(Stretchy): self.parent = parent cont = done_btn(label=_("Okay"), on_press=lambda unused: self.close()) widgets = [ - Text(_("Your token has expired. Please use another token" " to continue.")), + Text(_("Your token has expired. Please use another token to continue.")), Text(""), button_pile([cont]), ] @@ -814,7 +812,7 @@ class AboutProWidget(Stretchy): _("10 years of security patch coverage (extended from 5 years)."), _("Kernel Livepatch to reduce required reboots."), _("Ubuntu Security Guide for CIS and DISA-STIG hardening."), - _("FIPS 140-2 NIST-certified crypto-modules for FedRAMP" " compliance"), + _("FIPS 140-2 NIST-certified crypto-modules for FedRAMP compliance"), ] def itemize(item: str, marker: str = "•") -> Columns: @@ -834,7 +832,7 @@ class AboutProWidget(Stretchy): Text(""), Pile([itemize(svc, marker=" •") for svc in services]), Text(""), - Text(_("Ubuntu Pro is free for personal use on up to 3" " machines.")), + Text(_("Ubuntu Pro is free for personal use on up to 3 machines.")), Text(_("More information is at ubuntu.com/pro")), Text(""), button_pile([ok]), diff --git a/subiquitycore/controllers/network.py b/subiquitycore/controllers/network.py index 92d203ac..983606a5 100644 --- a/subiquitycore/controllers/network.py +++ b/subiquitycore/controllers/network.py @@ -374,8 +374,7 @@ class BaseNetworkController(BaseController): await arun_command(["netplan", "apply"], env=env, check=True) except subprocess.CalledProcessError as cpe: log.debug( - "CalledProcessError: " - f"stdout[{cpe.stdout}] stderr[{cpe.stderr}]" + f"CalledProcessError: stdout[{cpe.stdout}] stderr[{cpe.stderr}]" ) error("apply") raise diff --git a/subiquitycore/ui/views/network.py b/subiquitycore/ui/views/network.py index 1b6f5cc2..e10ff89d 100644 --- a/subiquitycore/ui/views/network.py +++ b/subiquitycore/ui/views/network.py @@ -500,7 +500,7 @@ class NetworkView(BaseView): ) elif action == "timeout": self.error.set_text( - "Network configuration timed out; " "please verify your settings." + "Network configuration timed out; please verify your settings." ) elif action == "down": self.error.set_text("Downing network interfaces failed.") @@ -510,7 +510,7 @@ class NetworkView(BaseView): self.error.set_text("Failed to delete a virtual interface.") else: self.error.set_text( - "An unexpected error has occurred; " "please verify your settings." + "An unexpected error has occurred; please verify your settings." ) def done(self, result=None): diff --git a/subiquitycore/utils.py b/subiquitycore/utils.py index 1c492a0b..60233d77 100644 --- a/subiquitycore/utils.py +++ b/subiquitycore/utils.py @@ -222,7 +222,7 @@ def crypt_password(passwd, algo="SHA-512"): ) ) - salt_set = "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "0123456789./" + salt_set = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./" salt = 16 * " " salt = "".join([random.choice(salt_set) for c in salt]) return crypt.crypt(passwd, algos[algo] + salt) diff --git a/system_setup/cmd/server.py b/system_setup/cmd/server.py index 01c19f42..db7bcc70 100644 --- a/system_setup/cmd/server.py +++ b/system_setup/cmd/server.py @@ -38,8 +38,10 @@ def make_server_args_parser(): parser.add_argument( "--prefill", dest="prefill", - help="Prefills UI models with data provided in" - " a prefill.yaml file yet allowing overrides.", + help=( + "Prefills UI models with data provided in" + " a prefill.yaml file yet allowing overrides." + ), ) parser.add_argument( "--output-base", @@ -54,9 +56,11 @@ def make_server_args_parser(): type=int, choices=range(49152, 60999), metavar="[49152 to 60999]", - help="The TCP port Subiquity must listen to. It means " - "TCP will be used instead of Unix domain sockets. " - "Only localhost connections are accepted.", + help=( + "The TCP port Subiquity must listen to. It means " + "TCP will be used instead of Unix domain sockets. " + "Only localhost connections are accepted." + ), ) return parser diff --git a/system_setup/cmd/tui.py b/system_setup/cmd/tui.py index c3cbe46d..6b1212b9 100755 --- a/system_setup/cmd/tui.py +++ b/system_setup/cmd/tui.py @@ -55,8 +55,10 @@ def make_client_args_parser(): parser.add_argument( "--prefill", dest="prefill", - help="Prefills UI models with data provided in" - " a prefill.yaml file yet allowing overrides.", + help=( + "Prefills UI models with data provided in" + " a prefill.yaml file yet allowing overrides." + ), ) parser.add_argument( "--output-base", diff --git a/system_setup/server/controllers/configure.py b/system_setup/server/controllers/configure.py index afd5d85e..24b970b7 100644 --- a/system_setup/server/controllers/configure.py +++ b/system_setup/server/controllers/configure.py @@ -166,7 +166,7 @@ class ConfigureController(SubiquityController): envcp = None if not os.path.exists(data_dir): log.error( - "Language selector data dir %s seems not to be part" " of the snap.", + "Language selector data dir %s seems not to be part of the snap.", data_dir, ) # Try seeded L-S-C @@ -405,7 +405,7 @@ class ConfigureController(SubiquityController): assign_grp_proc = await arun_command(assign_grp_cmd, env=env) if assign_grp_proc.returncode != 0: raise Exception( - ("Failed to assign group to user %s: %s") + "Failed to assign group to user %s: %s" % (username, assign_grp_proc.stderr) ) diff --git a/system_setup/ui/views/wslconfadvanced.py b/system_setup/ui/views/wslconfadvanced.py index ba138c38..401c4d48 100644 --- a/system_setup/ui/views/wslconfadvanced.py +++ b/system_setup/ui/views/wslconfadvanced.py @@ -70,7 +70,7 @@ class WSLConfigurationAdvancedForm(Form): class WSLConfigurationAdvancedView(BaseView): title = _("WSL Configuration - Advanced options") excerpt = _( - "In this page, you can configure Ubuntu WSL " "advanced options your needs. \n" + "In this page, you can configure Ubuntu WSL advanced options your needs. \n" ) def __init__(self, controller, configuration_data): diff --git a/system_setup/ui/views/wslconfbase.py b/system_setup/ui/views/wslconfbase.py index dac09d07..1bfafae8 100644 --- a/system_setup/ui/views/wslconfbase.py +++ b/system_setup/ui/views/wslconfbase.py @@ -38,21 +38,21 @@ class WSLConfBaseForm(Form): _("Mount Location"), help=_("Location for the automount") ) automount_options = StringField( - _("Mount Option"), help=_("Mount option passed " "for the automount") + _("Mount Option"), help=_("Mount option passed for the automount") ) network_generatehosts = BooleanField( _("Enable Host Generation"), - help=_("Selecting enables /etc/host re-generation at" " every start"), + help=_("Selecting enables /etc/host re-generation at every start"), ) network_generateresolvconf = BooleanField( _("Enable resolv.conf Generation"), - help=_("Selecting enables /etc/resolv.conf re-generation" " at every start"), + help=_("Selecting enables /etc/resolv.conf re-generation at every start"), ) def validate_automount_root(self): p = self.automount_root.value if p != "" and (re.fullmatch(r"(/[^/ ]*)+/?", p) is None): - return _("Mount location must be a absolute UNIX path" " without space.") + return _("Mount location must be a absolute UNIX path without space.") def validate_automount_options(self): o = self.automount_options.value