From 3114aa0892b09feb290e58c6c789046eddfd05e1 Mon Sep 17 00:00:00 2001 From: kdeldycke <159718+kdeldycke@users.noreply.github.com> Date: Mon, 2 Dec 2024 10:36:34 +0000 Subject: [PATCH] [autofix] Format Python --- extra_platforms/platform_data.py | 57 +++++++++++++++++----- tests/test_platform_data.py | 84 ++++++++++++++++---------------- 2 files changed, 88 insertions(+), 53 deletions(-) diff --git a/extra_platforms/platform_data.py b/extra_platforms/platform_data.py index 2f8ea593..3a4b2b13 100644 --- a/extra_platforms/platform_data.py +++ b/extra_platforms/platform_data.py @@ -28,7 +28,9 @@ AIX = Platform("aix", "IBM AIX", "➿", "https://ibm.com/products/aix/") ALTLINUX = Platform("altlinux", "ALT Linux", "🐧", "https://altlinux.org") -AMZN = Platform("amzn", "Amazon Linux", "πŸ™‚", "https://aws.amazon.com/amazon-linux-ami/") +AMZN = Platform( + "amzn", "Amazon Linux", "πŸ™‚", "https://aws.amazon.com/amazon-linux-ami/" +) ANDROID = Platform("android", "Android", "πŸ€–", "https://android.com") ARCH = Platform("arch", "Arch Linux", "πŸŽ—οΈ", "https://archlinux.org") BUILDROOT = Platform("buildroot", "Buildroot", "⛑️", "https://buildroot.org") @@ -36,39 +38,72 @@ CLOUDLINUX = Platform("cloudlinux", "CloudLinux OS", "꩜", "https://cloudlinux.com") CYGWIN = Platform("cygwin", "Cygwin", "ΟΎ", "https://cygwin.com") DEBIAN = Platform("debian", "Debian", "πŸŒ€", "https://debian.org") -EXHERBO = Platform("exherbo", "Exherbo Linux", "🐽","https://exherbolinux.org") +EXHERBO = Platform("exherbo", "Exherbo Linux", "🐽", "https://exherbolinux.org") FEDORA = Platform("fedora", "Fedora", "🎩", "https://fedoraproject.org") FREEBSD = Platform("freebsd", "FreeBSD", "😈", "https://freebsd.org") GENTOO = Platform("gentoo", "Gentoo Linux", "πŸ—œοΈ", "https://gentoo.org") GUIX = Platform("guix", "Guix System", "πŸƒ", "https://guix.gnu.org") HURD = Platform("hurd", "GNU/Hurd", "πŸƒ", "https://gnu.org/software/hurd/") -IBM_POWERKVM = Platform("ibm_powerkvm", "IBM PowerKVM", "🀹", "https://ibm.com/mysupport/s/topic/0TO50000000QkyPGAS/") -KVMIBM = Platform("kvmibm", "KVM for IBM z Systems", "🀹", "https://ibm.com/products/kvm/") +IBM_POWERKVM = Platform( + "ibm_powerkvm", + "IBM PowerKVM", + "🀹", + "https://ibm.com/mysupport/s/topic/0TO50000000QkyPGAS/", +) +KVMIBM = Platform( + "kvmibm", "KVM for IBM z Systems", "🀹", "https://ibm.com/products/kvm/" +) LINUXMINT = Platform("linuxmint", "Linux Mint", "🌿", "https://linuxmint.com") MACOS = Platform("macos", "macOS", "🍎", "https://apple.com/macos/") MAGEIA = Platform("mageia", "Mageia", "β₯", "https://mageia.org") -MANDRIVA = Platform("mandriva", "Mandriva Linux", "πŸ’«", "https://web.archive.org/web/20150522203942/https://mandriva.com/en/mbs/") +MANDRIVA = Platform( + "mandriva", + "Mandriva Linux", + "πŸ’«", + "https://web.archive.org/web/20150522203942/https://mandriva.com/en/mbs/", +) MIDNIGHTBSD = Platform("midnightbsd", "MidnightBSD", "🌘", "https://midnightbsd.org") NETBSD = Platform("netbsd", "NetBSD", "🚩", "https://netbsd.org") OPENBSD = Platform("openbsd", "OpenBSD", "🐑", "https://openbsd.org") OPENSUSE = Platform("opensuse", "openSUSE", "🦎", "https://opensuse.org") ORACLE = Platform("oracle", "Oracle Linux", "🦴", "https://oracle.com/linux/") PARALLELS = Platform("parallels", "Parallels", "βˆ₯", "https://parallels.com") -PIDORA = Platform("pidora", "Pidora", "πŸ“", "https://web.archive.org/web/20200227132047/http://pidora.ca:80/") +PIDORA = Platform( + "pidora", + "Pidora", + "πŸ“", + "https://web.archive.org/web/20200227132047/http://pidora.ca:80/", +) RASPBIAN = Platform("raspbian", "Raspbian", "πŸ“", "https://raspberrypi.com/software/") RHEL = Platform("rhel", "RedHat Enterprise Linux", "🎩", "https://redhat.com/rhel/") ROCKY = Platform("rocky", "Rocky Linux", "⛰️", "https://rockylinux.org") -SCIENTIFIC = Platform("scientific", "Scientific Linux", "βš›οΈ", "https://scientificlinux.org") +SCIENTIFIC = Platform( + "scientific", "Scientific Linux", "βš›οΈ", "https://scientificlinux.org" +) SLACKWARE = Platform("slackware", "Slackware", "🚬", "https://www.slackware.com") -SLES = Platform("sles", "SUSE Linux Enterprise Server", "🦎", "https://suse.com/products/server/") +SLES = Platform( + "sles", "SUSE Linux Enterprise Server", "🦎", "https://suse.com/products/server/" +) SOLARIS = Platform("solaris", "Solaris", "🌞", "https://oracle.com/solaris") SUNOS = Platform("sunos", "SunOS", "β˜€οΈ", "https://wikipedia.org/wiki/SunOS") -TUMBLEWEED = Platform("tumbleweed", "openSUSE Tumbleweed", "↻", "https://get.opensuse.org/tumbleweed/") +TUMBLEWEED = Platform( + "tumbleweed", "openSUSE Tumbleweed", "↻", "https://get.opensuse.org/tumbleweed/" +) TUXEDO = Platform("tuxedo", "Tuxedo OS", "🀡", "https://tuxedocomputers.com/os") UBUNTU = Platform("ubuntu", "Ubuntu", "🎯", "https://ubuntu.com") UNKNOWN_LINUX = Platform("unknown_linux", "Unknown Linux", "🐧", "https://kernel.org") WINDOWS = Platform("windows", "Windows", "πŸͺŸ", "https://windows.com") -WSL1 = Platform("wsl1", "Windows Subsystem for Linux v1", "⊞", "https://learn.microsoft.com/windows/wsl") -WSL2 = Platform("wsl2", "Windows Subsystem for Linux v2", "⊞", "https://learn.microsoft.com/windows/wsl") +WSL1 = Platform( + "wsl1", + "Windows Subsystem for Linux v1", + "⊞", + "https://learn.microsoft.com/windows/wsl", +) +WSL2 = Platform( + "wsl2", + "Windows Subsystem for Linux v2", + "⊞", + "https://learn.microsoft.com/windows/wsl", +) XENSERVER = Platform("xenserver", "XenServer", "Ⓧ", "https://xenproject.org") """All individual platforms.""" diff --git a/tests/test_platform_data.py b/tests/test_platform_data.py index cc4f1fa1..5a8a28a6 100644 --- a/tests/test_platform_data.py +++ b/tests/test_platform_data.py @@ -23,55 +23,55 @@ import pytest import requests + @pytest.mark.parametrize("platform", ALL_PLATFORMS.platforms) def test_platform_definitions(platform): + assert platform - assert platform - - # ID. - assert platform.id - assert platform.id.isascii() - assert platform.id[0] in ascii_lowercase - assert platform.id[-1] in ascii_lowercase + digits - assert set(platform.id).issubset(ascii_lowercase + digits + "_") - assert platform.id.islower() - # Platforms are not allowed to starts with all_ or any_, which is reserved - # for groups. Use unknown_ prefix instead. - assert not platform.id.startswith(("all_", "any_")) + # ID. + assert platform.id + assert platform.id.isascii() + assert platform.id[0] in ascii_lowercase + assert platform.id[-1] in ascii_lowercase + digits + assert set(platform.id).issubset(ascii_lowercase + digits + "_") + assert platform.id.islower() + # Platforms are not allowed to starts with all_ or any_, which is reserved + # for groups. Use unknown_ prefix instead. + assert not platform.id.startswith(("all_", "any_")) - # Name. - assert platform.name - assert platform.name.isascii() - assert platform.name.isprintable() - assert platform.name in ALL_OS_LABELS + # Name. + assert platform.name + assert platform.name.isascii() + assert platform.name.isprintable() + assert platform.name in ALL_OS_LABELS - # Icon. - assert platform.icon - assert 2 >= len(platform.icon) >= 1 + # Icon. + assert platform.icon + assert 2 >= len(platform.icon) >= 1 - # URL. - assert platform.url - assert platform.url.startswith("https://") - if platform.id == "raspbian": - pytest.xfail("raspberrypi.com is blocking access from GitHub Actions") - with requests.get(platform.url) as response: - assert response.ok, f"{platform.url} is not reachable: {response}" + # URL. + assert platform.url + assert platform.url.startswith("https://") + if platform.id == "raspbian": + pytest.xfail("raspberrypi.com is blocking access from GitHub Actions") + with requests.get(platform.url) as response: + assert response.ok, f"{platform.url} is not reachable: {response}" - # Info. - assert platform.info() - for k, v in platform.info().items(): - assert set(k).issubset(ascii_lowercase + "_") - if v is not None: - assert isinstance(v, (str, bool, dict)) - if isinstance(v, str): - assert v - elif isinstance(v, dict): - assert v - for k1, v1 in v.items(): - assert set(k1).issubset(ascii_lowercase + "_") - if v1 is not None: - assert v1 - assert platform.info()["id"] == platform.id + # Info. + assert platform.info() + for k, v in platform.info().items(): + assert set(k).issubset(ascii_lowercase + "_") + if v is not None: + assert isinstance(v, (str, bool, dict)) + if isinstance(v, str): + assert v + elif isinstance(v, dict): + assert v + for k1, v1 in v.items(): + assert set(k1).issubset(ascii_lowercase + "_") + if v1 is not None: + assert v1 + assert platform.info()["id"] == platform.id def test_os_labels():