blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
7e18f3a53eb3da2fc84c24b88957c8bf4d775c1e
[ "if self._units in ('C', 'F'):\n return round(self._state, 1)\nif isinstance(self._state, float):\n return round(self._state, 2)\nreturn self._state", "if self._units in ['C', 'F']:\n return DEVICE_CLASS_TEMPERATURE\nreturn None", "if self._units == 'C':\n return TEMP_CELSIUS\nif self._units == 'F':...
<|body_start_0|> if self._units in ('C', 'F'): return round(self._state, 1) if isinstance(self._state, float): return round(self._state, 2) return self._state <|end_body_0|> <|body_start_1|> if self._units in ['C', 'F']: return DEVICE_CLASS_TEMPERATUR...
Representation of a multi level sensor Z-Wave sensor.
ZWaveMultilevelSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZWaveMultilevelSensor: """Representation of a multi level sensor Z-Wave sensor.""" def state(self): """Return the state of the sensor.""" <|body_0|> def device_class(self): """Return the class of this device.""" <|body_1|> def unit_of_measurement(sel...
stack_v2_sparse_classes_36k_train_006900
3,651
permissive
[ { "docstring": "Return the state of the sensor.", "name": "state", "signature": "def state(self)" }, { "docstring": "Return the class of this device.", "name": "device_class", "signature": "def device_class(self)" }, { "docstring": "Return the unit the value is expressed in.", ...
3
stack_v2_sparse_classes_30k_train_004197
Implement the Python class `ZWaveMultilevelSensor` described below. Class description: Representation of a multi level sensor Z-Wave sensor. Method signatures and docstrings: - def state(self): Return the state of the sensor. - def device_class(self): Return the class of this device. - def unit_of_measurement(self): ...
Implement the Python class `ZWaveMultilevelSensor` described below. Class description: Representation of a multi level sensor Z-Wave sensor. Method signatures and docstrings: - def state(self): Return the state of the sensor. - def device_class(self): Return the class of this device. - def unit_of_measurement(self): ...
2fee32fce03bc49e86cf2e7b741a15621a97cce5
<|skeleton|> class ZWaveMultilevelSensor: """Representation of a multi level sensor Z-Wave sensor.""" def state(self): """Return the state of the sensor.""" <|body_0|> def device_class(self): """Return the class of this device.""" <|body_1|> def unit_of_measurement(sel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ZWaveMultilevelSensor: """Representation of a multi level sensor Z-Wave sensor.""" def state(self): """Return the state of the sensor.""" if self._units in ('C', 'F'): return round(self._state, 1) if isinstance(self._state, float): return round(self._state,...
the_stack_v2_python_sparse
homeassistant/components/zwave/sensor.py
BenWoodford/home-assistant
train
11
44959a235aff017cba9a1bc0dcf0283f4d22c0a9
[ "p_current = head\nval_lsit = []\nwhile p_current:\n val_lsit.append(p_current.val)\n p_current = p_current.next\nreturn self.sortedArrayToBST(val_lsit)", "if nums:\n mid = len(nums) / 2\n node = TreeNode(nums[mid])\n node.left = self.sortedArrayToBST(nums[:mid])\n node.right = self.sortedArrayT...
<|body_start_0|> p_current = head val_lsit = [] while p_current: val_lsit.append(p_current.val) p_current = p_current.next return self.sortedArrayToBST(val_lsit) <|end_body_0|> <|body_start_1|> if nums: mid = len(nums) / 2 node = T...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def sortedListToBST(self, head): """:type head: ListNode :rtype: TreeNode""" <|body_0|> def sortedArrayToBST(self, nums): """:type nums: List[int] :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> p_current = head va...
stack_v2_sparse_classes_36k_train_006901
1,262
no_license
[ { "docstring": ":type head: ListNode :rtype: TreeNode", "name": "sortedListToBST", "signature": "def sortedListToBST(self, head)" }, { "docstring": ":type nums: List[int] :rtype: TreeNode", "name": "sortedArrayToBST", "signature": "def sortedArrayToBST(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortedListToBST(self, head): :type head: ListNode :rtype: TreeNode - def sortedArrayToBST(self, nums): :type nums: List[int] :rtype: TreeNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortedListToBST(self, head): :type head: ListNode :rtype: TreeNode - def sortedArrayToBST(self, nums): :type nums: List[int] :rtype: TreeNode <|skeleton|> class Solution: ...
b7e59ef26a00ebdd3c253ca63f66ea079f9bca54
<|skeleton|> class Solution: def sortedListToBST(self, head): """:type head: ListNode :rtype: TreeNode""" <|body_0|> def sortedArrayToBST(self, nums): """:type nums: List[int] :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def sortedListToBST(self, head): """:type head: ListNode :rtype: TreeNode""" p_current = head val_lsit = [] while p_current: val_lsit.append(p_current.val) p_current = p_current.next return self.sortedArrayToBST(val_lsit) def sorte...
the_stack_v2_python_sparse
DFS/109_covert_sorted_list_to_BST.py
dodoyuan/leetcode_python
train
1
1ea721f901acc1e541f1bfeb8ef637e37c2577ff
[ "l = 0\nr = len(List) - 1\nif l > r:\n return None\nif l == r:\n return TreeNode(List[0])\nmid = int((l + r) / 2)\nroot = TreeNode(List[mid])\nroot.left = self.build_tree(List[:mid])\nroot.right = self.build_tree(List[mid + 1:])\nreturn root", "if not root:\n return []\nqueue = []\nresult = []\nqueue.app...
<|body_start_0|> l = 0 r = len(List) - 1 if l > r: return None if l == r: return TreeNode(List[0]) mid = int((l + r) / 2) root = TreeNode(List[mid]) root.left = self.build_tree(List[:mid]) root.right = self.build_tree(List[mid + 1:]...
BinaryTree
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BinaryTree: def build_tree(self, List): """构建一棵二叉树,数组必须为中序遍历类型,如果数组排好序,那么得到平衡二叉树""" <|body_0|> def PrintFromTopToBottom(self, root): """层序遍历二叉树:从上到下打印二叉树""" <|body_1|> <|end_skeleton|> <|body_start_0|> l = 0 r = len(List) - 1 if l > ...
stack_v2_sparse_classes_36k_train_006902
3,791
no_license
[ { "docstring": "构建一棵二叉树,数组必须为中序遍历类型,如果数组排好序,那么得到平衡二叉树", "name": "build_tree", "signature": "def build_tree(self, List)" }, { "docstring": "层序遍历二叉树:从上到下打印二叉树", "name": "PrintFromTopToBottom", "signature": "def PrintFromTopToBottom(self, root)" } ]
2
null
Implement the Python class `BinaryTree` described below. Class description: Implement the BinaryTree class. Method signatures and docstrings: - def build_tree(self, List): 构建一棵二叉树,数组必须为中序遍历类型,如果数组排好序,那么得到平衡二叉树 - def PrintFromTopToBottom(self, root): 层序遍历二叉树:从上到下打印二叉树
Implement the Python class `BinaryTree` described below. Class description: Implement the BinaryTree class. Method signatures and docstrings: - def build_tree(self, List): 构建一棵二叉树,数组必须为中序遍历类型,如果数组排好序,那么得到平衡二叉树 - def PrintFromTopToBottom(self, root): 层序遍历二叉树:从上到下打印二叉树 <|skeleton|> class BinaryTree: def build_tre...
4e4f739402b95691f6c91411da26d7d3bfe042b6
<|skeleton|> class BinaryTree: def build_tree(self, List): """构建一棵二叉树,数组必须为中序遍历类型,如果数组排好序,那么得到平衡二叉树""" <|body_0|> def PrintFromTopToBottom(self, root): """层序遍历二叉树:从上到下打印二叉树""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BinaryTree: def build_tree(self, List): """构建一棵二叉树,数组必须为中序遍历类型,如果数组排好序,那么得到平衡二叉树""" l = 0 r = len(List) - 1 if l > r: return None if l == r: return TreeNode(List[0]) mid = int((l + r) / 2) root = TreeNode(List[mid]) root.l...
the_stack_v2_python_sparse
剑指offer/57.二叉树的下一个结点.py
hugechuanqi/Algorithms-and-Data-Structures
train
3
babf78034a9a30fff341ff3da6eb4a6214f9e009
[ "Target(id=1, user=2, type='standard', latitude=10, longitude=-10, orientation='n', shape='circle', background_color='white', alphanumeric='a', alphanumeric_color='black')\nTarget(type='qrc', latitude=10, longitude=-10, description='http://test.com')\nTarget(type='off_axis', latitude=10, longitude=-10, orientation=...
<|body_start_0|> Target(id=1, user=2, type='standard', latitude=10, longitude=-10, orientation='n', shape='circle', background_color='white', alphanumeric='a', alphanumeric_color='black') Target(type='qrc', latitude=10, longitude=-10, description='http://test.com') Target(type='off_axis', latitu...
Tests the Target model for validation and serialization.
TestTarget
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestTarget: """Tests the Target model for validation and serialization.""" def test_valid(self): """Test valid inputs.""" <|body_0|> def test_invalid(self): """Test invalid inputs.""" <|body_1|> def test_serialize(self): """Test serialization...
stack_v2_sparse_classes_36k_train_006903
14,890
permissive
[ { "docstring": "Test valid inputs.", "name": "test_valid", "signature": "def test_valid(self)" }, { "docstring": "Test invalid inputs.", "name": "test_invalid", "signature": "def test_invalid(self)" }, { "docstring": "Test serialization.", "name": "test_serialize", "signa...
4
stack_v2_sparse_classes_30k_val_000505
Implement the Python class `TestTarget` described below. Class description: Tests the Target model for validation and serialization. Method signatures and docstrings: - def test_valid(self): Test valid inputs. - def test_invalid(self): Test invalid inputs. - def test_serialize(self): Test serialization. - def test_de...
Implement the Python class `TestTarget` described below. Class description: Tests the Target model for validation and serialization. Method signatures and docstrings: - def test_valid(self): Test valid inputs. - def test_invalid(self): Test invalid inputs. - def test_serialize(self): Test serialization. - def test_de...
509f36562fc895433fcd01da755a35dd04581025
<|skeleton|> class TestTarget: """Tests the Target model for validation and serialization.""" def test_valid(self): """Test valid inputs.""" <|body_0|> def test_invalid(self): """Test invalid inputs.""" <|body_1|> def test_serialize(self): """Test serialization...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestTarget: """Tests the Target model for validation and serialization.""" def test_valid(self): """Test valid inputs.""" Target(id=1, user=2, type='standard', latitude=10, longitude=-10, orientation='n', shape='circle', background_color='white', alphanumeric='a', alphanumeric_color='blac...
the_stack_v2_python_sparse
client/interop/types_test.py
matcheydj/interop
train
1
884b86e1c63265020f9e0eb79cf147ec697ffe39
[ "self.conditions_dict = conditions_dict\nself.axes_vars = axes_vars\nself.x_axis_label = labels['x_axis']\nself.y_axis_label = labels['y_axis']\nsuper(VegaGraphBarBase, self).__init__(output_path, input_path, config_dir, labels)\nself.graph_type = 'barbase'", "pandas_df = super(VegaGraphBarBase, self).parse_jsons...
<|body_start_0|> self.conditions_dict = conditions_dict self.axes_vars = axes_vars self.x_axis_label = labels['x_axis'] self.y_axis_label = labels['y_axis'] super(VegaGraphBarBase, self).__init__(output_path, input_path, config_dir, labels) self.graph_type = 'barbase' <|e...
Class for converting json outputs of different algorithms to vega-specific bar or scatter graph json files. This class is a child class of VegaGraphBase and inherits all the methods and variables. It serves as a base class to VegaGraphBar and VegaGraphScatter. Attributes: output_path: the output directory to write the ...
VegaGraphBarBase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VegaGraphBarBase: """Class for converting json outputs of different algorithms to vega-specific bar or scatter graph json files. This class is a child class of VegaGraphBase and inherits all the methods and variables. It serves as a base class to VegaGraphBar and VegaGraphScatter. Attributes: out...
stack_v2_sparse_classes_36k_train_006904
16,246
no_license
[ { "docstring": "Instantiate the input arguments. References the base class __init__ to instantiate recurring ones.", "name": "__init__", "signature": "def __init__(self, output_path, input_path, config_dir, labels, conditions_dict, axes_vars)" }, { "docstring": "Parses the input json files using...
2
stack_v2_sparse_classes_30k_train_014019
Implement the Python class `VegaGraphBarBase` described below. Class description: Class for converting json outputs of different algorithms to vega-specific bar or scatter graph json files. This class is a child class of VegaGraphBase and inherits all the methods and variables. It serves as a base class to VegaGraphBa...
Implement the Python class `VegaGraphBarBase` described below. Class description: Class for converting json outputs of different algorithms to vega-specific bar or scatter graph json files. This class is a child class of VegaGraphBase and inherits all the methods and variables. It serves as a base class to VegaGraphBa...
d42ec8e8328117d70fb910f2d1f751ce15862810
<|skeleton|> class VegaGraphBarBase: """Class for converting json outputs of different algorithms to vega-specific bar or scatter graph json files. This class is a child class of VegaGraphBase and inherits all the methods and variables. It serves as a base class to VegaGraphBar and VegaGraphScatter. Attributes: out...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VegaGraphBarBase: """Class for converting json outputs of different algorithms to vega-specific bar or scatter graph json files. This class is a child class of VegaGraphBase and inherits all the methods and variables. It serves as a base class to VegaGraphBar and VegaGraphScatter. Attributes: output_path: the...
the_stack_v2_python_sparse
scripts/json2vega.py
gunrock/io
train
11
2382713acf4aaceb8e09d117e2612d6e6b5bc617
[ "for i in range(rows):\n for j in range(cols):\n if matrix[i * cols + j] == path[0]:\n if self.find(list(matrix), rows, cols, path[1:], i, j):\n return True", "if not path:\n return True\nmatrix[i * cols + j] = '0'\nif j + 1 < cols and matrix[i * cols + (j + 1)] == path[0]:\...
<|body_start_0|> for i in range(rows): for j in range(cols): if matrix[i * cols + j] == path[0]: if self.find(list(matrix), rows, cols, path[1:], i, j): return True <|end_body_0|> <|body_start_1|> if not path: return Tr...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def hasPath(self, matrix, rows, cols, path): """首先,在矩阵中任选一个格子作为路径的起点。如果路径上的第i个字符不是ch,那么这个格子不可能处在路径上的 第i个位置。如果路径上的第i个字符正好是ch,那么往相邻的格子寻找路径上的第i+1个字符。 除在矩阵边界上的格子之外,其他格子都有4个相邻的格子。重复这个过程直到路径上的所有字符都在矩阵中找到相应的位置。 由于回朔法的递归特性,路径可以被开成一个栈。当在矩阵中定位了路径中前n个字符的位置之后, 在与第n个字符对应的格子的周围都没有找到第n+1个字符,这...
stack_v2_sparse_classes_36k_train_006905
3,558
no_license
[ { "docstring": "首先,在矩阵中任选一个格子作为路径的起点。如果路径上的第i个字符不是ch,那么这个格子不可能处在路径上的 第i个位置。如果路径上的第i个字符正好是ch,那么往相邻的格子寻找路径上的第i+1个字符。 除在矩阵边界上的格子之外,其他格子都有4个相邻的格子。重复这个过程直到路径上的所有字符都在矩阵中找到相应的位置。 由于回朔法的递归特性,路径可以被开成一个栈。当在矩阵中定位了路径中前n个字符的位置之后, 在与第n个字符对应的格子的周围都没有找到第n+1个字符,这个时候只要在路径上回到第n-1个字符,重新定位第n个字符。 由于路径不能重复进入矩阵的格子,还需要定义和字符矩阵大小一样的布尔值矩阵...
2
stack_v2_sparse_classes_30k_train_018336
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasPath(self, matrix, rows, cols, path): 首先,在矩阵中任选一个格子作为路径的起点。如果路径上的第i个字符不是ch,那么这个格子不可能处在路径上的 第i个位置。如果路径上的第i个字符正好是ch,那么往相邻的格子寻找路径上的第i+1个字符。 除在矩阵边界上的格子之外,其他格子都有4个相邻的格子。重复这个过程直...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasPath(self, matrix, rows, cols, path): 首先,在矩阵中任选一个格子作为路径的起点。如果路径上的第i个字符不是ch,那么这个格子不可能处在路径上的 第i个位置。如果路径上的第i个字符正好是ch,那么往相邻的格子寻找路径上的第i+1个字符。 除在矩阵边界上的格子之外,其他格子都有4个相邻的格子。重复这个过程直...
c756fe54e8e17e9ba0bfdab5fccc24ac89263d90
<|skeleton|> class Solution: def hasPath(self, matrix, rows, cols, path): """首先,在矩阵中任选一个格子作为路径的起点。如果路径上的第i个字符不是ch,那么这个格子不可能处在路径上的 第i个位置。如果路径上的第i个字符正好是ch,那么往相邻的格子寻找路径上的第i+1个字符。 除在矩阵边界上的格子之外,其他格子都有4个相邻的格子。重复这个过程直到路径上的所有字符都在矩阵中找到相应的位置。 由于回朔法的递归特性,路径可以被开成一个栈。当在矩阵中定位了路径中前n个字符的位置之后, 在与第n个字符对应的格子的周围都没有找到第n+1个字符,这...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def hasPath(self, matrix, rows, cols, path): """首先,在矩阵中任选一个格子作为路径的起点。如果路径上的第i个字符不是ch,那么这个格子不可能处在路径上的 第i个位置。如果路径上的第i个字符正好是ch,那么往相邻的格子寻找路径上的第i+1个字符。 除在矩阵边界上的格子之外,其他格子都有4个相邻的格子。重复这个过程直到路径上的所有字符都在矩阵中找到相应的位置。 由于回朔法的递归特性,路径可以被开成一个栈。当在矩阵中定位了路径中前n个字符的位置之后, 在与第n个字符对应的格子的周围都没有找到第n+1个字符,这个时候只要在路径上回到第n-...
the_stack_v2_python_sparse
newcoder_offer/has_path.py
EarthChen/LeetCode_Record
train
0
2e75b1dfa79a3d7e52dbc65e4ace1a241ffe6ecb
[ "self.url = url\nself.query = query\nself.make_request = make_request\nself.use_get = use_get", "if rows:\n self.query['rows'] = rows\nif 'rows' not in self.query:\n self.query['rows'] = 10\nself.query['start'] = 0\nend = False\ndocs_retrieved = 0\nwhile not end:\n if self.use_get:\n http_response...
<|body_start_0|> self.url = url self.query = query self.make_request = make_request self.use_get = use_get <|end_body_0|> <|body_start_1|> if rows: self.query['rows'] = rows if 'rows' not in self.query: self.query['rows'] = 10 self.query['...
Implements the concept of cursor in relational databases
Cursor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cursor: """Implements the concept of cursor in relational databases""" def __init__(self, url, query, make_request=requests, use_get=False): """Cursor initialization""" <|body_0|> def fetch(self, rows=None): """Generator method that grabs all the documents in bul...
stack_v2_sparse_classes_36k_train_006906
47,807
no_license
[ { "docstring": "Cursor initialization", "name": "__init__", "signature": "def __init__(self, url, query, make_request=requests, use_get=False)" }, { "docstring": "Generator method that grabs all the documents in bulk sets of 'rows' documents :param rows: number of rows for each request", "na...
2
null
Implement the Python class `Cursor` described below. Class description: Implements the concept of cursor in relational databases Method signatures and docstrings: - def __init__(self, url, query, make_request=requests, use_get=False): Cursor initialization - def fetch(self, rows=None): Generator method that grabs all...
Implement the Python class `Cursor` described below. Class description: Implements the concept of cursor in relational databases Method signatures and docstrings: - def __init__(self, url, query, make_request=requests, use_get=False): Cursor initialization - def fetch(self, rows=None): Generator method that grabs all...
0ac6653219c2701c13c508c5c4fc9bc3437eea06
<|skeleton|> class Cursor: """Implements the concept of cursor in relational databases""" def __init__(self, url, query, make_request=requests, use_get=False): """Cursor initialization""" <|body_0|> def fetch(self, rows=None): """Generator method that grabs all the documents in bul...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Cursor: """Implements the concept of cursor in relational databases""" def __init__(self, url, query, make_request=requests, use_get=False): """Cursor initialization""" self.url = url self.query = query self.make_request = make_request self.use_get = use_get d...
the_stack_v2_python_sparse
repoData/RedTuna-mysolr/allPythonContent.py
aCoffeeYin/pyreco
train
0
14b0ec57320083bc44b3a228ac206941b7b9e587
[ "files = self.files.getlist('file_field')\nfor file in files:\n validators.validate_filename(file.name)\n if not file:\n raise forms.ValidationError('Could not read file: %(file_name)s', params={'file_name': file.name})\nfor file in files:\n if file.size > ActiveProject.INDIVIDUAL_FILE_SIZE_LIMIT:\n...
<|body_start_0|> files = self.files.getlist('file_field') for file in files: validators.validate_filename(file.name) if not file: raise forms.ValidationError('Could not read file: %(file_name)s', params={'file_name': file.name}) for file in files: ...
Form for uploading multiple files to a project. `subdir` is the project subdirectory relative to the file root.
UploadFilesForm
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UploadFilesForm: """Form for uploading multiple files to a project. `subdir` is the project subdirectory relative to the file root.""" def clean_file_field(self): """Check for file name, size limits and whether they are readable""" <|body_0|> def perform_action(self): ...
stack_v2_sparse_classes_36k_train_006907
39,361
permissive
[ { "docstring": "Check for file name, size limits and whether they are readable", "name": "clean_file_field", "signature": "def clean_file_field(self)" }, { "docstring": "Upload the files", "name": "perform_action", "signature": "def perform_action(self)" } ]
2
stack_v2_sparse_classes_30k_test_000960
Implement the Python class `UploadFilesForm` described below. Class description: Form for uploading multiple files to a project. `subdir` is the project subdirectory relative to the file root. Method signatures and docstrings: - def clean_file_field(self): Check for file name, size limits and whether they are readabl...
Implement the Python class `UploadFilesForm` described below. Class description: Form for uploading multiple files to a project. `subdir` is the project subdirectory relative to the file root. Method signatures and docstrings: - def clean_file_field(self): Check for file name, size limits and whether they are readabl...
e7c8ed0b07a4c9a1b4007f6089f59aafa6a3ac57
<|skeleton|> class UploadFilesForm: """Form for uploading multiple files to a project. `subdir` is the project subdirectory relative to the file root.""" def clean_file_field(self): """Check for file name, size limits and whether they are readable""" <|body_0|> def perform_action(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UploadFilesForm: """Form for uploading multiple files to a project. `subdir` is the project subdirectory relative to the file root.""" def clean_file_field(self): """Check for file name, size limits and whether they are readable""" files = self.files.getlist('file_field') for file...
the_stack_v2_python_sparse
physionet-django/project/forms.py
tompollard/physionet-build
train
0
403b4b9ba23ba10354f7848c7a985f2d35c59b54
[ "details = {}\nselector = 'table > tbody > tr'\nfor resource, unit, used in root.cssselect(selector):\n name = resource.findtext('strong').strip()\n details[name] = (used.text.strip(), unit.text.strip())\nreturn details", "events = []\nselector = '#ae-billing-logs-table > tbody > tr'\nfor date_elt, event_el...
<|body_start_0|> details = {} selector = 'table > tbody > tr' for resource, unit, used in root.cssselect(selector): name = resource.findtext('strong').strip() details[name] = (used.text.strip(), unit.text.strip()) return details <|end_body_0|> <|body_start_1|> ...
An API for the contents of /billing/history as structured data.
BillingHistory
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BillingHistory: """An API for the contents of /billing/history as structured data.""" def _usage_report_dict(self, root): """Extract usage report details from the element that contains the table with columns resource, unit, used.""" <|body_0|> def event_dicts(self): ...
stack_v2_sparse_classes_36k_train_006908
15,505
no_license
[ { "docstring": "Extract usage report details from the element that contains the table with columns resource, unit, used.", "name": "_usage_report_dict", "signature": "def _usage_report_dict(self, root)" }, { "docstring": "Information about each row in the billing history table. Entries match the...
2
stack_v2_sparse_classes_30k_test_000204
Implement the Python class `BillingHistory` described below. Class description: An API for the contents of /billing/history as structured data. Method signatures and docstrings: - def _usage_report_dict(self, root): Extract usage report details from the element that contains the table with columns resource, unit, use...
Implement the Python class `BillingHistory` described below. Class description: An API for the contents of /billing/history as structured data. Method signatures and docstrings: - def _usage_report_dict(self, root): Extract usage report details from the element that contains the table with columns resource, unit, use...
c4ad2ad67b497ce411a9e5d6d6db407ee304491f
<|skeleton|> class BillingHistory: """An API for the contents of /billing/history as structured data.""" def _usage_report_dict(self, root): """Extract usage report details from the element that contains the table with columns resource, unit, used.""" <|body_0|> def event_dicts(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BillingHistory: """An API for the contents of /billing/history as structured data.""" def _usage_report_dict(self, root): """Extract usage report details from the element that contains the table with columns resource, unit, used.""" details = {} selector = 'table > tbody > tr' ...
the_stack_v2_python_sparse
src/gae_dashboard/parsers.py
summer-liu/analytics
train
1
e14f5f493f1270683ae216a11c4bef6faf33476c
[ "exp_last_playthrough = user_domain.ExpUserLastPlaythrough('user_id0', 'exp_id0', 0, 'last_updated', 'state0')\nself.assertEqual(exp_last_playthrough.id, 'user_id0.exp_id0')\nself.assertEqual(exp_last_playthrough.user_id, 'user_id0')\nself.assertEqual(exp_last_playthrough.exploration_id, 'exp_id0')\nself.assertEqua...
<|body_start_0|> exp_last_playthrough = user_domain.ExpUserLastPlaythrough('user_id0', 'exp_id0', 0, 'last_updated', 'state0') self.assertEqual(exp_last_playthrough.id, 'user_id0.exp_id0') self.assertEqual(exp_last_playthrough.user_id, 'user_id0') self.assertEqual(exp_last_playthrough.ex...
Testing domain object for an exploration last playthrough model.
ExpUserLastPlaythroughTests
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExpUserLastPlaythroughTests: """Testing domain object for an exploration last playthrough model.""" def test_initialization(self): """Testing init method.""" <|body_0|> def test_update_last_played_information(self): """Testing update_last_played_information.""" ...
stack_v2_sparse_classes_36k_train_006909
14,816
permissive
[ { "docstring": "Testing init method.", "name": "test_initialization", "signature": "def test_initialization(self)" }, { "docstring": "Testing update_last_played_information.", "name": "test_update_last_played_information", "signature": "def test_update_last_played_information(self)" } ...
2
null
Implement the Python class `ExpUserLastPlaythroughTests` described below. Class description: Testing domain object for an exploration last playthrough model. Method signatures and docstrings: - def test_initialization(self): Testing init method. - def test_update_last_played_information(self): Testing update_last_pla...
Implement the Python class `ExpUserLastPlaythroughTests` described below. Class description: Testing domain object for an exploration last playthrough model. Method signatures and docstrings: - def test_initialization(self): Testing init method. - def test_update_last_played_information(self): Testing update_last_pla...
899b9755a6b795a8991e596055ac24065a8435e0
<|skeleton|> class ExpUserLastPlaythroughTests: """Testing domain object for an exploration last playthrough model.""" def test_initialization(self): """Testing init method.""" <|body_0|> def test_update_last_played_information(self): """Testing update_last_played_information.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExpUserLastPlaythroughTests: """Testing domain object for an exploration last playthrough model.""" def test_initialization(self): """Testing init method.""" exp_last_playthrough = user_domain.ExpUserLastPlaythrough('user_id0', 'exp_id0', 0, 'last_updated', 'state0') self.assertEq...
the_stack_v2_python_sparse
core/domain/user_domain_test.py
import-keshav/oppia
train
4
28b89ed7181549671d04e7db1210fffaf1250ab2
[ "line = data[0]\ntext = line.get('data') or line.get('body')\nif isinstance(text, (bytes, bytearray)):\n text = text.decode('utf-8')\ntext = self._remove_html_tags(text)\ntext = text.lower()\ntext = self._expand_contractions(text)\ntext = self._remove_accented_characters(text)\ntext = self._remove_punctuation(te...
<|body_start_0|> line = data[0] text = line.get('data') or line.get('body') if isinstance(text, (bytes, bytearray)): text = text.decode('utf-8') text = self._remove_html_tags(text) text = text.lower() text = self._expand_contractions(text) text = self....
TextClassifier handler class. This handler takes a text (string) and as input and returns the classification text based on the model vocabulary.
TextClassifier
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextClassifier: """TextClassifier handler class. This handler takes a text (string) and as input and returns the classification text based on the model vocabulary.""" def preprocess(self, data): """Normalizes the input text for PyTorch model using following basic cleanup operations :...
stack_v2_sparse_classes_36k_train_006910
5,272
permissive
[ { "docstring": "Normalizes the input text for PyTorch model using following basic cleanup operations : - remove html tags - lowercase all text - expand contractions [like I'd -> I would, don't -> do not] - remove accented characters - remove punctuations Converts the normalized text to tensor using the source_v...
4
null
Implement the Python class `TextClassifier` described below. Class description: TextClassifier handler class. This handler takes a text (string) and as input and returns the classification text based on the model vocabulary. Method signatures and docstrings: - def preprocess(self, data): Normalizes the input text for...
Implement the Python class `TextClassifier` described below. Class description: TextClassifier handler class. This handler takes a text (string) and as input and returns the classification text based on the model vocabulary. Method signatures and docstrings: - def preprocess(self, data): Normalizes the input text for...
242895c6b4596c4119ec09d6139e627c5dd696b6
<|skeleton|> class TextClassifier: """TextClassifier handler class. This handler takes a text (string) and as input and returns the classification text based on the model vocabulary.""" def preprocess(self, data): """Normalizes the input text for PyTorch model using following basic cleanup operations :...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TextClassifier: """TextClassifier handler class. This handler takes a text (string) and as input and returns the classification text based on the model vocabulary.""" def preprocess(self, data): """Normalizes the input text for PyTorch model using following basic cleanup operations : - remove htm...
the_stack_v2_python_sparse
ts/torch_handler/text_classifier.py
pytorch/serve
train
3,689
ebb7360a92565566b9eeeb34a054aaf70a7e4b88
[ "user = users.get_current_user()\nif not utils.IsValidSheriffUser():\n message = 'User \"%s\" not authorized.' % user\n self.response.out.write(json.dumps({'error': message}))\n return\nstep = self.request.get('step')\nif step == 'prefill-info':\n result = _PrefillInfo(self.request.get('test_path'))\nel...
<|body_start_0|> user = users.get_current_user() if not utils.IsValidSheriffUser(): message = 'User "%s" not authorized.' % user self.response.out.write(json.dumps({'error': message})) return step = self.request.get('step') if step == 'prefill-info': ...
URL endpoint for AJAX requests for bisect config handling. Requests are made to this end-point by bisect and trace forms. This handler does several different types of things depending on what is given as the value of the "step" parameter: "prefill-info": Returns JSON with some info to fill into the form. "perform-bisec...
StartBisectHandler
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StartBisectHandler: """URL endpoint for AJAX requests for bisect config handling. Requests are made to this end-point by bisect and trace forms. This handler does several different types of things depending on what is given as the value of the "step" parameter: "prefill-info": Returns JSON with s...
stack_v2_sparse_classes_36k_train_006911
32,152
permissive
[ { "docstring": "Performs one of several bisect-related actions depending on parameters. The only required parameter is \"step\", which indicates what to do. This end-point should always output valid JSON with different contents depending on the value of \"step\".", "name": "post", "signature": "def post...
3
stack_v2_sparse_classes_30k_train_000437
Implement the Python class `StartBisectHandler` described below. Class description: URL endpoint for AJAX requests for bisect config handling. Requests are made to this end-point by bisect and trace forms. This handler does several different types of things depending on what is given as the value of the "step" paramet...
Implement the Python class `StartBisectHandler` described below. Class description: URL endpoint for AJAX requests for bisect config handling. Requests are made to this end-point by bisect and trace forms. This handler does several different types of things depending on what is given as the value of the "step" paramet...
9df8ce98c2a14fb60c2f581853011e32eb4bed0f
<|skeleton|> class StartBisectHandler: """URL endpoint for AJAX requests for bisect config handling. Requests are made to this end-point by bisect and trace forms. This handler does several different types of things depending on what is given as the value of the "step" parameter: "prefill-info": Returns JSON with s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StartBisectHandler: """URL endpoint for AJAX requests for bisect config handling. Requests are made to this end-point by bisect and trace forms. This handler does several different types of things depending on what is given as the value of the "step" parameter: "prefill-info": Returns JSON with some info to f...
the_stack_v2_python_sparse
third_party/catapult/dashboard/dashboard/start_try_job.py
hanpfei/chromium-net
train
297
ba645af633f7f4a33f2f0a081764ef39cff4b024
[ "island = 0\nfor row in range(len(grid)):\n for column in range(len(grid[row])):\n if grid[row][column] == '1':\n island += 1\n self.expand_island(grid, row, column)\nreturn island", "if row < 0 or row >= len(grid) or column < 0 or (column >= len(grid[row])):\n return\nif grid[r...
<|body_start_0|> island = 0 for row in range(len(grid)): for column in range(len(grid[row])): if grid[row][column] == '1': island += 1 self.expand_island(grid, row, column) return island <|end_body_0|> <|body_start_1|> ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numIslands(self, grid): """:type grid: List[List[str]] :rtype: int""" <|body_0|> def expand_island(self, grid, row, column): """Helper function to perform DFS search on the grid""" <|body_1|> def area_of_island(self, grid, row, column): ...
stack_v2_sparse_classes_36k_train_006912
1,843
permissive
[ { "docstring": ":type grid: List[List[str]] :rtype: int", "name": "numIslands", "signature": "def numIslands(self, grid)" }, { "docstring": "Helper function to perform DFS search on the grid", "name": "expand_island", "signature": "def expand_island(self, grid, row, column)" }, { ...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numIslands(self, grid): :type grid: List[List[str]] :rtype: int - def expand_island(self, grid, row, column): Helper function to perform DFS search on the grid - def area_of_...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numIslands(self, grid): :type grid: List[List[str]] :rtype: int - def expand_island(self, grid, row, column): Helper function to perform DFS search on the grid - def area_of_...
547c200b627c774535bc22880b16d5390183aeba
<|skeleton|> class Solution: def numIslands(self, grid): """:type grid: List[List[str]] :rtype: int""" <|body_0|> def expand_island(self, grid, row, column): """Helper function to perform DFS search on the grid""" <|body_1|> def area_of_island(self, grid, row, column): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def numIslands(self, grid): """:type grid: List[List[str]] :rtype: int""" island = 0 for row in range(len(grid)): for column in range(len(grid[row])): if grid[row][column] == '1': island += 1 self.expand_isla...
the_stack_v2_python_sparse
medium/200_number_of_islands.py
Sukhrobjon/leetcode
train
0
bf52cdb366bf2827c2168f9a33a80c59443be497
[ "super().__init__()\nself._use_condition = use_condition\nself._model = self._get_coupling_layers(num_layers=4, num_channels_hidden=[32, 32], compression_size=compression_size)", "mask = tf.range(4096, dtype=tf.float32)\nmask = tf.reshape(mask, shape=[64, 64, 1]) % 2\nlayers = []\nfor _ in range(num_layers):\n ...
<|body_start_0|> super().__init__() self._use_condition = use_condition self._model = self._get_coupling_layers(num_layers=4, num_channels_hidden=[32, 32], compression_size=compression_size) <|end_body_0|> <|body_start_1|> mask = tf.range(4096, dtype=tf.float32) mask = tf.reshap...
Embedding conditioned flow model. Attributes: _use_condition:
EmbeddingConditionedFlow
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmbeddingConditionedFlow: """Embedding conditioned flow model. Attributes: _use_condition:""" def __init__(self, use_condition, compression_size): """Initializes the object. Args: use_condition: compression_size:""" <|body_0|> def _get_coupling_layers(self, num_layers, n...
stack_v2_sparse_classes_36k_train_006913
12,897
no_license
[ { "docstring": "Initializes the object. Args: use_condition: compression_size:", "name": "__init__", "signature": "def __init__(self, use_condition, compression_size)" }, { "docstring": "Returns a list of convolutional affine coupling layers. Args: num_layers: num_channels_hidden: compression_si...
3
stack_v2_sparse_classes_30k_train_007534
Implement the Python class `EmbeddingConditionedFlow` described below. Class description: Embedding conditioned flow model. Attributes: _use_condition: Method signatures and docstrings: - def __init__(self, use_condition, compression_size): Initializes the object. Args: use_condition: compression_size: - def _get_cou...
Implement the Python class `EmbeddingConditionedFlow` described below. Class description: Embedding conditioned flow model. Attributes: _use_condition: Method signatures and docstrings: - def __init__(self, use_condition, compression_size): Initializes the object. Args: use_condition: compression_size: - def _get_cou...
6d04861ef87ba2ba2a4182ad36f3b322fcf47cfa
<|skeleton|> class EmbeddingConditionedFlow: """Embedding conditioned flow model. Attributes: _use_condition:""" def __init__(self, use_condition, compression_size): """Initializes the object. Args: use_condition: compression_size:""" <|body_0|> def _get_coupling_layers(self, num_layers, n...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EmbeddingConditionedFlow: """Embedding conditioned flow model. Attributes: _use_condition:""" def __init__(self, use_condition, compression_size): """Initializes the object. Args: use_condition: compression_size:""" super().__init__() self._use_condition = use_condition se...
the_stack_v2_python_sparse
flow.py
gaotianxiang/text-to-image-synthesis
train
0
942e20fa65f0a304ef68a184de15e6472a24b5c6
[ "super().__init__(*args, **kwargs)\nself.mode = None\nself.axis = None", "if isinstance(self.args, dict):\n self.mode = engine.evaluate(self.args.get('mode'), recursive=True)\n self.axis = engine.evaluate(self.args.get('axis'), recursive=True)\nelse:\n self.mode = self.args\n self.axis = Merge.DEFAULT...
<|body_start_0|> super().__init__(*args, **kwargs) self.mode = None self.axis = None <|end_body_0|> <|body_start_1|> if isinstance(self.args, dict): self.mode = engine.evaluate(self.args.get('mode'), recursive=True) self.axis = engine.evaluate(self.args.get('axis...
A container for merging inputs from multiple input layers.
Merge
[ "Apache-2.0", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Merge: """A container for merging inputs from multiple input layers.""" def __init__(self, *args, **kwargs): """Create a new merge container.""" <|body_0|> def _parse(self, engine): """Parse the child containers""" <|body_1|> def _build(self, model):...
stack_v2_sparse_classes_36k_train_006914
4,408
permissive
[ { "docstring": "Create a new merge container.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Parse the child containers", "name": "_parse", "signature": "def _parse(self, engine)" }, { "docstring": "Instantiate the container.", "na...
4
stack_v2_sparse_classes_30k_train_006968
Implement the Python class `Merge` described below. Class description: A container for merging inputs from multiple input layers. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Create a new merge container. - def _parse(self, engine): Parse the child containers - def _build(self, model): Ins...
Implement the Python class `Merge` described below. Class description: A container for merging inputs from multiple input layers. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Create a new merge container. - def _parse(self, engine): Parse the child containers - def _build(self, model): Ins...
fd0c120e50815c1e5be64e5dde964dcd47234556
<|skeleton|> class Merge: """A container for merging inputs from multiple input layers.""" def __init__(self, *args, **kwargs): """Create a new merge container.""" <|body_0|> def _parse(self, engine): """Parse the child containers""" <|body_1|> def _build(self, model):...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Merge: """A container for merging inputs from multiple input layers.""" def __init__(self, *args, **kwargs): """Create a new merge container.""" super().__init__(*args, **kwargs) self.mode = None self.axis = None def _parse(self, engine): """Parse the child co...
the_stack_v2_python_sparse
kur/containers/layers/merge.py
deepgram/kur
train
873
828834957515fcb5d972577a44c7b92568fd54ec
[ "assert isinstance(reversible_blocks, nn.ModuleList)\nfor block in reversible_blocks:\n assert isinstance(block, ReversibleBlock)\n x = block(x)\nctx.y = x.detach()\nctx.reversible_blocks = reversible_blocks\nctx.eagerly_discard_variables = eagerly_discard_variables\nreturn x", "y = ctx.y\nif ctx.eagerly_di...
<|body_start_0|> assert isinstance(reversible_blocks, nn.ModuleList) for block in reversible_blocks: assert isinstance(block, ReversibleBlock) x = block(x) ctx.y = x.detach() ctx.reversible_blocks = reversible_blocks ctx.eagerly_discard_variables = eagerly...
Integrates the reversible sequence into the autograd framework
_ReversibleModuleFunction
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _ReversibleModuleFunction: """Integrates the reversible sequence into the autograd framework""" def forward(ctx, x, reversible_blocks, eagerly_discard_variables): """Performs the forward pass of a reversible sequence within the autograd framework :param ctx: autograd context :param x...
stack_v2_sparse_classes_36k_train_006915
8,406
no_license
[ { "docstring": "Performs the forward pass of a reversible sequence within the autograd framework :param ctx: autograd context :param x: input tensor :param reversible_blocks: nn.Modulelist of reversible blocks :return: output tensor", "name": "forward", "signature": "def forward(ctx, x, reversible_block...
2
stack_v2_sparse_classes_30k_train_010074
Implement the Python class `_ReversibleModuleFunction` described below. Class description: Integrates the reversible sequence into the autograd framework Method signatures and docstrings: - def forward(ctx, x, reversible_blocks, eagerly_discard_variables): Performs the forward pass of a reversible sequence within the...
Implement the Python class `_ReversibleModuleFunction` described below. Class description: Integrates the reversible sequence into the autograd framework Method signatures and docstrings: - def forward(ctx, x, reversible_blocks, eagerly_discard_variables): Performs the forward pass of a reversible sequence within the...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class _ReversibleModuleFunction: """Integrates the reversible sequence into the autograd framework""" def forward(ctx, x, reversible_blocks, eagerly_discard_variables): """Performs the forward pass of a reversible sequence within the autograd framework :param ctx: autograd context :param x...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _ReversibleModuleFunction: """Integrates the reversible sequence into the autograd framework""" def forward(ctx, x, reversible_blocks, eagerly_discard_variables): """Performs the forward pass of a reversible sequence within the autograd framework :param ctx: autograd context :param x: input tenso...
the_stack_v2_python_sparse
generated/test_RobinBruegger_RevTorch.py
jansel/pytorch-jit-paritybench
train
35
8f8cc14c49fcc3b32700f45d86938c1e30d241b0
[ "collections = repo.filter_by(Collection, deleted=False)\niris = True if request.args.get('iris') == '1' else False\ncontainer = {'id': url_for('api.index', _external=True), 'label': 'All collections', 'type': ['AnnotationCollection', 'BasicContainer'], 'total': len(collections), 'items': self._decorate_page_items(...
<|body_start_0|> collections = repo.filter_by(Collection, deleted=False) iris = True if request.args.get('iris') == '1' else False container = {'id': url_for('api.index', _external=True), 'label': 'All collections', 'type': ['AnnotationCollection', 'BasicContainer'], 'total': len(collections), '...
Index API class.
IndexAPI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IndexAPI: """Index API class.""" def get(self): """Return a list of all AnnotationCollections.""" <|body_0|> def post(self): """Create an AnnotationCollection.""" <|body_1|> <|end_skeleton|> <|body_start_0|> collections = repo.filter_by(Collecti...
stack_v2_sparse_classes_36k_train_006916
1,290
permissive
[ { "docstring": "Return a list of all AnnotationCollections.", "name": "get", "signature": "def get(self)" }, { "docstring": "Create an AnnotationCollection.", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_017819
Implement the Python class `IndexAPI` described below. Class description: Index API class. Method signatures and docstrings: - def get(self): Return a list of all AnnotationCollections. - def post(self): Create an AnnotationCollection.
Implement the Python class `IndexAPI` described below. Class description: Index API class. Method signatures and docstrings: - def get(self): Return a list of all AnnotationCollections. - def post(self): Create an AnnotationCollection. <|skeleton|> class IndexAPI: """Index API class.""" def get(self): ...
bc504498ef330fab46f2334f96631457d520ec90
<|skeleton|> class IndexAPI: """Index API class.""" def get(self): """Return a list of all AnnotationCollections.""" <|body_0|> def post(self): """Create an AnnotationCollection.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IndexAPI: """Index API class.""" def get(self): """Return a list of all AnnotationCollections.""" collections = repo.filter_by(Collection, deleted=False) iris = True if request.args.get('iris') == '1' else False container = {'id': url_for('api.index', _external=True), 'lab...
the_stack_v2_python_sparse
explicates/api/index.py
alexandermendes/explicates
train
8
a9927bece47be6cfe05ea1b14ab8e40cccc7bb16
[ "self.splitLine = '/*----------*/'\nself.path = logFilePath\nself.fun = otherFun if otherFun else lambda: ''\nself.printt = printOnCmd\nself.localTime = localTime\nself.format = ' Index :{index}, {time}\\n{timeClass} :{timeStr}\\n Exception :{exceptionName}\\n Message :{message}\\n Args :{args}\\n{otherI...
<|body_start_0|> self.splitLine = '/*----------*/' self.path = logFilePath self.fun = otherFun if otherFun else lambda: '' self.printt = printOnCmd self.localTime = localTime self.format = ' Index :{index}, {time}\n{timeClass} :{timeStr}\n Exception :{exceptionName}\n...
用于扑捉和记录函数中的异常错误 usage: loge = LogException(logFilePath,otherFun) # 先实例一个对象 loge.listen(f,*l,**args) # 用 .listen 运行函数 @loge.decorator # 装饰被监听函数
LogException
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LogException: """用于扑捉和记录函数中的异常错误 usage: loge = LogException(logFilePath,otherFun) # 先实例一个对象 loge.listen(f,*l,**args) # 用 .listen 运行函数 @loge.decorator # 装饰被监听函数""" def __init__(self, logFilePath=None, otherFun=None, printOnCmd=True, logBegin=False, localTime=False, isOn=True): """logF...
stack_v2_sparse_classes_36k_train_006917
37,864
no_license
[ { "docstring": "logFilePath log文件保存路径,为False时 不写入文件 otherFun 一个返回字符串的函数,每次错误运行一次,结果写入log printOnCmd 时候在屏幕上打印 logBegin 是否记录开始监听事件 localTime 是否为当地时间 默认为GMT时间", "name": "__init__", "signature": "def __init__(self, logFilePath=None, otherFun=None, printOnCmd=True, logBegin=False, localTime=False, isOn=True)...
4
stack_v2_sparse_classes_30k_val_001105
Implement the Python class `LogException` described below. Class description: 用于扑捉和记录函数中的异常错误 usage: loge = LogException(logFilePath,otherFun) # 先实例一个对象 loge.listen(f,*l,**args) # 用 .listen 运行函数 @loge.decorator # 装饰被监听函数 Method signatures and docstrings: - def __init__(self, logFilePath=None, otherFun=None, printOnCm...
Implement the Python class `LogException` described below. Class description: 用于扑捉和记录函数中的异常错误 usage: loge = LogException(logFilePath,otherFun) # 先实例一个对象 loge.listen(f,*l,**args) # 用 .listen 运行函数 @loge.decorator # 装饰被监听函数 Method signatures and docstrings: - def __init__(self, logFilePath=None, otherFun=None, printOnCm...
69b117ee983d8a9ee3ad176af8b096acc902f3ae
<|skeleton|> class LogException: """用于扑捉和记录函数中的异常错误 usage: loge = LogException(logFilePath,otherFun) # 先实例一个对象 loge.listen(f,*l,**args) # 用 .listen 运行函数 @loge.decorator # 装饰被监听函数""" def __init__(self, logFilePath=None, otherFun=None, printOnCmd=True, logBegin=False, localTime=False, isOn=True): """logF...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LogException: """用于扑捉和记录函数中的异常错误 usage: loge = LogException(logFilePath,otherFun) # 先实例一个对象 loge.listen(f,*l,**args) # 用 .listen 运行函数 @loge.decorator # 装饰被监听函数""" def __init__(self, logFilePath=None, otherFun=None, printOnCmd=True, logBegin=False, localTime=False, isOn=True): """logFilePath log文件...
the_stack_v2_python_sparse
boxx/tool/toolLog.py
DIYer22/boxx
train
452
cc07f7b69a55cb3e3ccce5a3e9b1eb31b9cebe75
[ "result = PersonService.get_by_id(id)\nif not result:\n return ({'message': 'The person does not exist'}, 404)\nelse:\n return result[0]", "data = request.json\nif data['entityID'] != id:\n return ({'message': 'entityID property in the incoming json object and id parameter in the URL path arenot matched'...
<|body_start_0|> result = PersonService.get_by_id(id) if not result: return ({'message': 'The person does not exist'}, 404) else: return result[0] <|end_body_0|> <|body_start_1|> data = request.json if data['entityID'] != id: return ({'message...
PersonEntity
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PersonEntity: def get(self, id): """Get a specific Person""" <|body_0|> def put(self, id): """Update a person Use this method to change properties of a person. * Send a JSON object with new properties in the request body. ``` { "name": "New Person Name", "des": "New ...
stack_v2_sparse_classes_36k_train_006918
4,600
no_license
[ { "docstring": "Get a specific Person", "name": "get", "signature": "def get(self, id)" }, { "docstring": "Update a person Use this method to change properties of a person. * Send a JSON object with new properties in the request body. ``` { \"name\": \"New Person Name\", \"des\": \"New Person De...
3
stack_v2_sparse_classes_30k_train_017023
Implement the Python class `PersonEntity` described below. Class description: Implement the PersonEntity class. Method signatures and docstrings: - def get(self, id): Get a specific Person - def put(self, id): Update a person Use this method to change properties of a person. * Send a JSON object with new properties i...
Implement the Python class `PersonEntity` described below. Class description: Implement the PersonEntity class. Method signatures and docstrings: - def get(self, id): Get a specific Person - def put(self, id): Update a person Use this method to change properties of a person. * Send a JSON object with new properties i...
05bc527a3738d45263dc8aad23af271b3ea0219c
<|skeleton|> class PersonEntity: def get(self, id): """Get a specific Person""" <|body_0|> def put(self, id): """Update a person Use this method to change properties of a person. * Send a JSON object with new properties in the request body. ``` { "name": "New Person Name", "des": "New ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PersonEntity: def get(self, id): """Get a specific Person""" result = PersonService.get_by_id(id) if not result: return ({'message': 'The person does not exist'}, 404) else: return result[0] def put(self, id): """Update a person Use this met...
the_stack_v2_python_sparse
application/persons/controller.py
dinhphien/api_server
train
0
673096ab1a035bcc11797b7743218261900df161
[ "super().__init__()\nself.length = embed_size\nself.model = nn.Sequential()\nlayers_size = [in_channels] + layers_size\niterations = enumerate(zip(layers_size[:-1], layers_size[1:], kernels_size, strides, paddings))\nfor i, (in_c, out_c, k, s, p) in iterations:\n conv2d_i = nn.Conv2d(in_c, out_c, kernel_size=k, ...
<|body_start_0|> super().__init__() self.length = embed_size self.model = nn.Sequential() layers_size = [in_channels] + layers_size iterations = enumerate(zip(layers_size[:-1], layers_size[1:], kernels_size, strides, paddings)) for i, (in_c, out_c, k, s, p) in iterations:...
Base Input class for image, which embed image by a stack of convolution neural network (CNN) and fully-connect layer.
ImageInput
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageInput: """Base Input class for image, which embed image by a stack of convolution neural network (CNN) and fully-connect layer.""" def __init__(self, embed_size: int, in_channels: int, layers_size: List[int], kernels_size: List[int], strides: List[int], paddings: List[int], pooling: Opt...
stack_v2_sparse_classes_36k_train_006919
3,726
permissive
[ { "docstring": "Initialize ImageInput. Args: embed_size (int): Size of embedding tensor in_channels (int): Number of channel of inputs layers_size (List[int]): Layers size of CNN kernels_size (List[int]): Kernels size of CNN strides (List[int]): Strides of CNN paddings (List[int]): Paddings of CNN pooling (str,...
2
stack_v2_sparse_classes_30k_train_020751
Implement the Python class `ImageInput` described below. Class description: Base Input class for image, which embed image by a stack of convolution neural network (CNN) and fully-connect layer. Method signatures and docstrings: - def __init__(self, embed_size: int, in_channels: int, layers_size: List[int], kernels_si...
Implement the Python class `ImageInput` described below. Class description: Base Input class for image, which embed image by a stack of convolution neural network (CNN) and fully-connect layer. Method signatures and docstrings: - def __init__(self, embed_size: int, in_channels: int, layers_size: List[int], kernels_si...
751a43b9cd35e951d81c0d9cf46507b1777bb7ff
<|skeleton|> class ImageInput: """Base Input class for image, which embed image by a stack of convolution neural network (CNN) and fully-connect layer.""" def __init__(self, embed_size: int, in_channels: int, layers_size: List[int], kernels_size: List[int], strides: List[int], paddings: List[int], pooling: Opt...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImageInput: """Base Input class for image, which embed image by a stack of convolution neural network (CNN) and fully-connect layer.""" def __init__(self, embed_size: int, in_channels: int, layers_size: List[int], kernels_size: List[int], strides: List[int], paddings: List[int], pooling: Optional[str]='a...
the_stack_v2_python_sparse
torecsys/inputs/base/image_inp.py
p768lwy3/torecsys
train
98
13f9aad7b11cf7da4096f97cbe45c1b44fdff99b
[ "self.followed_graph = {}\nself.news_feed = {}\nself.clock = 0", "self.clock += 1\nif userId not in self.news_feed:\n self.news_feed[userId] = []\nself.news_feed[userId].append((self.clock, tweetId))", "self_tweet = self.news_feed.get(userId, [])[-11:]\nfollowee_tweet = []\nfor followee_id in self.followed_g...
<|body_start_0|> self.followed_graph = {} self.news_feed = {} self.clock = 0 <|end_body_0|> <|body_start_1|> self.clock += 1 if userId not in self.news_feed: self.news_feed[userId] = [] self.news_feed[userId].append((self.clock, tweetId)) <|end_body_1|> <|bo...
Twitter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Twitter: def __init__(self): """Initialize your data structure here.""" <|body_0|> def postTweet(self, userId, tweetId): """Compose a new tweet. :type userId: int :type tweetId: int :rtype: void""" <|body_1|> def getNewsFeed(self, userId): """Ret...
stack_v2_sparse_classes_36k_train_006920
2,118
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Compose a new tweet. :type userId: int :type tweetId: int :rtype: void", "name": "postTweet", "signature": "def postTweet(self, userId, tweetId)" }, { "...
5
null
Implement the Python class `Twitter` described below. Class description: Implement the Twitter class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def postTweet(self, userId, tweetId): Compose a new tweet. :type userId: int :type tweetId: int :rtype: void - def getNew...
Implement the Python class `Twitter` described below. Class description: Implement the Twitter class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def postTweet(self, userId, tweetId): Compose a new tweet. :type userId: int :type tweetId: int :rtype: void - def getNew...
9f6ccf8a8fd8eaaeae2f11557b73be4e5e7adba8
<|skeleton|> class Twitter: def __init__(self): """Initialize your data structure here.""" <|body_0|> def postTweet(self, userId, tweetId): """Compose a new tweet. :type userId: int :type tweetId: int :rtype: void""" <|body_1|> def getNewsFeed(self, userId): """Ret...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Twitter: def __init__(self): """Initialize your data structure here.""" self.followed_graph = {} self.news_feed = {} self.clock = 0 def postTweet(self, userId, tweetId): """Compose a new tweet. :type userId: int :type tweetId: int :rtype: void""" self.clock...
the_stack_v2_python_sparse
python/355.py
MrRabbit0o0/LeetCode
train
0
37c5f658592de38a14caf7e3bce84f55951dcc6b
[ "user = request.user\nnotifications = user.notifications.unread()\nserializer = self.serializer_class(notifications, many=True)\nreturn Response(serializer.data, status.HTTP_200_OK)", "user = request.user\nNotification.objects.mark_all_as_unread(user)\nreturn Response({'response': 'All unread'}, status.HTTP_200_O...
<|body_start_0|> user = request.user notifications = user.notifications.unread() serializer = self.serializer_class(notifications, many=True) return Response(serializer.data, status.HTTP_200_OK) <|end_body_0|> <|body_start_1|> user = request.user Notification.objects.mar...
Unread notifications Retrieve unread notifications
NotificationListViews
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NotificationListViews: """Unread notifications Retrieve unread notifications""" def get(self, request): """retrieves""" <|body_0|> def put(self, request, format=None): """Mark as unread""" <|body_1|> <|end_skeleton|> <|body_start_0|> user = requ...
stack_v2_sparse_classes_36k_train_006921
2,497
permissive
[ { "docstring": "retrieves", "name": "get", "signature": "def get(self, request)" }, { "docstring": "Mark as unread", "name": "put", "signature": "def put(self, request, format=None)" } ]
2
stack_v2_sparse_classes_30k_train_007711
Implement the Python class `NotificationListViews` described below. Class description: Unread notifications Retrieve unread notifications Method signatures and docstrings: - def get(self, request): retrieves - def put(self, request, format=None): Mark as unread
Implement the Python class `NotificationListViews` described below. Class description: Unread notifications Retrieve unread notifications Method signatures and docstrings: - def get(self, request): retrieves - def put(self, request, format=None): Mark as unread <|skeleton|> class NotificationListViews: """Unread...
b80ad485339dbb02b74d9b2093543bf8173d51de
<|skeleton|> class NotificationListViews: """Unread notifications Retrieve unread notifications""" def get(self, request): """retrieves""" <|body_0|> def put(self, request, format=None): """Mark as unread""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NotificationListViews: """Unread notifications Retrieve unread notifications""" def get(self, request): """retrieves""" user = request.user notifications = user.notifications.unread() serializer = self.serializer_class(notifications, many=True) return Response(seri...
the_stack_v2_python_sparse
authors/apps/notifications/views.py
deferral/ah-django
train
1
a028872377265846d63fac2fd6d365c5191f4326
[ "if not root or not root.left:\n return root\nleft, right = (root.left, root.right)\nnew_root = self.upsideDownBinaryTree(left)\nleft.left, left.right = (right, root)\nroot.left, root.right = (None, None)\nreturn new_root", "p, parent, parent_right = (root, None, None)\nwhile p:\n left = p.left\n p.left ...
<|body_start_0|> if not root or not root.left: return root left, right = (root.left, root.right) new_root = self.upsideDownBinaryTree(left) left.left, left.right = (right, root) root.left, root.right = (None, None) return new_root <|end_body_0|> <|body_start_...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def upsideDownBinaryTree(self, root): """:type root: TreeNode :rtype: TreeNode""" <|body_0|> def upsideDownBinaryTree_iterative(self, root): """:type root: TreeNode :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not ro...
stack_v2_sparse_classes_36k_train_006922
2,305
no_license
[ { "docstring": ":type root: TreeNode :rtype: TreeNode", "name": "upsideDownBinaryTree", "signature": "def upsideDownBinaryTree(self, root)" }, { "docstring": ":type root: TreeNode :rtype: TreeNode", "name": "upsideDownBinaryTree_iterative", "signature": "def upsideDownBinaryTree_iterativ...
2
stack_v2_sparse_classes_30k_train_011461
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def upsideDownBinaryTree(self, root): :type root: TreeNode :rtype: TreeNode - def upsideDownBinaryTree_iterative(self, root): :type root: TreeNode :rtype: TreeNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def upsideDownBinaryTree(self, root): :type root: TreeNode :rtype: TreeNode - def upsideDownBinaryTree_iterative(self, root): :type root: TreeNode :rtype: TreeNode <|skeleton|> ...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def upsideDownBinaryTree(self, root): """:type root: TreeNode :rtype: TreeNode""" <|body_0|> def upsideDownBinaryTree_iterative(self, root): """:type root: TreeNode :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def upsideDownBinaryTree(self, root): """:type root: TreeNode :rtype: TreeNode""" if not root or not root.left: return root left, right = (root.left, root.right) new_root = self.upsideDownBinaryTree(left) left.left, left.right = (right, root) ...
the_stack_v2_python_sparse
src/lt_156.py
oxhead/CodingYourWay
train
0
31fd7437f52594e6d0b30a81e980c4c7fd6bf603
[ "track_event = TrackEvent.create(**attr)\nif track_event is None:\n raise BusinessError('创建失败')\nreturn True", "track_event_qs = TrackEvent.query(**search_info)\ntrack_event_qs.order_by('-create_time')\nreturn Splitor(current_page, track_event_qs)", "track_event_qs = TrackEvent.search(create_time__range=(sal...
<|body_start_0|> track_event = TrackEvent.create(**attr) if track_event is None: raise BusinessError('创建失败') return True <|end_body_0|> <|body_start_1|> track_event_qs = TrackEvent.query(**search_info) track_event_qs.order_by('-create_time') return Splitor(cu...
TrackEventServer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TrackEventServer: def generate(cls, **attr): """创建跟踪""" <|body_0|> def search(cls, current_page, **search_info): """查询跟踪列表""" <|body_1|> def search_by_sale_chance(cls, sale_chance): """根据机会查询跟踪列表""" <|body_2|> <|end_skeleton|> <|body_st...
stack_v2_sparse_classes_36k_train_006923
1,190
no_license
[ { "docstring": "创建跟踪", "name": "generate", "signature": "def generate(cls, **attr)" }, { "docstring": "查询跟踪列表", "name": "search", "signature": "def search(cls, current_page, **search_info)" }, { "docstring": "根据机会查询跟踪列表", "name": "search_by_sale_chance", "signature": "def...
3
stack_v2_sparse_classes_30k_train_018221
Implement the Python class `TrackEventServer` described below. Class description: Implement the TrackEventServer class. Method signatures and docstrings: - def generate(cls, **attr): 创建跟踪 - def search(cls, current_page, **search_info): 查询跟踪列表 - def search_by_sale_chance(cls, sale_chance): 根据机会查询跟踪列表
Implement the Python class `TrackEventServer` described below. Class description: Implement the TrackEventServer class. Method signatures and docstrings: - def generate(cls, **attr): 创建跟踪 - def search(cls, current_page, **search_info): 查询跟踪列表 - def search_by_sale_chance(cls, sale_chance): 根据机会查询跟踪列表 <|skeleton|> cla...
f572830aa996cfe619fc4dd8279972a2f567c94c
<|skeleton|> class TrackEventServer: def generate(cls, **attr): """创建跟踪""" <|body_0|> def search(cls, current_page, **search_info): """查询跟踪列表""" <|body_1|> def search_by_sale_chance(cls, sale_chance): """根据机会查询跟踪列表""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TrackEventServer: def generate(cls, **attr): """创建跟踪""" track_event = TrackEvent.create(**attr) if track_event is None: raise BusinessError('创建失败') return True def search(cls, current_page, **search_info): """查询跟踪列表""" track_event_qs = TrackEven...
the_stack_v2_python_sparse
codes/personal_backend/tuoen/abs/service/track/manager.py
MaseraTiGo/4U
train
0
3aab4cf7eddd55682f2aba650ec0ee52948e5408
[ "total_dict = {}\nfor b in B:\n for c in b:\n total_dict.setdefault(c, 0)\n total_dict[c] = max(b.count(c), total_dict[c])\n\ndef a_compare_total(a, d):\n for char, count in d.items():\n if a.count(char) < count:\n return False\n return True\nreturn [a for a in A if a_compar...
<|body_start_0|> total_dict = {} for b in B: for c in b: total_dict.setdefault(c, 0) total_dict[c] = max(b.count(c), total_dict[c]) def a_compare_total(a, d): for char, count in d.items(): if a.count(char) < count: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def wordSubsets(self, A, B): """:type A: List[str] :type B: List[str] :rtype: List[str] 這邊的解法將 V1 精簡化, 但核心想法還是一樣的 total_dict 就是 B 的要求,但不同於長度為 26 的 list 這邊只記錄了字母數 > 0 的字母,所以後面再檢驗 a 的時候會比較快 另外也利用了 count function 加速""" <|body_0|> def wordSubsetsV1(self, A, B): ...
stack_v2_sparse_classes_36k_train_006924
1,753
no_license
[ { "docstring": ":type A: List[str] :type B: List[str] :rtype: List[str] 這邊的解法將 V1 精簡化, 但核心想法還是一樣的 total_dict 就是 B 的要求,但不同於長度為 26 的 list 這邊只記錄了字母數 > 0 的字母,所以後面再檢驗 a 的時候會比較快 另外也利用了 count function 加速", "name": "wordSubsets", "signature": "def wordSubsets(self, A, B)" }, { "docstring": ":type A: Lis...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def wordSubsets(self, A, B): :type A: List[str] :type B: List[str] :rtype: List[str] 這邊的解法將 V1 精簡化, 但核心想法還是一樣的 total_dict 就是 B 的要求,但不同於長度為 26 的 list 這邊只記錄了字母數 > 0 的字母,所以後面再檢驗 a 的...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def wordSubsets(self, A, B): :type A: List[str] :type B: List[str] :rtype: List[str] 這邊的解法將 V1 精簡化, 但核心想法還是一樣的 total_dict 就是 B 的要求,但不同於長度為 26 的 list 這邊只記錄了字母數 > 0 的字母,所以後面再檢驗 a 的...
ac53dd9bf2c4c9d17c9dc5f7fdda32e386658fdd
<|skeleton|> class Solution: def wordSubsets(self, A, B): """:type A: List[str] :type B: List[str] :rtype: List[str] 這邊的解法將 V1 精簡化, 但核心想法還是一樣的 total_dict 就是 B 的要求,但不同於長度為 26 的 list 這邊只記錄了字母數 > 0 的字母,所以後面再檢驗 a 的時候會比較快 另外也利用了 count function 加速""" <|body_0|> def wordSubsetsV1(self, A, B): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def wordSubsets(self, A, B): """:type A: List[str] :type B: List[str] :rtype: List[str] 這邊的解法將 V1 精簡化, 但核心想法還是一樣的 total_dict 就是 B 的要求,但不同於長度為 26 的 list 這邊只記錄了字母數 > 0 的字母,所以後面再檢驗 a 的時候會比較快 另外也利用了 count function 加速""" total_dict = {} for b in B: for c in b: ...
the_stack_v2_python_sparse
cs_notes/string/word_subsets.py
hwc1824/LeetCodeSolution
train
0
8b7fe54bad51aeb1997abb809802c39a17d75b87
[ "text = 'Interatomic data.\\n\\n'\ntext += '%-25s%-25s%-25s' % ('Index', 'Spin ID 1', 'Spin ID 2') + '\\n'\nfor i in range(len(self)):\n text += '%-25i%-25s%-25s\\n\\n' % (i, self[i].spin_id1, self[i].spin_id2)\nreturn text", "cont = InteratomContainer(spin_id1, spin_id2)\nself.append(cont)\nreturn cont", "i...
<|body_start_0|> text = 'Interatomic data.\n\n' text += '%-25s%-25s%-25s' % ('Index', 'Spin ID 1', 'Spin ID 2') + '\n' for i in range(len(self)): text += '%-25i%-25s%-25s\n\n' % (i, self[i].spin_id1, self[i].spin_id2) return text <|end_body_0|> <|body_start_1|> cont ...
List type data container for interatomic specific data.
InteratomList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InteratomList: """List type data container for interatomic specific data.""" def __repr__(self): """The string representation of the object. Rather than using the standard Python conventions (either the string representation of the value or the "<...desc...>" notation), a rich-format...
stack_v2_sparse_classes_36k_train_006925
9,873
no_license
[ { "docstring": "The string representation of the object. Rather than using the standard Python conventions (either the string representation of the value or the \"<...desc...>\" notation), a rich-formatted description of the object is given.", "name": "__repr__", "signature": "def __repr__(self)" }, ...
5
null
Implement the Python class `InteratomList` described below. Class description: List type data container for interatomic specific data. Method signatures and docstrings: - def __repr__(self): The string representation of the object. Rather than using the standard Python conventions (either the string representation of...
Implement the Python class `InteratomList` described below. Class description: List type data container for interatomic specific data. Method signatures and docstrings: - def __repr__(self): The string representation of the object. Rather than using the standard Python conventions (either the string representation of...
c317326ddeacd1a1c608128769676899daeae531
<|skeleton|> class InteratomList: """List type data container for interatomic specific data.""" def __repr__(self): """The string representation of the object. Rather than using the standard Python conventions (either the string representation of the value or the "<...desc...>" notation), a rich-format...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InteratomList: """List type data container for interatomic specific data.""" def __repr__(self): """The string representation of the object. Rather than using the standard Python conventions (either the string representation of the value or the "<...desc...>" notation), a rich-formatted descripti...
the_stack_v2_python_sparse
data_store/interatomic.py
jlec/relax
train
4
8b9d2ddf9b8fd4f964a1efb0e006efcefa4de2f6
[ "self.radius = size\nself.n = corners\nself.point = None", "if self.point is not None:\n x, y = self.point.getXY()\n return pyx.box.polygon([(x - self.radius * math.sin(i * 2 * math.pi / self.n), y + self.radius * math.cos(i * 2 * math.pi / self.n)) for i in range(self.n)]).path()\nreturn None" ]
<|body_start_0|> self.radius = size self.n = corners self.point = None <|end_body_0|> <|body_start_1|> if self.point is not None: x, y = self.point.getXY() return pyx.box.polygon([(x - self.radius * math.sin(i * 2 * math.pi / self.n), y + self.radius * math.cos(i...
PolygonalMark
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PolygonalMark: def __init__(self, size=0.075, corners=3): """A polygonal mark.""" <|body_0|> def getPath(self): """Return the path for this marker.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.radius = size self.n = corners s...
stack_v2_sparse_classes_36k_train_006926
12,026
no_license
[ { "docstring": "A polygonal mark.", "name": "__init__", "signature": "def __init__(self, size=0.075, corners=3)" }, { "docstring": "Return the path for this marker.", "name": "getPath", "signature": "def getPath(self)" } ]
2
stack_v2_sparse_classes_30k_train_008197
Implement the Python class `PolygonalMark` described below. Class description: Implement the PolygonalMark class. Method signatures and docstrings: - def __init__(self, size=0.075, corners=3): A polygonal mark. - def getPath(self): Return the path for this marker.
Implement the Python class `PolygonalMark` described below. Class description: Implement the PolygonalMark class. Method signatures and docstrings: - def __init__(self, size=0.075, corners=3): A polygonal mark. - def getPath(self): Return the path for this marker. <|skeleton|> class PolygonalMark: def __init__(...
62f64e33d900280b26a6de5bbd9ee86c38c69cd0
<|skeleton|> class PolygonalMark: def __init__(self, size=0.075, corners=3): """A polygonal mark.""" <|body_0|> def getPath(self): """Return the path for this marker.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PolygonalMark: def __init__(self, size=0.075, corners=3): """A polygonal mark.""" self.radius = size self.n = corners self.point = None def getPath(self): """Return the path for this marker.""" if self.point is not None: x, y = self.point.getXY(...
the_stack_v2_python_sparse
pyfeyn/points.py
kpedro88/pyfeyn
train
0
2fda368ca43c860a7eb63f90972ade3e30a66517
[ "ana_id = super(hr_department, self).create(vals)\nif self.manager_id.id != False and self.analytic_account_id.id != False:\n self.analytic_account_id.write({'user_id': self.manager_id.user_id.id})\nreturn ana_id", "ana_id = super(hr_department, self).write(vals)\nif self.manager_id.id != False and self.analyt...
<|body_start_0|> ana_id = super(hr_department, self).create(vals) if self.manager_id.id != False and self.analytic_account_id.id != False: self.analytic_account_id.write({'user_id': self.manager_id.user_id.id}) return ana_id <|end_body_0|> <|body_start_1|> ana_id = super(hr_...
inherit hr.department model
hr_department
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class hr_department: """inherit hr.department model""" def create(self, vals): """override create function to set resposeble of department's analytic account equals to department's manager""" <|body_0|> def write(self, vals): """override write function to set resposebl...
stack_v2_sparse_classes_36k_train_006927
926
no_license
[ { "docstring": "override create function to set resposeble of department's analytic account equals to department's manager", "name": "create", "signature": "def create(self, vals)" }, { "docstring": "override write function to set resposeble of department's analytic account equals to department'...
2
null
Implement the Python class `hr_department` described below. Class description: inherit hr.department model Method signatures and docstrings: - def create(self, vals): override create function to set resposeble of department's analytic account equals to department's manager - def write(self, vals): override write func...
Implement the Python class `hr_department` described below. Class description: inherit hr.department model Method signatures and docstrings: - def create(self, vals): override create function to set resposeble of department's analytic account equals to department's manager - def write(self, vals): override write func...
0b997095c260d58b026440967fea3a202bef7efb
<|skeleton|> class hr_department: """inherit hr.department model""" def create(self, vals): """override create function to set resposeble of department's analytic account equals to department's manager""" <|body_0|> def write(self, vals): """override write function to set resposebl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class hr_department: """inherit hr.department model""" def create(self, vals): """override create function to set resposeble of department's analytic account equals to department's manager""" ana_id = super(hr_department, self).create(vals) if self.manager_id.id != False and self.analyt...
the_stack_v2_python_sparse
v_11/EBS-SVN/trunk/account_budget_ebs/models/departmentAccount_custom.py
musabahmed/baba
train
0
bf244c8d59f7592201f06cb1c6b38b4b540dd931
[ "if not request.user.has_perm('Users.users_list'):\n return HttpResponseForbidden()\nnames = [n.lower() for n in user_backend.list()]\nreturn HttpRestAuthResponse(request, names)", "if not request.user.has_perm('Users.user_create'):\n return HttpResponseForbidden()\nname, password, properties = self._parse_...
<|body_start_0|> if not request.user.has_perm('Users.users_list'): return HttpResponseForbidden() names = [n.lower() for n in user_backend.list()] return HttpRestAuthResponse(request, names) <|end_body_0|> <|body_start_1|> if not request.user.has_perm('Users.user_create'): ...
Handle requests to ``/users/``.
UsersView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UsersView: """Handle requests to ``/users/``.""" def get(self, request, largs, *args, **kwargs): """Get all users.""" <|body_0|> def post(self, request, largs, dry=False): """Create a new user.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if ...
stack_v2_sparse_classes_36k_train_006928
9,743
no_license
[ { "docstring": "Get all users.", "name": "get", "signature": "def get(self, request, largs, *args, **kwargs)" }, { "docstring": "Create a new user.", "name": "post", "signature": "def post(self, request, largs, dry=False)" } ]
2
stack_v2_sparse_classes_30k_val_000695
Implement the Python class `UsersView` described below. Class description: Handle requests to ``/users/``. Method signatures and docstrings: - def get(self, request, largs, *args, **kwargs): Get all users. - def post(self, request, largs, dry=False): Create a new user.
Implement the Python class `UsersView` described below. Class description: Handle requests to ``/users/``. Method signatures and docstrings: - def get(self, request, largs, *args, **kwargs): Get all users. - def post(self, request, largs, dry=False): Create a new user. <|skeleton|> class UsersView: """Handle req...
60769f6b4965836b2220878cfa2e1bc403d8f8a3
<|skeleton|> class UsersView: """Handle requests to ``/users/``.""" def get(self, request, largs, *args, **kwargs): """Get all users.""" <|body_0|> def post(self, request, largs, dry=False): """Create a new user.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UsersView: """Handle requests to ``/users/``.""" def get(self, request, largs, *args, **kwargs): """Get all users.""" if not request.user.has_perm('Users.users_list'): return HttpResponseForbidden() names = [n.lower() for n in user_backend.list()] return HttpRe...
the_stack_v2_python_sparse
env/lib/python3.6/site-packages/RestAuth/Users/views.py
sachinlokesh05/login-registration-forgotpassword-and-resetpassword-using-django-rest-framework-
train
3
3163f2e8699e3fff3f90ce2297d0af3cde3b627e
[ "super(AggregateCell, self).__init__()\nself.pre_transform = pre_transform\nself.concat = concat\nself.agg_size = agg_size\nself.concat = concat\nself.data_format = data_format", "if self.pre_transform:\n x1 = Conv(self.agg_size, 1, 1, data_format=self.data_format)(x1, training)\n x2 = Conv(self.agg_size, 1...
<|body_start_0|> super(AggregateCell, self).__init__() self.pre_transform = pre_transform self.concat = concat self.agg_size = agg_size self.concat = concat self.data_format = data_format <|end_body_0|> <|body_start_1|> if self.pre_transform: x1 = Con...
Aggregate two cells and sum or concat them up.
AggregateCell
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AggregateCell: """Aggregate two cells and sum or concat them up.""" def __init__(self, agg_size, pre_transform=True, concat=False, data_format='channels_first'): """Construct AggregateCell. :param size_1: channel of first input :param size_2: channel of second input :param agg_size: ...
stack_v2_sparse_classes_36k_train_006929
12,491
permissive
[ { "docstring": "Construct AggregateCell. :param size_1: channel of first input :param size_2: channel of second input :param agg_size: channel of aggregated tensor :param pre_transform: whether to do a transform on two inputs :param concat: concat the result if set to True, otherwise add the result", "name"...
2
stack_v2_sparse_classes_30k_train_017473
Implement the Python class `AggregateCell` described below. Class description: Aggregate two cells and sum or concat them up. Method signatures and docstrings: - def __init__(self, agg_size, pre_transform=True, concat=False, data_format='channels_first'): Construct AggregateCell. :param size_1: channel of first input...
Implement the Python class `AggregateCell` described below. Class description: Aggregate two cells and sum or concat them up. Method signatures and docstrings: - def __init__(self, agg_size, pre_transform=True, concat=False, data_format='channels_first'): Construct AggregateCell. :param size_1: channel of first input...
df51ed9c1d6dbde1deef63f2a037a369f8554406
<|skeleton|> class AggregateCell: """Aggregate two cells and sum or concat them up.""" def __init__(self, agg_size, pre_transform=True, concat=False, data_format='channels_first'): """Construct AggregateCell. :param size_1: channel of first input :param size_2: channel of second input :param agg_size: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AggregateCell: """Aggregate two cells and sum or concat them up.""" def __init__(self, agg_size, pre_transform=True, concat=False, data_format='channels_first'): """Construct AggregateCell. :param size_1: channel of first input :param size_2: channel of second input :param agg_size: channel of ag...
the_stack_v2_python_sparse
built-in/TensorFlow/Official/cv/image_classification/ResnetVariant_for_TensorFlow/automl/vega/search_space/networks/tensorflow/customs/adelaide_nn/micro_decoders.py
Huawei-Ascend/modelzoo
train
1
6cb51966783b07534f0e7b8c31e9ac8c7b4118f7
[ "args = [*self.pos_only, *self.required, *self.optional]\nif self.varargs:\n args.append(self.varargs)\nargs.extend(self.kw_required.values())\nargs.extend(self.kw_optional.values())\nif self.varkwargs:\n args.append(self.varkwargs)\nreturn Signature(args, return_annotation=return_annotation)", "out = Decom...
<|body_start_0|> args = [*self.pos_only, *self.required, *self.optional] if self.varargs: args.append(self.varargs) args.extend(self.kw_required.values()) args.extend(self.kw_optional.values()) if self.varkwargs: args.append(self.varkwargs) return ...
DecomposedParams
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DecomposedParams: def signature(self, return_annotation=None) -> Signature: """Create a signature object from decomposition.""" <|body_0|> def replace(self, **kwargs) -> 'DecomposedParams': """Replace attribute from decomposed params.""" <|body_1|> <|end_ske...
stack_v2_sparse_classes_36k_train_006930
5,048
permissive
[ { "docstring": "Create a signature object from decomposition.", "name": "signature", "signature": "def signature(self, return_annotation=None) -> Signature" }, { "docstring": "Replace attribute from decomposed params.", "name": "replace", "signature": "def replace(self, **kwargs) -> 'Dec...
2
null
Implement the Python class `DecomposedParams` described below. Class description: Implement the DecomposedParams class. Method signatures and docstrings: - def signature(self, return_annotation=None) -> Signature: Create a signature object from decomposition. - def replace(self, **kwargs) -> 'DecomposedParams': Repla...
Implement the Python class `DecomposedParams` described below. Class description: Implement the DecomposedParams class. Method signatures and docstrings: - def signature(self, return_annotation=None) -> Signature: Create a signature object from decomposition. - def replace(self, **kwargs) -> 'DecomposedParams': Repla...
993ae7b8496347ad9720d3ff11e10ab946c3a800
<|skeleton|> class DecomposedParams: def signature(self, return_annotation=None) -> Signature: """Create a signature object from decomposition.""" <|body_0|> def replace(self, **kwargs) -> 'DecomposedParams': """Replace attribute from decomposed params.""" <|body_1|> <|end_ske...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DecomposedParams: def signature(self, return_annotation=None) -> Signature: """Create a signature object from decomposition.""" args = [*self.pos_only, *self.required, *self.optional] if self.varargs: args.append(self.varargs) args.extend(self.kw_required.values()) ...
the_stack_v2_python_sparse
sidekick-beta/sidekick/beta/app/function_wrapper.py
fabiommendes/sidekick
train
32
8d13e9e9517feb63f9e3f69015eab608b2de472c
[ "try:\n if self.id is None:\n return self.query.all()\n if self.id is not None and type(self.id) is int and (self.id >= 0):\n return self.query.get(self.id)\nexcept Exception as e:\n return e.__cause__.args[1]", "try:\n db.session.add(self)\n return db.session.commit()\nexcept Excepti...
<|body_start_0|> try: if self.id is None: return self.query.all() if self.id is not None and type(self.id) is int and (self.id >= 0): return self.query.get(self.id) except Exception as e: return e.__cause__.args[1] <|end_body_0|> <|bod...
Using to create a component tag [description] Extends: db.Model Variables: __tablename__ {str} -- [table name in database] id {[int]} -- [The id of component tag] component_id {[int]} -- [The id of component] tag_id {[int]} -- [The tag id]
ComponentTag
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ComponentTag: """Using to create a component tag [description] Extends: db.Model Variables: __tablename__ {str} -- [table name in database] id {[int]} -- [The id of component tag] component_id {[int]} -- [The id of component] tag_id {[int]} -- [The tag id]""" def get(self): """Using ...
stack_v2_sparse_classes_36k_train_006931
10,042
no_license
[ { "docstring": "Using get all component tags or get a single component tag. [description] Keyword Arguments: id {[int]} -- [Component group ID] (default: {None}) Returns: [Information about component(s)] -- [When successed] [Message] -- [When failed]", "name": "get", "signature": "def get(self)" }, ...
3
stack_v2_sparse_classes_30k_train_019737
Implement the Python class `ComponentTag` described below. Class description: Using to create a component tag [description] Extends: db.Model Variables: __tablename__ {str} -- [table name in database] id {[int]} -- [The id of component tag] component_id {[int]} -- [The id of component] tag_id {[int]} -- [The tag id] ...
Implement the Python class `ComponentTag` described below. Class description: Using to create a component tag [description] Extends: db.Model Variables: __tablename__ {str} -- [table name in database] id {[int]} -- [The id of component tag] component_id {[int]} -- [The id of component] tag_id {[int]} -- [The tag id] ...
052956e5006f7d274d19a43b061c2fe4a6456cc0
<|skeleton|> class ComponentTag: """Using to create a component tag [description] Extends: db.Model Variables: __tablename__ {str} -- [table name in database] id {[int]} -- [The id of component tag] component_id {[int]} -- [The id of component] tag_id {[int]} -- [The tag id]""" def get(self): """Using ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ComponentTag: """Using to create a component tag [description] Extends: db.Model Variables: __tablename__ {str} -- [table name in database] id {[int]} -- [The id of component tag] component_id {[int]} -- [The id of component] tag_id {[int]} -- [The tag id]""" def get(self): """Using get all compo...
the_stack_v2_python_sparse
models/components.py
BoTranVan/statuspage
train
0
f8bfeadbb0c34abc9530df57e608702dc8c85eec
[ "a = []\nb = []\nt = []\nfor i in A:\n if i % 2 == 0:\n a.append(i)\n else:\n b.append(i)\nfor x in range(len(A) // 2):\n t.append(a[x])\n t.append(b[x])\nreturn t", "n = len(A)\nresult = [0] * n\neven, odd = (0, 1)\nfor i in A:\n if i % 2 == 0:\n result[even] = i\n even...
<|body_start_0|> a = [] b = [] t = [] for i in A: if i % 2 == 0: a.append(i) else: b.append(i) for x in range(len(A) // 2): t.append(a[x]) t.append(b[x]) return t <|end_body_0|> <|body_start_...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def sortArrayByParityII_1(self, A): """:type A: List[int] :rtype: List[int]""" <|body_0|> def sortArrayByParityII_2(self, A): """:type A: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> a = [] b = [] ...
stack_v2_sparse_classes_36k_train_006932
857
no_license
[ { "docstring": ":type A: List[int] :rtype: List[int]", "name": "sortArrayByParityII_1", "signature": "def sortArrayByParityII_1(self, A)" }, { "docstring": ":type A: List[int] :rtype: List[int]", "name": "sortArrayByParityII_2", "signature": "def sortArrayByParityII_2(self, A)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortArrayByParityII_1(self, A): :type A: List[int] :rtype: List[int] - def sortArrayByParityII_2(self, A): :type A: List[int] :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortArrayByParityII_1(self, A): :type A: List[int] :rtype: List[int] - def sortArrayByParityII_2(self, A): :type A: List[int] :rtype: List[int] <|skeleton|> class Solution: ...
ec641c43ee481220b3ccdac2d1b6d0826fe379a5
<|skeleton|> class Solution: def sortArrayByParityII_1(self, A): """:type A: List[int] :rtype: List[int]""" <|body_0|> def sortArrayByParityII_2(self, A): """:type A: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def sortArrayByParityII_1(self, A): """:type A: List[int] :rtype: List[int]""" a = [] b = [] t = [] for i in A: if i % 2 == 0: a.append(i) else: b.append(i) for x in range(len(A) // 2): ...
the_stack_v2_python_sparse
Leetcode/leetcode922.py
lxh1997zj/-offer_and_LeetCode
train
0
2185f568dfc58b57aa889ecf6b3751374db57d2f
[ "self.etf_symbol = etfSymbol\nself.universe_settings = universeSettings\nself.universe_filter_function = universeFilterFunc\nself.universe = None", "if self.universe is None:\n self.universe = algorithm.Universe.ETF(self.etf_symbol, self.universe_settings, self.universe_filter_function)\nreturn [self.universe]...
<|body_start_0|> self.etf_symbol = etfSymbol self.universe_settings = universeSettings self.universe_filter_function = universeFilterFunc self.universe = None <|end_body_0|> <|body_start_1|> if self.universe is None: self.universe = algorithm.Universe.ETF(self.etf_sy...
Universe selection model that selects the constituents of an ETF.
ETFConstituentsUniverseSelectionModel
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ETFConstituentsUniverseSelectionModel: """Universe selection model that selects the constituents of an ETF.""" def __init__(self, etfSymbol, universeSettings=None, universeFilterFunc=None): """Initializes a new instance of the ETFConstituentsUniverseSelectionModel class Args: etfSymb...
stack_v2_sparse_classes_36k_train_006933
2,049
permissive
[ { "docstring": "Initializes a new instance of the ETFConstituentsUniverseSelectionModel class Args: etfSymbol: Symbol of the ETF to get constituents for universeSettings: Universe settings universeFilterFunc: Function to filter universe results", "name": "__init__", "signature": "def __init__(self, etfS...
2
stack_v2_sparse_classes_30k_train_012968
Implement the Python class `ETFConstituentsUniverseSelectionModel` described below. Class description: Universe selection model that selects the constituents of an ETF. Method signatures and docstrings: - def __init__(self, etfSymbol, universeSettings=None, universeFilterFunc=None): Initializes a new instance of the ...
Implement the Python class `ETFConstituentsUniverseSelectionModel` described below. Class description: Universe selection model that selects the constituents of an ETF. Method signatures and docstrings: - def __init__(self, etfSymbol, universeSettings=None, universeFilterFunc=None): Initializes a new instance of the ...
b33dd3bc140e14b883f39ecf848a793cf7292277
<|skeleton|> class ETFConstituentsUniverseSelectionModel: """Universe selection model that selects the constituents of an ETF.""" def __init__(self, etfSymbol, universeSettings=None, universeFilterFunc=None): """Initializes a new instance of the ETFConstituentsUniverseSelectionModel class Args: etfSymb...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ETFConstituentsUniverseSelectionModel: """Universe selection model that selects the constituents of an ETF.""" def __init__(self, etfSymbol, universeSettings=None, universeFilterFunc=None): """Initializes a new instance of the ETFConstituentsUniverseSelectionModel class Args: etfSymbol: Symbol of...
the_stack_v2_python_sparse
Algorithm.Framework/Selection/ETFConstituentsUniverseSelectionModel.py
Capnode/Algoloop
train
87
14a2f55bb0859861c3875689195dfd00246427a4
[ "conn = sqlite3.connect(path)\nif os.path.exists(path) and os.path.isfile(path):\n return conn\nelse:\n conn = None\n return sqlite3.connect(':memory:')", "if conn is not None:\n return conn.cursor()\nelse:\n return get_conn('').cursor()", "if table is not None and table != '':\n sql = 'DROP T...
<|body_start_0|> conn = sqlite3.connect(path) if os.path.exists(path) and os.path.isfile(path): return conn else: conn = None return sqlite3.connect(':memory:') <|end_body_0|> <|body_start_1|> if conn is not None: return conn.cursor() ...
SQL
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SQL: def get_conn(self, path): """获取到数据库的连接对象,参数为数据库文件的绝对路径,如果传递的参数是存在,并 且是文件,那么就返回硬盘上面该路径下的数据库文件的连接对象;否则,返回内存中的数 据链接对象""" <|body_0|> def get_cursor(self, conn): """该方法是获取数据库的游标对象,参数为数据库的连接对象,如果数据库的连接对象不 为None,则返回数据库连接对象所创建的游标对象;否则返回一个游标对象,该对象是内存 中数据库连接对象所创建的游标对象""" ...
stack_v2_sparse_classes_36k_train_006934
7,146
no_license
[ { "docstring": "获取到数据库的连接对象,参数为数据库文件的绝对路径,如果传递的参数是存在,并 且是文件,那么就返回硬盘上面该路径下的数据库文件的连接对象;否则,返回内存中的数 据链接对象", "name": "get_conn", "signature": "def get_conn(self, path)" }, { "docstring": "该方法是获取数据库的游标对象,参数为数据库的连接对象,如果数据库的连接对象不 为None,则返回数据库连接对象所创建的游标对象;否则返回一个游标对象,该对象是内存 中数据库连接对象所创建的游标对象", "name": ...
5
stack_v2_sparse_classes_30k_train_012386
Implement the Python class `SQL` described below. Class description: Implement the SQL class. Method signatures and docstrings: - def get_conn(self, path): 获取到数据库的连接对象,参数为数据库文件的绝对路径,如果传递的参数是存在,并 且是文件,那么就返回硬盘上面该路径下的数据库文件的连接对象;否则,返回内存中的数 据链接对象 - def get_cursor(self, conn): 该方法是获取数据库的游标对象,参数为数据库的连接对象,如果数据库的连接对象不 为None,则...
Implement the Python class `SQL` described below. Class description: Implement the SQL class. Method signatures and docstrings: - def get_conn(self, path): 获取到数据库的连接对象,参数为数据库文件的绝对路径,如果传递的参数是存在,并 且是文件,那么就返回硬盘上面该路径下的数据库文件的连接对象;否则,返回内存中的数 据链接对象 - def get_cursor(self, conn): 该方法是获取数据库的游标对象,参数为数据库的连接对象,如果数据库的连接对象不 为None,则...
04257fd49f05d4b567e234dea4cdf3907aebf0eb
<|skeleton|> class SQL: def get_conn(self, path): """获取到数据库的连接对象,参数为数据库文件的绝对路径,如果传递的参数是存在,并 且是文件,那么就返回硬盘上面该路径下的数据库文件的连接对象;否则,返回内存中的数 据链接对象""" <|body_0|> def get_cursor(self, conn): """该方法是获取数据库的游标对象,参数为数据库的连接对象,如果数据库的连接对象不 为None,则返回数据库连接对象所创建的游标对象;否则返回一个游标对象,该对象是内存 中数据库连接对象所创建的游标对象""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SQL: def get_conn(self, path): """获取到数据库的连接对象,参数为数据库文件的绝对路径,如果传递的参数是存在,并 且是文件,那么就返回硬盘上面该路径下的数据库文件的连接对象;否则,返回内存中的数 据链接对象""" conn = sqlite3.connect(path) if os.path.exists(path) and os.path.isfile(path): return conn else: conn = None return sql...
the_stack_v2_python_sparse
web/backend/src/mydb.py
erineliu/test-framework
train
0
cb3734155c0c730f3d201e966eed33c3a665a7a9
[ "pu = ground_level_m\nlatitude, longitude, _alt = pm.enu2geodetic(pe_m, pn_m, pu, lat0_rad, lon0_rad, ground_level_m, ell=None, deg=False)\necef_x, ecef_y, ecef_z = pm.enu2ecef(pe_m, pn_m, pu, lat0_rad, lon0_rad, ground_level_m, ell=None, deg=False)\nglobal_rotation = Rotation.from_quat(Dubins2DConverter.quaternion...
<|body_start_0|> pu = ground_level_m latitude, longitude, _alt = pm.enu2geodetic(pe_m, pn_m, pu, lat0_rad, lon0_rad, ground_level_m, ell=None, deg=False) ecef_x, ecef_y, ecef_z = pm.enu2ecef(pe_m, pn_m, pu, lat0_rad, lon0_rad, ground_level_m, ell=None, deg=False) global_rotation = Rotati...
Dubins2DConverter
[ "GPL-3.0-only", "BSD-3-Clause", "GPL-1.0-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dubins2DConverter: def convert_data(cls, pn_m, pe_m, alt_m, psi_rad, lat0_rad, lon0_rad, ground_level_m) -> list: """This method takes in a dictionary of "raw" 2D Dubins log data, as read from the LogReader class, and returns a populated Episode object.""" <|body_0|> def qua...
stack_v2_sparse_classes_36k_train_006935
2,905
permissive
[ { "docstring": "This method takes in a dictionary of \"raw\" 2D Dubins log data, as read from the LogReader class, and returns a populated Episode object.", "name": "convert_data", "signature": "def convert_data(cls, pn_m, pe_m, alt_m, psi_rad, lat0_rad, lon0_rad, ground_level_m) -> list" }, { "...
2
stack_v2_sparse_classes_30k_train_000403
Implement the Python class `Dubins2DConverter` described below. Class description: Implement the Dubins2DConverter class. Method signatures and docstrings: - def convert_data(cls, pn_m, pe_m, alt_m, psi_rad, lat0_rad, lon0_rad, ground_level_m) -> list: This method takes in a dictionary of "raw" 2D Dubins log data, as...
Implement the Python class `Dubins2DConverter` described below. Class description: Implement the Dubins2DConverter class. Method signatures and docstrings: - def convert_data(cls, pn_m, pe_m, alt_m, psi_rad, lat0_rad, lon0_rad, ground_level_m) -> list: This method takes in a dictionary of "raw" 2D Dubins log data, as...
c90a7346f3a2a651adda5b6ead47d4989af59dcc
<|skeleton|> class Dubins2DConverter: def convert_data(cls, pn_m, pe_m, alt_m, psi_rad, lat0_rad, lon0_rad, ground_level_m) -> list: """This method takes in a dictionary of "raw" 2D Dubins log data, as read from the LogReader class, and returns a populated Episode object.""" <|body_0|> def qua...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Dubins2DConverter: def convert_data(cls, pn_m, pe_m, alt_m, psi_rad, lat0_rad, lon0_rad, ground_level_m) -> list: """This method takes in a dictionary of "raw" 2D Dubins log data, as read from the LogReader class, and returns a populated Episode object.""" pu = ground_level_m latitude,...
the_stack_v2_python_sparse
csaf_f16/fgconverter.py
GaloisInc/csaf
train
11
a3f7a68156c30a0dbeef317fa5a4aab155c8728a
[ "self.series = series\nself.time_start = time_start\nself.time_end = time_end\nself.time_interval_sec = (time_end - time_start) // NUMBER_OF_BINS\nself.binned_series = []\nself.events_by_key = {}\nself.binned_series, self.events_by_key = self.create_binned_series()\nself.bins_values = list(map(lambda x: self.sum_da...
<|body_start_0|> self.series = series self.time_start = time_start self.time_end = time_end self.time_interval_sec = (time_end - time_start) // NUMBER_OF_BINS self.binned_series = [] self.events_by_key = {} self.binned_series, self.events_by_key = self.create_binn...
Object to calculate time series histograms on data with special format, look at the above get_series methods.
TimeSeries
[ "LicenseRef-scancode-warranty-disclaimer", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimeSeries: """Object to calculate time series histograms on data with special format, look at the above get_series methods.""" def __init__(self, series, time_start, time_end): """:param series: data series :type series: list[dict] :param time_start: unix timestamp :type time_start:...
stack_v2_sparse_classes_36k_train_006936
14,137
permissive
[ { "docstring": ":param series: data series :type series: list[dict] :param time_start: unix timestamp :type time_start: int :param time_end: unix timestamp :type time_end: int", "name": "__init__", "signature": "def __init__(self, series, time_start, time_end)" }, { "docstring": "Creates the his...
4
stack_v2_sparse_classes_30k_train_015852
Implement the Python class `TimeSeries` described below. Class description: Object to calculate time series histograms on data with special format, look at the above get_series methods. Method signatures and docstrings: - def __init__(self, series, time_start, time_end): :param series: data series :type series: list[...
Implement the Python class `TimeSeries` described below. Class description: Object to calculate time series histograms on data with special format, look at the above get_series methods. Method signatures and docstrings: - def __init__(self, series, time_start, time_end): :param series: data series :type series: list[...
7885f02f13eda3c89fda3d53f76310b6f50960d7
<|skeleton|> class TimeSeries: """Object to calculate time series histograms on data with special format, look at the above get_series methods.""" def __init__(self, series, time_start, time_end): """:param series: data series :type series: list[dict] :param time_start: unix timestamp :type time_start:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TimeSeries: """Object to calculate time series histograms on data with special format, look at the above get_series methods.""" def __init__(self, series, time_start, time_end): """:param series: data series :type series: list[dict] :param time_start: unix timestamp :type time_start: int :param t...
the_stack_v2_python_sparse
lndmanage/lib/report.py
bitromortac/lndmanage
train
178
75439b5f0ac4d753885f08d1c62cf52cbb71ce47
[ "super(LeamNet, self).__init__()\nself.embed_x = nn.Embedding(opt.n_words, opt.embed_size)\nself.embed_y = nn.Embedding(opt.num_class, opt.embed_size)\nself.att_conv = nn.Conv1d(opt.num_class, opt.num_class, kernel_size=opt.ngram, padding=opt.ngram / 2)\nself.H1_dropout_x = nn.Dropout(opt.dropout)\nself.H1_x = nn.L...
<|body_start_0|> super(LeamNet, self).__init__() self.embed_x = nn.Embedding(opt.n_words, opt.embed_size) self.embed_y = nn.Embedding(opt.num_class, opt.embed_size) self.att_conv = nn.Conv1d(opt.num_class, opt.num_class, kernel_size=opt.ngram, padding=opt.ngram / 2) self.H1_dropo...
LeamNet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LeamNet: def __init__(self, opt): """In the constructor we instantiate two nn.Linear modules and assign them as member variables.""" <|body_0|> def forward(self, x, x_mask, opt): """In the forward function we accept a Tensor of input data and we must return a Tensor ...
stack_v2_sparse_classes_36k_train_006937
3,532
permissive
[ { "docstring": "In the constructor we instantiate two nn.Linear modules and assign them as member variables.", "name": "__init__", "signature": "def __init__(self, opt)" }, { "docstring": "In the forward function we accept a Tensor of input data and we must return a Tensor of output data. We can...
2
stack_v2_sparse_classes_30k_train_016456
Implement the Python class `LeamNet` described below. Class description: Implement the LeamNet class. Method signatures and docstrings: - def __init__(self, opt): In the constructor we instantiate two nn.Linear modules and assign them as member variables. - def forward(self, x, x_mask, opt): In the forward function w...
Implement the Python class `LeamNet` described below. Class description: Implement the LeamNet class. Method signatures and docstrings: - def __init__(self, opt): In the constructor we instantiate two nn.Linear modules and assign them as member variables. - def forward(self, x, x_mask, opt): In the forward function w...
08f08cbe3d8afe27a2ad005cf8046a129c42bf78
<|skeleton|> class LeamNet: def __init__(self, opt): """In the constructor we instantiate two nn.Linear modules and assign them as member variables.""" <|body_0|> def forward(self, x, x_mask, opt): """In the forward function we accept a Tensor of input data and we must return a Tensor ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LeamNet: def __init__(self, opt): """In the constructor we instantiate two nn.Linear modules and assign them as member variables.""" super(LeamNet, self).__init__() self.embed_x = nn.Embedding(opt.n_words, opt.embed_size) self.embed_y = nn.Embedding(opt.num_class, opt.embed_siz...
the_stack_v2_python_sparse
MH-Term-Project-master/src/LEAM/model.py
voghoei/DL-Fundation
train
5
bb751e426205113316c84686120d4d44e02f4b8e
[ "self.visited = {}\nif root is not None:\n self.dfs = [root]\n pointer = self.dfs[-1]\nelse:\n self.dfs = []\n pointer = None\nwhile pointer is not None:\n self.visited[pointer.val] = True\n if pointer.left:\n self.dfs.append(pointer.left)\n pointer = pointer.left", "if self.dfs[-1].va...
<|body_start_0|> self.visited = {} if root is not None: self.dfs = [root] pointer = self.dfs[-1] else: self.dfs = [] pointer = None while pointer is not None: self.visited[pointer.val] = True if pointer.left: ...
BSTIterator2
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BSTIterator2: def __init__(self, root): """:type root: TreeNode""" <|body_0|> def next(self): """@return the next smallest number :rtype: int""" <|body_1|> def hasNext(self): """@return whether we have a next smallest number :rtype: bool""" ...
stack_v2_sparse_classes_36k_train_006938
2,715
no_license
[ { "docstring": ":type root: TreeNode", "name": "__init__", "signature": "def __init__(self, root)" }, { "docstring": "@return the next smallest number :rtype: int", "name": "next", "signature": "def next(self)" }, { "docstring": "@return whether we have a next smallest number :rt...
3
null
Implement the Python class `BSTIterator2` described below. Class description: Implement the BSTIterator2 class. Method signatures and docstrings: - def __init__(self, root): :type root: TreeNode - def next(self): @return the next smallest number :rtype: int - def hasNext(self): @return whether we have a next smallest...
Implement the Python class `BSTIterator2` described below. Class description: Implement the BSTIterator2 class. Method signatures and docstrings: - def __init__(self, root): :type root: TreeNode - def next(self): @return the next smallest number :rtype: int - def hasNext(self): @return whether we have a next smallest...
9387c1cbf1cac2db1aebf5ad196230705ab0fcc7
<|skeleton|> class BSTIterator2: def __init__(self, root): """:type root: TreeNode""" <|body_0|> def next(self): """@return the next smallest number :rtype: int""" <|body_1|> def hasNext(self): """@return whether we have a next smallest number :rtype: bool""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BSTIterator2: def __init__(self, root): """:type root: TreeNode""" self.visited = {} if root is not None: self.dfs = [root] pointer = self.dfs[-1] else: self.dfs = [] pointer = None while pointer is not None: s...
the_stack_v2_python_sparse
binary_search_tree_iterator.py
lightening0907/algorithm
train
0
84c5e9a8ec64bb21eb2cde555c100f6149c737e0
[ "self.list_of_fixes = []\nself.time_threshold = time_threshold * 1000\nself.distance_threshold = distance_threshold\nself.verbose = verbose", "self.list_of_fixes.append(gps_fix)\nif len(self.list_of_fixes) == 1:\n return (None, None)\nelse:\n return self._process_live()", "pi = self.list_of_fixes[0]\npj =...
<|body_start_0|> self.list_of_fixes = [] self.time_threshold = time_threshold * 1000 self.distance_threshold = distance_threshold self.verbose = verbose <|end_body_0|> <|body_start_1|> self.list_of_fixes.append(gps_fix) if len(self.list_of_fixes) == 1: return...
Zhen live algorithm for stay points detection. It works buffering fixes, as the accumulation of coordinates might lead to overflow of values. Attributes: time_threshold: time threshold parameter (value is kept in milliseconds) distance_threshold: distance threshold parameter verbose: print internal states-task details
StreamedZhen
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StreamedZhen: """Zhen live algorithm for stay points detection. It works buffering fixes, as the accumulation of coordinates might lead to overflow of values. Attributes: time_threshold: time threshold parameter (value is kept in milliseconds) distance_threshold: distance threshold parameter verb...
stack_v2_sparse_classes_36k_train_006939
3,412
permissive
[ { "docstring": "Basic constructor :param time_threshold: Time threshold to employ (in seconds) :param distance_threshold: Distance threshold to employ :param verbose: print task details", "name": "__init__", "signature": "def __init__(self, time_threshold, distance_threshold, verbose=False)" }, { ...
5
null
Implement the Python class `StreamedZhen` described below. Class description: Zhen live algorithm for stay points detection. It works buffering fixes, as the accumulation of coordinates might lead to overflow of values. Attributes: time_threshold: time threshold parameter (value is kept in milliseconds) distance_thres...
Implement the Python class `StreamedZhen` described below. Class description: Zhen live algorithm for stay points detection. It works buffering fixes, as the accumulation of coordinates might lead to overflow of values. Attributes: time_threshold: time threshold parameter (value is kept in milliseconds) distance_thres...
b058185ca028abd1902edbb35a52d3565b06f8b0
<|skeleton|> class StreamedZhen: """Zhen live algorithm for stay points detection. It works buffering fixes, as the accumulation of coordinates might lead to overflow of values. Attributes: time_threshold: time threshold parameter (value is kept in milliseconds) distance_threshold: distance threshold parameter verb...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StreamedZhen: """Zhen live algorithm for stay points detection. It works buffering fixes, as the accumulation of coordinates might lead to overflow of values. Attributes: time_threshold: time threshold parameter (value is kept in milliseconds) distance_threshold: distance threshold parameter verbose: print in...
the_stack_v2_python_sparse
pac/stay_point_detectors/StreamedZhen.py
s0lver/stm-creator
train
0
a24c9583d141b85edc2aad239b9119b3e8cf0bcd
[ "nvars = 3\nsuper().__init__(init=(nvars, None, np.dtype('float64')))\nself._makeAttributeAndRegister('nvars', 'duty', 'fsw', 'Vs', 'Rs', 'C1', 'Rp', 'L1', 'C2', 'Rl', localVars=locals(), readOnly=True)\nself.A = np.zeros((nvars, nvars))", "Tsw = 1 / self.fsw\nf = self.dtype_f(self.init, val=0.0)\nf.impl[:] = sel...
<|body_start_0|> nvars = 3 super().__init__(init=(nvars, None, np.dtype('float64'))) self._makeAttributeAndRegister('nvars', 'duty', 'fsw', 'Vs', 'Rs', 'C1', 'Rp', 'L1', 'C2', 'Rl', localVars=locals(), readOnly=True) self.A = np.zeros((nvars, nvars)) <|end_body_0|> <|body_start_1|> ...
Example implementing the model of a buck converter, which is also called a step-down converter. The converter has two different states and each of this state can be expressed as a nonhomogeneous linear system of ordinary differential equations (ODEs) .. math:: \\frac{d u(t)}{dt} = A_k u(t) + f_k (t) for :math:`k=1,2`. ...
buck_converter
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class buck_converter: """Example implementing the model of a buck converter, which is also called a step-down converter. The converter has two different states and each of this state can be expressed as a nonhomogeneous linear system of ordinary differential equations (ODEs) .. math:: \\frac{d u(t)}{dt...
stack_v2_sparse_classes_36k_train_006940
6,346
permissive
[ { "docstring": "Initialization routine", "name": "__init__", "signature": "def __init__(self, duty=0.5, fsw=1000.0, Vs=10.0, Rs=0.5, C1=0.001, Rp=0.01, L1=0.001, C2=0.001, Rl=10)" }, { "docstring": "Routine to evaluate the right-hand side of the problem. Parameters ---------- u : dtype_u Current...
4
null
Implement the Python class `buck_converter` described below. Class description: Example implementing the model of a buck converter, which is also called a step-down converter. The converter has two different states and each of this state can be expressed as a nonhomogeneous linear system of ordinary differential equat...
Implement the Python class `buck_converter` described below. Class description: Example implementing the model of a buck converter, which is also called a step-down converter. The converter has two different states and each of this state can be expressed as a nonhomogeneous linear system of ordinary differential equat...
1a51834bedffd4472e344bed28f4d766614b1537
<|skeleton|> class buck_converter: """Example implementing the model of a buck converter, which is also called a step-down converter. The converter has two different states and each of this state can be expressed as a nonhomogeneous linear system of ordinary differential equations (ODEs) .. math:: \\frac{d u(t)}{dt...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class buck_converter: """Example implementing the model of a buck converter, which is also called a step-down converter. The converter has two different states and each of this state can be expressed as a nonhomogeneous linear system of ordinary differential equations (ODEs) .. math:: \\frac{d u(t)}{dt} = A_k u(t) ...
the_stack_v2_python_sparse
pySDC/implementations/problem_classes/BuckConverter.py
Parallel-in-Time/pySDC
train
30
f019c4222049d7857e9a1f484e0e87656b0ea85c
[ "self.check_type = check_type\nself.result_type = result_type\nself.user_message = user_message", "if dictionary is None:\n return None\ncheck_type = dictionary.get('checkType')\nresult_type = dictionary.get('resultType')\nuser_message = dictionary.get('userMessage')\nreturn cls(check_type, result_type, user_m...
<|body_start_0|> self.check_type = check_type self.result_type = result_type self.user_message = user_message <|end_body_0|> <|body_start_1|> if dictionary is None: return None check_type = dictionary.get('checkType') result_type = dictionary.get('resultType'...
Implementation of the 'HostSettingsCheckResult' model. Specifies the result of various checks performed internally on host. Attributes: check_type (CheckTypeEnum): Specifies the type of the check internally performed. Specifies the type of the host check performed internally. 'kIsAgentPortAccessible' indicates the chec...
HostSettingsCheckResult
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HostSettingsCheckResult: """Implementation of the 'HostSettingsCheckResult' model. Specifies the result of various checks performed internally on host. Attributes: check_type (CheckTypeEnum): Specifies the type of the check internally performed. Specifies the type of the host check performed inte...
stack_v2_sparse_classes_36k_train_006941
3,246
permissive
[ { "docstring": "Constructor for the HostSettingsCheckResult class", "name": "__init__", "signature": "def __init__(self, check_type=None, result_type=None, user_message=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary repre...
2
stack_v2_sparse_classes_30k_train_006164
Implement the Python class `HostSettingsCheckResult` described below. Class description: Implementation of the 'HostSettingsCheckResult' model. Specifies the result of various checks performed internally on host. Attributes: check_type (CheckTypeEnum): Specifies the type of the check internally performed. Specifies th...
Implement the Python class `HostSettingsCheckResult` described below. Class description: Implementation of the 'HostSettingsCheckResult' model. Specifies the result of various checks performed internally on host. Attributes: check_type (CheckTypeEnum): Specifies the type of the check internally performed. Specifies th...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class HostSettingsCheckResult: """Implementation of the 'HostSettingsCheckResult' model. Specifies the result of various checks performed internally on host. Attributes: check_type (CheckTypeEnum): Specifies the type of the check internally performed. Specifies the type of the host check performed inte...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HostSettingsCheckResult: """Implementation of the 'HostSettingsCheckResult' model. Specifies the result of various checks performed internally on host. Attributes: check_type (CheckTypeEnum): Specifies the type of the check internally performed. Specifies the type of the host check performed internally. 'kIsA...
the_stack_v2_python_sparse
cohesity_management_sdk/models/host_settings_check_result.py
cohesity/management-sdk-python
train
24
c3f2d1cddd50989b45fe5f021ddf96f2c01dea2a
[ "cdk_config_file = os.path.join(os.getcwd(), 'cdk.json')\ncdk_language = cfg.CDKLanguage\ncdk_init_cmd = ['cdk', 'init', 'app', '--language', cdk_language]\nif os.path.isfile(cdk_config_file):\n logging.info('CDK application already created.')\nelse:\n logging.info('Creating a new CDK application.')\n run_...
<|body_start_0|> cdk_config_file = os.path.join(os.getcwd(), 'cdk.json') cdk_language = cfg.CDKLanguage cdk_init_cmd = ['cdk', 'init', 'app', '--language', cdk_language] if os.path.isfile(cdk_config_file): logging.info('CDK application already created.') else: ...
Manage CDK dependencies and its versions for the project.
CDKDependencies
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CDKDependencies: """Manage CDK dependencies and its versions for the project.""" def init_cdk(cfg=current_config): """Run CDK init using the following arguments. `app` the template used to bootstrap the directory structure. `--language typescript` language in which cdk will be built....
stack_v2_sparse_classes_36k_train_006942
3,754
no_license
[ { "docstring": "Run CDK init using the following arguments. `app` the template used to bootstrap the directory structure. `--language typescript` language in which cdk will be built. After running CDK init it will read the package.json created and get the CDK version to lock in Windsor config. :param cfg: Confi...
5
stack_v2_sparse_classes_30k_train_000838
Implement the Python class `CDKDependencies` described below. Class description: Manage CDK dependencies and its versions for the project. Method signatures and docstrings: - def init_cdk(cfg=current_config): Run CDK init using the following arguments. `app` the template used to bootstrap the directory structure. `--...
Implement the Python class `CDKDependencies` described below. Class description: Manage CDK dependencies and its versions for the project. Method signatures and docstrings: - def init_cdk(cfg=current_config): Run CDK init using the following arguments. `app` the template used to bootstrap the directory structure. `--...
13cb202fba954d63d728feb0635241d55680a718
<|skeleton|> class CDKDependencies: """Manage CDK dependencies and its versions for the project.""" def init_cdk(cfg=current_config): """Run CDK init using the following arguments. `app` the template used to bootstrap the directory structure. `--language typescript` language in which cdk will be built....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CDKDependencies: """Manage CDK dependencies and its versions for the project.""" def init_cdk(cfg=current_config): """Run CDK init using the following arguments. `app` the template used to bootstrap the directory structure. `--language typescript` language in which cdk will be built. After runnin...
the_stack_v2_python_sparse
windsor/cdkdependencies.py
westpoint-io/windsor
train
3
cd3ba5abdd2e221f464815bbc9bd5d0f7ea3582f
[ "try:\n import lxml\nexcept ImportError:\n raise ValueError('lxml package not found, please install it with `pip install lxml`')\nsuper().__init__(web_path)\nself.filter_urls = filter_urls\nself.parsing_function = parsing_function or _default_parsing_function", "els = []\nfor url in soup.find_all('url'):\n ...
<|body_start_0|> try: import lxml except ImportError: raise ValueError('lxml package not found, please install it with `pip install lxml`') super().__init__(web_path) self.filter_urls = filter_urls self.parsing_function = parsing_function or _default_parsi...
Loader that fetches a sitemap and loads those URLs.
SitemapLoader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SitemapLoader: """Loader that fetches a sitemap and loads those URLs.""" def __init__(self, web_path: str, filter_urls: Optional[List[str]]=None, parsing_function: Optional[Callable]=None): """Initialize with webpage path and optional filter URLs. Args: web_path: url of the sitemap f...
stack_v2_sparse_classes_36k_train_006943
2,392
no_license
[ { "docstring": "Initialize with webpage path and optional filter URLs. Args: web_path: url of the sitemap filter_urls: list of strings or regexes that will be applied to filter the urls that are parsed and loaded parsing_function: Function to parse bs4.Soup output", "name": "__init__", "signature": "def...
3
null
Implement the Python class `SitemapLoader` described below. Class description: Loader that fetches a sitemap and loads those URLs. Method signatures and docstrings: - def __init__(self, web_path: str, filter_urls: Optional[List[str]]=None, parsing_function: Optional[Callable]=None): Initialize with webpage path and o...
Implement the Python class `SitemapLoader` described below. Class description: Loader that fetches a sitemap and loads those URLs. Method signatures and docstrings: - def __init__(self, web_path: str, filter_urls: Optional[List[str]]=None, parsing_function: Optional[Callable]=None): Initialize with webpage path and o...
b7aaa920a52613e3f1f04fa5cd7568ad37302d11
<|skeleton|> class SitemapLoader: """Loader that fetches a sitemap and loads those URLs.""" def __init__(self, web_path: str, filter_urls: Optional[List[str]]=None, parsing_function: Optional[Callable]=None): """Initialize with webpage path and optional filter URLs. Args: web_path: url of the sitemap f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SitemapLoader: """Loader that fetches a sitemap and loads those URLs.""" def __init__(self, web_path: str, filter_urls: Optional[List[str]]=None, parsing_function: Optional[Callable]=None): """Initialize with webpage path and optional filter URLs. Args: web_path: url of the sitemap filter_urls: l...
the_stack_v2_python_sparse
openai/venv/lib/python3.10/site-packages/langchain/document_loaders/sitemap.py
henrymendez/garage
train
0
41f0d0ad5e971b2d4f0352278ab517ecbcf7767c
[ "shots = 100\ncircuits = ref_measure.multiqubit_measure_circuits_deterministic(allow_sampling=True)\ntargets = ref_measure.multiqubit_measure_counts_deterministic(shots)\nqobj = assemble(circuits, self.SIMULATOR, shots=shots)\nresult = self.SIMULATOR.run(qobj, backend_options=self.BACKEND_OPTS).result()\nself.is_co...
<|body_start_0|> shots = 100 circuits = ref_measure.multiqubit_measure_circuits_deterministic(allow_sampling=True) targets = ref_measure.multiqubit_measure_counts_deterministic(shots) qobj = assemble(circuits, self.SIMULATOR, shots=shots) result = self.SIMULATOR.run(qobj, backend...
QasmSimulator measure tests.
QasmMultiQubitMeasureTests
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QasmMultiQubitMeasureTests: """QasmSimulator measure tests.""" def test_measure_deterministic_multi_qubit_with_sampling(self): """Test QasmSimulator multi-qubit measure with deterministic counts with sampling""" <|body_0|> def test_measure_deterministic_multi_qubit_witho...
stack_v2_sparse_classes_36k_train_006944
10,352
permissive
[ { "docstring": "Test QasmSimulator multi-qubit measure with deterministic counts with sampling", "name": "test_measure_deterministic_multi_qubit_with_sampling", "signature": "def test_measure_deterministic_multi_qubit_with_sampling(self)" }, { "docstring": "Test QasmSimulator multi-qubit measure...
4
null
Implement the Python class `QasmMultiQubitMeasureTests` described below. Class description: QasmSimulator measure tests. Method signatures and docstrings: - def test_measure_deterministic_multi_qubit_with_sampling(self): Test QasmSimulator multi-qubit measure with deterministic counts with sampling - def test_measure...
Implement the Python class `QasmMultiQubitMeasureTests` described below. Class description: QasmSimulator measure tests. Method signatures and docstrings: - def test_measure_deterministic_multi_qubit_with_sampling(self): Test QasmSimulator multi-qubit measure with deterministic counts with sampling - def test_measure...
0c1c805fd5dfce465a8955ee3faf81037023a23e
<|skeleton|> class QasmMultiQubitMeasureTests: """QasmSimulator measure tests.""" def test_measure_deterministic_multi_qubit_with_sampling(self): """Test QasmSimulator multi-qubit measure with deterministic counts with sampling""" <|body_0|> def test_measure_deterministic_multi_qubit_witho...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QasmMultiQubitMeasureTests: """QasmSimulator measure tests.""" def test_measure_deterministic_multi_qubit_with_sampling(self): """Test QasmSimulator multi-qubit measure with deterministic counts with sampling""" shots = 100 circuits = ref_measure.multiqubit_measure_circuits_determ...
the_stack_v2_python_sparse
artifacts/old_dataset_versions/original_commits_backup/qiskit-aer/qiskit-aer#322/before/qasm_measure.py
MattePalte/Bugs-Quantum-Computing-Platforms
train
4
2adf3f18e606b193ccaafbf7b02ef642c609fc0e
[ "minNumber = 1000000000.0\nfor i in numbers:\n if i < minNumber:\n minNumber = i\nreturn minNumber", "i, j = (0, len(numbers) - 1)\nwhile i < j:\n m = (i + j) // 2\n if numbers[m] > numbers[j]:\n i = m + 1\n elif numbers[m] < numbers[j]:\n j = m\n else:\n j -= 1\nreturn ...
<|body_start_0|> minNumber = 1000000000.0 for i in numbers: if i < minNumber: minNumber = i return minNumber <|end_body_0|> <|body_start_1|> i, j = (0, len(numbers) - 1) while i < j: m = (i + j) // 2 if numbers[m] > numbers[j]:...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minArray(self, numbers: List[int]) -> int: """注意此题:虽然是递增排序,但是并不排除是包含重复元素的升序数组。 此题会分为三种情况: 第一种情况: 数组[1,2,3,4,5] 1和2旋转后数组尾部, 旋转后为 [3,4,5,1,2] 第二种情况: 数组[1,2,3,4,5] 整体旋转,旋转后不变,仍然为[1,2,3,4,5] 第三种情况: 数组[1,1,1,1,1] 不管怎么旋转,旋转后都为 [1,1,1,1,1] 复杂度分析: 时间复杂度为O(n) 空间复杂度为O(1)""" <...
stack_v2_sparse_classes_36k_train_006945
3,169
no_license
[ { "docstring": "注意此题:虽然是递增排序,但是并不排除是包含重复元素的升序数组。 此题会分为三种情况: 第一种情况: 数组[1,2,3,4,5] 1和2旋转后数组尾部, 旋转后为 [3,4,5,1,2] 第二种情况: 数组[1,2,3,4,5] 整体旋转,旋转后不变,仍然为[1,2,3,4,5] 第三种情况: 数组[1,1,1,1,1] 不管怎么旋转,旋转后都为 [1,1,1,1,1] 复杂度分析: 时间复杂度为O(n) 空间复杂度为O(1)", "name": "minArray", "signature": "def minArray(self, numbers: List[int...
2
stack_v2_sparse_classes_30k_train_000421
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minArray(self, numbers: List[int]) -> int: 注意此题:虽然是递增排序,但是并不排除是包含重复元素的升序数组。 此题会分为三种情况: 第一种情况: 数组[1,2,3,4,5] 1和2旋转后数组尾部, 旋转后为 [3,4,5,1,2] 第二种情况: 数组[1,2,3,4,5] 整体旋转,旋转后不变,仍然为[1...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minArray(self, numbers: List[int]) -> int: 注意此题:虽然是递增排序,但是并不排除是包含重复元素的升序数组。 此题会分为三种情况: 第一种情况: 数组[1,2,3,4,5] 1和2旋转后数组尾部, 旋转后为 [3,4,5,1,2] 第二种情况: 数组[1,2,3,4,5] 整体旋转,旋转后不变,仍然为[1...
51943e2c2c4ec70c7c1d5b53c9fdf0a719428d7a
<|skeleton|> class Solution: def minArray(self, numbers: List[int]) -> int: """注意此题:虽然是递增排序,但是并不排除是包含重复元素的升序数组。 此题会分为三种情况: 第一种情况: 数组[1,2,3,4,5] 1和2旋转后数组尾部, 旋转后为 [3,4,5,1,2] 第二种情况: 数组[1,2,3,4,5] 整体旋转,旋转后不变,仍然为[1,2,3,4,5] 第三种情况: 数组[1,1,1,1,1] 不管怎么旋转,旋转后都为 [1,1,1,1,1] 复杂度分析: 时间复杂度为O(n) 空间复杂度为O(1)""" <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minArray(self, numbers: List[int]) -> int: """注意此题:虽然是递增排序,但是并不排除是包含重复元素的升序数组。 此题会分为三种情况: 第一种情况: 数组[1,2,3,4,5] 1和2旋转后数组尾部, 旋转后为 [3,4,5,1,2] 第二种情况: 数组[1,2,3,4,5] 整体旋转,旋转后不变,仍然为[1,2,3,4,5] 第三种情况: 数组[1,1,1,1,1] 不管怎么旋转,旋转后都为 [1,1,1,1,1] 复杂度分析: 时间复杂度为O(n) 空间复杂度为O(1)""" minNumber = 100...
the_stack_v2_python_sparse
剑指offer/PythonVersion/11_旋转数组的最小数字.py
LeBron-Jian/BasicAlgorithmPractice
train
13
b72494013d0c70a7d2dac223a4b3851734505098
[ "nonexistent_las = 'nonexistent.las'\nnonexistent_ply = 'nonexistent.ply'\nload(nonexistent_las, nonexistent_ply)\nload_las_mock.assert_called_once_with(nonexistent_las)", "nonexistent_las = 'nonexistent.las'\nnonexistent_ply = 'nonexistent.ply'\nload(nonexistent_las, nonexistent_ply)\nwrite_ply_mock.assert_calle...
<|body_start_0|> nonexistent_las = 'nonexistent.las' nonexistent_ply = 'nonexistent.ply' load(nonexistent_las, nonexistent_ply) load_las_mock.assert_called_once_with(nonexistent_las) <|end_body_0|> <|body_start_1|> nonexistent_las = 'nonexistent.las' nonexistent_ply = 'n...
TestLoad
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestLoad: def test_load(self, load_las_mock, write_ply_mock): """Load module should call load_las to get the file.""" <|body_0|> def test_write(self, load_las_mock, write_ply_mock): """Load module should call write_ply to get the file.""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_36k_train_006946
1,251
permissive
[ { "docstring": "Load module should call load_las to get the file.", "name": "test_load", "signature": "def test_load(self, load_las_mock, write_ply_mock)" }, { "docstring": "Load module should call write_ply to get the file.", "name": "test_write", "signature": "def test_write(self, load...
2
stack_v2_sparse_classes_30k_train_011600
Implement the Python class `TestLoad` described below. Class description: Implement the TestLoad class. Method signatures and docstrings: - def test_load(self, load_las_mock, write_ply_mock): Load module should call load_las to get the file. - def test_write(self, load_las_mock, write_ply_mock): Load module should ca...
Implement the Python class `TestLoad` described below. Class description: Implement the TestLoad class. Method signatures and docstrings: - def test_load(self, load_las_mock, write_ply_mock): Load module should call load_las to get the file. - def test_write(self, load_las_mock, write_ply_mock): Load module should ca...
8053cf6f31a7e62b0c4d1d2586284c37da8f13fb
<|skeleton|> class TestLoad: def test_load(self, load_las_mock, write_ply_mock): """Load module should call load_las to get the file.""" <|body_0|> def test_write(self, load_las_mock, write_ply_mock): """Load module should call write_ply to get the file.""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestLoad: def test_load(self, load_las_mock, write_ply_mock): """Load module should call load_las to get the file.""" nonexistent_las = 'nonexistent.las' nonexistent_ply = 'nonexistent.ply' load(nonexistent_las, nonexistent_ply) load_las_mock.assert_called_once_with(non...
the_stack_v2_python_sparse
laserchicken/test_load.py
rubenvalpue/laserchicken
train
0
1b3154d139398a7f0080a0d763516aa09c3fb181
[ "if not (probe and typeMapper):\n raise Exception('Argument exception - request classifier must have valid probe and type mapper')\nself.probe = probe\nself.typeMapper = typeMapper", "counter = txn.getCounterForProbe(self.probe)\nif counter:\n data = counter.data\n if self.typeMapper:\n return sel...
<|body_start_0|> if not (probe and typeMapper): raise Exception('Argument exception - request classifier must have valid probe and type mapper') self.probe = probe self.typeMapper = typeMapper <|end_body_0|> <|body_start_1|> counter = txn.getCounterForProbe(self.probe) ...
Classifies transactions based on data in a given probe
ProbeDataClassifier
[ "MIT", "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProbeDataClassifier: """Classifies transactions based on data in a given probe""" def __init__(self, probe, typeMapper): """Constructs an instance of ProbeDataClassifier :param probe: A probe that is expected to be in the transaction :type probe: xpedite.types.probe.Probe :param type...
stack_v2_sparse_classes_36k_train_006947
1,896
permissive
[ { "docstring": "Constructs an instance of ProbeDataClassifier :param probe: A probe that is expected to be in the transaction :type probe: xpedite.types.probe.Probe :param typeMapper: a callback to map probe data to a category :type typeMapper: bool", "name": "__init__", "signature": "def __init__(self,...
2
null
Implement the Python class `ProbeDataClassifier` described below. Class description: Classifies transactions based on data in a given probe Method signatures and docstrings: - def __init__(self, probe, typeMapper): Constructs an instance of ProbeDataClassifier :param probe: A probe that is expected to be in the trans...
Implement the Python class `ProbeDataClassifier` described below. Class description: Classifies transactions based on data in a given probe Method signatures and docstrings: - def __init__(self, probe, typeMapper): Constructs an instance of ProbeDataClassifier :param probe: A probe that is expected to be in the trans...
d6b67e98d4b640c98499a373425f1f009e5b9061
<|skeleton|> class ProbeDataClassifier: """Classifies transactions based on data in a given probe""" def __init__(self, probe, typeMapper): """Constructs an instance of ProbeDataClassifier :param probe: A probe that is expected to be in the transaction :type probe: xpedite.types.probe.Probe :param type...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProbeDataClassifier: """Classifies transactions based on data in a given probe""" def __init__(self, probe, typeMapper): """Constructs an instance of ProbeDataClassifier :param probe: A probe that is expected to be in the transaction :type probe: xpedite.types.probe.Probe :param typeMapper: a cal...
the_stack_v2_python_sparse
scripts/lib/xpedite/txn/classifier.py
dendisuhubdy/Xpedite
train
1
de87a8bccdaaf69f6bc607b4bfd5a44026af09af
[ "self.region = region\nself.proxy_config = Config()\nif proxy != 'NONE':\n self.proxy_config = Config(proxies={'https': proxy})", "try:\n return boto3.client(service, region_name=self.region, config=self.proxy_config)\nexcept ClientError as e:\n fail('AWS %s service failed with exception: %s' % (service,...
<|body_start_0|> self.region = region self.proxy_config = Config() if proxy != 'NONE': self.proxy_config = Config(proxies={'https': proxy}) <|end_body_0|> <|body_start_1|> try: return boto3.client(service, region_name=self.region, config=self.proxy_config) ...
Boto3 configuration object.
Boto3ClientFactory
[ "Python-2.0", "GPL-1.0-or-later", "MPL-2.0", "MIT", "LicenseRef-scancode-python-cwi", "BSD-3-Clause", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-free-unknown", "Apache-2.0", "MIT-0", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Boto3ClientFactory: """Boto3 configuration object.""" def __init__(self, region, proxy='NONE'): """Initialize the object.""" <|body_0|> def get_client(self, service): """Initialize the boto3 client for a given service. :param service: boto3 service. :return: the ...
stack_v2_sparse_classes_36k_train_006948
14,826
permissive
[ { "docstring": "Initialize the object.", "name": "__init__", "signature": "def __init__(self, region, proxy='NONE')" }, { "docstring": "Initialize the boto3 client for a given service. :param service: boto3 service. :return: the boto3 client", "name": "get_client", "signature": "def get_...
2
stack_v2_sparse_classes_30k_val_000191
Implement the Python class `Boto3ClientFactory` described below. Class description: Boto3 configuration object. Method signatures and docstrings: - def __init__(self, region, proxy='NONE'): Initialize the object. - def get_client(self, service): Initialize the boto3 client for a given service. :param service: boto3 s...
Implement the Python class `Boto3ClientFactory` described below. Class description: Boto3 configuration object. Method signatures and docstrings: - def __init__(self, region, proxy='NONE'): Initialize the object. - def get_client(self, service): Initialize the boto3 client for a given service. :param service: boto3 s...
a213978a09ea7fc80855bf55c539861ea95259f9
<|skeleton|> class Boto3ClientFactory: """Boto3 configuration object.""" def __init__(self, region, proxy='NONE'): """Initialize the object.""" <|body_0|> def get_client(self, service): """Initialize the boto3 client for a given service. :param service: boto3 service. :return: the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Boto3ClientFactory: """Boto3 configuration object.""" def __init__(self, region, proxy='NONE'): """Initialize the object.""" self.region = region self.proxy_config = Config() if proxy != 'NONE': self.proxy_config = Config(proxies={'https': proxy}) def get_...
the_stack_v2_python_sparse
awsbatch-cli/src/awsbatch/common.py
aws/aws-parallelcluster
train
520
9f8c4e732c00a0ca3001dd53d42b31f673f30d6c
[ "params = ObjectDict({'contentId': id})\nhost, port = (yield self.get_ip_proxy())\nret = (yield http_fetch(path.PAPER_ADD_VOTE, data=params, proxy_host=host, proxy_port=port))\nraise gen.Return(ret)", "host, port = (yield self.get_ip_proxy())\nret = (yield http_get(path.PAPER_ARTICLE.format(id), res_json=False, p...
<|body_start_0|> params = ObjectDict({'contentId': id}) host, port = (yield self.get_ip_proxy()) ret = (yield http_fetch(path.PAPER_ADD_VOTE, data=params, proxy_host=host, proxy_port=port)) raise gen.Return(ret) <|end_body_0|> <|body_start_1|> host, port = (yield self.get_ip_pro...
paper刷榜
PaperDataService
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PaperDataService: """paper刷榜""" def add_vote(self, id): """为文章点赞 :param id: 文章 id :return:""" <|body_0|> def read_article(self, id): """刷文章浏览数 :param id: 文章 id :return:""" <|body_1|> def refresh_article(self, id): """利用selenium刷新网页 :param id:...
stack_v2_sparse_classes_36k_train_006949
1,724
no_license
[ { "docstring": "为文章点赞 :param id: 文章 id :return:", "name": "add_vote", "signature": "def add_vote(self, id)" }, { "docstring": "刷文章浏览数 :param id: 文章 id :return:", "name": "read_article", "signature": "def read_article(self, id)" }, { "docstring": "利用selenium刷新网页 :param id: :return...
3
null
Implement the Python class `PaperDataService` described below. Class description: paper刷榜 Method signatures and docstrings: - def add_vote(self, id): 为文章点赞 :param id: 文章 id :return: - def read_article(self, id): 刷文章浏览数 :param id: 文章 id :return: - def refresh_article(self, id): 利用selenium刷新网页 :param id: :return:
Implement the Python class `PaperDataService` described below. Class description: paper刷榜 Method signatures and docstrings: - def add_vote(self, id): 为文章点赞 :param id: 文章 id :return: - def read_article(self, id): 刷文章浏览数 :param id: 文章 id :return: - def refresh_article(self, id): 利用selenium刷新网页 :param id: :return: <|sk...
deced3892333f866525b46fa51ddbe0fa5ff8f58
<|skeleton|> class PaperDataService: """paper刷榜""" def add_vote(self, id): """为文章点赞 :param id: 文章 id :return:""" <|body_0|> def read_article(self, id): """刷文章浏览数 :param id: 文章 id :return:""" <|body_1|> def refresh_article(self, id): """利用selenium刷新网页 :param id:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PaperDataService: """paper刷榜""" def add_vote(self, id): """为文章点赞 :param id: 文章 id :return:""" params = ObjectDict({'contentId': id}) host, port = (yield self.get_ip_proxy()) ret = (yield http_fetch(path.PAPER_ADD_VOTE, data=params, proxy_host=host, proxy_port=port)) ...
the_stack_v2_python_sparse
service/data/paper/paper.py
cash2one/DL-BIKE
train
0
e3d089dec2b8dd02dc31386a8128fa400c95e512
[ "if len(strs) == 0:\n return chr(258)\nreturn chr(257).join((x for x in strs))", "if s == chr(258):\n return []\nreturn s.split(chr(257))" ]
<|body_start_0|> if len(strs) == 0: return chr(258) return chr(257).join((x for x in strs)) <|end_body_0|> <|body_start_1|> if s == chr(258): return [] return s.split(chr(257)) <|end_body_1|>
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def encode(self, strs: [str]) -> str: """Encodes a list of strings to a single string.""" <|body_0|> def decode(self, s: str) -> [str]: """Decodes a single string to a list of strings.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(st...
stack_v2_sparse_classes_36k_train_006950
744
no_license
[ { "docstring": "Encodes a list of strings to a single string.", "name": "encode", "signature": "def encode(self, strs: [str]) -> str" }, { "docstring": "Decodes a single string to a list of strings.", "name": "decode", "signature": "def decode(self, s: str) -> [str]" } ]
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, strs: [str]) -> str: Encodes a list of strings to a single string. - def decode(self, s: str) -> [str]: Decodes a single string to a list of strings.
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, strs: [str]) -> str: Encodes a list of strings to a single string. - def decode(self, s: str) -> [str]: Decodes a single string to a list of strings. <|skeleton|> cla...
d00993a88c6b34fcd79d0a6580fde5c523a2741d
<|skeleton|> class Codec: def encode(self, strs: [str]) -> str: """Encodes a list of strings to a single string.""" <|body_0|> def decode(self, s: str) -> [str]: """Decodes a single string to a list of strings.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def encode(self, strs: [str]) -> str: """Encodes a list of strings to a single string.""" if len(strs) == 0: return chr(258) return chr(257).join((x for x in strs)) def decode(self, s: str) -> [str]: """Decodes a single string to a list of strings.""" ...
the_stack_v2_python_sparse
271_EncodeAndDecodeStrings/271_EncodeAndDecodeStrings.py
H-Cong/LeetCode
train
0
8e73fe7b8dd0aceaaa4c0739085c488d2649a286
[ "new_model = CarModel(name=validated_data.get('name'), brand=validated_data.get('brand'))\nnew_model.save()\nreturn new_model", "instance.name = validated_data.get('name', instance.name)\ninstance.brand = validated_data.get('brand', instance.brand)\ninstance.save()\nreturn instance" ]
<|body_start_0|> new_model = CarModel(name=validated_data.get('name'), brand=validated_data.get('brand')) new_model.save() return new_model <|end_body_0|> <|body_start_1|> instance.name = validated_data.get('name', instance.name) instance.brand = validated_data.get('brand', inst...
CarModelSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CarModelSerializer: def create(self, validated_data): """create and return new 'CarModel' instance""" <|body_0|> def update(self, instance, validated_data): """Update and return an existing `CarModel` instance""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_36k_train_006951
6,342
no_license
[ { "docstring": "create and return new 'CarModel' instance", "name": "create", "signature": "def create(self, validated_data)" }, { "docstring": "Update and return an existing `CarModel` instance", "name": "update", "signature": "def update(self, instance, validated_data)" } ]
2
stack_v2_sparse_classes_30k_train_008219
Implement the Python class `CarModelSerializer` described below. Class description: Implement the CarModelSerializer class. Method signatures and docstrings: - def create(self, validated_data): create and return new 'CarModel' instance - def update(self, instance, validated_data): Update and return an existing `CarMo...
Implement the Python class `CarModelSerializer` described below. Class description: Implement the CarModelSerializer class. Method signatures and docstrings: - def create(self, validated_data): create and return new 'CarModel' instance - def update(self, instance, validated_data): Update and return an existing `CarMo...
dba8d1fdb96889e41328e792816a4968cbeb1ed4
<|skeleton|> class CarModelSerializer: def create(self, validated_data): """create and return new 'CarModel' instance""" <|body_0|> def update(self, instance, validated_data): """Update and return an existing `CarModel` instance""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CarModelSerializer: def create(self, validated_data): """create and return new 'CarModel' instance""" new_model = CarModel(name=validated_data.get('name'), brand=validated_data.get('brand')) new_model.save() return new_model def update(self, instance, validated_data): ...
the_stack_v2_python_sparse
cars_web/cars_app/serializers.py
Ignisor/cars_scrapper
train
0
240ce93ceeaa4bb98148a78a6c2a508d624fcca0
[ "self.d = {}\nfor i, word in enumerate(words):\n if word not in self.d:\n self.d[word] = [i]\n else:\n self.d[word].append(i)", "l1 = self.d[word1]\nl2 = self.d[word2]\nminDist = abs(l1[0] - l2[0])\ni, j = (0, 0)\nlen1 = len(l1)\nlen2 = len(l2)\nwhile i < len1 and j < len2:\n minDist = min(...
<|body_start_0|> self.d = {} for i, word in enumerate(words): if word not in self.d: self.d[word] = [i] else: self.d[word].append(i) <|end_body_0|> <|body_start_1|> l1 = self.d[word1] l2 = self.d[word2] minDist = abs(l1[0] ...
WordDistance
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WordDistance: def __init__(self, words): """initialize your data structure here. :type words: List[str]""" <|body_0|> def shortest(self, word1, word2): """Adds a word into the data structure. :type word1: str :type word2: str :rtype: int""" <|body_1|> <|end_...
stack_v2_sparse_classes_36k_train_006952
1,165
permissive
[ { "docstring": "initialize your data structure here. :type words: List[str]", "name": "__init__", "signature": "def __init__(self, words)" }, { "docstring": "Adds a word into the data structure. :type word1: str :type word2: str :rtype: int", "name": "shortest", "signature": "def shortes...
2
null
Implement the Python class `WordDistance` described below. Class description: Implement the WordDistance class. Method signatures and docstrings: - def __init__(self, words): initialize your data structure here. :type words: List[str] - def shortest(self, word1, word2): Adds a word into the data structure. :type word...
Implement the Python class `WordDistance` described below. Class description: Implement the WordDistance class. Method signatures and docstrings: - def __init__(self, words): initialize your data structure here. :type words: List[str] - def shortest(self, word1, word2): Adds a word into the data structure. :type word...
975d7e3b8cb9b6be9e80e07febf4bcf6414acd46
<|skeleton|> class WordDistance: def __init__(self, words): """initialize your data structure here. :type words: List[str]""" <|body_0|> def shortest(self, word1, word2): """Adds a word into the data structure. :type word1: str :type word2: str :rtype: int""" <|body_1|> <|end_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WordDistance: def __init__(self, words): """initialize your data structure here. :type words: List[str]""" self.d = {} for i, word in enumerate(words): if word not in self.d: self.d[word] = [i] else: self.d[word].append(i) de...
the_stack_v2_python_sparse
Python/leetcode.244.shortest-word-distance-ii.py
tedye/leetcode
train
4
57265edca835a048f9864b452a080764ad8f3692
[ "Action.__init__(self, game_state, player)\nassert isinstance(force, (int, float))\nself.force = force\nself.target = target\nself.end_speed = end_speed", "if self.target is not None:\n ball_position = self.game_state.get_ball_position()\n orientation = (self.target.position - self.player.pose.position).ang...
<|body_start_0|> Action.__init__(self, game_state, player) assert isinstance(force, (int, float)) self.force = force self.target = target self.end_speed = end_speed <|end_body_0|> <|body_start_1|> if self.target is not None: ball_position = self.game_state.ge...
Kick
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Kick: def __init__(self, game_state: GameState, player: OurPlayer, force: [int, float], target: Pose=Pose(), end_speed=0, cruise_speed=0.1): """:param game_state: Current state of the game :param player: Instance of the player :param p_force: Kick force [0, 10]""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_006953
1,731
permissive
[ { "docstring": ":param game_state: Current state of the game :param player: Instance of the player :param p_force: Kick force [0, 10]", "name": "__init__", "signature": "def __init__(self, game_state: GameState, player: OurPlayer, force: [int, float], target: Pose=Pose(), end_speed=0, cruise_speed=0.1)"...
2
null
Implement the Python class `Kick` described below. Class description: Implement the Kick class. Method signatures and docstrings: - def __init__(self, game_state: GameState, player: OurPlayer, force: [int, float], target: Pose=Pose(), end_speed=0, cruise_speed=0.1): :param game_state: Current state of the game :param...
Implement the Python class `Kick` described below. Class description: Implement the Kick class. Method signatures and docstrings: - def __init__(self, game_state: GameState, player: OurPlayer, force: [int, float], target: Pose=Pose(), end_speed=0, cruise_speed=0.1): :param game_state: Current state of the game :param...
ea997cad26e9eaec75e32f7490e2819151937d93
<|skeleton|> class Kick: def __init__(self, game_state: GameState, player: OurPlayer, force: [int, float], target: Pose=Pose(), end_speed=0, cruise_speed=0.1): """:param game_state: Current state of the game :param player: Instance of the player :param p_force: Kick force [0, 10]""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Kick: def __init__(self, game_state: GameState, player: OurPlayer, force: [int, float], target: Pose=Pose(), end_speed=0, cruise_speed=0.1): """:param game_state: Current state of the game :param player: Instance of the player :param p_force: Kick force [0, 10]""" Action.__init__(self, game_st...
the_stack_v2_python_sparse
ai/STA/Action/Kick.py
EtienneLavallee/StrategyAI
train
0
1d89eb0706b8e662d01d2c26a48842bcc75da2e8
[ "alpha_num = ''\nif type == 'lower':\n case = string.ascii_lowercase\nelif type == 'upper':\n case = string.ascii_uppercase\nelif type == 'digits':\n case = string.digits\nelif type == 'mix':\n case = string.ascii_letters + string.digits\nelse:\n case = string.ascii_letters\nreturn alpha_num.join((ra...
<|body_start_0|> alpha_num = '' if type == 'lower': case = string.ascii_lowercase elif type == 'upper': case = string.ascii_uppercase elif type == 'digits': case = string.digits elif type == 'mix': case = string.ascii_letters + stri...
Test
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test: def getAlphaNumeric(self, length, type='letters'): """Get random string of characters Required Parameters: length: Length of string, number of characters string should have Optional Parameters: type: Type of characters string should have. Default is letters Provide lower/upper/digi...
stack_v2_sparse_classes_36k_train_006954
1,372
permissive
[ { "docstring": "Get random string of characters Required Parameters: length: Length of string, number of characters string should have Optional Parameters: type: Type of characters string should have. Default is letters Provide lower/upper/digits for different types Returns: None", "name": "getAlphaNumeric"...
2
stack_v2_sparse_classes_30k_train_012146
Implement the Python class `Test` described below. Class description: Implement the Test class. Method signatures and docstrings: - def getAlphaNumeric(self, length, type='letters'): Get random string of characters Required Parameters: length: Length of string, number of characters string should have Optional Paramet...
Implement the Python class `Test` described below. Class description: Implement the Test class. Method signatures and docstrings: - def getAlphaNumeric(self, length, type='letters'): Get random string of characters Required Parameters: length: Length of string, number of characters string should have Optional Paramet...
b16143961cee869c7555b449e2a05abeae2dc3b5
<|skeleton|> class Test: def getAlphaNumeric(self, length, type='letters'): """Get random string of characters Required Parameters: length: Length of string, number of characters string should have Optional Parameters: type: Type of characters string should have. Default is letters Provide lower/upper/digi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test: def getAlphaNumeric(self, length, type='letters'): """Get random string of characters Required Parameters: length: Length of string, number of characters string should have Optional Parameters: type: Type of characters string should have. Default is letters Provide lower/upper/digits for differe...
the_stack_v2_python_sparse
selenium_advanced/unittestpackage/test.py
khanhdodang/automation-training-python
train
0
3f7a9933246792089de82b1856ceb375e3aa7197
[ "if not isinstance(args, list) and (not isinstance(args, tuple)):\n raise TypeError('In DBNAlert(), the first argument must be a list or tuple of arguments to send to dbn_alert')\nif alert_exe is not None and (not isinstance(alert_exe, str)) and (not isinstance(alert_exe, Runner)):\n raise TypeError('In DBNAl...
<|body_start_0|> if not isinstance(args, list) and (not isinstance(args, tuple)): raise TypeError('In DBNAlert(), the first argument must be a list or tuple of arguments to send to dbn_alert') if alert_exe is not None and (not isinstance(alert_exe, str)) and (not isinstance(alert_exe, Runner...
!This class represents a call to dbn_alert, as a callable Python object. It allows the instructions on how to make the call to be stored for later use by a produtil.datastore.Product object's add_callback and call_callbacks functions.
DBNAlert
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DBNAlert: """!This class represents a call to dbn_alert, as a callable Python object. It allows the instructions on how to make the call to be stored for later use by a produtil.datastore.Product object's add_callback and call_callbacks functions.""" def __init__(self, args, loglevel=logging...
stack_v2_sparse_classes_36k_train_006955
7,985
permissive
[ { "docstring": "!Create a new DBNAlert object that can be used to send an alert later on. @param args The arguments to dbn_alert. @param alert_exe The dbn_alert executable name. @param loglevel A Python logging level to log messages before each alert.", "name": "__init__", "signature": "def __init__(sel...
2
null
Implement the Python class `DBNAlert` described below. Class description: !This class represents a call to dbn_alert, as a callable Python object. It allows the instructions on how to make the call to be stored for later use by a produtil.datastore.Product object's add_callback and call_callbacks functions. Method si...
Implement the Python class `DBNAlert` described below. Class description: !This class represents a call to dbn_alert, as a callable Python object. It allows the instructions on how to make the call to be stored for later use by a produtil.datastore.Product object's add_callback and call_callbacks functions. Method si...
a666ac3b58d19f04249f76c9340f2e4a4a27939b
<|skeleton|> class DBNAlert: """!This class represents a call to dbn_alert, as a callable Python object. It allows the instructions on how to make the call to be stored for later use by a produtil.datastore.Product object's add_callback and call_callbacks functions.""" def __init__(self, args, loglevel=logging...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DBNAlert: """!This class represents a call to dbn_alert, as a callable Python object. It allows the instructions on how to make the call to be stored for later use by a produtil.datastore.Product object's add_callback and call_callbacks functions.""" def __init__(self, args, loglevel=logging.WARNING, ale...
the_stack_v2_python_sparse
produtil/dbnalert.py
dtcenter/METplus
train
41
b10d3963c8fb2eac58867ca1e1be402822072b2e
[ "if offset is None:\n return default_value\noffset = to_int(offset, 'offset')\nif offset < 0:\n raise ParamValueError(\"'offset' should be greater than or equal to 0.\")\nreturn offset", "if limit is None:\n return default_value\nlimit = to_int(limit, 'limit')\nif limit < min_value or limit > max_value:\...
<|body_start_0|> if offset is None: return default_value offset = to_int(offset, 'offset') if offset < 0: raise ParamValueError("'offset' should be greater than or equal to 0.") return offset <|end_body_0|> <|body_start_1|> if limit is None: r...
Validation class, define all check methods.
Validation
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "MIT", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Validation: """Validation class, define all check methods.""" def check_offset(cls, offset, default_value=0): """Check offset parameter, it must be greater or equal 0. Args: offset (Union[str, int]): Value can be string number or int. default_value (int): Default value for checked of...
stack_v2_sparse_classes_36k_train_006956
3,530
permissive
[ { "docstring": "Check offset parameter, it must be greater or equal 0. Args: offset (Union[str, int]): Value can be string number or int. default_value (int): Default value for checked offset. Default: 0. Returns: int, offset.", "name": "check_offset", "signature": "def check_offset(cls, offset, default...
4
stack_v2_sparse_classes_30k_val_000183
Implement the Python class `Validation` described below. Class description: Validation class, define all check methods. Method signatures and docstrings: - def check_offset(cls, offset, default_value=0): Check offset parameter, it must be greater or equal 0. Args: offset (Union[str, int]): Value can be string number ...
Implement the Python class `Validation` described below. Class description: Validation class, define all check methods. Method signatures and docstrings: - def check_offset(cls, offset, default_value=0): Check offset parameter, it must be greater or equal 0. Args: offset (Union[str, int]): Value can be string number ...
a774d893fb2f21dbc3edb5cd89f9e6eec274ebf1
<|skeleton|> class Validation: """Validation class, define all check methods.""" def check_offset(cls, offset, default_value=0): """Check offset parameter, it must be greater or equal 0. Args: offset (Union[str, int]): Value can be string number or int. default_value (int): Default value for checked of...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Validation: """Validation class, define all check methods.""" def check_offset(cls, offset, default_value=0): """Check offset parameter, it must be greater or equal 0. Args: offset (Union[str, int]): Value can be string number or int. default_value (int): Default value for checked offset. Default...
the_stack_v2_python_sparse
mindinsight/datavisual/common/validation.py
mindspore-ai/mindinsight
train
224
2bded521623eeadd44782c60eb6f71cab9a16988
[ "self.enterTuangou(self.s_name)\nself.swipe_to_down(1)\nsleep(2)\nself.assertTrue(self.check_icon(self.s_name))", "self.enterTuangou(self.s_name)\nself.swipe_to_down(1)\nself.enter_fist_goods_datil_page(self.s_name)\ns_goods_title = self.setCollected(self.s_name)\nself.press_back_by_keycode()\nself.press_back()\n...
<|body_start_0|> self.enterTuangou(self.s_name) self.swipe_to_down(1) sleep(2) self.assertTrue(self.check_icon(self.s_name)) <|end_body_0|> <|body_start_1|> self.enterTuangou(self.s_name) self.swipe_to_down(1) self.enter_fist_goods_datil_page(self.s_name) ...
TChouJiang
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TChouJiang: def test_goods_icon(self): """抽奖团_团购标签验证""" <|body_0|> def test_collect(self): """抽奖团_收藏功能""" <|body_1|> def test_customer_service(self): """抽奖团_发送客服消息验证""" <|body_2|> def test_t_separately_buy(self): """抽奖团_马上抢_单...
stack_v2_sparse_classes_36k_train_006957
2,715
no_license
[ { "docstring": "抽奖团_团购标签验证", "name": "test_goods_icon", "signature": "def test_goods_icon(self)" }, { "docstring": "抽奖团_收藏功能", "name": "test_collect", "signature": "def test_collect(self)" }, { "docstring": "抽奖团_发送客服消息验证", "name": "test_customer_service", "signature": "de...
6
null
Implement the Python class `TChouJiang` described below. Class description: Implement the TChouJiang class. Method signatures and docstrings: - def test_goods_icon(self): 抽奖团_团购标签验证 - def test_collect(self): 抽奖团_收藏功能 - def test_customer_service(self): 抽奖团_发送客服消息验证 - def test_t_separately_buy(self): 抽奖团_马上抢_单独购买 - def...
Implement the Python class `TChouJiang` described below. Class description: Implement the TChouJiang class. Method signatures and docstrings: - def test_goods_icon(self): 抽奖团_团购标签验证 - def test_collect(self): 抽奖团_收藏功能 - def test_customer_service(self): 抽奖团_发送客服消息验证 - def test_t_separately_buy(self): 抽奖团_马上抢_单独购买 - def...
b2066139eb0723eff69d971589b283b4b776c84c
<|skeleton|> class TChouJiang: def test_goods_icon(self): """抽奖团_团购标签验证""" <|body_0|> def test_collect(self): """抽奖团_收藏功能""" <|body_1|> def test_customer_service(self): """抽奖团_发送客服消息验证""" <|body_2|> def test_t_separately_buy(self): """抽奖团_马上抢_单...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TChouJiang: def test_goods_icon(self): """抽奖团_团购标签验证""" self.enterTuangou(self.s_name) self.swipe_to_down(1) sleep(2) self.assertTrue(self.check_icon(self.s_name)) def test_collect(self): """抽奖团_收藏功能""" self.enterTuangou(self.s_name) self.sw...
the_stack_v2_python_sparse
TestCase/4_5/TC_tuan_gou/test_chou_jiang.py
testerSunshine/auto_md
train
4
377161134525ffa0d72a7e3fcc0b345c66006f9a
[ "setup_metrics = {tuple(m.path): m.id for m in metrics if m.metric in {'SLA | JITTER', 'SLA | UDP RTT'}}\nv = self.cli('show ip sla statistics')\nmetric_map = {'ipsla operation id': 'name', 'latest rtt': 'rtt', 'source to destination jitter min/avg/max': 'sd_jitter', 'destination to source jitter min/avg/max': 'ds_...
<|body_start_0|> setup_metrics = {tuple(m.path): m.id for m in metrics if m.metric in {'SLA | JITTER', 'SLA | UDP RTT'}} v = self.cli('show ip sla statistics') metric_map = {'ipsla operation id': 'name', 'latest rtt': 'rtt', 'source to destination jitter min/avg/max': 'sd_jitter', 'destination t...
Script
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Script: def get_ip_sla_udp_jitter_metrics_cli(self, metrics): """Returns collected ip sla metrics in form probe id -> { rtt: RTT in seconds } :return:""" <|body_0|> def get_ip_sla_icmp_echo_metrics_cli(self, metrics): """Returns collected ip sla metrics in form probe...
stack_v2_sparse_classes_36k_train_006958
6,963
permissive
[ { "docstring": "Returns collected ip sla metrics in form probe id -> { rtt: RTT in seconds } :return:", "name": "get_ip_sla_udp_jitter_metrics_cli", "signature": "def get_ip_sla_udp_jitter_metrics_cli(self, metrics)" }, { "docstring": "Returns collected ip sla metrics in form probe id -> { rtt: ...
3
stack_v2_sparse_classes_30k_train_015471
Implement the Python class `Script` described below. Class description: Implement the Script class. Method signatures and docstrings: - def get_ip_sla_udp_jitter_metrics_cli(self, metrics): Returns collected ip sla metrics in form probe id -> { rtt: RTT in seconds } :return: - def get_ip_sla_icmp_echo_metrics_cli(sel...
Implement the Python class `Script` described below. Class description: Implement the Script class. Method signatures and docstrings: - def get_ip_sla_udp_jitter_metrics_cli(self, metrics): Returns collected ip sla metrics in form probe id -> { rtt: RTT in seconds } :return: - def get_ip_sla_icmp_echo_metrics_cli(sel...
aba08dc328296bb0e8e181c2ac9a766e1ec2a0bb
<|skeleton|> class Script: def get_ip_sla_udp_jitter_metrics_cli(self, metrics): """Returns collected ip sla metrics in form probe id -> { rtt: RTT in seconds } :return:""" <|body_0|> def get_ip_sla_icmp_echo_metrics_cli(self, metrics): """Returns collected ip sla metrics in form probe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Script: def get_ip_sla_udp_jitter_metrics_cli(self, metrics): """Returns collected ip sla metrics in form probe id -> { rtt: RTT in seconds } :return:""" setup_metrics = {tuple(m.path): m.id for m in metrics if m.metric in {'SLA | JITTER', 'SLA | UDP RTT'}} v = self.cli('show ip sla st...
the_stack_v2_python_sparse
sa/profiles/Cisco/IOS/get_metrics.py
ewwwcha/noc
train
1
1ded29b013b3c8fc349828d6d63c7b41d569efb8
[ "super(RandAugmentation, self).__init__(n_level)\nself.n_select = n_select\nself.level = level if type(level) is int and 0 <= level < n_level else None\nself.transforms = transforms", "chosen_transforms = random.sample(self.transforms, k=self.n_select)\nfor transf in chosen_transforms:\n level = self.level if ...
<|body_start_0|> super(RandAugmentation, self).__init__(n_level) self.n_select = n_select self.level = level if type(level) is int and 0 <= level < n_level else None self.transforms = transforms <|end_body_0|> <|body_start_1|> chosen_transforms = random.sample(self.transforms, k...
Random augmentation class. References: RandAugment: Practical automated data augmentation with a reduced search space (https://arxiv.org/abs/1909.13719)
RandAugmentation
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandAugmentation: """Random augmentation class. References: RandAugment: Practical automated data augmentation with a reduced search space (https://arxiv.org/abs/1909.13719)""" def __init__(self, transforms: List[str], n_select: int=2, level: int=14, n_level: int=31) -> None: """Init...
stack_v2_sparse_classes_36k_train_006959
5,467
permissive
[ { "docstring": "Initialize.", "name": "__init__", "signature": "def __init__(self, transforms: List[str], n_select: int=2, level: int=14, n_level: int=31) -> None" }, { "docstring": "Run augmentations.", "name": "__call__", "signature": "def __call__(self, img: Image) -> Image" } ]
2
stack_v2_sparse_classes_30k_train_002295
Implement the Python class `RandAugmentation` described below. Class description: Random augmentation class. References: RandAugment: Practical automated data augmentation with a reduced search space (https://arxiv.org/abs/1909.13719) Method signatures and docstrings: - def __init__(self, transforms: List[str], n_sel...
Implement the Python class `RandAugmentation` described below. Class description: Random augmentation class. References: RandAugment: Practical automated data augmentation with a reduced search space (https://arxiv.org/abs/1909.13719) Method signatures and docstrings: - def __init__(self, transforms: List[str], n_sel...
88bcff70e93dd68058a5cf0dfeac119a57abc6de
<|skeleton|> class RandAugmentation: """Random augmentation class. References: RandAugment: Practical automated data augmentation with a reduced search space (https://arxiv.org/abs/1909.13719)""" def __init__(self, transforms: List[str], n_select: int=2, level: int=14, n_level: int=31) -> None: """Init...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RandAugmentation: """Random augmentation class. References: RandAugment: Practical automated data augmentation with a reduced search space (https://arxiv.org/abs/1909.13719)""" def __init__(self, transforms: List[str], n_select: int=2, level: int=14, n_level: int=31) -> None: """Initialize.""" ...
the_stack_v2_python_sparse
src/augmentation/methods.py
scott-mao/DenseDepth_Pruning
train
1
95f9b969aee21bb81b0eaf331167cfe9bbd34143
[ "for stack in self.stacks:\n if stack.stack_id == stack_id:\n return stack", "def should_show_stack(stack):\n \"\"\"\n Determines if a stack should be shown for the list response.\n \"\"\"\n if stack.is_deleted() and (not show_deleted):\n return False\n for tag in t...
<|body_start_0|> for stack in self.stacks: if stack.stack_id == stack_id: return stack <|end_body_0|> <|body_start_1|> def should_show_stack(stack): """ Determines if a stack should be shown for the list response. """ ...
A collection of :obj:`Stack` objects for a region.
RegionalStackCollection
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegionalStackCollection: """A collection of :obj:`Stack` objects for a region.""" def stack_by_id(self, stack_id): """Retrieves a stack by its ID""" <|body_0|> def request_list(self, absolutize_url, show_deleted=False, tags=[]): """Tries a stack list operation.""...
stack_v2_sparse_classes_36k_train_006960
9,838
permissive
[ { "docstring": "Retrieves a stack by its ID", "name": "stack_by_id", "signature": "def stack_by_id(self, stack_id)" }, { "docstring": "Tries a stack list operation.", "name": "request_list", "signature": "def request_list(self, absolutize_url, show_deleted=False, tags=[])" }, { "...
6
stack_v2_sparse_classes_30k_val_000241
Implement the Python class `RegionalStackCollection` described below. Class description: A collection of :obj:`Stack` objects for a region. Method signatures and docstrings: - def stack_by_id(self, stack_id): Retrieves a stack by its ID - def request_list(self, absolutize_url, show_deleted=False, tags=[]): Tries a st...
Implement the Python class `RegionalStackCollection` described below. Class description: A collection of :obj:`Stack` objects for a region. Method signatures and docstrings: - def stack_by_id(self, stack_id): Retrieves a stack by its ID - def request_list(self, absolutize_url, show_deleted=False, tags=[]): Tries a st...
8e7eeed84ec5ae97863f9330023298845623c639
<|skeleton|> class RegionalStackCollection: """A collection of :obj:`Stack` objects for a region.""" def stack_by_id(self, stack_id): """Retrieves a stack by its ID""" <|body_0|> def request_list(self, absolutize_url, show_deleted=False, tags=[]): """Tries a stack list operation.""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RegionalStackCollection: """A collection of :obj:`Stack` objects for a region.""" def stack_by_id(self, stack_id): """Retrieves a stack by its ID""" for stack in self.stacks: if stack.stack_id == stack_id: return stack def request_list(self, absolutize_url...
the_stack_v2_python_sparse
mimic/model/heat_objects.py
ranjithpeddi/mimic
train
1
45c4d00461ec47be9a1da524403dc99dcfb9bf8f
[ "if isinstance(pyobj, ExtensionTypeSpec):\n try:\n type_spec_registry.get_name(type(pyobj))\n return True\n except ValueError:\n return False\nreturn False", "type_spec_class_name = type_spec_registry.get_name(type(extension_type_spec_value))\ntype_state = extension_type_spec_value._ser...
<|body_start_0|> if isinstance(pyobj, ExtensionTypeSpec): try: type_spec_registry.get_name(type(pyobj)) return True except ValueError: return False return False <|end_body_0|> <|body_start_1|> type_spec_class_name = type_sp...
Codec for `tf.ExtensionTypeSpec`.
_ExtensionTypeSpecCodec
[ "Apache-2.0", "LicenseRef-scancode-generic-cla", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _ExtensionTypeSpecCodec: """Codec for `tf.ExtensionTypeSpec`.""" def can_encode(self, pyobj): """Returns true if `pyobj` can be encoded as an ExtensionTypeSpec.""" <|body_0|> def do_encode(self, extension_type_spec_value, encode_fn): """Returns an encoded proto f...
stack_v2_sparse_classes_36k_train_006961
47,654
permissive
[ { "docstring": "Returns true if `pyobj` can be encoded as an ExtensionTypeSpec.", "name": "can_encode", "signature": "def can_encode(self, pyobj)" }, { "docstring": "Returns an encoded proto for the given `tf.ExtensionTypeSpec`.", "name": "do_encode", "signature": "def do_encode(self, ex...
4
null
Implement the Python class `_ExtensionTypeSpecCodec` described below. Class description: Codec for `tf.ExtensionTypeSpec`. Method signatures and docstrings: - def can_encode(self, pyobj): Returns true if `pyobj` can be encoded as an ExtensionTypeSpec. - def do_encode(self, extension_type_spec_value, encode_fn): Retur...
Implement the Python class `_ExtensionTypeSpecCodec` described below. Class description: Codec for `tf.ExtensionTypeSpec`. Method signatures and docstrings: - def can_encode(self, pyobj): Returns true if `pyobj` can be encoded as an ExtensionTypeSpec. - def do_encode(self, extension_type_spec_value, encode_fn): Retur...
a7f3934a67900720af3d3b15389551483bee50b8
<|skeleton|> class _ExtensionTypeSpecCodec: """Codec for `tf.ExtensionTypeSpec`.""" def can_encode(self, pyobj): """Returns true if `pyobj` can be encoded as an ExtensionTypeSpec.""" <|body_0|> def do_encode(self, extension_type_spec_value, encode_fn): """Returns an encoded proto f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _ExtensionTypeSpecCodec: """Codec for `tf.ExtensionTypeSpec`.""" def can_encode(self, pyobj): """Returns true if `pyobj` can be encoded as an ExtensionTypeSpec.""" if isinstance(pyobj, ExtensionTypeSpec): try: type_spec_registry.get_name(type(pyobj)) ...
the_stack_v2_python_sparse
tensorflow/python/framework/extension_type.py
tensorflow/tensorflow
train
208,740
cbf8502b9e1a3143f2d77e621480380a6ea0e042
[ "self.call_id = call_id\nself.parent_call_id = parent_call_id\nself.application_id = application_id\nself.account_id = account_id\nself.to = to\nself.mfrom = mfrom\nself.direction = direction\nself.state = state\nself.identity = identity\nself.stir_shaken = stir_shaken\nself.start_time = APIHelper.RFC3339DateTime(s...
<|body_start_0|> self.call_id = call_id self.parent_call_id = parent_call_id self.application_id = application_id self.account_id = account_id self.to = to self.mfrom = mfrom self.direction = direction self.state = state self.identity = identity ...
Implementation of the 'CallState' model. TODO: type model description here. Attributes: call_id (string): TODO: type description here. parent_call_id (string): TODO: type description here. application_id (string): TODO: type description here. account_id (string): TODO: type description here. to (string): TODO: type des...
CallState
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CallState: """Implementation of the 'CallState' model. TODO: type model description here. Attributes: call_id (string): TODO: type description here. parent_call_id (string): TODO: type description here. application_id (string): TODO: type description here. account_id (string): TODO: type descript...
stack_v2_sparse_classes_36k_train_006962
6,933
permissive
[ { "docstring": "Constructor for the CallState class", "name": "__init__", "signature": "def __init__(self, call_id=None, parent_call_id=None, application_id=None, account_id=None, to=None, mfrom=None, direction=None, state=None, identity=None, stir_shaken=None, start_time=None, enqueued_time=None, answe...
2
stack_v2_sparse_classes_30k_train_013104
Implement the Python class `CallState` described below. Class description: Implementation of the 'CallState' model. TODO: type model description here. Attributes: call_id (string): TODO: type description here. parent_call_id (string): TODO: type description here. application_id (string): TODO: type description here. a...
Implement the Python class `CallState` described below. Class description: Implementation of the 'CallState' model. TODO: type model description here. Attributes: call_id (string): TODO: type description here. parent_call_id (string): TODO: type description here. application_id (string): TODO: type description here. a...
447df3cc8cb7acaf3361d842630c432a9c31ce6e
<|skeleton|> class CallState: """Implementation of the 'CallState' model. TODO: type model description here. Attributes: call_id (string): TODO: type description here. parent_call_id (string): TODO: type description here. application_id (string): TODO: type description here. account_id (string): TODO: type descript...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CallState: """Implementation of the 'CallState' model. TODO: type model description here. Attributes: call_id (string): TODO: type description here. parent_call_id (string): TODO: type description here. application_id (string): TODO: type description here. account_id (string): TODO: type description here. to ...
the_stack_v2_python_sparse
bandwidth/voice/models/call_state.py
Bandwidth/python-sdk
train
10
df31b4139442de6803187c49752cc1f09bca6b39
[ "inputs = [x.strip('[]\"\\n') for x in sys_stdin]\na = [self.cast(x) for x in inputs[0].split(',')]\no = TreeNode().convert(a)\nx = int(inputs[1])\nreturn (o, x)", "if x.lower() == 'null':\n return None\nelse:\n return int(x)" ]
<|body_start_0|> inputs = [x.strip('[]"\n') for x in sys_stdin] a = [self.cast(x) for x in inputs[0].split(',')] o = TreeNode().convert(a) x = int(inputs[1]) return (o, x) <|end_body_0|> <|body_start_1|> if x.lower() == 'null': return None else: ...
Input
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Input: def stdin(self, sys_stdin): """Imports standard input. :param _io.TextIOWrapper sys_stdin: standard input :return: root node of binary tree :rtype: TreeNode object""" <|body_0|> def cast(self, x): """Converts string values to integer or None values. :param str...
stack_v2_sparse_classes_36k_train_006963
2,708
permissive
[ { "docstring": "Imports standard input. :param _io.TextIOWrapper sys_stdin: standard input :return: root node of binary tree :rtype: TreeNode object", "name": "stdin", "signature": "def stdin(self, sys_stdin)" }, { "docstring": "Converts string values to integer or None values. :param str x: str...
2
stack_v2_sparse_classes_30k_train_013099
Implement the Python class `Input` described below. Class description: Implement the Input class. Method signatures and docstrings: - def stdin(self, sys_stdin): Imports standard input. :param _io.TextIOWrapper sys_stdin: standard input :return: root node of binary tree :rtype: TreeNode object - def cast(self, x): Co...
Implement the Python class `Input` described below. Class description: Implement the Input class. Method signatures and docstrings: - def stdin(self, sys_stdin): Imports standard input. :param _io.TextIOWrapper sys_stdin: standard input :return: root node of binary tree :rtype: TreeNode object - def cast(self, x): Co...
69f90877c5466927e8b081c4268cbcda074813ec
<|skeleton|> class Input: def stdin(self, sys_stdin): """Imports standard input. :param _io.TextIOWrapper sys_stdin: standard input :return: root node of binary tree :rtype: TreeNode object""" <|body_0|> def cast(self, x): """Converts string values to integer or None values. :param str...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Input: def stdin(self, sys_stdin): """Imports standard input. :param _io.TextIOWrapper sys_stdin: standard input :return: root node of binary tree :rtype: TreeNode object""" inputs = [x.strip('[]"\n') for x in sys_stdin] a = [self.cast(x) for x in inputs[0].split(',')] o = Tree...
the_stack_v2_python_sparse
0701_insert_into_binary_search_tree/python_source.py
arthurdysart/LeetCode
train
0
daaedc4d37aed9872e8e607cea152120df431497
[ "super(ResBlk, self).__init__()\nself.conv1 = nn.Conv2d(ch_in, ch_out, kernel_size=3, stride=stride, padding=1)\nself.bn1 = nn.BatchNorm2d(ch_out)\nself.conv2 = nn.Conv2d(ch_out, ch_out, kernel_size=3, stride=1, padding=1)\nself.bn2 = nn.BatchNorm2d(ch_out)\nself.extra = nn.Sequential()\nif ch_out != ch_in:\n se...
<|body_start_0|> super(ResBlk, self).__init__() self.conv1 = nn.Conv2d(ch_in, ch_out, kernel_size=3, stride=stride, padding=1) self.bn1 = nn.BatchNorm2d(ch_out) self.conv2 = nn.Conv2d(ch_out, ch_out, kernel_size=3, stride=1, padding=1) self.bn2 = nn.BatchNorm2d(ch_out) se...
resnet block
ResBlk
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResBlk: """resnet block""" def __init__(self, ch_in, ch_out, stride=1): """:param ch_in: :param ch_out:""" <|body_0|> def forward(self, x): """:param x: [b, ch, h, w] :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(ResBlk, self)._...
stack_v2_sparse_classes_36k_train_006964
12,300
no_license
[ { "docstring": ":param ch_in: :param ch_out:", "name": "__init__", "signature": "def __init__(self, ch_in, ch_out, stride=1)" }, { "docstring": ":param x: [b, ch, h, w] :return:", "name": "forward", "signature": "def forward(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_009158
Implement the Python class `ResBlk` described below. Class description: resnet block Method signatures and docstrings: - def __init__(self, ch_in, ch_out, stride=1): :param ch_in: :param ch_out: - def forward(self, x): :param x: [b, ch, h, w] :return:
Implement the Python class `ResBlk` described below. Class description: resnet block Method signatures and docstrings: - def __init__(self, ch_in, ch_out, stride=1): :param ch_in: :param ch_out: - def forward(self, x): :param x: [b, ch, h, w] :return: <|skeleton|> class ResBlk: """resnet block""" def __init...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class ResBlk: """resnet block""" def __init__(self, ch_in, ch_out, stride=1): """:param ch_in: :param ch_out:""" <|body_0|> def forward(self, x): """:param x: [b, ch, h, w] :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResBlk: """resnet block""" def __init__(self, ch_in, ch_out, stride=1): """:param ch_in: :param ch_out:""" super(ResBlk, self).__init__() self.conv1 = nn.Conv2d(ch_in, ch_out, kernel_size=3, stride=stride, padding=1) self.bn1 = nn.BatchNorm2d(ch_out) self.conv2 = n...
the_stack_v2_python_sparse
generated/test_dragen1860_Deep_Learning_with_PyTorch_Tutorials.py
jansel/pytorch-jit-paritybench
train
35
310eecd649e9b3909db063c80c7401b7109c2d4c
[ "with self._open(self.app.page_admin_volumes) as page:\n page.label_volume_types.click()\n return page.tab_volume_types", "volume_type_name = volume_type_name or next(utils.generate_ids('volume-type'))\ntab = self._tab_volume_types()\ntab.button_create_volume_type.click()\nwith tab.form_create_volume_type a...
<|body_start_0|> with self._open(self.app.page_admin_volumes) as page: page.label_volume_types.click() return page.tab_volume_types <|end_body_0|> <|body_start_1|> volume_type_name = volume_type_name or next(utils.generate_ids('volume-type')) tab = self._tab_volume_types...
Volume types steps.
VolumeTypesSteps
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VolumeTypesSteps: """Volume types steps.""" def _tab_volume_types(self): """Open volume types tab.""" <|body_0|> def create_volume_type(self, volume_type_name=None, description=None, check=True): """Step to create volume type.""" <|body_1|> def delet...
stack_v2_sparse_classes_36k_train_006965
4,174
no_license
[ { "docstring": "Open volume types tab.", "name": "_tab_volume_types", "signature": "def _tab_volume_types(self)" }, { "docstring": "Step to create volume type.", "name": "create_volume_type", "signature": "def create_volume_type(self, volume_type_name=None, description=None, check=True)"...
6
null
Implement the Python class `VolumeTypesSteps` described below. Class description: Volume types steps. Method signatures and docstrings: - def _tab_volume_types(self): Open volume types tab. - def create_volume_type(self, volume_type_name=None, description=None, check=True): Step to create volume type. - def delete_vo...
Implement the Python class `VolumeTypesSteps` described below. Class description: Volume types steps. Method signatures and docstrings: - def _tab_volume_types(self): Open volume types tab. - def create_volume_type(self, volume_type_name=None, description=None, check=True): Step to create volume type. - def delete_vo...
e7583444cd24893ec6ae237b47db7c605b99b0c5
<|skeleton|> class VolumeTypesSteps: """Volume types steps.""" def _tab_volume_types(self): """Open volume types tab.""" <|body_0|> def create_volume_type(self, volume_type_name=None, description=None, check=True): """Step to create volume type.""" <|body_1|> def delet...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VolumeTypesSteps: """Volume types steps.""" def _tab_volume_types(self): """Open volume types tab.""" with self._open(self.app.page_admin_volumes) as page: page.label_volume_types.click() return page.tab_volume_types def create_volume_type(self, volume_type_na...
the_stack_v2_python_sparse
stepler/horizon/steps/volume_types.py
Mirantis/stepler
train
16
d5cbcbbe9e3d5bf07c20e2db882169758e3effa3
[ "super(Receiver, self).__init__()\nself.daemon = False\nself.q_of_samples = multiprocessing.Queue()\nself.server = cb.get_collectd_server(self.q_of_samples)\nself.control = control\nself.pd_dict = pd_dict\nself.collectd_cpu_keys = settings.getValue('COLLECTD_CPU_KEYS')\nself.collectd_processes_keys = settings.getVa...
<|body_start_0|> super(Receiver, self).__init__() self.daemon = False self.q_of_samples = multiprocessing.Queue() self.server = cb.get_collectd_server(self.q_of_samples) self.control = control self.pd_dict = pd_dict self.collectd_cpu_keys = settings.getValue('COLL...
Wrapper Receiver (of samples) class
Receiver
[ "CC-BY-4.0", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Receiver: """Wrapper Receiver (of samples) class""" def __init__(self, pd_dict, control): """Initialize. A queue will be shared with collectd_bucky""" <|body_0|> def run(self): """Start receiving the samples.""" <|body_1|> def handle(self, sample): ...
stack_v2_sparse_classes_36k_train_006966
10,808
permissive
[ { "docstring": "Initialize. A queue will be shared with collectd_bucky", "name": "__init__", "signature": "def __init__(self, pd_dict, control)" }, { "docstring": "Start receiving the samples.", "name": "run", "signature": "def run(self)" }, { "docstring": "Store values and names...
4
stack_v2_sparse_classes_30k_train_005533
Implement the Python class `Receiver` described below. Class description: Wrapper Receiver (of samples) class Method signatures and docstrings: - def __init__(self, pd_dict, control): Initialize. A queue will be shared with collectd_bucky - def run(self): Start receiving the samples. - def handle(self, sample): Store...
Implement the Python class `Receiver` described below. Class description: Wrapper Receiver (of samples) class Method signatures and docstrings: - def __init__(self, pd_dict, control): Initialize. A queue will be shared with collectd_bucky - def run(self): Start receiving the samples. - def handle(self, sample): Store...
d5c0a03054f720da2a5ff9eba74feee57fb0296d
<|skeleton|> class Receiver: """Wrapper Receiver (of samples) class""" def __init__(self, pd_dict, control): """Initialize. A queue will be shared with collectd_bucky""" <|body_0|> def run(self): """Start receiving the samples.""" <|body_1|> def handle(self, sample): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Receiver: """Wrapper Receiver (of samples) class""" def __init__(self, pd_dict, control): """Initialize. A queue will be shared with collectd_bucky""" super(Receiver, self).__init__() self.daemon = False self.q_of_samples = multiprocessing.Queue() self.server = cb....
the_stack_v2_python_sparse
tools/collectors/collectd/collectd.py
shreyagupta30/vineperf
train
0
c6ad1c04d916a201667100e784f85e131198c646
[ "self.id = id\nself.code = code\nself.url = url\nself.amount = amount\nself.status = status\nself.payment_method = payment_method\nself.created_at = APIHelper.RFC3339DateTime(created_at) if created_at else None\nself.items = items\nself.customer = customer\nself.charge = charge\nself.installments = installments\nse...
<|body_start_0|> self.id = id self.code = code self.url = url self.amount = amount self.status = status self.payment_method = payment_method self.created_at = APIHelper.RFC3339DateTime(created_at) if created_at else None self.items = items self.cus...
Implementation of the 'GetInvoiceResponse' model. Response object for getting an invoice Attributes: id (string): TODO: type description here. code (string): TODO: type description here. url (string): TODO: type description here. amount (int): TODO: type description here. status (string): TODO: type description here. p...
GetInvoiceResponse
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetInvoiceResponse: """Implementation of the 'GetInvoiceResponse' model. Response object for getting an invoice Attributes: id (string): TODO: type description here. code (string): TODO: type description here. url (string): TODO: type description here. amount (int): TODO: type description here. s...
stack_v2_sparse_classes_36k_train_006967
8,566
permissive
[ { "docstring": "Constructor for the GetInvoiceResponse class", "name": "__init__", "signature": "def __init__(self, id=None, code=None, url=None, amount=None, status=None, payment_method=None, created_at=None, items=None, charge=None, installments=None, billing_address=None, subscription=None, shipping=...
2
stack_v2_sparse_classes_30k_train_019002
Implement the Python class `GetInvoiceResponse` described below. Class description: Implementation of the 'GetInvoiceResponse' model. Response object for getting an invoice Attributes: id (string): TODO: type description here. code (string): TODO: type description here. url (string): TODO: type description here. amoun...
Implement the Python class `GetInvoiceResponse` described below. Class description: Implementation of the 'GetInvoiceResponse' model. Response object for getting an invoice Attributes: id (string): TODO: type description here. code (string): TODO: type description here. url (string): TODO: type description here. amoun...
95c80c35dd57bb2a238faeaf30d1e3b4544d2298
<|skeleton|> class GetInvoiceResponse: """Implementation of the 'GetInvoiceResponse' model. Response object for getting an invoice Attributes: id (string): TODO: type description here. code (string): TODO: type description here. url (string): TODO: type description here. amount (int): TODO: type description here. s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GetInvoiceResponse: """Implementation of the 'GetInvoiceResponse' model. Response object for getting an invoice Attributes: id (string): TODO: type description here. code (string): TODO: type description here. url (string): TODO: type description here. amount (int): TODO: type description here. status (string...
the_stack_v2_python_sparse
mundiapi/models/get_invoice_response.py
mundipagg/MundiAPI-PYTHON
train
10
1ff92a7ab1f22fe13306882ca5f7168607fc4d4b
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Missing associated documentation comment in .proto file.
TestServiceServicer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestServiceServicer: """Missing associated documentation comment in .proto file.""" def Get(self, request, context): """Returns test by test id.""" <|body_0|> def Create(self, request, context): """Creates test for the specified folder.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_006968
6,647
permissive
[ { "docstring": "Returns test by test id.", "name": "Get", "signature": "def Get(self, request, context)" }, { "docstring": "Creates test for the specified folder.", "name": "Create", "signature": "def Create(self, request, context)" }, { "docstring": "Updates the specified test."...
3
null
Implement the Python class `TestServiceServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def Get(self, request, context): Returns test by test id. - def Create(self, request, context): Creates test for the specified folder. - def...
Implement the Python class `TestServiceServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def Get(self, request, context): Returns test by test id. - def Create(self, request, context): Creates test for the specified folder. - def...
b906a014dd893e2697864e1e48e814a8d9fbc48c
<|skeleton|> class TestServiceServicer: """Missing associated documentation comment in .proto file.""" def Get(self, request, context): """Returns test by test id.""" <|body_0|> def Create(self, request, context): """Creates test for the specified folder.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestServiceServicer: """Missing associated documentation comment in .proto file.""" def Get(self, request, context): """Returns test by test id.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Met...
the_stack_v2_python_sparse
yandex/cloud/loadtesting/agent/v1/test_service_pb2_grpc.py
yandex-cloud/python-sdk
train
63
2713c7fe674a209ade5ed49a86832860ffe54892
[ "self.LOGS = settings.logger\nself.dataset = settings.dataset\nself.LOGS.info('DATASET: Instantiating Dataset object')\nmodule = self._load_module(settings, client)\nremote_check = core.get_date(module.url)\nif self.dataset in settings.modules.keys() and remote_check > settings.modules[self.dataset]:\n msg = 'Re...
<|body_start_0|> self.LOGS = settings.logger self.dataset = settings.dataset self.LOGS.info('DATASET: Instantiating Dataset object') module = self._load_module(settings, client) remote_check = core.get_date(module.url) if self.dataset in settings.modules.keys() and remote...
Class to retrieve the required DHTK extension (dataset) module
ExtensionLoader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExtensionLoader: """Class to retrieve the required DHTK extension (dataset) module""" def __init__(self, settings: object, client: object): """Method to retrieve the required the DHTK extension module. Parameters ---------- settings: DHTK Settings object Configurations to use client:...
stack_v2_sparse_classes_36k_train_006969
3,777
no_license
[ { "docstring": "Method to retrieve the required the DHTK extension module. Parameters ---------- settings: DHTK Settings object Configurations to use client: DHTK Client object Client to use Returns ------- Extension module selected by the user as the .module attribute", "name": "__init__", "signature":...
2
stack_v2_sparse_classes_30k_train_003919
Implement the Python class `ExtensionLoader` described below. Class description: Class to retrieve the required DHTK extension (dataset) module Method signatures and docstrings: - def __init__(self, settings: object, client: object): Method to retrieve the required the DHTK extension module. Parameters ---------- set...
Implement the Python class `ExtensionLoader` described below. Class description: Class to retrieve the required DHTK extension (dataset) module Method signatures and docstrings: - def __init__(self, settings: object, client: object): Method to retrieve the required the DHTK extension module. Parameters ---------- set...
54d9104c8b04af0fb368a499372d7ea0337be3d2
<|skeleton|> class ExtensionLoader: """Class to retrieve the required DHTK extension (dataset) module""" def __init__(self, settings: object, client: object): """Method to retrieve the required the DHTK extension module. Parameters ---------- settings: DHTK Settings object Configurations to use client:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExtensionLoader: """Class to retrieve the required DHTK extension (dataset) module""" def __init__(self, settings: object, client: object): """Method to retrieve the required the DHTK extension module. Parameters ---------- settings: DHTK Settings object Configurations to use client: DHTK Client ...
the_stack_v2_python_sparse
venv/Lib/site-packages/dhtk/core/loader.py
sorchawalsh/semanticweb
train
0
f89e484418655cc89e679b16aca9507abc8664e7
[ "if netcdf_filepath[-3:] == '.nc':\n filename_stem = netcdf_filepath[:-3]\nelse:\n filename_stem = netcdf_filepath\nyear = filename_stem.split('_')[-2][:4]\nif subset_name is not None:\n new_filename = f'{year}_{filename_stem}_{subset_name}.nc'\nelse:\n new_filename = f'{year}_{filename_stem}.nc'\nretur...
<|body_start_0|> if netcdf_filepath[-3:] == '.nc': filename_stem = netcdf_filepath[:-3] else: filename_stem = netcdf_filepath year = filename_stem.split('_')[-2][:4] if subset_name is not None: new_filename = f'{year}_{filename_stem}_{subset_name}.nc' ...
Preprocesses the ESA CCI Landcover data
NDVIPreprocessor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NDVIPreprocessor: """Preprocesses the ESA CCI Landcover data""" def create_filename(self, netcdf_filepath: str, subset_name: Optional[str]=None) -> str: """AVHRR-Land_v005_AVH13C1_NOAA-09_19860702_c20170612095548.nc => 1986_AVHRR-Land_v005_AVH13C1_NOAA-09_19860702_c20170612095548_ken...
stack_v2_sparse_classes_36k_train_006970
4,147
no_license
[ { "docstring": "AVHRR-Land_v005_AVH13C1_NOAA-09_19860702_c20170612095548.nc => 1986_AVHRR-Land_v005_AVH13C1_NOAA-09_19860702_c20170612095548_kenya.nc", "name": "create_filename", "signature": "def create_filename(self, netcdf_filepath: str, subset_name: Optional[str]=None) -> str" }, { "docstrin...
3
stack_v2_sparse_classes_30k_train_007154
Implement the Python class `NDVIPreprocessor` described below. Class description: Preprocesses the ESA CCI Landcover data Method signatures and docstrings: - def create_filename(self, netcdf_filepath: str, subset_name: Optional[str]=None) -> str: AVHRR-Land_v005_AVH13C1_NOAA-09_19860702_c20170612095548.nc => 1986_AVH...
Implement the Python class `NDVIPreprocessor` described below. Class description: Preprocesses the ESA CCI Landcover data Method signatures and docstrings: - def create_filename(self, netcdf_filepath: str, subset_name: Optional[str]=None) -> str: AVHRR-Land_v005_AVH13C1_NOAA-09_19860702_c20170612095548.nc => 1986_AVH...
2a39c5c20ed50f3194ebb95aba720e48215c0dfd
<|skeleton|> class NDVIPreprocessor: """Preprocesses the ESA CCI Landcover data""" def create_filename(self, netcdf_filepath: str, subset_name: Optional[str]=None) -> str: """AVHRR-Land_v005_AVH13C1_NOAA-09_19860702_c20170612095548.nc => 1986_AVHRR-Land_v005_AVH13C1_NOAA-09_19860702_c20170612095548_ken...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NDVIPreprocessor: """Preprocesses the ESA CCI Landcover data""" def create_filename(self, netcdf_filepath: str, subset_name: Optional[str]=None) -> str: """AVHRR-Land_v005_AVH13C1_NOAA-09_19860702_c20170612095548.nc => 1986_AVHRR-Land_v005_AVH13C1_NOAA-09_19860702_c20170612095548_kenya.nc""" ...
the_stack_v2_python_sparse
ndvi.py
tommylees112/esowc_notes
train
3
2d4abe0f05bd4838b1e6b4b2796ebb2a9dad22ee
[ "if len(nums) == 0:\n return 0\nD = [0 for _ in nums]\nfor index, num in enumerate(nums):\n if index == 0:\n D[index] = num\n elif index == 1:\n D[index] = max(D[index - 1], num)\n else:\n D[index] = max(D[index - 2] + num, D[index - 1])\nreturn D[-1]", "if not nums:\n return 0...
<|body_start_0|> if len(nums) == 0: return 0 D = [0 for _ in nums] for index, num in enumerate(nums): if index == 0: D[index] = num elif index == 1: D[index] = max(D[index - 1], num) else: D[index] = ...
同 HouseRobber,不过这里的数组是环状的,不允许0和n-1同时出现, 分解成0~n-2 和 1~n-1的问题, 如果不偷0, 那么1~n-1可以随便,退化成HouseRobber问题, 如果偷0,那么n-1肯定不能,退化成 0~n-2问题
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """同 HouseRobber,不过这里的数组是环状的,不允许0和n-1同时出现, 分解成0~n-2 和 1~n-1的问题, 如果不偷0, 那么1~n-1可以随便,退化成HouseRobber问题, 如果偷0,那么n-1肯定不能,退化成 0~n-2问题""" def rob2(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def rob(self, nums): """:type nums: List[int] :rt...
stack_v2_sparse_classes_36k_train_006971
1,047
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "rob2", "signature": "def rob2(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "rob", "signature": "def rob(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: 同 HouseRobber,不过这里的数组是环状的,不允许0和n-1同时出现, 分解成0~n-2 和 1~n-1的问题, 如果不偷0, 那么1~n-1可以随便,退化成HouseRobber问题, 如果偷0,那么n-1肯定不能,退化成 0~n-2问题 Method signatures and docstrings: - def rob2(self, nums): :type nums: List[int] :rtype: int - def rob(self, nums): :typ...
Implement the Python class `Solution` described below. Class description: 同 HouseRobber,不过这里的数组是环状的,不允许0和n-1同时出现, 分解成0~n-2 和 1~n-1的问题, 如果不偷0, 那么1~n-1可以随便,退化成HouseRobber问题, 如果偷0,那么n-1肯定不能,退化成 0~n-2问题 Method signatures and docstrings: - def rob2(self, nums): :type nums: List[int] :rtype: int - def rob(self, nums): :typ...
f563dbf35878808491f03281889c9a0800be7d90
<|skeleton|> class Solution: """同 HouseRobber,不过这里的数组是环状的,不允许0和n-1同时出现, 分解成0~n-2 和 1~n-1的问题, 如果不偷0, 那么1~n-1可以随便,退化成HouseRobber问题, 如果偷0,那么n-1肯定不能,退化成 0~n-2问题""" def rob2(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def rob(self, nums): """:type nums: List[int] :rt...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """同 HouseRobber,不过这里的数组是环状的,不允许0和n-1同时出现, 分解成0~n-2 和 1~n-1的问题, 如果不偷0, 那么1~n-1可以随便,退化成HouseRobber问题, 如果偷0,那么n-1肯定不能,退化成 0~n-2问题""" def rob2(self, nums): """:type nums: List[int] :rtype: int""" if len(nums) == 0: return 0 D = [0 for _ in nums] for inde...
the_stack_v2_python_sparse
leetcode/213.HouseRobber2/main.py
lee3164/newcoder
train
1
5e41b29712a08ee5cb90e11b38b2af610e52deed
[ "inputs = tf.keras.Input(shape=(128,) * rank + (16,), batch_size=1)\nnetwork = conv_endec.UNet(scales=scales, base_filters=base_filters, kernel_size=kernel_size, rank=rank, use_deconv=use_deconv, out_channels=out_channels, use_global_residual=use_global_residual)\nfeatures = network(inputs)\nif out_channels is None...
<|body_start_0|> inputs = tf.keras.Input(shape=(128,) * rank + (16,), batch_size=1) network = conv_endec.UNet(scales=scales, base_filters=base_filters, kernel_size=kernel_size, rank=rank, use_deconv=use_deconv, out_channels=out_channels, use_global_residual=use_global_residual) features = networ...
U-Net tests.
UNetTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UNetTest: """U-Net tests.""" def test_unet_creation(self, scales, base_filters, kernel_size, rank, out_channels, use_deconv, use_global_residual): """Test object creation.""" <|body_0|> def test_serialize_deserialize(self): """Test de/serialization.""" <|...
stack_v2_sparse_classes_36k_train_006972
3,132
permissive
[ { "docstring": "Test object creation.", "name": "test_unet_creation", "signature": "def test_unet_creation(self, scales, base_filters, kernel_size, rank, out_channels, use_deconv, use_global_residual)" }, { "docstring": "Test de/serialization.", "name": "test_serialize_deserialize", "sig...
2
null
Implement the Python class `UNetTest` described below. Class description: U-Net tests. Method signatures and docstrings: - def test_unet_creation(self, scales, base_filters, kernel_size, rank, out_channels, use_deconv, use_global_residual): Test object creation. - def test_serialize_deserialize(self): Test de/seriali...
Implement the Python class `UNetTest` described below. Class description: U-Net tests. Method signatures and docstrings: - def test_unet_creation(self, scales, base_filters, kernel_size, rank, out_channels, use_deconv, use_global_residual): Test object creation. - def test_serialize_deserialize(self): Test de/seriali...
cfd8930ee5281e7f6dceb17c4a5acaf625fd3243
<|skeleton|> class UNetTest: """U-Net tests.""" def test_unet_creation(self, scales, base_filters, kernel_size, rank, out_channels, use_deconv, use_global_residual): """Test object creation.""" <|body_0|> def test_serialize_deserialize(self): """Test de/serialization.""" <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UNetTest: """U-Net tests.""" def test_unet_creation(self, scales, base_filters, kernel_size, rank, out_channels, use_deconv, use_global_residual): """Test object creation.""" inputs = tf.keras.Input(shape=(128,) * rank + (16,), batch_size=1) network = conv_endec.UNet(scales=scales...
the_stack_v2_python_sparse
tensorflow_mri/python/layers/conv_endec_test.py
mrphys/tensorflow-mri
train
29
4eefe3f2214ed67ab0f3433eaf009ee68aeafb9c
[ "sagemaker_session = sagemaker_session or Session()\nbucket, key_prefix = parse_s3_url(url=s3_uri)\nif kms_key is not None:\n extra_args = {'SSECustomerKey': kms_key}\nelse:\n extra_args = None\nreturn sagemaker_session.download_data(path=local_path, bucket=bucket, key_prefix=key_prefix, extra_args=extra_args...
<|body_start_0|> sagemaker_session = sagemaker_session or Session() bucket, key_prefix = parse_s3_url(url=s3_uri) if kms_key is not None: extra_args = {'SSECustomerKey': kms_key} else: extra_args = None return sagemaker_session.download_data(path=local_pat...
Contains static methods for downloading directories or files from S3.
S3Downloader
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class S3Downloader: """Contains static methods for downloading directories or files from S3.""" def download(s3_uri, local_path, kms_key=None, sagemaker_session=None): """Static method that downloads a given S3 uri to the local machine. Args: s3_uri (str): An S3 uri to download from. local...
stack_v2_sparse_classes_36k_train_006973
8,554
permissive
[ { "docstring": "Static method that downloads a given S3 uri to the local machine. Args: s3_uri (str): An S3 uri to download from. local_path (str): A local path to download the file(s) to. kms_key (str): The KMS key to use to decrypt the files. sagemaker_session (sagemaker.session.Session): Session object which...
4
null
Implement the Python class `S3Downloader` described below. Class description: Contains static methods for downloading directories or files from S3. Method signatures and docstrings: - def download(s3_uri, local_path, kms_key=None, sagemaker_session=None): Static method that downloads a given S3 uri to the local machi...
Implement the Python class `S3Downloader` described below. Class description: Contains static methods for downloading directories or files from S3. Method signatures and docstrings: - def download(s3_uri, local_path, kms_key=None, sagemaker_session=None): Static method that downloads a given S3 uri to the local machi...
8d5d7fd8ae1a917ed3e2b988d5e533bce244fd85
<|skeleton|> class S3Downloader: """Contains static methods for downloading directories or files from S3.""" def download(s3_uri, local_path, kms_key=None, sagemaker_session=None): """Static method that downloads a given S3 uri to the local machine. Args: s3_uri (str): An S3 uri to download from. local...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class S3Downloader: """Contains static methods for downloading directories or files from S3.""" def download(s3_uri, local_path, kms_key=None, sagemaker_session=None): """Static method that downloads a given S3 uri to the local machine. Args: s3_uri (str): An S3 uri to download from. local_path (str): ...
the_stack_v2_python_sparse
src/sagemaker/s3.py
aws/sagemaker-python-sdk
train
2,050
56d5e0e35200bf6629d652c3bac6fd3f4f6121d5
[ "self.data_point_vec = data_point_vec\nself.metric_name = metric_name\nself.mtype = mtype", "if dictionary is None:\n return None\ndata_point_vec = None\nif dictionary.get('dataPointVec') != None:\n data_point_vec = list()\n for structure in dictionary.get('dataPointVec'):\n data_point_vec.append(...
<|body_start_0|> self.data_point_vec = data_point_vec self.metric_name = metric_name self.mtype = mtype <|end_body_0|> <|body_start_1|> if dictionary is None: return None data_point_vec = None if dictionary.get('dataPointVec') != None: data_point_...
Implementation of the 'MetricDataBlock' model. Specifies a series of metric data points for a time series. Attributes: data_point_vec (list of MetricDataPoint): Array of Data Points. Specifies a list of metric data points for a time series. metric_name (string): Specifies the name of a metric such as 'kDiskAwaitTimeMse...
MetricDataBlock
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MetricDataBlock: """Implementation of the 'MetricDataBlock' model. Specifies a series of metric data points for a time series. Attributes: data_point_vec (list of MetricDataPoint): Array of Data Points. Specifies a list of metric data points for a time series. metric_name (string): Specifies the ...
stack_v2_sparse_classes_36k_train_006974
2,460
permissive
[ { "docstring": "Constructor for the MetricDataBlock class", "name": "__init__", "signature": "def __init__(self, data_point_vec=None, metric_name=None, mtype=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation o...
2
stack_v2_sparse_classes_30k_train_010111
Implement the Python class `MetricDataBlock` described below. Class description: Implementation of the 'MetricDataBlock' model. Specifies a series of metric data points for a time series. Attributes: data_point_vec (list of MetricDataPoint): Array of Data Points. Specifies a list of metric data points for a time serie...
Implement the Python class `MetricDataBlock` described below. Class description: Implementation of the 'MetricDataBlock' model. Specifies a series of metric data points for a time series. Attributes: data_point_vec (list of MetricDataPoint): Array of Data Points. Specifies a list of metric data points for a time serie...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class MetricDataBlock: """Implementation of the 'MetricDataBlock' model. Specifies a series of metric data points for a time series. Attributes: data_point_vec (list of MetricDataPoint): Array of Data Points. Specifies a list of metric data points for a time series. metric_name (string): Specifies the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MetricDataBlock: """Implementation of the 'MetricDataBlock' model. Specifies a series of metric data points for a time series. Attributes: data_point_vec (list of MetricDataPoint): Array of Data Points. Specifies a list of metric data points for a time series. metric_name (string): Specifies the name of a met...
the_stack_v2_python_sparse
cohesity_management_sdk/models/metric_data_block.py
cohesity/management-sdk-python
train
24
55b2901645c279e53bb670e00116acf907cccd87
[ "initial_groups = util.setNoneList(initial_groups)\nsuper(self.__class__, self).__init__(initial_groups=initial_groups)\nif is_set_group_label:\n self.setGroupLabels(prefix=prefix)\nself._is_plot = is_plot", "num_permute = util.nCr(num_isolates, num_occurrences)\ndenom = num_permute ** num_mutations\nreturn 1....
<|body_start_0|> initial_groups = util.setNoneList(initial_groups) super(self.__class__, self).__init__(initial_groups=initial_groups) if is_set_group_label: self.setGroupLabels(prefix=prefix) self._is_plot = is_plot <|end_body_0|> <|body_start_1|> num_permute = util...
MutationCollection
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MutationCollection: def __init__(self, initial_groups=None, prefix='', is_set_group_label=True, is_plot=True): """If no mutation_source is specified, then calculates a default MutationDifferential. :param list-Group initial_groups: :param bool is_plot: plots if True""" <|body_0|>...
stack_v2_sparse_classes_36k_train_006975
4,729
permissive
[ { "docstring": "If no mutation_source is specified, then calculates a default MutationDifferential. :param list-Group initial_groups: :param bool is_plot: plots if True", "name": "__init__", "signature": "def __init__(self, initial_groups=None, prefix='', is_set_group_label=True, is_plot=True)" }, {...
5
stack_v2_sparse_classes_30k_train_012274
Implement the Python class `MutationCollection` described below. Class description: Implement the MutationCollection class. Method signatures and docstrings: - def __init__(self, initial_groups=None, prefix='', is_set_group_label=True, is_plot=True): If no mutation_source is specified, then calculates a default Mutat...
Implement the Python class `MutationCollection` described below. Class description: Implement the MutationCollection class. Method signatures and docstrings: - def __init__(self, initial_groups=None, prefix='', is_set_group_label=True, is_plot=True): If no mutation_source is specified, then calculates a default Mutat...
704435e66c58677bab24f27820458870092924e2
<|skeleton|> class MutationCollection: def __init__(self, initial_groups=None, prefix='', is_set_group_label=True, is_plot=True): """If no mutation_source is specified, then calculates a default MutationDifferential. :param list-Group initial_groups: :param bool is_plot: plots if True""" <|body_0|>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MutationCollection: def __init__(self, initial_groups=None, prefix='', is_set_group_label=True, is_plot=True): """If no mutation_source is specified, then calculates a default MutationDifferential. :param list-Group initial_groups: :param bool is_plot: plots if True""" initial_groups = util.se...
the_stack_v2_python_sparse
microbepy/correlation/mutation_collection.py
ScienceStacks/microbepy
train
1
654903d1365dc7f97bfbe014e96c70493e0cf09f
[ "if not matrix or not path or rows < 1 or (cols < 1):\n return False\nvisited = [0] * (rows * cols)\npathLength = 0\nfor i in range(rows):\n for j in range(cols):\n if self.hasPathCore(matrix, rows, cols, i, j, path, pathLength, visited):\n return True\nreturn False", "if len(path) == path...
<|body_start_0|> if not matrix or not path or rows < 1 or (cols < 1): return False visited = [0] * (rows * cols) pathLength = 0 for i in range(rows): for j in range(cols): if self.hasPathCore(matrix, rows, cols, i, j, path, pathLength, visited): ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def hasPath(self, matrix, rows, cols, path): """:param matrix: 一个一维数组(题目中的二维矩阵) :param rows: 行 :param cols: 列 :param path: 要找的路径""" <|body_0|> def hasPathCore(self, matrix, rows, cols, i, j, path, pathLength, visited): """以格子 (i,j) 开始找路径 path 中的字符 path[path...
stack_v2_sparse_classes_36k_train_006976
2,879
permissive
[ { "docstring": ":param matrix: 一个一维数组(题目中的二维矩阵) :param rows: 行 :param cols: 列 :param path: 要找的路径", "name": "hasPath", "signature": "def hasPath(self, matrix, rows, cols, path)" }, { "docstring": "以格子 (i,j) 开始找路径 path 中的字符 path[pathLength], 若未找到说明以 (i, j)为起点是找不到路径的,直接退出,以下一个格子为起点找。 若找到了路径中的第一个字符,...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasPath(self, matrix, rows, cols, path): :param matrix: 一个一维数组(题目中的二维矩阵) :param rows: 行 :param cols: 列 :param path: 要找的路径 - def hasPathCore(self, matrix, rows, cols, i, j, pa...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasPath(self, matrix, rows, cols, path): :param matrix: 一个一维数组(题目中的二维矩阵) :param rows: 行 :param cols: 列 :param path: 要找的路径 - def hasPathCore(self, matrix, rows, cols, i, j, pa...
889d8fa489f1f2719c5a0dafd3ae51df7b4bf978
<|skeleton|> class Solution: def hasPath(self, matrix, rows, cols, path): """:param matrix: 一个一维数组(题目中的二维矩阵) :param rows: 行 :param cols: 列 :param path: 要找的路径""" <|body_0|> def hasPathCore(self, matrix, rows, cols, i, j, path, pathLength, visited): """以格子 (i,j) 开始找路径 path 中的字符 path[path...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def hasPath(self, matrix, rows, cols, path): """:param matrix: 一个一维数组(题目中的二维矩阵) :param rows: 行 :param cols: 列 :param path: 要找的路径""" if not matrix or not path or rows < 1 or (cols < 1): return False visited = [0] * (rows * cols) pathLength = 0 for i...
the_stack_v2_python_sparse
剑指offer/12-矩阵中的路径/12 hasPath.py
jinbooooom/coding-for-algorithms
train
14
1030b9670235ecefde328f82df820232ca97e0f6
[ "self.battle = battle\nPygameController.__init__(self, screen)\nself.coroutine = self.performEntireRound()", "self.screen.setBottomView(None)\nPerformEvents(self.battle.eventQueue, self)\nself.coroutine.send(None)\nif self.battle.over:\n self.stopRunning()", "while not self.battle.over:\n self.performRoun...
<|body_start_0|> self.battle = battle PygameController.__init__(self, screen) self.coroutine = self.performEntireRound() <|end_body_0|> <|body_start_1|> self.screen.setBottomView(None) PerformEvents(self.battle.eventQueue, self) self.coroutine.send(None) if self....
Controller for Battle Rounds
BattleRoundController
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BattleRoundController: """Controller for Battle Rounds""" def __init__(self, battle, screen): """Initialize the Battle Round Controller""" <|body_0|> def performGameCycle(self): """Tells the battle object what to perform""" <|body_1|> def performEnti...
stack_v2_sparse_classes_36k_train_006977
2,442
no_license
[ { "docstring": "Initialize the Battle Round Controller", "name": "__init__", "signature": "def __init__(self, battle, screen)" }, { "docstring": "Tells the battle object what to perform", "name": "performGameCycle", "signature": "def performGameCycle(self)" }, { "docstring": "Per...
5
stack_v2_sparse_classes_30k_train_007329
Implement the Python class `BattleRoundController` described below. Class description: Controller for Battle Rounds Method signatures and docstrings: - def __init__(self, battle, screen): Initialize the Battle Round Controller - def performGameCycle(self): Tells the battle object what to perform - def performEntireRo...
Implement the Python class `BattleRoundController` described below. Class description: Controller for Battle Rounds Method signatures and docstrings: - def __init__(self, battle, screen): Initialize the Battle Round Controller - def performGameCycle(self): Tells the battle object what to perform - def performEntireRo...
3931eee5fd04e18bb1738a0b27a4c6979dc4db01
<|skeleton|> class BattleRoundController: """Controller for Battle Rounds""" def __init__(self, battle, screen): """Initialize the Battle Round Controller""" <|body_0|> def performGameCycle(self): """Tells the battle object what to perform""" <|body_1|> def performEnti...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BattleRoundController: """Controller for Battle Rounds""" def __init__(self, battle, screen): """Initialize the Battle Round Controller""" self.battle = battle PygameController.__init__(self, screen) self.coroutine = self.performEntireRound() def performGameCycle(self...
the_stack_v2_python_sparse
src/Screen/Pygame/Battle/battle_round_controller.py
sgtnourry/Pokemon-Project
train
0
bd292910056a20d98d07e88d59c6246ec78d3ab8
[ "args = self.parser.parse_args()\ndata = self.build_data(args=args, collection='task')\nreturn data", "args = self.parse_args(add_task_fields)\nname = args.pop('name')\ntarget = args.pop('target')\ntry:\n task_data_list = submit_task_task(target=target, name=name, options=args)\nexcept Exception as e:\n log...
<|body_start_0|> args = self.parser.parse_args() data = self.build_data(args=args, collection='task') return data <|end_body_0|> <|body_start_1|> args = self.parse_args(add_task_fields) name = args.pop('name') target = args.pop('target') try: task_dat...
ARLTask
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ARLTask: def get(self): """任务信息查询""" <|body_0|> def post(self): """任务提交""" <|body_1|> <|end_skeleton|> <|body_start_0|> args = self.parser.parse_args() data = self.build_data(args=args, collection='task') return data <|end_body_0|> ...
stack_v2_sparse_classes_36k_train_006978
14,992
no_license
[ { "docstring": "任务信息查询", "name": "get", "signature": "def get(self)" }, { "docstring": "任务提交", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_021223
Implement the Python class `ARLTask` described below. Class description: Implement the ARLTask class. Method signatures and docstrings: - def get(self): 任务信息查询 - def post(self): 任务提交
Implement the Python class `ARLTask` described below. Class description: Implement the ARLTask class. Method signatures and docstrings: - def get(self): 任务信息查询 - def post(self): 任务提交 <|skeleton|> class ARLTask: def get(self): """任务信息查询""" <|body_0|> def post(self): """任务提交""" ...
5ca64806252b9e7e6d2b31a6bfaeecbfdc4baf06
<|skeleton|> class ARLTask: def get(self): """任务信息查询""" <|body_0|> def post(self): """任务提交""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ARLTask: def get(self): """任务信息查询""" args = self.parser.parse_args() data = self.build_data(args=args, collection='task') return data def post(self): """任务提交""" args = self.parse_args(add_task_fields) name = args.pop('name') target = args.po...
the_stack_v2_python_sparse
app/routes/task.py
QmF0c3UK/ARL
train
0
4c5495cf1bb582131de1e5c52b38709eefe0aad0
[ "self.check_run('deploy_environment_without_toolchain')\nself.env.revert_snapshot('ready_with_5_slaves')\nself.helpers.create_cluster(name=self.__class__.__name__)\nself.helpers.deploy_cluster({'slave-01': ['controller'], 'slave-02': ['compute', 'cinder']})\nself.helpers.run_ostf()\nself.env.make_snapshot('deploy_e...
<|body_start_0|> self.check_run('deploy_environment_without_toolchain') self.env.revert_snapshot('ready_with_5_slaves') self.helpers.create_cluster(name=self.__class__.__name__) self.helpers.deploy_cluster({'slave-01': ['controller'], 'slave-02': ['compute', 'cinder']}) self.help...
Class for testing that the LMA Toolchain plugins can be installed in an existing environment.
TestToolchainPostInstallation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestToolchainPostInstallation: """Class for testing that the LMA Toolchain plugins can be installed in an existing environment.""" def deploy_environment_without_toolchain(self): """Deploy a cluster without the LMA Toolchain plugins. Scenario: 1. Create the cluster 2. Add 1 node with...
stack_v2_sparse_classes_36k_train_006979
3,993
no_license
[ { "docstring": "Deploy a cluster without the LMA Toolchain plugins. Scenario: 1. Create the cluster 2. Add 1 node with the controller role 3. Add 1 node with the compute and cinder roles 4. Deploy the cluster 5. Run OSTF Duration 60m Snapshot deploy_environment_without_toolchain", "name": "deploy_environmen...
2
stack_v2_sparse_classes_30k_train_017847
Implement the Python class `TestToolchainPostInstallation` described below. Class description: Class for testing that the LMA Toolchain plugins can be installed in an existing environment. Method signatures and docstrings: - def deploy_environment_without_toolchain(self): Deploy a cluster without the LMA Toolchain pl...
Implement the Python class `TestToolchainPostInstallation` described below. Class description: Class for testing that the LMA Toolchain plugins can be installed in an existing environment. Method signatures and docstrings: - def deploy_environment_without_toolchain(self): Deploy a cluster without the LMA Toolchain pl...
179249df2d206eeabb3955c9dc8cb78cac3c36c6
<|skeleton|> class TestToolchainPostInstallation: """Class for testing that the LMA Toolchain plugins can be installed in an existing environment.""" def deploy_environment_without_toolchain(self): """Deploy a cluster without the LMA Toolchain plugins. Scenario: 1. Create the cluster 2. Add 1 node with...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestToolchainPostInstallation: """Class for testing that the LMA Toolchain plugins can be installed in an existing environment.""" def deploy_environment_without_toolchain(self): """Deploy a cluster without the LMA Toolchain plugins. Scenario: 1. Create the cluster 2. Add 1 node with the controll...
the_stack_v2_python_sparse
stacklight_tests/toolchain/test_post_install.py
rkhozinov/stacklight-integration-tests
train
1
97976139dc89d5f5d252b29d61638a65e5722867
[ "self.address = self._get_conf('Ec_rest_server_address')\nself.port = self._get_conf('Ec_port_number')\nself.controller_type = 'em'\nself.api_url = 'v1/internal/ec_ctrl/logstatusnotify'\nself.url_format = 'http://{address}:{port}/{api_url}'", "if self.address and self.port:\n thread = threading.Thread(target=s...
<|body_start_0|> self.address = self._get_conf('Ec_rest_server_address') self.port = self._get_conf('Ec_port_number') self.controller_type = 'em' self.api_url = 'v1/internal/ec_ctrl/logstatusnotify' self.url_format = 'http://{address}:{port}/{api_url}' <|end_body_0|> <|body_star...
Controller log notification class
ControllerLogNotify
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ControllerLogNotify: """Controller log notification class""" def __init__(self): """Constructor""" <|body_0|> def notify_logs(self, msg, log_level): """Log is notified. Argument: msg : log data (str) log_level : log level (int)""" <|body_1|> def send...
stack_v2_sparse_classes_36k_train_006980
3,494
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Log is notified. Argument: msg : log data (str) log_level : log level (int)", "name": "notify_logs", "signature": "def notify_logs(self, msg, log_level)" }, { "docstring": "Requ...
5
null
Implement the Python class `ControllerLogNotify` described below. Class description: Controller log notification class Method signatures and docstrings: - def __init__(self): Constructor - def notify_logs(self, msg, log_level): Log is notified. Argument: msg : log data (str) log_level : log level (int) - def send_not...
Implement the Python class `ControllerLogNotify` described below. Class description: Controller log notification class Method signatures and docstrings: - def __init__(self): Constructor - def notify_logs(self, msg, log_level): Log is notified. Argument: msg : log data (str) log_level : log level (int) - def send_not...
e550d1b5ec9419f1fb3eb6e058ce46b57c92ee2f
<|skeleton|> class ControllerLogNotify: """Controller log notification class""" def __init__(self): """Constructor""" <|body_0|> def notify_logs(self, msg, log_level): """Log is notified. Argument: msg : log data (str) log_level : log level (int)""" <|body_1|> def send...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ControllerLogNotify: """Controller log notification class""" def __init__(self): """Constructor""" self.address = self._get_conf('Ec_rest_server_address') self.port = self._get_conf('Ec_port_number') self.controller_type = 'em' self.api_url = 'v1/internal/ec_ctrl/l...
the_stack_v2_python_sparse
lib/ControllerLogNotify/ControllerLogNotify.py
lixiaochun/element-manager
train
0
40018bf78d0e5152a2446aef1b89ac6e8e35b626
[ "self._resource = resource\nself._pin = pin\nself.data = {}", "try:\n response = requests.get(f'{self._resource}/digital/{self._pin}', timeout=10)\n self.data = {'state': response.json()['return_value']}\nexcept requests.exceptions.ConnectionError:\n _LOGGER.error(\"No route to device '%s'\", self._resou...
<|body_start_0|> self._resource = resource self._pin = pin self.data = {} <|end_body_0|> <|body_start_1|> try: response = requests.get(f'{self._resource}/digital/{self._pin}', timeout=10) self.data = {'state': response.json()['return_value']} except reque...
Class for handling the data retrieval for pins.
ArestData
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArestData: """Class for handling the data retrieval for pins.""" def __init__(self, resource, pin): """Initialize the aREST data object.""" <|body_0|> def update(self) -> None: """Get the latest data from aREST device.""" <|body_1|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_36k_train_006981
3,418
permissive
[ { "docstring": "Initialize the aREST data object.", "name": "__init__", "signature": "def __init__(self, resource, pin)" }, { "docstring": "Get the latest data from aREST device.", "name": "update", "signature": "def update(self) -> None" } ]
2
stack_v2_sparse_classes_30k_train_007244
Implement the Python class `ArestData` described below. Class description: Class for handling the data retrieval for pins. Method signatures and docstrings: - def __init__(self, resource, pin): Initialize the aREST data object. - def update(self) -> None: Get the latest data from aREST device.
Implement the Python class `ArestData` described below. Class description: Class for handling the data retrieval for pins. Method signatures and docstrings: - def __init__(self, resource, pin): Initialize the aREST data object. - def update(self) -> None: Get the latest data from aREST device. <|skeleton|> class Are...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class ArestData: """Class for handling the data retrieval for pins.""" def __init__(self, resource, pin): """Initialize the aREST data object.""" <|body_0|> def update(self) -> None: """Get the latest data from aREST device.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ArestData: """Class for handling the data retrieval for pins.""" def __init__(self, resource, pin): """Initialize the aREST data object.""" self._resource = resource self._pin = pin self.data = {} def update(self) -> None: """Get the latest data from aREST dev...
the_stack_v2_python_sparse
homeassistant/components/arest/binary_sensor.py
home-assistant/core
train
35,501
3f89dae91c71a98247aaf3fc00979abbfdd6931c
[ "input_doc = xml.dom.minidom.parse(filename)\npoint = point.process(input_doc.getElementsByTagName('Parameters')[0])\nrequests = self._handleRequests(input_doc.getElementsByTagName('Requests')[0])\nreturn (point, requests)", "requests = {}\nfor child in node.childNodes:\n if child.nodeType == node.ELEMENT_NODE...
<|body_start_0|> input_doc = xml.dom.minidom.parse(filename) point = point.process(input_doc.getElementsByTagName('Parameters')[0]) requests = self._handleRequests(input_doc.getElementsByTagName('Requests')[0]) return (point, requests) <|end_body_0|> <|body_start_1|> requests = ...
The reader/writer for the COLIN XML IO Formats
ColinXmlIO
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ColinXmlIO: """The reader/writer for the COLIN XML IO Formats""" def read(self, filename, point): """Read a point and request information. This method returns a tuple: point, requests""" <|body_0|> def _handleRequests(self, node): """A function that processes the...
stack_v2_sparse_classes_36k_train_006982
2,928
permissive
[ { "docstring": "Read a point and request information. This method returns a tuple: point, requests", "name": "read", "signature": "def read(self, filename, point)" }, { "docstring": "A function that processes the requests", "name": "_handleRequests", "signature": "def _handleRequests(sel...
4
null
Implement the Python class `ColinXmlIO` described below. Class description: The reader/writer for the COLIN XML IO Formats Method signatures and docstrings: - def read(self, filename, point): Read a point and request information. This method returns a tuple: point, requests - def _handleRequests(self, node): A functi...
Implement the Python class `ColinXmlIO` described below. Class description: The reader/writer for the COLIN XML IO Formats Method signatures and docstrings: - def read(self, filename, point): Read a point and request information. This method returns a tuple: point, requests - def _handleRequests(self, node): A functi...
ab4ada5a93aed570a6e6ca6161462e970cffe677
<|skeleton|> class ColinXmlIO: """The reader/writer for the COLIN XML IO Formats""" def read(self, filename, point): """Read a point and request information. This method returns a tuple: point, requests""" <|body_0|> def _handleRequests(self, node): """A function that processes the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ColinXmlIO: """The reader/writer for the COLIN XML IO Formats""" def read(self, filename, point): """Read a point and request information. This method returns a tuple: point, requests""" input_doc = xml.dom.minidom.parse(filename) point = point.process(input_doc.getElementsByTagNa...
the_stack_v2_python_sparse
pyomo/opt/plugins/colin_xml_io.py
qtothec/pyomo
train
3
e42279d86caaec807eea2c51576edc1818618277
[ "if len(s) <= 1:\n return True\nfor i in range(len(s) / 2):\n if s[i] != s[len(s) - i - 1]:\n return False\nreturn True", "m, n = (len(word1), len(word2))\nif m == 0 or n == 0:\n return 0\ndp = [0] * n\nres = 0\nfor i, a in enumerate(word1):\n cur_max = 1\n for j, b in enumerate(word2):\n ...
<|body_start_0|> if len(s) <= 1: return True for i in range(len(s) / 2): if s[i] != s[len(s) - i - 1]: return False return True <|end_body_0|> <|body_start_1|> m, n = (len(word1), len(word2)) if m == 0 or n == 0: return 0 ...
XString
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class XString: def is_p(self, s): """is palindrome type s: string rtype : boolean""" <|body_0|> def lcslen(self, word1, word2): """longest common substring :type word1: str :type word2: str :rtype: int :return the length of longest common substring, e.g, m('1a2b3c4d', 'a5b...
stack_v2_sparse_classes_36k_train_006983
6,377
no_license
[ { "docstring": "is palindrome type s: string rtype : boolean", "name": "is_p", "signature": "def is_p(self, s)" }, { "docstring": "longest common substring :type word1: str :type word2: str :rtype: int :return the length of longest common substring, e.g, m('1a2b3c4d', 'a5b6c777d88') return 4 (le...
4
null
Implement the Python class `XString` described below. Class description: Implement the XString class. Method signatures and docstrings: - def is_p(self, s): is palindrome type s: string rtype : boolean - def lcslen(self, word1, word2): longest common substring :type word1: str :type word2: str :rtype: int :return the...
Implement the Python class `XString` described below. Class description: Implement the XString class. Method signatures and docstrings: - def is_p(self, s): is palindrome type s: string rtype : boolean - def lcslen(self, word1, word2): longest common substring :type word1: str :type word2: str :rtype: int :return the...
9e4f6f1a2830bd9aab1bba374c98f0464825d435
<|skeleton|> class XString: def is_p(self, s): """is palindrome type s: string rtype : boolean""" <|body_0|> def lcslen(self, word1, word2): """longest common substring :type word1: str :type word2: str :rtype: int :return the length of longest common substring, e.g, m('1a2b3c4d', 'a5b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class XString: def is_p(self, s): """is palindrome type s: string rtype : boolean""" if len(s) <= 1: return True for i in range(len(s) / 2): if s[i] != s[len(s) - i - 1]: return False return True def lcslen(self, word1, word2): """...
the_stack_v2_python_sparse
python_solutions/712.minimum-ascii-delete-sum-for-two-strings.py
h4hany/leetcode
train
0
4c7431e38bed166aac61e4b93caf7764cca6131c
[ "self.image = Image.open(image_data)\nimage_size = self.image.size\nself.image_too_large = False\nif image_size[0] > MAX_ALLOWED_IMAGE_DIM or image_size[1] > MAX_ALLOWED_IMAGE_DIM:\n self.image_too_large = True\nif image_size[0] > MAX_IMAGE_DIM or image_size[1] > MAX_IMAGE_DIM:\n self.image = self.image.resiz...
<|body_start_0|> self.image = Image.open(image_data) image_size = self.image.size self.image_too_large = False if image_size[0] > MAX_ALLOWED_IMAGE_DIM or image_size[1] > MAX_ALLOWED_IMAGE_DIM: self.image_too_large = True if image_size[0] > MAX_IMAGE_DIM or image_size...
Class to check properties of an image and to validate if they are allowed.
ImageProperties
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageProperties: """Class to check properties of an image and to validate if they are allowed.""" def __init__(self, image_data): """Initializes class variables @param image: Image object (from PIL) @return: None""" <|body_0|> def count_colors(self): """Counts th...
stack_v2_sparse_classes_36k_train_006984
8,366
no_license
[ { "docstring": "Initializes class variables @param image: Image object (from PIL) @return: None", "name": "__init__", "signature": "def __init__(self, image_data)" }, { "docstring": "Counts the number of colors in an image, and matches them to the max allowed @return: boolean true if color count...
5
null
Implement the Python class `ImageProperties` described below. Class description: Class to check properties of an image and to validate if they are allowed. Method signatures and docstrings: - def __init__(self, image_data): Initializes class variables @param image: Image object (from PIL) @return: None - def count_co...
Implement the Python class `ImageProperties` described below. Class description: Class to check properties of an image and to validate if they are allowed. Method signatures and docstrings: - def __init__(self, image_data): Initializes class variables @param image: Image object (from PIL) @return: None - def count_co...
5fa3a818c3d41bd9c3eb25122e1d376c8910269c
<|skeleton|> class ImageProperties: """Class to check properties of an image and to validate if they are allowed.""" def __init__(self, image_data): """Initializes class variables @param image: Image object (from PIL) @return: None""" <|body_0|> def count_colors(self): """Counts th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImageProperties: """Class to check properties of an image and to validate if they are allowed.""" def __init__(self, image_data): """Initializes class variables @param image: Image object (from PIL) @return: None""" self.image = Image.open(image_data) image_size = self.image.size ...
the_stack_v2_python_sparse
ExtractFeatures/Data/pratik98/open_ended_image_submission.py
vivekaxl/LexisNexis
train
9
26dd01fc7464fa5f25199bb74be568bb4abc301a
[ "self.ranges = ranges = [0]\nself.rects = rects\nfor x1, y1, x2, y2 in rects:\n ranges.append(ranges[-1] + (y2 - y1 + 1) * (x2 - x1 + 1))", "ranges, rects = (self.ranges, self.rects)\nareaPt = random.randint(1, ranges[-1])\nx1, y1, x2, y2 = rects[bisect.bisect_left(ranges, areaPt) - 1]\nreturn [random.randint(...
<|body_start_0|> self.ranges = ranges = [0] self.rects = rects for x1, y1, x2, y2 in rects: ranges.append(ranges[-1] + (y2 - y1 + 1) * (x2 - x1 + 1)) <|end_body_0|> <|body_start_1|> ranges, rects = (self.ranges, self.rects) areaPt = random.randint(1, ranges[-1]) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, rects): """:type rects: List[List[int]]""" <|body_0|> def pick(self): """:rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.ranges = ranges = [0] self.rects = rects for x1, y1, x2, y2 ...
stack_v2_sparse_classes_36k_train_006985
4,116
no_license
[ { "docstring": ":type rects: List[List[int]]", "name": "__init__", "signature": "def __init__(self, rects)" }, { "docstring": ":rtype: List[int]", "name": "pick", "signature": "def pick(self)" } ]
2
stack_v2_sparse_classes_30k_train_014984
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, rects): :type rects: List[List[int]] - def pick(self): :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, rects): :type rects: List[List[int]] - def pick(self): :rtype: List[int] <|skeleton|> class Solution: def __init__(self, rects): """:type rects: ...
d2037e521a3ee6fdcc14fd5228ea1fd32d57d637
<|skeleton|> class Solution: def __init__(self, rects): """:type rects: List[List[int]]""" <|body_0|> def pick(self): """:rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, rects): """:type rects: List[List[int]]""" self.ranges = ranges = [0] self.rects = rects for x1, y1, x2, y2 in rects: ranges.append(ranges[-1] + (y2 - y1 + 1) * (x2 - x1 + 1)) def pick(self): """:rtype: List[int]""" ...
the_stack_v2_python_sparse
monthlyChallenge/2020-08(augustchallenge)/8_22(***)RandNonOverlappedRect.py
phu-n-tran/LeetCode
train
2
89ff15bbd2be63a50bc35b21850606205f9fee65
[ "super().__init__()\nself.graph, self.session = parse_tf_model_bytes(model_bytes, device, session_config)\nself.input_image = self.graph.get_tensor_by_name('input:0')\nself.segmented_tensor = self.graph.get_tensor_by_name('output_prediction:0')", "img_rgb = cv2.cvtColor(img_bgr, cv2.COLOR_BGR2RGB)\nfeed = {self.i...
<|body_start_0|> super().__init__() self.graph, self.session = parse_tf_model_bytes(model_bytes, device, session_config) self.input_image = self.graph.get_tensor_by_name('input:0') self.segmented_tensor = self.graph.get_tensor_by_name('output_prediction:0') <|end_body_0|> <|body_start_1...
Loads a model and uses it to run depth prediction, meaning that it takes an image as input and returns a matrix the size of the input image where the value of each 'pixel' corresponds to the pixel's distance from the camera in meters. Does not support batch prediction TODO: Is this true?
DepthPredictor
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DepthPredictor: """Loads a model and uses it to run depth prediction, meaning that it takes an image as input and returns a matrix the size of the input image where the value of each 'pixel' corresponds to the pixel's distance from the camera in meters. Does not support batch prediction TODO: Is ...
stack_v2_sparse_classes_36k_train_006986
2,142
permissive
[ { "docstring": ":param model_bytes: Model file data, likely a loaded *.pb file :param device: The device to run the model on :param session_config: Model configuration options", "name": "__init__", "signature": "def __init__(self, model_bytes, device: str=None, session_config: tf.compat.v1.ConfigProto=N...
2
stack_v2_sparse_classes_30k_val_000787
Implement the Python class `DepthPredictor` described below. Class description: Loads a model and uses it to run depth prediction, meaning that it takes an image as input and returns a matrix the size of the input image where the value of each 'pixel' corresponds to the pixel's distance from the camera in meters. Does...
Implement the Python class `DepthPredictor` described below. Class description: Loads a model and uses it to run depth prediction, meaning that it takes an image as input and returns a matrix the size of the input image where the value of each 'pixel' corresponds to the pixel's distance from the camera in meters. Does...
7412902fed8f91c9c82bd42b0180e07673c38bf1
<|skeleton|> class DepthPredictor: """Loads a model and uses it to run depth prediction, meaning that it takes an image as input and returns a matrix the size of the input image where the value of each 'pixel' corresponds to the pixel's distance from the camera in meters. Does not support batch prediction TODO: Is ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DepthPredictor: """Loads a model and uses it to run depth prediction, meaning that it takes an image as input and returns a matrix the size of the input image where the value of each 'pixel' corresponds to the pixel's distance from the camera in meters. Does not support batch prediction TODO: Is this true?"""...
the_stack_v2_python_sparse
vcap_utils/vcap_utils/backends/depth.py
opencv/open_vision_capsules
train
124
9e610cef92c3f9a27ce716577bd54232b9871a21
[ "result = [[]]\nfor num in nums:\n result += [curr_result + [num] for curr_result in result]\nreturn result", "result = []\n\ndef backtrack(tmp, idx):\n result.append(tmp[:])\n for i in xrange(idx, len(nums)):\n tmp.append(nums[i])\n backtrack(tmp, i + 1)\n tmp.pop()\nbacktrack([], 0...
<|body_start_0|> result = [[]] for num in nums: result += [curr_result + [num] for curr_result in result] return result <|end_body_0|> <|body_start_1|> result = [] def backtrack(tmp, idx): result.append(tmp[:]) for i in xrange(idx, len(nums))...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def subsets_1(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def subsets(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> result = [[]] for n...
stack_v2_sparse_classes_36k_train_006987
1,481
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "subsets_1", "signature": "def subsets_1(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "subsets", "signature": "def subsets(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_000820
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subsets_1(self, nums): :type nums: List[int] :rtype: List[List[int]] - def subsets(self, nums): :type nums: List[int] :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subsets_1(self, nums): :type nums: List[int] :rtype: List[List[int]] - def subsets(self, nums): :type nums: List[int] :rtype: List[List[int]] <|skeleton|> class Solution: ...
5c2473f859da5efec73120256faad06ab8e0e359
<|skeleton|> class Solution: def subsets_1(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def subsets(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def subsets_1(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" result = [[]] for num in nums: result += [curr_result + [num] for curr_result in result] return result def subsets(self, nums): """:type nums: List[int] :rtype: Lis...
the_stack_v2_python_sparse
leetcode/subsets.py
chlos/exercises_in_futility
train
0
c01ac6f0b059d2dd4fe85d2dac1454ca3d6bd08e
[ "if len(values) == 0 or len(weights) == 0:\n return 0\ntable = []\nfor i in range(limit + 1):\n table.append([0] * (len(values) + 1))\nfor max_weights in range(limit + 1):\n for i in range(len(values) + 1):\n if max_weights == 0:\n table[max_weights][i] = 0\n elif i == 0:\n ...
<|body_start_0|> if len(values) == 0 or len(weights) == 0: return 0 table = [] for i in range(limit + 1): table.append([0] * (len(values) + 1)) for max_weights in range(limit + 1): for i in range(len(values) + 1): if max_weights == 0: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def knapsack(self, values, weights, limit): """input: string source, string target return: int""" <|body_0|> def knapsack2(self, values, weights, limit): """input: string source, string target return: int""" <|body_1|> <|end_skeleton|> <|body_star...
stack_v2_sparse_classes_36k_train_006988
3,832
no_license
[ { "docstring": "input: string source, string target return: int", "name": "knapsack", "signature": "def knapsack(self, values, weights, limit)" }, { "docstring": "input: string source, string target return: int", "name": "knapsack2", "signature": "def knapsack2(self, values, weights, lim...
2
stack_v2_sparse_classes_30k_val_000022
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def knapsack(self, values, weights, limit): input: string source, string target return: int - def knapsack2(self, values, weights, limit): input: string source, string target ret...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def knapsack(self, values, weights, limit): input: string source, string target return: int - def knapsack2(self, values, weights, limit): input: string source, string target ret...
8d9eb98fa5e897602eae9c37b47fd8abae72b1dc
<|skeleton|> class Solution: def knapsack(self, values, weights, limit): """input: string source, string target return: int""" <|body_0|> def knapsack2(self, values, weights, limit): """input: string source, string target return: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def knapsack(self, values, weights, limit): """input: string source, string target return: int""" if len(values) == 0 or len(weights) == 0: return 0 table = [] for i in range(limit + 1): table.append([0] * (len(values) + 1)) for max_wei...
the_stack_v2_python_sparse
misc/knapsack.py
wanlipu/coding-python
train
0
1684678b68165a0fd8dd055be58b2f53e1faa4ad
[ "fit_params = {}\nmodel_params = {}\nfor k, v in params.items():\n if k in self.independent_vars or k in ['weights', 'method', 'scale_covar', 'iter_cb']:\n fit_params[k] = v\n else:\n model_params[k] = v\np = self.make_params(**model_params)\nfit = lmfit.Model.fit(self, data, params=p, **fit_par...
<|body_start_0|> fit_params = {} model_params = {} for k, v in params.items(): if k in self.independent_vars or k in ['weights', 'method', 'scale_covar', 'iter_cb']: fit_params[k] = v else: model_params[k] = v p = self.make_params(*...
Simple extension of lmfit.Model that allows one-line fitting. Example uses: # single exponential fit:: fit = expfitting.Exp1.fit(data, x=time_vals, xoffset=(0, 'fixed'), yoffset=(yoff_guess, -120, 0), amp=(amp_guess, 0, 50), tau=(tau_guess, 0.1, 50)) # plot the fit:: fit_curve = fit.eval() plot(time_vals, fit_curve) # ...
FitModel
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FitModel: """Simple extension of lmfit.Model that allows one-line fitting. Example uses: # single exponential fit:: fit = expfitting.Exp1.fit(data, x=time_vals, xoffset=(0, 'fixed'), yoffset=(yoff_guess, -120, 0), amp=(amp_guess, 0, 50), tau=(tau_guess, 0.1, 50)) # plot the fit:: fit_curve = fit....
stack_v2_sparse_classes_36k_train_006989
6,827
permissive
[ { "docstring": "Return a fit of data to this model. Parameters ---------- data : array dependent data to fit interactive : bool If True, show a GUI used for interactively exploring fit parameters Extra keyword arguments are passed to make_params() if they are model parameter names, or passed directly to Model.f...
3
stack_v2_sparse_classes_30k_train_008952
Implement the Python class `FitModel` described below. Class description: Simple extension of lmfit.Model that allows one-line fitting. Example uses: # single exponential fit:: fit = expfitting.Exp1.fit(data, x=time_vals, xoffset=(0, 'fixed'), yoffset=(yoff_guess, -120, 0), amp=(amp_guess, 0, 50), tau=(tau_guess, 0.1,...
Implement the Python class `FitModel` described below. Class description: Simple extension of lmfit.Model that allows one-line fitting. Example uses: # single exponential fit:: fit = expfitting.Exp1.fit(data, x=time_vals, xoffset=(0, 'fixed'), yoffset=(yoff_guess, -120, 0), amp=(amp_guess, 0, 50), tau=(tau_guess, 0.1,...
ff705f650e765142775f4ae0e3c3159e30af8944
<|skeleton|> class FitModel: """Simple extension of lmfit.Model that allows one-line fitting. Example uses: # single exponential fit:: fit = expfitting.Exp1.fit(data, x=time_vals, xoffset=(0, 'fixed'), yoffset=(yoff_guess, -120, 0), amp=(amp_guess, 0, 50), tau=(tau_guess, 0.1, 50)) # plot the fit:: fit_curve = fit....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FitModel: """Simple extension of lmfit.Model that allows one-line fitting. Example uses: # single exponential fit:: fit = expfitting.Exp1.fit(data, x=time_vals, xoffset=(0, 'fixed'), yoffset=(yoff_guess, -120, 0), amp=(amp_guess, 0, 50), tau=(tau_guess, 0.1, 50)) # plot the fit:: fit_curve = fit.eval() plot(t...
the_stack_v2_python_sparse
cnmodel/util/fitting.py
cnmodel/cnmodel
train
10
b024ce790f1a0c6ce1cc0e1f34202313fcedc8a0
[ "super().__init__()\nself.graph, self.session = parse_tf_model_bytes(model_bytes, device, session_config)\nself.label_map = parse_dataset_metadata_bytes(metadata_bytes)\nself.input_image = self.graph.get_tensor_by_name('input')\nself.segmented_tensor = self.graph.get_tensor_by_name('output_prediction')", "feed = ...
<|body_start_0|> super().__init__() self.graph, self.session = parse_tf_model_bytes(model_bytes, device, session_config) self.label_map = parse_dataset_metadata_bytes(metadata_bytes) self.input_image = self.graph.get_tensor_by_name('input') self.segmented_tensor = self.graph.get_...
Loads a model and uses it to run image segmentation, meaning that it takes an image as input and returns a matrix the size of the input image where the value of each 'pixel' corresponds to an image segment type. Does not support batch prediction TODO: Is this true?
Segmenter
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Segmenter: """Loads a model and uses it to run image segmentation, meaning that it takes an image as input and returns a matrix the size of the input image where the value of each 'pixel' corresponds to an image segment type. Does not support batch prediction TODO: Is this true?""" def __ini...
stack_v2_sparse_classes_36k_train_006990
2,521
permissive
[ { "docstring": ":param model_bytes: Model file data, likely a loaded *.pb file :param metadata_bytes: The dataset metadata file data, likely named \"dataset_metadata.json\" :param device: The device to run the model on :param session_config: Model configuration options", "name": "__init__", "signature":...
2
stack_v2_sparse_classes_30k_train_016964
Implement the Python class `Segmenter` described below. Class description: Loads a model and uses it to run image segmentation, meaning that it takes an image as input and returns a matrix the size of the input image where the value of each 'pixel' corresponds to an image segment type. Does not support batch predictio...
Implement the Python class `Segmenter` described below. Class description: Loads a model and uses it to run image segmentation, meaning that it takes an image as input and returns a matrix the size of the input image where the value of each 'pixel' corresponds to an image segment type. Does not support batch predictio...
7412902fed8f91c9c82bd42b0180e07673c38bf1
<|skeleton|> class Segmenter: """Loads a model and uses it to run image segmentation, meaning that it takes an image as input and returns a matrix the size of the input image where the value of each 'pixel' corresponds to an image segment type. Does not support batch prediction TODO: Is this true?""" def __ini...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Segmenter: """Loads a model and uses it to run image segmentation, meaning that it takes an image as input and returns a matrix the size of the input image where the value of each 'pixel' corresponds to an image segment type. Does not support batch prediction TODO: Is this true?""" def __init__(self, mod...
the_stack_v2_python_sparse
vcap_utils/vcap_utils/backends/segmentation.py
opencv/open_vision_capsules
train
124
757964161dd89c5d39077a62a765398605121c04
[ "self.filename = os.path.join(write_dir, 'hdf5/data%08d.h5' % i)\nself.iteration = i\nself.zmin_lab = zmin_lab\nself.zmax_lab = zmax_lab\nself.t_lab = t_lab\nself.current_z_lab = 0\nself.current_z_boost = 0\nself.buffered_slices = []\nself.buffer_z_indices = []\ndata_shape = (10, 2 * fld.Nm - 1, Nr_output)\nif fld....
<|body_start_0|> self.filename = os.path.join(write_dir, 'hdf5/data%08d.h5' % i) self.iteration = i self.zmin_lab = zmin_lab self.zmax_lab = zmax_lab self.t_lab = t_lab self.current_z_lab = 0 self.current_z_boost = 0 self.buffered_slices = [] self....
Class that stores data relative to one given snapshot in the lab frame (i.e. one given *time* in the lab frame)
LabSnapshot
[ "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LabSnapshot: """Class that stores data relative to one given snapshot in the lab frame (i.e. one given *time* in the lab frame)""" def __init__(self, t_lab, zmin_lab, zmax_lab, write_dir, i, fld, Nr_output): """Initialize a LabSnapshot Parameters ---------- t_lab: float (seconds) Tim...
stack_v2_sparse_classes_36k_train_006991
33,919
permissive
[ { "docstring": "Initialize a LabSnapshot Parameters ---------- t_lab: float (seconds) Time of this snapshot *in the lab frame* zmin_lab, zmax_lab: floats Longitudinal limits of this snapshot write_dir: string Absolute path to the directory where the data for this snapshot is to be written i: int Number of the f...
4
null
Implement the Python class `LabSnapshot` described below. Class description: Class that stores data relative to one given snapshot in the lab frame (i.e. one given *time* in the lab frame) Method signatures and docstrings: - def __init__(self, t_lab, zmin_lab, zmax_lab, write_dir, i, fld, Nr_output): Initialize a Lab...
Implement the Python class `LabSnapshot` described below. Class description: Class that stores data relative to one given snapshot in the lab frame (i.e. one given *time* in the lab frame) Method signatures and docstrings: - def __init__(self, t_lab, zmin_lab, zmax_lab, write_dir, i, fld, Nr_output): Initialize a Lab...
5744598571eab40c4fb45cc3db21f346b69b1f37
<|skeleton|> class LabSnapshot: """Class that stores data relative to one given snapshot in the lab frame (i.e. one given *time* in the lab frame)""" def __init__(self, t_lab, zmin_lab, zmax_lab, write_dir, i, fld, Nr_output): """Initialize a LabSnapshot Parameters ---------- t_lab: float (seconds) Tim...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LabSnapshot: """Class that stores data relative to one given snapshot in the lab frame (i.e. one given *time* in the lab frame)""" def __init__(self, t_lab, zmin_lab, zmax_lab, write_dir, i, fld, Nr_output): """Initialize a LabSnapshot Parameters ---------- t_lab: float (seconds) Time of this sna...
the_stack_v2_python_sparse
fbpic/openpmd_diag/boosted_field_diag.py
fbpic/fbpic
train
163
8daa2c680bbf2d7096fe8f99dd40b90b1a609af2
[ "if os.system('redis-server &') == 0:\n print('redis-server 启动成功')\n try:\n time.sleep(0.5)\n self.__connect = redis.Redis(host=s_host)\n except:\n self.__connect = None\nelse:\n self.__connect = None", "if self.__connect is not None:\n self.__connect.publish(str_channel, sendM...
<|body_start_0|> if os.system('redis-server &') == 0: print('redis-server 启动成功') try: time.sleep(0.5) self.__connect = redis.Redis(host=s_host) except: self.__connect = None else: self.__connect = None <|end_...
DataBus
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataBus: def __init__(self, s_host: str): """:param s_host: REDIS服务地址""" <|body_0|> def publish(self, str_channel: str, sendMsg): """:param str_channel:消息发布频道 :param sendMsg:对应消息 :return:消息发布状态,成功:TRUE,失败:FALSE""" <|body_1|> def get_subscriber(self, list...
stack_v2_sparse_classes_36k_train_006992
1,428
no_license
[ { "docstring": ":param s_host: REDIS服务地址", "name": "__init__", "signature": "def __init__(self, s_host: str)" }, { "docstring": ":param str_channel:消息发布频道 :param sendMsg:对应消息 :return:消息发布状态,成功:TRUE,失败:FALSE", "name": "publish", "signature": "def publish(self, str_channel: str, sendMsg)" ...
3
null
Implement the Python class `DataBus` described below. Class description: Implement the DataBus class. Method signatures and docstrings: - def __init__(self, s_host: str): :param s_host: REDIS服务地址 - def publish(self, str_channel: str, sendMsg): :param str_channel:消息发布频道 :param sendMsg:对应消息 :return:消息发布状态,成功:TRUE,失败:FA...
Implement the Python class `DataBus` described below. Class description: Implement the DataBus class. Method signatures and docstrings: - def __init__(self, s_host: str): :param s_host: REDIS服务地址 - def publish(self, str_channel: str, sendMsg): :param str_channel:消息发布频道 :param sendMsg:对应消息 :return:消息发布状态,成功:TRUE,失败:FA...
31918e28fa3390390c4ea6208132d48164f95f73
<|skeleton|> class DataBus: def __init__(self, s_host: str): """:param s_host: REDIS服务地址""" <|body_0|> def publish(self, str_channel: str, sendMsg): """:param str_channel:消息发布频道 :param sendMsg:对应消息 :return:消息发布状态,成功:TRUE,失败:FALSE""" <|body_1|> def get_subscriber(self, list...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DataBus: def __init__(self, s_host: str): """:param s_host: REDIS服务地址""" if os.system('redis-server &') == 0: print('redis-server 启动成功') try: time.sleep(0.5) self.__connect = redis.Redis(host=s_host) except: se...
the_stack_v2_python_sparse
new_soft/Common/Interface/DataBus.py
841661831/perception
train
1
e950332936e16fe0704720e81b300c1cdc57962f
[ "if csvfilename is not None:\n attrdata = self.loaddata(mriscan, attrname, csvfilename)\nelse:\n attrdata = self.loaddata(mriscan, attrname)\nattr = netattr.Attr(attrdata, self.atlasobj, mriscan, attrname)\nreturn attr", "attr_list = []\nfor mriscan in mriscans:\n if csvfilename is not None:\n att...
<|body_start_0|> if csvfilename is not None: attrdata = self.loaddata(mriscan, attrname, csvfilename) else: attrdata = self.loaddata(mriscan, attrname) attr = netattr.Attr(attrdata, self.atlasobj, mriscan, attrname) return attr <|end_body_0|> <|body_start_1|> ...
Attribute loader.
AttrLoader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AttrLoader: """Attribute loader.""" def loadSingle(self, mriscan, attrname, csvfilename=None): """Load the attribute object, with atlasobj. - mriscan: specify which scan to load from - attrname: the name of the attr to load - csvfilename: the name of the attr file name. Specify this ...
stack_v2_sparse_classes_36k_train_006993
13,309
no_license
[ { "docstring": "Load the attribute object, with atlasobj. - mriscan: specify which scan to load from - attrname: the name of the attr to load - csvfilename: the name of the attr file name. Specify this parameter to override filename", "name": "loadSingle", "signature": "def loadSingle(self, mriscan, att...
3
stack_v2_sparse_classes_30k_train_018141
Implement the Python class `AttrLoader` described below. Class description: Attribute loader. Method signatures and docstrings: - def loadSingle(self, mriscan, attrname, csvfilename=None): Load the attribute object, with atlasobj. - mriscan: specify which scan to load from - attrname: the name of the attr to load - c...
Implement the Python class `AttrLoader` described below. Class description: Attribute loader. Method signatures and docstrings: - def loadSingle(self, mriscan, attrname, csvfilename=None): Load the attribute object, with atlasobj. - mriscan: specify which scan to load from - attrname: the name of the attr to load - c...
dabfabdeb2f922a3dcbdaf3fc46f0c4b40598279
<|skeleton|> class AttrLoader: """Attribute loader.""" def loadSingle(self, mriscan, attrname, csvfilename=None): """Load the attribute object, with atlasobj. - mriscan: specify which scan to load from - attrname: the name of the attr to load - csvfilename: the name of the attr file name. Specify this ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AttrLoader: """Attribute loader.""" def loadSingle(self, mriscan, attrname, csvfilename=None): """Load the attribute object, with atlasobj. - mriscan: specify which scan to load from - attrname: the name of the attr to load - csvfilename: the name of the attr file name. Specify this parameter to ...
the_stack_v2_python_sparse
mmdps/proc/loader.py
geyunxiang/mmdps
train
5
393892e2d191c6ead87e8a0e12db2f86e24528d3
[ "if file is None:\n 'Set client to the default when running on local machine'\n self.file = 'batch1.json'", "with open(self.file, 'a') as f:\n json.dump(data, f, ensure_ascii=False)\n f.write('\\n')" ]
<|body_start_0|> if file is None: 'Set client to the default when running on local machine' self.file = 'batch1.json' <|end_body_0|> <|body_start_1|> with open(self.file, 'a') as f: json.dump(data, f, ensure_ascii=False) f.write('\n') <|end_body_1|>
FileWriter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileWriter: def __init__(self, file=None): """:param file: The path to the wile which this calss will write data.""" <|body_0|> def send_data(self, data): """Writes JSON data to the file. If the file does not exists it will be created.""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_36k_train_006994
571
no_license
[ { "docstring": ":param file: The path to the wile which this calss will write data.", "name": "__init__", "signature": "def __init__(self, file=None)" }, { "docstring": "Writes JSON data to the file. If the file does not exists it will be created.", "name": "send_data", "signature": "def...
2
stack_v2_sparse_classes_30k_train_014007
Implement the Python class `FileWriter` described below. Class description: Implement the FileWriter class. Method signatures and docstrings: - def __init__(self, file=None): :param file: The path to the wile which this calss will write data. - def send_data(self, data): Writes JSON data to the file. If the file does...
Implement the Python class `FileWriter` described below. Class description: Implement the FileWriter class. Method signatures and docstrings: - def __init__(self, file=None): :param file: The path to the wile which this calss will write data. - def send_data(self, data): Writes JSON data to the file. If the file does...
6530a53f1d901eb418b404f8d705105b08b1ae97
<|skeleton|> class FileWriter: def __init__(self, file=None): """:param file: The path to the wile which this calss will write data.""" <|body_0|> def send_data(self, data): """Writes JSON data to the file. If the file does not exists it will be created.""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FileWriter: def __init__(self, file=None): """:param file: The path to the wile which this calss will write data.""" if file is None: 'Set client to the default when running on local machine' self.file = 'batch1.json' def send_data(self, data): """Writes JS...
the_stack_v2_python_sparse
extraction/file_writer.py
anduinsay/StickComments
train
0
015e8fe8d59d16818589213af4378bed0b0347b7
[ "if context is None:\n context = {}\nform = self.read(cr, uid, ids, [])[0]\njournal_ids = form['journal_ids']\njournal_id = form['journal_id'] and form['journal_id'][0]\ncompany_id = form['company_id'] and form['company_id'][0]\ndata_pool = self.pool.get('ir.model.data')\nvoucher_ids = self.get_move(cr, uid, ids...
<|body_start_0|> if context is None: context = {} form = self.read(cr, uid, ids, [])[0] journal_ids = form['journal_ids'] journal_id = form['journal_id'] and form['journal_id'][0] company_id = form['company_id'] and form['company_id'][0] data_pool = self.pool....
account_cancel_check
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class account_cancel_check: def get_moves(self, cr, uid, ids, context=None): """Method that display all cancelled payment @return: dictionary action details""" <|body_0|> def get_move(self, cr, uid, ids=False, journal_ids=False, journal_id=False, company_id=False, account_id=False...
stack_v2_sparse_classes_36k_train_006995
5,744
no_license
[ { "docstring": "Method that display all cancelled payment @return: dictionary action details", "name": "get_moves", "signature": "def get_moves(self, cr, uid, ids, context=None)" }, { "docstring": "Method that cancel unreceived & unreconsiled payment vouchers which exceed it's grace period and c...
2
null
Implement the Python class `account_cancel_check` described below. Class description: Implement the account_cancel_check class. Method signatures and docstrings: - def get_moves(self, cr, uid, ids, context=None): Method that display all cancelled payment @return: dictionary action details - def get_move(self, cr, uid...
Implement the Python class `account_cancel_check` described below. Class description: Implement the account_cancel_check class. Method signatures and docstrings: - def get_moves(self, cr, uid, ids, context=None): Method that display all cancelled payment @return: dictionary action details - def get_move(self, cr, uid...
0b997095c260d58b026440967fea3a202bef7efb
<|skeleton|> class account_cancel_check: def get_moves(self, cr, uid, ids, context=None): """Method that display all cancelled payment @return: dictionary action details""" <|body_0|> def get_move(self, cr, uid, ids=False, journal_ids=False, journal_id=False, company_id=False, account_id=False...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class account_cancel_check: def get_moves(self, cr, uid, ids, context=None): """Method that display all cancelled payment @return: dictionary action details""" if context is None: context = {} form = self.read(cr, uid, ids, [])[0] journal_ids = form['journal_ids'] ...
the_stack_v2_python_sparse
v_7/Dongola/wafi/account_check_writing_wafi/wizard/account_check_cancel.py
musabahmed/baba
train
0
e27baa3b2d4f703dad99eaac484b1291d27e75bd
[ "completed_process = subprocess.run(command, shell=True, executable='/bin/bash', stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True, timeout=timeout)\nif completed_process.returncode != 0:\n raise Exception(completed_process.stderr)\nsys.stderr.write(completed_process.stderr)", "process = ...
<|body_start_0|> completed_process = subprocess.run(command, shell=True, executable='/bin/bash', stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True, timeout=timeout) if completed_process.returncode != 0: raise Exception(completed_process.stderr) sys.stderr.write(...
Subprocess
[ "LicenseRef-scancode-generic-cla", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Subprocess: def run(command: str, timeout: int=None) -> None: """Run one-time command with subprocess.run(). Args: command (str): command to be executed. timeout (int): timeout in seconds. Returns: str: return stdout of the command.""" <|body_0|> def interactive_run(command:...
stack_v2_sparse_classes_36k_train_006996
19,871
permissive
[ { "docstring": "Run one-time command with subprocess.run(). Args: command (str): command to be executed. timeout (int): timeout in seconds. Returns: str: return stdout of the command.", "name": "run", "signature": "def run(command: str, timeout: int=None) -> None" }, { "docstring": "Run one-time...
2
null
Implement the Python class `Subprocess` described below. Class description: Implement the Subprocess class. Method signatures and docstrings: - def run(command: str, timeout: int=None) -> None: Run one-time command with subprocess.run(). Args: command (str): command to be executed. timeout (int): timeout in seconds. ...
Implement the Python class `Subprocess` described below. Class description: Implement the Subprocess class. Method signatures and docstrings: - def run(command: str, timeout: int=None) -> None: Run one-time command with subprocess.run(). Args: command (str): command to be executed. timeout (int): timeout in seconds. ...
b3c6a589ad9036b03221e776a6929b2bc1eb4680
<|skeleton|> class Subprocess: def run(command: str, timeout: int=None) -> None: """Run one-time command with subprocess.run(). Args: command (str): command to be executed. timeout (int): timeout in seconds. Returns: str: return stdout of the command.""" <|body_0|> def interactive_run(command:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Subprocess: def run(command: str, timeout: int=None) -> None: """Run one-time command with subprocess.run(). Args: command (str): command to be executed. timeout (int): timeout in seconds. Returns: str: return stdout of the command.""" completed_process = subprocess.run(command, shell=True, ex...
the_stack_v2_python_sparse
maro/cli/grass/lib/scripts/node/join_cluster.py
microsoft/maro
train
764
9f2ad0541d077cdc022c8560ee1189941ff9936c
[ "super(ConvNet, self).__init__()\nif norm_layer is None:\n norm_layer = nn.BatchNorm1d\nself._norm_layer = norm_layer\nif act_layer is None:\n act_layer = nn.ReLU\nself._act_layer = act_layer\nself.conv1 = conv3x3(1, 16, stride=1)\nself.bn1 = norm_layer(16)\nself.stack1 = self._make_stack(block=block, num_lay...
<|body_start_0|> super(ConvNet, self).__init__() if norm_layer is None: norm_layer = nn.BatchNorm1d self._norm_layer = norm_layer if act_layer is None: act_layer = nn.ReLU self._act_layer = act_layer self.conv1 = conv3x3(1, 16, stride=1) se...
Basic CNN architecture
ConvNet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConvNet: """Basic CNN architecture""" def __init__(self, block, layers, latent_dim=512, norm_layer=None, act_layer=None): """Constructor Args: block: (nn.Module) building block; e.g., BasicBlock layers: (list of int) a list of integers specifying number of blocks per stack latent_dim...
stack_v2_sparse_classes_36k_train_006997
8,913
permissive
[ { "docstring": "Constructor Args: block: (nn.Module) building block; e.g., BasicBlock layers: (list of int) a list of integers specifying number of blocks per stack latent_dim: (int) dimension of latent space at network output; default = 512 norm_layer: (nn.Module) normalization layer; default = nn.BatchNorm2d ...
3
stack_v2_sparse_classes_30k_train_003622
Implement the Python class `ConvNet` described below. Class description: Basic CNN architecture Method signatures and docstrings: - def __init__(self, block, layers, latent_dim=512, norm_layer=None, act_layer=None): Constructor Args: block: (nn.Module) building block; e.g., BasicBlock layers: (list of int) a list of ...
Implement the Python class `ConvNet` described below. Class description: Basic CNN architecture Method signatures and docstrings: - def __init__(self, block, layers, latent_dim=512, norm_layer=None, act_layer=None): Constructor Args: block: (nn.Module) building block; e.g., BasicBlock layers: (list of int) a list of ...
3ad344901c3bb59e0bc16bb70202d2cfd538fd77
<|skeleton|> class ConvNet: """Basic CNN architecture""" def __init__(self, block, layers, latent_dim=512, norm_layer=None, act_layer=None): """Constructor Args: block: (nn.Module) building block; e.g., BasicBlock layers: (list of int) a list of integers specifying number of blocks per stack latent_dim...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConvNet: """Basic CNN architecture""" def __init__(self, block, layers, latent_dim=512, norm_layer=None, act_layer=None): """Constructor Args: block: (nn.Module) building block; e.g., BasicBlock layers: (list of int) a list of integers specifying number of blocks per stack latent_dim: (int) dimen...
the_stack_v2_python_sparse
baselines/common/networks/cnn.py
baihuaxie/drl-lib
train
0
a8c65985642d78ae4385c6e60a77420651827446
[ "input_json = request.data\noutput_json = dict(zip(['AvailabilityDetails', 'AuthenticationDetails', 'SessionDetails', 'Payload'], [input_json['AvailabilityDetails'], input_json['AuthenticationDetails'], input_json['SessionDetails'], None]))\njson_params = dict(zip(['profile_id'], [input_json['SessionDetails']['Payl...
<|body_start_0|> input_json = request.data output_json = dict(zip(['AvailabilityDetails', 'AuthenticationDetails', 'SessionDetails', 'Payload'], [input_json['AvailabilityDetails'], input_json['AuthenticationDetails'], input_json['SessionDetails'], None])) json_params = dict(zip(['profile_id'], [...
This covers the API for checking if the given user is a staff
CheckIfUserIsStaffAPI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CheckIfUserIsStaffAPI: """This covers the API for checking if the given user is a staff""" def post(self, request): """Post Function to fetching common questions based on ticket type.""" <|body_0|> def check_if_user_is_staff_json(self, request): """This function ...
stack_v2_sparse_classes_36k_train_006998
2,530
no_license
[ { "docstring": "Post Function to fetching common questions based on ticket type.", "name": "post", "signature": "def post(self, request)" }, { "docstring": "This function checks if the given user is a staff :param request: { 'profile_id': 1, } :return:", "name": "check_if_user_is_staff_json"...
2
null
Implement the Python class `CheckIfUserIsStaffAPI` described below. Class description: This covers the API for checking if the given user is a staff Method signatures and docstrings: - def post(self, request): Post Function to fetching common questions based on ticket type. - def check_if_user_is_staff_json(self, req...
Implement the Python class `CheckIfUserIsStaffAPI` described below. Class description: This covers the API for checking if the given user is a staff Method signatures and docstrings: - def post(self, request): Post Function to fetching common questions based on ticket type. - def check_if_user_is_staff_json(self, req...
36eb9931f330e64902354c6fc471be2adf4b7049
<|skeleton|> class CheckIfUserIsStaffAPI: """This covers the API for checking if the given user is a staff""" def post(self, request): """Post Function to fetching common questions based on ticket type.""" <|body_0|> def check_if_user_is_staff_json(self, request): """This function ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CheckIfUserIsStaffAPI: """This covers the API for checking if the given user is a staff""" def post(self, request): """Post Function to fetching common questions based on ticket type.""" input_json = request.data output_json = dict(zip(['AvailabilityDetails', 'AuthenticationDetail...
the_stack_v2_python_sparse
Generic/common/staffmanagement/staffregister/api/check_if_user_is_staff/views_check_if_user_is_staff.py
archiemb303/common_backend_django
train
0
3223b6213e3c4b993236badffbb571ffe02689c6
[ "if not l1:\n return l2\nif not l2:\n return l1\nif l1.val < l2.val:\n l1.next = self.mergeTwoLists(l1.next, l2)\n return l1\nelse:\n l2.next = self.mergeTwoLists(l1, l2.next)\n return l2", "dummy = ListNode(None)\nprev = dummy\nwhile l1 and l2:\n if l1.val < l2.val:\n prev.next = l1\n...
<|body_start_0|> if not l1: return l2 if not l2: return l1 if l1.val < l2.val: l1.next = self.mergeTwoLists(l1.next, l2) return l1 else: l2.next = self.mergeTwoLists(l1, l2.next) return l2 <|end_body_0|> <|body_star...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mergeTwoLists_1(self, l1: ListNode, l2: ListNode) -> ListNode: """1. 递归:""" <|body_0|> def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: """2. 迭代 KEY:定义一个辅助的前置节点指针""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not l...
stack_v2_sparse_classes_36k_train_006999
1,949
no_license
[ { "docstring": "1. 递归:", "name": "mergeTwoLists_1", "signature": "def mergeTwoLists_1(self, l1: ListNode, l2: ListNode) -> ListNode" }, { "docstring": "2. 迭代 KEY:定义一个辅助的前置节点指针", "name": "mergeTwoLists", "signature": "def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists_1(self, l1: ListNode, l2: ListNode) -> ListNode: 1. 递归: - def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: 2. 迭代 KEY:定义一个辅助的前置节点指针
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists_1(self, l1: ListNode, l2: ListNode) -> ListNode: 1. 递归: - def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: 2. 迭代 KEY:定义一个辅助的前置节点指针 <|skeleton|>...
4732fb80710a08a715c3e7080c394f5298b8326d
<|skeleton|> class Solution: def mergeTwoLists_1(self, l1: ListNode, l2: ListNode) -> ListNode: """1. 递归:""" <|body_0|> def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: """2. 迭代 KEY:定义一个辅助的前置节点指针""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def mergeTwoLists_1(self, l1: ListNode, l2: ListNode) -> ListNode: """1. 递归:""" if not l1: return l2 if not l2: return l1 if l1.val < l2.val: l1.next = self.mergeTwoLists(l1.next, l2) return l1 else: ...
the_stack_v2_python_sparse
02-linkedlist/21.合并两个有序链表.py
xiaoruijiang/algorithm
train
0