
From: Simon Glass <sjg@chromium.org> There are quite a few warnings which makes it confusing when editing this file. Resolve them. Signed-off-by: Simon Glass <sjg@chromium.org> --- test/py/console_sandbox.py | 35 ++++++++++------------------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/test/py/console_sandbox.py b/test/py/console_sandbox.py index dd721067f8f..c9a5a057bb8 100644 --- a/test/py/console_sandbox.py +++ b/test/py/console_sandbox.py @@ -18,14 +18,11 @@ class ConsoleSandbox(ConsoleBase): """Initialize a U-Boot console connection. Args: - log: A multiplexed_log.Logfile instance. - config: A "configuration" object as defined in conftest.py. - - Returns: - Nothing. + log (multiplexed_log.Logfile): Log file to write to + config (ArbitraryAttributeContainer): ubconfig "configuration" + object as defined in conftest.py """ - - super(ConsoleSandbox, self).__init__(log, config, max_fifo_fill=1024) + super().__init__(log, config, max_fifo_fill=1024) self.sandbox_flags = [] self.use_dtb = True @@ -35,13 +32,9 @@ class ConsoleSandbox(ConsoleBase): A new sandbox process is created, so that U-Boot begins running from scratch. - Args: - None. - Returns: A spawn.Spawn object that is attached to U-Boot. """ - bcfg = self.config.buildconfig config_spl = bcfg.get('config_spl', 'n') == 'y' config_vpl = bcfg.get('config_vpl', 'n') == 'y' @@ -64,13 +57,13 @@ class ConsoleSandbox(ConsoleBase): """Run U-Boot with the given command-line flags Args: - flags: List of flags to pass, each a string - use_dtb: True to use a device tree file, False to run without one + flags (list of str): List of flags to pass + use_dtb (bool): True to use a device tree file, False to run without + one Returns: A spawn.Spawn object that is attached to U-Boot. """ - try: self.sandbox_flags = flags self.use_dtb = use_dtb @@ -83,13 +76,9 @@ class ConsoleSandbox(ConsoleBase): """Send a specific Unix signal to the sandbox process. Args: - sig: The Unix signal to send to the process. - - Returns: - Nothing. + sig (int): Unix signal to send to the process """ - - self.log.action('kill %d' % sig) + self.log.action(f'kill {sig}') self.p.kill(sig) def validate_exited(self): @@ -98,16 +87,12 @@ class ConsoleSandbox(ConsoleBase): If required, this function waits a reasonable time for the process to exit. - Args: - None. - Returns: Boolean indicating whether the process has exited. """ - p = self.p self.p = None - for i in range(100): + for _ in range(100): ret = not p.isalive() if ret: break -- 2.43.0