text
stringlengths 0
828
|
|---|
734,"def action(*args, **kwargs):
|
""""""Transforms functions or class methods into actions.
|
Optionnaly, you can define a function to be used as the view initializer:
|
@action()
|
def my_action():
|
pass
|
@my_action.init_view
|
def my_action_init_view(view, options):
|
pass
|
""""""
|
def decorator(f):
|
return ActionFunction(f, *args, **kwargs)
|
return decorator"
|
735,"def with_actions(actions_or_group_name, actions=None):
|
""""""Executes the list of actions before/after the function
|
Actions should be a list where items are action names as
|
strings or a dict. See frasco.actions.loaders.load_action().
|
""""""
|
group = None
|
if isinstance(actions_or_group_name, str):
|
group = actions_or_group_name
|
else:
|
actions = actions_or_group_name
|
def decorator(f):
|
if isinstance(f, WithActionsDecorator):
|
dec = f
|
else:
|
dec = WithActionsDecorator(f)
|
dec.actions.extend(load_actions(actions, group=group))
|
return dec
|
return decorator"
|
736,"def expose(rule, **options):
|
""""""Decorator to add an url rule to a function
|
""""""
|
def decorator(f):
|
if not hasattr(f, ""urls""):
|
f.urls = []
|
if isinstance(rule, (list, tuple)):
|
f.urls.extend(rule)
|
else:
|
f.urls.append((rule, options))
|
return f
|
return decorator"
|
737,"def plot_channel_sweep(proxy, start_channel):
|
'''
|
Parameters
|
----------
|
proxy : DMFControlBoard
|
start_channel : int
|
Channel number from which to start a channel sweep (should be a
|
multiple of 40, e.g., 0, 40, 80).
|
Returns
|
-------
|
pandas.DataFrame
|
See description of return of :func:`sweep_channels`.
|
'''
|
test_loads = TEST_LOADS.copy()
|
test_loads.index += start_channel
|
results = sweep_channels(proxy, test_loads)
|
normalized_measurements = (results['measured capacitance']
|
/ results['expected capacitance'])
|
fig, axis = plt.subplots(figsize=(10, 8))
|
axis.bar(normalized_measurements.index - 0.3, normalized_measurements,
|
width=0.6, edgecolor='none', facecolor='limegreen')
|
axis.set_xlim(left=test_loads.index.min() - 0.5,
|
right=test_loads.index.max() + 0.5)
|
axis.set_xlabel('channel')
|
axis.set_ylabel(r'$\frac{C_{\tt{measured}}}{C_{\tt{expected}}}$',
|
fontsize=28)
|
return results"
|
738,"def _create_unicode_map():
|
""""""
|
Create the inverse map from unicode to betacode.
|
Returns:
|
The hash map to convert unicode characters to the beta code representation.
|
""""""
|
unicode_map = {}
|
for beta, uni in _map.BETACODE_MAP.items():
|
# Include decomposed equivalent where necessary.
|
norm = unicodedata.normalize('NFC', uni)
|
unicode_map[norm] = beta
|
unicode_map[uni] = beta
|
# Add the final sigmas.
|
final_sigma_norm = unicodedata.normalize('NFC', _FINAL_LC_SIGMA)
|
unicode_map[final_sigma_norm] = 's'
|
unicode_map[_FINAL_LC_SIGMA] = 's'
|
return unicode_map"
|
739,"def _create_conversion_trie(strict):
|
""""""
|
Create the trie for betacode conversion.
|
Args:
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.