hutch_python.utils.extract_objs

hutch_python.utils.extract_objs(scope=None, skip_hidden=True, stack_offset=0)

Return all objects with the scope.

This can be though of as a * import, and it obeys the __all__ keyword functionality.

Parameters:
  • scope (module, namespace, or list of these, optional) – If provided, we’ll import from this object. If omitted, we’ll include all objects that have been loaded by hutch_python and everything in the caller’s global frame.

  • skip_hidden (bool, optional) – If True, we’ll omit objects with leading underscores.

  • stack_offset (int, optional) – If scope was not provided, we’ll use stack_offset to determine which frame is the user’s frame. Leave this at zero if you want the objects in the caller’s frame, and increase it by one for each level up the stack your frame is.

Returns:

objs – Mapping from name in scope to object

Return type:

dict