<commit_before>from functools import partial

import metadatastore.commands

import ophyd
from ophyd import EpicsSignal
from ophyd.callbacks import UidPublish

from hxntools.scan_number import HxnScanNumberPrinter
from hxntools.scan_status import HxnScanStatus

from bluesky.global_state import get_gs
from bluesky.callbacks.olog import logbook_cb_factory

from pyOlog import SimpleOlogClient

# Set up the logbook. This configures bluesky's summaries of
# data acquisition (scan type, ID, etc.).

LOGBOOKS = ['bs-testing']

logbook = SimpleOlogClient()

uid_signal = EpicsSignal('XF:03IDC-ES{BS-Scan}UID-I')
uid_broadcaster = UidPublish(uid_signal)
scan_number_printer = HxnScanNumberPrinter()
hxn_scan_status = HxnScanStatus('XF:03IDC-ES{Status}ScanRunning-I')
logger_callback = logbook_cb_factory(partial(logbook.log, logbooks=LOGBOOKS))

RE = get_gs().RE

# Save all scan data to metadatastore:

try:
    from bluesky.register_mds import register_mds
except ImportError:
    RE.subscribe_lossless('all', metadatastore.commands.insert)
else:
    register_mds(RE)


# Pass on only start/stop documents to a few subscriptions
for _event in ('start', 'stop'):
    RE.subscribe(_event, scan_number_printer)
    RE.subscribe(_event, uid_broadcaster)
    RE.subscribe(_event, hxn_scan_status)

RE.subscribe('start', logger_callback)<commit_msg>use only new bluesky register_mds<commit_after>from functools import partial

import metadatastore.commands

import ophyd
from ophyd import EpicsSignal
from ophyd.callbacks import UidPublish

from hxntools.scan_number import HxnScanNumberPrinter
from hxntools.scan_status import HxnScanStatus

from bluesky.global_state import get_gs
from bluesky.callbacks.olog import logbook_cb_factory

from pyOlog import SimpleOlogClient

# Set up the logbook. This configures bluesky's summaries of
# data acquisition (scan type, ID, etc.).

LOGBOOKS = ['bs-testing']

logbook = SimpleOlogClient()

uid_signal = EpicsSignal('XF:03IDC-ES{BS-Scan}UID-I')
uid_broadcaster = UidPublish(uid_signal)
scan_number_printer = HxnScanNumberPrinter()
hxn_scan_status = HxnScanStatus('XF:03IDC-ES{Status}ScanRunning-I')
logger_callback = logbook_cb_factory(partial(logbook.log, logbooks=LOGBOOKS))

RE = get_gs().RE

# Save all scan data to metadatastore:

from bluesky.register_mds import register_mds
register_mds(RE)


# Pass on only start/stop documents to a few subscriptions
for _event in ('start', 'stop'):
    RE.subscribe(_event, scan_number_printer)
    RE.subscribe(_event, uid_broadcaster)
    RE.subscribe(_event, hxn_scan_status)

RE.subscribe('start', logger_callback)
{'fraction_non_alphanumeric': 0.0819545979222778, 'fraction_numerical': 0.0030781069642170067, 'mean_word_length': 6.386363636363637, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3387943', 'n_tokens_mistral': 901, 'n_tokens_neox': 887, 'n_words': 211}