diff --git a/.azure-pipelines/scripts/combine-coverage.py b/.azure-pipelines/scripts/combine-coverage.py index 727d2502..afadeaa3 100755 --- a/.azure-pipelines/scripts/combine-coverage.py +++ b/.azure-pipelines/scripts/combine-coverage.py @@ -7,9 +7,6 @@ It is up to pipeline authors to avoid name collisions when deviating from the recommended format. """ -from __future__ import absolute_import, division, print_function - -__metaclass__ = type import os import re @@ -41,14 +38,14 @@ def main(): jobs[label] = max(attempt, jobs.get(label, 0)) for label, attempt in jobs.items(): - name = "Coverage {attempt} {label}".format(label=label, attempt=attempt) + name = f"Coverage {attempt} {label}" source = os.path.join(source_directory, name) source_files = os.listdir(source) for source_file in source_files: source_path = os.path.join(source, source_file) destination_path = os.path.join(destination_directory, source_file + "." + label) - print('"%s" -> "%s"' % (source_path, destination_path)) + print(f'"{source_path}" -> "{destination_path}"') shutil.copyfile(source_path, destination_path) count += 1 diff --git a/.azure-pipelines/scripts/time-command.py b/.azure-pipelines/scripts/time-command.py index a734ca3a..ada4d5a8 100755 --- a/.azure-pipelines/scripts/time-command.py +++ b/.azure-pipelines/scripts/time-command.py @@ -1,9 +1,6 @@ #!/usr/bin/env python """Prepends a relative timestamp to each input line from stdin and writes it to stdout.""" -from __future__ import absolute_import, division, print_function - -__metaclass__ = type import sys import time diff --git a/plugins/doc_fragments/hcloud.py b/plugins/doc_fragments/hcloud.py index 43288672..80f0d8ea 100644 --- a/plugins/doc_fragments/hcloud.py +++ b/plugins/doc_fragments/hcloud.py @@ -1,12 +1,8 @@ -# -*- coding: utf-8 -*- # Copyright: (c) 2019, Hetzner Cloud GmbH # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -class ModuleDocFragment(object): +class ModuleDocFragment: DOCUMENTATION = """ options: api_token: diff --git a/plugins/inventory/hcloud.py b/plugins/inventory/hcloud.py index 50dcea67..96829471 100644 --- a/plugins/inventory/hcloud.py +++ b/plugins/inventory/hcloud.py @@ -1,9 +1,6 @@ # Copyright (c) 2019 Hetzner Cloud GmbH # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function - -__metaclass__ = type DOCUMENTATION = r""" name: hcloud @@ -320,10 +317,10 @@ def _first_ipv6_address(self, network): def verify_file(self, path): """Return the possibly of a file being consumable by this plugin.""" - return super(InventoryModule, self).verify_file(path) and path.endswith(("hcloud.yaml", "hcloud.yml")) + return super().verify_file(path) and path.endswith(("hcloud.yaml", "hcloud.yml")) def parse(self, inventory, loader, path, cache=True): - super(InventoryModule, self).parse(inventory, loader, path, cache) + super().parse(inventory, loader, path, cache) if not HAS_HCLOUD: raise AnsibleError("The Hetzner Cloud dynamic inventory plugin requires hcloud-python.") diff --git a/plugins/module_utils/hcloud.py b/plugins/module_utils/hcloud.py index 932b0c52..cb99555e 100644 --- a/plugins/module_utils/hcloud.py +++ b/plugins/module_utils/hcloud.py @@ -1,11 +1,7 @@ -# -*- coding: utf-8 -*- # Copyright: (c) 2019, Hetzner Cloud GmbH # Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) -from __future__ import absolute_import, division, print_function - -__metaclass__ = type from ansible.module_utils.ansible_release import __version__ from ansible.module_utils.basic import env_fallback, missing_required_lib @@ -18,7 +14,7 @@ HAS_HCLOUD = False -class Hcloud(object): +class Hcloud: def __init__(self, module, represent): self.module = module self.represent = represent diff --git a/plugins/modules/hcloud_certificate.py b/plugins/modules/hcloud_certificate.py index 36a5cf5a..acb4b6c3 100644 --- a/plugins/modules/hcloud_certificate.py +++ b/plugins/modules/hcloud_certificate.py @@ -1,12 +1,8 @@ #!/usr/bin/python -# -*- coding: utf-8 -*- # Copyright: (c) 2020, Hetzner Cloud GmbH # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function - -__metaclass__ = type DOCUMENTATION = """ --- diff --git a/plugins/modules/hcloud_certificate_info.py b/plugins/modules/hcloud_certificate_info.py index 35137bc4..e41aa44b 100644 --- a/plugins/modules/hcloud_certificate_info.py +++ b/plugins/modules/hcloud_certificate_info.py @@ -1,12 +1,8 @@ #!/usr/bin/python -# -*- coding: utf-8 -*- # Copyright: (c) 2020, Hetzner Cloud GmbH # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function - -__metaclass__ = type DOCUMENTATION = """ --- diff --git a/plugins/modules/hcloud_datacenter_info.py b/plugins/modules/hcloud_datacenter_info.py index 7ed6fca5..5c4b8357 100644 --- a/plugins/modules/hcloud_datacenter_info.py +++ b/plugins/modules/hcloud_datacenter_info.py @@ -1,12 +1,8 @@ #!/usr/bin/python -# -*- coding: utf-8 -*- # Copyright: (c) 2019, Hetzner Cloud GmbH # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function - -__metaclass__ = type DOCUMENTATION = """ --- diff --git a/plugins/modules/hcloud_firewall.py b/plugins/modules/hcloud_firewall.py index cf91ca53..3677d738 100644 --- a/plugins/modules/hcloud_firewall.py +++ b/plugins/modules/hcloud_firewall.py @@ -1,12 +1,8 @@ #!/usr/bin/python -# -*- coding: utf-8 -*- # Copyright: (c) 2020, Hetzner Cloud GmbH # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function - -__metaclass__ = type DOCUMENTATION = """ --- diff --git a/plugins/modules/hcloud_floating_ip.py b/plugins/modules/hcloud_floating_ip.py index 4a082736..476147ed 100644 --- a/plugins/modules/hcloud_floating_ip.py +++ b/plugins/modules/hcloud_floating_ip.py @@ -1,12 +1,8 @@ #!/usr/bin/python -# -*- coding: utf-8 -*- # Copyright: (c) 2019, Hetzner Cloud GmbH # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function - -__metaclass__ = type DOCUMENTATION = """ --- diff --git a/plugins/modules/hcloud_floating_ip_info.py b/plugins/modules/hcloud_floating_ip_info.py index bc2b1ac6..79141a43 100644 --- a/plugins/modules/hcloud_floating_ip_info.py +++ b/plugins/modules/hcloud_floating_ip_info.py @@ -1,12 +1,8 @@ #!/usr/bin/python -# -*- coding: utf-8 -*- # Copyright: (c) 2019, Hetzner Cloud GmbH # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function - -__metaclass__ = type DOCUMENTATION = """ --- diff --git a/plugins/modules/hcloud_image_info.py b/plugins/modules/hcloud_image_info.py index ca3b6058..cea660e2 100644 --- a/plugins/modules/hcloud_image_info.py +++ b/plugins/modules/hcloud_image_info.py @@ -1,12 +1,8 @@ #!/usr/bin/python -# -*- coding: utf-8 -*- # Copyright: (c) 2019, Hetzner Cloud GmbH # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function - -__metaclass__ = type DOCUMENTATION = """ --- diff --git a/plugins/modules/hcloud_load_balancer.py b/plugins/modules/hcloud_load_balancer.py index febb81ed..620fdd39 100644 --- a/plugins/modules/hcloud_load_balancer.py +++ b/plugins/modules/hcloud_load_balancer.py @@ -1,12 +1,8 @@ #!/usr/bin/python -# -*- coding: utf-8 -*- # Copyright: (c) 2020, Hetzner Cloud GmbH # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function - -__metaclass__ = type DOCUMENTATION = """ --- diff --git a/plugins/modules/hcloud_load_balancer_info.py b/plugins/modules/hcloud_load_balancer_info.py index 0241bc10..6beeacf7 100644 --- a/plugins/modules/hcloud_load_balancer_info.py +++ b/plugins/modules/hcloud_load_balancer_info.py @@ -1,12 +1,8 @@ #!/usr/bin/python -# -*- coding: utf-8 -*- # Copyright: (c) 2020, Hetzner Cloud GmbH # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function - -__metaclass__ = type DOCUMENTATION = """ --- diff --git a/plugins/modules/hcloud_load_balancer_network.py b/plugins/modules/hcloud_load_balancer_network.py index c37df480..3c47e31e 100644 --- a/plugins/modules/hcloud_load_balancer_network.py +++ b/plugins/modules/hcloud_load_balancer_network.py @@ -1,12 +1,8 @@ #!/usr/bin/python -# -*- coding: utf-8 -*- # Copyright: (c) 2020, Hetzner Cloud GmbH # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function - -__metaclass__ = type DOCUMENTATION = """ --- diff --git a/plugins/modules/hcloud_load_balancer_service.py b/plugins/modules/hcloud_load_balancer_service.py index 49f82c29..dd2dad25 100644 --- a/plugins/modules/hcloud_load_balancer_service.py +++ b/plugins/modules/hcloud_load_balancer_service.py @@ -1,12 +1,8 @@ #!/usr/bin/python -# -*- coding: utf-8 -*- # Copyright: (c) 2020, Hetzner Cloud GmbH # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function - -__metaclass__ = type DOCUMENTATION = """ --- diff --git a/plugins/modules/hcloud_load_balancer_target.py b/plugins/modules/hcloud_load_balancer_target.py index e839863c..3e89aa2c 100644 --- a/plugins/modules/hcloud_load_balancer_target.py +++ b/plugins/modules/hcloud_load_balancer_target.py @@ -1,12 +1,8 @@ #!/usr/bin/python -# -*- coding: utf-8 -*- # Copyright: (c) 2019, Hetzner Cloud GmbH # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function - -__metaclass__ = type DOCUMENTATION = """ --- diff --git a/plugins/modules/hcloud_load_balancer_type_info.py b/plugins/modules/hcloud_load_balancer_type_info.py index 3f130152..0530d49a 100644 --- a/plugins/modules/hcloud_load_balancer_type_info.py +++ b/plugins/modules/hcloud_load_balancer_type_info.py @@ -1,12 +1,8 @@ #!/usr/bin/python -# -*- coding: utf-8 -*- # Copyright: (c) 2019, Hetzner Cloud GmbH # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function - -__metaclass__ = type DOCUMENTATION = """ --- diff --git a/plugins/modules/hcloud_location_info.py b/plugins/modules/hcloud_location_info.py index d25b1ebd..bd69e552 100644 --- a/plugins/modules/hcloud_location_info.py +++ b/plugins/modules/hcloud_location_info.py @@ -1,12 +1,8 @@ #!/usr/bin/python -# -*- coding: utf-8 -*- # Copyright: (c) 2019, Hetzner Cloud GmbH # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function - -__metaclass__ = type DOCUMENTATION = """ --- diff --git a/plugins/modules/hcloud_network.py b/plugins/modules/hcloud_network.py index ad38b062..1cc7eb2b 100644 --- a/plugins/modules/hcloud_network.py +++ b/plugins/modules/hcloud_network.py @@ -1,12 +1,8 @@ #!/usr/bin/python -# -*- coding: utf-8 -*- # Copyright: (c) 2019, Hetzner Cloud GmbH # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function - -__metaclass__ = type DOCUMENTATION = """ --- diff --git a/plugins/modules/hcloud_network_info.py b/plugins/modules/hcloud_network_info.py index 787623e5..8c657770 100644 --- a/plugins/modules/hcloud_network_info.py +++ b/plugins/modules/hcloud_network_info.py @@ -1,12 +1,8 @@ #!/usr/bin/python -# -*- coding: utf-8 -*- # Copyright: (c) 2019, Hetzner Cloud GmbH # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function - -__metaclass__ = type DOCUMENTATION = """ --- diff --git a/plugins/modules/hcloud_placement_group.py b/plugins/modules/hcloud_placement_group.py index 178b2915..eba71cc0 100644 --- a/plugins/modules/hcloud_placement_group.py +++ b/plugins/modules/hcloud_placement_group.py @@ -1,12 +1,8 @@ #!/usr/bin/python -# -*- coding: utf-8 -*- # Copyright: (c) 2020, Hetzner Cloud GmbH # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function - -__metaclass__ = type DOCUMENTATION = """ --- diff --git a/plugins/modules/hcloud_primary_ip.py b/plugins/modules/hcloud_primary_ip.py index d3805032..32605c14 100644 --- a/plugins/modules/hcloud_primary_ip.py +++ b/plugins/modules/hcloud_primary_ip.py @@ -1,12 +1,8 @@ #!/usr/bin/python -# -*- coding: utf-8 -*- # Copyright: (c) 2022, Hetzner Cloud GmbH # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function - -__metaclass__ = type DOCUMENTATION = """ --- diff --git a/plugins/modules/hcloud_primary_ip_info.py b/plugins/modules/hcloud_primary_ip_info.py index bfef0842..8be73977 100644 --- a/plugins/modules/hcloud_primary_ip_info.py +++ b/plugins/modules/hcloud_primary_ip_info.py @@ -1,12 +1,8 @@ #!/usr/bin/python -# -*- coding: utf-8 -*- # Copyright: (c) 2019, Hetzner Cloud GmbH # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function - -__metaclass__ = type DOCUMENTATION = """ --- diff --git a/plugins/modules/hcloud_rdns.py b/plugins/modules/hcloud_rdns.py index a2286763..f559a4e8 100644 --- a/plugins/modules/hcloud_rdns.py +++ b/plugins/modules/hcloud_rdns.py @@ -1,12 +1,8 @@ #!/usr/bin/python -# -*- coding: utf-8 -*- # Copyright: (c) 2019, Hetzner Cloud GmbH # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function - -__metaclass__ = type DOCUMENTATION = """ --- diff --git a/plugins/modules/hcloud_route.py b/plugins/modules/hcloud_route.py index 2b50f125..5a777875 100644 --- a/plugins/modules/hcloud_route.py +++ b/plugins/modules/hcloud_route.py @@ -1,12 +1,8 @@ #!/usr/bin/python -# -*- coding: utf-8 -*- # Copyright: (c) 2019, Hetzner Cloud GmbH # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function - -__metaclass__ = type DOCUMENTATION = """ --- diff --git a/plugins/modules/hcloud_server.py b/plugins/modules/hcloud_server.py index ffb8be7d..1843bdcd 100644 --- a/plugins/modules/hcloud_server.py +++ b/plugins/modules/hcloud_server.py @@ -1,12 +1,8 @@ #!/usr/bin/python -# -*- coding: utf-8 -*- # Copyright: (c) 2019, Hetzner Cloud GmbH # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function - -__metaclass__ = type DOCUMENTATION = """ --- diff --git a/plugins/modules/hcloud_server_info.py b/plugins/modules/hcloud_server_info.py index ba4d61dc..6087d843 100644 --- a/plugins/modules/hcloud_server_info.py +++ b/plugins/modules/hcloud_server_info.py @@ -1,12 +1,8 @@ #!/usr/bin/python -# -*- coding: utf-8 -*- # Copyright: (c) 2019, Hetzner Cloud GmbH # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function - -__metaclass__ = type DOCUMENTATION = """ --- diff --git a/plugins/modules/hcloud_server_network.py b/plugins/modules/hcloud_server_network.py index c1b92e23..33b562ae 100644 --- a/plugins/modules/hcloud_server_network.py +++ b/plugins/modules/hcloud_server_network.py @@ -1,12 +1,8 @@ #!/usr/bin/python -# -*- coding: utf-8 -*- # Copyright: (c) 2019, Hetzner Cloud GmbH # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function - -__metaclass__ = type DOCUMENTATION = """ --- diff --git a/plugins/modules/hcloud_server_type_info.py b/plugins/modules/hcloud_server_type_info.py index e0863dfb..4e1ba232 100644 --- a/plugins/modules/hcloud_server_type_info.py +++ b/plugins/modules/hcloud_server_type_info.py @@ -1,12 +1,8 @@ #!/usr/bin/python -# -*- coding: utf-8 -*- # Copyright: (c) 2019, Hetzner Cloud GmbH # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function - -__metaclass__ = type DOCUMENTATION = """ --- diff --git a/plugins/modules/hcloud_ssh_key.py b/plugins/modules/hcloud_ssh_key.py index c0b4c292..cbcdeeeb 100644 --- a/plugins/modules/hcloud_ssh_key.py +++ b/plugins/modules/hcloud_ssh_key.py @@ -1,12 +1,8 @@ #!/usr/bin/python -# -*- coding: utf-8 -*- # Copyright: (c) 2019, Hetzner Cloud GmbH # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function - -__metaclass__ = type DOCUMENTATION = """ --- diff --git a/plugins/modules/hcloud_ssh_key_info.py b/plugins/modules/hcloud_ssh_key_info.py index 2a0477d3..31ea15f7 100644 --- a/plugins/modules/hcloud_ssh_key_info.py +++ b/plugins/modules/hcloud_ssh_key_info.py @@ -1,12 +1,8 @@ #!/usr/bin/python -# -*- coding: utf-8 -*- # Copyright: (c) 2019, Hetzner Cloud GmbH # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function - -__metaclass__ = type DOCUMENTATION = """ --- diff --git a/plugins/modules/hcloud_subnetwork.py b/plugins/modules/hcloud_subnetwork.py index 039514e9..4e77db62 100644 --- a/plugins/modules/hcloud_subnetwork.py +++ b/plugins/modules/hcloud_subnetwork.py @@ -1,12 +1,8 @@ #!/usr/bin/python -# -*- coding: utf-8 -*- # Copyright: (c) 2019, Hetzner Cloud GmbH # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function - -__metaclass__ = type DOCUMENTATION = """ --- diff --git a/plugins/modules/hcloud_volume.py b/plugins/modules/hcloud_volume.py index 09624785..3377b7c1 100644 --- a/plugins/modules/hcloud_volume.py +++ b/plugins/modules/hcloud_volume.py @@ -1,12 +1,8 @@ #!/usr/bin/python -# -*- coding: utf-8 -*- # Copyright: (c) 2019, Hetzner Cloud GmbH # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function - -__metaclass__ = type DOCUMENTATION = """ --- diff --git a/plugins/modules/hcloud_volume_info.py b/plugins/modules/hcloud_volume_info.py index 63b7c9cd..dd7fc896 100644 --- a/plugins/modules/hcloud_volume_info.py +++ b/plugins/modules/hcloud_volume_info.py @@ -1,12 +1,8 @@ #!/usr/bin/python -# -*- coding: utf-8 -*- # Copyright: (c) 2019, Hetzner Cloud GmbH # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function - -__metaclass__ = type DOCUMENTATION = """ --- diff --git a/tests/utils/shippable/check_matrix.py b/tests/utils/shippable/check_matrix.py index a9750832..c130655d 100755 --- a/tests/utils/shippable/check_matrix.py +++ b/tests/utils/shippable/check_matrix.py @@ -1,8 +1,6 @@ #!/usr/bin/env python """Verify the currently executing Shippable test matrix matches the one defined in the "shippable.yml" file.""" -from __future__ import absolute_import, division, print_function -__metaclass__ = type import datetime import json @@ -31,7 +29,7 @@ def main(): # type: () -> None if repo_full_name != required_repo_full_name: sys.stderr.write( - 'Skipping matrix check on repo "%s" which is not "%s".\n' % (repo_full_name, required_repo_full_name) + f'Skipping matrix check on repo "{repo_full_name}" which is not "{required_repo_full_name}".\n' ) return @@ -63,7 +61,7 @@ def main(): # type: () -> None if not attempts_remaining: fail("Unable to retrieve Shippable run %s matrix." % run_id, str(ex)) - sys.stderr.write("Unable to retrieve Shippable run %s matrix: %s\n" % (run_id, ex)) + sys.stderr.write(f"Unable to retrieve Shippable run {run_id} matrix: {ex}\n") sys.stderr.write("Trying again in %d seconds...\n" % sleep) time.sleep(sleep) sleep *= 2 @@ -79,10 +77,10 @@ def main(): # type: () -> None "Try re-running the entire matrix.%s" % hint, ) - actual_matrix = dict( - (job.get("jobNumber"), dict(tuple(line.split("=", 1)) for line in job.get("env", [])).get("T", "")) + actual_matrix = { + job.get("jobNumber"): dict(tuple(line.split("=", 1)) for line in job.get("env", [])).get("T", "") for job in jobs - ) + } errors = [ (job_number, test, actual_matrix.get(job_number)) for job_number, test in enumerate(defined_matrix, 1) @@ -91,7 +89,7 @@ def main(): # type: () -> None if len(errors): error_summary = "\n".join( - 'Job %s expected "%s" but found "%s" instead.' % (job_number, expected, actual) + f'Job {job_number} expected "{expected}" but found "{actual}" instead.' for job_number, expected, actual in errors ) @@ -109,20 +107,16 @@ def fail(message, output): # type: (str, str) -> NoReturn timestamp = datetime.datetime.utcnow().replace(microsecond=0).isoformat() # hack to avoid requiring junit-xml, which isn't pre-installed on Shippable outside our test containers - xml = """ + xml = f""" -\t +\t \t\t -\t\t\t%s +\t\t\t{output} \t\t \t -""" % ( - timestamp, - message, - output, - ) +""" path = "shippable/testresults/check-matrix.xml" dir_path = os.path.dirname(path) diff --git a/tests/utils/shippable/timing.py b/tests/utils/shippable/timing.py index 7896840a..e8f4799a 100755 --- a/tests/utils/shippable/timing.py +++ b/tests/utils/shippable/timing.py @@ -1,7 +1,5 @@ #!/usr/bin/env python3.7 -from __future__ import absolute_import, division, print_function -__metaclass__ = type import sys import time