repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
SiLab-Bonn/basil | basil/HL/GPAC.py | GPAC.set_current | def set_current(self, channel, value, unit='A'):
'''Setting current of current source
'''
dac_offset = self._ch_cal[channel]['DAC']['offset']
dac_gain = self._ch_cal[channel]['DAC']['gain']
if unit == 'raw':
value = value
elif unit == 'A':
value = ... | python | def set_current(self, channel, value, unit='A'):
'''Setting current of current source
'''
dac_offset = self._ch_cal[channel]['DAC']['offset']
dac_gain = self._ch_cal[channel]['DAC']['gain']
if unit == 'raw':
value = value
elif unit == 'A':
value = ... | [
"def",
"set_current",
"(",
"self",
",",
"channel",
",",
"value",
",",
"unit",
"=",
"'A'",
")",
":",
"dac_offset",
"=",
"self",
".",
"_ch_cal",
"[",
"channel",
"]",
"[",
"'DAC'",
"]",
"[",
"'offset'",
"]",
"dac_gain",
"=",
"self",
".",
"_ch_cal",
"[",... | Setting current of current source | [
"Setting",
"current",
"of",
"current",
"source"
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/HL/GPAC.py#L858-L874 |
SiLab-Bonn/basil | basil/HL/MIO_PLL.py | MIO_PLL._calculateParameters | def _calculateParameters(self, fout):
q_d_f = 0
'''
fout = fref * (p_total / q_total) * (1 / div)
p_total = 2 * ((p_counter + 4) + p_0) [16..1023]
q_total = q_counter + 2 [2..129]
div = [2,(3),4..127]
constraints:
f_ref * p_total ... | python | def _calculateParameters(self, fout):
q_d_f = 0
'''
fout = fref * (p_total / q_total) * (1 / div)
p_total = 2 * ((p_counter + 4) + p_0) [16..1023]
q_total = q_counter + 2 [2..129]
div = [2,(3),4..127]
constraints:
f_ref * p_total ... | [
"def",
"_calculateParameters",
"(",
"self",
",",
"fout",
")",
":",
"q_d_f",
"=",
"0",
"for",
"self",
".",
"q_counter",
"in",
"range",
"(",
"128",
")",
":",
"self",
".",
"q_total",
"=",
"self",
".",
"q_counter",
"+",
"2",
"if",
"(",
"self",
".",
"fr... | fout = fref * (p_total / q_total) * (1 / div)
p_total = 2 * ((p_counter + 4) + p_0) [16..1023]
q_total = q_counter + 2 [2..129]
div = [2,(3),4..127]
constraints:
f_ref * p_total / q_total = [100..400] MHz
f_ref / q_total > 0.25 MHz | [
"fout",
"=",
"fref",
"*",
"(",
"p_total",
"/",
"q_total",
")",
"*",
"(",
"1",
"/",
"div",
")"
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/HL/MIO_PLL.py#L111-L180 |
SiLab-Bonn/basil | basil/TL/Visa.py | Visa.init | def init(self):
'''
Initialize the device.
Parameters of visa.ResourceManager().open_resource()
'''
super(Visa, self).init()
backend = self._init.get('backend', '') # Empty string means std. backend (NI VISA)
rm = visa.ResourceManager(backend)
try:
... | python | def init(self):
'''
Initialize the device.
Parameters of visa.ResourceManager().open_resource()
'''
super(Visa, self).init()
backend = self._init.get('backend', '') # Empty string means std. backend (NI VISA)
rm = visa.ResourceManager(backend)
try:
... | [
"def",
"init",
"(",
"self",
")",
":",
"super",
"(",
"Visa",
",",
"self",
")",
".",
"init",
"(",
")",
"backend",
"=",
"self",
".",
"_init",
".",
"get",
"(",
"'backend'",
",",
"''",
")",
"# Empty string means std. backend (NI VISA)",
"rm",
"=",
"visa",
"... | Initialize the device.
Parameters of visa.ResourceManager().open_resource() | [
"Initialize",
"the",
"device",
".",
"Parameters",
"of",
"visa",
".",
"ResourceManager",
"()",
".",
"open_resource",
"()"
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/TL/Visa.py#L26-L38 |
SiLab-Bonn/basil | basil/HL/bram_fifo.py | bram_fifo.get_data | def get_data(self):
''' Reading data in BRAM.
Returns
-------
array : numpy.ndarray
Array of unsigned integers (32 bit).
'''
fifo_int_size_1 = self.FIFO_INT_SIZE
fifo_int_size_2 = self.FIFO_INT_SIZE
if fifo_int_size_1 > fifo_int_size_2:
... | python | def get_data(self):
''' Reading data in BRAM.
Returns
-------
array : numpy.ndarray
Array of unsigned integers (32 bit).
'''
fifo_int_size_1 = self.FIFO_INT_SIZE
fifo_int_size_2 = self.FIFO_INT_SIZE
if fifo_int_size_1 > fifo_int_size_2:
... | [
"def",
"get_data",
"(",
"self",
")",
":",
"fifo_int_size_1",
"=",
"self",
".",
"FIFO_INT_SIZE",
"fifo_int_size_2",
"=",
"self",
".",
"FIFO_INT_SIZE",
"if",
"fifo_int_size_1",
">",
"fifo_int_size_2",
":",
"fifo_int_size",
"=",
"fifo_int_size_2",
"# use smaller chunk",
... | Reading data in BRAM.
Returns
-------
array : numpy.ndarray
Array of unsigned integers (32 bit). | [
"Reading",
"data",
"in",
"BRAM",
"."
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/HL/bram_fifo.py#L60-L75 |
SiLab-Bonn/basil | basil/utils/sim/SiLibUsbBusDriver.py | SiLibUsbBusDriver.read_external | def read_external(self, address):
"""Copied from silusb.sv testbench interface"""
self.bus.RD_B <= 1
self.bus.ADD <= self._x
self.bus.BUS_DATA <= self._high_impedence
for _ in range(5):
yield RisingEdge(self.clock)
yield RisingEdge(self.clock)
self.bu... | python | def read_external(self, address):
"""Copied from silusb.sv testbench interface"""
self.bus.RD_B <= 1
self.bus.ADD <= self._x
self.bus.BUS_DATA <= self._high_impedence
for _ in range(5):
yield RisingEdge(self.clock)
yield RisingEdge(self.clock)
self.bu... | [
"def",
"read_external",
"(",
"self",
",",
"address",
")",
":",
"self",
".",
"bus",
".",
"RD_B",
"<=",
"1",
"self",
".",
"bus",
".",
"ADD",
"<=",
"self",
".",
"_x",
"self",
".",
"bus",
".",
"BUS_DATA",
"<=",
"self",
".",
"_high_impedence",
"for",
"_... | Copied from silusb.sv testbench interface | [
"Copied",
"from",
"silusb",
".",
"sv",
"testbench",
"interface"
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/utils/sim/SiLibUsbBusDriver.py#L101-L130 |
SiLab-Bonn/basil | basil/utils/sim/SiLibUsbBusDriver.py | SiLibUsbBusDriver.write_external | def write_external(self, address, value):
"""Copied from silusb.sv testbench interface"""
self.bus.WR_B <= 1
self.bus.ADD <= self._x
for _ in range(5):
yield RisingEdge(self.clock)
yield RisingEdge(self.clock)
self.bus.ADD <= address + 0x4000
self.bu... | python | def write_external(self, address, value):
"""Copied from silusb.sv testbench interface"""
self.bus.WR_B <= 1
self.bus.ADD <= self._x
for _ in range(5):
yield RisingEdge(self.clock)
yield RisingEdge(self.clock)
self.bus.ADD <= address + 0x4000
self.bu... | [
"def",
"write_external",
"(",
"self",
",",
"address",
",",
"value",
")",
":",
"self",
".",
"bus",
".",
"WR_B",
"<=",
"1",
"self",
".",
"bus",
".",
"ADD",
"<=",
"self",
".",
"_x",
"for",
"_",
"in",
"range",
"(",
"5",
")",
":",
"yield",
"RisingEdge... | Copied from silusb.sv testbench interface | [
"Copied",
"from",
"silusb",
".",
"sv",
"testbench",
"interface"
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/utils/sim/SiLibUsbBusDriver.py#L133-L168 |
SiLab-Bonn/basil | basil/HL/FEI4AdapterCard.py | AdcMax1239._setup_adc | def _setup_adc(self, flags):
'''Initialize ADC
'''
self._intf.write(self._base_addr + self.MAX_1239_ADD, array('B', pack('B', flags))) | python | def _setup_adc(self, flags):
'''Initialize ADC
'''
self._intf.write(self._base_addr + self.MAX_1239_ADD, array('B', pack('B', flags))) | [
"def",
"_setup_adc",
"(",
"self",
",",
"flags",
")",
":",
"self",
".",
"_intf",
".",
"write",
"(",
"self",
".",
"_base_addr",
"+",
"self",
".",
"MAX_1239_ADD",
",",
"array",
"(",
"'B'",
",",
"pack",
"(",
"'B'",
",",
"flags",
")",
")",
")"
] | Initialize ADC | [
"Initialize",
"ADC"
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/HL/FEI4AdapterCard.py#L45-L48 |
SiLab-Bonn/basil | basil/HL/FEI4AdapterCard.py | AdcMax1239._get_adc_value | def _get_adc_value(self, channel, average=None):
'''Read ADC
'''
conf = self.SCAN_OFF | self.SINGLE_ENDED | ((0x1e) & (channel << 1))
self._intf.write(self._base_addr + self.MAX_1239_ADD, array('B', pack('B', conf)))
def read_data():
ret = self._intf.read(self._base_... | python | def _get_adc_value(self, channel, average=None):
'''Read ADC
'''
conf = self.SCAN_OFF | self.SINGLE_ENDED | ((0x1e) & (channel << 1))
self._intf.write(self._base_addr + self.MAX_1239_ADD, array('B', pack('B', conf)))
def read_data():
ret = self._intf.read(self._base_... | [
"def",
"_get_adc_value",
"(",
"self",
",",
"channel",
",",
"average",
"=",
"None",
")",
":",
"conf",
"=",
"self",
".",
"SCAN_OFF",
"|",
"self",
".",
"SINGLE_ENDED",
"|",
"(",
"(",
"0x1e",
")",
"&",
"(",
"channel",
"<<",
"1",
")",
")",
"self",
".",
... | Read ADC | [
"Read",
"ADC"
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/HL/FEI4AdapterCard.py#L50-L70 |
SiLab-Bonn/basil | basil/HL/FEI4AdapterCard.py | Eeprom24Lc128._read_eeprom | def _read_eeprom(self, address, size):
'''Read EEPROM
'''
self._intf.write(self._base_addr + self.CAL_EEPROM_ADD, array('B', pack('>H', address & 0x3FFF))) # 14-bit address, 16384 bytes
n_pages, n_bytes = divmod(size, self.CAL_EEPROM_PAGE_SIZE)
data = array('B')
for _ i... | python | def _read_eeprom(self, address, size):
'''Read EEPROM
'''
self._intf.write(self._base_addr + self.CAL_EEPROM_ADD, array('B', pack('>H', address & 0x3FFF))) # 14-bit address, 16384 bytes
n_pages, n_bytes = divmod(size, self.CAL_EEPROM_PAGE_SIZE)
data = array('B')
for _ i... | [
"def",
"_read_eeprom",
"(",
"self",
",",
"address",
",",
"size",
")",
":",
"self",
".",
"_intf",
".",
"write",
"(",
"self",
".",
"_base_addr",
"+",
"self",
".",
"CAL_EEPROM_ADD",
",",
"array",
"(",
"'B'",
",",
"pack",
"(",
"'>H'",
",",
"address",
"&"... | Read EEPROM | [
"Read",
"EEPROM"
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/HL/FEI4AdapterCard.py#L102-L115 |
SiLab-Bonn/basil | basil/HL/FEI4AdapterCard.py | Fei4Dcs.set_default | def set_default(self, channels=None):
'''Setting default voltage
'''
if not channels:
channels = self._ch_cal.keys()
for channel in channels:
self.set_voltage(channel, self._ch_cal[channel]['default'], unit='V') | python | def set_default(self, channels=None):
'''Setting default voltage
'''
if not channels:
channels = self._ch_cal.keys()
for channel in channels:
self.set_voltage(channel, self._ch_cal[channel]['default'], unit='V') | [
"def",
"set_default",
"(",
"self",
",",
"channels",
"=",
"None",
")",
":",
"if",
"not",
"channels",
":",
"channels",
"=",
"self",
".",
"_ch_cal",
".",
"keys",
"(",
")",
"for",
"channel",
"in",
"channels",
":",
"self",
".",
"set_voltage",
"(",
"channel"... | Setting default voltage | [
"Setting",
"default",
"voltage"
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/HL/FEI4AdapterCard.py#L140-L146 |
SiLab-Bonn/basil | basil/HL/FEI4AdapterCard.py | Fei4Dcs.get_voltage | def get_voltage(self, channel, unit='V'):
'''Reading voltage
'''
kwargs = self._ch_map[channel]['ADCV']
voltage_raw = self._get_adc_value(**kwargs)
voltage = (voltage_raw - self._ch_cal[channel]['ADCV']['offset']) / self._ch_cal[channel]['ADCV']['gain']
if unit == 'raw'... | python | def get_voltage(self, channel, unit='V'):
'''Reading voltage
'''
kwargs = self._ch_map[channel]['ADCV']
voltage_raw = self._get_adc_value(**kwargs)
voltage = (voltage_raw - self._ch_cal[channel]['ADCV']['offset']) / self._ch_cal[channel]['ADCV']['gain']
if unit == 'raw'... | [
"def",
"get_voltage",
"(",
"self",
",",
"channel",
",",
"unit",
"=",
"'V'",
")",
":",
"kwargs",
"=",
"self",
".",
"_ch_map",
"[",
"channel",
"]",
"[",
"'ADCV'",
"]",
"voltage_raw",
"=",
"self",
".",
"_get_adc_value",
"(",
"*",
"*",
"kwargs",
")",
"vo... | Reading voltage | [
"Reading",
"voltage"
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/HL/FEI4AdapterCard.py#L165-L180 |
SiLab-Bonn/basil | basil/HL/FEI4AdapterCard.py | Fei4Dcs.get_current | def get_current(self, channel, unit='A'):
'''Reading current
'''
kwargs = self._ch_map[channel]['ADCI']
current_raw = self._get_adc_value(**kwargs)
voltage = self.get_voltage(channel)
current_raw_iq = current_raw - (self._ch_cal[channel]['ADCI']['iq_offset'] + self._ch_c... | python | def get_current(self, channel, unit='A'):
'''Reading current
'''
kwargs = self._ch_map[channel]['ADCI']
current_raw = self._get_adc_value(**kwargs)
voltage = self.get_voltage(channel)
current_raw_iq = current_raw - (self._ch_cal[channel]['ADCI']['iq_offset'] + self._ch_c... | [
"def",
"get_current",
"(",
"self",
",",
"channel",
",",
"unit",
"=",
"'A'",
")",
":",
"kwargs",
"=",
"self",
".",
"_ch_map",
"[",
"channel",
"]",
"[",
"'ADCI'",
"]",
"current_raw",
"=",
"self",
".",
"_get_adc_value",
"(",
"*",
"*",
"kwargs",
")",
"vo... | Reading current | [
"Reading",
"current"
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/HL/FEI4AdapterCard.py#L182-L203 |
SiLab-Bonn/basil | basil/HL/FEI4AdapterCard.py | FEI4AdapterCard.read_eeprom_calibration | def read_eeprom_calibration(self, temperature=False): # use default values for temperature, EEPROM values are usually not calibrated and random
'''Reading EEPROM calibration for power regulators and temperature
'''
header = self.get_format()
if header == self.HEADER_V1:
data... | python | def read_eeprom_calibration(self, temperature=False): # use default values for temperature, EEPROM values are usually not calibrated and random
'''Reading EEPROM calibration for power regulators and temperature
'''
header = self.get_format()
if header == self.HEADER_V1:
data... | [
"def",
"read_eeprom_calibration",
"(",
"self",
",",
"temperature",
"=",
"False",
")",
":",
"# use default values for temperature, EEPROM values are usually not calibrated and random",
"header",
"=",
"self",
".",
"get_format",
"(",
")",
"if",
"header",
"==",
"self",
".",
... | Reading EEPROM calibration for power regulators and temperature | [
"Reading",
"EEPROM",
"calibration",
"for",
"power",
"regulators",
"and",
"temperature"
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/HL/FEI4AdapterCard.py#L336-L366 |
SiLab-Bonn/basil | basil/HL/FEI4AdapterCard.py | FEI4AdapterCard.get_temperature | def get_temperature(self, channel, sensor='VNTC'):
'''Reading temperature
'''
# NTC type SEMITEC 103KT1608 http://www.semitec.co.jp/english/products/pdf/KT_Thermistor.pdf
#
# R_NTC = R_25 * exp(B_NTC * (1/T - 1/T_25))
#
# R_NTC measured NTC resistance
# R_NTC_25 ... | python | def get_temperature(self, channel, sensor='VNTC'):
'''Reading temperature
'''
# NTC type SEMITEC 103KT1608 http://www.semitec.co.jp/english/products/pdf/KT_Thermistor.pdf
#
# R_NTC = R_25 * exp(B_NTC * (1/T - 1/T_25))
#
# R_NTC measured NTC resistance
# R_NTC_25 ... | [
"def",
"get_temperature",
"(",
"self",
",",
"channel",
",",
"sensor",
"=",
"'VNTC'",
")",
":",
"# NTC type SEMITEC 103KT1608 http://www.semitec.co.jp/english/products/pdf/KT_Thermistor.pdf",
"#",
"# R_NTC = R_25 * exp(B_NTC * (1/T - 1/T_25))",
"#",
"# R_NTC ... | Reading temperature | [
"Reading",
"temperature"
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/HL/FEI4AdapterCard.py#L368-L396 |
SiLab-Bonn/basil | basil/utils/DataManipulation.py | convert_data_array | def convert_data_array(arr, filter_func=None, converter_func=None):
'''Filter and convert any given data array of any dtype.
Parameters
----------
arr : numpy.array
Data array of any dtype.
filter_func : function
Function that takes array and returns true or false for each i... | python | def convert_data_array(arr, filter_func=None, converter_func=None):
'''Filter and convert any given data array of any dtype.
Parameters
----------
arr : numpy.array
Data array of any dtype.
filter_func : function
Function that takes array and returns true or false for each i... | [
"def",
"convert_data_array",
"(",
"arr",
",",
"filter_func",
"=",
"None",
",",
"converter_func",
"=",
"None",
")",
":",
"# if filter_func != None:\r",
"# if not hasattr(filter_func, '__call__'):\r",
"# raise ValueError('Filter is not callable')\r",
"if",
"... | Filter and convert any given data array of any dtype.
Parameters
----------
arr : numpy.array
Data array of any dtype.
filter_func : function
Function that takes array and returns true or false for each item in array.
converter_func : function
Function that takes ar... | [
"Filter",
"and",
"convert",
"any",
"given",
"data",
"array",
"of",
"any",
"dtype",
".",
"Parameters",
"----------",
"arr",
":",
"numpy",
".",
"array",
"Data",
"array",
"of",
"any",
"dtype",
".",
"filter_func",
":",
"function",
"Function",
"that",
"takes",
... | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/utils/DataManipulation.py#L11-L37 |
SiLab-Bonn/basil | basil/utils/DataManipulation.py | logical_and | 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
Examples
--------
filter_func=logical_... | python | 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
Examples
--------
filter_func=logical_... | [
"def",
"logical_and",
"(",
"f1",
",",
"f2",
")",
":",
"# function factory\r",
"def",
"f_and",
"(",
"arr",
")",
":",
"return",
"np",
".",
"logical_and",
"(",
"f1",
"(",
"arr",
")",
",",
"f2",
"(",
"arr",
")",
")",
"f_and",
".",
"__name__",
"=",
"f1"... | Logical and from functions.
Parameters
----------
f1, f2 : function
Function that takes array and returns true or false for each item in array.
Returns
-------
Function
Examples
--------
filter_func=logical_and(is_data_record, is_data_from_channel(4)) # new f... | [
"Logical",
"and",
"from",
"functions",
".",
"Parameters",
"----------",
"f1",
"f2",
":",
"function",
"Function",
"that",
"takes",
"array",
"and",
"returns",
"true",
"or",
"false",
"for",
"each",
"item",
"in",
"array",
".",
"Returns",
"-------",
"Function",
"... | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/utils/DataManipulation.py#L44-L64 |
SiLab-Bonn/basil | basil/utils/DataManipulation.py | logical_or | 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_or(arr):
return np.logical_o... | python | 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_or(arr):
return np.logical_o... | [
"def",
"logical_or",
"(",
"f1",
",",
"f2",
")",
":",
"# function factory\r",
"def",
"f_or",
"(",
"arr",
")",
":",
"return",
"np",
".",
"logical_or",
"(",
"f1",
"(",
"arr",
")",
",",
"f2",
"(",
"arr",
")",
")",
"f_or",
".",
"__name__",
"=",
"f1",
... | Logical or from functions.
Parameters
----------
f1, f2 : function
Function that takes array and returns true or false for each item in array.
Returns
-------
Function | [
"Logical",
"or",
"from",
"functions",
".",
"Parameters",
"----------",
"f1",
"f2",
":",
"function",
"Function",
"that",
"takes",
"array",
"and",
"returns",
"true",
"or",
"false",
"for",
"each",
"item",
"in",
"array",
".",
"Returns",
"-------",
"Function"
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/utils/DataManipulation.py#L67-L82 |
SiLab-Bonn/basil | basil/utils/DataManipulation.py | 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_not(arr):
return np.logical_not... | python | 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_not(arr):
return np.logical_not... | [
"def",
"logical_not",
"(",
"f",
")",
":",
"# function factory\r",
"def",
"f_not",
"(",
"arr",
")",
":",
"return",
"np",
".",
"logical_not",
"(",
"f",
"(",
"arr",
")",
")",
"f_not",
".",
"__name__",
"=",
"\"not_\"",
"+",
"f",
".",
"__name__",
"return",
... | Logical not from functions.
Parameters
----------
f1, f2 : function
Function that takes array and returns true or false for each item in array.
Returns
-------
Function | [
"Logical",
"not",
"from",
"functions",
".",
"Parameters",
"----------",
"f1",
"f2",
":",
"function",
"Function",
"that",
"takes",
"array",
"and",
"returns",
"true",
"or",
"false",
"for",
"each",
"item",
"in",
"array",
".",
"Returns",
"-------",
"Function"
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/utils/DataManipulation.py#L85-L100 |
SiLab-Bonn/basil | basil/utils/DataManipulation.py | logical_xor | 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_xor(arr):
return np.logica... | python | 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_xor(arr):
return np.logica... | [
"def",
"logical_xor",
"(",
"f1",
",",
"f2",
")",
":",
"# function factory\r",
"def",
"f_xor",
"(",
"arr",
")",
":",
"return",
"np",
".",
"logical_xor",
"(",
"f1",
"(",
"arr",
")",
",",
"f2",
"(",
"arr",
")",
")",
"f_xor",
".",
"__name__",
"=",
"f1"... | Logical xor from functions.
Parameters
----------
f1, f2 : function
Function that takes array and returns true or false for each item in array.
Returns
-------
Function | [
"Logical",
"xor",
"from",
"functions",
".",
"Parameters",
"----------",
"f1",
"f2",
":",
"function",
"Function",
"that",
"takes",
"array",
"and",
"returns",
"true",
"or",
"false",
"for",
"each",
"item",
"in",
"array",
".",
"Returns",
"-------",
"Function"
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/utils/DataManipulation.py#L103-L118 |
SiLab-Bonn/basil | basil/utils/DataManipulation.py | arr_select | def arr_select(value): # function factory
'''Selecting array elements by bitwise and comparison to a given value.
Parameters:
value : int
Value to which array elements are compared to.
Returns:
array : np.array
'''
def f_eq(arr):
return np.equal(np.bitwise_and(a... | python | def arr_select(value): # function factory
'''Selecting array elements by bitwise and comparison to a given value.
Parameters:
value : int
Value to which array elements are compared to.
Returns:
array : np.array
'''
def f_eq(arr):
return np.equal(np.bitwise_and(a... | [
"def",
"arr_select",
"(",
"value",
")",
":",
"# function factory\r",
"def",
"f_eq",
"(",
"arr",
")",
":",
"return",
"np",
".",
"equal",
"(",
"np",
".",
"bitwise_and",
"(",
"arr",
",",
"value",
")",
",",
"value",
")",
"f_eq",
".",
"__name__",
"=",
"\"... | Selecting array elements by bitwise and comparison to a given value.
Parameters:
value : int
Value to which array elements are compared to.
Returns:
array : np.array | [
"Selecting",
"array",
"elements",
"by",
"bitwise",
"and",
"comparison",
"to",
"a",
"given",
"value",
".",
"Parameters",
":",
"value",
":",
"int",
"Value",
"to",
"which",
"array",
"elements",
"are",
"compared",
"to",
".",
"Returns",
":",
"array",
":",
"np",... | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/utils/DataManipulation.py#L121-L134 |
SiLab-Bonn/basil | basil/utils/DataManipulation.py | arr_astype | def arr_astype(arr_type): # function factory
'''Change dtype of array.
Parameters:
arr_type : str, np.dtype
Character codes (e.g. 'b', '>H'), type strings (e.g. 'i4', 'f8'), Python types (e.g. float, int) and numpy dtypes (e.g. np.uint32) are allowed.
Returns:
array : np.array
... | python | def arr_astype(arr_type): # function factory
'''Change dtype of array.
Parameters:
arr_type : str, np.dtype
Character codes (e.g. 'b', '>H'), type strings (e.g. 'i4', 'f8'), Python types (e.g. float, int) and numpy dtypes (e.g. np.uint32) are allowed.
Returns:
array : np.array
... | [
"def",
"arr_astype",
"(",
"arr_type",
")",
":",
"# function factory\r",
"def",
"f_astype",
"(",
"arr",
")",
":",
"return",
"arr",
".",
"astype",
"(",
"arr_type",
")",
"f_astype",
".",
"__name__",
"=",
"\"arr_astype_\"",
"+",
"str",
"(",
"arr_type",
")",
"#... | Change dtype of array.
Parameters:
arr_type : str, np.dtype
Character codes (e.g. 'b', '>H'), type strings (e.g. 'i4', 'f8'), Python types (e.g. float, int) and numpy dtypes (e.g. np.uint32) are allowed.
Returns:
array : np.array | [
"Change",
"dtype",
"of",
"array",
".",
"Parameters",
":",
"arr_type",
":",
"str",
"np",
".",
"dtype",
"Character",
"codes",
"(",
"e",
".",
"g",
".",
"b",
">",
"H",
")",
"type",
"strings",
"(",
"e",
".",
"g",
".",
"i4",
"f8",
")",
"Python",
"types... | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/utils/DataManipulation.py#L139-L152 |
SiLab-Bonn/basil | basil/utils/sim/Protocol.py | PickleInterface.send | def send(self, obj):
"""Prepend a 4-byte length to the string"""
assert isinstance(obj, ProtocolBase)
string = pickle.dumps(obj)
length = len(string)
self.sock.sendall(struct.pack("<I", length) + string) | python | def send(self, obj):
"""Prepend a 4-byte length to the string"""
assert isinstance(obj, ProtocolBase)
string = pickle.dumps(obj)
length = len(string)
self.sock.sendall(struct.pack("<I", length) + string) | [
"def",
"send",
"(",
"self",
",",
"obj",
")",
":",
"assert",
"isinstance",
"(",
"obj",
",",
"ProtocolBase",
")",
"string",
"=",
"pickle",
".",
"dumps",
"(",
"obj",
")",
"length",
"=",
"len",
"(",
"string",
")",
"self",
".",
"sock",
".",
"sendall",
"... | Prepend a 4-byte length to the string | [
"Prepend",
"a",
"4",
"-",
"byte",
"length",
"to",
"the",
"string"
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/utils/sim/Protocol.py#L57-L62 |
SiLab-Bonn/basil | basil/utils/sim/Protocol.py | PickleInterface.recv | def recv(self, blocking=True):
"""Receive the next object from the socket"""
length = struct.unpack("<I", self.sock.recv(4))[0]
return self._get_next_obj(length) | python | def recv(self, blocking=True):
"""Receive the next object from the socket"""
length = struct.unpack("<I", self.sock.recv(4))[0]
return self._get_next_obj(length) | [
"def",
"recv",
"(",
"self",
",",
"blocking",
"=",
"True",
")",
":",
"length",
"=",
"struct",
".",
"unpack",
"(",
"\"<I\"",
",",
"self",
".",
"sock",
".",
"recv",
"(",
"4",
")",
")",
"[",
"0",
"]",
"return",
"self",
".",
"_get_next_obj",
"(",
"len... | Receive the next object from the socket | [
"Receive",
"the",
"next",
"object",
"from",
"the",
"socket"
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/utils/sim/Protocol.py#L64-L67 |
SiLab-Bonn/basil | basil/utils/sim/Protocol.py | PickleInterface.try_recv | def try_recv(self):
"""Return None immediately if nothing is waiting"""
try:
lenstr = self.sock.recv(4, socket.MSG_DONTWAIT)
except socket.error:
return None
if len(lenstr) < 4:
raise EOFError("Socket closed")
length = struct.unpack("<I", lenst... | python | def try_recv(self):
"""Return None immediately if nothing is waiting"""
try:
lenstr = self.sock.recv(4, socket.MSG_DONTWAIT)
except socket.error:
return None
if len(lenstr) < 4:
raise EOFError("Socket closed")
length = struct.unpack("<I", lenst... | [
"def",
"try_recv",
"(",
"self",
")",
":",
"try",
":",
"lenstr",
"=",
"self",
".",
"sock",
".",
"recv",
"(",
"4",
",",
"socket",
".",
"MSG_DONTWAIT",
")",
"except",
"socket",
".",
"error",
":",
"return",
"None",
"if",
"len",
"(",
"lenstr",
")",
"<",... | Return None immediately if nothing is waiting | [
"Return",
"None",
"immediately",
"if",
"nothing",
"is",
"waiting"
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/utils/sim/Protocol.py#L69-L78 |
SiLab-Bonn/basil | basil/utils/sim/Protocol.py | PickleInterface._get_next_obj | def _get_next_obj(self, length):
"""Assumes we've already read the object length"""
data = b''
while len(data) < length:
data += self.sock.recv(length - len(data))
return pickle.loads(data) | python | def _get_next_obj(self, length):
"""Assumes we've already read the object length"""
data = b''
while len(data) < length:
data += self.sock.recv(length - len(data))
return pickle.loads(data) | [
"def",
"_get_next_obj",
"(",
"self",
",",
"length",
")",
":",
"data",
"=",
"b''",
"while",
"len",
"(",
"data",
")",
"<",
"length",
":",
"data",
"+=",
"self",
".",
"sock",
".",
"recv",
"(",
"length",
"-",
"len",
"(",
"data",
")",
")",
"return",
"p... | Assumes we've already read the object length | [
"Assumes",
"we",
"ve",
"already",
"read",
"the",
"object",
"length"
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/utils/sim/Protocol.py#L80-L86 |
SiLab-Bonn/basil | basil/dut.py | Dut.get_modules | def get_modules(self, type_name):
'''Getting modules by type name.
Parameters
----------
type_name : string
Type name of the modules to be returned.
Returns
-------
List of modules of given type name else empty list.
'''
modules = []
... | python | def get_modules(self, type_name):
'''Getting modules by type name.
Parameters
----------
type_name : string
Type name of the modules to be returned.
Returns
-------
List of modules of given type name else empty list.
'''
modules = []
... | [
"def",
"get_modules",
"(",
"self",
",",
"type_name",
")",
":",
"modules",
"=",
"[",
"]",
"for",
"module",
"in",
"self",
":",
"if",
"module",
".",
"__class__",
".",
"__name__",
"==",
"type_name",
":",
"modules",
".",
"append",
"(",
"module",
")",
"retur... | Getting modules by type name.
Parameters
----------
type_name : string
Type name of the modules to be returned.
Returns
-------
List of modules of given type name else empty list. | [
"Getting",
"modules",
"by",
"type",
"name",
"."
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/dut.py#L288-L304 |
SiLab-Bonn/basil | basil/HL/sensirion_ekh4.py | sensirionEKH4.ask | def ask(self, command):
'''Read response to command and convert it to 16-bit integer.
Returns : list of values
'''
self.write(command)
time.sleep(0.1)
return self.read() | python | def ask(self, command):
'''Read response to command and convert it to 16-bit integer.
Returns : list of values
'''
self.write(command)
time.sleep(0.1)
return self.read() | [
"def",
"ask",
"(",
"self",
",",
"command",
")",
":",
"self",
".",
"write",
"(",
"command",
")",
"time",
".",
"sleep",
"(",
"0.1",
")",
"return",
"self",
".",
"read",
"(",
")"
] | Read response to command and convert it to 16-bit integer.
Returns : list of values | [
"Read",
"response",
"to",
"command",
"and",
"convert",
"it",
"to",
"16",
"-",
"bit",
"integer",
".",
"Returns",
":",
"list",
"of",
"values"
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/HL/sensirion_ekh4.py#L34-L40 |
SiLab-Bonn/basil | basil/HL/tti_ql355tp.py | ttiQl355tp.set_enable | def set_enable(self, on, channel=1):
""" channel: 1=OP1, 2=OP2, 3=AUX, ALL=all channels"""
if isinstance(channel, str):
cmd = "OPALL %d" % int(on)
elif isinstance(channel, int):
cmd = "OP%d %d" % (channel, int(on))
self.write(cmd) | python | def set_enable(self, on, channel=1):
""" channel: 1=OP1, 2=OP2, 3=AUX, ALL=all channels"""
if isinstance(channel, str):
cmd = "OPALL %d" % int(on)
elif isinstance(channel, int):
cmd = "OP%d %d" % (channel, int(on))
self.write(cmd) | [
"def",
"set_enable",
"(",
"self",
",",
"on",
",",
"channel",
"=",
"1",
")",
":",
"if",
"isinstance",
"(",
"channel",
",",
"str",
")",
":",
"cmd",
"=",
"\"OPALL %d\"",
"%",
"int",
"(",
"on",
")",
"elif",
"isinstance",
"(",
"channel",
",",
"int",
")"... | channel: 1=OP1, 2=OP2, 3=AUX, ALL=all channels | [
"channel",
":",
"1",
"=",
"OP1",
"2",
"=",
"OP2",
"3",
"=",
"AUX",
"ALL",
"=",
"all",
"channels"
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/HL/tti_ql355tp.py#L41-L47 |
SiLab-Bonn/basil | basil/HL/tti_ql355tp.py | ttiQl355tp.get_current | def get_current(self, channel):
""" channel: 1=OP1, 2=OP2, AUX is not supported"""
ret = self.ask("I%dO?" % channel)
if ret[-1] != "A":
print("ttiQl355tp.get_current() format error", ret)
return None
return float(ret[:-1]) | python | def get_current(self, channel):
""" channel: 1=OP1, 2=OP2, AUX is not supported"""
ret = self.ask("I%dO?" % channel)
if ret[-1] != "A":
print("ttiQl355tp.get_current() format error", ret)
return None
return float(ret[:-1]) | [
"def",
"get_current",
"(",
"self",
",",
"channel",
")",
":",
"ret",
"=",
"self",
".",
"ask",
"(",
"\"I%dO?\"",
"%",
"channel",
")",
"if",
"ret",
"[",
"-",
"1",
"]",
"!=",
"\"A\"",
":",
"print",
"(",
"\"ttiQl355tp.get_current() format error\"",
",",
"ret"... | channel: 1=OP1, 2=OP2, AUX is not supported | [
"channel",
":",
"1",
"=",
"OP1",
"2",
"=",
"OP2",
"AUX",
"is",
"not",
"supported"
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/HL/tti_ql355tp.py#L52-L58 |
SiLab-Bonn/basil | basil/HL/tti_ql355tp.py | ttiQl355tp.get_voltage | def get_voltage(self, channel):
""" channel: 1=OP1, 2=OP2, AUX is not supported"""
ret = self.ask("V%dO?" % channel)
if ret[-1] != "V":
print("ttiQl355tp.get_voltage() format error", ret)
return None
return float(ret[:-1]) | python | def get_voltage(self, channel):
""" channel: 1=OP1, 2=OP2, AUX is not supported"""
ret = self.ask("V%dO?" % channel)
if ret[-1] != "V":
print("ttiQl355tp.get_voltage() format error", ret)
return None
return float(ret[:-1]) | [
"def",
"get_voltage",
"(",
"self",
",",
"channel",
")",
":",
"ret",
"=",
"self",
".",
"ask",
"(",
"\"V%dO?\"",
"%",
"channel",
")",
"if",
"ret",
"[",
"-",
"1",
"]",
"!=",
"\"V\"",
":",
"print",
"(",
"\"ttiQl355tp.get_voltage() format error\"",
",",
"ret"... | channel: 1=OP1, 2=OP2, AUX is not supported | [
"channel",
":",
"1",
"=",
"OP1",
"2",
"=",
"OP2",
"AUX",
"is",
"not",
"supported"
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/HL/tti_ql355tp.py#L60-L66 |
SiLab-Bonn/basil | basil/HL/tti_ql355tp.py | ttiQl355tp.get_set_voltage | def get_set_voltage(self, channel):
""" channel: 1=OP1, 2=OP2, AUX is not supported"""
ret = self.ask("V%d?" % channel)
if ret[:3] != "V%d " % channel:
print("ttiQl355tp.get_voltage() format error", ret)
return None
return float(ret[3:]) | python | def get_set_voltage(self, channel):
""" channel: 1=OP1, 2=OP2, AUX is not supported"""
ret = self.ask("V%d?" % channel)
if ret[:3] != "V%d " % channel:
print("ttiQl355tp.get_voltage() format error", ret)
return None
return float(ret[3:]) | [
"def",
"get_set_voltage",
"(",
"self",
",",
"channel",
")",
":",
"ret",
"=",
"self",
".",
"ask",
"(",
"\"V%d?\"",
"%",
"channel",
")",
"if",
"ret",
"[",
":",
"3",
"]",
"!=",
"\"V%d \"",
"%",
"channel",
":",
"print",
"(",
"\"ttiQl355tp.get_voltage() forma... | channel: 1=OP1, 2=OP2, AUX is not supported | [
"channel",
":",
"1",
"=",
"OP1",
"2",
"=",
"OP2",
"AUX",
"is",
"not",
"supported"
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/HL/tti_ql355tp.py#L68-L74 |
SiLab-Bonn/basil | basil/HL/tti_ql355tp.py | ttiQl355tp.get_current_limit | def get_current_limit(self, channel):
""" channel: 1=OP1, 2=OP2, AUX is not supported"""
ret = self.ask("I%d?" % channel)
if ret[:3] != "I%d " % channel:
print("ttiQl355tp.get_current_limit() format error", ret)
return None
return float(ret[3:]) | python | def get_current_limit(self, channel):
""" channel: 1=OP1, 2=OP2, AUX is not supported"""
ret = self.ask("I%d?" % channel)
if ret[:3] != "I%d " % channel:
print("ttiQl355tp.get_current_limit() format error", ret)
return None
return float(ret[3:]) | [
"def",
"get_current_limit",
"(",
"self",
",",
"channel",
")",
":",
"ret",
"=",
"self",
".",
"ask",
"(",
"\"I%d?\"",
"%",
"channel",
")",
"if",
"ret",
"[",
":",
"3",
"]",
"!=",
"\"I%d \"",
"%",
"channel",
":",
"print",
"(",
"\"ttiQl355tp.get_current_limit... | channel: 1=OP1, 2=OP2, AUX is not supported | [
"channel",
":",
"1",
"=",
"OP1",
"2",
"=",
"OP2",
"AUX",
"is",
"not",
"supported"
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/HL/tti_ql355tp.py#L76-L82 |
SiLab-Bonn/basil | basil/HL/tti_ql355tp.py | ttiQl355tp.set_voltage | def set_voltage(self, value, channel=1):
""" channel: 1=OP1, 2=OP2, AUX is not supported"""
cmd = "V%d %f" % (channel, value)
self.write(cmd) | python | def set_voltage(self, value, channel=1):
""" channel: 1=OP1, 2=OP2, AUX is not supported"""
cmd = "V%d %f" % (channel, value)
self.write(cmd) | [
"def",
"set_voltage",
"(",
"self",
",",
"value",
",",
"channel",
"=",
"1",
")",
":",
"cmd",
"=",
"\"V%d %f\"",
"%",
"(",
"channel",
",",
"value",
")",
"self",
".",
"write",
"(",
"cmd",
")"
] | channel: 1=OP1, 2=OP2, AUX is not supported | [
"channel",
":",
"1",
"=",
"OP1",
"2",
"=",
"OP2",
"AUX",
"is",
"not",
"supported"
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/HL/tti_ql355tp.py#L84-L87 |
SiLab-Bonn/basil | basil/HL/tti_ql355tp.py | ttiQl355tp.set_current_limit | def set_current_limit(self, value, channel=1):
""" channel: 1=OP1, 2=OP2, AUX is not supported"""
cmd = "I%d %f" % (channel, value)
self.write(cmd) | python | def set_current_limit(self, value, channel=1):
""" channel: 1=OP1, 2=OP2, AUX is not supported"""
cmd = "I%d %f" % (channel, value)
self.write(cmd) | [
"def",
"set_current_limit",
"(",
"self",
",",
"value",
",",
"channel",
"=",
"1",
")",
":",
"cmd",
"=",
"\"I%d %f\"",
"%",
"(",
"channel",
",",
"value",
")",
"self",
".",
"write",
"(",
"cmd",
")"
] | channel: 1=OP1, 2=OP2, AUX is not supported | [
"channel",
":",
"1",
"=",
"OP1",
"2",
"=",
"OP2",
"AUX",
"is",
"not",
"supported"
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/HL/tti_ql355tp.py#L89-L92 |
SiLab-Bonn/basil | basil/HL/HardwareLayer.py | HardwareLayer.wait_for_ready | def wait_for_ready(self, timeout=None, times=None, delay=None, delay_between=None, abort=None):
'''Determine the ready state of the device and wait until device is ready.
Parameters
----------
timeout : int, float
The maximum amount of time to wait in seconds. Reaching the t... | python | def wait_for_ready(self, timeout=None, times=None, delay=None, delay_between=None, abort=None):
'''Determine the ready state of the device and wait until device is ready.
Parameters
----------
timeout : int, float
The maximum amount of time to wait in seconds. Reaching the t... | [
"def",
"wait_for_ready",
"(",
"self",
",",
"timeout",
"=",
"None",
",",
"times",
"=",
"None",
",",
"delay",
"=",
"None",
",",
"delay_between",
"=",
"None",
",",
"abort",
"=",
"None",
")",
":",
"if",
"delay",
":",
"try",
":",
"sleep",
"(",
"delay",
... | Determine the ready state of the device and wait until device is ready.
Parameters
----------
timeout : int, float
The maximum amount of time to wait in seconds. Reaching the timeout will raise a RuntimeError.
times : int
Maximum number of times reading the ready... | [
"Determine",
"the",
"ready",
"state",
"of",
"the",
"device",
"and",
"wait",
"until",
"device",
"is",
"ready",
"."
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/HL/HardwareLayer.py#L26-L71 |
SiLab-Bonn/basil | basil/HL/FEI4QuadModuleAdapterCard.py | DacMax5380._set_dac_value | def _set_dac_value(self, channel, value):
'''Write DAC
'''
self._intf.write(self._base_addr + self.MAX_5380_ADD, array('B', pack('B', value))) | python | def _set_dac_value(self, channel, value):
'''Write DAC
'''
self._intf.write(self._base_addr + self.MAX_5380_ADD, array('B', pack('B', value))) | [
"def",
"_set_dac_value",
"(",
"self",
",",
"channel",
",",
"value",
")",
":",
"self",
".",
"_intf",
".",
"write",
"(",
"self",
".",
"_base_addr",
"+",
"self",
".",
"MAX_5380_ADD",
",",
"array",
"(",
"'B'",
",",
"pack",
"(",
"'B'",
",",
"value",
")",
... | Write DAC | [
"Write",
"DAC"
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/HL/FEI4QuadModuleAdapterCard.py#L32-L35 |
SiLab-Bonn/basil | basil/HL/FEI4QuadModuleAdapterCard.py | DacDs4424._set_dac_value | def _set_dac_value(self, channel, value):
'''Write DAC
'''
# DAC value cannot be -128
if value == -128:
value = -127
if value < 0:
sign = 1
else:
sign = 0
value = (sign << 7) | (0x7F & abs(value))
self._intf.write(self._... | python | def _set_dac_value(self, channel, value):
'''Write DAC
'''
# DAC value cannot be -128
if value == -128:
value = -127
if value < 0:
sign = 1
else:
sign = 0
value = (sign << 7) | (0x7F & abs(value))
self._intf.write(self._... | [
"def",
"_set_dac_value",
"(",
"self",
",",
"channel",
",",
"value",
")",
":",
"# DAC value cannot be -128",
"if",
"value",
"==",
"-",
"128",
":",
"value",
"=",
"-",
"127",
"if",
"value",
"<",
"0",
":",
"sign",
"=",
"1",
"else",
":",
"sign",
"=",
"0",... | Write DAC | [
"Write",
"DAC"
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/HL/FEI4QuadModuleAdapterCard.py#L49-L60 |
SiLab-Bonn/basil | basil/HL/FEI4QuadModuleAdapterCard.py | FEI4QuadModuleAdapterCard.read_eeprom_calibration | def read_eeprom_calibration(self, temperature=False): # use default values for temperature, EEPROM values are usually not calibrated and random
'''Reading EEPROM calibration for power regulators and temperature
'''
header = self.get_format()
if header == self.HEADER_V2:
data... | python | def read_eeprom_calibration(self, temperature=False): # use default values for temperature, EEPROM values are usually not calibrated and random
'''Reading EEPROM calibration for power regulators and temperature
'''
header = self.get_format()
if header == self.HEADER_V2:
data... | [
"def",
"read_eeprom_calibration",
"(",
"self",
",",
"temperature",
"=",
"False",
")",
":",
"# use default values for temperature, EEPROM values are usually not calibrated and random",
"header",
"=",
"self",
".",
"get_format",
"(",
")",
"if",
"header",
"==",
"self",
".",
... | Reading EEPROM calibration for power regulators and temperature | [
"Reading",
"EEPROM",
"calibration",
"for",
"power",
"regulators",
"and",
"temperature"
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/HL/FEI4QuadModuleAdapterCard.py#L164-L191 |
SiLab-Bonn/basil | basil/HL/FEI4QuadModuleAdapterCard.py | FEI4QuadModuleAdapterCard.set_current_limit | def set_current_limit(self, channel, value, unit='A'):
'''Setting current limit
Note: same limit for all channels.
'''
dac_offset = self._ch_cal[channel]['DACI']['offset']
dac_gain = self._ch_cal[channel]['DACI']['gain']
if unit == 'raw':
value = value
... | python | def set_current_limit(self, channel, value, unit='A'):
'''Setting current limit
Note: same limit for all channels.
'''
dac_offset = self._ch_cal[channel]['DACI']['offset']
dac_gain = self._ch_cal[channel]['DACI']['gain']
if unit == 'raw':
value = value
... | [
"def",
"set_current_limit",
"(",
"self",
",",
"channel",
",",
"value",
",",
"unit",
"=",
"'A'",
")",
":",
"dac_offset",
"=",
"self",
".",
"_ch_cal",
"[",
"channel",
"]",
"[",
"'DACI'",
"]",
"[",
"'offset'",
"]",
"dac_gain",
"=",
"self",
".",
"_ch_cal",... | Setting current limit
Note: same limit for all channels. | [
"Setting",
"current",
"limit"
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/HL/FEI4QuadModuleAdapterCard.py#L226-L243 |
SiLab-Bonn/basil | basil/utils/sim/SiLibUsb.py | SiUSBDevice.DownloadXilinx | def DownloadXilinx(self, bitfile):
"""We hijack this call to perform the socket connect"""
self._sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self._sock.connect((self.simulation_host, self.simulation_port))
self._iface = PickleInterface(self._sock)
return True | python | def DownloadXilinx(self, bitfile):
"""We hijack this call to perform the socket connect"""
self._sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self._sock.connect((self.simulation_host, self.simulation_port))
self._iface = PickleInterface(self._sock)
return True | [
"def",
"DownloadXilinx",
"(",
"self",
",",
"bitfile",
")",
":",
"self",
".",
"_sock",
"=",
"socket",
".",
"socket",
"(",
"socket",
".",
"AF_INET",
",",
"socket",
".",
"SOCK_STREAM",
")",
"self",
".",
"_sock",
".",
"connect",
"(",
"(",
"self",
".",
"s... | We hijack this call to perform the socket connect | [
"We",
"hijack",
"this",
"call",
"to",
"perform",
"the",
"socket",
"connect"
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/utils/sim/SiLibUsb.py#L56-L61 |
SiLab-Bonn/basil | basil/HL/SussProber.py | SussProber.set_position | def set_position(self, x, y, speed=None):
''' Move chuck to absolute position in um'''
if speed:
self._intf.write('MoveChuckSubsite %1.1f %1.1f R Y %d' % (x, y, speed))
else:
self._intf.write('MoveChuckSubsite %1.1f %1.1f R Y' % (x, y)) | python | def set_position(self, x, y, speed=None):
''' Move chuck to absolute position in um'''
if speed:
self._intf.write('MoveChuckSubsite %1.1f %1.1f R Y %d' % (x, y, speed))
else:
self._intf.write('MoveChuckSubsite %1.1f %1.1f R Y' % (x, y)) | [
"def",
"set_position",
"(",
"self",
",",
"x",
",",
"y",
",",
"speed",
"=",
"None",
")",
":",
"if",
"speed",
":",
"self",
".",
"_intf",
".",
"write",
"(",
"'MoveChuckSubsite %1.1f %1.1f R Y %d'",
"%",
"(",
"x",
",",
"y",
",",
"speed",
")",
")",
"else"... | Move chuck to absolute position in um | [
"Move",
"chuck",
"to",
"absolute",
"position",
"in",
"um"
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/HL/SussProber.py#L20-L25 |
SiLab-Bonn/basil | basil/HL/SussProber.py | SussProber.move_position | def move_position(self, dx, dy, speed=None):
''' Move chuck relative to actual position in um'''
if speed:
self._intf.write('MoveChuckPosition %1.1f %1.1f R Y %d' % (dx, dy, speed))
else:
self._intf.write('MoveChuckPosition %1.1f %1.1f R Y' % (dx, dy)) | python | def move_position(self, dx, dy, speed=None):
''' Move chuck relative to actual position in um'''
if speed:
self._intf.write('MoveChuckPosition %1.1f %1.1f R Y %d' % (dx, dy, speed))
else:
self._intf.write('MoveChuckPosition %1.1f %1.1f R Y' % (dx, dy)) | [
"def",
"move_position",
"(",
"self",
",",
"dx",
",",
"dy",
",",
"speed",
"=",
"None",
")",
":",
"if",
"speed",
":",
"self",
".",
"_intf",
".",
"write",
"(",
"'MoveChuckPosition %1.1f %1.1f R Y %d'",
"%",
"(",
"dx",
",",
"dy",
",",
"speed",
")",
")",
... | Move chuck relative to actual position in um | [
"Move",
"chuck",
"relative",
"to",
"actual",
"position",
"in",
"um"
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/HL/SussProber.py#L27-L32 |
SiLab-Bonn/basil | basil/HL/SussProber.py | SussProber.get_position | def get_position(self):
''' Read chuck position (x, y, z)'''
reply = self._intf.query('ReadChuckPosition Y H')[2:]
return [float(i) for i in reply.split()] | python | def get_position(self):
''' Read chuck position (x, y, z)'''
reply = self._intf.query('ReadChuckPosition Y H')[2:]
return [float(i) for i in reply.split()] | [
"def",
"get_position",
"(",
"self",
")",
":",
"reply",
"=",
"self",
".",
"_intf",
".",
"query",
"(",
"'ReadChuckPosition Y H'",
")",
"[",
"2",
":",
"]",
"return",
"[",
"float",
"(",
"i",
")",
"for",
"i",
"in",
"reply",
".",
"split",
"(",
")",
"]"
] | Read chuck position (x, y, z) | [
"Read",
"chuck",
"position",
"(",
"x",
"y",
"z",
")"
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/HL/SussProber.py#L34-L37 |
SiLab-Bonn/basil | basil/HL/SussProber.py | SussProber.get_die | def get_die(self):
''' Move chuck to wafer map chip index'''
reply = self._intf.query('ReadMapPosition')
values = reply[2:].split(' ')
return (int(values[0]), int(values[1])) | python | def get_die(self):
''' Move chuck to wafer map chip index'''
reply = self._intf.query('ReadMapPosition')
values = reply[2:].split(' ')
return (int(values[0]), int(values[1])) | [
"def",
"get_die",
"(",
"self",
")",
":",
"reply",
"=",
"self",
".",
"_intf",
".",
"query",
"(",
"'ReadMapPosition'",
")",
"values",
"=",
"reply",
"[",
"2",
":",
"]",
".",
"split",
"(",
"' '",
")",
"return",
"(",
"int",
"(",
"values",
"[",
"0",
"]... | Move chuck to wafer map chip index | [
"Move",
"chuck",
"to",
"wafer",
"map",
"chip",
"index"
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/HL/SussProber.py#L51-L55 |
SiLab-Bonn/basil | basil/RL/TrackRegister.py | TrackRegister.clear | def clear(self):
'Clear tracks in memory - all zero'
for track in self._tracks:
self._tracks[track].setall(False) | python | def clear(self):
'Clear tracks in memory - all zero'
for track in self._tracks:
self._tracks[track].setall(False) | [
"def",
"clear",
"(",
"self",
")",
":",
"for",
"track",
"in",
"self",
".",
"_tracks",
":",
"self",
".",
"_tracks",
"[",
"track",
"]",
".",
"setall",
"(",
"False",
")"
] | Clear tracks in memory - all zero | [
"Clear",
"tracks",
"in",
"memory",
"-",
"all",
"zero"
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/RL/TrackRegister.py#L38-L41 |
SiLab-Bonn/basil | basil/HL/sitcp_fifo.py | sitcp_fifo.get_data | def get_data(self):
''' Reading data from SiTCP FIFO (via TCP).
Returns
-------
array : numpy.ndarray
Array of unsigned integers (32 bit).
'''
fifo_size = self._intf._get_tcp_data_size()
fifo_int_size = int((fifo_size - (fifo_size % 4)) / 4)
d... | python | def get_data(self):
''' Reading data from SiTCP FIFO (via TCP).
Returns
-------
array : numpy.ndarray
Array of unsigned integers (32 bit).
'''
fifo_size = self._intf._get_tcp_data_size()
fifo_int_size = int((fifo_size - (fifo_size % 4)) / 4)
d... | [
"def",
"get_data",
"(",
"self",
")",
":",
"fifo_size",
"=",
"self",
".",
"_intf",
".",
"_get_tcp_data_size",
"(",
")",
"fifo_int_size",
"=",
"int",
"(",
"(",
"fifo_size",
"-",
"(",
"fifo_size",
"%",
"4",
")",
")",
"/",
"4",
")",
"data",
"=",
"self",
... | Reading data from SiTCP FIFO (via TCP).
Returns
-------
array : numpy.ndarray
Array of unsigned integers (32 bit). | [
"Reading",
"data",
"from",
"SiTCP",
"FIFO",
"(",
"via",
"TCP",
")",
"."
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/HL/sitcp_fifo.py#L61-L72 |
SiLab-Bonn/basil | basil/HL/sitcp_fifo.py | sitcp_fifo.set_data | def set_data(self, data):
''' Sending data to via TCP.
Parameters
----------
data : array
Array of unsigned integers (32 bit).
'''
data = array.array('B', struct.unpack("{}B".format(len(data) * 4), struct.pack("{}I".format(len(data)), *data)))
self._i... | python | def set_data(self, data):
''' Sending data to via TCP.
Parameters
----------
data : array
Array of unsigned integers (32 bit).
'''
data = array.array('B', struct.unpack("{}B".format(len(data) * 4), struct.pack("{}I".format(len(data)), *data)))
self._i... | [
"def",
"set_data",
"(",
"self",
",",
"data",
")",
":",
"data",
"=",
"array",
".",
"array",
"(",
"'B'",
",",
"struct",
".",
"unpack",
"(",
"\"{}B\"",
".",
"format",
"(",
"len",
"(",
"data",
")",
"*",
"4",
")",
",",
"struct",
".",
"pack",
"(",
"\... | Sending data to via TCP.
Parameters
----------
data : array
Array of unsigned integers (32 bit). | [
"Sending",
"data",
"to",
"via",
"TCP",
"."
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/HL/sitcp_fifo.py#L74-L83 |
SiLab-Bonn/basil | examples/mio_pixel/pixel.py | Pixel.program_global_reg | def program_global_reg(self):
"""
Send the global register to the chip.
Loads the values of self['GLOBAL_REG'] onto the chip.
Includes enabling the clock, and loading the Control (CTR)
and DAC shadow registers.
"""
self._clear_strobes()
gr_size = len(s... | python | def program_global_reg(self):
"""
Send the global register to the chip.
Loads the values of self['GLOBAL_REG'] onto the chip.
Includes enabling the clock, and loading the Control (CTR)
and DAC shadow registers.
"""
self._clear_strobes()
gr_size = len(s... | [
"def",
"program_global_reg",
"(",
"self",
")",
":",
"self",
".",
"_clear_strobes",
"(",
")",
"gr_size",
"=",
"len",
"(",
"self",
"[",
"'GLOBAL_REG'",
"]",
"[",
":",
"]",
")",
"# get the size",
"self",
"[",
"'SEQ'",
"]",
"[",
"'SHIFT_IN'",
"]",
"[",
"0"... | Send the global register to the chip.
Loads the values of self['GLOBAL_REG'] onto the chip.
Includes enabling the clock, and loading the Control (CTR)
and DAC shadow registers. | [
"Send",
"the",
"global",
"register",
"to",
"the",
"chip",
"."
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/examples/mio_pixel/pixel.py#L24-L44 |
SiLab-Bonn/basil | examples/mio_pixel/pixel.py | Pixel.program_pixel_reg | def program_pixel_reg(self, enable_receiver=True):
"""
Send the pixel register to the chip and store the output.
Loads the values of self['PIXEL_REG'] onto the chip.
Includes enabling the clock, and loading the Control (CTR)
and DAC shadow registers.
if(enable_receiver)... | python | def program_pixel_reg(self, enable_receiver=True):
"""
Send the pixel register to the chip and store the output.
Loads the values of self['PIXEL_REG'] onto the chip.
Includes enabling the clock, and loading the Control (CTR)
and DAC shadow registers.
if(enable_receiver)... | [
"def",
"program_pixel_reg",
"(",
"self",
",",
"enable_receiver",
"=",
"True",
")",
":",
"self",
".",
"_clear_strobes",
"(",
")",
"# enable receiver it work only if pixel register is enabled/clocked",
"self",
"[",
"'PIXEL_RX'",
"]",
".",
"set_en",
"(",
"enable_receiver",... | Send the pixel register to the chip and store the output.
Loads the values of self['PIXEL_REG'] onto the chip.
Includes enabling the clock, and loading the Control (CTR)
and DAC shadow registers.
if(enable_receiver), stores the output (by byte) in
self['DATA'], retrievable via ... | [
"Send",
"the",
"pixel",
"register",
"to",
"the",
"chip",
"and",
"store",
"the",
"output",
"."
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/examples/mio_pixel/pixel.py#L46-L68 |
SiLab-Bonn/basil | examples/mio_pixel/pixel.py | Pixel._run_seq | def _run_seq(self, size):
"""
Send the contents of self['SEQ'] to the chip and wait until it finishes.
"""
# Write the sequence to the sequence generator (hw driver)
self['SEQ'].write(size) # write pattern to memory
self['SEQ'].set_size(size) # set size
self[... | python | def _run_seq(self, size):
"""
Send the contents of self['SEQ'] to the chip and wait until it finishes.
"""
# Write the sequence to the sequence generator (hw driver)
self['SEQ'].write(size) # write pattern to memory
self['SEQ'].set_size(size) # set size
self[... | [
"def",
"_run_seq",
"(",
"self",
",",
"size",
")",
":",
"# Write the sequence to the sequence generator (hw driver)",
"self",
"[",
"'SEQ'",
"]",
".",
"write",
"(",
"size",
")",
"# write pattern to memory",
"self",
"[",
"'SEQ'",
"]",
".",
"set_size",
"(",
"size",
... | Send the contents of self['SEQ'] to the chip and wait until it finishes. | [
"Send",
"the",
"contents",
"of",
"self",
"[",
"SEQ",
"]",
"to",
"the",
"chip",
"and",
"wait",
"until",
"it",
"finishes",
"."
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/examples/mio_pixel/pixel.py#L70-L84 |
SiLab-Bonn/basil | basil/HL/i2c.py | i2c.write | def write(self, addr, data):
'''Write access.
:param addr: i2c slave address
:type addr: char
:param data: array/list of bytes
:type data: iterable
:rtype: None
'''
self.set_addr(addr & 0xfe)
self.set_data(data)
self.set_size(... | python | def write(self, addr, data):
'''Write access.
:param addr: i2c slave address
:type addr: char
:param data: array/list of bytes
:type data: iterable
:rtype: None
'''
self.set_addr(addr & 0xfe)
self.set_data(data)
self.set_size(... | [
"def",
"write",
"(",
"self",
",",
"addr",
",",
"data",
")",
":",
"self",
".",
"set_addr",
"(",
"addr",
"&",
"0xfe",
")",
"self",
".",
"set_data",
"(",
"data",
")",
"self",
".",
"set_size",
"(",
"len",
"(",
"data",
")",
")",
"self",
".",
"start",
... | Write access.
:param addr: i2c slave address
:type addr: char
:param data: array/list of bytes
:type data: iterable
:rtype: None | [
"Write",
"access",
".",
":",
"param",
"addr",
":",
"i2c",
"slave",
"address",
":",
"type",
"addr",
":",
"char",
":",
"param",
"data",
":",
"array",
"/",
"list",
"of",
"bytes",
":",
"type",
"data",
":",
"iterable",
":",
"rtype",
":",
"None"
] | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/HL/i2c.py#L93-L108 |
SiLab-Bonn/basil | basil/HL/i2c.py | i2c.read | def read(self, addr, size):
'''Read access.
:param addr: i2c slave address
:type addr: char
:param size: size of transfer
:type size: int
:returns: data byte array
:rtype: array.array('B')
'''
self.set_addr(addr | 0x01)
self.s... | python | def read(self, addr, size):
'''Read access.
:param addr: i2c slave address
:type addr: char
:param size: size of transfer
:type size: int
:returns: data byte array
:rtype: array.array('B')
'''
self.set_addr(addr | 0x01)
self.s... | [
"def",
"read",
"(",
"self",
",",
"addr",
",",
"size",
")",
":",
"self",
".",
"set_addr",
"(",
"addr",
"|",
"0x01",
")",
"self",
".",
"set_size",
"(",
"size",
")",
"self",
".",
"start",
"(",
")",
"while",
"not",
"self",
".",
"is_ready",
":",
"pass... | Read access.
:param addr: i2c slave address
:type addr: char
:param size: size of transfer
:type size: int
:returns: data byte array
:rtype: array.array('B') | [
"Read",
"access",
".",
":",
"param",
"addr",
":",
"i2c",
"slave",
"address",
":",
"type",
"addr",
":",
"char",
":",
"param",
"size",
":",
"size",
"of",
"transfer",
":",
"type",
"size",
":",
"int",
":",
"returns",
":",
"data",
"byte",
"array",
":",
... | train | https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/HL/i2c.py#L110-L127 |
riga/law | law/parser.py | full_parser | def full_parser():
"""
Returns the full *ArgumentParser* used by the luigi ``CmdlineParser``. The returned instance is
cached.
"""
global _full_parser
if _full_parser:
return _full_parser
luigi_parser = luigi.cmdline_parser.CmdlineParser.get_instance()
if not luigi_parser:
... | python | def full_parser():
"""
Returns the full *ArgumentParser* used by the luigi ``CmdlineParser``. The returned instance is
cached.
"""
global _full_parser
if _full_parser:
return _full_parser
luigi_parser = luigi.cmdline_parser.CmdlineParser.get_instance()
if not luigi_parser:
... | [
"def",
"full_parser",
"(",
")",
":",
"global",
"_full_parser",
"if",
"_full_parser",
":",
"return",
"_full_parser",
"luigi_parser",
"=",
"luigi",
".",
"cmdline_parser",
".",
"CmdlineParser",
".",
"get_instance",
"(",
")",
"if",
"not",
"luigi_parser",
":",
"retur... | Returns the full *ArgumentParser* used by the luigi ``CmdlineParser``. The returned instance is
cached. | [
"Returns",
"the",
"full",
"*",
"ArgumentParser",
"*",
"used",
"by",
"the",
"luigi",
"CmdlineParser",
".",
"The",
"returned",
"instance",
"is",
"cached",
"."
] | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/parser.py#L27-L47 |
riga/law | law/parser.py | root_task_parser | def root_task_parser():
"""
Returns a new *ArgumentParser* instance that only contains paremeter actions of the root task.
The returned instance is cached.
"""
global _root_task_parser
if _root_task_parser:
return _root_task_parser
luigi_parser = luigi.cmdline_parser.CmdlineParser.... | python | def root_task_parser():
"""
Returns a new *ArgumentParser* instance that only contains paremeter actions of the root task.
The returned instance is cached.
"""
global _root_task_parser
if _root_task_parser:
return _root_task_parser
luigi_parser = luigi.cmdline_parser.CmdlineParser.... | [
"def",
"root_task_parser",
"(",
")",
":",
"global",
"_root_task_parser",
"if",
"_root_task_parser",
":",
"return",
"_root_task_parser",
"luigi_parser",
"=",
"luigi",
".",
"cmdline_parser",
".",
"CmdlineParser",
".",
"get_instance",
"(",
")",
"if",
"not",
"luigi_pars... | Returns a new *ArgumentParser* instance that only contains paremeter actions of the root task.
The returned instance is cached. | [
"Returns",
"a",
"new",
"*",
"ArgumentParser",
"*",
"instance",
"that",
"only",
"contains",
"paremeter",
"actions",
"of",
"the",
"root",
"task",
".",
"The",
"returned",
"instance",
"is",
"cached",
"."
] | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/parser.py#L50-L80 |
riga/law | law/parser.py | global_cmdline_args | def global_cmdline_args():
"""
Returns the list of command line arguments that do not belong to the root task. The returned
list is cached. Example:
.. code-block:: python
global_cmdline_args()
# -> ["--local-scheduler"]
"""
global _global_cmdline_args
if _global_cmdline_a... | python | def global_cmdline_args():
"""
Returns the list of command line arguments that do not belong to the root task. The returned
list is cached. Example:
.. code-block:: python
global_cmdline_args()
# -> ["--local-scheduler"]
"""
global _global_cmdline_args
if _global_cmdline_a... | [
"def",
"global_cmdline_args",
"(",
")",
":",
"global",
"_global_cmdline_args",
"if",
"_global_cmdline_args",
":",
"return",
"_global_cmdline_args",
"luigi_parser",
"=",
"luigi",
".",
"cmdline_parser",
".",
"CmdlineParser",
".",
"get_instance",
"(",
")",
"if",
"not",
... | Returns the list of command line arguments that do not belong to the root task. The returned
list is cached. Example:
.. code-block:: python
global_cmdline_args()
# -> ["--local-scheduler"] | [
"Returns",
"the",
"list",
"of",
"command",
"line",
"arguments",
"that",
"do",
"not",
"belong",
"to",
"the",
"root",
"task",
".",
"The",
"returned",
"list",
"is",
"cached",
".",
"Example",
":"
] | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/parser.py#L83-L104 |
riga/law | law/parser.py | global_cmdline_values | def global_cmdline_values():
"""
Returns a dictionary of global command line arguments (computed with
:py:func:`global_cmdline_args`) to their current values. The returnd dictionary is cached.
Example:
.. code-block:: python
global_cmdline_values()
# -> {"core_local_scheduler": Tru... | python | def global_cmdline_values():
"""
Returns a dictionary of global command line arguments (computed with
:py:func:`global_cmdline_args`) to their current values. The returnd dictionary is cached.
Example:
.. code-block:: python
global_cmdline_values()
# -> {"core_local_scheduler": Tru... | [
"def",
"global_cmdline_values",
"(",
")",
":",
"global",
"_global_cmdline_values",
"if",
"_global_cmdline_values",
":",
"return",
"_global_cmdline_values",
"luigi_parser",
"=",
"luigi",
".",
"cmdline_parser",
".",
"CmdlineParser",
".",
"get_instance",
"(",
")",
"if",
... | Returns a dictionary of global command line arguments (computed with
:py:func:`global_cmdline_args`) to their current values. The returnd dictionary is cached.
Example:
.. code-block:: python
global_cmdline_values()
# -> {"core_local_scheduler": True} | [
"Returns",
"a",
"dictionary",
"of",
"global",
"command",
"line",
"arguments",
"(",
"computed",
"with",
":",
"py",
":",
"func",
":",
"global_cmdline_args",
")",
"to",
"their",
"current",
"values",
".",
"The",
"returnd",
"dictionary",
"is",
"cached",
".",
"Exa... | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/parser.py#L107-L136 |
riga/law | law/parser.py | add_cmdline_arg | def add_cmdline_arg(args, arg, *values):
"""
Adds a command line argument *arg* to a list of argument *args*, e.g. as returned from
:py:func:`global_cmdline_args`. When *arg* exists, *args* is returned unchanged. Otherwise,
*arg* is appended to the end with optional argument *values*. Example:
.. c... | python | def add_cmdline_arg(args, arg, *values):
"""
Adds a command line argument *arg* to a list of argument *args*, e.g. as returned from
:py:func:`global_cmdline_args`. When *arg* exists, *args* is returned unchanged. Otherwise,
*arg* is appended to the end with optional argument *values*. Example:
.. c... | [
"def",
"add_cmdline_arg",
"(",
"args",
",",
"arg",
",",
"*",
"values",
")",
":",
"if",
"arg",
"not",
"in",
"args",
":",
"args",
"=",
"list",
"(",
"args",
")",
"+",
"[",
"arg",
"]",
"+",
"list",
"(",
"values",
")",
"return",
"args"
] | Adds a command line argument *arg* to a list of argument *args*, e.g. as returned from
:py:func:`global_cmdline_args`. When *arg* exists, *args* is returned unchanged. Otherwise,
*arg* is appended to the end with optional argument *values*. Example:
.. code-block:: python
args = global_cmdline_val... | [
"Adds",
"a",
"command",
"line",
"argument",
"*",
"arg",
"*",
"to",
"a",
"list",
"of",
"argument",
"*",
"args",
"*",
"e",
".",
"g",
".",
"as",
"returned",
"from",
":",
"py",
":",
"func",
":",
"global_cmdline_args",
".",
"When",
"*",
"arg",
"*",
"exi... | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/parser.py#L139-L158 |
riga/law | law/parser.py | remove_cmdline_arg | def remove_cmdline_arg(args, arg, n=1):
"""
Removes the command line argument *args* from a list of arguments *args*, e.g. as returned from
:py:func:`global_cmdline_args`. When *n* is 1 or less, only the argument is removed. Otherwise,
the following *n-1* values are removed. Example:
.. code-block:... | python | def remove_cmdline_arg(args, arg, n=1):
"""
Removes the command line argument *args* from a list of arguments *args*, e.g. as returned from
:py:func:`global_cmdline_args`. When *n* is 1 or less, only the argument is removed. Otherwise,
the following *n-1* values are removed. Example:
.. code-block:... | [
"def",
"remove_cmdline_arg",
"(",
"args",
",",
"arg",
",",
"n",
"=",
"1",
")",
":",
"if",
"arg",
"in",
"args",
":",
"idx",
"=",
"args",
".",
"index",
"(",
"arg",
")",
"args",
"=",
"list",
"(",
"args",
")",
"del",
"args",
"[",
"idx",
":",
"idx",... | Removes the command line argument *args* from a list of arguments *args*, e.g. as returned from
:py:func:`global_cmdline_args`. When *n* is 1 or less, only the argument is removed. Otherwise,
the following *n-1* values are removed. Example:
.. code-block:: python
args = global_cmdline_values()
... | [
"Removes",
"the",
"command",
"line",
"argument",
"*",
"args",
"*",
"from",
"a",
"list",
"of",
"arguments",
"*",
"args",
"*",
"e",
".",
"g",
".",
"as",
"returned",
"from",
":",
"py",
":",
"func",
":",
"global_cmdline_args",
".",
"When",
"*",
"n",
"*",... | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/parser.py#L161-L182 |
riga/law | law/target/file.py | split_transfer_kwargs | def split_transfer_kwargs(kwargs, skip=None):
"""
Takes keyword arguments *kwargs*, splits them into two separate dictionaries depending on their
content, and returns them in a tuple. The first one will contain arguments related to potential
file transfer operations (e.g. ``"cache"`` or ``"retries"``), ... | python | def split_transfer_kwargs(kwargs, skip=None):
"""
Takes keyword arguments *kwargs*, splits them into two separate dictionaries depending on their
content, and returns them in a tuple. The first one will contain arguments related to potential
file transfer operations (e.g. ``"cache"`` or ``"retries"``), ... | [
"def",
"split_transfer_kwargs",
"(",
"kwargs",
",",
"skip",
"=",
"None",
")",
":",
"skip",
"=",
"make_list",
"(",
"skip",
")",
"if",
"skip",
"else",
"[",
"]",
"transfer_kwargs",
"=",
"{",
"name",
":",
"kwargs",
".",
"pop",
"(",
"name",
")",
"for",
"n... | Takes keyword arguments *kwargs*, splits them into two separate dictionaries depending on their
content, and returns them in a tuple. The first one will contain arguments related to potential
file transfer operations (e.g. ``"cache"`` or ``"retries"``), while the second one will contain
all remaining argume... | [
"Takes",
"keyword",
"arguments",
"*",
"kwargs",
"*",
"splits",
"them",
"into",
"two",
"separate",
"dictionaries",
"depending",
"on",
"their",
"content",
"and",
"returns",
"them",
"in",
"a",
"tuple",
".",
"The",
"first",
"one",
"will",
"contain",
"arguments",
... | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/target/file.py#L323-L337 |
riga/law | law/workflow/remote.py | SubmissionData.job_data | def job_data(cls, job_id=dummy_job_id, branches=None, **kwargs):
"""
Returns a dictionary containing default job submission information such as the *job_id* and
task *branches* covered by the job.
"""
return dict(job_id=job_id, branches=branches or []) | python | def job_data(cls, job_id=dummy_job_id, branches=None, **kwargs):
"""
Returns a dictionary containing default job submission information such as the *job_id* and
task *branches* covered by the job.
"""
return dict(job_id=job_id, branches=branches or []) | [
"def",
"job_data",
"(",
"cls",
",",
"job_id",
"=",
"dummy_job_id",
",",
"branches",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"dict",
"(",
"job_id",
"=",
"job_id",
",",
"branches",
"=",
"branches",
"or",
"[",
"]",
")"
] | Returns a dictionary containing default job submission information such as the *job_id* and
task *branches* covered by the job. | [
"Returns",
"a",
"dictionary",
"containing",
"default",
"job",
"submission",
"information",
"such",
"as",
"the",
"*",
"job_id",
"*",
"and",
"task",
"*",
"branches",
"*",
"covered",
"by",
"the",
"job",
"."
] | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/workflow/remote.py#L51-L56 |
riga/law | law/workflow/remote.py | StatusData.job_data | def job_data(cls, job_id=dummy_job_id, status=None, code=None, error=None, **kwargs):
"""
Returns a dictionary containing default job status information such as the *job_id*, a job
*status* string, a job return code, and an *error* message.
"""
return dict(job_id=job_id, status=s... | python | def job_data(cls, job_id=dummy_job_id, status=None, code=None, error=None, **kwargs):
"""
Returns a dictionary containing default job status information such as the *job_id*, a job
*status* string, a job return code, and an *error* message.
"""
return dict(job_id=job_id, status=s... | [
"def",
"job_data",
"(",
"cls",
",",
"job_id",
"=",
"dummy_job_id",
",",
"status",
"=",
"None",
",",
"code",
"=",
"None",
",",
"error",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"dict",
"(",
"job_id",
"=",
"job_id",
",",
"status",
"=... | Returns a dictionary containing default job status information such as the *job_id*, a job
*status* string, a job return code, and an *error* message. | [
"Returns",
"a",
"dictionary",
"containing",
"default",
"job",
"status",
"information",
"such",
"as",
"the",
"*",
"job_id",
"*",
"a",
"job",
"*",
"status",
"*",
"string",
"a",
"job",
"return",
"code",
"and",
"an",
"*",
"error",
"*",
"message",
"."
] | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/workflow/remote.py#L91-L96 |
riga/law | law/workflow/remote.py | BaseRemoteWorkflowProxy._get_task_attribute | def _get_task_attribute(self, name, fallback=False):
"""
Return an attribute of the actial task named ``<workflow_type>_<name>``.
When the attribute does not exist and *fallback* is *True*, try to return the task attribute
simply named *name*. In any case, if a requested task attribute i... | python | def _get_task_attribute(self, name, fallback=False):
"""
Return an attribute of the actial task named ``<workflow_type>_<name>``.
When the attribute does not exist and *fallback* is *True*, try to return the task attribute
simply named *name*. In any case, if a requested task attribute i... | [
"def",
"_get_task_attribute",
"(",
"self",
",",
"name",
",",
"fallback",
"=",
"False",
")",
":",
"attr",
"=",
"\"{}_{}\"",
".",
"format",
"(",
"self",
".",
"workflow_type",
",",
"name",
")",
"if",
"not",
"fallback",
":",
"return",
"getattr",
"(",
"self",... | Return an attribute of the actial task named ``<workflow_type>_<name>``.
When the attribute does not exist and *fallback* is *True*, try to return the task attribute
simply named *name*. In any case, if a requested task attribute is eventually not found, an
AttributeError is raised. | [
"Return",
"an",
"attribute",
"of",
"the",
"actial",
"task",
"named",
"<workflow_type",
">",
"_<name",
">",
".",
"When",
"the",
"attribute",
"does",
"not",
"exist",
"and",
"*",
"fallback",
"*",
"is",
"*",
"True",
"*",
"try",
"to",
"return",
"the",
"task",... | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/workflow/remote.py#L258-L270 |
riga/law | law/workflow/remote.py | BaseRemoteWorkflowProxy.output | def output(self):
"""
Returns the default workflow outputs in an ordered dictionary. At the moment, this is the
collection of outputs of the branch tasks (key ``"collection"``), the submission file (key
``"submission"``), and the status file (key ``"status"``). These two *control outputs... | python | def output(self):
"""
Returns the default workflow outputs in an ordered dictionary. At the moment, this is the
collection of outputs of the branch tasks (key ``"collection"``), the submission file (key
``"submission"``), and the status file (key ``"status"``). These two *control outputs... | [
"def",
"output",
"(",
"self",
")",
":",
"task",
"=",
"self",
".",
"task",
"# get the directory where the control outputs are stored",
"out_dir",
"=",
"self",
".",
"_get_task_attribute",
"(",
"\"output_directory\"",
")",
"(",
")",
"# define outputs",
"outputs",
"=",
... | Returns the default workflow outputs in an ordered dictionary. At the moment, this is the
collection of outputs of the branch tasks (key ``"collection"``), the submission file (key
``"submission"``), and the status file (key ``"status"``). These two *control outputs* are
optional, i.e., they are... | [
"Returns",
"the",
"default",
"workflow",
"outputs",
"in",
"an",
"ordered",
"dictionary",
".",
"At",
"the",
"moment",
"this",
"is",
"the",
"collection",
"of",
"outputs",
"of",
"the",
"branch",
"tasks",
"(",
"key",
"collection",
")",
"the",
"submission",
"file... | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/workflow/remote.py#L282-L313 |
riga/law | law/workflow/remote.py | BaseRemoteWorkflowProxy.dump_submission_data | def dump_submission_data(self):
"""
Dumps the current submission data to the submission file.
"""
# renew the dashboard config
self.submission_data["dashboard_config"] = self.dashboard.get_persistent_config()
# write the submission data to the output file
self._o... | python | def dump_submission_data(self):
"""
Dumps the current submission data to the submission file.
"""
# renew the dashboard config
self.submission_data["dashboard_config"] = self.dashboard.get_persistent_config()
# write the submission data to the output file
self._o... | [
"def",
"dump_submission_data",
"(",
"self",
")",
":",
"# renew the dashboard config",
"self",
".",
"submission_data",
"[",
"\"dashboard_config\"",
"]",
"=",
"self",
".",
"dashboard",
".",
"get_persistent_config",
"(",
")",
"# write the submission data to the output file",
... | Dumps the current submission data to the submission file. | [
"Dumps",
"the",
"current",
"submission",
"data",
"to",
"the",
"submission",
"file",
"."
] | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/workflow/remote.py#L315-L323 |
riga/law | law/workflow/remote.py | BaseRemoteWorkflowProxy.run | def run(self):
"""
Actual run method that starts the processing of jobs and initiates the status polling, or
performs job cancelling or cleaning, depending on the task parameters.
"""
task = self.task
self._outputs = self.output()
# create the job dashboard inter... | python | def run(self):
"""
Actual run method that starts the processing of jobs and initiates the status polling, or
performs job cancelling or cleaning, depending on the task parameters.
"""
task = self.task
self._outputs = self.output()
# create the job dashboard inter... | [
"def",
"run",
"(",
"self",
")",
":",
"task",
"=",
"self",
".",
"task",
"self",
".",
"_outputs",
"=",
"self",
".",
"output",
"(",
")",
"# create the job dashboard interface",
"self",
".",
"dashboard",
"=",
"task",
".",
"create_job_dashboard",
"(",
")",
"or"... | Actual run method that starts the processing of jobs and initiates the status polling, or
performs job cancelling or cleaning, depending on the task parameters. | [
"Actual",
"run",
"method",
"that",
"starts",
"the",
"processing",
"of",
"jobs",
"and",
"initiates",
"the",
"status",
"polling",
"or",
"performs",
"job",
"cancelling",
"or",
"cleaning",
"depending",
"on",
"the",
"task",
"parameters",
"."
] | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/workflow/remote.py#L326-L400 |
riga/law | law/workflow/remote.py | BaseRemoteWorkflowProxy.cancel | def cancel(self):
"""
Cancels running jobs. The job ids are read from the submission file which has to exist
for obvious reasons.
"""
task = self.task
# get job ids from submission data
job_ids = [
d["job_id"] for d in self.submission_data.jobs.values... | python | def cancel(self):
"""
Cancels running jobs. The job ids are read from the submission file which has to exist
for obvious reasons.
"""
task = self.task
# get job ids from submission data
job_ids = [
d["job_id"] for d in self.submission_data.jobs.values... | [
"def",
"cancel",
"(",
"self",
")",
":",
"task",
"=",
"self",
".",
"task",
"# get job ids from submission data",
"job_ids",
"=",
"[",
"d",
"[",
"\"job_id\"",
"]",
"for",
"d",
"in",
"self",
".",
"submission_data",
".",
"jobs",
".",
"values",
"(",
")",
"if"... | Cancels running jobs. The job ids are read from the submission file which has to exist
for obvious reasons. | [
"Cancels",
"running",
"jobs",
".",
"The",
"job",
"ids",
"are",
"read",
"from",
"the",
"submission",
"file",
"which",
"has",
"to",
"exist",
"for",
"obvious",
"reasons",
"."
] | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/workflow/remote.py#L402-L436 |
riga/law | law/workflow/remote.py | BaseRemoteWorkflowProxy.cleanup | def cleanup(self):
"""
Cleans up jobs on the remote run location. The job ids are read from the submission file
which has to exist for obvious reasons.
"""
task = self.task
# get job ids from submission data
job_ids = [
d["job_id"] for d in self.submi... | python | def cleanup(self):
"""
Cleans up jobs on the remote run location. The job ids are read from the submission file
which has to exist for obvious reasons.
"""
task = self.task
# get job ids from submission data
job_ids = [
d["job_id"] for d in self.submi... | [
"def",
"cleanup",
"(",
"self",
")",
":",
"task",
"=",
"self",
".",
"task",
"# get job ids from submission data",
"job_ids",
"=",
"[",
"d",
"[",
"\"job_id\"",
"]",
"for",
"d",
"in",
"self",
".",
"submission_data",
".",
"jobs",
".",
"values",
"(",
")",
"if... | Cleans up jobs on the remote run location. The job ids are read from the submission file
which has to exist for obvious reasons. | [
"Cleans",
"up",
"jobs",
"on",
"the",
"remote",
"run",
"location",
".",
"The",
"job",
"ids",
"are",
"read",
"from",
"the",
"submission",
"file",
"which",
"has",
"to",
"exist",
"for",
"obvious",
"reasons",
"."
] | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/workflow/remote.py#L438-L468 |
riga/law | law/workflow/remote.py | BaseRemoteWorkflowProxy.submit | def submit(self, retry_jobs=None):
"""
Submits all jobs. When *retry_jobs* is *None*, a new job list is built. Otherwise,
previously failed jobs defined in the *retry_jobs* dictionary, which maps job numbers to
lists of branch numbers, are used.
"""
task = self.task
... | python | def submit(self, retry_jobs=None):
"""
Submits all jobs. When *retry_jobs* is *None*, a new job list is built. Otherwise,
previously failed jobs defined in the *retry_jobs* dictionary, which maps job numbers to
lists of branch numbers, are used.
"""
task = self.task
... | [
"def",
"submit",
"(",
"self",
",",
"retry_jobs",
"=",
"None",
")",
":",
"task",
"=",
"self",
".",
"task",
"# helper to check if a job can be skipped",
"# rule: skip a job when only_missing is set to True and all its branch tasks are complete",
"def",
"skip_job",
"(",
"job_num... | Submits all jobs. When *retry_jobs* is *None*, a new job list is built. Otherwise,
previously failed jobs defined in the *retry_jobs* dictionary, which maps job numbers to
lists of branch numbers, are used. | [
"Submits",
"all",
"jobs",
".",
"When",
"*",
"retry_jobs",
"*",
"is",
"*",
"None",
"*",
"a",
"new",
"job",
"list",
"is",
"built",
".",
"Otherwise",
"previously",
"failed",
"jobs",
"defined",
"in",
"the",
"*",
"retry_jobs",
"*",
"dictionary",
"which",
"map... | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/workflow/remote.py#L470-L597 |
riga/law | law/workflow/remote.py | BaseRemoteWorkflowProxy.poll | def poll(self):
"""
Initiates the job status polling loop.
"""
task = self.task
# total job count
n_jobs = len(self.submission_data)
# store the number of consecutive polling failures and get the maximum number of polls
n_poll_fails = 0
if task.w... | python | def poll(self):
"""
Initiates the job status polling loop.
"""
task = self.task
# total job count
n_jobs = len(self.submission_data)
# store the number of consecutive polling failures and get the maximum number of polls
n_poll_fails = 0
if task.w... | [
"def",
"poll",
"(",
"self",
")",
":",
"task",
"=",
"self",
".",
"task",
"# total job count",
"n_jobs",
"=",
"len",
"(",
"self",
".",
"submission_data",
")",
"# store the number of consecutive polling failures and get the maximum number of polls",
"n_poll_fails",
"=",
"0... | Initiates the job status polling loop. | [
"Initiates",
"the",
"job",
"status",
"polling",
"loop",
"."
] | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/workflow/remote.py#L599-L781 |
riga/law | law/workflow/remote.py | BaseRemoteWorkflowProxy.touch_control_outputs | def touch_control_outputs(self):
"""
Creates and saves dummy submission and status files. This method is called in case the
collection of branch task outputs exists.
"""
task = self.task
# create the parent directory
self._outputs["submission"].parent.touch()
... | python | def touch_control_outputs(self):
"""
Creates and saves dummy submission and status files. This method is called in case the
collection of branch task outputs exists.
"""
task = self.task
# create the parent directory
self._outputs["submission"].parent.touch()
... | [
"def",
"touch_control_outputs",
"(",
"self",
")",
":",
"task",
"=",
"self",
".",
"task",
"# create the parent directory",
"self",
".",
"_outputs",
"[",
"\"submission\"",
"]",
".",
"parent",
".",
"touch",
"(",
")",
"# get all branch indexes and chunk them by tasks_per_... | Creates and saves dummy submission and status files. This method is called in case the
collection of branch task outputs exists. | [
"Creates",
"and",
"saves",
"dummy",
"submission",
"and",
"status",
"files",
".",
"This",
"method",
"is",
"called",
"in",
"case",
"the",
"collection",
"of",
"branch",
"task",
"outputs",
"exists",
"."
] | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/workflow/remote.py#L783-L814 |
riga/law | law/workflow/remote.py | BaseRemoteWorkflow.forward_dashboard_event | def forward_dashboard_event(self, dashboard, job_data, event, job_num):
"""
Hook to preprocess and publish dashboard events. By default, every event is passed to the
dashboard's :py:meth:`law.job.dashboard.BaseJobDashboard.publish` method unchanged.
"""
# possible events:
... | python | def forward_dashboard_event(self, dashboard, job_data, event, job_num):
"""
Hook to preprocess and publish dashboard events. By default, every event is passed to the
dashboard's :py:meth:`law.job.dashboard.BaseJobDashboard.publish` method unchanged.
"""
# possible events:
... | [
"def",
"forward_dashboard_event",
"(",
"self",
",",
"dashboard",
",",
"job_data",
",",
"event",
",",
"job_num",
")",
":",
"# possible events:",
"# - action.submit",
"# - action.cancel",
"# - status.pending",
"# - status.running",
"# - status.finished",
"# - status... | Hook to preprocess and publish dashboard events. By default, every event is passed to the
dashboard's :py:meth:`law.job.dashboard.BaseJobDashboard.publish` method unchanged. | [
"Hook",
"to",
"preprocess",
"and",
"publish",
"dashboard",
"events",
".",
"By",
"default",
"every",
"event",
"is",
"passed",
"to",
"the",
"dashboard",
"s",
":",
"py",
":",
"meth",
":",
"law",
".",
"job",
".",
"dashboard",
".",
"BaseJobDashboard",
".",
"p... | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/workflow/remote.py#L973-L987 |
riga/law | law/target/local.py | LocalFileTarget.localize | def localize(self, mode="r", perm=None, parent_perm=None, **kwargs):
""" localize(mode="r", perm=None, parent_perm=None, skip_copy=False, is_tmp=None, **kwargs)
"""
if mode not in ("r", "w"):
raise Exception("unknown mode '{}', use r or w".format(mode))
# get additional argu... | python | def localize(self, mode="r", perm=None, parent_perm=None, **kwargs):
""" localize(mode="r", perm=None, parent_perm=None, skip_copy=False, is_tmp=None, **kwargs)
"""
if mode not in ("r", "w"):
raise Exception("unknown mode '{}', use r or w".format(mode))
# get additional argu... | [
"def",
"localize",
"(",
"self",
",",
"mode",
"=",
"\"r\"",
",",
"perm",
"=",
"None",
",",
"parent_perm",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"mode",
"not",
"in",
"(",
"\"r\"",
",",
"\"w\"",
")",
":",
"raise",
"Exception",
"(",
"... | localize(mode="r", perm=None, parent_perm=None, skip_copy=False, is_tmp=None, **kwargs) | [
"localize",
"(",
"mode",
"=",
"r",
"perm",
"=",
"None",
"parent_perm",
"=",
"None",
"skip_copy",
"=",
"False",
"is_tmp",
"=",
"None",
"**",
"kwargs",
")"
] | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/target/local.py#L252-L309 |
riga/law | law/cli/index.py | setup_parser | def setup_parser(sub_parsers):
"""
Sets up the command line parser for the *index* subprogram and adds it to *sub_parsers*.
"""
parser = sub_parsers.add_parser("index", prog="law index", description="Create or update the"
" (human-readable) law task index file ({}). This is only required for the... | python | def setup_parser(sub_parsers):
"""
Sets up the command line parser for the *index* subprogram and adds it to *sub_parsers*.
"""
parser = sub_parsers.add_parser("index", prog="law index", description="Create or update the"
" (human-readable) law task index file ({}). This is only required for the... | [
"def",
"setup_parser",
"(",
"sub_parsers",
")",
":",
"parser",
"=",
"sub_parsers",
".",
"add_parser",
"(",
"\"index\"",
",",
"prog",
"=",
"\"law index\"",
",",
"description",
"=",
"\"Create or update the\"",
"\" (human-readable) law task index file ({}). This is only requir... | Sets up the command line parser for the *index* subprogram and adds it to *sub_parsers*. | [
"Sets",
"up",
"the",
"command",
"line",
"parser",
"for",
"the",
"*",
"index",
"*",
"subprogram",
"and",
"adds",
"it",
"to",
"*",
"sub_parsers",
"*",
"."
] | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/cli/index.py#L22-L36 |
riga/law | law/cli/index.py | execute | def execute(args):
"""
Executes the *index* subprogram with parsed commandline *args*.
"""
index_file = Config.instance().get_expanded("core", "index_file")
# just print the file location?
if args.location:
print(index_file)
return
# just remove the index file?
if args.... | python | def execute(args):
"""
Executes the *index* subprogram with parsed commandline *args*.
"""
index_file = Config.instance().get_expanded("core", "index_file")
# just print the file location?
if args.location:
print(index_file)
return
# just remove the index file?
if args.... | [
"def",
"execute",
"(",
"args",
")",
":",
"index_file",
"=",
"Config",
".",
"instance",
"(",
")",
".",
"get_expanded",
"(",
"\"core\"",
",",
"\"index_file\"",
")",
"# just print the file location?",
"if",
"args",
".",
"location",
":",
"print",
"(",
"index_file"... | Executes the *index* subprogram with parsed commandline *args*. | [
"Executes",
"the",
"*",
"index",
"*",
"subprogram",
"with",
"parsed",
"commandline",
"*",
"args",
"*",
"."
] | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/cli/index.py#L39-L155 |
riga/law | law/cli/index.py | get_global_parameters | def get_global_parameters(config_names=("core", "scheduler", "worker", "retcode")):
"""
Returns a list of global, luigi-internal configuration parameters. Each list item is a 4-tuple
containing the configuration class, the parameter instance, the parameter name, and the full
parameter name in the cli. W... | python | def get_global_parameters(config_names=("core", "scheduler", "worker", "retcode")):
"""
Returns a list of global, luigi-internal configuration parameters. Each list item is a 4-tuple
containing the configuration class, the parameter instance, the parameter name, and the full
parameter name in the cli. W... | [
"def",
"get_global_parameters",
"(",
"config_names",
"=",
"(",
"\"core\"",
",",
"\"scheduler\"",
",",
"\"worker\"",
",",
"\"retcode\"",
")",
")",
":",
"params",
"=",
"[",
"]",
"for",
"cls",
"in",
"luigi",
".",
"task",
".",
"Config",
".",
"__subclasses__",
... | Returns a list of global, luigi-internal configuration parameters. Each list item is a 4-tuple
containing the configuration class, the parameter instance, the parameter name, and the full
parameter name in the cli. When *config_names* is set, it should be a list of configuration
class names that are exclusi... | [
"Returns",
"a",
"list",
"of",
"global",
"luigi",
"-",
"internal",
"configuration",
"parameters",
".",
"Each",
"list",
"item",
"is",
"a",
"4",
"-",
"tuple",
"containing",
"the",
"configuration",
"class",
"the",
"parameter",
"instance",
"the",
"parameter",
"name... | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/cli/index.py#L158-L181 |
riga/law | law/util.py | rel_path | def rel_path(anchor, *paths):
"""
Returns a path made of framgment *paths* relativ to an *anchor* path. When *anchor* is a file,
its absolute directory is used instead.
"""
anchor = os.path.abspath(os.path.expandvars(os.path.expanduser(anchor)))
if os.path.exists(anchor) and os.path.isfile(ancho... | python | def rel_path(anchor, *paths):
"""
Returns a path made of framgment *paths* relativ to an *anchor* path. When *anchor* is a file,
its absolute directory is used instead.
"""
anchor = os.path.abspath(os.path.expandvars(os.path.expanduser(anchor)))
if os.path.exists(anchor) and os.path.isfile(ancho... | [
"def",
"rel_path",
"(",
"anchor",
",",
"*",
"paths",
")",
":",
"anchor",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"expandvars",
"(",
"os",
".",
"path",
".",
"expanduser",
"(",
"anchor",
")",
")",
")",
"if",
"os",
".",
... | Returns a path made of framgment *paths* relativ to an *anchor* path. When *anchor* is a file,
its absolute directory is used instead. | [
"Returns",
"a",
"path",
"made",
"of",
"framgment",
"*",
"paths",
"*",
"relativ",
"to",
"an",
"*",
"anchor",
"*",
"path",
".",
"When",
"*",
"anchor",
"*",
"is",
"a",
"file",
"its",
"absolute",
"directory",
"is",
"used",
"instead",
"."
] | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/util.py#L54-L62 |
riga/law | law/util.py | law_home_path | def law_home_path(*paths):
"""
Returns the law home directory (``$LAW_HOME``) that defaults to ``"$HOME/.law"``, optionally
joined with *paths*.
"""
home = os.getenv("LAW_HOME", "$HOME/.law")
home = os.path.expandvars(os.path.expanduser(home))
return os.path.normpath(os.path.join(home, *path... | python | def law_home_path(*paths):
"""
Returns the law home directory (``$LAW_HOME``) that defaults to ``"$HOME/.law"``, optionally
joined with *paths*.
"""
home = os.getenv("LAW_HOME", "$HOME/.law")
home = os.path.expandvars(os.path.expanduser(home))
return os.path.normpath(os.path.join(home, *path... | [
"def",
"law_home_path",
"(",
"*",
"paths",
")",
":",
"home",
"=",
"os",
".",
"getenv",
"(",
"\"LAW_HOME\"",
",",
"\"$HOME/.law\"",
")",
"home",
"=",
"os",
".",
"path",
".",
"expandvars",
"(",
"os",
".",
"path",
".",
"expanduser",
"(",
"home",
")",
")... | Returns the law home directory (``$LAW_HOME``) that defaults to ``"$HOME/.law"``, optionally
joined with *paths*. | [
"Returns",
"the",
"law",
"home",
"directory",
"(",
"$LAW_HOME",
")",
"that",
"defaults",
"to",
"$HOME",
"/",
".",
"law",
"optionally",
"joined",
"with",
"*",
"paths",
"*",
"."
] | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/util.py#L72-L79 |
riga/law | law/util.py | print_err | def print_err(*args, **kwargs):
""" print_err(*args, flush=False)
Same as *print*, but outputs to stderr. If *flush* is *True*, stderr is flushed after printing.
"""
sys.stderr.write(" ".join(str(arg) for arg in args) + "\n")
if kwargs.get("flush", False):
sys.stderr.flush() | python | def print_err(*args, **kwargs):
""" print_err(*args, flush=False)
Same as *print*, but outputs to stderr. If *flush* is *True*, stderr is flushed after printing.
"""
sys.stderr.write(" ".join(str(arg) for arg in args) + "\n")
if kwargs.get("flush", False):
sys.stderr.flush() | [
"def",
"print_err",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"sys",
".",
"stderr",
".",
"write",
"(",
"\" \"",
".",
"join",
"(",
"str",
"(",
"arg",
")",
"for",
"arg",
"in",
"args",
")",
"+",
"\"\\n\"",
")",
"if",
"kwargs",
".",
"get... | print_err(*args, flush=False)
Same as *print*, but outputs to stderr. If *flush* is *True*, stderr is flushed after printing. | [
"print_err",
"(",
"*",
"args",
"flush",
"=",
"False",
")",
"Same",
"as",
"*",
"print",
"*",
"but",
"outputs",
"to",
"stderr",
".",
"If",
"*",
"flush",
"*",
"is",
"*",
"True",
"*",
"stderr",
"is",
"flushed",
"after",
"printing",
"."
] | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/util.py#L82-L88 |
riga/law | law/util.py | abort | def abort(msg=None, exitcode=1):
"""
Aborts the process (*sys.exit*) with an *exitcode*. If *msg* is not *None*, it is printed first
to stdout if *exitcode* is 0 or *None*, and to stderr otherwise.
"""
if msg is not None:
if exitcode in (None, 0):
print(msg)
else:
... | python | def abort(msg=None, exitcode=1):
"""
Aborts the process (*sys.exit*) with an *exitcode*. If *msg* is not *None*, it is printed first
to stdout if *exitcode* is 0 or *None*, and to stderr otherwise.
"""
if msg is not None:
if exitcode in (None, 0):
print(msg)
else:
... | [
"def",
"abort",
"(",
"msg",
"=",
"None",
",",
"exitcode",
"=",
"1",
")",
":",
"if",
"msg",
"is",
"not",
"None",
":",
"if",
"exitcode",
"in",
"(",
"None",
",",
"0",
")",
":",
"print",
"(",
"msg",
")",
"else",
":",
"print_err",
"(",
"msg",
")",
... | Aborts the process (*sys.exit*) with an *exitcode*. If *msg* is not *None*, it is printed first
to stdout if *exitcode* is 0 or *None*, and to stderr otherwise. | [
"Aborts",
"the",
"process",
"(",
"*",
"sys",
".",
"exit",
"*",
")",
"with",
"an",
"*",
"exitcode",
"*",
".",
"If",
"*",
"msg",
"*",
"is",
"not",
"*",
"None",
"*",
"it",
"is",
"printed",
"first",
"to",
"stdout",
"if",
"*",
"exitcode",
"*",
"is",
... | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/util.py#L91-L101 |
riga/law | law/util.py | colored | def colored(msg, color=None, background=None, style=None, force=False):
"""
Return the colored version of a string *msg*. For *color*, *background* and *style* options, see
https://misc.flogisoft.com/bash/tip_colors_and_formatting. Unless *force* is *True*, the *msg*
string is returned unchanged in case... | python | def colored(msg, color=None, background=None, style=None, force=False):
"""
Return the colored version of a string *msg*. For *color*, *background* and *style* options, see
https://misc.flogisoft.com/bash/tip_colors_and_formatting. Unless *force* is *True*, the *msg*
string is returned unchanged in case... | [
"def",
"colored",
"(",
"msg",
",",
"color",
"=",
"None",
",",
"background",
"=",
"None",
",",
"style",
"=",
"None",
",",
"force",
"=",
"False",
")",
":",
"try",
":",
"if",
"not",
"force",
"and",
"not",
"os",
".",
"isatty",
"(",
"sys",
".",
"stdou... | Return the colored version of a string *msg*. For *color*, *background* and *style* options, see
https://misc.flogisoft.com/bash/tip_colors_and_formatting. Unless *force* is *True*, the *msg*
string is returned unchanged in case the output is not a tty. | [
"Return",
"the",
"colored",
"version",
"of",
"a",
"string",
"*",
"msg",
"*",
".",
"For",
"*",
"color",
"*",
"*",
"background",
"*",
"and",
"*",
"style",
"*",
"options",
"see",
"https",
":",
"//",
"misc",
".",
"flogisoft",
".",
"com",
"/",
"bash",
"... | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/util.py#L157-L176 |
riga/law | law/util.py | query_choice | def query_choice(msg, choices, default=None, descriptions=None, lower=True):
"""
Interactively query a choice from the prompt until the input matches one of the *choices*. The
prompt can be configured using *msg* and *descriptions*, which, if set, must have the same
length as *choices*. When *default* i... | python | def query_choice(msg, choices, default=None, descriptions=None, lower=True):
"""
Interactively query a choice from the prompt until the input matches one of the *choices*. The
prompt can be configured using *msg* and *descriptions*, which, if set, must have the same
length as *choices*. When *default* i... | [
"def",
"query_choice",
"(",
"msg",
",",
"choices",
",",
"default",
"=",
"None",
",",
"descriptions",
"=",
"None",
",",
"lower",
"=",
"True",
")",
":",
"choices",
"=",
"_choices",
"=",
"[",
"str",
"(",
"c",
")",
"for",
"c",
"in",
"choices",
"]",
"if... | Interactively query a choice from the prompt until the input matches one of the *choices*. The
prompt can be configured using *msg* and *descriptions*, which, if set, must have the same
length as *choices*. When *default* is not *None* it must be one of the choices and is used when
the input is empty. When ... | [
"Interactively",
"query",
"a",
"choice",
"from",
"the",
"prompt",
"until",
"the",
"input",
"matches",
"one",
"of",
"the",
"*",
"choices",
"*",
".",
"The",
"prompt",
"can",
"be",
"configured",
"using",
"*",
"msg",
"*",
"and",
"*",
"descriptions",
"*",
"wh... | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/util.py#L186-L218 |
riga/law | law/util.py | multi_match | def multi_match(name, patterns, mode=any, regex=False):
"""
Compares *name* to multiple *patterns* and returns *True* in case of at least one match (*mode*
= *any*, the default), or in case all patterns matched (*mode* = *all*). Otherwise, *False* is
returned. When *regex* is *True*, *re.match* is used ... | python | def multi_match(name, patterns, mode=any, regex=False):
"""
Compares *name* to multiple *patterns* and returns *True* in case of at least one match (*mode*
= *any*, the default), or in case all patterns matched (*mode* = *all*). Otherwise, *False* is
returned. When *regex* is *True*, *re.match* is used ... | [
"def",
"multi_match",
"(",
"name",
",",
"patterns",
",",
"mode",
"=",
"any",
",",
"regex",
"=",
"False",
")",
":",
"if",
"not",
"regex",
":",
"return",
"mode",
"(",
"fnmatch",
".",
"fnmatch",
"(",
"name",
",",
"pattern",
")",
"for",
"pattern",
"in",
... | Compares *name* to multiple *patterns* and returns *True* in case of at least one match (*mode*
= *any*, the default), or in case all patterns matched (*mode* = *all*). Otherwise, *False* is
returned. When *regex* is *True*, *re.match* is used instead of *fnmatch.fnmatch*. | [
"Compares",
"*",
"name",
"*",
"to",
"multiple",
"*",
"patterns",
"*",
"and",
"returns",
"*",
"True",
"*",
"in",
"case",
"of",
"at",
"least",
"one",
"match",
"(",
"*",
"mode",
"*",
"=",
"*",
"any",
"*",
"the",
"default",
")",
"or",
"in",
"case",
"... | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/util.py#L221-L230 |
riga/law | law/util.py | is_lazy_iterable | def is_lazy_iterable(obj):
"""
Returns whether *obj* is iterable lazily, such as generators, range objects, etc.
"""
return isinstance(obj,
(types.GeneratorType, collections.MappingView, six.moves.range, enumerate)) | python | def is_lazy_iterable(obj):
"""
Returns whether *obj* is iterable lazily, such as generators, range objects, etc.
"""
return isinstance(obj,
(types.GeneratorType, collections.MappingView, six.moves.range, enumerate)) | [
"def",
"is_lazy_iterable",
"(",
"obj",
")",
":",
"return",
"isinstance",
"(",
"obj",
",",
"(",
"types",
".",
"GeneratorType",
",",
"collections",
".",
"MappingView",
",",
"six",
".",
"moves",
".",
"range",
",",
"enumerate",
")",
")"
] | Returns whether *obj* is iterable lazily, such as generators, range objects, etc. | [
"Returns",
"whether",
"*",
"obj",
"*",
"is",
"iterable",
"lazily",
"such",
"as",
"generators",
"range",
"objects",
"etc",
"."
] | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/util.py#L233-L238 |
riga/law | law/util.py | make_list | def make_list(obj, cast=True):
"""
Converts an object *obj* to a list and returns it. Objects of types *tuple* and *set* are
converted if *cast* is *True*. Otherwise, and for all other types, *obj* is put in a new list.
"""
if isinstance(obj, list):
return list(obj)
elif is_lazy_iterable... | python | def make_list(obj, cast=True):
"""
Converts an object *obj* to a list and returns it. Objects of types *tuple* and *set* are
converted if *cast* is *True*. Otherwise, and for all other types, *obj* is put in a new list.
"""
if isinstance(obj, list):
return list(obj)
elif is_lazy_iterable... | [
"def",
"make_list",
"(",
"obj",
",",
"cast",
"=",
"True",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"list",
")",
":",
"return",
"list",
"(",
"obj",
")",
"elif",
"is_lazy_iterable",
"(",
"obj",
")",
":",
"return",
"list",
"(",
"obj",
")",
"elif... | Converts an object *obj* to a list and returns it. Objects of types *tuple* and *set* are
converted if *cast* is *True*. Otherwise, and for all other types, *obj* is put in a new list. | [
"Converts",
"an",
"object",
"*",
"obj",
"*",
"to",
"a",
"list",
"and",
"returns",
"it",
".",
"Objects",
"of",
"types",
"*",
"tuple",
"*",
"and",
"*",
"set",
"*",
"are",
"converted",
"if",
"*",
"cast",
"*",
"is",
"*",
"True",
"*",
".",
"Otherwise",
... | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/util.py#L241-L253 |
riga/law | law/util.py | make_tuple | def make_tuple(obj, cast=True):
"""
Converts an object *obj* to a tuple and returns it. Objects of types *list* and *set* are
converted if *cast* is *True*. Otherwise, and for all other types, *obj* is put in a new tuple.
"""
if isinstance(obj, tuple):
return tuple(obj)
elif is_lazy_iter... | python | def make_tuple(obj, cast=True):
"""
Converts an object *obj* to a tuple and returns it. Objects of types *list* and *set* are
converted if *cast* is *True*. Otherwise, and for all other types, *obj* is put in a new tuple.
"""
if isinstance(obj, tuple):
return tuple(obj)
elif is_lazy_iter... | [
"def",
"make_tuple",
"(",
"obj",
",",
"cast",
"=",
"True",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"tuple",
")",
":",
"return",
"tuple",
"(",
"obj",
")",
"elif",
"is_lazy_iterable",
"(",
"obj",
")",
":",
"return",
"tuple",
"(",
"obj",
")",
"... | Converts an object *obj* to a tuple and returns it. Objects of types *list* and *set* are
converted if *cast* is *True*. Otherwise, and for all other types, *obj* is put in a new tuple. | [
"Converts",
"an",
"object",
"*",
"obj",
"*",
"to",
"a",
"tuple",
"and",
"returns",
"it",
".",
"Objects",
"of",
"types",
"*",
"list",
"*",
"and",
"*",
"set",
"*",
"are",
"converted",
"if",
"*",
"cast",
"*",
"is",
"*",
"True",
"*",
".",
"Otherwise",
... | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/util.py#L256-L268 |
riga/law | law/util.py | flatten | def flatten(struct):
"""
Flattens and returns a complex structured object *struct*.
"""
if isinstance(struct, dict):
return flatten(struct.values())
elif isinstance(struct, (list, tuple, set)) or is_lazy_iterable(struct):
objs = []
for obj in struct:
objs.extend(f... | python | def flatten(struct):
"""
Flattens and returns a complex structured object *struct*.
"""
if isinstance(struct, dict):
return flatten(struct.values())
elif isinstance(struct, (list, tuple, set)) or is_lazy_iterable(struct):
objs = []
for obj in struct:
objs.extend(f... | [
"def",
"flatten",
"(",
"struct",
")",
":",
"if",
"isinstance",
"(",
"struct",
",",
"dict",
")",
":",
"return",
"flatten",
"(",
"struct",
".",
"values",
"(",
")",
")",
"elif",
"isinstance",
"(",
"struct",
",",
"(",
"list",
",",
"tuple",
",",
"set",
... | Flattens and returns a complex structured object *struct*. | [
"Flattens",
"and",
"returns",
"a",
"complex",
"structured",
"object",
"*",
"struct",
"*",
"."
] | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/util.py#L271-L283 |
riga/law | law/util.py | merge_dicts | def merge_dicts(*dicts, **kwargs):
""" merge_dicts(*dicts, cls=None)
Takes multiple *dicts* and returns a single merged dict. The merging takes place in order of the
passed dicts and therefore, values of rear objects have precedence in case of field collisions.
The class of the returned merged dict is c... | python | def merge_dicts(*dicts, **kwargs):
""" merge_dicts(*dicts, cls=None)
Takes multiple *dicts* and returns a single merged dict. The merging takes place in order of the
passed dicts and therefore, values of rear objects have precedence in case of field collisions.
The class of the returned merged dict is c... | [
"def",
"merge_dicts",
"(",
"*",
"dicts",
",",
"*",
"*",
"kwargs",
")",
":",
"# get or infer the class",
"cls",
"=",
"kwargs",
".",
"get",
"(",
"\"cls\"",
",",
"None",
")",
"if",
"cls",
"is",
"None",
":",
"for",
"d",
"in",
"dicts",
":",
"if",
"isinsta... | merge_dicts(*dicts, cls=None)
Takes multiple *dicts* and returns a single merged dict. The merging takes place in order of the
passed dicts and therefore, values of rear objects have precedence in case of field collisions.
The class of the returned merged dict is configurable via *cls*. If it is *None*, the... | [
"merge_dicts",
"(",
"*",
"dicts",
"cls",
"=",
"None",
")",
"Takes",
"multiple",
"*",
"dicts",
"*",
"and",
"returns",
"a",
"single",
"merged",
"dict",
".",
"The",
"merging",
"takes",
"place",
"in",
"order",
"of",
"the",
"passed",
"dicts",
"and",
"therefor... | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/util.py#L286-L309 |
riga/law | law/util.py | which | def which(prog):
"""
Pythonic ``which`` implementation. Returns the path to an executable *prog* by searching in
*PATH*, or *None* when it could not be found.
"""
executable = lambda path: os.path.isfile(path) and os.access(path, os.X_OK)
# prog can also be a path
dirname, _ = os.path.split... | python | def which(prog):
"""
Pythonic ``which`` implementation. Returns the path to an executable *prog* by searching in
*PATH*, or *None* when it could not be found.
"""
executable = lambda path: os.path.isfile(path) and os.access(path, os.X_OK)
# prog can also be a path
dirname, _ = os.path.split... | [
"def",
"which",
"(",
"prog",
")",
":",
"executable",
"=",
"lambda",
"path",
":",
"os",
".",
"path",
".",
"isfile",
"(",
"path",
")",
"and",
"os",
".",
"access",
"(",
"path",
",",
"os",
".",
"X_OK",
")",
"# prog can also be a path",
"dirname",
",",
"_... | Pythonic ``which`` implementation. Returns the path to an executable *prog* by searching in
*PATH*, or *None* when it could not be found. | [
"Pythonic",
"which",
"implementation",
".",
"Returns",
"the",
"path",
"to",
"an",
"executable",
"*",
"prog",
"*",
"by",
"searching",
"in",
"*",
"PATH",
"*",
"or",
"*",
"None",
"*",
"when",
"it",
"could",
"not",
"be",
"found",
"."
] | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/util.py#L312-L330 |
riga/law | law/util.py | map_verbose | def map_verbose(func, seq, msg="{}", every=25, start=True, end=True, offset=0, callback=None):
"""
Same as the built-in map function but prints a *msg* after chunks of size *every* iterations.
When *start* (*stop*) is *True*, the *msg* is also printed after the first (last) iteration.
Note that *msg* is... | python | def map_verbose(func, seq, msg="{}", every=25, start=True, end=True, offset=0, callback=None):
"""
Same as the built-in map function but prints a *msg* after chunks of size *every* iterations.
When *start* (*stop*) is *True*, the *msg* is also printed after the first (last) iteration.
Note that *msg* is... | [
"def",
"map_verbose",
"(",
"func",
",",
"seq",
",",
"msg",
"=",
"\"{}\"",
",",
"every",
"=",
"25",
",",
"start",
"=",
"True",
",",
"end",
"=",
"True",
",",
"offset",
"=",
"0",
",",
"callback",
"=",
"None",
")",
":",
"# default callable",
"if",
"not... | Same as the built-in map function but prints a *msg* after chunks of size *every* iterations.
When *start* (*stop*) is *True*, the *msg* is also printed after the first (last) iteration.
Note that *msg* is supposed to be a template string that will be formatted with the current
iteration number (starting at... | [
"Same",
"as",
"the",
"built",
"-",
"in",
"map",
"function",
"but",
"prints",
"a",
"*",
"msg",
"*",
"after",
"chunks",
"of",
"size",
"*",
"every",
"*",
"iterations",
".",
"When",
"*",
"start",
"*",
"(",
"*",
"stop",
"*",
")",
"is",
"*",
"True",
"*... | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/util.py#L333-L368 |
riga/law | law/util.py | map_struct | def map_struct(func, struct, cls=None, map_dict=True, map_list=True, map_tuple=False,
map_set=False):
"""
Applies a function *func* to each value of a complex structured object *struct* and returns the
output in the same structure. Example:
.. code-block:: python
struct = {"foo": [123, ... | python | def map_struct(func, struct, cls=None, map_dict=True, map_list=True, map_tuple=False,
map_set=False):
"""
Applies a function *func* to each value of a complex structured object *struct* and returns the
output in the same structure. Example:
.. code-block:: python
struct = {"foo": [123, ... | [
"def",
"map_struct",
"(",
"func",
",",
"struct",
",",
"cls",
"=",
"None",
",",
"map_dict",
"=",
"True",
",",
"map_list",
"=",
"True",
",",
"map_tuple",
"=",
"False",
",",
"map_set",
"=",
"False",
")",
":",
"# interpret generators and views as lists",
"if",
... | Applies a function *func* to each value of a complex structured object *struct* and returns the
output in the same structure. Example:
.. code-block:: python
struct = {"foo": [123, 456], "bar": [{"1": 1}, {"2": 2}]}
def times_two(i):
return i * 2
map_struct(struct, times_two)
... | [
"Applies",
"a",
"function",
"*",
"func",
"*",
"to",
"each",
"value",
"of",
"a",
"complex",
"structured",
"object",
"*",
"struct",
"*",
"and",
"returns",
"the",
"output",
"in",
"the",
"same",
"structure",
".",
"Example",
":"
] | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/util.py#L371-L451 |
riga/law | law/util.py | mask_struct | def mask_struct(mask, struct, replace=no_value):
"""
Masks a complex structured object *struct* with a *mask* and returns the remaining values. When
*replace* is set, masked values are replaced with that value instead of being removed. The
*mask* can have a complex structure as well. Examples:
.. c... | python | def mask_struct(mask, struct, replace=no_value):
"""
Masks a complex structured object *struct* with a *mask* and returns the remaining values. When
*replace* is set, masked values are replaced with that value instead of being removed. The
*mask* can have a complex structure as well. Examples:
.. c... | [
"def",
"mask_struct",
"(",
"mask",
",",
"struct",
",",
"replace",
"=",
"no_value",
")",
":",
"# interpret lazy iterables lists",
"if",
"is_lazy_iterable",
"(",
"struct",
")",
":",
"struct",
"=",
"list",
"(",
"struct",
")",
"# when mask is a bool, or struct is not a ... | Masks a complex structured object *struct* with a *mask* and returns the remaining values. When
*replace* is set, masked values are replaced with that value instead of being removed. The
*mask* can have a complex structure as well. Examples:
.. code-block:: python
struct = {"a": [1, 2], "b": [3, [... | [
"Masks",
"a",
"complex",
"structured",
"object",
"*",
"struct",
"*",
"with",
"a",
"*",
"mask",
"*",
"and",
"returns",
"the",
"remaining",
"values",
".",
"When",
"*",
"replace",
"*",
"is",
"set",
"masked",
"values",
"are",
"replaced",
"with",
"that",
"val... | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/util.py#L454-L513 |
riga/law | law/util.py | tmp_file | def tmp_file(*args, **kwargs):
"""
Context manager that generates a temporary file, yields the file descriptor number and temporary
path, and eventually removes the files. All *args* and *kwargs* are passed to
:py:meth:`tempfile.mkstemp`.
"""
fileno, path = tempfile.mkstemp(*args, **kwargs)
... | python | def tmp_file(*args, **kwargs):
"""
Context manager that generates a temporary file, yields the file descriptor number and temporary
path, and eventually removes the files. All *args* and *kwargs* are passed to
:py:meth:`tempfile.mkstemp`.
"""
fileno, path = tempfile.mkstemp(*args, **kwargs)
... | [
"def",
"tmp_file",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"fileno",
",",
"path",
"=",
"tempfile",
".",
"mkstemp",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"# create the file",
"with",
"open",
"(",
"path",
",",
"\"w\"",
")",
"as... | Context manager that generates a temporary file, yields the file descriptor number and temporary
path, and eventually removes the files. All *args* and *kwargs* are passed to
:py:meth:`tempfile.mkstemp`. | [
"Context",
"manager",
"that",
"generates",
"a",
"temporary",
"file",
"yields",
"the",
"file",
"descriptor",
"number",
"and",
"temporary",
"path",
"and",
"eventually",
"removes",
"the",
"files",
".",
"All",
"*",
"args",
"*",
"and",
"*",
"kwargs",
"*",
"are",
... | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/util.py#L517-L534 |
riga/law | law/util.py | interruptable_popen | def interruptable_popen(*args, **kwargs):
"""
Shorthand to :py:class:`Popen` followed by :py:meth:`Popen.communicate`. All *args* and *kwargs*
are forwatded to the :py:class:`Popen` constructor. The return code, standard output and
standard error are returned in a tuple. The call :py:meth:`Popen.communi... | python | def interruptable_popen(*args, **kwargs):
"""
Shorthand to :py:class:`Popen` followed by :py:meth:`Popen.communicate`. All *args* and *kwargs*
are forwatded to the :py:class:`Popen` constructor. The return code, standard output and
standard error are returned in a tuple. The call :py:meth:`Popen.communi... | [
"def",
"interruptable_popen",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"\"preexec_fn\"",
"]",
"=",
"os",
".",
"setsid",
"p",
"=",
"subprocess",
".",
"Popen",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"try",
":",
"ou... | Shorthand to :py:class:`Popen` followed by :py:meth:`Popen.communicate`. All *args* and *kwargs*
are forwatded to the :py:class:`Popen` constructor. The return code, standard output and
standard error are returned in a tuple. The call :py:meth:`Popen.communicate` is interruptable
by the user. | [
"Shorthand",
"to",
":",
"py",
":",
"class",
":",
"Popen",
"followed",
"by",
":",
"py",
":",
"meth",
":",
"Popen",
".",
"communicate",
".",
"All",
"*",
"args",
"*",
"and",
"*",
"kwargs",
"*",
"are",
"forwatded",
"to",
"the",
":",
"py",
":",
"class",... | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/util.py#L537-L560 |
riga/law | law/util.py | readable_popen | def readable_popen(*args, **kwargs):
"""
Shorthand to :py:class:`Popen` which yields the output live line-by-line. All *args* and
*kwargs* are forwatded to the :py:class:`Popen` constructor. When EOF is reached,
``communicate()`` is called on the subprocess and it is yielded. Example:
.. code-block... | python | def readable_popen(*args, **kwargs):
"""
Shorthand to :py:class:`Popen` which yields the output live line-by-line. All *args* and
*kwargs* are forwatded to the :py:class:`Popen` constructor. When EOF is reached,
``communicate()`` is called on the subprocess and it is yielded. Example:
.. code-block... | [
"def",
"readable_popen",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# force pipes",
"kwargs",
"[",
"\"stdout\"",
"]",
"=",
"subprocess",
".",
"PIPE",
"kwargs",
"[",
"\"stderr\"",
"]",
"=",
"subprocess",
".",
"STDOUT",
"p",
"=",
"subprocess",
"... | Shorthand to :py:class:`Popen` which yields the output live line-by-line. All *args* and
*kwargs* are forwatded to the :py:class:`Popen` constructor. When EOF is reached,
``communicate()`` is called on the subprocess and it is yielded. Example:
.. code-block:: python
for line in readable_popen(["s... | [
"Shorthand",
"to",
":",
"py",
":",
"class",
":",
"Popen",
"which",
"yields",
"the",
"output",
"live",
"line",
"-",
"by",
"-",
"line",
".",
"All",
"*",
"args",
"*",
"and",
"*",
"kwargs",
"*",
"are",
"forwatded",
"to",
"the",
":",
"py",
":",
"class",... | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/util.py#L563-L592 |
riga/law | law/util.py | create_hash | def create_hash(inp, l=10, algo="sha256"):
"""
Takes an input *inp* and creates a hash based on an algorithm *algo*. For valid algorithms, see
python's hashlib. *l* corresponds to the maximum length of the returned hash. Internally, the
string representation of *inp* is used.
"""
return getattr(... | python | def create_hash(inp, l=10, algo="sha256"):
"""
Takes an input *inp* and creates a hash based on an algorithm *algo*. For valid algorithms, see
python's hashlib. *l* corresponds to the maximum length of the returned hash. Internally, the
string representation of *inp* is used.
"""
return getattr(... | [
"def",
"create_hash",
"(",
"inp",
",",
"l",
"=",
"10",
",",
"algo",
"=",
"\"sha256\"",
")",
":",
"return",
"getattr",
"(",
"hashlib",
",",
"algo",
")",
"(",
"six",
".",
"b",
"(",
"str",
"(",
"inp",
")",
")",
")",
".",
"hexdigest",
"(",
")",
"["... | Takes an input *inp* and creates a hash based on an algorithm *algo*. For valid algorithms, see
python's hashlib. *l* corresponds to the maximum length of the returned hash. Internally, the
string representation of *inp* is used. | [
"Takes",
"an",
"input",
"*",
"inp",
"*",
"and",
"creates",
"a",
"hash",
"based",
"on",
"an",
"algorithm",
"*",
"algo",
"*",
".",
"For",
"valid",
"algorithms",
"see",
"python",
"s",
"hashlib",
".",
"*",
"l",
"*",
"corresponds",
"to",
"the",
"maximum",
... | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/util.py#L595-L601 |
riga/law | law/util.py | copy_no_perm | def copy_no_perm(src, dst):
"""
Copies a file from *src* to *dst* including meta data except for permission bits.
"""
shutil.copy(src, dst)
perm = os.stat(dst).st_mode
shutil.copystat(src, dst)
os.chmod(dst, perm) | python | def copy_no_perm(src, dst):
"""
Copies a file from *src* to *dst* including meta data except for permission bits.
"""
shutil.copy(src, dst)
perm = os.stat(dst).st_mode
shutil.copystat(src, dst)
os.chmod(dst, perm) | [
"def",
"copy_no_perm",
"(",
"src",
",",
"dst",
")",
":",
"shutil",
".",
"copy",
"(",
"src",
",",
"dst",
")",
"perm",
"=",
"os",
".",
"stat",
"(",
"dst",
")",
".",
"st_mode",
"shutil",
".",
"copystat",
"(",
"src",
",",
"dst",
")",
"os",
".",
"ch... | Copies a file from *src* to *dst* including meta data except for permission bits. | [
"Copies",
"a",
"file",
"from",
"*",
"src",
"*",
"to",
"*",
"dst",
"*",
"including",
"meta",
"data",
"except",
"for",
"permission",
"bits",
"."
] | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/util.py#L604-L611 |
riga/law | law/util.py | makedirs_perm | def makedirs_perm(path, perm=None):
"""
Recursively creates directory up to *path*. If *perm* is set, the permissions of all newly
created directories are set to its value.
"""
if not os.path.exists(path):
if perm is None:
os.makedirs(path)
else:
umask = os.um... | python | def makedirs_perm(path, perm=None):
"""
Recursively creates directory up to *path*. If *perm* is set, the permissions of all newly
created directories are set to its value.
"""
if not os.path.exists(path):
if perm is None:
os.makedirs(path)
else:
umask = os.um... | [
"def",
"makedirs_perm",
"(",
"path",
",",
"perm",
"=",
"None",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"if",
"perm",
"is",
"None",
":",
"os",
".",
"makedirs",
"(",
"path",
")",
"else",
":",
"umask",
"=",
... | Recursively creates directory up to *path*. If *perm* is set, the permissions of all newly
created directories are set to its value. | [
"Recursively",
"creates",
"directory",
"up",
"to",
"*",
"path",
"*",
".",
"If",
"*",
"perm",
"*",
"is",
"set",
"the",
"permissions",
"of",
"all",
"newly",
"created",
"directories",
"are",
"set",
"to",
"its",
"value",
"."
] | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/util.py#L614-L627 |
riga/law | law/util.py | user_owns_file | def user_owns_file(path, uid=None):
"""
Returns whether a file located at *path* is owned by the user with *uid*. When *uid* is *None*,
the user id of the current process is used.
"""
if uid is None:
uid = os.getuid()
path = os.path.expandvars(os.path.expanduser(path))
return os.stat... | python | def user_owns_file(path, uid=None):
"""
Returns whether a file located at *path* is owned by the user with *uid*. When *uid* is *None*,
the user id of the current process is used.
"""
if uid is None:
uid = os.getuid()
path = os.path.expandvars(os.path.expanduser(path))
return os.stat... | [
"def",
"user_owns_file",
"(",
"path",
",",
"uid",
"=",
"None",
")",
":",
"if",
"uid",
"is",
"None",
":",
"uid",
"=",
"os",
".",
"getuid",
"(",
")",
"path",
"=",
"os",
".",
"path",
".",
"expandvars",
"(",
"os",
".",
"path",
".",
"expanduser",
"(",... | Returns whether a file located at *path* is owned by the user with *uid*. When *uid* is *None*,
the user id of the current process is used. | [
"Returns",
"whether",
"a",
"file",
"located",
"at",
"*",
"path",
"*",
"is",
"owned",
"by",
"the",
"user",
"with",
"*",
"uid",
"*",
".",
"When",
"*",
"uid",
"*",
"is",
"*",
"None",
"*",
"the",
"user",
"id",
"of",
"the",
"current",
"process",
"is",
... | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/util.py#L630-L638 |
riga/law | law/util.py | iter_chunks | def iter_chunks(l, size):
"""
Returns a generator containing chunks of *size* of a list, integer or generator *l*. A *size*
smaller than 1 results in no chunking at all.
"""
if isinstance(l, six.integer_types):
l = six.moves.range(l)
if is_lazy_iterable(l):
if size < 1:
... | python | def iter_chunks(l, size):
"""
Returns a generator containing chunks of *size* of a list, integer or generator *l*. A *size*
smaller than 1 results in no chunking at all.
"""
if isinstance(l, six.integer_types):
l = six.moves.range(l)
if is_lazy_iterable(l):
if size < 1:
... | [
"def",
"iter_chunks",
"(",
"l",
",",
"size",
")",
":",
"if",
"isinstance",
"(",
"l",
",",
"six",
".",
"integer_types",
")",
":",
"l",
"=",
"six",
".",
"moves",
".",
"range",
"(",
"l",
")",
"if",
"is_lazy_iterable",
"(",
"l",
")",
":",
"if",
"size... | Returns a generator containing chunks of *size* of a list, integer or generator *l*. A *size*
smaller than 1 results in no chunking at all. | [
"Returns",
"a",
"generator",
"containing",
"chunks",
"of",
"*",
"size",
"*",
"of",
"a",
"list",
"integer",
"or",
"generator",
"*",
"l",
"*",
".",
"A",
"*",
"size",
"*",
"smaller",
"than",
"1",
"results",
"in",
"no",
"chunking",
"at",
"all",
"."
] | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/util.py#L641-L669 |
riga/law | law/util.py | human_bytes | def human_bytes(n, unit=None):
"""
Takes a number of bytes *n*, assigns the best matching unit and returns the respective number
and unit string in a tuple. When *unit* is set, that unit is used. Example:
.. code-block:: python
human_bytes(3407872)
# -> (3.25, "MB")
human_byte... | python | def human_bytes(n, unit=None):
"""
Takes a number of bytes *n*, assigns the best matching unit and returns the respective number
and unit string in a tuple. When *unit* is set, that unit is used. Example:
.. code-block:: python
human_bytes(3407872)
# -> (3.25, "MB")
human_byte... | [
"def",
"human_bytes",
"(",
"n",
",",
"unit",
"=",
"None",
")",
":",
"if",
"n",
"==",
"0",
":",
"idx",
"=",
"0",
"elif",
"unit",
":",
"idx",
"=",
"byte_units",
".",
"index",
"(",
"unit",
")",
"else",
":",
"idx",
"=",
"int",
"(",
"math",
".",
"... | Takes a number of bytes *n*, assigns the best matching unit and returns the respective number
and unit string in a tuple. When *unit* is set, that unit is used. Example:
.. code-block:: python
human_bytes(3407872)
# -> (3.25, "MB")
human_bytes(3407872, "kB")
# -> (3328.0, "kB"... | [
"Takes",
"a",
"number",
"of",
"bytes",
"*",
"n",
"*",
"assigns",
"the",
"best",
"matching",
"unit",
"and",
"returns",
"the",
"respective",
"number",
"and",
"unit",
"string",
"in",
"a",
"tuple",
".",
"When",
"*",
"unit",
"*",
"is",
"set",
"that",
"unit"... | train | https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/util.py#L675-L695 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.