Skip to content

Commit

Permalink
[autofix] Format Python
Browse files Browse the repository at this point in the history
  • Loading branch information
kdeldycke committed Dec 2, 2024
1 parent b6d3a9b commit 3114aa0
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 53 deletions.
57 changes: 46 additions & 11 deletions extra_platforms/platform_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,47 +28,82 @@

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")
CENTOS = Platform("centos", "CentOS", "💠", "https://centos.org")
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."""
84 changes: 42 additions & 42 deletions tests/test_platform_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

0 comments on commit 3114aa0

Please sign in to comment.