From 57a6a7ff661930a8b0dde55663947b80cf3c196a Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos Orfanos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Fri, 12 Jan 2024 20:35:33 +0100 Subject: [PATCH] Appply some bugbear suggestions (#761) B015 Pointless comparison. B009 Do not call `getattr` with a constant attribute value. --------- Co-authored-by: Brett Cannon --- src/packaging/_manylinux.py | 2 +- tests/test_structures.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/packaging/_manylinux.py b/src/packaging/_manylinux.py index 3705d50d..95f84281 100644 --- a/src/packaging/_manylinux.py +++ b/src/packaging/_manylinux.py @@ -82,7 +82,7 @@ def _glibc_version_string_confstr() -> Optional[str]: # https://github.com/python/cpython/blob/fcf1d003bf4f0100c/Lib/platform.py#L175-L183 try: # Should be a string like "glibc 2.17". - version_string: str = getattr(os, "confstr")("CS_GNU_LIBC_VERSION") + version_string: Optional[str] = os.confstr("CS_GNU_LIBC_VERSION") assert version_string is not None _, version = version_string.rsplit() except (AssertionError, AttributeError, OSError, ValueError): diff --git a/tests/test_structures.py b/tests/test_structures.py index f8115e57..cc651cf6 100644 --- a/tests/test_structures.py +++ b/tests/test_structures.py @@ -8,11 +8,11 @@ def test_infinity_repr(): - repr(Infinity) == "Infinity" + assert repr(Infinity) == "Infinity" def test_negative_infinity_repr(): - repr(NegativeInfinity) == "-Infinity" + assert repr(NegativeInfinity) == "-Infinity" def test_infinity_hash():