From 8dca42846d2956122d45795763095559a6a51b64 Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Sun, 9 Apr 2023 21:15:18 +0100 Subject: Migrate code style to ruff Co-authored-by: Boris Muratov <8bee278@gmail.com> Co-authored-by: wookie184 --- tests/bot/test_constants.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'tests/bot/test_constants.py') diff --git a/tests/bot/test_constants.py b/tests/bot/test_constants.py index f10d6fbe8..3492021ce 100644 --- a/tests/bot/test_constants.py +++ b/tests/bot/test_constants.py @@ -23,11 +23,7 @@ def is_annotation_instance(value: typing.Any, annotation: typing.Any) -> bool: def is_any_instance(value: typing.Any, types: typing.Collection) -> bool: """Return True if `value` is an instance of any type in `types`.""" - for type_ in types: - if is_annotation_instance(value, type_): - return True - - return False + return any(is_annotation_instance(value, type_) for type_ in types) class ConstantsTests(unittest.TestCase): @@ -39,7 +35,7 @@ class ConstantsTests(unittest.TestCase): sections = ( cls for (name, cls) in inspect.getmembers(constants) - if hasattr(cls, 'section') and isinstance(cls, type) + if hasattr(cls, "section") and isinstance(cls, type) ) for section in sections: for name, annotation in section.__annotations__.items(): -- cgit v1.2.3