partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
hist_last_nonzero
Find the last nonzero index and mask the remaining entries. Parameters ---------- hist : array_like, iterable Input histogram with dimension at most 1. return_index : bool, optional If true, return the index. copy : bool, optional Whether to copy the input data (Tru...
pybar/analysis/plotting/plotting.py
def hist_last_nonzero(hist, return_index=False, copy=True): '''Find the last nonzero index and mask the remaining entries. Parameters ---------- hist : array_like, iterable Input histogram with dimension at most 1. return_index : bool, optional If true, return the index. ...
def hist_last_nonzero(hist, return_index=False, copy=True): '''Find the last nonzero index and mask the remaining entries. Parameters ---------- hist : array_like, iterable Input histogram with dimension at most 1. return_index : bool, optional If true, return the index. ...
[ "Find", "the", "last", "nonzero", "index", "and", "mask", "the", "remaining", "entries", ".", "Parameters", "----------", "hist", ":", "array_like", "iterable", "Input", "histogram", "with", "dimension", "at", "most", "1", ".", "return_index", ":", "bool", "op...
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/plotting/plotting.py#L882-L910
[ "def", "hist_last_nonzero", "(", "hist", ",", "return_index", "=", "False", ",", "copy", "=", "True", ")", ":", "# make np array\r", "hist_t", "=", "np", ".", "array", "(", "hist", ")", "index", "=", "(", "np", ".", "where", "(", "hist_t", ")", "[", ...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
FifoReadout.readout
Readout thread continuously reading FIFO. Readout thread, which uses read_raw_data_from_fifo() and appends data to self._fifo_data_deque (collection.deque).
pybar/daq/fifo_readout.py
def readout(self, fifo, no_data_timeout=None): '''Readout thread continuously reading FIFO. Readout thread, which uses read_raw_data_from_fifo() and appends data to self._fifo_data_deque (collection.deque). ''' logging.info('Starting readout thread for %s', fifo) time_last...
def readout(self, fifo, no_data_timeout=None): '''Readout thread continuously reading FIFO. Readout thread, which uses read_raw_data_from_fifo() and appends data to self._fifo_data_deque (collection.deque). ''' logging.info('Starting readout thread for %s', fifo) time_last...
[ "Readout", "thread", "continuously", "reading", "FIFO", ".", "Readout", "thread", "which", "uses", "read_raw_data_from_fifo", "()", "and", "appends", "data", "to", "self", ".", "_fifo_data_deque", "(", "collection", ".", "deque", ")", "." ]
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/fifo_readout.py#L270-L320
[ "def", "readout", "(", "self", ",", "fifo", ",", "no_data_timeout", "=", "None", ")", ":", "logging", ".", "info", "(", "'Starting readout thread for %s'", ",", "fifo", ")", "time_last_data", "=", "time", "(", ")", "time_wait", "=", "0.0", "empty_reads", "="...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
FifoReadout.worker
Worker thread continuously filtering and converting data when data becomes available.
pybar/daq/fifo_readout.py
def worker(self, fifo): '''Worker thread continuously filtering and converting data when data becomes available. ''' logging.debug('Starting worker thread for %s', fifo) self._fifo_conditions[fifo].acquire() while True: try: data_tuple = self._f...
def worker(self, fifo): '''Worker thread continuously filtering and converting data when data becomes available. ''' logging.debug('Starting worker thread for %s', fifo) self._fifo_conditions[fifo].acquire() while True: try: data_tuple = self._f...
[ "Worker", "thread", "continuously", "filtering", "and", "converting", "data", "when", "data", "becomes", "available", "." ]
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/fifo_readout.py#L322-L352
[ "def", "worker", "(", "self", ",", "fifo", ")", ":", "logging", ".", "debug", "(", "'Starting worker thread for %s'", ",", "fifo", ")", "self", ".", "_fifo_conditions", "[", "fifo", "]", ".", "acquire", "(", ")", "while", "True", ":", "try", ":", "data_t...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
FifoReadout.writer
Writer thread continuously calling callback function for writing data when data becomes available.
pybar/daq/fifo_readout.py
def writer(self, index, no_data_timeout=None): '''Writer thread continuously calling callback function for writing data when data becomes available. ''' is_fe_data_header = logical_and(is_fe_word, is_data_header) logging.debug('Starting writer thread with index %d', index) s...
def writer(self, index, no_data_timeout=None): '''Writer thread continuously calling callback function for writing data when data becomes available. ''' is_fe_data_header = logical_and(is_fe_word, is_data_header) logging.debug('Starting writer thread with index %d', index) s...
[ "Writer", "thread", "continuously", "calling", "callback", "function", "for", "writing", "data", "when", "data", "becomes", "available", "." ]
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/fifo_readout.py#L354-L403
[ "def", "writer", "(", "self", ",", "index", ",", "no_data_timeout", "=", "None", ")", ":", "is_fe_data_header", "=", "logical_and", "(", "is_fe_word", ",", "is_data_header", ")", "logging", ".", "debug", "(", "'Starting writer thread with index %d'", ",", "index",...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
FifoReadout.get_data_from_buffer
Reads local data buffer and returns data and meta data list. Returns ------- data : list List of data and meta data dicts.
pybar/daq/fifo_readout.py
def get_data_from_buffer(self, filter_func=None, converter_func=None): '''Reads local data buffer and returns data and meta data list. Returns ------- data : list List of data and meta data dicts. ''' if self._is_running: raise RuntimeErr...
def get_data_from_buffer(self, filter_func=None, converter_func=None): '''Reads local data buffer and returns data and meta data list. Returns ------- data : list List of data and meta data dicts. ''' if self._is_running: raise RuntimeErr...
[ "Reads", "local", "data", "buffer", "and", "returns", "data", "and", "meta", "data", "list", ".", "Returns", "-------", "data", ":", "list", "List", "of", "data", "and", "meta", "data", "dicts", "." ]
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/fifo_readout.py#L425-L437
[ "def", "get_data_from_buffer", "(", "self", ",", "filter_func", "=", "None", ",", "converter_func", "=", "None", ")", ":", "if", "self", ".", "_is_running", ":", "raise", "RuntimeError", "(", "'Readout thread running'", ")", "if", "not", "self", ".", "fill_buf...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
FifoReadout.get_raw_data_from_buffer
Reads local data buffer and returns raw data array. Returns ------- data : np.array An array containing data words from the local data buffer.
pybar/daq/fifo_readout.py
def get_raw_data_from_buffer(self, filter_func=None, converter_func=None): '''Reads local data buffer and returns raw data array. Returns ------- data : np.array An array containing data words from the local data buffer. ''' if self._is_running: ...
def get_raw_data_from_buffer(self, filter_func=None, converter_func=None): '''Reads local data buffer and returns raw data array. Returns ------- data : np.array An array containing data words from the local data buffer. ''' if self._is_running: ...
[ "Reads", "local", "data", "buffer", "and", "returns", "raw", "data", "array", ".", "Returns", "-------", "data", ":", "np", ".", "array", "An", "array", "containing", "data", "words", "from", "the", "local", "data", "buffer", "." ]
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/fifo_readout.py#L439-L451
[ "def", "get_raw_data_from_buffer", "(", "self", ",", "filter_func", "=", "None", ",", "converter_func", "=", "None", ")", ":", "if", "self", ".", "_is_running", ":", "raise", "RuntimeError", "(", "'Readout thread running'", ")", "if", "not", "self", ".", "fill...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
FifoReadout.read_raw_data_from_fifo
Reads FIFO data and returns raw data array. Returns ------- data : np.array An array containing FIFO data words.
pybar/daq/fifo_readout.py
def read_raw_data_from_fifo(self, fifo, filter_func=None, converter_func=None): '''Reads FIFO data and returns raw data array. Returns ------- data : np.array An array containing FIFO data words. ''' return convert_data_array(self.dut[fifo].get_data()...
def read_raw_data_from_fifo(self, fifo, filter_func=None, converter_func=None): '''Reads FIFO data and returns raw data array. Returns ------- data : np.array An array containing FIFO data words. ''' return convert_data_array(self.dut[fifo].get_data()...
[ "Reads", "FIFO", "data", "and", "returns", "raw", "data", "array", ".", "Returns", "-------", "data", ":", "np", ".", "array", "An", "array", "containing", "FIFO", "data", "words", "." ]
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/fifo_readout.py#L453-L461
[ "def", "read_raw_data_from_fifo", "(", "self", ",", "fifo", ",", "filter_func", "=", "None", ",", "converter_func", "=", "None", ")", ":", "return", "convert_data_array", "(", "self", ".", "dut", "[", "fifo", "]", ".", "get_data", "(", ")", ",", "filter_fu...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
get_item_from_queue
Attempts to retrieve an item from the queue Q. If Q is empty, None is returned. Blocks for 'timeout' seconds in case the queue is empty, so don't use this method for speedy retrieval of multiple items (use get_all_from_queue for that).
pybar/utils/utils.py
def get_item_from_queue(Q, timeout=0.01): """ Attempts to retrieve an item from the queue Q. If Q is empty, None is returned. Blocks for 'timeout' seconds in case the queue is empty, so don't use this method for speedy retrieval of multiple items (use get_all_from_queue for th...
def get_item_from_queue(Q, timeout=0.01): """ Attempts to retrieve an item from the queue Q. If Q is empty, None is returned. Blocks for 'timeout' seconds in case the queue is empty, so don't use this method for speedy retrieval of multiple items (use get_all_from_queue for th...
[ "Attempts", "to", "retrieve", "an", "item", "from", "the", "queue", "Q", ".", "If", "Q", "is", "empty", "None", "is", "returned", ".", "Blocks", "for", "timeout", "seconds", "in", "case", "the", "queue", "is", "empty", "so", "don", "t", "use", "this", ...
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/utils/utils.py#L38-L51
[ "def", "get_item_from_queue", "(", "Q", ",", "timeout", "=", "0.01", ")", ":", "try", ":", "item", "=", "Q", ".", "get", "(", "True", ",", "0.01", ")", "except", "Queue", ".", "Empty", ":", "return", "None", "return", "item" ]
5ad95bbcd41cd358825823fb78f396cfce23593e
train
argmin_list
Return a list of elements of seq[i] with the lowest func(seq[i]) scores. >>> argmin_list(['one', 'to', 'three', 'or'], len) ['to', 'or']
pybar/utils/utils.py
def argmin_list(seq, func): """ Return a list of elements of seq[i] with the lowest func(seq[i]) scores. >>> argmin_list(['one', 'to', 'three', 'or'], len) ['to', 'or'] """ best_score, best = func(seq[0]), [] for x in seq: x_score = func(x) if x_score < b...
def argmin_list(seq, func): """ Return a list of elements of seq[i] with the lowest func(seq[i]) scores. >>> argmin_list(['one', 'to', 'three', 'or'], len) ['to', 'or'] """ best_score, best = func(seq[0]), [] for x in seq: x_score = func(x) if x_score < b...
[ "Return", "a", "list", "of", "elements", "of", "seq", "[", "i", "]", "with", "the", "lowest", "func", "(", "seq", "[", "i", "]", ")", "scores", ".", ">>>", "argmin_list", "(", "[", "one", "to", "three", "or", "]", "len", ")", "[", "to", "or", "...
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/utils/utils.py#L62-L75
[ "def", "argmin_list", "(", "seq", ",", "func", ")", ":", "best_score", ",", "best", "=", "func", "(", "seq", "[", "0", "]", ")", ",", "[", "]", "for", "x", "in", "seq", ":", "x_score", "=", "func", "(", "x", ")", "if", "x_score", "<", "best_sco...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
flatten_iterable
flatten iterable, but leaves out strings [[[1, 2, 3], [4, 5]], 6] -> [1, 2, 3, 4, 5, 6]
pybar/utils/utils.py
def flatten_iterable(iterable): """flatten iterable, but leaves out strings [[[1, 2, 3], [4, 5]], 6] -> [1, 2, 3, 4, 5, 6] """ for item in iterable: if isinstance(item, collections.Iterable) and not isinstance(item, basestring): for sub in flatten_iterable(item): ...
def flatten_iterable(iterable): """flatten iterable, but leaves out strings [[[1, 2, 3], [4, 5]], 6] -> [1, 2, 3, 4, 5, 6] """ for item in iterable: if isinstance(item, collections.Iterable) and not isinstance(item, basestring): for sub in flatten_iterable(item): ...
[ "flatten", "iterable", "but", "leaves", "out", "strings", "[[[", "1", "2", "3", "]", "[", "4", "5", "]]", "6", "]", "-", ">", "[", "1", "2", "3", "4", "5", "6", "]" ]
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/utils/utils.py#L198-L209
[ "def", "flatten_iterable", "(", "iterable", ")", ":", "for", "item", "in", "iterable", ":", "if", "isinstance", "(", "item", ",", "collections", ".", "Iterable", ")", "and", "not", "isinstance", "(", "item", ",", "basestring", ")", ":", "for", "sub", "in...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
iterable
generate iterable from item, but leaves out strings
pybar/utils/utils.py
def iterable(item): """generate iterable from item, but leaves out strings """ if isinstance(item, collections.Iterable) and not isinstance(item, basestring): return item else: return [item]
def iterable(item): """generate iterable from item, but leaves out strings """ if isinstance(item, collections.Iterable) and not isinstance(item, basestring): return item else: return [item]
[ "generate", "iterable", "from", "item", "but", "leaves", "out", "strings" ]
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/utils/utils.py#L212-L219
[ "def", "iterable", "(", "item", ")", ":", "if", "isinstance", "(", "item", ",", "collections", ".", "Iterable", ")", "and", "not", "isinstance", "(", "item", ",", "basestring", ")", ":", "return", "item", "else", ":", "return", "[", "item", "]" ]
5ad95bbcd41cd358825823fb78f396cfce23593e
train
natsorted
Returns a copy of seq, sorted by natural string sort.
pybar/utils/utils.py
def natsorted(seq, cmp=natcmp): "Returns a copy of seq, sorted by natural string sort." import copy temp = copy.copy(seq) natsort(temp, cmp) return temp
def natsorted(seq, cmp=natcmp): "Returns a copy of seq, sorted by natural string sort." import copy temp = copy.copy(seq) natsort(temp, cmp) return temp
[ "Returns", "a", "copy", "of", "seq", "sorted", "by", "natural", "string", "sort", "." ]
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/utils/utils.py#L258-L263
[ "def", "natsorted", "(", "seq", ",", "cmp", "=", "natcmp", ")", ":", "import", "copy", "temp", "=", "copy", ".", "copy", "(", "seq", ")", "natsort", "(", "temp", ",", "cmp", ")", "return", "temp" ]
5ad95bbcd41cd358825823fb78f396cfce23593e
train
get_iso_time
returns time as ISO string, mapping to and from datetime in ugly way convert to string with str()
pybar/utils/utils.py
def get_iso_time(): '''returns time as ISO string, mapping to and from datetime in ugly way convert to string with str() ''' t1 = time.time() t2 = datetime.datetime.fromtimestamp(t1) t4 = t2.__str__() try: t4a, t4b = t4.split(".", 1) except ValueError: t4a = t...
def get_iso_time(): '''returns time as ISO string, mapping to and from datetime in ugly way convert to string with str() ''' t1 = time.time() t2 = datetime.datetime.fromtimestamp(t1) t4 = t2.__str__() try: t4a, t4b = t4.split(".", 1) except ValueError: t4a = t...
[ "returns", "time", "as", "ISO", "string", "mapping", "to", "and", "from", "datetime", "in", "ugly", "way", "convert", "to", "string", "with", "str", "()" ]
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/utils/utils.py#L267-L282
[ "def", "get_iso_time", "(", ")", ":", "t1", "=", "time", ".", "time", "(", ")", "t2", "=", "datetime", ".", "datetime", ".", "fromtimestamp", "(", "t1", ")", "t4", "=", "t2", ".", "__str__", "(", ")", "try", ":", "t4a", ",", "t4b", "=", "t4", "...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
get_float_time
returns time as double precision floats - Time64 in pytables - mapping to and from python datetime's
pybar/utils/utils.py
def get_float_time(): '''returns time as double precision floats - Time64 in pytables - mapping to and from python datetime's ''' t1 = time.time() t2 = datetime.datetime.fromtimestamp(t1) return time.mktime(t2.timetuple()) + 1e-6 * t2.microsecond
def get_float_time(): '''returns time as double precision floats - Time64 in pytables - mapping to and from python datetime's ''' t1 = time.time() t2 = datetime.datetime.fromtimestamp(t1) return time.mktime(t2.timetuple()) + 1e-6 * t2.microsecond
[ "returns", "time", "as", "double", "precision", "floats", "-", "Time64", "in", "pytables", "-", "mapping", "to", "and", "from", "python", "datetime", "s" ]
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/utils/utils.py#L285-L291
[ "def", "get_float_time", "(", ")", ":", "t1", "=", "time", ".", "time", "(", ")", "t2", "=", "datetime", ".", "datetime", ".", "fromtimestamp", "(", "t1", ")", "return", "time", ".", "mktime", "(", "t2", ".", "timetuple", "(", ")", ")", "+", "1e-6"...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
groupby_dict
Group dict of dicts by key.
pybar/utils/utils.py
def groupby_dict(dictionary, key): ''' Group dict of dicts by key. ''' return dict((k, list(g)) for k, g in itertools.groupby(sorted(dictionary.keys(), key=lambda name: dictionary[name][key]), key=lambda name: dictionary[name][key]))
def groupby_dict(dictionary, key): ''' Group dict of dicts by key. ''' return dict((k, list(g)) for k, g in itertools.groupby(sorted(dictionary.keys(), key=lambda name: dictionary[name][key]), key=lambda name: dictionary[name][key]))
[ "Group", "dict", "of", "dicts", "by", "key", "." ]
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/utils/utils.py#L313-L316
[ "def", "groupby_dict", "(", "dictionary", ",", "key", ")", ":", "return", "dict", "(", "(", "k", ",", "list", "(", "g", ")", ")", "for", "k", ",", "g", "in", "itertools", ".", "groupby", "(", "sorted", "(", "dictionary", ".", "keys", "(", ")", ",...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
zip_nofill
Zipping iterables without fillvalue. Note: https://stackoverflow.com/questions/38054593/zip-longest-without-fillvalue
pybar/utils/utils.py
def zip_nofill(*iterables): '''Zipping iterables without fillvalue. Note: https://stackoverflow.com/questions/38054593/zip-longest-without-fillvalue ''' return (tuple([entry for entry in iterable if entry is not None]) for iterable in itertools.izip_longest(*iterables, fillvalue=None))
def zip_nofill(*iterables): '''Zipping iterables without fillvalue. Note: https://stackoverflow.com/questions/38054593/zip-longest-without-fillvalue ''' return (tuple([entry for entry in iterable if entry is not None]) for iterable in itertools.izip_longest(*iterables, fillvalue=None))
[ "Zipping", "iterables", "without", "fillvalue", ".", "Note", ":", "https", ":", "//", "stackoverflow", ".", "com", "/", "questions", "/", "38054593", "/", "zip", "-", "longest", "-", "without", "-", "fillvalue" ]
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/utils/utils.py#L334-L339
[ "def", "zip_nofill", "(", "*", "iterables", ")", ":", "return", "(", "tuple", "(", "[", "entry", "for", "entry", "in", "iterable", "if", "entry", "is", "not", "None", "]", ")", "for", "iterable", "in", "itertools", ".", "izip_longest", "(", "*", "itera...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
find_file_dir_up
Finding file in directory upwards.
pybar/utils/utils.py
def find_file_dir_up(filename, path=None, n=None): '''Finding file in directory upwards. ''' if path is None: path = os.getcwd() i = 0 while True: current_path = path for _ in range(i): current_path = os.path.split(current_path)[0] if os.path.isf...
def find_file_dir_up(filename, path=None, n=None): '''Finding file in directory upwards. ''' if path is None: path = os.getcwd() i = 0 while True: current_path = path for _ in range(i): current_path = os.path.split(current_path)[0] if os.path.isf...
[ "Finding", "file", "in", "directory", "upwards", "." ]
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/utils/utils.py#L342-L360
[ "def", "find_file_dir_up", "(", "filename", ",", "path", "=", "None", ",", "n", "=", "None", ")", ":", "if", "path", "is", "None", ":", "path", "=", "os", ".", "getcwd", "(", ")", "i", "=", "0", "while", "True", ":", "current_path", "=", "path", ...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
load_configuration_from_text_file
Loading configuration from text files to register object Parameters ---------- register : pybar.fei4.register object configuration_file : string Full path (directory and filename) of the configuration file. If name is not given, reload configuration from file.
pybar/fei4/register.py
def load_configuration_from_text_file(register, configuration_file): '''Loading configuration from text files to register object Parameters ---------- register : pybar.fei4.register object configuration_file : string Full path (directory and filename) of the configuration file. If na...
def load_configuration_from_text_file(register, configuration_file): '''Loading configuration from text files to register object Parameters ---------- register : pybar.fei4.register object configuration_file : string Full path (directory and filename) of the configuration file. If na...
[ "Loading", "configuration", "from", "text", "files", "to", "register", "object", "Parameters", "----------", "register", ":", "pybar", ".", "fei4", ".", "register", "object", "configuration_file", ":", "string", "Full", "path", "(", "directory", "and", "filename",...
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register.py#L715-L781
[ "def", "load_configuration_from_text_file", "(", "register", ",", "configuration_file", ")", ":", "logging", ".", "info", "(", "\"Loading configuration: %s\"", "%", "configuration_file", ")", "register", ".", "configuration_file", "=", "configuration_file", "config_dict", ...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
load_configuration_from_hdf5
Loading configuration from HDF5 file to register object Parameters ---------- register : pybar.fei4.register object configuration_file : string, file Filename of the HDF5 configuration file or file object. node : string Additional identifier (subgroup). Useful when more than...
pybar/fei4/register.py
def load_configuration_from_hdf5(register, configuration_file, node=''): '''Loading configuration from HDF5 file to register object Parameters ---------- register : pybar.fei4.register object configuration_file : string, file Filename of the HDF5 configuration file or file object. ...
def load_configuration_from_hdf5(register, configuration_file, node=''): '''Loading configuration from HDF5 file to register object Parameters ---------- register : pybar.fei4.register object configuration_file : string, file Filename of the HDF5 configuration file or file object. ...
[ "Loading", "configuration", "from", "HDF5", "file", "to", "register", "object", "Parameters", "----------", "register", ":", "pybar", ".", "fei4", ".", "register", "object", "configuration_file", ":", "string", "file", "Filename", "of", "the", "HDF5", "configurati...
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register.py#L784-L860
[ "def", "load_configuration_from_hdf5", "(", "register", ",", "configuration_file", ",", "node", "=", "''", ")", ":", "def", "load_conf", "(", ")", ":", "logging", ".", "info", "(", "\"Loading configuration: %s\"", "%", "h5_file", ".", "filename", ")", "register"...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
save_configuration_to_text_file
Saving configuration to text files from register object Parameters ---------- register : pybar.fei4.register object configuration_file : string Filename of the configuration file.
pybar/fei4/register.py
def save_configuration_to_text_file(register, configuration_file): '''Saving configuration to text files from register object Parameters ---------- register : pybar.fei4.register object configuration_file : string Filename of the configuration file. ''' configuration_path, ...
def save_configuration_to_text_file(register, configuration_file): '''Saving configuration to text files from register object Parameters ---------- register : pybar.fei4.register object configuration_file : string Filename of the configuration file. ''' configuration_path, ...
[ "Saving", "configuration", "to", "text", "files", "from", "register", "object", "Parameters", "----------", "register", ":", "pybar", ".", "fei4", ".", "register", "object", "configuration_file", ":", "string", "Filename", "of", "the", "configuration", "file", "."...
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register.py#L863-L930
[ "def", "save_configuration_to_text_file", "(", "register", ",", "configuration_file", ")", ":", "configuration_path", ",", "filename", "=", "os", ".", "path", ".", "split", "(", "configuration_file", ")", "if", "os", ".", "path", ".", "split", "(", "configuratio...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
save_configuration_to_hdf5
Saving configuration to HDF5 file from register object Parameters ---------- register : pybar.fei4.register object configuration_file : string, file Filename of the HDF5 configuration file or file object. name : string Additional identifier (subgroup). Useful when storing mo...
pybar/fei4/register.py
def save_configuration_to_hdf5(register, configuration_file, name=''): '''Saving configuration to HDF5 file from register object Parameters ---------- register : pybar.fei4.register object configuration_file : string, file Filename of the HDF5 configuration file or file object. ...
def save_configuration_to_hdf5(register, configuration_file, name=''): '''Saving configuration to HDF5 file from register object Parameters ---------- register : pybar.fei4.register object configuration_file : string, file Filename of the HDF5 configuration file or file object. ...
[ "Saving", "configuration", "to", "HDF5", "file", "from", "register", "object", "Parameters", "----------", "register", ":", "pybar", ".", "fei4", ".", "register", "object", "configuration_file", ":", "string", "file", "Filename", "of", "the", "HDF5", "configuratio...
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register.py#L933-L1019
[ "def", "save_configuration_to_hdf5", "(", "register", ",", "configuration_file", ",", "name", "=", "''", ")", ":", "def", "save_conf", "(", ")", ":", "logging", ".", "info", "(", "\"Saving configuration: %s\"", "%", "h5_file", ".", "filename", ")", "register", ...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
FEI4Register.load_configuration
Loading configuration Parameters ---------- configuration_file : string Path to the configuration file (text or HDF5 file).
pybar/fei4/register.py
def load_configuration(self, configuration_file): '''Loading configuration Parameters ---------- configuration_file : string Path to the configuration file (text or HDF5 file). ''' if os.path.isfile(configuration_file): if not isinstance(...
def load_configuration(self, configuration_file): '''Loading configuration Parameters ---------- configuration_file : string Path to the configuration file (text or HDF5 file). ''' if os.path.isfile(configuration_file): if not isinstance(...
[ "Loading", "configuration", "Parameters", "----------", "configuration_file", ":", "string", "Path", "to", "the", "configuration", "file", "(", "text", "or", "HDF5", "file", ")", "." ]
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register.py#L135-L149
[ "def", "load_configuration", "(", "self", ",", "configuration_file", ")", ":", "if", "os", ".", "path", ".", "isfile", "(", "configuration_file", ")", ":", "if", "not", "isinstance", "(", "configuration_file", ",", "tb", ".", "file", ".", "File", ")", "and...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
FEI4Register.save_configuration
Saving configuration Parameters ---------- configuration_file : string Filename of the configuration file.
pybar/fei4/register.py
def save_configuration(self, configuration_file): '''Saving configuration Parameters ---------- configuration_file : string Filename of the configuration file. ''' if not isinstance(configuration_file, tb.file.File) and os.path.splitext(configuration_...
def save_configuration(self, configuration_file): '''Saving configuration Parameters ---------- configuration_file : string Filename of the configuration file. ''' if not isinstance(configuration_file, tb.file.File) and os.path.splitext(configuration_...
[ "Saving", "configuration", "Parameters", "----------", "configuration_file", ":", "string", "Filename", "of", "the", "configuration", "file", "." ]
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register.py#L151-L162
[ "def", "save_configuration", "(", "self", ",", "configuration_file", ")", ":", "if", "not", "isinstance", "(", "configuration_file", ",", "tb", ".", "file", ".", "File", ")", "and", "os", ".", "path", ".", "splitext", "(", "configuration_file", ")", "[", "...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
FEI4Register.get_commands
get fe_command from command name and keyword arguments wrapper for build_commands() implements FEI4 specific behavior
pybar/fei4/register.py
def get_commands(self, command_name, **kwargs): """get fe_command from command name and keyword arguments wrapper for build_commands() implements FEI4 specific behavior """ chip_id = kwargs.pop("ChipID", self.chip_id_bitarray) commands = [] if command_n...
def get_commands(self, command_name, **kwargs): """get fe_command from command name and keyword arguments wrapper for build_commands() implements FEI4 specific behavior """ chip_id = kwargs.pop("ChipID", self.chip_id_bitarray) commands = [] if command_n...
[ "get", "fe_command", "from", "command", "name", "and", "keyword", "arguments", "wrapper", "for", "build_commands", "()", "implements", "FEI4", "specific", "behavior" ]
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register.py#L205-L410
[ "def", "get_commands", "(", "self", ",", "command_name", ",", "*", "*", "kwargs", ")", ":", "chip_id", "=", "kwargs", ".", "pop", "(", "\"ChipID\"", ",", "self", ".", "chip_id_bitarray", ")", "commands", "=", "[", "]", "if", "command_name", "==", "\"zero...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
FEI4Register.build_command
build command from command_name and keyword values Returns ------- command_bitvector : list List of bitarrays. Usage ----- Receives: command name as defined inside xml file, key-value-pairs as defined inside bit stream filed for each command
pybar/fei4/register.py
def build_command(self, command_name, **kwargs): """build command from command_name and keyword values Returns ------- command_bitvector : list List of bitarrays. Usage ----- Receives: command name as defined inside xml file, key-value-pair...
def build_command(self, command_name, **kwargs): """build command from command_name and keyword values Returns ------- command_bitvector : list List of bitarrays. Usage ----- Receives: command name as defined inside xml file, key-value-pair...
[ "build", "command", "from", "command_name", "and", "keyword", "values", "Returns", "-------", "command_bitvector", ":", "list", "List", "of", "bitarrays", ".", "Usage", "-----", "Receives", ":", "command", "name", "as", "defined", "inside", "xml", "file", "key",...
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register.py#L412-L465
[ "def", "build_command", "(", "self", ",", "command_name", ",", "*", "*", "kwargs", ")", ":", "# command_name = command_name.lower()\r", "command_bitvector", "=", "bitarray", "(", "0", ",", "endian", "=", "'little'", ")", "if", "command_name", "not", "in", ...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
FEI4Register.get_global_register_attributes
Calculating register numbers from register names. Usage: get_global_register_attributes("attribute_name", name = [regname_1, regname_2, ...], addresses = 2) Receives: attribute name to be returned, dictionaries (kwargs) of register attributes and values for making cuts Returns: list of attr...
pybar/fei4/register.py
def get_global_register_attributes(self, register_attribute, do_sort=True, **kwargs): """Calculating register numbers from register names. Usage: get_global_register_attributes("attribute_name", name = [regname_1, regname_2, ...], addresses = 2) Receives: attribute name to be returned, dict...
def get_global_register_attributes(self, register_attribute, do_sort=True, **kwargs): """Calculating register numbers from register names. Usage: get_global_register_attributes("attribute_name", name = [regname_1, regname_2, ...], addresses = 2) Receives: attribute name to be returned, dict...
[ "Calculating", "register", "numbers", "from", "register", "names", ".", "Usage", ":", "get_global_register_attributes", "(", "attribute_name", "name", "=", "[", "regname_1", "regname_2", "...", "]", "addresses", "=", "2", ")", "Receives", ":", "attribute", "name",...
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register.py#L467-L493
[ "def", "get_global_register_attributes", "(", "self", ",", "register_attribute", ",", "do_sort", "=", "True", ",", "*", "*", "kwargs", ")", ":", "# speed up of the most often used keyword name\r", "try", ":", "names", "=", "iterable", "(", "kwargs", ".", "pop", "(...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
FEI4Register.get_global_register_objects
Generate register objects (list) from register name list Usage: get_global_register_objects(name = ["Amp2Vbn", "GateHitOr", "DisableColumnCnfg"], address = [2, 3]) Receives: keyword lists of register names, addresses,... for making cuts Returns: list of register objects
pybar/fei4/register.py
def get_global_register_objects(self, do_sort=None, reverse=False, **kwargs): """Generate register objects (list) from register name list Usage: get_global_register_objects(name = ["Amp2Vbn", "GateHitOr", "DisableColumnCnfg"], address = [2, 3]) Receives: keyword lists of register names, add...
def get_global_register_objects(self, do_sort=None, reverse=False, **kwargs): """Generate register objects (list) from register name list Usage: get_global_register_objects(name = ["Amp2Vbn", "GateHitOr", "DisableColumnCnfg"], address = [2, 3]) Receives: keyword lists of register names, add...
[ "Generate", "register", "objects", "(", "list", ")", "from", "register", "name", "list", "Usage", ":", "get_global_register_objects", "(", "name", "=", "[", "Amp2Vbn", "GateHitOr", "DisableColumnCnfg", "]", "address", "=", "[", "2", "3", "]", ")", "Receives", ...
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register.py#L495-L518
[ "def", "get_global_register_objects", "(", "self", ",", "do_sort", "=", "None", ",", "reverse", "=", "False", ",", "*", "*", "kwargs", ")", ":", "# speed up of the most often used keyword name\r", "try", ":", "names", "=", "iterable", "(", "kwargs", ".", "pop", ...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
FEI4Register.get_global_register_bitsets
Calculating register bitsets from register addresses. Usage: get_global_register_bitsets([regaddress_1, regaddress_2, ...]) Receives: list of register addresses Returns: list of register bitsets
pybar/fei4/register.py
def get_global_register_bitsets(self, register_addresses): # TOTO: add sorting """Calculating register bitsets from register addresses. Usage: get_global_register_bitsets([regaddress_1, regaddress_2, ...]) Receives: list of register addresses Returns: list of register bitsets ...
def get_global_register_bitsets(self, register_addresses): # TOTO: add sorting """Calculating register bitsets from register addresses. Usage: get_global_register_bitsets([regaddress_1, regaddress_2, ...]) Receives: list of register addresses Returns: list of register bitsets ...
[ "Calculating", "register", "bitsets", "from", "register", "addresses", ".", "Usage", ":", "get_global_register_bitsets", "(", "[", "regaddress_1", "regaddress_2", "...", "]", ")", "Receives", ":", "list", "of", "register", "addresses", "Returns", ":", "list", "of"...
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register.py#L520-L548
[ "def", "get_global_register_bitsets", "(", "self", ",", "register_addresses", ")", ":", "# TOTO: add sorting\r", "register_bitsets", "=", "[", "]", "for", "register_address", "in", "register_addresses", ":", "register_objects", "=", "self", ".", "get_global_register_objec...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
FEI4Register.get_pixel_register_objects
Generate register objects (list) from register name list Usage: get_pixel_register_objects(name = ["TDAC", "FDAC"]) Receives: keyword lists of register names, addresses,... Returns: list of register objects
pybar/fei4/register.py
def get_pixel_register_objects(self, do_sort=None, reverse=False, **kwargs): """Generate register objects (list) from register name list Usage: get_pixel_register_objects(name = ["TDAC", "FDAC"]) Receives: keyword lists of register names, addresses,... Returns: list of register obj...
def get_pixel_register_objects(self, do_sort=None, reverse=False, **kwargs): """Generate register objects (list) from register name list Usage: get_pixel_register_objects(name = ["TDAC", "FDAC"]) Receives: keyword lists of register names, addresses,... Returns: list of register obj...
[ "Generate", "register", "objects", "(", "list", ")", "from", "register", "name", "list", "Usage", ":", "get_pixel_register_objects", "(", "name", "=", "[", "TDAC", "FDAC", "]", ")", "Receives", ":", "keyword", "lists", "of", "register", "names", "addresses", ...
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register.py#L550-L573
[ "def", "get_pixel_register_objects", "(", "self", ",", "do_sort", "=", "None", ",", "reverse", "=", "False", ",", "*", "*", "kwargs", ")", ":", "# speed up of the most often used keyword name\r", "try", ":", "names", "=", "iterable", "(", "kwargs", ".", "pop", ...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
FEI4Register.get_pixel_register_bitset
Calculating pixel register bitsets from pixel register addresses. Usage: get_pixel_register_bitset(object, bit_number, double_column_number) Receives: register object, bit number, double column number Returns: double column bitset
pybar/fei4/register.py
def get_pixel_register_bitset(self, register_object, bit_no, dc_no): """Calculating pixel register bitsets from pixel register addresses. Usage: get_pixel_register_bitset(object, bit_number, double_column_number) Receives: register object, bit number, double column number Returns: ...
def get_pixel_register_bitset(self, register_object, bit_no, dc_no): """Calculating pixel register bitsets from pixel register addresses. Usage: get_pixel_register_bitset(object, bit_number, double_column_number) Receives: register object, bit number, double column number Returns: ...
[ "Calculating", "pixel", "register", "bitsets", "from", "pixel", "register", "addresses", ".", "Usage", ":", "get_pixel_register_bitset", "(", "object", "bit_number", "double_column_number", ")", "Receives", ":", "register", "object", "bit", "number", "double", "column...
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register.py#L575-L597
[ "def", "get_pixel_register_bitset", "(", "self", ",", "register_object", ",", "bit_no", ",", "dc_no", ")", ":", "if", "not", "0", "<=", "dc_no", "<", "40", ":", "raise", "ValueError", "(", "\"Pixel register %s: DC out of range\"", "%", "register_object", "[", "'...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
FEI4Register.create_restore_point
Creating a configuration restore point. Parameters ---------- name : str Name of the restore point. If not given, a md5 hash will be generated.
pybar/fei4/register.py
def create_restore_point(self, name=None): '''Creating a configuration restore point. Parameters ---------- name : str Name of the restore point. If not given, a md5 hash will be generated. ''' if name is None: for i in iter(int, 1): ...
def create_restore_point(self, name=None): '''Creating a configuration restore point. Parameters ---------- name : str Name of the restore point. If not given, a md5 hash will be generated. ''' if name is None: for i in iter(int, 1): ...
[ "Creating", "a", "configuration", "restore", "point", ".", "Parameters", "----------", "name", ":", "str", "Name", "of", "the", "restore", "point", ".", "If", "not", "given", "a", "md5", "hash", "will", "be", "generated", "." ]
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register.py#L607-L627
[ "def", "create_restore_point", "(", "self", ",", "name", "=", "None", ")", ":", "if", "name", "is", "None", ":", "for", "i", "in", "iter", "(", "int", ",", "1", ")", ":", "name", "=", "datetime", ".", "datetime", ".", "utcnow", "(", ")", ".", "st...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
FEI4Register.restore
Restoring a configuration restore point. Parameters ---------- name : str Name of the restore point. If not given, a md5 hash will be generated. keep : bool Keeping restore point for later use. last : bool If name is not given, the la...
pybar/fei4/register.py
def restore(self, name=None, keep=False, last=True, global_register=True, pixel_register=True): '''Restoring a configuration restore point. Parameters ---------- name : str Name of the restore point. If not given, a md5 hash will be generated. keep : bool ...
def restore(self, name=None, keep=False, last=True, global_register=True, pixel_register=True): '''Restoring a configuration restore point. Parameters ---------- name : str Name of the restore point. If not given, a md5 hash will be generated. keep : bool ...
[ "Restoring", "a", "configuration", "restore", "point", ".", "Parameters", "----------", "name", ":", "str", "Name", "of", "the", "restore", "point", ".", "If", "not", "given", "a", "md5", "hash", "will", "be", "generated", ".", "keep", ":", "bool", "Keepin...
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register.py#L629-L660
[ "def", "restore", "(", "self", ",", "name", "=", "None", ",", "keep", "=", "False", ",", "last", "=", "True", ",", "global_register", "=", "True", ",", "pixel_register", "=", "True", ")", ":", "if", "name", "is", "None", ":", "if", "keep", ":", "na...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
FEI4Register.clear_restore_points
Deleting all/a configuration restore points/point. Parameters ---------- name : str Name of the restore point to be deleted. If not given, all restore points will be deleted.
pybar/fei4/register.py
def clear_restore_points(self, name=None): '''Deleting all/a configuration restore points/point. Parameters ---------- name : str Name of the restore point to be deleted. If not given, all restore points will be deleted. ''' if name is None: ...
def clear_restore_points(self, name=None): '''Deleting all/a configuration restore points/point. Parameters ---------- name : str Name of the restore point to be deleted. If not given, all restore points will be deleted. ''' if name is None: ...
[ "Deleting", "all", "/", "a", "configuration", "restore", "points", "/", "point", ".", "Parameters", "----------", "name", ":", "str", "Name", "of", "the", "restore", "point", "to", "be", "deleted", ".", "If", "not", "given", "all", "restore", "points", "wi...
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register.py#L662-L673
[ "def", "clear_restore_points", "(", "self", ",", "name", "=", "None", ")", ":", "if", "name", "is", "None", ":", "self", ".", "config_state", ".", "clear", "(", ")", "else", ":", "del", "self", ".", "config_state", "[", "name", "]" ]
5ad95bbcd41cd358825823fb78f396cfce23593e
train
save_configuration_dict
Stores any configuration dictionary to HDF5 file. Parameters ---------- h5_file : string, file Filename of the HDF5 configuration file or file object. configuation_name : str Configuration name. Will be used for table name. configuration : dict Configuration diction...
pybar/daq/readout_utils.py
def save_configuration_dict(h5_file, configuation_name, configuration, **kwargs): '''Stores any configuration dictionary to HDF5 file. Parameters ---------- h5_file : string, file Filename of the HDF5 configuration file or file object. configuation_name : str Configuration n...
def save_configuration_dict(h5_file, configuation_name, configuration, **kwargs): '''Stores any configuration dictionary to HDF5 file. Parameters ---------- h5_file : string, file Filename of the HDF5 configuration file or file object. configuation_name : str Configuration n...
[ "Stores", "any", "configuration", "dictionary", "to", "HDF5", "file", ".", "Parameters", "----------", "h5_file", ":", "string", "file", "Filename", "of", "the", "HDF5", "configuration", "file", "or", "file", "object", ".", "configuation_name", ":", "str", "Conf...
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/readout_utils.py#L13-L49
[ "def", "save_configuration_dict", "(", "h5_file", ",", "configuation_name", ",", "configuration", ",", "*", "*", "kwargs", ")", ":", "def", "save_conf", "(", ")", ":", "try", ":", "h5_file", ".", "remove_node", "(", "h5_file", ".", "root", ".", "configuratio...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
convert_data_array
Filter and convert raw data numpy array (numpy.ndarray). Parameters ---------- array : numpy.array Raw data array. filter_func : function Function that takes array and returns true or false for each item in array. converter_func : function Function that takes array ...
pybar/daq/readout_utils.py
def convert_data_array(array, filter_func=None, converter_func=None): # TODO: add copy parameter, otherwise in-place '''Filter and convert raw data numpy array (numpy.ndarray). Parameters ---------- array : numpy.array Raw data array. filter_func : function Function that ta...
def convert_data_array(array, filter_func=None, converter_func=None): # TODO: add copy parameter, otherwise in-place '''Filter and convert raw data numpy array (numpy.ndarray). Parameters ---------- array : numpy.array Raw data array. filter_func : function Function that ta...
[ "Filter", "and", "convert", "raw", "data", "numpy", "array", "(", "numpy", ".", "ndarray", ")", ".", "Parameters", "----------", "array", ":", "numpy", ".", "array", "Raw", "data", "array", ".", "filter_func", ":", "function", "Function", "that", "takes", ...
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/readout_utils.py#L52-L79
[ "def", "convert_data_array", "(", "array", ",", "filter_func", "=", "None", ",", "converter_func", "=", "None", ")", ":", "# TODO: add copy parameter, otherwise in-place\r", "# if filter_func != None:\r", "# if not hasattr(filter_func, '__call__'):\r", "# ra...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
convert_data_iterable
Convert raw data in data iterable. Parameters ---------- data_iterable : iterable Iterable where each element is a tuple with following content: (raw data, timestamp_start, timestamp_stop, status). filter_func : function Function that takes array and returns true or false for eac...
pybar/daq/readout_utils.py
def convert_data_iterable(data_iterable, filter_func=None, converter_func=None): # TODO: add concatenate parameter '''Convert raw data in data iterable. Parameters ---------- data_iterable : iterable Iterable where each element is a tuple with following content: (raw data, timestamp_star...
def convert_data_iterable(data_iterable, filter_func=None, converter_func=None): # TODO: add concatenate parameter '''Convert raw data in data iterable. Parameters ---------- data_iterable : iterable Iterable where each element is a tuple with following content: (raw data, timestamp_star...
[ "Convert", "raw", "data", "in", "data", "iterable", ".", "Parameters", "----------", "data_iterable", ":", "iterable", "Iterable", "where", "each", "element", "is", "a", "tuple", "with", "following", "content", ":", "(", "raw", "data", "timestamp_start", "timest...
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/readout_utils.py#L82-L102
[ "def", "convert_data_iterable", "(", "data_iterable", ",", "filter_func", "=", "None", ",", "converter_func", "=", "None", ")", ":", "# TODO: add concatenate parameter\r", "data_list", "=", "[", "]", "for", "item", "in", "data_iterable", ":", "data_list", ".", "ap...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
data_array_from_data_iterable
Convert data iterable to raw data numpy array. Parameters ---------- data_iterable : iterable Iterable where each element is a tuple with following content: (raw data, timestamp_start, timestamp_stop, status). Returns ------- data_array : numpy.array concatenated data...
pybar/daq/readout_utils.py
def data_array_from_data_iterable(data_iterable): '''Convert data iterable to raw data numpy array. Parameters ---------- data_iterable : iterable Iterable where each element is a tuple with following content: (raw data, timestamp_start, timestamp_stop, status). Returns ------...
def data_array_from_data_iterable(data_iterable): '''Convert data iterable to raw data numpy array. Parameters ---------- data_iterable : iterable Iterable where each element is a tuple with following content: (raw data, timestamp_start, timestamp_stop, status). Returns ------...
[ "Convert", "data", "iterable", "to", "raw", "data", "numpy", "array", ".", "Parameters", "----------", "data_iterable", ":", "iterable", "Iterable", "where", "each", "element", "is", "a", "tuple", "with", "following", "content", ":", "(", "raw", "data", "times...
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/readout_utils.py#L105-L122
[ "def", "data_array_from_data_iterable", "(", "data_iterable", ")", ":", "try", ":", "data_array", "=", "np", ".", "concatenate", "(", "[", "item", "[", "0", "]", "for", "item", "in", "data_iterable", "]", ")", "except", "ValueError", ":", "# length is 0\r", ...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
convert_tdc_to_channel
Converts TDC words at a given channel to common TDC header (0x4).
pybar/daq/readout_utils.py
def convert_tdc_to_channel(channel): ''' Converts TDC words at a given channel to common TDC header (0x4). ''' def f(value): filter_func = logical_and(is_tdc_word, is_tdc_from_channel(channel)) select = filter_func(value) value[select] = np.bitwise_and(value[select], 0x0FFFFFFF...
def convert_tdc_to_channel(channel): ''' Converts TDC words at a given channel to common TDC header (0x4). ''' def f(value): filter_func = logical_and(is_tdc_word, is_tdc_from_channel(channel)) select = filter_func(value) value[select] = np.bitwise_and(value[select], 0x0FFFFFFF...
[ "Converts", "TDC", "words", "at", "a", "given", "channel", "to", "common", "TDC", "header", "(", "0x4", ")", "." ]
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/readout_utils.py#L151-L161
[ "def", "convert_tdc_to_channel", "(", "channel", ")", ":", "def", "f", "(", "value", ")", ":", "filter_func", "=", "logical_and", "(", "is_tdc_word", ",", "is_tdc_from_channel", "(", "channel", ")", ")", "select", "=", "filter_func", "(", "value", ")", "valu...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
is_data_from_channel
Selecting FE data from given channel. Parameters ---------- channel : int Channel number (4 is default channel on Single Chip Card). Returns ------- Function. Usage: 1 Selecting FE data from channel 4 (combine with is_fe_word): filter_fe_data_from_channel_...
pybar/daq/readout_utils.py
def is_data_from_channel(channel=4): # function factory '''Selecting FE data from given channel. Parameters ---------- channel : int Channel number (4 is default channel on Single Chip Card). Returns ------- Function. Usage: 1 Selecting FE data from channel 4...
def is_data_from_channel(channel=4): # function factory '''Selecting FE data from given channel. Parameters ---------- channel : int Channel number (4 is default channel on Single Chip Card). Returns ------- Function. Usage: 1 Selecting FE data from channel 4...
[ "Selecting", "FE", "data", "from", "given", "channel", ".", "Parameters", "----------", "channel", ":", "int", "Channel", "number", "(", "4", "is", "default", "channel", "on", "Single", "Chip", "Card", ")", ".", "Returns", "-------", "Function", ".", "Usage"...
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/readout_utils.py#L164-L196
[ "def", "is_data_from_channel", "(", "channel", "=", "4", ")", ":", "# function factory\r", "if", "channel", ">=", "0", "and", "channel", "<", "16", ":", "def", "f", "(", "value", ")", ":", "return", "np", ".", "equal", "(", "np", ".", "right_shift", "(...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
logical_and
Logical and from functions. Parameters ---------- f1, f2 : function Function that takes array and returns true or false for each item in array. Returns ------- Function. Usage: filter_func=logical_and(is_data_record, is_data_from_channel(4)) # new filter function ...
pybar/daq/readout_utils.py
def logical_and(f1, f2): # function factory '''Logical and from functions. Parameters ---------- f1, f2 : function Function that takes array and returns true or false for each item in array. Returns ------- Function. Usage: filter_func=logical_and(is_data_rec...
def logical_and(f1, f2): # function factory '''Logical and from functions. Parameters ---------- f1, f2 : function Function that takes array and returns true or false for each item in array. Returns ------- Function. Usage: filter_func=logical_and(is_data_rec...
[ "Logical", "and", "from", "functions", ".", "Parameters", "----------", "f1", "f2", ":", "function", "Function", "that", "takes", "array", "and", "returns", "true", "or", "false", "for", "each", "item", "in", "array", ".", "Returns", "-------", "Function", "...
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/readout_utils.py#L199-L218
[ "def", "logical_and", "(", "f1", ",", "f2", ")", ":", "# function factory\r", "def", "f", "(", "value", ")", ":", "return", "np", ".", "logical_and", "(", "f1", "(", "value", ")", ",", "f2", "(", "value", ")", ")", "f", ".", "__name__", "=", "\"(\"...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
logical_or
Logical or from functions. Parameters ---------- f1, f2 : function Function that takes array and returns true or false for each item in array. Returns ------- Function.
pybar/daq/readout_utils.py
def logical_or(f1, f2): # function factory '''Logical or from functions. Parameters ---------- f1, f2 : function Function that takes array and returns true or false for each item in array. Returns ------- Function. ''' def f(value): return np.logical_o...
def logical_or(f1, f2): # function factory '''Logical or from functions. Parameters ---------- f1, f2 : function Function that takes array and returns true or false for each item in array. Returns ------- Function. ''' def f(value): return np.logical_o...
[ "Logical", "or", "from", "functions", ".", "Parameters", "----------", "f1", "f2", ":", "function", "Function", "that", "takes", "array", "and", "returns", "true", "or", "false", "for", "each", "item", "in", "array", ".", "Returns", "-------", "Function", "....
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/readout_utils.py#L221-L236
[ "def", "logical_or", "(", "f1", ",", "f2", ")", ":", "# function factory\r", "def", "f", "(", "value", ")", ":", "return", "np", ".", "logical_or", "(", "f1", "(", "value", ")", ",", "f2", "(", "value", ")", ")", "f", ".", "__name__", "=", "\"(\"",...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
logical_not
Logical not from functions. Parameters ---------- f1, f2 : function Function that takes array and returns true or false for each item in array. Returns ------- Function.
pybar/daq/readout_utils.py
def logical_not(f): # function factory '''Logical not from functions. Parameters ---------- f1, f2 : function Function that takes array and returns true or false for each item in array. Returns ------- Function. ''' def f(value): return np.logical_not(...
def logical_not(f): # function factory '''Logical not from functions. Parameters ---------- f1, f2 : function Function that takes array and returns true or false for each item in array. Returns ------- Function. ''' def f(value): return np.logical_not(...
[ "Logical", "not", "from", "functions", ".", "Parameters", "----------", "f1", "f2", ":", "function", "Function", "that", "takes", "array", "and", "returns", "true", "or", "false", "for", "each", "item", "in", "array", ".", "Returns", "-------", "Function", "...
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/readout_utils.py#L239-L254
[ "def", "logical_not", "(", "f", ")", ":", "# function factory\r", "def", "f", "(", "value", ")", ":", "return", "np", ".", "logical_not", "(", "f", "(", "value", ")", ")", "f", ".", "__name__", "=", "\"not_\"", "+", "f", ".", "__name__", "return", "f...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
logical_xor
Logical xor from functions. Parameters ---------- f1, f2 : function Function that takes array and returns true or false for each item in array. Returns ------- Function.
pybar/daq/readout_utils.py
def logical_xor(f1, f2): # function factory '''Logical xor from functions. Parameters ---------- f1, f2 : function Function that takes array and returns true or false for each item in array. Returns ------- Function. ''' def f(value): return np.logical...
def logical_xor(f1, f2): # function factory '''Logical xor from functions. Parameters ---------- f1, f2 : function Function that takes array and returns true or false for each item in array. Returns ------- Function. ''' def f(value): return np.logical...
[ "Logical", "xor", "from", "functions", ".", "Parameters", "----------", "f1", "f2", ":", "function", "Function", "that", "takes", "array", "and", "returns", "true", "or", "false", "for", "each", "item", "in", "array", ".", "Returns", "-------", "Function", "...
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/readout_utils.py#L257-L272
[ "def", "logical_xor", "(", "f1", ",", "f2", ")", ":", "# function factory\r", "def", "f", "(", "value", ")", ":", "return", "np", ".", "logical_xor", "(", "f1", "(", "value", ")", ",", "f2", "(", "value", ")", ")", "f", ".", "__name__", "=", "\"(\"...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
get_trigger_data
Returns 31bit trigger counter (mode=0), 31bit timestamp (mode=1), 15bit timestamp and 16bit trigger counter (mode=2)
pybar/daq/readout_utils.py
def get_trigger_data(value, mode=0): '''Returns 31bit trigger counter (mode=0), 31bit timestamp (mode=1), 15bit timestamp and 16bit trigger counter (mode=2) ''' if mode == 2: return np.right_shift(np.bitwise_and(value, 0x7FFF0000), 16), np.bitwise_and(value, 0x0000FFFF) else: retur...
def get_trigger_data(value, mode=0): '''Returns 31bit trigger counter (mode=0), 31bit timestamp (mode=1), 15bit timestamp and 16bit trigger counter (mode=2) ''' if mode == 2: return np.right_shift(np.bitwise_and(value, 0x7FFF0000), 16), np.bitwise_and(value, 0x0000FFFF) else: retur...
[ "Returns", "31bit", "trigger", "counter", "(", "mode", "=", "0", ")", "31bit", "timestamp", "(", "mode", "=", "1", ")", "15bit", "timestamp", "and", "16bit", "trigger", "counter", "(", "mode", "=", "2", ")" ]
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/readout_utils.py#L315-L321
[ "def", "get_trigger_data", "(", "value", ",", "mode", "=", "0", ")", ":", "if", "mode", "==", "2", ":", "return", "np", ".", "right_shift", "(", "np", ".", "bitwise_and", "(", "value", ",", "0x7FFF0000", ")", ",", "16", ")", ",", "np", ".", "bitwis...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
get_col_row_tot_array_from_data_record_array
Convert raw data array to column, row, and ToT array. Parameters ---------- array : numpy.array Raw data array. Returns ------- Tuple of arrays.
pybar/daq/readout_utils.py
def get_col_row_tot_array_from_data_record_array(array): # TODO: max ToT '''Convert raw data array to column, row, and ToT array. Parameters ---------- array : numpy.array Raw data array. Returns ------- Tuple of arrays. ''' def get_col_row_tot_1_array_from_dat...
def get_col_row_tot_array_from_data_record_array(array): # TODO: max ToT '''Convert raw data array to column, row, and ToT array. Parameters ---------- array : numpy.array Raw data array. Returns ------- Tuple of arrays. ''' def get_col_row_tot_1_array_from_dat...
[ "Convert", "raw", "data", "array", "to", "column", "row", "and", "ToT", "array", ".", "Parameters", "----------", "array", ":", "numpy", ".", "array", "Raw", "data", "array", ".", "Returns", "-------", "Tuple", "of", "arrays", "." ]
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/readout_utils.py#L342-L370
[ "def", "get_col_row_tot_array_from_data_record_array", "(", "array", ")", ":", "# TODO: max ToT\r", "def", "get_col_row_tot_1_array_from_data_record_array", "(", "value", ")", ":", "return", "np", ".", "right_shift", "(", "np", ".", "bitwise_and", "(", "value", ",", "...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
interpret_pixel_data
Takes the pixel raw data and interprets them. This includes consistency checks and pixel/data matching. The data has to come from one double column only but can have more than one pixel bit (e.g. TDAC = 5 bit). Parameters ---------- data : numpy.ndarray The raw data words. dc : int ...
pybar/daq/readout_utils.py
def interpret_pixel_data(data, dc, pixel_array, invert=True): '''Takes the pixel raw data and interprets them. This includes consistency checks and pixel/data matching. The data has to come from one double column only but can have more than one pixel bit (e.g. TDAC = 5 bit). Parameters ---------- ...
def interpret_pixel_data(data, dc, pixel_array, invert=True): '''Takes the pixel raw data and interprets them. This includes consistency checks and pixel/data matching. The data has to come from one double column only but can have more than one pixel bit (e.g. TDAC = 5 bit). Parameters ---------- ...
[ "Takes", "the", "pixel", "raw", "data", "and", "interprets", "them", ".", "This", "includes", "consistency", "checks", "and", "pixel", "/", "data", "matching", ".", "The", "data", "has", "to", "come", "from", "one", "double", "column", "only", "but", "can"...
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/readout_utils.py#L428-L499
[ "def", "interpret_pixel_data", "(", "data", ",", "dc", ",", "pixel_array", ",", "invert", "=", "True", ")", ":", "# data validity cut, VR has to follow an AR\r", "index_value", "=", "np", ".", "where", "(", "is_address_record", "(", "data", ")", ")", "[", "0", ...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
AnalyzeRawData.set_standard_settings
Set all settings to their standard values.
pybar/analysis/analyze_raw_data.py
def set_standard_settings(self): '''Set all settings to their standard values. ''' if self.is_open(self.out_file_h5): self.out_file_h5.close() self.out_file_h5 = None self._setup_clusterizer() self.chunk_size = 3000000 self.n_injections = None ...
def set_standard_settings(self): '''Set all settings to their standard values. ''' if self.is_open(self.out_file_h5): self.out_file_h5.close() self.out_file_h5 = None self._setup_clusterizer() self.chunk_size = 3000000 self.n_injections = None ...
[ "Set", "all", "settings", "to", "their", "standard", "values", "." ]
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analyze_raw_data.py#L263-L312
[ "def", "set_standard_settings", "(", "self", ")", ":", "if", "self", ".", "is_open", "(", "self", ".", "out_file_h5", ")", ":", "self", ".", "out_file_h5", ".", "close", "(", ")", "self", ".", "out_file_h5", "=", "None", "self", ".", "_setup_clusterizer", ...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
AnalyzeRawData.trig_count
Set the numbers of BCIDs (usually 16) of one event.
pybar/analysis/analyze_raw_data.py
def trig_count(self, value): """Set the numbers of BCIDs (usually 16) of one event.""" self._trig_count = 16 if value == 0 else value self.interpreter.set_trig_count(self._trig_count)
def trig_count(self, value): """Set the numbers of BCIDs (usually 16) of one event.""" self._trig_count = 16 if value == 0 else value self.interpreter.set_trig_count(self._trig_count)
[ "Set", "the", "numbers", "of", "BCIDs", "(", "usually", "16", ")", "of", "one", "event", "." ]
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analyze_raw_data.py#L531-L534
[ "def", "trig_count", "(", "self", ",", "value", ")", ":", "self", ".", "_trig_count", "=", "16", "if", "value", "==", "0", "else", "value", "self", ".", "interpreter", ".", "set_trig_count", "(", "self", ".", "_trig_count", ")" ]
5ad95bbcd41cd358825823fb78f396cfce23593e
train
AnalyzeRawData.max_tot_value
Set maximum ToT value that is considered to be a hit
pybar/analysis/analyze_raw_data.py
def max_tot_value(self, value): """Set maximum ToT value that is considered to be a hit""" self._max_tot_value = value self.interpreter.set_max_tot(self._max_tot_value) self.histogram.set_max_tot(self._max_tot_value) self.clusterizer.set_max_hit_charge(self._max_tot_value)
def max_tot_value(self, value): """Set maximum ToT value that is considered to be a hit""" self._max_tot_value = value self.interpreter.set_max_tot(self._max_tot_value) self.histogram.set_max_tot(self._max_tot_value) self.clusterizer.set_max_hit_charge(self._max_tot_value)
[ "Set", "maximum", "ToT", "value", "that", "is", "considered", "to", "be", "a", "hit" ]
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analyze_raw_data.py#L542-L547
[ "def", "max_tot_value", "(", "self", ",", "value", ")", ":", "self", ".", "_max_tot_value", "=", "value", "self", ".", "interpreter", ".", "set_max_tot", "(", "self", ".", "_max_tot_value", ")", "self", ".", "histogram", ".", "set_max_tot", "(", "self", "....
5ad95bbcd41cd358825823fb78f396cfce23593e
train
AnalyzeRawData.interpret_word_table
Interprets the raw data word table of all given raw data files with the c++ library. Creates the h5 output file and PDF plots. Parameters ---------- analyzed_data_file : string The file name of the output analyzed data file. If None, the output analyzed data file ...
pybar/analysis/analyze_raw_data.py
def interpret_word_table(self, analyzed_data_file=None, use_settings_from_file=True, fei4b=None): '''Interprets the raw data word table of all given raw data files with the c++ library. Creates the h5 output file and PDF plots. Parameters ---------- analyzed_data_file : string ...
def interpret_word_table(self, analyzed_data_file=None, use_settings_from_file=True, fei4b=None): '''Interprets the raw data word table of all given raw data files with the c++ library. Creates the h5 output file and PDF plots. Parameters ---------- analyzed_data_file : string ...
[ "Interprets", "the", "raw", "data", "word", "table", "of", "all", "given", "raw", "data", "files", "with", "the", "c", "++", "library", ".", "Creates", "the", "h5", "output", "file", "and", "PDF", "plots", "." ]
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analyze_raw_data.py#L643-L921
[ "def", "interpret_word_table", "(", "self", ",", "analyzed_data_file", "=", "None", ",", "use_settings_from_file", "=", "True", ",", "fei4b", "=", "None", ")", ":", "logging", ".", "info", "(", "'Interpreting raw data file(s): '", "+", "(", "', '", ")", ".", "...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
AnalyzeRawData.analyze_hit_table
Analyzes a hit table with the c++ histogrammming/clusterizer. Parameters ---------- analyzed_data_file : string The filename of the analyzed data file. If None, the analyzed data file specified during initialization is taken. Filename extension (.h5) does not...
pybar/analysis/analyze_raw_data.py
def analyze_hit_table(self, analyzed_data_file=None, analyzed_data_out_file=None): '''Analyzes a hit table with the c++ histogrammming/clusterizer. Parameters ---------- analyzed_data_file : string The filename of the analyzed data file. If None, the analyzed data file ...
def analyze_hit_table(self, analyzed_data_file=None, analyzed_data_out_file=None): '''Analyzes a hit table with the c++ histogrammming/clusterizer. Parameters ---------- analyzed_data_file : string The filename of the analyzed data file. If None, the analyzed data file ...
[ "Analyzes", "a", "hit", "table", "with", "the", "c", "++", "histogrammming", "/", "clusterizer", "." ]
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analyze_raw_data.py#L1067-L1204
[ "def", "analyze_hit_table", "(", "self", ",", "analyzed_data_file", "=", "None", ",", "analyzed_data_out_file", "=", "None", ")", ":", "close_analyzed_data_file", "=", "False", "if", "analyzed_data_file", "is", "not", "None", ":", "# if an output file name is specified ...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
AnalyzeRawData._deduce_settings_from_file
Tries to get the scan parameters needed for analysis from the raw data file
pybar/analysis/analyze_raw_data.py
def _deduce_settings_from_file(self, opened_raw_data_file): # TODO: parse better '''Tries to get the scan parameters needed for analysis from the raw data file ''' try: # take infos raw data files (not avalable in old files) flavor = opened_raw_data_file.root.configuration.miscella...
def _deduce_settings_from_file(self, opened_raw_data_file): # TODO: parse better '''Tries to get the scan parameters needed for analysis from the raw data file ''' try: # take infos raw data files (not avalable in old files) flavor = opened_raw_data_file.root.configuration.miscella...
[ "Tries", "to", "get", "the", "scan", "parameters", "needed", "for", "analysis", "from", "the", "raw", "data", "file" ]
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analyze_raw_data.py#L1399-L1431
[ "def", "_deduce_settings_from_file", "(", "self", ",", "opened_raw_data_file", ")", ":", "# TODO: parse better", "try", ":", "# take infos raw data files (not avalable in old files)", "flavor", "=", "opened_raw_data_file", ".", "root", ".", "configuration", ".", "miscellaneou...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
AnalyzeRawData._get_plsr_dac_charge
Takes the PlsrDAC calibration and the stored C-high/C-low mask to calculate the charge from the PlsrDAC array on a pixel basis
pybar/analysis/analyze_raw_data.py
def _get_plsr_dac_charge(self, plsr_dac_array, no_offset=False): '''Takes the PlsrDAC calibration and the stored C-high/C-low mask to calculate the charge from the PlsrDAC array on a pixel basis ''' charge = np.zeros_like(self.c_low_mask, dtype=np.float16) # charge in electrons if self....
def _get_plsr_dac_charge(self, plsr_dac_array, no_offset=False): '''Takes the PlsrDAC calibration and the stored C-high/C-low mask to calculate the charge from the PlsrDAC array on a pixel basis ''' charge = np.zeros_like(self.c_low_mask, dtype=np.float16) # charge in electrons if self....
[ "Takes", "the", "PlsrDAC", "calibration", "and", "the", "stored", "C", "-", "high", "/", "C", "-", "low", "mask", "to", "calculate", "the", "charge", "from", "the", "PlsrDAC", "array", "on", "a", "pixel", "basis" ]
SiLab-Bonn/pyBAR
python
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analyze_raw_data.py#L1433-L1442
[ "def", "_get_plsr_dac_charge", "(", "self", ",", "plsr_dac_array", ",", "no_offset", "=", "False", ")", ":", "charge", "=", "np", ".", "zeros_like", "(", "self", ".", "c_low_mask", ",", "dtype", "=", "np", ".", "float16", ")", "# charge in electrons", "if", ...
5ad95bbcd41cd358825823fb78f396cfce23593e
train
DocManager._parse_fields
If Schema access, parse fields and build respective lists
mongo_connector/doc_managers/solr_doc_manager.py
def _parse_fields(self, result, field_name): """ If Schema access, parse fields and build respective lists """ field_list = [] for key, value in result.get('schema', {}).get(field_name, {}).items(): if key not in field_list: field_list.append(key) retu...
def _parse_fields(self, result, field_name): """ If Schema access, parse fields and build respective lists """ field_list = [] for key, value in result.get('schema', {}).get(field_name, {}).items(): if key not in field_list: field_list.append(key) retu...
[ "If", "Schema", "access", "parse", "fields", "and", "build", "respective", "lists" ]
yougov/solr-doc-manager
python
https://github.com/yougov/solr-doc-manager/blob/1978bf6f3387b1afd6dd6b41a1bbaea9932d60fd/mongo_connector/doc_managers/solr_doc_manager.py#L83-L90
[ "def", "_parse_fields", "(", "self", ",", "result", ",", "field_name", ")", ":", "field_list", "=", "[", "]", "for", "key", ",", "value", "in", "result", ".", "get", "(", "'schema'", ",", "{", "}", ")", ".", "get", "(", "field_name", ",", "{", "}",...
1978bf6f3387b1afd6dd6b41a1bbaea9932d60fd
train
DocManager._build_fields
Builds a list of valid fields
mongo_connector/doc_managers/solr_doc_manager.py
def _build_fields(self): """ Builds a list of valid fields """ declared_fields = self.solr._send_request('get', ADMIN_URL) result = decoder.decode(declared_fields) self.field_list = self._parse_fields(result, 'fields') # Build regular expressions to match dynamic fields....
def _build_fields(self): """ Builds a list of valid fields """ declared_fields = self.solr._send_request('get', ADMIN_URL) result = decoder.decode(declared_fields) self.field_list = self._parse_fields(result, 'fields') # Build regular expressions to match dynamic fields....
[ "Builds", "a", "list", "of", "valid", "fields" ]
yougov/solr-doc-manager
python
https://github.com/yougov/solr-doc-manager/blob/1978bf6f3387b1afd6dd6b41a1bbaea9932d60fd/mongo_connector/doc_managers/solr_doc_manager.py#L93-L110
[ "def", "_build_fields", "(", "self", ")", ":", "declared_fields", "=", "self", ".", "solr", ".", "_send_request", "(", "'get'", ",", "ADMIN_URL", ")", "result", "=", "decoder", ".", "decode", "(", "declared_fields", ")", "self", ".", "field_list", "=", "se...
1978bf6f3387b1afd6dd6b41a1bbaea9932d60fd
train
DocManager._clean_doc
Reformats the given document before insertion into Solr. This method reformats the document in the following ways: - removes extraneous fields that aren't defined in schema.xml - unwinds arrays in order to find and later flatten sub-documents - flattens the document so that there ...
mongo_connector/doc_managers/solr_doc_manager.py
def _clean_doc(self, doc, namespace, timestamp): """Reformats the given document before insertion into Solr. This method reformats the document in the following ways: - removes extraneous fields that aren't defined in schema.xml - unwinds arrays in order to find and later flatten su...
def _clean_doc(self, doc, namespace, timestamp): """Reformats the given document before insertion into Solr. This method reformats the document in the following ways: - removes extraneous fields that aren't defined in schema.xml - unwinds arrays in order to find and later flatten su...
[ "Reformats", "the", "given", "document", "before", "insertion", "into", "Solr", "." ]
yougov/solr-doc-manager
python
https://github.com/yougov/solr-doc-manager/blob/1978bf6f3387b1afd6dd6b41a1bbaea9932d60fd/mongo_connector/doc_managers/solr_doc_manager.py#L112-L165
[ "def", "_clean_doc", "(", "self", ",", "doc", ",", "namespace", ",", "timestamp", ")", ":", "# Translate the _id field to whatever unique key we're using.", "# _id may not exist in the doc, if we retrieved it from Solr", "# as part of update.", "if", "'_id'", "in", "doc", ":", ...
1978bf6f3387b1afd6dd6b41a1bbaea9932d60fd
train
DocManager.apply_update
Override DocManagerBase.apply_update to have flat documents.
mongo_connector/doc_managers/solr_doc_manager.py
def apply_update(self, doc, update_spec): """Override DocManagerBase.apply_update to have flat documents.""" # Replace a whole document if not '$set' in update_spec and not '$unset' in update_spec: # update_spec contains the new document. # Update the key in Solr based on...
def apply_update(self, doc, update_spec): """Override DocManagerBase.apply_update to have flat documents.""" # Replace a whole document if not '$set' in update_spec and not '$unset' in update_spec: # update_spec contains the new document. # Update the key in Solr based on...
[ "Override", "DocManagerBase", ".", "apply_update", "to", "have", "flat", "documents", "." ]
yougov/solr-doc-manager
python
https://github.com/yougov/solr-doc-manager/blob/1978bf6f3387b1afd6dd6b41a1bbaea9932d60fd/mongo_connector/doc_managers/solr_doc_manager.py#L195-L226
[ "def", "apply_update", "(", "self", ",", "doc", ",", "update_spec", ")", ":", "# Replace a whole document", "if", "not", "'$set'", "in", "update_spec", "and", "not", "'$unset'", "in", "update_spec", ":", "# update_spec contains the new document.", "# Update the key in S...
1978bf6f3387b1afd6dd6b41a1bbaea9932d60fd
train
DocManager.update
Apply updates given in update_spec to the document whose id matches that of doc.
mongo_connector/doc_managers/solr_doc_manager.py
def update(self, document_id, update_spec, namespace, timestamp): """Apply updates given in update_spec to the document whose id matches that of doc. """ # Commit outstanding changes so that the document to be updated is the # same version to which the changes apply. sel...
def update(self, document_id, update_spec, namespace, timestamp): """Apply updates given in update_spec to the document whose id matches that of doc. """ # Commit outstanding changes so that the document to be updated is the # same version to which the changes apply. sel...
[ "Apply", "updates", "given", "in", "update_spec", "to", "the", "document", "whose", "id", "matches", "that", "of", "doc", "." ]
yougov/solr-doc-manager
python
https://github.com/yougov/solr-doc-manager/blob/1978bf6f3387b1afd6dd6b41a1bbaea9932d60fd/mongo_connector/doc_managers/solr_doc_manager.py#L229-L258
[ "def", "update", "(", "self", ",", "document_id", ",", "update_spec", ",", "namespace", ",", "timestamp", ")", ":", "# Commit outstanding changes so that the document to be updated is the", "# same version to which the changes apply.", "self", ".", "commit", "(", ")", "# Ne...
1978bf6f3387b1afd6dd6b41a1bbaea9932d60fd
train
DocManager.upsert
Update or insert a document into Solr This method should call whatever add/insert/update method exists for the backend engine and add the document in there. The input will always be one mongo document, represented as a Python dictionary.
mongo_connector/doc_managers/solr_doc_manager.py
def upsert(self, doc, namespace, timestamp): """Update or insert a document into Solr This method should call whatever add/insert/update method exists for the backend engine and add the document in there. The input will always be one mongo document, represented as a Python dictionary. ...
def upsert(self, doc, namespace, timestamp): """Update or insert a document into Solr This method should call whatever add/insert/update method exists for the backend engine and add the document in there. The input will always be one mongo document, represented as a Python dictionary. ...
[ "Update", "or", "insert", "a", "document", "into", "Solr" ]
yougov/solr-doc-manager
python
https://github.com/yougov/solr-doc-manager/blob/1978bf6f3387b1afd6dd6b41a1bbaea9932d60fd/mongo_connector/doc_managers/solr_doc_manager.py#L261-L274
[ "def", "upsert", "(", "self", ",", "doc", ",", "namespace", ",", "timestamp", ")", ":", "if", "self", ".", "auto_commit_interval", "is", "not", "None", ":", "self", ".", "solr", ".", "add", "(", "[", "self", ".", "_clean_doc", "(", "doc", ",", "names...
1978bf6f3387b1afd6dd6b41a1bbaea9932d60fd
train
DocManager.bulk_upsert
Update or insert multiple documents into Solr docs may be any iterable
mongo_connector/doc_managers/solr_doc_manager.py
def bulk_upsert(self, docs, namespace, timestamp): """Update or insert multiple documents into Solr docs may be any iterable """ if self.auto_commit_interval is not None: add_kwargs = { "commit": (self.auto_commit_interval == 0), "commitWithin...
def bulk_upsert(self, docs, namespace, timestamp): """Update or insert multiple documents into Solr docs may be any iterable """ if self.auto_commit_interval is not None: add_kwargs = { "commit": (self.auto_commit_interval == 0), "commitWithin...
[ "Update", "or", "insert", "multiple", "documents", "into", "Solr" ]
yougov/solr-doc-manager
python
https://github.com/yougov/solr-doc-manager/blob/1978bf6f3387b1afd6dd6b41a1bbaea9932d60fd/mongo_connector/doc_managers/solr_doc_manager.py#L277-L298
[ "def", "bulk_upsert", "(", "self", ",", "docs", ",", "namespace", ",", "timestamp", ")", ":", "if", "self", ".", "auto_commit_interval", "is", "not", "None", ":", "add_kwargs", "=", "{", "\"commit\"", ":", "(", "self", ".", "auto_commit_interval", "==", "0...
1978bf6f3387b1afd6dd6b41a1bbaea9932d60fd
train
DocManager.remove
Removes documents from Solr The input is a python dictionary that represents a mongo document.
mongo_connector/doc_managers/solr_doc_manager.py
def remove(self, document_id, namespace, timestamp): """Removes documents from Solr The input is a python dictionary that represents a mongo document. """ self.solr.delete(id=u(document_id), commit=(self.auto_commit_interval == 0))
def remove(self, document_id, namespace, timestamp): """Removes documents from Solr The input is a python dictionary that represents a mongo document. """ self.solr.delete(id=u(document_id), commit=(self.auto_commit_interval == 0))
[ "Removes", "documents", "from", "Solr" ]
yougov/solr-doc-manager
python
https://github.com/yougov/solr-doc-manager/blob/1978bf6f3387b1afd6dd6b41a1bbaea9932d60fd/mongo_connector/doc_managers/solr_doc_manager.py#L320-L326
[ "def", "remove", "(", "self", ",", "document_id", ",", "namespace", ",", "timestamp", ")", ":", "self", ".", "solr", ".", "delete", "(", "id", "=", "u", "(", "document_id", ")", ",", "commit", "=", "(", "self", ".", "auto_commit_interval", "==", "0", ...
1978bf6f3387b1afd6dd6b41a1bbaea9932d60fd
train
DocManager._stream_search
Helper method for iterating over Solr search results.
mongo_connector/doc_managers/solr_doc_manager.py
def _stream_search(self, query): """Helper method for iterating over Solr search results.""" for doc in self.solr.search(query, rows=100000000): if self.unique_key != "_id": doc["_id"] = doc.pop(self.unique_key) yield doc
def _stream_search(self, query): """Helper method for iterating over Solr search results.""" for doc in self.solr.search(query, rows=100000000): if self.unique_key != "_id": doc["_id"] = doc.pop(self.unique_key) yield doc
[ "Helper", "method", "for", "iterating", "over", "Solr", "search", "results", "." ]
yougov/solr-doc-manager
python
https://github.com/yougov/solr-doc-manager/blob/1978bf6f3387b1afd6dd6b41a1bbaea9932d60fd/mongo_connector/doc_managers/solr_doc_manager.py#L329-L334
[ "def", "_stream_search", "(", "self", ",", "query", ")", ":", "for", "doc", "in", "self", ".", "solr", ".", "search", "(", "query", ",", "rows", "=", "100000000", ")", ":", "if", "self", ".", "unique_key", "!=", "\"_id\"", ":", "doc", "[", "\"_id\"",...
1978bf6f3387b1afd6dd6b41a1bbaea9932d60fd
train
DocManager.search
Called to query Solr for documents in a time range.
mongo_connector/doc_managers/solr_doc_manager.py
def search(self, start_ts, end_ts): """Called to query Solr for documents in a time range.""" query = '_ts: [%s TO %s]' % (start_ts, end_ts) return self._stream_search(query)
def search(self, start_ts, end_ts): """Called to query Solr for documents in a time range.""" query = '_ts: [%s TO %s]' % (start_ts, end_ts) return self._stream_search(query)
[ "Called", "to", "query", "Solr", "for", "documents", "in", "a", "time", "range", "." ]
yougov/solr-doc-manager
python
https://github.com/yougov/solr-doc-manager/blob/1978bf6f3387b1afd6dd6b41a1bbaea9932d60fd/mongo_connector/doc_managers/solr_doc_manager.py#L337-L340
[ "def", "search", "(", "self", ",", "start_ts", ",", "end_ts", ")", ":", "query", "=", "'_ts: [%s TO %s]'", "%", "(", "start_ts", ",", "end_ts", ")", "return", "self", ".", "_stream_search", "(", "query", ")" ]
1978bf6f3387b1afd6dd6b41a1bbaea9932d60fd
train
DocManager.get_last_doc
Returns the last document stored in the Solr engine.
mongo_connector/doc_managers/solr_doc_manager.py
def get_last_doc(self): """Returns the last document stored in the Solr engine. """ #search everything, sort by descending timestamp, return 1 row try: result = self.solr.search('*:*', sort='_ts desc', rows=1) except ValueError: return None for r ...
def get_last_doc(self): """Returns the last document stored in the Solr engine. """ #search everything, sort by descending timestamp, return 1 row try: result = self.solr.search('*:*', sort='_ts desc', rows=1) except ValueError: return None for r ...
[ "Returns", "the", "last", "document", "stored", "in", "the", "Solr", "engine", "." ]
yougov/solr-doc-manager
python
https://github.com/yougov/solr-doc-manager/blob/1978bf6f3387b1afd6dd6b41a1bbaea9932d60fd/mongo_connector/doc_managers/solr_doc_manager.py#L348-L359
[ "def", "get_last_doc", "(", "self", ")", ":", "#search everything, sort by descending timestamp, return 1 row", "try", ":", "result", "=", "self", ".", "solr", ".", "search", "(", "'*:*'", ",", "sort", "=", "'_ts desc'", ",", "rows", "=", "1", ")", "except", "...
1978bf6f3387b1afd6dd6b41a1bbaea9932d60fd
train
pbkdf2_single
Returns the result of the Password-Based Key Derivation Function 2 with a single iteration (i.e. count = 1). prf - a psuedorandom function See http://en.wikipedia.org/wiki/PBKDF2
pyscrypt/hash.py
def pbkdf2_single(password, salt, key_length, prf): '''Returns the result of the Password-Based Key Derivation Function 2 with a single iteration (i.e. count = 1). prf - a psuedorandom function See http://en.wikipedia.org/wiki/PBKDF2 ''' block_number = 0 result = b'' # The i...
def pbkdf2_single(password, salt, key_length, prf): '''Returns the result of the Password-Based Key Derivation Function 2 with a single iteration (i.e. count = 1). prf - a psuedorandom function See http://en.wikipedia.org/wiki/PBKDF2 ''' block_number = 0 result = b'' # The i...
[ "Returns", "the", "result", "of", "the", "Password", "-", "Based", "Key", "Derivation", "Function", "2", "with", "a", "single", "iteration", "(", "i", ".", "e", ".", "count", "=", "1", ")", "." ]
ricmoo/pyscrypt
python
https://github.com/ricmoo/pyscrypt/blob/131ca39acee4963afd704b4c4631497e4fe34c97/pyscrypt/hash.py#L56-L73
[ "def", "pbkdf2_single", "(", "password", ",", "salt", ",", "key_length", ",", "prf", ")", ":", "block_number", "=", "0", "result", "=", "b''", "# The iterations", "while", "len", "(", "result", ")", "<", "key_length", ":", "block_number", "+=", "1", "resul...
131ca39acee4963afd704b4c4631497e4fe34c97
train
salsa20_8
Salsa 20/8 stream cypher; Used by BlockMix. See http://en.wikipedia.org/wiki/Salsa20
pyscrypt/hash.py
def salsa20_8(B): '''Salsa 20/8 stream cypher; Used by BlockMix. See http://en.wikipedia.org/wiki/Salsa20''' # Create a working copy x = B[:] # Expanded form of this code. The expansion is significantly faster but # this is much easier to understand # ROUNDS = ( # (4, 0, 12, 7), (8, ...
def salsa20_8(B): '''Salsa 20/8 stream cypher; Used by BlockMix. See http://en.wikipedia.org/wiki/Salsa20''' # Create a working copy x = B[:] # Expanded form of this code. The expansion is significantly faster but # this is much easier to understand # ROUNDS = ( # (4, 0, 12, 7), (8, ...
[ "Salsa", "20", "/", "8", "stream", "cypher", ";", "Used", "by", "BlockMix", ".", "See", "http", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", "/", "Salsa20" ]
ricmoo/pyscrypt
python
https://github.com/ricmoo/pyscrypt/blob/131ca39acee4963afd704b4c4631497e4fe34c97/pyscrypt/hash.py#L76-L167
[ "def", "salsa20_8", "(", "B", ")", ":", "# Create a working copy", "x", "=", "B", "[", ":", "]", "# Expanded form of this code. The expansion is significantly faster but", "# this is much easier to understand", "# ROUNDS = (", "# (4, 0, 12, 7), (8, 4, 0, 9), (12, 8, 4, 13), ...
131ca39acee4963afd704b4c4631497e4fe34c97
train
blockmix_salsa8
Blockmix; Used by SMix.
pyscrypt/hash.py
def blockmix_salsa8(BY, Yi, r): '''Blockmix; Used by SMix.''' start = (2 * r - 1) * 16 X = BY[start:start + 16] # BlockMix - 1 for i in xrange(0, 2 * r): # BlockMix - 2 for xi in xrange(0, 16): ...
def blockmix_salsa8(BY, Yi, r): '''Blockmix; Used by SMix.''' start = (2 * r - 1) * 16 X = BY[start:start + 16] # BlockMix - 1 for i in xrange(0, 2 * r): # BlockMix - 2 for xi in xrange(0, 16): ...
[ "Blockmix", ";", "Used", "by", "SMix", "." ]
ricmoo/pyscrypt
python
https://github.com/ricmoo/pyscrypt/blob/131ca39acee4963afd704b4c4631497e4fe34c97/pyscrypt/hash.py#L170-L193
[ "def", "blockmix_salsa8", "(", "BY", ",", "Yi", ",", "r", ")", ":", "start", "=", "(", "2", "*", "r", "-", "1", ")", "*", "16", "X", "=", "BY", "[", "start", ":", "start", "+", "16", "]", "# BlockMix - 1", "for", "i", "in", "xrange", "(", "0"...
131ca39acee4963afd704b4c4631497e4fe34c97
train
smix
SMix; a specific case of ROMix. See scrypt.pdf in the links above.
pyscrypt/hash.py
def smix(B, Bi, r, N, V, X): '''SMix; a specific case of ROMix. See scrypt.pdf in the links above.''' X[:32 * r] = B[Bi:Bi + 32 * r] # ROMix - 1 for i in xrange(0, N): # ROMix - 2 aod = i * 32 * r # ROMix - 3 V[aod:aod...
def smix(B, Bi, r, N, V, X): '''SMix; a specific case of ROMix. See scrypt.pdf in the links above.''' X[:32 * r] = B[Bi:Bi + 32 * r] # ROMix - 1 for i in xrange(0, N): # ROMix - 2 aod = i * 32 * r # ROMix - 3 V[aod:aod...
[ "SMix", ";", "a", "specific", "case", "of", "ROMix", ".", "See", "scrypt", ".", "pdf", "in", "the", "links", "above", "." ]
ricmoo/pyscrypt
python
https://github.com/ricmoo/pyscrypt/blob/131ca39acee4963afd704b4c4631497e4fe34c97/pyscrypt/hash.py#L196-L213
[ "def", "smix", "(", "B", ",", "Bi", ",", "r", ",", "N", ",", "V", ",", "X", ")", ":", "X", "[", ":", "32", "*", "r", "]", "=", "B", "[", "Bi", ":", "Bi", "+", "32", "*", "r", "]", "# ROMix - 1", "for", "i", "in", "xrange", "(", "0", "...
131ca39acee4963afd704b4c4631497e4fe34c97
train
hash
Returns the result of the scrypt password-based key derivation function. Constraints: r * p < (2 ** 30) dkLen <= (((2 ** 32) - 1) * 32 N must be a power of 2 greater than 1 (eg. 2, 4, 8, 16, 32...) N, r, p must be positive
pyscrypt/hash.py
def hash(password, salt, N, r, p, dkLen): """Returns the result of the scrypt password-based key derivation function. Constraints: r * p < (2 ** 30) dkLen <= (((2 ** 32) - 1) * 32 N must be a power of 2 greater than 1 (eg. 2, 4, 8, 16, 32...) N, r, p must be positive ...
def hash(password, salt, N, r, p, dkLen): """Returns the result of the scrypt password-based key derivation function. Constraints: r * p < (2 ** 30) dkLen <= (((2 ** 32) - 1) * 32 N must be a power of 2 greater than 1 (eg. 2, 4, 8, 16, 32...) N, r, p must be positive ...
[ "Returns", "the", "result", "of", "the", "scrypt", "password", "-", "based", "key", "derivation", "function", "." ]
ricmoo/pyscrypt
python
https://github.com/ricmoo/pyscrypt/blob/131ca39acee4963afd704b4c4631497e4fe34c97/pyscrypt/hash.py#L217-L258
[ "def", "hash", "(", "password", ",", "salt", ",", "N", ",", "r", ",", "p", ",", "dkLen", ")", ":", "# This only matters to Python 3", "if", "not", "check_bytes", "(", "password", ")", ":", "raise", "ValueError", "(", "'password must be a byte array'", ")", "...
131ca39acee4963afd704b4c4631497e4fe34c97
train
ScryptFile._load_get_attr
Return an internal attribute after ensuring the headers is loaded if necessary.
pyscrypt/file.py
def _load_get_attr(self, name): 'Return an internal attribute after ensuring the headers is loaded if necessary.' if self._mode in _allowed_read and self._N is None: self._read_header() return getattr(self, name)
def _load_get_attr(self, name): 'Return an internal attribute after ensuring the headers is loaded if necessary.' if self._mode in _allowed_read and self._N is None: self._read_header() return getattr(self, name)
[ "Return", "an", "internal", "attribute", "after", "ensuring", "the", "headers", "is", "loaded", "if", "necessary", "." ]
ricmoo/pyscrypt
python
https://github.com/ricmoo/pyscrypt/blob/131ca39acee4963afd704b4c4631497e4fe34c97/pyscrypt/file.py#L190-L194
[ "def", "_load_get_attr", "(", "self", ",", "name", ")", ":", "if", "self", ".", "_mode", "in", "_allowed_read", "and", "self", ".", "_N", "is", "None", ":", "self", ".", "_read_header", "(", ")", "return", "getattr", "(", "self", ",", "name", ")" ]
131ca39acee4963afd704b4c4631497e4fe34c97
train
ScryptFile.close
Close the underlying file. Sets data attribute .closed to True. A closed file cannot be used for further I/O operations. close() may be called more than once without error. Some kinds of file objects (for example, opened by popen()) may return an exit status upon closing.
pyscrypt/file.py
def close(self): '''Close the underlying file. Sets data attribute .closed to True. A closed file cannot be used for further I/O operations. close() may be called more than once without error. Some kinds of file objects (for example, opened by popen()) may return an exit status ...
def close(self): '''Close the underlying file. Sets data attribute .closed to True. A closed file cannot be used for further I/O operations. close() may be called more than once without error. Some kinds of file objects (for example, opened by popen()) may return an exit status ...
[ "Close", "the", "underlying", "file", "." ]
ricmoo/pyscrypt
python
https://github.com/ricmoo/pyscrypt/blob/131ca39acee4963afd704b4c4631497e4fe34c97/pyscrypt/file.py#L241-L254
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "_mode", "in", "_allowed_write", "and", "self", ".", "_valid", "is", "None", ":", "self", ".", "_finalize_write", "(", ")", "result", "=", "self", ".", "_fp", ".", "close", "(", ")", "self", ...
131ca39acee4963afd704b4c4631497e4fe34c97
train
ScryptFile.verify_file
Returns whether a scrypt encrypted file is valid.
pyscrypt/file.py
def verify_file(fp, password): 'Returns whether a scrypt encrypted file is valid.' sf = ScryptFile(fp = fp, password = password) for line in sf: pass sf.close() return sf.valid
def verify_file(fp, password): 'Returns whether a scrypt encrypted file is valid.' sf = ScryptFile(fp = fp, password = password) for line in sf: pass sf.close() return sf.valid
[ "Returns", "whether", "a", "scrypt", "encrypted", "file", "is", "valid", "." ]
ricmoo/pyscrypt
python
https://github.com/ricmoo/pyscrypt/blob/131ca39acee4963afd704b4c4631497e4fe34c97/pyscrypt/file.py#L267-L273
[ "def", "verify_file", "(", "fp", ",", "password", ")", ":", "sf", "=", "ScryptFile", "(", "fp", "=", "fp", ",", "password", "=", "password", ")", "for", "line", "in", "sf", ":", "pass", "sf", ".", "close", "(", ")", "return", "sf", ".", "valid" ]
131ca39acee4963afd704b4c4631497e4fe34c97
train
ScryptFile.readline
Next line from the decrypted file, as a string. Retain newline. A non-negative size argument limits the maximum number of bytes to return (an incomplete line may be returned then). Return an empty string at EOF.
pyscrypt/file.py
def readline(self, size = None): '''Next line from the decrypted file, as a string. Retain newline. A non-negative size argument limits the maximum number of bytes to return (an incomplete line may be returned then). Return an empty string at EOF.''' if self.closed: raise Valu...
def readline(self, size = None): '''Next line from the decrypted file, as a string. Retain newline. A non-negative size argument limits the maximum number of bytes to return (an incomplete line may be returned then). Return an empty string at EOF.''' if self.closed: raise Valu...
[ "Next", "line", "from", "the", "decrypted", "file", "as", "a", "string", "." ]
ricmoo/pyscrypt
python
https://github.com/ricmoo/pyscrypt/blob/131ca39acee4963afd704b4c4631497e4fe34c97/pyscrypt/file.py#L276-L291
[ "def", "readline", "(", "self", ",", "size", "=", "None", ")", ":", "if", "self", ".", "closed", ":", "raise", "ValueError", "(", "'file closed'", ")", "if", "self", ".", "_mode", "in", "_allowed_write", ":", "raise", "Exception", "(", "'file opened for wr...
131ca39acee4963afd704b4c4631497e4fe34c97
train
ScryptFile._read_header
Read and parse the header and calculate derived keys.
pyscrypt/file.py
def _read_header(self): '''Read and parse the header and calculate derived keys.''' try: # Read the entire header header = self._fp.read(96) if len(header) != 96: raise InvalidScryptFileFormat("Incomplete header") # Magic number ...
def _read_header(self): '''Read and parse the header and calculate derived keys.''' try: # Read the entire header header = self._fp.read(96) if len(header) != 96: raise InvalidScryptFileFormat("Incomplete header") # Magic number ...
[ "Read", "and", "parse", "the", "header", "and", "calculate", "derived", "keys", "." ]
ricmoo/pyscrypt
python
https://github.com/ricmoo/pyscrypt/blob/131ca39acee4963afd704b4c4631497e4fe34c97/pyscrypt/file.py#L308-L358
[ "def", "_read_header", "(", "self", ")", ":", "try", ":", "# Read the entire header", "header", "=", "self", ".", "_fp", ".", "read", "(", "96", ")", "if", "len", "(", "header", ")", "!=", "96", ":", "raise", "InvalidScryptFileFormat", "(", "\"Incomplete h...
131ca39acee4963afd704b4c4631497e4fe34c97
train
ScryptFile.read
Read at most size bytes, returned as a string. If the size argument is negative or omitted, read until EOF is reached. Notice that when in non-blocking mode, less data than what was requested may be returned, even if no size parameter was given.
pyscrypt/file.py
def read(self, size = None): '''Read at most size bytes, returned as a string. If the size argument is negative or omitted, read until EOF is reached. Notice that when in non-blocking mode, less data than what was requested may be returned, even if no size parameter was given.''' ...
def read(self, size = None): '''Read at most size bytes, returned as a string. If the size argument is negative or omitted, read until EOF is reached. Notice that when in non-blocking mode, less data than what was requested may be returned, even if no size parameter was given.''' ...
[ "Read", "at", "most", "size", "bytes", "returned", "as", "a", "string", "." ]
ricmoo/pyscrypt
python
https://github.com/ricmoo/pyscrypt/blob/131ca39acee4963afd704b4c4631497e4fe34c97/pyscrypt/file.py#L366-L427
[ "def", "read", "(", "self", ",", "size", "=", "None", ")", ":", "if", "self", ".", "closed", ":", "raise", "ValueError", "(", "'File closed'", ")", "if", "self", ".", "_mode", "in", "_allowed_write", ":", "raise", "Exception", "(", "'File opened for write ...
131ca39acee4963afd704b4c4631497e4fe34c97
train
ScryptFile._write_header
Writes the header to the underlying file object.
pyscrypt/file.py
def _write_header(self): 'Writes the header to the underlying file object.' header = b'scrypt' + CHR0 + struct.pack('>BII', int(math.log(self.N, 2)), self.r, self.p) + self.salt # Add the header checksum to the header checksum = hashlib.sha256(header).digest()[:16] header += ch...
def _write_header(self): 'Writes the header to the underlying file object.' header = b'scrypt' + CHR0 + struct.pack('>BII', int(math.log(self.N, 2)), self.r, self.p) + self.salt # Add the header checksum to the header checksum = hashlib.sha256(header).digest()[:16] header += ch...
[ "Writes", "the", "header", "to", "the", "underlying", "file", "object", "." ]
ricmoo/pyscrypt
python
https://github.com/ricmoo/pyscrypt/blob/131ca39acee4963afd704b4c4631497e4fe34c97/pyscrypt/file.py#L444-L466
[ "def", "_write_header", "(", "self", ")", ":", "header", "=", "b'scrypt'", "+", "CHR0", "+", "struct", ".", "pack", "(", "'>BII'", ",", "int", "(", "math", ".", "log", "(", "self", ".", "N", ",", "2", ")", ")", ",", "self", ".", "r", ",", "self...
131ca39acee4963afd704b4c4631497e4fe34c97
train
ScryptFile._finalize_write
Finishes any unencrypted bytes and writes the final checksum.
pyscrypt/file.py
def _finalize_write(self): 'Finishes any unencrypted bytes and writes the final checksum.' # Make sure we have written the header if not self._done_header: self._write_header() # Write the remaining decrypted part to disk block = self._crypto.encrypt(self._decrypted...
def _finalize_write(self): 'Finishes any unencrypted bytes and writes the final checksum.' # Make sure we have written the header if not self._done_header: self._write_header() # Write the remaining decrypted part to disk block = self._crypto.encrypt(self._decrypted...
[ "Finishes", "any", "unencrypted", "bytes", "and", "writes", "the", "final", "checksum", "." ]
ricmoo/pyscrypt
python
https://github.com/ricmoo/pyscrypt/blob/131ca39acee4963afd704b4c4631497e4fe34c97/pyscrypt/file.py#L468-L483
[ "def", "_finalize_write", "(", "self", ")", ":", "# Make sure we have written the header", "if", "not", "self", ".", "_done_header", ":", "self", ".", "_write_header", "(", ")", "# Write the remaining decrypted part to disk", "block", "=", "self", ".", "_crypto", ".",...
131ca39acee4963afd704b4c4631497e4fe34c97
train
ScryptFile.write
Write string str to the underlying file. Note that due to buffering, flush() or close() may be needed before the file on disk reflects the data written.
pyscrypt/file.py
def write(self, str): '''Write string str to the underlying file. Note that due to buffering, flush() or close() may be needed before the file on disk reflects the data written.''' if self.closed: raise ValueError('File closed') if self._mode in _allowed_read: raise...
def write(self, str): '''Write string str to the underlying file. Note that due to buffering, flush() or close() may be needed before the file on disk reflects the data written.''' if self.closed: raise ValueError('File closed') if self._mode in _allowed_read: raise...
[ "Write", "string", "str", "to", "the", "underlying", "file", "." ]
ricmoo/pyscrypt
python
https://github.com/ricmoo/pyscrypt/blob/131ca39acee4963afd704b4c4631497e4fe34c97/pyscrypt/file.py#L485-L504
[ "def", "write", "(", "self", ",", "str", ")", ":", "if", "self", ".", "closed", ":", "raise", "ValueError", "(", "'File closed'", ")", "if", "self", ".", "_mode", "in", "_allowed_read", ":", "raise", "Exception", "(", "'File opened for read only'", ")", "i...
131ca39acee4963afd704b4c4631497e4fe34c97
train
get_logger
Return a logger with the specified name, creating it if necessary.
logone/__init__.py
def get_logger(logger_name): """ Return a logger with the specified name, creating it if necessary. """ # Use default global logger if logger_name is None: return __instance assert isinstance(logger_name, str), 'Logger name must be a string!' with __lock: if logger_name in...
def get_logger(logger_name): """ Return a logger with the specified name, creating it if necessary. """ # Use default global logger if logger_name is None: return __instance assert isinstance(logger_name, str), 'Logger name must be a string!' with __lock: if logger_name in...
[ "Return", "a", "logger", "with", "the", "specified", "name", "creating", "it", "if", "necessary", "." ]
dnanhkhoa/logone
python
https://github.com/dnanhkhoa/logone/blob/7345a59e54ae59418a2c35ae7e7af5b2784fa1b5/logone/__init__.py#L59-L76
[ "def", "get_logger", "(", "logger_name", ")", ":", "# Use default global logger", "if", "logger_name", "is", "None", ":", "return", "__instance", "assert", "isinstance", "(", "logger_name", ",", "str", ")", ",", "'Logger name must be a string!'", "with", "__lock", "...
7345a59e54ae59418a2c35ae7e7af5b2784fa1b5
train
removeFile
remove a file
hallie/modules/files.py
def removeFile(file): """remove a file""" if "y" in speech.question("Are you sure you want to remove " + file + "? (Y/N): "): speech.speak("Removing " + file + " with the 'rm' command.") subprocess.call(["rm", "-r", file]) else: speech.speak("Okay, I won't remove " + file + ".")
def removeFile(file): """remove a file""" if "y" in speech.question("Are you sure you want to remove " + file + "? (Y/N): "): speech.speak("Removing " + file + " with the 'rm' command.") subprocess.call(["rm", "-r", file]) else: speech.speak("Okay, I won't remove " + file + ".")
[ "remove", "a", "file" ]
mikemelch/hallie
python
https://github.com/mikemelch/hallie/blob/a6dbb691145a85b776a1919e4c7930e0ae598437/hallie/modules/files.py#L19-L25
[ "def", "removeFile", "(", "file", ")", ":", "if", "\"y\"", "in", "speech", ".", "question", "(", "\"Are you sure you want to remove \"", "+", "file", "+", "\"? (Y/N): \"", ")", ":", "speech", ".", "speak", "(", "\"Removing \"", "+", "file", "+", "\" with the '...
a6dbb691145a85b776a1919e4c7930e0ae598437
train
copy
copy file or directory at a given location; can be pasted later
hallie/modules/files.py
def copy(location): """copy file or directory at a given location; can be pasted later""" copyData = settings.getDataFile() copyFileLocation = os.path.abspath(location) copy = {"copyLocation": copyFileLocation} dataFile = open(copyData, "wb") pickle.dump(copy, dataFile) speech.speak(location + " copied successfu...
def copy(location): """copy file or directory at a given location; can be pasted later""" copyData = settings.getDataFile() copyFileLocation = os.path.abspath(location) copy = {"copyLocation": copyFileLocation} dataFile = open(copyData, "wb") pickle.dump(copy, dataFile) speech.speak(location + " copied successfu...
[ "copy", "file", "or", "directory", "at", "a", "given", "location", ";", "can", "be", "pasted", "later" ]
mikemelch/hallie
python
https://github.com/mikemelch/hallie/blob/a6dbb691145a85b776a1919e4c7930e0ae598437/hallie/modules/files.py#L42-L50
[ "def", "copy", "(", "location", ")", ":", "copyData", "=", "settings", ".", "getDataFile", "(", ")", "copyFileLocation", "=", "os", ".", "path", ".", "abspath", "(", "location", ")", "copy", "=", "{", "\"copyLocation\"", ":", "copyFileLocation", "}", "data...
a6dbb691145a85b776a1919e4c7930e0ae598437
train
paste
paste a file or directory that has been previously copied
hallie/modules/files.py
def paste(location): """paste a file or directory that has been previously copied""" copyData = settings.getDataFile() if not location: location = "." try: data = pickle.load(open(copyData, "rb")) speech.speak("Pasting " + data["copyLocation"] + " to current directory.") except: speech.fail("It doesn't loo...
def paste(location): """paste a file or directory that has been previously copied""" copyData = settings.getDataFile() if not location: location = "." try: data = pickle.load(open(copyData, "rb")) speech.speak("Pasting " + data["copyLocation"] + " to current directory.") except: speech.fail("It doesn't loo...
[ "paste", "a", "file", "or", "directory", "that", "has", "been", "previously", "copied" ]
mikemelch/hallie
python
https://github.com/mikemelch/hallie/blob/a6dbb691145a85b776a1919e4c7930e0ae598437/hallie/modules/files.py#L53-L67
[ "def", "paste", "(", "location", ")", ":", "copyData", "=", "settings", ".", "getDataFile", "(", ")", "if", "not", "location", ":", "location", "=", "\".\"", "try", ":", "data", "=", "pickle", ".", "load", "(", "open", "(", "copyData", ",", "\"rb\"", ...
a6dbb691145a85b776a1919e4c7930e0ae598437
train
add_zfs_apt_repository
adds the ZFS repository
bookshelf/api_v2/pkg.py
def add_zfs_apt_repository(): """ adds the ZFS repository """ with settings(hide('warnings', 'running', 'stdout'), warn_only=False, capture=True): sudo('DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get update') install_ubuntu_development_tools() apt_install(packages=['so...
def add_zfs_apt_repository(): """ adds the ZFS repository """ with settings(hide('warnings', 'running', 'stdout'), warn_only=False, capture=True): sudo('DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get update') install_ubuntu_development_tools() apt_install(packages=['so...
[ "adds", "the", "ZFS", "repository" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/pkg.py#L24-L36
[ "def", "add_zfs_apt_repository", "(", ")", ":", "with", "settings", "(", "hide", "(", "'warnings'", ",", "'running'", ",", "'stdout'", ")", ",", "warn_only", "=", "False", ",", "capture", "=", "True", ")", ":", "sudo", "(", "'DEBIAN_FRONTEND=noninteractive /us...
a6770678e735de95b194f6e6989223970db5f654
train
apt_install
installs a apt package
bookshelf/api_v2/pkg.py
def apt_install(**kwargs): """ installs a apt package """ for pkg in list(kwargs['packages']): if is_package_installed(distribution='ubuntu', pkg=pkg) is False: sudo("DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get install -y %s" % pkg) # if we didn't abort above, we shou...
def apt_install(**kwargs): """ installs a apt package """ for pkg in list(kwargs['packages']): if is_package_installed(distribution='ubuntu', pkg=pkg) is False: sudo("DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get install -y %s" % pkg) # if we didn't abort above, we shou...
[ "installs", "a", "apt", "package" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/pkg.py#L48-L56
[ "def", "apt_install", "(", "*", "*", "kwargs", ")", ":", "for", "pkg", "in", "list", "(", "kwargs", "[", "'packages'", "]", ")", ":", "if", "is_package_installed", "(", "distribution", "=", "'ubuntu'", ",", "pkg", "=", "pkg", ")", "is", "False", ":", ...
a6770678e735de95b194f6e6989223970db5f654
train
apt_install_from_url
installs a pkg from a url p pkg_name: the name of the package to install p url: the full URL for the rpm package
bookshelf/api_v2/pkg.py
def apt_install_from_url(pkg_name, url, log=False): """ installs a pkg from a url p pkg_name: the name of the package to install p url: the full URL for the rpm package """ if is_package_installed(distribution='ubuntu', pkg=pkg_name) is False: if log: log_green( ...
def apt_install_from_url(pkg_name, url, log=False): """ installs a pkg from a url p pkg_name: the name of the package to install p url: the full URL for the rpm package """ if is_package_installed(distribution='ubuntu', pkg=pkg_name) is False: if log: log_green( ...
[ "installs", "a", "pkg", "from", "a", "url", "p", "pkg_name", ":", "the", "name", "of", "the", "package", "to", "install", "p", "url", ":", "the", "full", "URL", "for", "the", "rpm", "package" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/pkg.py#L59-L76
[ "def", "apt_install_from_url", "(", "pkg_name", ",", "url", ",", "log", "=", "False", ")", ":", "if", "is_package_installed", "(", "distribution", "=", "'ubuntu'", ",", "pkg", "=", "pkg_name", ")", "is", "False", ":", "if", "log", ":", "log_green", "(", ...
a6770678e735de95b194f6e6989223970db5f654
train
apt_add_key
trust a new PGP key related to a apt-repository
bookshelf/api_v2/pkg.py
def apt_add_key(keyid, keyserver='keyserver.ubuntu.com', log=False): """ trust a new PGP key related to a apt-repository """ if log: log_green( 'trusting keyid %s from %s' % (keyid, keyserver) ) with settings(hide('warnings', 'running', 'stdout')): sudo('apt-key adv --key...
def apt_add_key(keyid, keyserver='keyserver.ubuntu.com', log=False): """ trust a new PGP key related to a apt-repository """ if log: log_green( 'trusting keyid %s from %s' % (keyid, keyserver) ) with settings(hide('warnings', 'running', 'stdout')): sudo('apt-key adv --key...
[ "trust", "a", "new", "PGP", "key", "related", "to", "a", "apt", "-", "repository" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/pkg.py#L96-L104
[ "def", "apt_add_key", "(", "keyid", ",", "keyserver", "=", "'keyserver.ubuntu.com'", ",", "log", "=", "False", ")", ":", "if", "log", ":", "log_green", "(", "'trusting keyid %s from %s'", "%", "(", "keyid", ",", "keyserver", ")", ")", "with", "settings", "("...
a6770678e735de95b194f6e6989223970db5f654
train
enable_apt_repositories
adds an apt repository
bookshelf/api_v2/pkg.py
def enable_apt_repositories(prefix, url, version, repositories): """ adds an apt repository """ with settings(hide('warnings', 'running', 'stdout'), warn_only=False, capture=True): sudo('apt-add-repository "%s %s %s %s"' % (prefix, url...
def enable_apt_repositories(prefix, url, version, repositories): """ adds an apt repository """ with settings(hide('warnings', 'running', 'stdout'), warn_only=False, capture=True): sudo('apt-add-repository "%s %s %s %s"' % (prefix, url...
[ "adds", "an", "apt", "repository" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/pkg.py#L107-L121
[ "def", "enable_apt_repositories", "(", "prefix", ",", "url", ",", "version", ",", "repositories", ")", ":", "with", "settings", "(", "hide", "(", "'warnings'", ",", "'running'", ",", "'stdout'", ")", ",", "warn_only", "=", "False", ",", "capture", "=", "Tr...
a6770678e735de95b194f6e6989223970db5f654
train
install_gem
install a particular gem
bookshelf/api_v2/pkg.py
def install_gem(gem): """ install a particular gem """ with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=False, capture=True): # convert 0 into True, any errors will always raise an exception return not bool( run("gem install %s --no-rdoc --no...
def install_gem(gem): """ install a particular gem """ with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=False, capture=True): # convert 0 into True, any errors will always raise an exception return not bool( run("gem install %s --no-rdoc --no...
[ "install", "a", "particular", "gem" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/pkg.py#L124-L130
[ "def", "install_gem", "(", "gem", ")", ":", "with", "settings", "(", "hide", "(", "'warnings'", ",", "'running'", ",", "'stdout'", ",", "'stderr'", ")", ",", "warn_only", "=", "False", ",", "capture", "=", "True", ")", ":", "# convert 0 into True, any errors...
a6770678e735de95b194f6e6989223970db5f654
train
install_python_module_locally
instals a python module using pip
bookshelf/api_v2/pkg.py
def install_python_module_locally(name): """ instals a python module using pip """ with settings(hide('everything'), warn_only=False, capture=True): # convert 0 into True, any errors will always raise an exception print(not bool(local('pip --quiet install %s' % name).return_cod...
def install_python_module_locally(name): """ instals a python module using pip """ with settings(hide('everything'), warn_only=False, capture=True): # convert 0 into True, any errors will always raise an exception print(not bool(local('pip --quiet install %s' % name).return_cod...
[ "instals", "a", "python", "module", "using", "pip" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/pkg.py#L143-L150
[ "def", "install_python_module_locally", "(", "name", ")", ":", "with", "settings", "(", "hide", "(", "'everything'", ")", ",", "warn_only", "=", "False", ",", "capture", "=", "True", ")", ":", "# convert 0 into True, any errors will always raise an exception", "print"...
a6770678e735de95b194f6e6989223970db5f654
train
is_package_installed
checks if a particular package is installed
bookshelf/api_v2/pkg.py
def is_package_installed(distribution, pkg): """ checks if a particular package is installed """ if ('centos' in distribution or 'el' in distribution or 'redhat' in distribution): return(is_rpm_package_installed(pkg)) if ('ubuntu' in distribution or 'debian' in d...
def is_package_installed(distribution, pkg): """ checks if a particular package is installed """ if ('centos' in distribution or 'el' in distribution or 'redhat' in distribution): return(is_rpm_package_installed(pkg)) if ('ubuntu' in distribution or 'debian' in d...
[ "checks", "if", "a", "particular", "package", "is", "installed" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/pkg.py#L181-L190
[ "def", "is_package_installed", "(", "distribution", ",", "pkg", ")", ":", "if", "(", "'centos'", "in", "distribution", "or", "'el'", "in", "distribution", "or", "'redhat'", "in", "distribution", ")", ":", "return", "(", "is_rpm_package_installed", "(", "pkg", ...
a6770678e735de95b194f6e6989223970db5f654
train
is_rpm_package_installed
checks if a particular rpm package is installed
bookshelf/api_v2/pkg.py
def is_rpm_package_installed(pkg): """ checks if a particular rpm package is installed """ with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=True, capture=True): result = sudo("rpm -q %s" % pkg) if result.return_code == 0: return True ...
def is_rpm_package_installed(pkg): """ checks if a particular rpm package is installed """ with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=True, capture=True): result = sudo("rpm -q %s" % pkg) if result.return_code == 0: return True ...
[ "checks", "if", "a", "particular", "rpm", "package", "is", "installed" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/pkg.py#L193-L206
[ "def", "is_rpm_package_installed", "(", "pkg", ")", ":", "with", "settings", "(", "hide", "(", "'warnings'", ",", "'running'", ",", "'stdout'", ",", "'stderr'", ")", ",", "warn_only", "=", "True", ",", "capture", "=", "True", ")", ":", "result", "=", "su...
a6770678e735de95b194f6e6989223970db5f654
train
yum_install
installs a yum package
bookshelf/api_v2/pkg.py
def yum_install(**kwargs): """ installs a yum package """ if 'repo' in kwargs: repo = kwargs['repo'] for pkg in list(kwargs['packages']): if is_package_installed(distribution='el', pkg=pkg) is False: if 'repo' in locals(): log_green( ...
def yum_install(**kwargs): """ installs a yum package """ if 'repo' in kwargs: repo = kwargs['repo'] for pkg in list(kwargs['packages']): if is_package_installed(distribution='el', pkg=pkg) is False: if 'repo' in locals(): log_green( ...
[ "installs", "a", "yum", "package" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/pkg.py#L209-L224
[ "def", "yum_install", "(", "*", "*", "kwargs", ")", ":", "if", "'repo'", "in", "kwargs", ":", "repo", "=", "kwargs", "[", "'repo'", "]", "for", "pkg", "in", "list", "(", "kwargs", "[", "'packages'", "]", ")", ":", "if", "is_package_installed", "(", "...
a6770678e735de95b194f6e6989223970db5f654
train
yum_group_install
instals a yum group
bookshelf/api_v2/pkg.py
def yum_group_install(**kwargs): """ instals a yum group """ for grp in list(kwargs['groups']): log_green("installing %s ..." % grp) if 'repo' in kwargs: repo = kwargs['repo'] sudo("yum groupinstall -y --quiet " "--enablerepo=%s '%s'" % (repo, grp)) ...
def yum_group_install(**kwargs): """ instals a yum group """ for grp in list(kwargs['groups']): log_green("installing %s ..." % grp) if 'repo' in kwargs: repo = kwargs['repo'] sudo("yum groupinstall -y --quiet " "--enablerepo=%s '%s'" % (repo, grp)) ...
[ "instals", "a", "yum", "group" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/pkg.py#L227-L238
[ "def", "yum_group_install", "(", "*", "*", "kwargs", ")", ":", "for", "grp", "in", "list", "(", "kwargs", "[", "'groups'", "]", ")", ":", "log_green", "(", "\"installing %s ...\"", "%", "grp", ")", "if", "'repo'", "in", "kwargs", ":", "repo", "=", "kwa...
a6770678e735de95b194f6e6989223970db5f654
train
yum_install_from_url
installs a pkg from a url p pkg_name: the name of the package to install p url: the full URL for the rpm package
bookshelf/api_v2/pkg.py
def yum_install_from_url(pkg_name, url): """ installs a pkg from a url p pkg_name: the name of the package to install p url: the full URL for the rpm package """ if is_package_installed(distribution='el', pkg=pkg_name) is False: log_green( "installing %s from %s" % (pkg_n...
def yum_install_from_url(pkg_name, url): """ installs a pkg from a url p pkg_name: the name of the package to install p url: the full URL for the rpm package """ if is_package_installed(distribution='el', pkg=pkg_name) is False: log_green( "installing %s from %s" % (pkg_n...
[ "installs", "a", "pkg", "from", "a", "url", "p", "pkg_name", ":", "the", "name", "of", "the", "package", "to", "install", "p", "url", ":", "the", "full", "URL", "for", "the", "rpm", "package" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/pkg.py#L241-L259
[ "def", "yum_install_from_url", "(", "pkg_name", ",", "url", ")", ":", "if", "is_package_installed", "(", "distribution", "=", "'el'", ",", "pkg", "=", "pkg_name", ")", "is", "False", ":", "log_green", "(", "\"installing %s from %s\"", "%", "(", "pkg_name", ","...
a6770678e735de95b194f6e6989223970db5f654
train
abstractInterface.recherche
abstractSearch in fields of collection and reset rendering. Returns number of results. If in_all is True, call get_all before doing the search.
pyDLib/Core/controller.py
def recherche(self, pattern, entete, in_all=False): """abstractSearch in fields of collection and reset rendering. Returns number of results. If in_all is True, call get_all before doing the search.""" if in_all: self.collection = self.get_all() self.collection.recher...
def recherche(self, pattern, entete, in_all=False): """abstractSearch in fields of collection and reset rendering. Returns number of results. If in_all is True, call get_all before doing the search.""" if in_all: self.collection = self.get_all() self.collection.recher...
[ "abstractSearch", "in", "fields", "of", "collection", "and", "reset", "rendering", ".", "Returns", "number", "of", "results", ".", "If", "in_all", "is", "True", "call", "get_all", "before", "doing", "the", "search", "." ]
benoitkugler/abstractDataLibrary
python
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/controller.py#L119-L127
[ "def", "recherche", "(", "self", ",", "pattern", ",", "entete", ",", "in_all", "=", "False", ")", ":", "if", "in_all", ":", "self", ".", "collection", "=", "self", ".", "get_all", "(", ")", "self", ".", "collection", ".", "recherche", "(", "pattern", ...
16be28e99837e40287a63803bbfdf67ac1806b7b
train
abstractInterface.launch_background_job
Launch the callable job in background thread. Succes or failure are controlled by on_error and on_success
pyDLib/Core/controller.py
def launch_background_job(self, job, on_error=None, on_success=None): """Launch the callable job in background thread. Succes or failure are controlled by on_error and on_success """ if not self.main.mode_online: self.sortie_erreur_GUI( "Local mode activated. ...
def launch_background_job(self, job, on_error=None, on_success=None): """Launch the callable job in background thread. Succes or failure are controlled by on_error and on_success """ if not self.main.mode_online: self.sortie_erreur_GUI( "Local mode activated. ...
[ "Launch", "the", "callable", "job", "in", "background", "thread", ".", "Succes", "or", "failure", "are", "controlled", "by", "on_error", "and", "on_success" ]
benoitkugler/abstractDataLibrary
python
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/controller.py#L129-L153
[ "def", "launch_background_job", "(", "self", ",", "job", ",", "on_error", "=", "None", ",", "on_success", "=", "None", ")", ":", "if", "not", "self", ".", "main", ".", "mode_online", ":", "self", ".", "sortie_erreur_GUI", "(", "\"Local mode activated. Can't ru...
16be28e99837e40287a63803bbfdf67ac1806b7b
train
abstractInterface.filtre
Return a filter list, bases on criteres :param liste_base: Acces list :param criteres: Criteria { `attribut`:[valeurs,...] }
pyDLib/Core/controller.py
def filtre(liste_base, criteres) -> groups.Collection: """ Return a filter list, bases on criteres :param liste_base: Acces list :param criteres: Criteria { `attribut`:[valeurs,...] } """ def choisi(ac): for cat, li in criteres.items(): v = a...
def filtre(liste_base, criteres) -> groups.Collection: """ Return a filter list, bases on criteres :param liste_base: Acces list :param criteres: Criteria { `attribut`:[valeurs,...] } """ def choisi(ac): for cat, li in criteres.items(): v = a...
[ "Return", "a", "filter", "list", "bases", "on", "criteres" ]
benoitkugler/abstractDataLibrary
python
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/controller.py#L175-L190
[ "def", "filtre", "(", "liste_base", ",", "criteres", ")", "->", "groups", ".", "Collection", ":", "def", "choisi", "(", "ac", ")", ":", "for", "cat", ",", "li", "in", "criteres", ".", "items", "(", ")", ":", "v", "=", "ac", "[", "cat", "]", "if",...
16be28e99837e40287a63803bbfdf67ac1806b7b
train
abstractInterInterfaces.load_remote_data
Load remote data. On succes, build base. On failure, raise :class:`~.Core.exceptions.StructureError`, :class:`~.Core.exceptions.ConnexionError` :param callback_etat: State renderer str , int , int -> None
pyDLib/Core/controller.py
def load_remote_data(self, callback_etat=print): """ Load remote data. On succes, build base. On failure, raise :class:`~.Core.exceptions.StructureError`, :class:`~.Core.exceptions.ConnexionError` :param callback_etat: State renderer str , int , int -> None """ callback_...
def load_remote_data(self, callback_etat=print): """ Load remote data. On succes, build base. On failure, raise :class:`~.Core.exceptions.StructureError`, :class:`~.Core.exceptions.ConnexionError` :param callback_etat: State renderer str , int , int -> None """ callback_...
[ "Load", "remote", "data", ".", "On", "succes", "build", "base", ".", "On", "failure", "raise", ":", "class", ":", "~", ".", "Core", ".", "exceptions", ".", "StructureError", ":", "class", ":", "~", ".", "Core", ".", "exceptions", ".", "ConnexionError" ]
benoitkugler/abstractDataLibrary
python
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/controller.py#L247-L256
[ "def", "load_remote_data", "(", "self", ",", "callback_etat", "=", "print", ")", ":", "callback_etat", "(", "\"Chargement des utilisateurs\"", ",", "0", ",", "1", ")", "self", ".", "_load_users", "(", ")", "self", ".", "base", "=", "self", ".", "BASE_CLASS",...
16be28e99837e40287a63803bbfdf67ac1806b7b
train
abstractInterInterfaces._load_users
Default implentation requires users from DB. Should setup `users` attribute
pyDLib/Core/controller.py
def _load_users(self): """Default implentation requires users from DB. Should setup `users` attribute""" r = sql.abstractRequetesSQL.get_users()() self.users = {d["id"]: dict(d) for d in r}
def _load_users(self): """Default implentation requires users from DB. Should setup `users` attribute""" r = sql.abstractRequetesSQL.get_users()() self.users = {d["id"]: dict(d) for d in r}
[ "Default", "implentation", "requires", "users", "from", "DB", ".", "Should", "setup", "users", "attribute" ]
benoitkugler/abstractDataLibrary
python
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/controller.py#L258-L262
[ "def", "_load_users", "(", "self", ")", ":", "r", "=", "sql", ".", "abstractRequetesSQL", ".", "get_users", "(", ")", "(", ")", "self", ".", "users", "=", "{", "d", "[", "\"id\"", "]", ":", "dict", "(", "d", ")", "for", "d", "in", "r", "}" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
train
abstractInterInterfaces.load_modules
Should instance interfaces and set them to interface, following `modules`
pyDLib/Core/controller.py
def load_modules(self): """Should instance interfaces and set them to interface, following `modules`""" if self.INTERFACES_MODULE is None: raise NotImplementedError("A module containing interfaces modules " "should be setup in INTERFACES_MODULE !") ...
def load_modules(self): """Should instance interfaces and set them to interface, following `modules`""" if self.INTERFACES_MODULE is None: raise NotImplementedError("A module containing interfaces modules " "should be setup in INTERFACES_MODULE !") ...
[ "Should", "instance", "interfaces", "and", "set", "them", "to", "interface", "following", "modules" ]
benoitkugler/abstractDataLibrary
python
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/controller.py#L273-L282
[ "def", "load_modules", "(", "self", ")", ":", "if", "self", ".", "INTERFACES_MODULE", "is", "None", ":", "raise", "NotImplementedError", "(", "\"A module containing interfaces modules \"", "\"should be setup in INTERFACES_MODULE !\"", ")", "else", ":", "for", "module", ...
16be28e99837e40287a63803bbfdf67ac1806b7b