namespace.py¶
This module provides utilities for grouping objects into namespaces.
- hutch_python.namespace.class_namespace(cls, scope=None)¶
Create a
namespacethat contains objects of a specific type.- Parameters
cls (
typeorstr) –scope (
module,namespace, orlistof these) – Every object attached to the given modules will be considered for theclass_namespace. Ifscopeis omitted, we’ll check all objects loaded byhutch-pythonand everything in the caller’s global frame. If anything is an instance ofophyd.Device, we’ll also include the object’s components as part of the scope, using thenameattribute to identify them rather than the attribute name on the device. This will continue recursively, skipping lazy and dynamic components.
- Returns
namespace
- Return type
- hutch_python.namespace.tree_namespace(scope=None)¶
Create a
namespacethat accumulates objects and creates a tree.This tree is a nested set of
IterableNamespaceobjects based on the object names as defined in scope. We will split on underscores and use the splits to create the tree.- Parameters
scope (
module,namespace, orlistof these) – Every object attached to the given modules will be considered for thetree_namespace. Ifscopeis omitted, we’ll check all objects loaded byhutch-pythonand everything in the caller’s global frame.- Returns
namespace
- Return type