From dc5dafb40ae3f8976d8d76d25cd056d7ce6b7718 Mon Sep 17 00:00:00 2001 From: correctmost <134317971+correctmost@users.noreply.github.com> Date: Fri, 6 Sep 2024 01:37:53 -0400 Subject: [PATCH] Avoid extra isinstance calls in _builtin_filter_predicate (#2544) --- astroid/brain/brain_builtin_inference.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/astroid/brain/brain_builtin_inference.py b/astroid/brain/brain_builtin_inference.py index e9d00e2e1a..4f86c613fa 100644 --- a/astroid/brain/brain_builtin_inference.py +++ b/astroid/brain/brain_builtin_inference.py @@ -189,8 +189,8 @@ def _builtin_filter_predicate(node, builtin_name) -> bool: # Match = type(...) # ``` return False - if isinstance(node.func, nodes.Name) and node.func.name == builtin_name: - return True + if isinstance(node.func, nodes.Name): + return node.func.name == builtin_name if isinstance(node.func, nodes.Attribute): return ( node.func.attrname == "fromkeys"