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)
| 342 | |
| 343 | |
| 344 | def 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)) |
nothing calls this directly
no outgoing calls
no test coverage detected