body_hash
stringlengths
64
64
body
stringlengths
23
109k
docstring
stringlengths
1
57k
path
stringlengths
4
198
name
stringlengths
1
115
repository_name
stringlengths
7
111
repository_stars
float64
0
191k
lang
stringclasses
1 value
body_without_docstring
stringlengths
14
108k
unified
stringlengths
45
133k
b902d17abe789d41104c59352edd738cb5bfd758e9b422c738da54594c712c45
def size(self, name=None): 'Compute the number of elements in this queue.\n\n Args:\n name: A name for the operation (optional).\n\n Returns:\n A scalar tensor containing the number of elements in this queue.\n ' if (name is None): name = ('%s_Size' % self._name) return gen_data_f...
Compute the number of elements in this queue. Args: name: A name for the operation (optional). Returns: A scalar tensor containing the number of elements in this queue.
tensorflow/python/ops/data_flow_ops.py
size
habangar/tensorflow
73
python
def size(self, name=None): 'Compute the number of elements in this queue.\n\n Args:\n name: A name for the operation (optional).\n\n Returns:\n A scalar tensor containing the number of elements in this queue.\n ' if (name is None): name = ('%s_Size' % self._name) return gen_data_f...
def size(self, name=None): 'Compute the number of elements in this queue.\n\n Args:\n name: A name for the operation (optional).\n\n Returns:\n A scalar tensor containing the number of elements in this queue.\n ' if (name is None): name = ('%s_Size' % self._name) return gen_data_f...
9a606c23df9d3bf8dced02f0098c09ac9d78d6716726c8d4dfe81e9e0b6aa069
def __init__(self, capacity, min_after_dequeue, dtypes, shapes=None, names=None, seed=None, shared_name=None, name='random_shuffle_queue'): 'Create a queue that dequeues elements in a random order.\n\n A `RandomShuffleQueue` has bounded capacity; supports multiple\n concurrent producers and consumers; and pro...
Create a queue that dequeues elements in a random order. A `RandomShuffleQueue` has bounded capacity; supports multiple concurrent producers and consumers; and provides exactly-once delivery. A `RandomShuffleQueue` holds a list of up to `capacity` elements. Each element is a fixed-length tuple of tensors whose dtypes...
tensorflow/python/ops/data_flow_ops.py
__init__
habangar/tensorflow
73
python
def __init__(self, capacity, min_after_dequeue, dtypes, shapes=None, names=None, seed=None, shared_name=None, name='random_shuffle_queue'): 'Create a queue that dequeues elements in a random order.\n\n A `RandomShuffleQueue` has bounded capacity; supports multiple\n concurrent producers and consumers; and pro...
def __init__(self, capacity, min_after_dequeue, dtypes, shapes=None, names=None, seed=None, shared_name=None, name='random_shuffle_queue'): 'Create a queue that dequeues elements in a random order.\n\n A `RandomShuffleQueue` has bounded capacity; supports multiple\n concurrent producers and consumers; and pro...
9910fa826977a547d74fc7ae5cca5464c315082a411d48ec9138fe4cf221cdae
def __init__(self, capacity, dtypes, shapes=None, names=None, shared_name=None, name='fifo_queue'): 'Creates a queue that dequeues elements in a first-in first-out order.\n\n A `FIFOQueue` has bounded capacity; supports multiple concurrent\n producers and consumers; and provides exactly-once delivery.\n\n ...
Creates a queue that dequeues elements in a first-in first-out order. A `FIFOQueue` has bounded capacity; supports multiple concurrent producers and consumers; and provides exactly-once delivery. A `FIFOQueue` holds a list of up to `capacity` elements. Each element is a fixed-length tuple of tensors whose dtypes are ...
tensorflow/python/ops/data_flow_ops.py
__init__
habangar/tensorflow
73
python
def __init__(self, capacity, dtypes, shapes=None, names=None, shared_name=None, name='fifo_queue'): 'Creates a queue that dequeues elements in a first-in first-out order.\n\n A `FIFOQueue` has bounded capacity; supports multiple concurrent\n producers and consumers; and provides exactly-once delivery.\n\n ...
def __init__(self, capacity, dtypes, shapes=None, names=None, shared_name=None, name='fifo_queue'): 'Creates a queue that dequeues elements in a first-in first-out order.\n\n A `FIFOQueue` has bounded capacity; supports multiple concurrent\n producers and consumers; and provides exactly-once delivery.\n\n ...
35c11710d0d177207522f9e1996a3c9d580c3653d45ece0c346b366bf5e44a3c
def __init__(self, capacity, dtypes, shapes, names=None, shared_name=None, name='padding_fifo_queue'): "Creates a queue that dequeues elements in a first-in first-out order.\n\n A `PaddingFIFOQueue` has bounded capacity; supports multiple concurrent\n producers and consumers; and provides exactly-once deliver...
Creates a queue that dequeues elements in a first-in first-out order. A `PaddingFIFOQueue` has bounded capacity; supports multiple concurrent producers and consumers; and provides exactly-once delivery. A `PaddingFIFOQueue` holds a list of up to `capacity` elements. Each element is a fixed-length tuple of tensors who...
tensorflow/python/ops/data_flow_ops.py
__init__
habangar/tensorflow
73
python
def __init__(self, capacity, dtypes, shapes, names=None, shared_name=None, name='padding_fifo_queue'): "Creates a queue that dequeues elements in a first-in first-out order.\n\n A `PaddingFIFOQueue` has bounded capacity; supports multiple concurrent\n producers and consumers; and provides exactly-once deliver...
def __init__(self, capacity, dtypes, shapes, names=None, shared_name=None, name='padding_fifo_queue'): "Creates a queue that dequeues elements in a first-in first-out order.\n\n A `PaddingFIFOQueue` has bounded capacity; supports multiple concurrent\n producers and consumers; and provides exactly-once deliver...
8dec1916ad6557ae2799eb622ef5db859ed9818cbb4e9979653a750f51f909cd
def parse(map_data_def, input) -> dict: ' Traverses a map-data: definition and calls value.parse on each value ' logger.debug(f'Entering: Key count = {len(map_data_def)}, data count = {(len(input) if isinstance(input, list) else 1)}') output = {} for key_value in map_data_def: if isinstance(key_...
Traverses a map-data: definition and calls value.parse on each value
data/map.py
parse
samadhicsec/threatware
0
python
def parse(map_data_def, input) -> dict: ' ' logger.debug(f'Entering: Key count = {len(map_data_def)}, data count = {(len(input) if isinstance(input, list) else 1)}') output = {} for key_value in map_data_def: if isinstance(key_value['key'], str): key_def = key.key(key_value['key']) ...
def parse(map_data_def, input) -> dict: ' ' logger.debug(f'Entering: Key count = {len(map_data_def)}, data count = {(len(input) if isinstance(input, list) else 1)}') output = {} for key_value in map_data_def: if isinstance(key_value['key'], str): key_def = key.key(key_value['key']) ...
216eb4fde65cbf2d3b89547b1f835cc31610133a16ffb2bd201b68d0536d5cce
def list_reserved_resources(): 'Displays the currently reserved resources on all agents via state.json;\n Currently for INFINITY-1881 where we believe uninstall may not be\n always doing its job correctly.' state_json_slaveinfo = dcos.mesos.DCOSClient().get_state_summary()['slaves'] for slave in...
Displays the currently reserved resources on all agents via state.json; Currently for INFINITY-1881 where we believe uninstall may not be always doing its job correctly.
testing/sdk_utils.py
list_reserved_resources
greggomann/dcos-commons
7
python
def list_reserved_resources(): 'Displays the currently reserved resources on all agents via state.json;\n Currently for INFINITY-1881 where we believe uninstall may not be\n always doing its job correctly.' state_json_slaveinfo = dcos.mesos.DCOSClient().get_state_summary()['slaves'] for slave in...
def list_reserved_resources(): 'Displays the currently reserved resources on all agents via state.json;\n Currently for INFINITY-1881 where we believe uninstall may not be\n always doing its job correctly.' state_json_slaveinfo = dcos.mesos.DCOSClient().get_state_summary()['slaves'] for slave in...
0657807e8261b6b6a4861a8856eff62c2fe9091d2c9721e662603d039f0013f0
def check_dcos_min_version_mark(item: pytest.Item): "Enforces the dcos_min_version pytest annotation, which should be used like this:\n\n @pytest.mark.dcos_min_version('1.10')\n def your_test_here(): ...\n\n In order for this annotation to take effect, this function must be called by a pytest_runtest_setup...
Enforces the dcos_min_version pytest annotation, which should be used like this: @pytest.mark.dcos_min_version('1.10') def your_test_here(): ... In order for this annotation to take effect, this function must be called by a pytest_runtest_setup() hook.
testing/sdk_utils.py
check_dcos_min_version_mark
greggomann/dcos-commons
7
python
def check_dcos_min_version_mark(item: pytest.Item): "Enforces the dcos_min_version pytest annotation, which should be used like this:\n\n @pytest.mark.dcos_min_version('1.10')\n def your_test_here(): ...\n\n In order for this annotation to take effect, this function must be called by a pytest_runtest_setup...
def check_dcos_min_version_mark(item: pytest.Item): "Enforces the dcos_min_version pytest annotation, which should be used like this:\n\n @pytest.mark.dcos_min_version('1.10')\n def your_test_here(): ...\n\n In order for this annotation to take effect, this function must be called by a pytest_runtest_setup...
1ca22585da97136f9398df3bbe5cb20c691d83b0ddc7aea9071a18dff84c2bd7
def is_open_dcos(): 'Determine if the tests are being run against open DC/OS. This is presently done by\n checking the envvar DCOS_ENTERPRISE.' return (not (os.environ.get('DCOS_ENTERPRISE', 'true').lower() == 'true'))
Determine if the tests are being run against open DC/OS. This is presently done by checking the envvar DCOS_ENTERPRISE.
testing/sdk_utils.py
is_open_dcos
greggomann/dcos-commons
7
python
def is_open_dcos(): 'Determine if the tests are being run against open DC/OS. This is presently done by\n checking the envvar DCOS_ENTERPRISE.' return (not (os.environ.get('DCOS_ENTERPRISE', 'true').lower() == 'true'))
def is_open_dcos(): 'Determine if the tests are being run against open DC/OS. This is presently done by\n checking the envvar DCOS_ENTERPRISE.' return (not (os.environ.get('DCOS_ENTERPRISE', 'true').lower() == 'true'))<|docstring|>Determine if the tests are being run against open DC/OS. This is presently don...
bb74f336e2cce520c6aec1b9398d47470139de814c36970067c5a51ffce23c6b
def is_strict_mode(): 'Determine if the tests are being run on a strict mode cluster.' return (os.environ.get('SECURITY', '') == 'strict')
Determine if the tests are being run on a strict mode cluster.
testing/sdk_utils.py
is_strict_mode
greggomann/dcos-commons
7
python
def is_strict_mode(): return (os.environ.get('SECURITY', ) == 'strict')
def is_strict_mode(): return (os.environ.get('SECURITY', ) == 'strict')<|docstring|>Determine if the tests are being run on a strict mode cluster.<|endoftext|>
50a53140288649f04327eacede9d5205cef4343e80fe5068a134769f9ca1f6f4
def get_in(keys, coll, default=None): " Reaches into nested associative data structures. Returns the value for path ``keys``.\n\n If the path doesn't exist returns ``default``.\n\n >>> transaction = {'name': 'Alice',\n ... 'purchase': {'items': ['Apple', 'Orange'],\n ... ...
Reaches into nested associative data structures. Returns the value for path ``keys``. If the path doesn't exist returns ``default``. >>> transaction = {'name': 'Alice', ... 'purchase': {'items': ['Apple', 'Orange'], ... 'costs': [0.50, 1.25]}, ... 'credit card...
testing/sdk_utils.py
get_in
greggomann/dcos-commons
7
python
def get_in(keys, coll, default=None): " Reaches into nested associative data structures. Returns the value for path ``keys``.\n\n If the path doesn't exist returns ``default``.\n\n >>> transaction = {'name': 'Alice',\n ... 'purchase': {'items': ['Apple', 'Orange'],\n ... ...
def get_in(keys, coll, default=None): " Reaches into nested associative data structures. Returns the value for path ``keys``.\n\n If the path doesn't exist returns ``default``.\n\n >>> transaction = {'name': 'Alice',\n ... 'purchase': {'items': ['Apple', 'Orange'],\n ... ...
f45e9c81930b2904fa35be67ff3ef3375e932a7e73d88f3262da1eb50e83e9b1
def saveJSON(fileName, data): '\n Function for/to <short description of `netpyne.sim.save.saveJSON`>\n\n Parameters\n ----------\n fileName : <type>\n <Short description of fileName>\n **Default:** *required*\n\n data : <type>\n <Short description of data>\n **Default:** *...
Function for/to <short description of `netpyne.sim.save.saveJSON`> Parameters ---------- fileName : <type> <Short description of fileName> **Default:** *required* data : <type> <Short description of data> **Default:** *required*
netpyne/sim/save.py
saveJSON
ghafari2019/netpyne
1
python
def saveJSON(fileName, data): '\n Function for/to <short description of `netpyne.sim.save.saveJSON`>\n\n Parameters\n ----------\n fileName : <type>\n <Short description of fileName>\n **Default:** *required*\n\n data : <type>\n <Short description of data>\n **Default:** *...
def saveJSON(fileName, data): '\n Function for/to <short description of `netpyne.sim.save.saveJSON`>\n\n Parameters\n ----------\n fileName : <type>\n <Short description of fileName>\n **Default:** *required*\n\n data : <type>\n <Short description of data>\n **Default:** *...
fdc283c3c5bb1c2c85c12fdec429c161c5108fc60866204d8e544a56bdd11755
def saveData(include=None, filename=None): '\n Function for/to <short description of `netpyne.sim.save.saveData`>\n\n Parameters\n ----------\n include : <``None``?>\n <Short description of include>\n **Default:** ``None``\n **Options:** ``<option>`` <description of option>\n\n f...
Function for/to <short description of `netpyne.sim.save.saveData`> Parameters ---------- include : <``None``?> <Short description of include> **Default:** ``None`` **Options:** ``<option>`` <description of option> filename : <``None``?> <Short description of filename> **Default:** ``None`` **O...
netpyne/sim/save.py
saveData
ghafari2019/netpyne
1
python
def saveData(include=None, filename=None): '\n Function for/to <short description of `netpyne.sim.save.saveData`>\n\n Parameters\n ----------\n include : <``None``?>\n <Short description of include>\n **Default:** ``None``\n **Options:** ``<option>`` <description of option>\n\n f...
def saveData(include=None, filename=None): '\n Function for/to <short description of `netpyne.sim.save.saveData`>\n\n Parameters\n ----------\n include : <``None``?>\n <Short description of include>\n **Default:** ``None``\n **Options:** ``<option>`` <description of option>\n\n f...
93a53853b250b1c8ab0880fe1d1a96d0e1aa53ec5b50c24f349f34984efbe245
def distributedSaveHDF5(): '\n Function for/to <short description of `netpyne.sim.save.distributedSaveHDF5`>\n\n\n ' from .. import sim import h5py if (sim.rank == 0): sim.timing('start', 'saveTimeHDF5') sim.compactConnFormat() conns = [([cell.gid] + conn) for cell in sim.net.cells...
Function for/to <short description of `netpyne.sim.save.distributedSaveHDF5`>
netpyne/sim/save.py
distributedSaveHDF5
ghafari2019/netpyne
1
python
def distributedSaveHDF5(): '\n \n\n\n ' from .. import sim import h5py if (sim.rank == 0): sim.timing('start', 'saveTimeHDF5') sim.compactConnFormat() conns = [([cell.gid] + conn) for cell in sim.net.cells for conn in cell.conns] conns = sim.copyRemoveItemObj(conns, keystart='h...
def distributedSaveHDF5(): '\n \n\n\n ' from .. import sim import h5py if (sim.rank == 0): sim.timing('start', 'saveTimeHDF5') sim.compactConnFormat() conns = [([cell.gid] + conn) for cell in sim.net.cells for conn in cell.conns] conns = sim.copyRemoveItemObj(conns, keystart='h...
51d6669f16669f6fb92ca10876c9bcef4cfac2d755f84d492b0a238a001daf1f
def compactConnFormat(): '\n Function for/to <short description of `netpyne.sim.save.compactConnFormat`>\n\n\n ' from .. import sim if (type(sim.cfg.compactConnFormat) is not list): if (len(sim.net.params.stimTargetParams) > 0): sim.cfg.compactConnFormat = ['preGid', 'preLabel', 's...
Function for/to <short description of `netpyne.sim.save.compactConnFormat`>
netpyne/sim/save.py
compactConnFormat
ghafari2019/netpyne
1
python
def compactConnFormat(): '\n \n\n\n ' from .. import sim if (type(sim.cfg.compactConnFormat) is not list): if (len(sim.net.params.stimTargetParams) > 0): sim.cfg.compactConnFormat = ['preGid', 'preLabel', 'sec', 'loc', 'synMech', 'weight', 'delay'] else: sim.cfg...
def compactConnFormat(): '\n \n\n\n ' from .. import sim if (type(sim.cfg.compactConnFormat) is not list): if (len(sim.net.params.stimTargetParams) > 0): sim.cfg.compactConnFormat = ['preGid', 'preLabel', 'sec', 'loc', 'synMech', 'weight', 'delay'] else: sim.cfg...
52737175f4c74b2339887f17813e08acd86903bb7835865a97ba017e1bd4442b
def intervalSave(t): '\n Function for/to <short description of `netpyne.sim.save.intervalSave`>\n\n Parameters\n ----------\n t : <type>\n <Short description of t>\n **Default:** *required*\n\n\n ' from .. import sim from ..specs import Dict import pickle, os import nump...
Function for/to <short description of `netpyne.sim.save.intervalSave`> Parameters ---------- t : <type> <Short description of t> **Default:** *required*
netpyne/sim/save.py
intervalSave
ghafari2019/netpyne
1
python
def intervalSave(t): '\n Function for/to <short description of `netpyne.sim.save.intervalSave`>\n\n Parameters\n ----------\n t : <type>\n <Short description of t>\n **Default:** *required*\n\n\n ' from .. import sim from ..specs import Dict import pickle, os import nump...
def intervalSave(t): '\n Function for/to <short description of `netpyne.sim.save.intervalSave`>\n\n Parameters\n ----------\n t : <type>\n <Short description of t>\n **Default:** *required*\n\n\n ' from .. import sim from ..specs import Dict import pickle, os import nump...
7dec5c6bba34e172ebed71397f681865763f0509d79286712d5f105bb6a5ba78
def saveDataInNodes(filename=None, saveLFP=True, removeTraces=False, dataDir=None): '\n Function to save simulation data by node rather than as a whole\n\n Parameters\n ----------\n filename : str\n The name to use for the saved files.\n **Default:** ``None``\n\n saveLFP : bool\n ...
Function to save simulation data by node rather than as a whole Parameters ---------- filename : str The name to use for the saved files. **Default:** ``None`` saveLFP : bool Whether to save any LFP data. **Default:** ``True`` saves LFP data. **Options:** ``False`` does not save LFP data. removeT...
netpyne/sim/save.py
saveDataInNodes
ghafari2019/netpyne
1
python
def saveDataInNodes(filename=None, saveLFP=True, removeTraces=False, dataDir=None): '\n Function to save simulation data by node rather than as a whole\n\n Parameters\n ----------\n filename : str\n The name to use for the saved files.\n **Default:** ``None``\n\n saveLFP : bool\n ...
def saveDataInNodes(filename=None, saveLFP=True, removeTraces=False, dataDir=None): '\n Function to save simulation data by node rather than as a whole\n\n Parameters\n ----------\n filename : str\n The name to use for the saved files.\n **Default:** ``None``\n\n saveLFP : bool\n ...
edff29e09386ea64f35aec9745c0faabe1d6f5655e44f06c0ceac7cf16ed62d8
def __init__(self, data: list, merger): '\n 初始化线段树\n __data:\n 区间内的数据\n __tree:\n 构建的线段树\n __merger:\n 自定义的融合规则,通常是 lambda 表达式传来的 function 对象\n ' self.__merger = merger self.__data = data self.__tree = (([None] * len(data)) * 4) ...
初始化线段树 __data: 区间内的数据 __tree: 构建的线段树 __merger: 自定义的融合规则,通常是 lambda 表达式传来的 function 对象
datastruct/segment_tree/SegmentTree.py
__init__
LibertyDream/algorithm_data_structure
0
python
def __init__(self, data: list, merger): '\n 初始化线段树\n __data:\n 区间内的数据\n __tree:\n 构建的线段树\n __merger:\n 自定义的融合规则,通常是 lambda 表达式传来的 function 对象\n ' self.__merger = merger self.__data = data self.__tree = (([None] * len(data)) * 4) ...
def __init__(self, data: list, merger): '\n 初始化线段树\n __data:\n 区间内的数据\n __tree:\n 构建的线段树\n __merger:\n 自定义的融合规则,通常是 lambda 表达式传来的 function 对象\n ' self.__merger = merger self.__data = data self.__tree = (([None] * len(data)) * 4) ...
f820ea559427a87d88fb39dda564ad56b66ce27b89fa0a0325a3f83a0bd1d3c7
def query(self, queryL: int, queryR: int): '\n 查询 [queryL...queryR] 范围内的内容\n ' if ((queryL < 0) or (queryL >= len(self.__data)) or (queryR < 0) or (queryR >= len(self.__data))): raise IndexError('Index is illegal') return self.__query(0, 0, (len(self.__data) - 1), queryL, queryR)
查询 [queryL...queryR] 范围内的内容
datastruct/segment_tree/SegmentTree.py
query
LibertyDream/algorithm_data_structure
0
python
def query(self, queryL: int, queryR: int): '\n \n ' if ((queryL < 0) or (queryL >= len(self.__data)) or (queryR < 0) or (queryR >= len(self.__data))): raise IndexError('Index is illegal') return self.__query(0, 0, (len(self.__data) - 1), queryL, queryR)
def query(self, queryL: int, queryR: int): '\n \n ' if ((queryL < 0) or (queryL >= len(self.__data)) or (queryR < 0) or (queryR >= len(self.__data))): raise IndexError('Index is illegal') return self.__query(0, 0, (len(self.__data) - 1), queryL, queryR)<|docstring|>查询 [queryL...que...
6361f8cc61fe2501ea265ab0208c356e2b1bd4784c3b28aa565e10fb10a81d3d
def __query(self, tree_index: int, left, right, queryL: int, queryR: int): '\n 查询以 treeIndex 为根,[left,right] 为界,目标范围为 [queryL,queryR] 中的内容\n ' if ((left == queryL) and (right == queryR)): return self.__tree[tree_index] mid = (left + ((right - left) // 2)) left_index = self.left...
查询以 treeIndex 为根,[left,right] 为界,目标范围为 [queryL,queryR] 中的内容
datastruct/segment_tree/SegmentTree.py
__query
LibertyDream/algorithm_data_structure
0
python
def __query(self, tree_index: int, left, right, queryL: int, queryR: int): '\n \n ' if ((left == queryL) and (right == queryR)): return self.__tree[tree_index] mid = (left + ((right - left) // 2)) left_index = self.left_child(tree_index) right_index = self.right_child(tree_...
def __query(self, tree_index: int, left, right, queryL: int, queryR: int): '\n \n ' if ((left == queryL) and (right == queryR)): return self.__tree[tree_index] mid = (left + ((right - left) // 2)) left_index = self.left_child(tree_index) right_index = self.right_child(tree_...
aa8445fe14d785f14bf9bb76d358fe4fa0223e9a0b75b907b149121322779d5b
def update(self, index: int, ele): '\n 更新 index 处的值为 ele\n ' if ((index < 0) or (index >= len(self.__data))): raise IndexError('Invalid index') self.__data[index] = ele self.__update(0, 0, (len(self.__data) - 1), index, ele)
更新 index 处的值为 ele
datastruct/segment_tree/SegmentTree.py
update
LibertyDream/algorithm_data_structure
0
python
def update(self, index: int, ele): '\n \n ' if ((index < 0) or (index >= len(self.__data))): raise IndexError('Invalid index') self.__data[index] = ele self.__update(0, 0, (len(self.__data) - 1), index, ele)
def update(self, index: int, ele): '\n \n ' if ((index < 0) or (index >= len(self.__data))): raise IndexError('Invalid index') self.__data[index] = ele self.__update(0, 0, (len(self.__data) - 1), index, ele)<|docstring|>更新 index 处的值为 ele<|endoftext|>
ab3a44092065a6f5bebe46144ff9c794c1aa0936b8df57340dd598de66db051d
def __update(self, tree_index: int, left: int, right: int, index: int, ele): '\n 在以 treeIndex 为根的 [left,right] 的区间内更新 index 处的值为 e\n ' if (left == right): self.__tree[tree_index] = ele return mid = (left + ((right - left) // 2)) left_index = self.left_child(tree_index) ...
在以 treeIndex 为根的 [left,right] 的区间内更新 index 处的值为 e
datastruct/segment_tree/SegmentTree.py
__update
LibertyDream/algorithm_data_structure
0
python
def __update(self, tree_index: int, left: int, right: int, index: int, ele): '\n \n ' if (left == right): self.__tree[tree_index] = ele return mid = (left + ((right - left) // 2)) left_index = self.left_child(tree_index) right_index = self.right_child(tree_index) ...
def __update(self, tree_index: int, left: int, right: int, index: int, ele): '\n \n ' if (left == right): self.__tree[tree_index] = ele return mid = (left + ((right - left) // 2)) left_index = self.left_child(tree_index) right_index = self.right_child(tree_index) ...
8841aa2f5f7cfe54440513b9b897ea05edf2ca51c30ed25be30f32bf26c39bb9
def rnacentral_id(context: Context, entry: HgncEntry) -> ty.Optional[str]: '\n Map HGNC ncRNAs to RNAcentral using RefSeq, Vega, gtRNAdb accessions\n and sequence matches.\n ' if entry.refseq_id: refseq_based = helpers.refseq_id_to_urs(context, entry.refseq_id) if refseq_based: ...
Map HGNC ncRNAs to RNAcentral using RefSeq, Vega, gtRNAdb accessions and sequence matches.
rnacentral_pipeline/databases/hgnc/parser.py
rnacentral_id
RNAcentral/rnacentral-import-pipeline
1
python
def rnacentral_id(context: Context, entry: HgncEntry) -> ty.Optional[str]: '\n Map HGNC ncRNAs to RNAcentral using RefSeq, Vega, gtRNAdb accessions\n and sequence matches.\n ' if entry.refseq_id: refseq_based = helpers.refseq_id_to_urs(context, entry.refseq_id) if refseq_based: ...
def rnacentral_id(context: Context, entry: HgncEntry) -> ty.Optional[str]: '\n Map HGNC ncRNAs to RNAcentral using RefSeq, Vega, gtRNAdb accessions\n and sequence matches.\n ' if entry.refseq_id: refseq_based = helpers.refseq_id_to_urs(context, entry.refseq_id) if refseq_based: ...
f0e31a426fb07b3e9817fd4fc01bdf56e4cc18fff7518a7a087ea1ac5599fce2
def test_basic(self) -> None: 'Test to create projectConfig class.' cfg = ProjectConfig(database='mydb', type='SQLite3 (SQLITE3)') self.assertTrue(cfg) self.assertEqual(cfg.SAVE_VERSION, VERSION_1_2)
Test to create projectConfig class.
pineboolib/loader/tests/test_projectconfig.py
test_basic
Aulla/pineboo
2
python
def test_basic(self) -> None: cfg = ProjectConfig(database='mydb', type='SQLite3 (SQLITE3)') self.assertTrue(cfg) self.assertEqual(cfg.SAVE_VERSION, VERSION_1_2)
def test_basic(self) -> None: cfg = ProjectConfig(database='mydb', type='SQLite3 (SQLITE3)') self.assertTrue(cfg) self.assertEqual(cfg.SAVE_VERSION, VERSION_1_2)<|docstring|>Test to create projectConfig class.<|endoftext|>
e4610f5cc717edfcabc423cacc07c27481c551876b198e794f081b4cf531d0e2
def test_read_write(self) -> None: 'Test that we can read a file, save it back, read it again and stays the same.' project_test1 = fixture_read('project_test1.xml') with tempfile.TemporaryDirectory() as tmpdirname: cfg = ProjectConfig(database='mydb', type='SQLite3 (SQLITE3)', filename=os.path.join(...
Test that we can read a file, save it back, read it again and stays the same.
pineboolib/loader/tests/test_projectconfig.py
test_read_write
Aulla/pineboo
2
python
def test_read_write(self) -> None: project_test1 = fixture_read('project_test1.xml') with tempfile.TemporaryDirectory() as tmpdirname: cfg = ProjectConfig(database='mydb', type='SQLite3 (SQLITE3)', filename=os.path.join(tmpdirname, 'test.xml')) cfg.SAVE_VERSION = VERSION_1_1 cfg.sav...
def test_read_write(self) -> None: project_test1 = fixture_read('project_test1.xml') with tempfile.TemporaryDirectory() as tmpdirname: cfg = ProjectConfig(database='mydb', type='SQLite3 (SQLITE3)', filename=os.path.join(tmpdirname, 'test.xml')) cfg.SAVE_VERSION = VERSION_1_1 cfg.sav...
61881d36da1311389b4105b9bdad06d5bdb541056b960e13babc80fc3e0fb23a
@patch('time.time') @patch('os.urandom') def test_read_write2(self, mock_urandom: Mock, mock_time: Mock) -> None: 'Test we can read and write and stays equal (slightly more complicated).' mock_urandom.side_effect = (lambda n: b'1234567890123456789012345678901234567890'[:n]) mock_time.side_effect = (lambda :...
Test we can read and write and stays equal (slightly more complicated).
pineboolib/loader/tests/test_projectconfig.py
test_read_write2
Aulla/pineboo
2
python
@patch('time.time') @patch('os.urandom') def test_read_write2(self, mock_urandom: Mock, mock_time: Mock) -> None: mock_urandom.side_effect = (lambda n: b'1234567890123456789012345678901234567890'[:n]) mock_time.side_effect = (lambda : 10000) project_test2 = fixture_read('project_test2.xml') project...
@patch('time.time') @patch('os.urandom') def test_read_write2(self, mock_urandom: Mock, mock_time: Mock) -> None: mock_urandom.side_effect = (lambda n: b'1234567890123456789012345678901234567890'[:n]) mock_time.side_effect = (lambda : 10000) project_test2 = fixture_read('project_test2.xml') project...
b9c337bef1270bd4274fe98fd77ee41df6f2f92a27fa902edeab811b629c984e
def check_experimenter_input(js): '\n Valida el input de entrada.\n\n Args:\n js (dict): Diccionario con el json parseado.\n ' experimenter_schema = get_full_schema() try: jsonschema.validate(js, experimenter_schema) except jsonschema.ValidationError as err: return models...
Valida el input de entrada. Args: js (dict): Diccionario con el json parseado.
experimenter/utils.py
check_experimenter_input
imfd/TextPerimenter
1
python
def check_experimenter_input(js): '\n Valida el input de entrada.\n\n Args:\n js (dict): Diccionario con el json parseado.\n ' experimenter_schema = get_full_schema() try: jsonschema.validate(js, experimenter_schema) except jsonschema.ValidationError as err: return models...
def check_experimenter_input(js): '\n Valida el input de entrada.\n\n Args:\n js (dict): Diccionario con el json parseado.\n ' experimenter_schema = get_full_schema() try: jsonschema.validate(js, experimenter_schema) except jsonschema.ValidationError as err: return models...
dc4b0a22ead3501ce673e543b8d925347e43c8fea96c3ef7b29a7eddc4367967
def creator(models_dic, metrics_dic): '\n Llama a las funciones creadoras de modelos y métricas.\n\n Args:\n models_dic (dict): Diccionario de modelos ingresados.\n metrics_dic (dict): Diccionario de métricas ingresadas.\n\n Returns:\n tuple: Tupla cuyo primer elemento corresponde a la...
Llama a las funciones creadoras de modelos y métricas. Args: models_dic (dict): Diccionario de modelos ingresados. metrics_dic (dict): Diccionario de métricas ingresadas. Returns: tuple: Tupla cuyo primer elemento corresponde a la lista de modelos instanciados, y el segundo elemento es una lis...
experimenter/utils.py
creator
imfd/TextPerimenter
1
python
def creator(models_dic, metrics_dic): '\n Llama a las funciones creadoras de modelos y métricas.\n\n Args:\n models_dic (dict): Diccionario de modelos ingresados.\n metrics_dic (dict): Diccionario de métricas ingresadas.\n\n Returns:\n tuple: Tupla cuyo primer elemento corresponde a la...
def creator(models_dic, metrics_dic): '\n Llama a las funciones creadoras de modelos y métricas.\n\n Args:\n models_dic (dict): Diccionario de modelos ingresados.\n metrics_dic (dict): Diccionario de métricas ingresadas.\n\n Returns:\n tuple: Tupla cuyo primer elemento corresponde a la...
6973ca05b195ede8ba60cc34d67d14203fbcaa9e7c9c0c4f751f3fc8f029ec1b
def filter_models(ranked_models, n): '\n Retorna los n primeros reportes de modelos.\n\n Args:\n ranked_models (list): Reportes de modelos ordenados.\n n (int): Cantidad de modelos a escoger.\n\n Returns:\n list: Lista de n reportes de modelos ordenados.\n ' if (n == 0): ...
Retorna los n primeros reportes de modelos. Args: ranked_models (list): Reportes de modelos ordenados. n (int): Cantidad de modelos a escoger. Returns: list: Lista de n reportes de modelos ordenados.
experimenter/utils.py
filter_models
imfd/TextPerimenter
1
python
def filter_models(ranked_models, n): '\n Retorna los n primeros reportes de modelos.\n\n Args:\n ranked_models (list): Reportes de modelos ordenados.\n n (int): Cantidad de modelos a escoger.\n\n Returns:\n list: Lista de n reportes de modelos ordenados.\n ' if (n == 0): ...
def filter_models(ranked_models, n): '\n Retorna los n primeros reportes de modelos.\n\n Args:\n ranked_models (list): Reportes de modelos ordenados.\n n (int): Cantidad de modelos a escoger.\n\n Returns:\n list: Lista de n reportes de modelos ordenados.\n ' if (n == 0): ...
7053215e44b30726254e35ee2a905960000c8d4e1690e73950d4edb0698e97e1
def get_optimizer_params(metrics_dic): '\n Función auxiliar, para obtener directamente los parámetros\n del optimizador.\n\n Args:\n metrics_dic (dict): Diccionario de métricas entregado en el input.\n\n Returns:\n tuple: Tupla de tres elementos. El primero corresponde a la label\n ...
Función auxiliar, para obtener directamente los parámetros del optimizador. Args: metrics_dic (dict): Diccionario de métricas entregado en el input. Returns: tuple: Tupla de tres elementos. El primero corresponde a la label según la cual se optimizará, mientras que el segundo es la mét...
experimenter/utils.py
get_optimizer_params
imfd/TextPerimenter
1
python
def get_optimizer_params(metrics_dic): '\n Función auxiliar, para obtener directamente los parámetros\n del optimizador.\n\n Args:\n metrics_dic (dict): Diccionario de métricas entregado en el input.\n\n Returns:\n tuple: Tupla de tres elementos. El primero corresponde a la label\n ...
def get_optimizer_params(metrics_dic): '\n Función auxiliar, para obtener directamente los parámetros\n del optimizador.\n\n Args:\n metrics_dic (dict): Diccionario de métricas entregado en el input.\n\n Returns:\n tuple: Tupla de tres elementos. El primero corresponde a la label\n ...
9e394327049d76181fdb69d1764d1b17cf0dcec0b2e96af036d7ac0089a0d27d
def metrics_creator(list_metrics): '\n Entrega las clases de las métricas introducidas.\n\n Args:\n list_metrics (list): Lista de strings con los nombres de las métricas.\n\n Returns:\n list: Lista de las clases de las métricas.\n ' metrics_mapping = get_metrics_mapping() return [m...
Entrega las clases de las métricas introducidas. Args: list_metrics (list): Lista de strings con los nombres de las métricas. Returns: list: Lista de las clases de las métricas.
experimenter/utils.py
metrics_creator
imfd/TextPerimenter
1
python
def metrics_creator(list_metrics): '\n Entrega las clases de las métricas introducidas.\n\n Args:\n list_metrics (list): Lista de strings con los nombres de las métricas.\n\n Returns:\n list: Lista de las clases de las métricas.\n ' metrics_mapping = get_metrics_mapping() return [m...
def metrics_creator(list_metrics): '\n Entrega las clases de las métricas introducidas.\n\n Args:\n list_metrics (list): Lista de strings con los nombres de las métricas.\n\n Returns:\n list: Lista de las clases de las métricas.\n ' metrics_mapping = get_metrics_mapping() return [m...
d6549024f8373c2f57ba790132afbdd4998d2f7962a7e24dafd6c10685e93f87
def models_creator(dic_models): '\n Inicializa los modelos.\n\n Args:\n dic_models (dict): Diccionario de modelos entregado en el input.\n\n Returns:\n list: Lista de modelos instanciados.\n ' models_mapping = get_models_mapping() models = [] for model_info in dic_models: ...
Inicializa los modelos. Args: dic_models (dict): Diccionario de modelos entregado en el input. Returns: list: Lista de modelos instanciados.
experimenter/utils.py
models_creator
imfd/TextPerimenter
1
python
def models_creator(dic_models): '\n Inicializa los modelos.\n\n Args:\n dic_models (dict): Diccionario de modelos entregado en el input.\n\n Returns:\n list: Lista de modelos instanciados.\n ' models_mapping = get_models_mapping() models = [] for model_info in dic_models: ...
def models_creator(dic_models): '\n Inicializa los modelos.\n\n Args:\n dic_models (dict): Diccionario de modelos entregado en el input.\n\n Returns:\n list: Lista de modelos instanciados.\n ' models_mapping = get_models_mapping() models = [] for model_info in dic_models: ...
6f01fd59625637bbce39567ccf15457a737a287b0c72403b3893782712809201
def models_preprocess(model, datasets_list): '\n Aplica el preprocesamiento de model en cada uno de los datasets contenidos\n en la lista datasets_list.\n\n Args:\n model (Model): Modelo instanciado.\n datasets_list (list): Lista de datasets a preprocesar.\n\n Returns:\n list: Lista...
Aplica el preprocesamiento de model en cada uno de los datasets contenidos en la lista datasets_list. Args: model (Model): Modelo instanciado. datasets_list (list): Lista de datasets a preprocesar. Returns: list: Lista de datasets preprocesados.
experimenter/utils.py
models_preprocess
imfd/TextPerimenter
1
python
def models_preprocess(model, datasets_list): '\n Aplica el preprocesamiento de model en cada uno de los datasets contenidos\n en la lista datasets_list.\n\n Args:\n model (Model): Modelo instanciado.\n datasets_list (list): Lista de datasets a preprocesar.\n\n Returns:\n list: Lista...
def models_preprocess(model, datasets_list): '\n Aplica el preprocesamiento de model en cada uno de los datasets contenidos\n en la lista datasets_list.\n\n Args:\n model (Model): Modelo instanciado.\n datasets_list (list): Lista de datasets a preprocesar.\n\n Returns:\n list: Lista...
0cf88e2d6e8cfd13a5307c8a2146646c07367db3d9bf95cf708ad4a713b6c34b
def get_set_result(models, metrics, X, y, exp_id): '\n Genera los resultados por metrica para una lista de modelos, dado un\n conjunto de entrenamiento (X e y), ademas guarda los resultados con un\n nombre unico.\n\n Args:\n models (list): Lista de listas que contienen los modelos.\n metri...
Genera los resultados por metrica para una lista de modelos, dado un conjunto de entrenamiento (X e y), ademas guarda los resultados con un nombre unico. Args: models (list): Lista de listas que contienen los modelos. metrics (list): Lista que contiene las metricas que se usaran para generar el reporte...
experimenter/utils.py
get_set_result
imfd/TextPerimenter
1
python
def get_set_result(models, metrics, X, y, exp_id): '\n Genera los resultados por metrica para una lista de modelos, dado un\n conjunto de entrenamiento (X e y), ademas guarda los resultados con un\n nombre unico.\n\n Args:\n models (list): Lista de listas que contienen los modelos.\n metri...
def get_set_result(models, metrics, X, y, exp_id): '\n Genera los resultados por metrica para una lista de modelos, dado un\n conjunto de entrenamiento (X e y), ademas guarda los resultados con un\n nombre unico.\n\n Args:\n models (list): Lista de listas que contienen los modelos.\n metri...
f8de4c7050c436dab54d4d39e04e15e87eeb020c5a1f3a1f10e5316d55fc67b7
def models_tester(models, metrics, X_test, y_test, exp_id): '\n Realiza predicciones con respecto al set de testeo de los mejores modelos\n obtenidos en el trainer. Se genera el output del experimenter, al cual se\n le añaden los reportes de desempeño.\n\n Args:\n models (list): Lista de listas, ...
Realiza predicciones con respecto al set de testeo de los mejores modelos obtenidos en el trainer. Se genera el output del experimenter, al cual se le añaden los reportes de desempeño. Args: models (list): Lista de listas, en donde cada lista interna corresponde a las n_best instancias de esa c...
experimenter/utils.py
models_tester
imfd/TextPerimenter
1
python
def models_tester(models, metrics, X_test, y_test, exp_id): '\n Realiza predicciones con respecto al set de testeo de los mejores modelos\n obtenidos en el trainer. Se genera el output del experimenter, al cual se\n le añaden los reportes de desempeño.\n\n Args:\n models (list): Lista de listas, ...
def models_tester(models, metrics, X_test, y_test, exp_id): '\n Realiza predicciones con respecto al set de testeo de los mejores modelos\n obtenidos en el trainer. Se genera el output del experimenter, al cual se\n le añaden los reportes de desempeño.\n\n Args:\n models (list): Lista de listas, ...
481b61c1f8b067604b5696164524e8e5c1608013d71b47ec8448774f2cfab682
def metrics_result(metrics, y_gold, y_pred): '\n Genera un reporte de desempeño de prediccción con respecto\n a las metricas especificadas. El reporte queda particionado\n por metrica.\n\n Args:\n metrics (list): Lista con las clases de las métricas especificadas.\n y_gold (array): Matriz ...
Genera un reporte de desempeño de prediccción con respecto a las metricas especificadas. El reporte queda particionado por metrica. Args: metrics (list): Lista con las clases de las métricas especificadas. y_gold (array): Matriz con las labels reales. y_pred (array): Matriz con las labels predichas. Retur...
experimenter/utils.py
metrics_result
imfd/TextPerimenter
1
python
def metrics_result(metrics, y_gold, y_pred): '\n Genera un reporte de desempeño de prediccción con respecto\n a las metricas especificadas. El reporte queda particionado\n por metrica.\n\n Args:\n metrics (list): Lista con las clases de las métricas especificadas.\n y_gold (array): Matriz ...
def metrics_result(metrics, y_gold, y_pred): '\n Genera un reporte de desempeño de prediccción con respecto\n a las metricas especificadas. El reporte queda particionado\n por metrica.\n\n Args:\n metrics (list): Lista con las clases de las métricas especificadas.\n y_gold (array): Matriz ...
1e779ece48bccc0477e5e61d6d46a60db140acbb52239cc2a968210220e5f150
def models_report(results): '\n Genera reporte de resultados por label o nivel.\n\n Args:\n results (dict): Diccionartio con los resultados por metrica\n\n Returns:\n dict: Reporte de desempeño, particionado por label o nivel.\n ' def union(metric_name, metric_value, report): ...
Genera reporte de resultados por label o nivel. Args: results (dict): Diccionartio con los resultados por metrica Returns: dict: Reporte de desempeño, particionado por label o nivel.
experimenter/utils.py
models_report
imfd/TextPerimenter
1
python
def models_report(results): '\n Genera reporte de resultados por label o nivel.\n\n Args:\n results (dict): Diccionartio con los resultados por metrica\n\n Returns:\n dict: Reporte de desempeño, particionado por label o nivel.\n ' def union(metric_name, metric_value, report): ...
def models_report(results): '\n Genera reporte de resultados por label o nivel.\n\n Args:\n results (dict): Diccionartio con los resultados por metrica\n\n Returns:\n dict: Reporte de desempeño, particionado por label o nivel.\n ' def union(metric_name, metric_value, report): ...
fa2d915e836b365004ab1d1145d99d2e84a4444d02efd98f02717d87f6773fd7
def models_trainer(models, X_train, X_val, y_train, y_val): '\n Entrena los modelos y genera reportes en base a todas\n las métricas.\n\n Args:\n models (list): Lista de listas de modelos, en donde cada lista interna\n corresponde a un modelo especificado en el input.\n ...
Entrena los modelos y genera reportes en base a todas las métricas. Args: models (list): Lista de listas de modelos, en donde cada lista interna corresponde a un modelo especificado en el input. X_train (array): Arreglo con textos de entrenamiento preprocesados. X_val (array): Arreglo c...
experimenter/utils.py
models_trainer
imfd/TextPerimenter
1
python
def models_trainer(models, X_train, X_val, y_train, y_val): '\n Entrena los modelos y genera reportes en base a todas\n las métricas.\n\n Args:\n models (list): Lista de listas de modelos, en donde cada lista interna\n corresponde a un modelo especificado en el input.\n ...
def models_trainer(models, X_train, X_val, y_train, y_val): '\n Entrena los modelos y genera reportes en base a todas\n las métricas.\n\n Args:\n models (list): Lista de listas de modelos, en donde cada lista interna\n corresponde a un modelo especificado en el input.\n ...
e5e6d4db130b0f908f44945d31726cedfab100890d883922ebdf5210b94d2358
def optimizer(reports, metrics_dic): '\n Genera un ranking de los mejores reportes con respecto a la etiqueta y\n métrica especificadas en el input. Luego, filtra los reportes de manera\n tal de dejar los n mejores (especificados por el usuario).\n\n Args:\n reports (list): Lista con los reportes...
Genera un ranking de los mejores reportes con respecto a la etiqueta y métrica especificadas en el input. Luego, filtra los reportes de manera tal de dejar los n mejores (especificados por el usuario). Args: reports (list): Lista con los reportes obtenidos en el trainer. metrics_dic (dict): Diccionario con las...
experimenter/utils.py
optimizer
imfd/TextPerimenter
1
python
def optimizer(reports, metrics_dic): '\n Genera un ranking de los mejores reportes con respecto a la etiqueta y\n métrica especificadas en el input. Luego, filtra los reportes de manera\n tal de dejar los n mejores (especificados por el usuario).\n\n Args:\n reports (list): Lista con los reportes...
def optimizer(reports, metrics_dic): '\n Genera un ranking de los mejores reportes con respecto a la etiqueta y\n métrica especificadas en el input. Luego, filtra los reportes de manera\n tal de dejar los n mejores (especificados por el usuario).\n\n Args:\n reports (list): Lista con los reportes...
2c20ad9d20e6142829f9ba6b79759a9ff52e35d374bdd6a2c93ba358c3c0299f
def rank_reports(unranked, label, metric): '\n Ordena una lista de listas de reportes con respecto a la label y métrica\n especificada.\n\n Args:\n unranked (list): Lista de listas de reportes.\n label (str): Nombre de la label con la cual se quiere optimizar.\n metric (str): Nombre de...
Ordena una lista de listas de reportes con respecto a la label y métrica especificada. Args: unranked (list): Lista de listas de reportes. label (str): Nombre de la label con la cual se quiere optimizar. metric (str): Nombre de la métrica con la cual se quiere optimizar.
experimenter/utils.py
rank_reports
imfd/TextPerimenter
1
python
def rank_reports(unranked, label, metric): '\n Ordena una lista de listas de reportes con respecto a la label y métrica\n especificada.\n\n Args:\n unranked (list): Lista de listas de reportes.\n label (str): Nombre de la label con la cual se quiere optimizar.\n metric (str): Nombre de...
def rank_reports(unranked, label, metric): '\n Ordena una lista de listas de reportes con respecto a la label y métrica\n especificada.\n\n Args:\n unranked (list): Lista de listas de reportes.\n label (str): Nombre de la label con la cual se quiere optimizar.\n metric (str): Nombre de...
51f58f37bdca21900fdc1fc666bd16d882d2b1fa8e2f0c19c3758a20a822dc79
def search_value(dic, first_key, second_key): '\n Retorna el valor obtenido de la métrica.\n\n Args:\n dic (dict): Diccionario que tiene un modelo y su reporte.\n first_key (str): String con la primera llave del reporte.\n second_key (str): String con la segunda llave del reporte.\n\n ...
Retorna el valor obtenido de la métrica. Args: dic (dict): Diccionario que tiene un modelo y su reporte. first_key (str): String con la primera llave del reporte. second_key (str): String con la segunda llave del reporte. Returns: float: Valor obtenido.
experimenter/utils.py
search_value
imfd/TextPerimenter
1
python
def search_value(dic, first_key, second_key): '\n Retorna el valor obtenido de la métrica.\n\n Args:\n dic (dict): Diccionario que tiene un modelo y su reporte.\n first_key (str): String con la primera llave del reporte.\n second_key (str): String con la segunda llave del reporte.\n\n ...
def search_value(dic, first_key, second_key): '\n Retorna el valor obtenido de la métrica.\n\n Args:\n dic (dict): Diccionario que tiene un modelo y su reporte.\n first_key (str): String con la primera llave del reporte.\n second_key (str): String con la segunda llave del reporte.\n\n ...
005b37c24a1da9aebb1fe1d605e5b0cc450da18e53f45de4e5812c4afafdd5c2
def set_params_to_list(js): '\n Inserta en listas los parámetros ingresados individualmente.\n\n Args:\n js (dict): Diccionario con los parámetros modificados.\n ' models = js['models'] if isinstance(models, dict): js['models'] = [models] for model in models: model_params...
Inserta en listas los parámetros ingresados individualmente. Args: js (dict): Diccionario con los parámetros modificados.
experimenter/utils.py
set_params_to_list
imfd/TextPerimenter
1
python
def set_params_to_list(js): '\n Inserta en listas los parámetros ingresados individualmente.\n\n Args:\n js (dict): Diccionario con los parámetros modificados.\n ' models = js['models'] if isinstance(models, dict): js['models'] = [models] for model in models: model_params...
def set_params_to_list(js): '\n Inserta en listas los parámetros ingresados individualmente.\n\n Args:\n js (dict): Diccionario con los parámetros modificados.\n ' models = js['models'] if isinstance(models, dict): js['models'] = [models] for model in models: model_params...
ee3e73767a128deacbdeacbc1c513afacbe847829c826332c22ba206a6b15bcb
@pytest.mark.parametrize('measured_dist,distance_measure_params,expected_mmd', [(BitstringDistribution({'000': 0.1, '111': 0.9}), {'sigma': 0.5}, 0.32000000000000006), (BitstringDistribution({'000': 0.5, '111': 0.5}), {'sigma': 1}, 0.0), (BitstringDistribution({'000': 0.5, '111': 0.5}), {'sigma': [1, 0.5, 2]}, 0.0)]) d...
Maximum mean discrepancy (MMD) with gaussian kernel between distributions is computed correctly.
tests/zquantum/core/bitstring_distribution/distance_measures/distance_measures_test.py
test_gaussian_mmd_is_computed_correctly
yukiizm/z-quantum-core
24
python
@pytest.mark.parametrize('measured_dist,distance_measure_params,expected_mmd', [(BitstringDistribution({'000': 0.1, '111': 0.9}), {'sigma': 0.5}, 0.32000000000000006), (BitstringDistribution({'000': 0.5, '111': 0.5}), {'sigma': 1}, 0.0), (BitstringDistribution({'000': 0.5, '111': 0.5}), {'sigma': [1, 0.5, 2]}, 0.0)]) d...
@pytest.mark.parametrize('measured_dist,distance_measure_params,expected_mmd', [(BitstringDistribution({'000': 0.1, '111': 0.9}), {'sigma': 0.5}, 0.32000000000000006), (BitstringDistribution({'000': 0.5, '111': 0.5}), {'sigma': 1}, 0.0), (BitstringDistribution({'000': 0.5, '111': 0.5}), {'sigma': [1, 0.5, 2]}, 0.0)]) d...
f4ba6bac1f5e0dc9c38f8067e14971de05c197e55676c420dcf0d29d5dad346c
def test_jensen_shannon_divergence_is_computed_correctly(): 'jensen shannon divergence between distributions is computed correctly.' target_distr = BitstringDistribution({'000': 0.5, '111': 0.5}) measured_dist = BitstringDistribution({'000': 0.1, '111': 0.9}) distance_measure_params = {'epsilon': 0.1} ...
jensen shannon divergence between distributions is computed correctly.
tests/zquantum/core/bitstring_distribution/distance_measures/distance_measures_test.py
test_jensen_shannon_divergence_is_computed_correctly
yukiizm/z-quantum-core
24
python
def test_jensen_shannon_divergence_is_computed_correctly(): target_distr = BitstringDistribution({'000': 0.5, '111': 0.5}) measured_dist = BitstringDistribution({'000': 0.1, '111': 0.9}) distance_measure_params = {'epsilon': 0.1} jensen_shannon_divergence = compute_jensen_shannon_divergence(target_...
def test_jensen_shannon_divergence_is_computed_correctly(): target_distr = BitstringDistribution({'000': 0.5, '111': 0.5}) measured_dist = BitstringDistribution({'000': 0.1, '111': 0.9}) distance_measure_params = {'epsilon': 0.1} jensen_shannon_divergence = compute_jensen_shannon_divergence(target_...
53206814c1af2002c93639fa917c9d8daedfc357a216206014d7b4af4f4cb42a
def run(self): 'Run (solve) the Genetic Algorithm.' for i in range(self.generations): log.info(f'Training population in generation {(i + 1)}...') if (i == 0): self.create_first_generation() else: self.create_next_generation() log.info(f'best individual: {s...
Run (solve) the Genetic Algorithm.
easynas/genetic_algorithm.py
run
erap129/EasyNAS
0
python
def run(self): for i in range(self.generations): log.info(f'Training population in generation {(i + 1)}...') if (i == 0): self.create_first_generation() else: self.create_next_generation() log.info(f'best individual: {self.best_individual()[1]}') ...
def run(self): for i in range(self.generations): log.info(f'Training population in generation {(i + 1)}...') if (i == 0): self.create_first_generation() else: self.create_next_generation() log.info(f'best individual: {self.best_individual()[1]}') ...
88d0b2eb98c3224b53536816a3094e7c4e7620c852cb09018684b9dc4e9b564d
def calculate_population_fitness(self): 'Calculate the fitness of every member of the given population using\n the supplied fitness_function.\n ' for individual in tqdm(self.current_generation): individual.fitness = self.fitness_function(individual.genes, self.seed_data) log.info(f'Cur...
Calculate the fitness of every member of the given population using the supplied fitness_function.
easynas/genetic_algorithm.py
calculate_population_fitness
erap129/EasyNAS
0
python
def calculate_population_fitness(self): 'Calculate the fitness of every member of the given population using\n the supplied fitness_function.\n ' for individual in tqdm(self.current_generation): individual.fitness = self.fitness_function(individual.genes, self.seed_data) log.info(f'Cur...
def calculate_population_fitness(self): 'Calculate the fitness of every member of the given population using\n the supplied fitness_function.\n ' for individual in tqdm(self.current_generation): individual.fitness = self.fitness_function(individual.genes, self.seed_data) log.info(f'Cur...
e42150652486303b224141080e5071b6fd0aabcdd00208d96c2d89141322883f
def test_return_type(self): '\n Invalid requests should still return a complete response dict\n ' self.assertIsInstance(self.response_dict, dict) self.assertEqual(len(self.response_dict), 6)
Invalid requests should still return a complete response dict
tests/test_response_handling.py
test_return_type
5150brien/retsdk
1
python
def test_return_type(self): '\n \n ' self.assertIsInstance(self.response_dict, dict) self.assertEqual(len(self.response_dict), 6)
def test_return_type(self): '\n \n ' self.assertIsInstance(self.response_dict, dict) self.assertEqual(len(self.response_dict), 6)<|docstring|>Invalid requests should still return a complete response dict<|endoftext|>
7447e23bbf40586bc27e2b27570897fcad8758bf61b8e2080f89a2c54d6754f2
def test_response_data_payload(self): "\n The 'rows' value should be an empty list (no data payload returned)\n " self.assertIsInstance(self.response_dict['rows'], list) self.assertEqual(len(self.response_dict['rows']), 0)
The 'rows' value should be an empty list (no data payload returned)
tests/test_response_handling.py
test_response_data_payload
5150brien/retsdk
1
python
def test_response_data_payload(self): "\n \n " self.assertIsInstance(self.response_dict['rows'], list) self.assertEqual(len(self.response_dict['rows']), 0)
def test_response_data_payload(self): "\n \n " self.assertIsInstance(self.response_dict['rows'], list) self.assertEqual(len(self.response_dict['rows']), 0)<|docstring|>The 'rows' value should be an empty list (no data payload returned)<|endoftext|>
835eae6137599f87ecebb12bb8a4df8311410a1156907e1974c4811f66510de5
def test_error_reply_code(self): '\n Reply code for bad requests should be non-null and non-zero\n ' self.assertIsNotNone(self.response_dict['reply_code']) self.assertNotEqual(self.response_dict['reply_code'], '') self.assertNotEqual(self.response_dict['reply_code'], '0')
Reply code for bad requests should be non-null and non-zero
tests/test_response_handling.py
test_error_reply_code
5150brien/retsdk
1
python
def test_error_reply_code(self): '\n \n ' self.assertIsNotNone(self.response_dict['reply_code']) self.assertNotEqual(self.response_dict['reply_code'], ) self.assertNotEqual(self.response_dict['reply_code'], '0')
def test_error_reply_code(self): '\n \n ' self.assertIsNotNone(self.response_dict['reply_code']) self.assertNotEqual(self.response_dict['reply_code'], ) self.assertNotEqual(self.response_dict['reply_code'], '0')<|docstring|>Reply code for bad requests should be non-null and non-zero<|endof...
229e1b6b04340446cbe53202e35393119e9346fcfece83130fc480727256fe78
def test_reply_text(self): '\n Reply text for bad requests should be non-null\n ' self.assertIsNotNone(self.response_dict['reply_text']) self.assertNotEqual(self.response_dict['reply_text'], '')
Reply text for bad requests should be non-null
tests/test_response_handling.py
test_reply_text
5150brien/retsdk
1
python
def test_reply_text(self): '\n \n ' self.assertIsNotNone(self.response_dict['reply_text']) self.assertNotEqual(self.response_dict['reply_text'], )
def test_reply_text(self): '\n \n ' self.assertIsNotNone(self.response_dict['reply_text']) self.assertNotEqual(self.response_dict['reply_text'], )<|docstring|>Reply text for bad requests should be non-null<|endoftext|>
e8fd10b09856bd1d27137f4c4c19a7326ed90644277aaa320db1655e1d7d40dd
def test_ok_value(self): "\n The response dict's 'ok' val should be False for bad requests\n " self.assertFalse(self.response_dict['ok'])
The response dict's 'ok' val should be False for bad requests
tests/test_response_handling.py
test_ok_value
5150brien/retsdk
1
python
def test_ok_value(self): "\n \n " self.assertFalse(self.response_dict['ok'])
def test_ok_value(self): "\n \n " self.assertFalse(self.response_dict['ok'])<|docstring|>The response dict's 'ok' val should be False for bad requests<|endoftext|>
bf056419043ff2133db3e8354916cccb5233b5961f1e851303c27a10f725aeaf
def test_more_rows_value(self): "\n The response dict's 'more_rows' val should be False for bad requests\n " self.assertFalse(self.response_dict['more_rows'])
The response dict's 'more_rows' val should be False for bad requests
tests/test_response_handling.py
test_more_rows_value
5150brien/retsdk
1
python
def test_more_rows_value(self): "\n \n " self.assertFalse(self.response_dict['more_rows'])
def test_more_rows_value(self): "\n \n " self.assertFalse(self.response_dict['more_rows'])<|docstring|>The response dict's 'more_rows' val should be False for bad requests<|endoftext|>
a73bd741b8e5b5517245e00ebc0231d4626ef8c46038ae6fb012f45bf47e04af
def test_response_rows(self): '\n The response dict should contain a list of values (can be empty)\n ' self.assertIsInstance(self.response_dict['rows'], list) self.assertGreaterEqual(len(self.response_dict['rows']), 0)
The response dict should contain a list of values (can be empty)
tests/test_response_handling.py
test_response_rows
5150brien/retsdk
1
python
def test_response_rows(self): '\n \n ' self.assertIsInstance(self.response_dict['rows'], list) self.assertGreaterEqual(len(self.response_dict['rows']), 0)
def test_response_rows(self): '\n \n ' self.assertIsInstance(self.response_dict['rows'], list) self.assertGreaterEqual(len(self.response_dict['rows']), 0)<|docstring|>The response dict should contain a list of values (can be empty)<|endoftext|>
dcae7e9cc1567d4ae81f81fe83fb68fdd978dd5cb9829466b57fc65c1863e3c6
def test_ok_value(self): "\n The response dict's 'ok' val should be True\n " self.assertTrue(self.response_dict['ok'])
The response dict's 'ok' val should be True
tests/test_response_handling.py
test_ok_value
5150brien/retsdk
1
python
def test_ok_value(self): "\n \n " self.assertTrue(self.response_dict['ok'])
def test_ok_value(self): "\n \n " self.assertTrue(self.response_dict['ok'])<|docstring|>The response dict's 'ok' val should be True<|endoftext|>
b49c1259e8e2e7dd5ea1228236cadcfd3a26805a7e3905800ae5d90e5201278b
def test_more_rows_value(self): "\n The response dict's 'more_rows' val should be False\n " self.assertFalse(self.response_dict['more_rows'])
The response dict's 'more_rows' val should be False
tests/test_response_handling.py
test_more_rows_value
5150brien/retsdk
1
python
def test_more_rows_value(self): "\n \n " self.assertFalse(self.response_dict['more_rows'])
def test_more_rows_value(self): "\n \n " self.assertFalse(self.response_dict['more_rows'])<|docstring|>The response dict's 'more_rows' val should be False<|endoftext|>
a73bd741b8e5b5517245e00ebc0231d4626ef8c46038ae6fb012f45bf47e04af
def test_response_rows(self): '\n The response dict should contain a list of values (can be empty)\n ' self.assertIsInstance(self.response_dict['rows'], list) self.assertGreaterEqual(len(self.response_dict['rows']), 0)
The response dict should contain a list of values (can be empty)
tests/test_response_handling.py
test_response_rows
5150brien/retsdk
1
python
def test_response_rows(self): '\n \n ' self.assertIsInstance(self.response_dict['rows'], list) self.assertGreaterEqual(len(self.response_dict['rows']), 0)
def test_response_rows(self): '\n \n ' self.assertIsInstance(self.response_dict['rows'], list) self.assertGreaterEqual(len(self.response_dict['rows']), 0)<|docstring|>The response dict should contain a list of values (can be empty)<|endoftext|>
dcae7e9cc1567d4ae81f81fe83fb68fdd978dd5cb9829466b57fc65c1863e3c6
def test_ok_value(self): "\n The response dict's 'ok' val should be True\n " self.assertTrue(self.response_dict['ok'])
The response dict's 'ok' val should be True
tests/test_response_handling.py
test_ok_value
5150brien/retsdk
1
python
def test_ok_value(self): "\n \n " self.assertTrue(self.response_dict['ok'])
def test_ok_value(self): "\n \n " self.assertTrue(self.response_dict['ok'])<|docstring|>The response dict's 'ok' val should be True<|endoftext|>
e7999c02f61086c39a5fc0a98e52c3fcee2371667d92c19b2fa8e0af2a6889e5
def test_more_rows_value(self): "\n The response dict's 'more_rows' val should be True\n " self.assertTrue(self.response_dict['more_rows'])
The response dict's 'more_rows' val should be True
tests/test_response_handling.py
test_more_rows_value
5150brien/retsdk
1
python
def test_more_rows_value(self): "\n \n " self.assertTrue(self.response_dict['more_rows'])
def test_more_rows_value(self): "\n \n " self.assertTrue(self.response_dict['more_rows'])<|docstring|>The response dict's 'more_rows' val should be True<|endoftext|>
e2655bac50398a24f2aefc00be442e4dc4965892ba7fad2638dba732ac69a81f
def test_get_api_url(): '\n Make sure we get a functioning API URL\n ' api_url = get_api_url() resp = requests.get(api_url) check_response(resp) content = resp.json() assert ('cases' in content.keys())
Make sure we get a functioning API URL
tests/test_utils.py
test_get_api_url
bensteinberg/cap-examples
49
python
def test_get_api_url(): '\n \n ' api_url = get_api_url() resp = requests.get(api_url) check_response(resp) content = resp.json() assert ('cases' in content.keys())
def test_get_api_url(): '\n \n ' api_url = get_api_url() resp = requests.get(api_url) check_response(resp) content = resp.json() assert ('cases' in content.keys())<|docstring|>Make sure we get a functioning API URL<|endoftext|>
2fe960a9a64446d8bf69f7931123ca58cad5491a39e7fb42d3b064a319170515
def _transform(s_data: str, replacements: list, keep_license_text: bool=False) -> str: '\n Internal function called to transform source data into templated data\n :param s_data: the source data to be transformed\n :param replacements: list of transformation pairs A->B\n :param keep_license_text: whether...
Internal function called to transform source data into templated data :param s_data: the source data to be transformed :param replacements: list of transformation pairs A->B :param keep_license_text: whether or not you want to keep license text :return: the potentially transformed data
scripts/o3de/o3de/engine_template.py
_transform
SparkyStudios/o3de
11
python
def _transform(s_data: str, replacements: list, keep_license_text: bool=False) -> str: '\n Internal function called to transform source data into templated data\n :param s_data: the source data to be transformed\n :param replacements: list of transformation pairs A->B\n :param keep_license_text: whether...
def _transform(s_data: str, replacements: list, keep_license_text: bool=False) -> str: '\n Internal function called to transform source data into templated data\n :param s_data: the source data to be transformed\n :param replacements: list of transformation pairs A->B\n :param keep_license_text: whether...
f602e1ea028d4229ef70c8279c7777c95c9b6264fe8859b1239e24097028fe00
def _transform_copy(source_file: pathlib.Path, destination_file: pathlib.Path, replacements: list, keep_license_text: bool=False) -> None: '\n Internal function called to transform and copy a source file into templated destination file\n :param source_file: the source file to be transformed\n :param destin...
Internal function called to transform and copy a source file into templated destination file :param source_file: the source file to be transformed :param destination_file: the destination file, this is the transformed file :param replacements: list of transformation pairs A->B :param keep_license_text: whether or not y...
scripts/o3de/o3de/engine_template.py
_transform_copy
SparkyStudios/o3de
11
python
def _transform_copy(source_file: pathlib.Path, destination_file: pathlib.Path, replacements: list, keep_license_text: bool=False) -> None: '\n Internal function called to transform and copy a source file into templated destination file\n :param source_file: the source file to be transformed\n :param destin...
def _transform_copy(source_file: pathlib.Path, destination_file: pathlib.Path, replacements: list, keep_license_text: bool=False) -> None: '\n Internal function called to transform and copy a source file into templated destination file\n :param source_file: the source file to be transformed\n :param destin...
bae588e00f74d14ad756c771453c2d0a3a92d6917da99da0b00e12d73c721497
def _instantiate_template(template_json_data: dict, destination_name: str, template_name: str, destination_path: pathlib.Path, template_path: pathlib.Path, destination_restricted_path: pathlib.Path, template_restricted_path: pathlib.Path, destination_restricted_platform_relative_path: pathlib.Path, template_restricted_...
Internal function to create a concrete instance from a template :param template_json_data: the template json data :param destination_name: the name of folder you want to instantiate the template in :param template_name: the name of the template :param destination_path: the path you want to instantiate the template in ...
scripts/o3de/o3de/engine_template.py
_instantiate_template
SparkyStudios/o3de
11
python
def _instantiate_template(template_json_data: dict, destination_name: str, template_name: str, destination_path: pathlib.Path, template_path: pathlib.Path, destination_restricted_path: pathlib.Path, template_restricted_path: pathlib.Path, destination_restricted_platform_relative_path: pathlib.Path, template_restricted_...
def _instantiate_template(template_json_data: dict, destination_name: str, template_name: str, destination_path: pathlib.Path, template_path: pathlib.Path, destination_restricted_path: pathlib.Path, template_restricted_path: pathlib.Path, destination_restricted_platform_relative_path: pathlib.Path, template_restricted_...
daced38d6fc416926d312ae10c7ce90a7f1f9eabb4fbcd6efe691dd84be38cce
def create_template(source_path: pathlib.Path, template_path: pathlib.Path, source_name: str=None, source_restricted_path: pathlib.Path=None, source_restricted_name: str=None, template_restricted_path: pathlib.Path=None, template_restricted_name: str=None, source_restricted_platform_relative_path: pathlib.Path=None, te...
Create a template from a source directory using replacement :param source_path: The path to the source that you want to make into a template :param template_path: the path of the template to create, can be absolute or relative to default templates path :param source_name: Name to replace within template folder with ${...
scripts/o3de/o3de/engine_template.py
create_template
SparkyStudios/o3de
11
python
def create_template(source_path: pathlib.Path, template_path: pathlib.Path, source_name: str=None, source_restricted_path: pathlib.Path=None, source_restricted_name: str=None, template_restricted_path: pathlib.Path=None, template_restricted_name: str=None, source_restricted_platform_relative_path: pathlib.Path=None, te...
def create_template(source_path: pathlib.Path, template_path: pathlib.Path, source_name: str=None, source_restricted_path: pathlib.Path=None, source_restricted_name: str=None, template_restricted_path: pathlib.Path=None, template_restricted_name: str=None, source_restricted_platform_relative_path: pathlib.Path=None, te...
455a51dc701b9f4241e6ae3ecdebbcc18a3a9865aa16031303a4cb9eecf01b7b
def create_from_template(destination_path: pathlib.Path, template_path: pathlib.Path=None, template_name: str=None, destination_name: str=None, destination_restricted_path: pathlib.Path=None, destination_restricted_name: str=None, template_restricted_path: pathlib.Path=None, template_restricted_name: str=None, destinat...
Generic template instantiation for non o3de object templates. This function makes NO assumptions! Assumptions are made only for specializations like create_project or create_gem etc... So this function will NOT try to divine intent. :param destination_path: the folder you want to instantiate the template into :param ...
scripts/o3de/o3de/engine_template.py
create_from_template
SparkyStudios/o3de
11
python
def create_from_template(destination_path: pathlib.Path, template_path: pathlib.Path=None, template_name: str=None, destination_name: str=None, destination_restricted_path: pathlib.Path=None, destination_restricted_name: str=None, template_restricted_path: pathlib.Path=None, template_restricted_name: str=None, destinat...
def create_from_template(destination_path: pathlib.Path, template_path: pathlib.Path=None, template_name: str=None, destination_name: str=None, destination_restricted_path: pathlib.Path=None, destination_restricted_name: str=None, template_restricted_path: pathlib.Path=None, template_restricted_name: str=None, destinat...
3b614afa580d188c08130a66b10cc8ee608048d999c5a57a7e2fa1731b8f86d7
def create_project(project_path: pathlib.Path, project_name: str=None, template_path: pathlib.Path=None, template_name: str=None, project_restricted_path: pathlib.Path=None, project_restricted_name: str=None, template_restricted_path: pathlib.Path=None, template_restricted_name: str=None, project_restricted_platform_re...
Template instantiation specialization that makes all default assumptions for a Project template instantiation, reducing the effort needed in instancing a project :param project_path: the project path, can be absolute or relative to default projects path :param project_name: the project name, defaults to project_path b...
scripts/o3de/o3de/engine_template.py
create_project
SparkyStudios/o3de
11
python
def create_project(project_path: pathlib.Path, project_name: str=None, template_path: pathlib.Path=None, template_name: str=None, project_restricted_path: pathlib.Path=None, project_restricted_name: str=None, template_restricted_path: pathlib.Path=None, template_restricted_name: str=None, project_restricted_platform_re...
def create_project(project_path: pathlib.Path, project_name: str=None, template_path: pathlib.Path=None, template_name: str=None, project_restricted_path: pathlib.Path=None, project_restricted_name: str=None, template_restricted_path: pathlib.Path=None, template_restricted_name: str=None, project_restricted_platform_re...
a77708bfbd97a7e52c6e4eb35f90184c0c4ccb9037cfb95e0410cbaa3039008c
def create_gem(gem_path: pathlib.Path, template_path: pathlib.Path=None, template_name: str=None, gem_name: str=None, gem_restricted_path: pathlib.Path=None, gem_restricted_name: str=None, template_restricted_path: pathlib.Path=None, template_restricted_name: str=None, gem_restricted_platform_relative_path: pathlib.Pat...
Template instantiation specialization that makes all default assumptions for a Gem template instantiation, reducing the effort needed in instancing a gem :param gem_path: the gem path, can be absolute or relative to default gems path :param template_path: the template path you want to instance, can be absolute or rela...
scripts/o3de/o3de/engine_template.py
create_gem
SparkyStudios/o3de
11
python
def create_gem(gem_path: pathlib.Path, template_path: pathlib.Path=None, template_name: str=None, gem_name: str=None, gem_restricted_path: pathlib.Path=None, gem_restricted_name: str=None, template_restricted_path: pathlib.Path=None, template_restricted_name: str=None, gem_restricted_platform_relative_path: pathlib.Pat...
def create_gem(gem_path: pathlib.Path, template_path: pathlib.Path=None, template_name: str=None, gem_name: str=None, gem_restricted_path: pathlib.Path=None, gem_restricted_name: str=None, template_restricted_path: pathlib.Path=None, template_restricted_name: str=None, gem_restricted_platform_relative_path: pathlib.Pat...
8cbb395c53200b008fd1637ec4c76d90a31ad9dbc3775df83b1425a8253a6d1f
def add_args(subparsers) -> None: '\n add_args is called to add expected parser arguments and subparsers arguments to each command such that it can be\n invoked locally or aggregated by a central python file.\n Ex. Directly run from this file alone with: python engine_template.py create-gem --gem-path Test...
add_args is called to add expected parser arguments and subparsers arguments to each command such that it can be invoked locally or aggregated by a central python file. Ex. Directly run from this file alone with: python engine_template.py create-gem --gem-path TestGem OR o3de.py can aggregate commands by importing engi...
scripts/o3de/o3de/engine_template.py
add_args
SparkyStudios/o3de
11
python
def add_args(subparsers) -> None: '\n add_args is called to add expected parser arguments and subparsers arguments to each command such that it can be\n invoked locally or aggregated by a central python file.\n Ex. Directly run from this file alone with: python engine_template.py create-gem --gem-path Test...
def add_args(subparsers) -> None: '\n add_args is called to add expected parser arguments and subparsers arguments to each command such that it can be\n invoked locally or aggregated by a central python file.\n Ex. Directly run from this file alone with: python engine_template.py create-gem --gem-path Test...
93774899140b07086fd0bba5071ec54fa34e62310ba799a4b8f189e193b837c1
def _is_cpp_file(file_path: pathlib.Path) -> bool: '\n Internal helper method to check if a file is a C++ file based\n on its extension, so we can determine if we need to prefer\n the ${SanitizedCppName}\n :param file_path: The input file path\n :return: bool: Whether or not the i...
Internal helper method to check if a file is a C++ file based on its extension, so we can determine if we need to prefer the ${SanitizedCppName} :param file_path: The input file path :return: bool: Whether or not the input file path has a C++ extension
scripts/o3de/o3de/engine_template.py
_is_cpp_file
SparkyStudios/o3de
11
python
def _is_cpp_file(file_path: pathlib.Path) -> bool: '\n Internal helper method to check if a file is a C++ file based\n on its extension, so we can determine if we need to prefer\n the ${SanitizedCppName}\n :param file_path: The input file path\n :return: bool: Whether or not the i...
def _is_cpp_file(file_path: pathlib.Path) -> bool: '\n Internal helper method to check if a file is a C++ file based\n on its extension, so we can determine if we need to prefer\n the ${SanitizedCppName}\n :param file_path: The input file path\n :return: bool: Whether or not the i...
f3d4e5f8bb43b54ee179c37cf2686fe7b6005598ba0d806c6e619551f8b78cb7
def _transform_into_template(s_data: object, prefer_sanitized_name: bool=False) -> (bool, str): "\n Internal function to transform any data into templated data\n :param s_data: the input data, this could be file data or file name data\n :param prefer_sanitized_name: Optionally swap the sanitize...
Internal function to transform any data into templated data :param s_data: the input data, this could be file data or file name data :param prefer_sanitized_name: Optionally swap the sanitized name with the normal name This can be necessary when creating the template, the source ...
scripts/o3de/o3de/engine_template.py
_transform_into_template
SparkyStudios/o3de
11
python
def _transform_into_template(s_data: object, prefer_sanitized_name: bool=False) -> (bool, str): "\n Internal function to transform any data into templated data\n :param s_data: the input data, this could be file data or file name data\n :param prefer_sanitized_name: Optionally swap the sanitize...
def _transform_into_template(s_data: object, prefer_sanitized_name: bool=False) -> (bool, str): "\n Internal function to transform any data into templated data\n :param s_data: the input data, this could be file data or file name data\n :param prefer_sanitized_name: Optionally swap the sanitize...
3e8bbe1a675aa9685bb555c586c05d258e0a9eeece728bff5bd4e29c59f31058
def _transform_restricted_into_copyfiles_and_createdirs(root_abs: pathlib.Path, path_abs: pathlib.Path=None) -> None: '\n Internal function recursively called to transform any paths files into copyfiles and create dirs relative to\n the root. This will transform and copy the files, and save the copyfi...
Internal function recursively called to transform any paths files into copyfiles and create dirs relative to the root. This will transform and copy the files, and save the copyfiles and createdirs data, no not save it :param root_abs: This is the path everything will end up relative to :path_abs: This is the path being...
scripts/o3de/o3de/engine_template.py
_transform_restricted_into_copyfiles_and_createdirs
SparkyStudios/o3de
11
python
def _transform_restricted_into_copyfiles_and_createdirs(root_abs: pathlib.Path, path_abs: pathlib.Path=None) -> None: '\n Internal function recursively called to transform any paths files into copyfiles and create dirs relative to\n the root. This will transform and copy the files, and save the copyfi...
def _transform_restricted_into_copyfiles_and_createdirs(root_abs: pathlib.Path, path_abs: pathlib.Path=None) -> None: '\n Internal function recursively called to transform any paths files into copyfiles and create dirs relative to\n the root. This will transform and copy the files, and save the copyfi...
a982a37af872c1332cac60743c82a22b74979b196b7936656651895121898b14
def _transform_dir_into_copyfiles_and_createdirs(root_abs: pathlib.Path, path_abs: pathlib.Path=None) -> None: '\n Internal function recursively called to transform any paths files into copyfiles and create dirs relative to\n the root. This will transform and copy the files, and save the copyfiles and...
Internal function recursively called to transform any paths files into copyfiles and create dirs relative to the root. This will transform and copy the files, and save the copyfiles and createdirs data, no not save it :param root_abs: This is the path everything will end up relative to :path_abs: This is the path being...
scripts/o3de/o3de/engine_template.py
_transform_dir_into_copyfiles_and_createdirs
SparkyStudios/o3de
11
python
def _transform_dir_into_copyfiles_and_createdirs(root_abs: pathlib.Path, path_abs: pathlib.Path=None) -> None: '\n Internal function recursively called to transform any paths files into copyfiles and create dirs relative to\n the root. This will transform and copy the files, and save the copyfiles and...
def _transform_dir_into_copyfiles_and_createdirs(root_abs: pathlib.Path, path_abs: pathlib.Path=None) -> None: '\n Internal function recursively called to transform any paths files into copyfiles and create dirs relative to\n the root. This will transform and copy the files, and save the copyfiles and...
b37f1b6c47345d0d7093ae3fc828d5c02e0388b0e054fb811394af94afdf125d
def open(self): ' New connection has been established ' clients.append(self) self.logger.info('New connection')
New connection has been established
lib/WebSocketServer.py
open
dorneanu/netgrafio
71
python
def open(self): ' ' clients.append(self) self.logger.info('New connection')
def open(self): ' ' clients.append(self) self.logger.info('New connection')<|docstring|>New connection has been established<|endoftext|>
578f53199ca06f81e5b4a0522189112b5d51aeeb98c414a11a455fddab985ae3
def on_message(self, message): ' Data income event callback ' self.write_message((u'%s' % message))
Data income event callback
lib/WebSocketServer.py
on_message
dorneanu/netgrafio
71
python
def on_message(self, message): ' ' self.write_message((u'%s' % message))
def on_message(self, message): ' ' self.write_message((u'%s' % message))<|docstring|>Data income event callback<|endoftext|>
56e7a6a5f49e387c8eff7760af5636efdbc5ee2e90213ce497357ab498b75a92
def on_close(self): ' Connection was closed ' clients.remove(self) self.logger.info('Connection removed')
Connection was closed
lib/WebSocketServer.py
on_close
dorneanu/netgrafio
71
python
def on_close(self): ' ' clients.remove(self) self.logger.info('Connection removed')
def on_close(self): ' ' clients.remove(self) self.logger.info('Connection removed')<|docstring|>Connection was closed<|endoftext|>
bbe3fbc457b80ed27b158dfe83de627c59f9507d8dbc7e265d457479688528bd
def __init__(self, host, port, in_queue=Queue()): ' Constructor for the WebSocketServer class\n\n Args:\n host(str): Hostname\n port(int): Port number to listen on\n in_queue(Queue): Thread-safe working queue\n\n ' self.application = Application() self.server =...
Constructor for the WebSocketServer class Args: host(str): Hostname port(int): Port number to listen on in_queue(Queue): Thread-safe working queue
lib/WebSocketServer.py
__init__
dorneanu/netgrafio
71
python
def __init__(self, host, port, in_queue=Queue()): ' Constructor for the WebSocketServer class\n\n Args:\n host(str): Hostname\n port(int): Port number to listen on\n in_queue(Queue): Thread-safe working queue\n\n ' self.application = Application() self.server =...
def __init__(self, host, port, in_queue=Queue()): ' Constructor for the WebSocketServer class\n\n Args:\n host(str): Hostname\n port(int): Port number to listen on\n in_queue(Queue): Thread-safe working queue\n\n ' self.application = Application() self.server =...
1ae035e74ab9844b68374059cbd0b43d4ff9217817df40d6298221f30cf4ca6f
def start_server(self): ' Starts the HTTP server\n ' self.logger.info(('Starting WebSocket server on port %d' % self.port)) http_server = Thread(target=tornado.ioloop.IOLoop.instance().start) http_server.start()
Starts the HTTP server
lib/WebSocketServer.py
start_server
dorneanu/netgrafio
71
python
def start_server(self): ' \n ' self.logger.info(('Starting WebSocket server on port %d' % self.port)) http_server = Thread(target=tornado.ioloop.IOLoop.instance().start) http_server.start()
def start_server(self): ' \n ' self.logger.info(('Starting WebSocket server on port %d' % self.port)) http_server = Thread(target=tornado.ioloop.IOLoop.instance().start) http_server.start()<|docstring|>Starts the HTTP server<|endoftext|>
6d22b55c005d826aeb369b71a6f01ad98d0a9f618d8da560a5308fb81ef2844c
def start_collector(self): ' Starts collecting packages\n ' self.logger.info('Start collector server') collector_server = Thread(target=self.collect_data) collector_server.start()
Starts collecting packages
lib/WebSocketServer.py
start_collector
dorneanu/netgrafio
71
python
def start_collector(self): ' \n ' self.logger.info('Start collector server') collector_server = Thread(target=self.collect_data) collector_server.start()
def start_collector(self): ' \n ' self.logger.info('Start collector server') collector_server = Thread(target=self.collect_data) collector_server.start()<|docstring|>Starts collecting packages<|endoftext|>
4a27201f6145d9b6deeb5a418af972d083ed42a73905898c5133eae83b030e10
def collector_process_data(self, data): ' Process incoming data and send it to all available clients\n\n Args:\n data: Received data\n\n ' for c in clients: c.on_message(json.dumps(data))
Process incoming data and send it to all available clients Args: data: Received data
lib/WebSocketServer.py
collector_process_data
dorneanu/netgrafio
71
python
def collector_process_data(self, data): ' Process incoming data and send it to all available clients\n\n Args:\n data: Received data\n\n ' for c in clients: c.on_message(json.dumps(data))
def collector_process_data(self, data): ' Process incoming data and send it to all available clients\n\n Args:\n data: Received data\n\n ' for c in clients: c.on_message(json.dumps(data))<|docstring|>Process incoming data and send it to all available clients Args: data: Rec...
b66b6f396626a9b6bc1fa974ee56c105a05b52b6484dc4aaca06e07c60ec4b51
def collect_data(self): ' Wait for data in individual thread\n ' self.logger.info('Waiting for incoming data ...') while True: item = self.in_queue.get() self.logger.info('Received data!') self.collector_process_data(item)
Wait for data in individual thread
lib/WebSocketServer.py
collect_data
dorneanu/netgrafio
71
python
def collect_data(self): ' \n ' self.logger.info('Waiting for incoming data ...') while True: item = self.in_queue.get() self.logger.info('Received data!') self.collector_process_data(item)
def collect_data(self): ' \n ' self.logger.info('Waiting for incoming data ...') while True: item = self.in_queue.get() self.logger.info('Received data!') self.collector_process_data(item)<|docstring|>Wait for data in individual thread<|endoftext|>
1ab8658321b54e1787405bdd243f1ba5d8a40b8196501fb866be8787986d7bd9
def start(self): ' Starts the server\n\n .. note::\n The server will listen for incoming JSON packets and pass them\n to all clients connected to the WebSocket.\n ' self.start_server() self.start_collector()
Starts the server .. note:: The server will listen for incoming JSON packets and pass them to all clients connected to the WebSocket.
lib/WebSocketServer.py
start
dorneanu/netgrafio
71
python
def start(self): ' Starts the server\n\n .. note::\n The server will listen for incoming JSON packets and pass them\n to all clients connected to the WebSocket.\n ' self.start_server() self.start_collector()
def start(self): ' Starts the server\n\n .. note::\n The server will listen for incoming JSON packets and pass them\n to all clients connected to the WebSocket.\n ' self.start_server() self.start_collector()<|docstring|>Starts the server .. note:: The server will lis...
61bb960435bb430467b7fe65996ef6d4adab430e06e04a9982b2e9405717ce1e
async def async_change(self, change): 'Merge changes with queue and send when possible, returning True when done' self.changes = update(self.changes, change) if self.lock.locked(): return False async with self.lock: while self.changes: (await asyncio.sleep(0)) pay...
Merge changes with queue and send when possible, returning True when done
advantage_air/__init__.py
async_change
Bre77/advantage_air
3
python
async def async_change(self, change): self.changes = update(self.changes, change) if self.lock.locked(): return False async with self.lock: while self.changes: (await asyncio.sleep(0)) payload = self.changes self.changes = {} try: ...
async def async_change(self, change): self.changes = update(self.changes, change) if self.lock.locked(): return False async with self.lock: while self.changes: (await asyncio.sleep(0)) payload = self.changes self.changes = {} try: ...
479f85a78220653f22158fb6f07d0a5bd7c1256bdea48b3b8fe1556a8e83494f
async def validate_input(hass: HomeAssistant, data: dict[(str, Any)]) -> dict[(str, Any)]: 'Validate the user input allows us to connect.\n\n Data has the keys from STEP_USER_DATA_SCHEMA with values provided by the user.\n ' api = NYC311API(async_get_clientsession(hass), data['api_key']) try: ...
Validate the user input allows us to connect. Data has the keys from STEP_USER_DATA_SCHEMA with values provided by the user.
custom_components/nyc311/config_flow.py
validate_input
elahd/ha-nyc311
1
python
async def validate_input(hass: HomeAssistant, data: dict[(str, Any)]) -> dict[(str, Any)]: 'Validate the user input allows us to connect.\n\n Data has the keys from STEP_USER_DATA_SCHEMA with values provided by the user.\n ' api = NYC311API(async_get_clientsession(hass), data['api_key']) try: ...
async def validate_input(hass: HomeAssistant, data: dict[(str, Any)]) -> dict[(str, Any)]: 'Validate the user input allows us to connect.\n\n Data has the keys from STEP_USER_DATA_SCHEMA with values provided by the user.\n ' api = NYC311API(async_get_clientsession(hass), data['api_key']) try: ...
9a5357f08f964aa0e64a5c9732aee09ae71738c68f2500c7ef98571faec12758
async def async_step_user(self, user_input: (dict[(str, Any)] | None)=None) -> FlowResult: 'Handle the initial step.' if (user_input is None): return self.async_show_form(step_id='user', data_schema=STEP_USER_DATA_SCHEMA) errors = {} if (user_input is not None): try: info = (...
Handle the initial step.
custom_components/nyc311/config_flow.py
async_step_user
elahd/ha-nyc311
1
python
async def async_step_user(self, user_input: (dict[(str, Any)] | None)=None) -> FlowResult: if (user_input is None): return self.async_show_form(step_id='user', data_schema=STEP_USER_DATA_SCHEMA) errors = {} if (user_input is not None): try: info = (await validate_input(self....
async def async_step_user(self, user_input: (dict[(str, Any)] | None)=None) -> FlowResult: if (user_input is None): return self.async_show_form(step_id='user', data_schema=STEP_USER_DATA_SCHEMA) errors = {} if (user_input is not None): try: info = (await validate_input(self....
5fd27ecf6981eb0e13f94749813ed55d44a532e41f4b838b931782c1d3140e87
def resample_pcd(pcd, n): 'drop or duplicate points so that input of each object has exactly n points' idx = np.random.permutation(pcd.shape[0]) if (idx.shape[0] < n): idx = np.concatenate([idx, np.random.randint(pcd.shape[0], size=(n - pcd.shape[0]))]) return pcd[idx[:n]]
drop or duplicate points so that input of each object has exactly n points
OcCo_TF/utils/data_util.py
resample_pcd
sun-pyo/OcCo
158
python
def resample_pcd(pcd, n): idx = np.random.permutation(pcd.shape[0]) if (idx.shape[0] < n): idx = np.concatenate([idx, np.random.randint(pcd.shape[0], size=(n - pcd.shape[0]))]) return pcd[idx[:n]]
def resample_pcd(pcd, n): idx = np.random.permutation(pcd.shape[0]) if (idx.shape[0] < n): idx = np.concatenate([idx, np.random.randint(pcd.shape[0], size=(n - pcd.shape[0]))]) return pcd[idx[:n]]<|docstring|>drop or duplicate points so that input of each object has exactly n points<|endoftext|...
4803135b83a70a68add73088bf4a8c769be466e8753c116e57f82cc170e4a728
def lmdb_dataflow(lmdb_path, batch_size, input_size, output_size, is_training, test_speed=False): 'load LMDB files, then generate batches??' df = dataflow.LMDBSerializer.load(lmdb_path, shuffle=False) size = df.size() if is_training: df = dataflow.LocallyShuffleData(df, buffer_size=2000) ...
load LMDB files, then generate batches??
OcCo_TF/utils/data_util.py
lmdb_dataflow
sun-pyo/OcCo
158
python
def lmdb_dataflow(lmdb_path, batch_size, input_size, output_size, is_training, test_speed=False): df = dataflow.LMDBSerializer.load(lmdb_path, shuffle=False) size = df.size() if is_training: df = dataflow.LocallyShuffleData(df, buffer_size=2000) df = dataflow.PrefetchData(df, nr_prefetc...
def lmdb_dataflow(lmdb_path, batch_size, input_size, output_size, is_training, test_speed=False): df = dataflow.LMDBSerializer.load(lmdb_path, shuffle=False) size = df.size() if is_training: df = dataflow.LocallyShuffleData(df, buffer_size=2000) df = dataflow.PrefetchData(df, nr_prefetc...
09a2b7ccff93adcc16ceabcbf703beb202ea765664e3890909abed062e4503b7
def __len__(self): 'get the number of batches' ds_size = len(self.ds) div = (ds_size // self.batch_size) rem = (ds_size % self.batch_size) if (rem == 0): return div return (div + int(self.remainder))
get the number of batches
OcCo_TF/utils/data_util.py
__len__
sun-pyo/OcCo
158
python
def __len__(self): ds_size = len(self.ds) div = (ds_size // self.batch_size) rem = (ds_size % self.batch_size) if (rem == 0): return div return (div + int(self.remainder))
def __len__(self): ds_size = len(self.ds) div = (ds_size // self.batch_size) rem = (ds_size % self.batch_size) if (rem == 0): return div return (div + int(self.remainder))<|docstring|>get the number of batches<|endoftext|>
f7a473a66147c832000e3f660fbc9ac67b86871a8702d83067e12904067434c3
def __iter__(self): 'generating data in batches' holder = [] for data in self.ds: holder.append(data) if (len(holder) == self.batch_size): (yield self._aggregate_batch(holder, self.use_list)) del holder[:] if (self.remainder and (len(holder) > 0)): (yield ...
generating data in batches
OcCo_TF/utils/data_util.py
__iter__
sun-pyo/OcCo
158
python
def __iter__(self): holder = [] for data in self.ds: holder.append(data) if (len(holder) == self.batch_size): (yield self._aggregate_batch(holder, self.use_list)) del holder[:] if (self.remainder and (len(holder) > 0)): (yield self._aggregate_batch(holder...
def __iter__(self): holder = [] for data in self.ds: holder.append(data) if (len(holder) == self.batch_size): (yield self._aggregate_batch(holder, self.use_list)) del holder[:] if (self.remainder and (len(holder) > 0)): (yield self._aggregate_batch(holder...
f55f8257dad181540c0277bf1b47a9c390a6a56f266e2ed680418102a22ae826
def _aggregate_batch(self, data_holder, use_list=False): '\n Concatenate input points along the 0-th dimension\n Stack all other data along the 0-th dimension\n ' ids = np.stack([x[0] for x in data_holder]) inputs = [(resample_pcd(x[1], self.input_size) if (x[1].shape[0] > self.inpu...
Concatenate input points along the 0-th dimension Stack all other data along the 0-th dimension
OcCo_TF/utils/data_util.py
_aggregate_batch
sun-pyo/OcCo
158
python
def _aggregate_batch(self, data_holder, use_list=False): '\n Concatenate input points along the 0-th dimension\n Stack all other data along the 0-th dimension\n ' ids = np.stack([x[0] for x in data_holder]) inputs = [(resample_pcd(x[1], self.input_size) if (x[1].shape[0] > self.inpu...
def _aggregate_batch(self, data_holder, use_list=False): '\n Concatenate input points along the 0-th dimension\n Stack all other data along the 0-th dimension\n ' ids = np.stack([x[0] for x in data_holder]) inputs = [(resample_pcd(x[1], self.input_size) if (x[1].shape[0] > self.inpu...
2eaa97460f397399fba41fce31e92a2b2e7cd1c5254b02f0c8960aa9884c3069
def get_gdf(self): '\n Obtain OSM data and save as GeoDataFrame.\n\n Returns\n -------\n GeoDataFrame\n ' return json_to_gdf(osm_json=self.query(), data_type=self.data_type)
Obtain OSM data and save as GeoDataFrame. Returns ------- GeoDataFrame
osmsc/geogroup.py
get_gdf
ruirzma/osmsc
9
python
def get_gdf(self): '\n Obtain OSM data and save as GeoDataFrame.\n\n Returns\n -------\n GeoDataFrame\n ' return json_to_gdf(osm_json=self.query(), data_type=self.data_type)
def get_gdf(self): '\n Obtain OSM data and save as GeoDataFrame.\n\n Returns\n -------\n GeoDataFrame\n ' return json_to_gdf(osm_json=self.query(), data_type=self.data_type)<|docstring|>Obtain OSM data and save as GeoDataFrame. Returns ------- GeoDataFrame<|endoftext|>
1d2031d6964801c6a6defd890835251777c53669c9a619f85816d5447f110930
def get_gdf(self, tags=False): '\n Obtain OSM data and save as GeoDataFrame.\n\n Parameters\n ----------\n tags : bool\n if False, the GeoDataFrame won\'t add OSM "tags" column.\n if True, need to extract tag info into current GeoDataFrame\n\n\n Returns\n ...
Obtain OSM data and save as GeoDataFrame. Parameters ---------- tags : bool if False, the GeoDataFrame won't add OSM "tags" column. if True, need to extract tag info into current GeoDataFrame Returns ------- GeoDataFrame
osmsc/geogroup.py
get_gdf
ruirzma/osmsc
9
python
def get_gdf(self, tags=False): '\n Obtain OSM data and save as GeoDataFrame.\n\n Parameters\n ----------\n tags : bool\n if False, the GeoDataFrame won\'t add OSM "tags" column.\n if True, need to extract tag info into current GeoDataFrame\n\n\n Returns\n ...
def get_gdf(self, tags=False): '\n Obtain OSM data and save as GeoDataFrame.\n\n Parameters\n ----------\n tags : bool\n if False, the GeoDataFrame won\'t add OSM "tags" column.\n if True, need to extract tag info into current GeoDataFrame\n\n\n Returns\n ...
c241a00c0b32c55f40bb1a46770c3b5184a1ef864bef9e5fb7d75ea20c28b3dc
@app.route('/registration', methods=['GET', 'POST']) def reg(): '\n Отвечает за вывод страницы регистрации и регистрацию\n :return: Страница регистрации\n ' form = RegForm() if form.validate_on_submit(): user = User(form.username_reg.data, form.email_reg.data) user.set_password(form...
Отвечает за вывод страницы регистрации и регистрацию :return: Страница регистрации
backend/app/controllers/auth.py
reg
DankanTsar/memesmerkatuan
0
python
@app.route('/registration', methods=['GET', 'POST']) def reg(): '\n Отвечает за вывод страницы регистрации и регистрацию\n :return: Страница регистрации\n ' form = RegForm() if form.validate_on_submit(): user = User(form.username_reg.data, form.email_reg.data) user.set_password(form...
@app.route('/registration', methods=['GET', 'POST']) def reg(): '\n Отвечает за вывод страницы регистрации и регистрацию\n :return: Страница регистрации\n ' form = RegForm() if form.validate_on_submit(): user = User(form.username_reg.data, form.email_reg.data) user.set_password(form...
d13732d5ab2b584cc10b004ed53c1472e56ddb82afa9e8e4a32ba13d5df08847
@app.route('/login', methods=['GET', 'POST']) def log(): '\n Отвечает за вывод страницы входа и вход\n :return: Страница входа\n ' form = LogForm() if form.validate_on_submit(): session['Username'] = form.username_log.data return redirect(url_for('index')) return render_template...
Отвечает за вывод страницы входа и вход :return: Страница входа
backend/app/controllers/auth.py
log
DankanTsar/memesmerkatuan
0
python
@app.route('/login', methods=['GET', 'POST']) def log(): '\n Отвечает за вывод страницы входа и вход\n :return: Страница входа\n ' form = LogForm() if form.validate_on_submit(): session['Username'] = form.username_log.data return redirect(url_for('index')) return render_template...
@app.route('/login', methods=['GET', 'POST']) def log(): '\n Отвечает за вывод страницы входа и вход\n :return: Страница входа\n ' form = LogForm() if form.validate_on_submit(): session['Username'] = form.username_log.data return redirect(url_for('index')) return render_template...
832e37a55fa87cacde34fe47020d875270c6d1df6bc06de824453f2922e821dc
def __init__(self, config: dict=None): 'Initialise a Milestones object.\n\n Args:\n config (dict): Arbitrary configuration.\n ' self.config = config
Initialise a Milestones object. Args: config (dict): Arbitrary configuration.
lexos/cutter/milestones.py
__init__
scottkleinman/lexos
0
python
def __init__(self, config: dict=None): 'Initialise a Milestones object.\n\n Args:\n config (dict): Arbitrary configuration.\n ' self.config = config
def __init__(self, config: dict=None): 'Initialise a Milestones object.\n\n Args:\n config (dict): Arbitrary configuration.\n ' self.config = config<|docstring|>Initialise a Milestones object. Args: config (dict): Arbitrary configuration.<|endoftext|>
6057a08a8d59094b74d702565d6843b8b7f863593353dd6a2bdb5ff320319d3b
def set(self, docs: Union[(object, list)], milestone: Union[(dict, str)]) -> Union[(List[object], object)]: 'Set the milestones for a doc or a list of docs.\n\n Args:\n docs (object): A spaCy doc or a list of spaCy docs.\n milestone (Union[dict, str]): The milestone token(s) to match.\n...
Set the milestones for a doc or a list of docs. Args: docs (object): A spaCy doc or a list of spaCy docs. milestone (Union[dict, str]): The milestone token(s) to match. Returns: Union[List[object], object]: A spaCy doc or list of spacy docs with `doc._.is_milestone` set.
lexos/cutter/milestones.py
set
scottkleinman/lexos
0
python
def set(self, docs: Union[(object, list)], milestone: Union[(dict, str)]) -> Union[(List[object], object)]: 'Set the milestones for a doc or a list of docs.\n\n Args:\n docs (object): A spaCy doc or a list of spaCy docs.\n milestone (Union[dict, str]): The milestone token(s) to match.\n...
def set(self, docs: Union[(object, list)], milestone: Union[(dict, str)]) -> Union[(List[object], object)]: 'Set the milestones for a doc or a list of docs.\n\n Args:\n docs (object): A spaCy doc or a list of spaCy docs.\n milestone (Union[dict, str]): The milestone token(s) to match.\n...
056a9d8d951cf20a284f0b2283b13242fb60465a540107c4cb31d1ecad701989
def _set_milestones(self, doc: object, milestone: str) -> object: 'Set the milestones for a doc.\n\n Args:\n doc (object): A spaCy doc.\n milestone (str): The milestone token(s) to match.\n\n Returns:\n object: A spaCy doc with `doc._.is_milestone` set.\n ' ...
Set the milestones for a doc. Args: doc (object): A spaCy doc. milestone (str): The milestone token(s) to match. Returns: object: A spaCy doc with `doc._.is_milestone` set.
lexos/cutter/milestones.py
_set_milestones
scottkleinman/lexos
0
python
def _set_milestones(self, doc: object, milestone: str) -> object: 'Set the milestones for a doc.\n\n Args:\n doc (object): A spaCy doc.\n milestone (str): The milestone token(s) to match.\n\n Returns:\n object: A spaCy doc with `doc._.is_milestone` set.\n ' ...
def _set_milestones(self, doc: object, milestone: str) -> object: 'Set the milestones for a doc.\n\n Args:\n doc (object): A spaCy doc.\n milestone (str): The milestone token(s) to match.\n\n Returns:\n object: A spaCy doc with `doc._.is_milestone` set.\n ' ...
72188a2301b29f2898f5a26a5fef9393a5af7d50487c8dbbbb5c01b8f1900e17
def _matches_milestone(self, token: object, milestone: Union[(dict, list, str)]) -> bool: 'Check if a token matches a milestone.\n\n Args:\n token (object): The token to test.\n milestone (Union[dict, list, str]): The milestone token(s) to match.\n\n Returns:\n bool: W...
Check if a token matches a milestone. Args: token (object): The token to test. milestone (Union[dict, list, str]): The milestone token(s) to match. Returns: bool: Whether the token matches the milestone.
lexos/cutter/milestones.py
_matches_milestone
scottkleinman/lexos
0
python
def _matches_milestone(self, token: object, milestone: Union[(dict, list, str)]) -> bool: 'Check if a token matches a milestone.\n\n Args:\n token (object): The token to test.\n milestone (Union[dict, list, str]): The milestone token(s) to match.\n\n Returns:\n bool: W...
def _matches_milestone(self, token: object, milestone: Union[(dict, list, str)]) -> bool: 'Check if a token matches a milestone.\n\n Args:\n token (object): The token to test.\n milestone (Union[dict, list, str]): The milestone token(s) to match.\n\n Returns:\n bool: W...
76af7c8fcdab80c53a44ad60b3ad31c960dd0789b115a64e993c8e52e36afddf
def _parse_milestone_dict(self, token, milestone_dict): 'Parse a milestone dictionary and get results for each criterion.\n\n Key-value pairs in `milestone_dict` will be interpreted as token\n attributes and their values. If the value is given as a tuple, it\n must have the form `(pattern, oper...
Parse a milestone dictionary and get results for each criterion. Key-value pairs in `milestone_dict` will be interpreted as token attributes and their values. If the value is given as a tuple, it must have the form `(pattern, operator)`, where the pattern is the string or regex pattern to match, and the operator is th...
lexos/cutter/milestones.py
_parse_milestone_dict
scottkleinman/lexos
0
python
def _parse_milestone_dict(self, token, milestone_dict): 'Parse a milestone dictionary and get results for each criterion.\n\n Key-value pairs in `milestone_dict` will be interpreted as token\n attributes and their values. If the value is given as a tuple, it\n must have the form `(pattern, oper...
def _parse_milestone_dict(self, token, milestone_dict): 'Parse a milestone dictionary and get results for each criterion.\n\n Key-value pairs in `milestone_dict` will be interpreted as token\n attributes and their values. If the value is given as a tuple, it\n must have the form `(pattern, oper...
610ecab364b9dbc023d4bcf496aaa80c020d282dce83ab92bd7640419725eef4
def _get_milestone_result(self, attr: str, token: object, value: Union[(str, tuple)]) -> bool: 'Test a token for a match.\n\n If value is a tuple, it must have the form `(pattern, operator)`,\n where pattern is the string or regex pattern to match, and\n operator is the method to use. Valid ope...
Test a token for a match. If value is a tuple, it must have the form `(pattern, operator)`, where pattern is the string or regex pattern to match, and operator is the method to use. Valid operators are "in", "not_in", "starts_with", "ends_with", "re_match", and "re_search". The prefix "re_" implies that the pattern is...
lexos/cutter/milestones.py
_get_milestone_result
scottkleinman/lexos
0
python
def _get_milestone_result(self, attr: str, token: object, value: Union[(str, tuple)]) -> bool: 'Test a token for a match.\n\n If value is a tuple, it must have the form `(pattern, operator)`,\n where pattern is the string or regex pattern to match, and\n operator is the method to use. Valid ope...
def _get_milestone_result(self, attr: str, token: object, value: Union[(str, tuple)]) -> bool: 'Test a token for a match.\n\n If value is a tuple, it must have the form `(pattern, operator)`,\n where pattern is the string or regex pattern to match, and\n operator is the method to use. Valid ope...
96f46542d299b6d7587cbd60554801f016a6142b9c46ae7153ba5fd06ab8f502
def register(router, model, database=db, view=AdminView): "Register an administration view for each model\n\n :param app: Flaks application\n :param list models: A list of AutomapModels\n :param Admin router: An instance of Flask's Admin\n :param ModelView view:\n :return:\n " if (hasattr(mode...
Register an administration view for each model :param app: Flaks application :param list models: A list of AutomapModels :param Admin router: An instance of Flask's Admin :param ModelView view: :return:
flask_sandman/admin.py
register
manaikan/sandman2
0
python
def register(router, model, database=db, view=AdminView): "Register an administration view for each model\n\n :param app: Flaks application\n :param list models: A list of AutomapModels\n :param Admin router: An instance of Flask's Admin\n :param ModelView view:\n :return:\n " if (hasattr(mode...
def register(router, model, database=db, view=AdminView): "Register an administration view for each model\n\n :param app: Flaks application\n :param list models: A list of AutomapModels\n :param Admin router: An instance of Flask's Admin\n :param ModelView view:\n :return:\n " if (hasattr(mode...
ff314682ea439080d7d3e36d75c45dd273f4b1eafde17be8b88ac9faf0efa30c
def hinge_loss(correct_answer, incorrect_answer, margin): '\n Loss by calculating the correct/incorrect score difference in relation to given margin\n :param margin:\n :param correct_answer:\n :param incorrect_answer:\n :return:\n ' loss_sum = torch.sum(((margin + incorrect_answer) - correct_a...
Loss by calculating the correct/incorrect score difference in relation to given margin :param margin: :param correct_answer: :param incorrect_answer: :return:
utility/training.py
hinge_loss
RobinRojowiec/intent-recognition-in-doctor-patient-interviews
0
python
def hinge_loss(correct_answer, incorrect_answer, margin): '\n Loss by calculating the correct/incorrect score difference in relation to given margin\n :param margin:\n :param correct_answer:\n :param incorrect_answer:\n :return:\n ' loss_sum = torch.sum(((margin + incorrect_answer) - correct_a...
def hinge_loss(correct_answer, incorrect_answer, margin): '\n Loss by calculating the correct/incorrect score difference in relation to given margin\n :param margin:\n :param correct_answer:\n :param incorrect_answer:\n :return:\n ' loss_sum = torch.sum(((margin + incorrect_answer) - correct_a...
8aaeb03e3332fbc9dc2657bd2e7141fee0bf6c4580de68886b77adacee7dae8c
def get_optimizer(model: nn.Module, name, **kwargs): '\n initializes the optimizer\n :param model:\n :param name:\n :param kwargs:\n :return:\n ' if (name == 'SGD'): return torch.optim.SGD(model.parameters(), **kwargs) elif (name == 'Adam'): return torch.optim.Adam(model.pa...
initializes the optimizer :param model: :param name: :param kwargs: :return:
utility/training.py
get_optimizer
RobinRojowiec/intent-recognition-in-doctor-patient-interviews
0
python
def get_optimizer(model: nn.Module, name, **kwargs): '\n initializes the optimizer\n :param model:\n :param name:\n :param kwargs:\n :return:\n ' if (name == 'SGD'): return torch.optim.SGD(model.parameters(), **kwargs) elif (name == 'Adam'): return torch.optim.Adam(model.pa...
def get_optimizer(model: nn.Module, name, **kwargs): '\n initializes the optimizer\n :param model:\n :param name:\n :param kwargs:\n :return:\n ' if (name == 'SGD'): return torch.optim.SGD(model.parameters(), **kwargs) elif (name == 'Adam'): return torch.optim.Adam(model.pa...