Determine whether the given object is a top-level function, i.e., defined at module scope using 'def'.
(obj: Any)
| 310 | |
| 311 | |
| 312 | def is_top_level_function(obj: Any) -> bool: |
| 313 | """Determine whether the given object is a top-level function, i.e., defined at module scope using 'def'.""" |
| 314 | return callable(obj) and obj.__name__ in sys.modules[obj.__module__].__dict__ |
| 315 | |
| 316 | |
| 317 | def get_top_level_function_name(obj: Any) -> str: |
no outgoing calls
no test coverage detected