MCPcopy Create free account
hub / github.com/10Ring/LAA-Net / has_method

Function has_method

register/misc.py:344–352  ·  view source on GitHub ↗

Check whether the object has a method. Args: method (str): The method name to check. obj (object): The object to check. Returns: bool: True if the object has the method else False.

(obj: object, method: str)

Source from the content-addressed store, hash-verified

342
343
344def has_method(obj: object, method: str) -> bool:
345 """Check whether the object has a method.
346 Args:
347 method (str): The method name to check.
348 obj (object): The object to check.
349 Returns:
350 bool: True if the object has the method else False.
351 """
352 return hasattr(obj, method) and callable(getattr(obj, method))

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected