From 39e3274a566178fc22480e577a8acd6b301a4677 Mon Sep 17 00:00:00 2001 From: ferbraher Date: Tue, 19 Mar 2024 11:52:27 +0100 Subject: [PATCH] removed format for python 3.5 --- contrib/genio/bin/brightness_test.py | 14 +++++++------- contrib/genio/bin/cpu_idle.py | 4 ++-- contrib/genio/bin/pmic_regulator.py | 4 ++-- contrib/genio/bin/serialcheck.py | 6 +++--- contrib/genio/bin/spidev_test.py | 8 ++++---- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/contrib/genio/bin/brightness_test.py b/contrib/genio/bin/brightness_test.py index 48006e5e3..90d25833f 100755 --- a/contrib/genio/bin/brightness_test.py +++ b/contrib/genio/bin/brightness_test.py @@ -126,22 +126,22 @@ def brightness_test(self, target_interface): exit_status = 0 find_target_display = False - print(f'Available Interfaces: {self.interfaces}') + print('Available Interfaces: {}'.format(self.interfaces)) for interface in self.interfaces: if target_interface in interface: find_target_display = True # Get the current brightness which we can restore later original_brightness = self.get_actual_brightness(interface) - print(f'Current brightness: {original_brightness}') + print('Current brightness: {}'.format(original_brightness)) # Get the maximum value for brightness max_brightness = self.get_max_brightness(interface) - print(f'Maximum brightness: {max_brightness}\n') + print('Maximum brightness: {}\n'.format(max_brightness)) for m in [0, 0.25, 0.5, 0.75, 1]: # Set the brightness to half the max value current_brightness = math.ceil(max_brightness * m) - print(f'Set the brightness as {current_brightness}') + print('Set the brightness as {}'.format(current_brightness)) self.write_value( current_brightness, os.path.join(interface, 'brightness')) @@ -159,7 +159,7 @@ def brightness_test(self, target_interface): os.path.join(interface, 'brightness')) print( 'Set brightness back to original value:' - f'{original_brightness}' + '{}'.format(original_brightness) ) # Close the loop since the target display has been tested break @@ -208,12 +208,12 @@ def main(): file=sys.stderr) exit(1) - print(f"Test the brightness of '{args.display}' display") + print("Test the brightness of '{}' display".format(args.display)) target_interface = '' try: target_interface = tables[args.platform][args.display] - print(f"Interface: {target_interface}\n") + print("Interface: {}\n".format(target_interface)) except KeyError: raise SystemExit( f"ERROR: no suitable interface of {args.display} display") diff --git a/contrib/genio/bin/cpu_idle.py b/contrib/genio/bin/cpu_idle.py index fd6e4e64b..442be111e 100755 --- a/contrib/genio/bin/cpu_idle.py +++ b/contrib/genio/bin/cpu_idle.py @@ -58,8 +58,8 @@ def output_checker(cpu, state, name, disable, usage): @param:usage ''' fail = 0 - print(f'CPU node: cpu/{cpu}/cpuidle/state{state}') - print(f'Got name: {name[0]}, disable: {disable[0]}, usage: {usage}') + print('CPU node: cpu/{}/cpuidle/state{}'.format(cpu, state)) + print('Got name: {}, disable: {}, usage: {}'.format(name[0], disable[0], usage)) if name[0] != name[1]: node_path = GENERAL_PATH.format(cpu, state, 'name') error_handler('name', node_path, name[0], name[1]) diff --git a/contrib/genio/bin/pmic_regulator.py b/contrib/genio/bin/pmic_regulator.py index 2419071d0..81f9b5b64 100755 --- a/contrib/genio/bin/pmic_regulator.py +++ b/contrib/genio/bin/pmic_regulator.py @@ -61,11 +61,11 @@ def test_regulator(soc): expect_set = mt8365_MAIN_REGULATORS if soc == 'mt8365' else MAIN_REGULATORS current_set = read_all_name() for node in expect_set: - print(f'Checking the \'{node}\' node exists in System...') + print('Checking the \'{0}\' node exists in System...'.format(node)) if node not in current_set: missing_node = True print( - f' - ERROR: expect the \'{node}\' node exist but it doesn\'t') + ' - ERROR: expect the \'{0}\' node exist but it doesn\'t'.format(node)) if missing_node: print('Test Fail') diff --git a/contrib/genio/bin/serialcheck.py b/contrib/genio/bin/serialcheck.py index cd363fbf2..6dd6d49a5 100755 --- a/contrib/genio/bin/serialcheck.py +++ b/contrib/genio/bin/serialcheck.py @@ -18,8 +18,8 @@ def runcmd(command): def test_uart_by_serialcheck(soc): base_path = os.environ.get('PLAINBOX_SESSION_SHARE', '/tmp') - file_path = f'{base_path}/binary' - runcmd([f'dd if=/dev/urandom of={file_path} count=1 bs=4096']) + file_path = '{}/binary'.format(base_path) + runcmd(['dd if=/dev/urandom of={} count=1 bs=4096'.format(file_path)]) golden_msg = ( 'cts: 0 dsr: 0 rng: 0 dcd: 0 rx: 12288' @@ -39,7 +39,7 @@ def test_uart_by_serialcheck(soc): fail = False for br in available_baudrate: print('\n' + '*' * 80) - print(f'Testing baudrate: {br}\n') + print('Testing baudrate: {}\n'.format(br)) ret = runcmd([cmd.format(tty_node, file_path, br)]) print(ret.stdout) if ret.returncode != 0 or ret.stdout.split('\n')[-2] != golden_msg: diff --git a/contrib/genio/bin/spidev_test.py b/contrib/genio/bin/spidev_test.py index 1af658b83..ee189d69f 100755 --- a/contrib/genio/bin/spidev_test.py +++ b/contrib/genio/bin/spidev_test.py @@ -34,12 +34,12 @@ def test_spi_content_consistency(platform): check_spi_node(spi_path) - test_bin_path = f'{PLAINBOX_PROVIDER_DATA}/spi/test.bin' + test_bin_path = '{}/spi/test.bin'.format(PLAINBOX_PROVIDER_DATA) cmd = ( - f'genio-test-tool.spidev-test -D' - f' {spi_path} -s 400000 -i {test_bin_path} -v' + 'genio-test-tool.spidev-test -D' + ' {} -s 400000 -i {} -v'.format(spi_path, test_bin_path) ) - print(f'Run command: {cmd}\n') + print('Run command: {}\n'.format(cmd)) spi_ret = runcmd([cmd]) print(spi_ret.stdout)