Fixed linting

This commit is contained in:
Jean-Baptiste Lallement 2021-08-31 13:26:49 +02:00
parent ba6ce20d64
commit 518cff3d3b
12 changed files with 35 additions and 27 deletions

View File

@ -39,7 +39,8 @@ class SystemSetupClient(SubiquityClient):
def __init__(self, opts):
# TODO WSL:
# 1. remove reconfigure flag
# 2. decide on which UI to show up based on existing user UID >=1000 (or default user set in wsl.conf?)
# 2. decide on which UI to show up based on existing user UID >=1000
# (or default user set in wsl.conf?)
# 3. provide an API for this for the flutter UI to know about it
# 4. Add Configuration Base page before Advanced
# 5. Add language page

View File

@ -19,7 +19,8 @@ from subiquity.client.controller import SubiquityTuiController
from subiquity.common.types import WSLConfigurationAdvanced
from system_setup.ui.views.wslconfadvanced import WSLConfigurationAdvancedView
log = logging.getLogger('system_setup.client.controllers.wslconfigurationadvanced')
log = logging.getLogger(
'system_setup.client.controllers.wslconfigurationadvanced')
class WSLConfigurationAdvancedController(SubiquityTuiController):

View File

@ -6,6 +6,7 @@ from system_setup.ui.views.wslconfbase import WSLConfigurationBaseView
log = logging.getLogger('system_setup.client.controllers.wslconfigurationbase')
class WSLConfigurationBaseController(SubiquityTuiController):
endpoint_name = 'wslconfbase'

View File

@ -23,6 +23,7 @@ log = logging.getLogger('subiquity.models.wsl_configuration_advanced')
# TODO WSL: Remove all attributes in wslconfbase
@attr.s
class WSLConfigurationAdvanced(object):
gui_theme = attr.ib()
@ -68,7 +69,8 @@ class WSLConfigurationAdvancedModel(object):
d['automount'] = result.automount
d['mountfstab'] = result.mountfstab
self._wslconfadvanced = WSLConfigurationAdvancedModel(**d)
# TODO WSL: Drop all calls of ubuntuwsl here and ensure the data are passed to the app model
# TODO WSL: Drop all calls of ubuntuwsl here and ensure the data
# are passed to the app model
if not is_dry_run:
# reset to keep everything as refreshed as new
run_command(["/usr/bin/ubuntuwsl", "reset", "-y"],

View File

@ -45,7 +45,8 @@ class WSLConfigurationBaseModel(object):
d['gen_host'] = result.gen_host
d['gen_resolvconf'] = result.gen_resolvconf
self._wslconfbase = WSLConfigurationBase(**d)
# TODO WSL: Drop all calls of ubuntuwsl here and ensure the data are passed to the app model
# TODO WSL: Drop all calls of ubuntuwsl here and ensure the data
# are passed to the app model
if not is_dry_run:
# reset to keep everything as refreshed as new
run_command(["/usr/bin/ubuntuwsl", "reset", "-y"],

View File

@ -14,7 +14,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import logging
import re
from subiquitycore.context import with_context
@ -36,7 +35,6 @@ class ConfigureController(SubiquityController):
super().__init__(app)
self.model = app.base_model
def start(self):
self.install_task = self.app.aio_loop.create_task(self.configure())
@ -57,7 +55,8 @@ class ConfigureController(SubiquityController):
# TODO WSL:
# 1. Use self.model to get all data to commit
# 2. Write directly (without wsl utilities) to wsl.conf and other fstab files
# 2. Write directly (without wsl utilities) to wsl.conf and other
# fstab files
# This must not use subprocesses.
# If dry-run: write in .subiquity
@ -72,4 +71,4 @@ class ConfigureController(SubiquityController):
def stop_uu(self):
# This is a no-op to allow Shutdown controller to depend on this one
pass
pass

View File

@ -13,15 +13,9 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import asyncio
import logging
import os
import platform
import subprocess
from subiquitycore.context import with_context
from subiquitycore.utils import arun_command, run_command
from subiquity.common.types import ShutdownMode
from subiquity.server.controllers import ShutdownController
@ -31,7 +25,8 @@ log = logging.getLogger("system_setup.controllers.restart")
class SetupShutdownController(ShutdownController):
def __init__(self, app):
# This isn't the most beautiful way, but the shutdown controller depends on Install, override with our configure one.
# This isn't the most beautiful way, but the shutdown controller
# depends on Install, override with our configure one.
super().__init__(app)
self.app.controllers.Install = self.app.controllers.Configure
@ -40,7 +35,6 @@ class SetupShutdownController(ShutdownController):
self.server_reboot_event.set()
self.app.aio_loop.create_task(self._run())
@with_context(description='mode={self.mode.name}')
def shutdown(self, context):
self.shuttingdown_event.set()

View File

@ -24,7 +24,9 @@ from subiquity.common.apidef import API
from subiquity.common.types import WSLConfigurationAdvanced
from subiquity.server.controller import SubiquityController
log = logging.getLogger('subiquity.server.controllers.wsl_configuration_advanced')
log = logging.getLogger(
'subiquity.server.controllers.wsl_configuration_advanced')
# TODO WSL: remove all duplicates from WSL config base controller
class WSLConfigurationAdvancedController(SubiquityController):
@ -173,7 +175,8 @@ class WSLConfigurationAdvancedController(SubiquityController):
data.interop_appendwindowspath = \
self.model.wslconfadvanced.interop_appendwindowspath
data.gui_theme = self.model.wslconfadvanced.gui_theme
data.gui_followwintheme = self.model.wslconfadvanced.gui_followwintheme
data.gui_followwintheme = \
self.model.wslconfadvanced.gui_followwintheme
data.legacy_gui = self.model.wslconfadvanced.legacy_gui
data.legacy_audio = self.model.wslconfadvanced.legacy_audio
data.adv_ip_detect = self.model.wslconfadvanced.adv_ip_detect

View File

@ -35,8 +35,11 @@ class SystemSetupServer(SubiquityServer):
]
def __init__(self, opts, block_log_dir):
# TODO WSL: remove reconfigure argument parser option and check dynamically what needs to be presented.
# TODO WSL: we should have WSLConfigurationBase here to show multiple pages.
# TODO WSL:
# remove reconfigure argument parser option and check dynamically
# what needs to be presented.
# TODO WSL:
# we should have WSLConfigurationBase here to show multiple pages.
self.is_reconfig = opts.reconfigure
if self.is_reconfig and not opts.dry_run:
self.controllers = [

View File

@ -4,8 +4,6 @@ Overview provides user with the overview of all the current settings.
"""
import os
import logging
from subiquitycore.ui.buttons import done_btn

View File

@ -1,6 +1,7 @@
""" WSLConfigurationAdvanced View
WSLConfigurationAdvanced provides user with options with additional settings for advanced configuration.
WSLConfigurationAdvanced provides user with options with additional settings
for advanced configuration.
"""
import re
@ -37,7 +38,8 @@ MountField = simple_field(MountEditor)
StringField = simple_field(StringEditor)
# TODO WSL: Advanced should not contain base configuration (it must be in 2 pages).
# TODO WSL: Advanced should not contain base configuration
# (it must be in 2 pages).
class WSLConfigurationAdvancedForm(Form):
def __init__(self, initial):
@ -143,7 +145,8 @@ class WSLConfigurationAdvancedForm(Form):
class WSLConfigurationAdvancedView(BaseView):
title = _("WSL advanced options")
excerpt = _("In this page, you can configure Ubuntu WSL advanced options your needs. \n")
excerpt = _("In this page, you can configure Ubuntu WSL"
"advanced options your needs. \n")
def __init__(self, controller, configuration_data):
self.controller = controller

View File

@ -1,6 +1,7 @@
""" WSLConfBase
WSLConfBase provides user with options to set up basic WSL configuration, requested on first setup.
WSLConfBase provides user with options to set up basic WSL configuration,
requested on first setup.
"""
import re
@ -91,7 +92,8 @@ class WSLConfBaseForm(Form):
class WSLConfigurationBaseView(BaseView):
title = _("WSL configuration options")
excerpt = _("In this page, you can configure Ubuntu WSL options to your needs.\n")
excerpt = _(
"In this page, you can configure Ubuntu WSL options to your needs.\n")
def __init__(self, controller, configuration_data):
self.controller = controller