-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #133 from ZLLentz/daq-api
FIX: for pcdsdaq changes
- Loading branch information
Showing
9 changed files
with
105 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,39 @@ | ||
# flake8: NOQA | ||
from bluesky.plans import * | ||
from pcdsdaq.plans import (calib_cycle, calib_at_step, | ||
daq_wrapper, daq_decorator) | ||
from importlib import import_module | ||
from inspect import isgeneratorfunction | ||
from types import SimpleNamespace | ||
|
||
|
||
def collect_plans(modules): | ||
""" | ||
Take all the plans in ``modules`` and collect them into a namespace. | ||
Arguments | ||
--------- | ||
modules: ``list of str`` | ||
The modules to extract plans from. | ||
""" | ||
plans = {} | ||
for module_name in modules: | ||
module = import_module(module_name) | ||
for name, obj in module.__dict__.items(): | ||
try: | ||
# Only include things that are natively from this module | ||
if obj.__module__ == module_name: | ||
try: | ||
# Check the __wrapped__ attribute for decorators | ||
if isgeneratorfunction(obj.__wrapped__): | ||
plans[name] = obj | ||
except AttributeError: | ||
# Not a decorator, check obj | ||
if isgeneratorfunction(obj): | ||
plans[name] = obj | ||
except AttributeError: | ||
# obj did not have __module__, probably a builtin | ||
pass | ||
return SimpleNamespace(**plans) | ||
|
||
|
||
plans = collect_plans(['bluesky.plans']) | ||
plan_stubs = collect_plans(['bluesky.plan_stubs']) | ||
preprocessors = collect_plans(['bluesky.preprocessors', | ||
'pcdsdaq.preprocessors']) |
Oops, something went wrong.