Skip to content

Commit

Permalink
Cut _safe_has_attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
nickdrozd committed Nov 24, 2022
1 parent 85805f7 commit 974f26f
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions astroid/raw_building.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,13 +316,6 @@ def _build_from_function(
object_build_function(node, member, name)


def _safe_has_attribute(obj, member: str) -> bool:
try:
return hasattr(obj, member)
except Exception: # pylint: disable=broad-except
return False


class InspectBuilder:
"""class for building nodes from living object
Expand Down Expand Up @@ -418,7 +411,7 @@ def object_build(
# This should be called for Jython, where some builtin
# methods aren't caught by isbuiltin branch.
_build_from_function(node, name, member, self._module)
elif _safe_has_attribute(member, "__all__"):
elif hasattr(member, "__all__"):
module = build_module(name)
_attach_local_node(node, module, name)
# recursion
Expand Down

0 comments on commit 974f26f

Please sign in to comment.