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
7471a3b55ad48d7e5133a7db047e51fbf7d6a11e
[ "super().__init__(self.PARAMS, parameters)\nself.queries = parameters['queries']\nself.query_names = parameters['query_names']\nself.remove_types = parameters['remove_types']\nself.expression_parsers, self.query_names = get_expression_parsers(self.queries, query_names=parameters['query_names'])", "if sidecar and ...
<|body_start_0|> super().__init__(self.PARAMS, parameters) self.queries = parameters['queries'] self.query_names = parameters['query_names'] self.remove_types = parameters['remove_types'] self.expression_parsers, self.query_names = get_expression_parsers(self.queries, query_names...
Create tabular file factors from tag queries. Required remodeling parameters: - **queries** (*list*): Queries to be applied successively as filters. - **query_names** (*list*): Column names for the query factors. - **remove_types** (*list*): Structural HED tags to be removed. - **expand_context** (*bool*): Expand the c...
FactorHedTagsOp
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FactorHedTagsOp: """Create tabular file factors from tag queries. Required remodeling parameters: - **queries** (*list*): Queries to be applied successively as filters. - **query_names** (*list*): Column names for the query factors. - **remove_types** (*list*): Structural HED tags to be removed. ...
stack_v2_sparse_classes_36k_train_007500
4,145
permissive
[ { "docstring": "Constructor for the factor HED tags operation. Parameters: parameters (dict): Actual values of the parameters for the operation. :raises KeyError: - If a required parameter is missing. - If an unexpected parameter is provided. :raises TypeError: - If a parameter has the wrong type. :raises Value...
2
stack_v2_sparse_classes_30k_train_010479
Implement the Python class `FactorHedTagsOp` described below. Class description: Create tabular file factors from tag queries. Required remodeling parameters: - **queries** (*list*): Queries to be applied successively as filters. - **query_names** (*list*): Column names for the query factors. - **remove_types** (*list...
Implement the Python class `FactorHedTagsOp` described below. Class description: Create tabular file factors from tag queries. Required remodeling parameters: - **queries** (*list*): Queries to be applied successively as filters. - **query_names** (*list*): Column names for the query factors. - **remove_types** (*list...
b871cae44bdf0ee68c688562c3b0af50b93343f5
<|skeleton|> class FactorHedTagsOp: """Create tabular file factors from tag queries. Required remodeling parameters: - **queries** (*list*): Queries to be applied successively as filters. - **query_names** (*list*): Column names for the query factors. - **remove_types** (*list*): Structural HED tags to be removed. ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FactorHedTagsOp: """Create tabular file factors from tag queries. Required remodeling parameters: - **queries** (*list*): Queries to be applied successively as filters. - **query_names** (*list*): Column names for the query factors. - **remove_types** (*list*): Structural HED tags to be removed. - **expand_co...
the_stack_v2_python_sparse
hed/tools/remodeling/operations/factor_hed_tags_op.py
hed-standard/hed-python
train
5
39718b9f6590ac925cf2205047a8cf86fa0d7b2d
[ "out = []\nqueue = deque([root])\nwhile queue:\n node = queue.popleft()\n out.append(str(node.val) if node else '#')\n if node:\n queue.append(node.left)\n queue.append(node.right)\nreturn ' '.join(out).rstrip(' #')", "if not data:\n return None\nout = data.split(' ')\nnodes_with_no = [T...
<|body_start_0|> out = [] queue = deque([root]) while queue: node = queue.popleft() out.append(str(node.val) if node else '#') if node: queue.append(node.left) queue.append(node.right) return ' '.join(out).rstrip(' #') <...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_007501
1,524
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_008990
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
63b7eedc720c1ce14880b80744dcd5ef7107065c
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" out = [] queue = deque([root]) while queue: node = queue.popleft() out.append(str(node.val) if node else '#') if node: ...
the_stack_v2_python_sparse
problems/serializeDeserializeTree.py
joddiy/leetcode
train
1
d2c9492d672a2eb3918aa2eb06efd0a26cf29d40
[ "for i in range(len(list1) - 1):\n for j in range(len(list1) - 1 - i):\n if list1[j] > list1[j + 1]:\n list1[j], list1[j + 1] = (list1[j + 1], list1[j])\nreturn list1", "for i in range(1, len(list1)):\n current = list1[i]\n pre_index = i - 1\n while pre_index >= 0 and list1[pre_index...
<|body_start_0|> for i in range(len(list1) - 1): for j in range(len(list1) - 1 - i): if list1[j] > list1[j + 1]: list1[j], list1[j + 1] = (list1[j + 1], list1[j]) return list1 <|end_body_0|> <|body_start_1|> for i in range(1, len(list1)): ...
各种排序方法
Sort
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Sort: """各种排序方法""" def bubble_sort(list1): """冒泡排序""" <|body_0|> def insertion_sort(list1): """插入排序""" <|body_1|> def quick_sort(arr): """快速排序""" <|body_2|> <|end_skeleton|> <|body_start_0|> for i in range(len(list1) - 1): ...
stack_v2_sparse_classes_36k_train_007502
1,922
no_license
[ { "docstring": "冒泡排序", "name": "bubble_sort", "signature": "def bubble_sort(list1)" }, { "docstring": "插入排序", "name": "insertion_sort", "signature": "def insertion_sort(list1)" }, { "docstring": "快速排序", "name": "quick_sort", "signature": "def quick_sort(arr)" } ]
3
stack_v2_sparse_classes_30k_train_005010
Implement the Python class `Sort` described below. Class description: 各种排序方法 Method signatures and docstrings: - def bubble_sort(list1): 冒泡排序 - def insertion_sort(list1): 插入排序 - def quick_sort(arr): 快速排序
Implement the Python class `Sort` described below. Class description: 各种排序方法 Method signatures and docstrings: - def bubble_sort(list1): 冒泡排序 - def insertion_sort(list1): 插入排序 - def quick_sort(arr): 快速排序 <|skeleton|> class Sort: """各种排序方法""" def bubble_sort(list1): """冒泡排序""" <|body_0|> ...
5f843531d413202f4f4e48ed0c3d510db21f4396
<|skeleton|> class Sort: """各种排序方法""" def bubble_sort(list1): """冒泡排序""" <|body_0|> def insertion_sort(list1): """插入排序""" <|body_1|> def quick_sort(arr): """快速排序""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Sort: """各种排序方法""" def bubble_sort(list1): """冒泡排序""" for i in range(len(list1) - 1): for j in range(len(list1) - 1 - i): if list1[j] > list1[j + 1]: list1[j], list1[j + 1] = (list1[j + 1], list1[j]) return list1 def insertion_s...
the_stack_v2_python_sparse
pycharm/yz/common/Sort.py
yz9527-1/1YZ
train
0
d204ec37394ca3d9c23e39ec01cb9c303a9927e1
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn Admin()", "from .edge import Edge\nfrom .service_announcement import ServiceAnnouncement\nfrom .sharepoint import Sharepoint\nfrom .edge import Edge\nfrom .service_announcement import ServiceAnnouncement\nfrom .sharepoint import Sharep...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return Admin() <|end_body_0|> <|body_start_1|> from .edge import Edge from .service_announcement import ServiceAnnouncement from .sharepoint import Sharepoint from .edge import ...
Admin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Admin: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Admin: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Admin""" ...
stack_v2_sparse_classes_36k_train_007503
3,415
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Admin", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value(parse_n...
3
stack_v2_sparse_classes_30k_train_018430
Implement the Python class `Admin` described below. Class description: Implement the Admin class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Admin: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The p...
Implement the Python class `Admin` described below. Class description: Implement the Admin class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Admin: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The p...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class Admin: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Admin: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Admin""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Admin: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Admin: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Admin""" if not pars...
the_stack_v2_python_sparse
msgraph/generated/models/admin.py
microsoftgraph/msgraph-sdk-python
train
135
8010f00620e7b8ae7b77539b05069e113e3fc079
[ "modules = ('lxml', 'lxml.html', 'lxml.html.builder', 'datetime', 'dateutil.relativedelta', 'pytz', 'invenio.bibsched_tasklets.bst_fermilab_research_glance')\nmodule_import_err = []\nfor module in modules:\n try:\n __import__(module)\n except ImportError:\n module_import_err.append('failed to im...
<|body_start_0|> modules = ('lxml', 'lxml.html', 'lxml.html.builder', 'datetime', 'dateutil.relativedelta', 'pytz', 'invenio.bibsched_tasklets.bst_fermilab_research_glance') module_import_err = [] for module in modules: try: __import__(module) except Impor...
Set of unit tests for fermilab_research_glance.py.
ResearchGlanceTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResearchGlanceTests: """Set of unit tests for fermilab_research_glance.py.""" def test_dependencies(self): """verify that required modules can be imported""" <|body_0|> def test_output_directory_exists(self): """verify that the destination directory for the repor...
stack_v2_sparse_classes_36k_train_007504
4,673
no_license
[ { "docstring": "verify that required modules can be imported", "name": "test_dependencies", "signature": "def test_dependencies(self)" }, { "docstring": "verify that the destination directory for the report exists", "name": "test_output_directory_exists", "signature": "def test_output_di...
3
null
Implement the Python class `ResearchGlanceTests` described below. Class description: Set of unit tests for fermilab_research_glance.py. Method signatures and docstrings: - def test_dependencies(self): verify that required modules can be imported - def test_output_directory_exists(self): verify that the destination di...
Implement the Python class `ResearchGlanceTests` described below. Class description: Set of unit tests for fermilab_research_glance.py. Method signatures and docstrings: - def test_dependencies(self): verify that required modules can be imported - def test_output_directory_exists(self): verify that the destination di...
37c905be9a569a6c25ced045eb84545ddb7ac3a5
<|skeleton|> class ResearchGlanceTests: """Set of unit tests for fermilab_research_glance.py.""" def test_dependencies(self): """verify that required modules can be imported""" <|body_0|> def test_output_directory_exists(self): """verify that the destination directory for the repor...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResearchGlanceTests: """Set of unit tests for fermilab_research_glance.py.""" def test_dependencies(self): """verify that required modules can be imported""" modules = ('lxml', 'lxml.html', 'lxml.html.builder', 'datetime', 'dateutil.relativedelta', 'pytz', 'invenio.bibsched_tasklets.bst_f...
the_stack_v2_python_sparse
bibtasklets/bst_fermilab_research_glance_unit_test.py
inspirehep/inspire
train
9
c5cf172bfa629e34727c98ea9a2fb7530988ebf7
[ "self.mean = mean\nself.std = std\nself.is_scale = is_scale\nself.is_channel_first = is_channel_first", "im = im.astype(np.float32, copy=False)\nif self.is_channel_first:\n mean = np.array(self.mean)[:, np.newaxis, np.newaxis]\n std = np.array(self.std)[:, np.newaxis, np.newaxis]\nelse:\n mean = np.array...
<|body_start_0|> self.mean = mean self.std = std self.is_scale = is_scale self.is_channel_first = is_channel_first <|end_body_0|> <|body_start_1|> im = im.astype(np.float32, copy=False) if self.is_channel_first: mean = np.array(self.mean)[:, np.newaxis, np.ne...
NormalizeImage
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NormalizeImage: def __init__(self, mean=[0.485, 0.456, 0.406], std=[1, 1, 1], is_scale=True, is_channel_first=True): """Args: mean (list): the pixel mean std (list): the pixel variance""" <|body_0|> def __call__(self, im): """Normalize the image. Operators: 1.(option...
stack_v2_sparse_classes_36k_train_007505
7,004
permissive
[ { "docstring": "Args: mean (list): the pixel mean std (list): the pixel variance", "name": "__init__", "signature": "def __init__(self, mean=[0.485, 0.456, 0.406], std=[1, 1, 1], is_scale=True, is_channel_first=True)" }, { "docstring": "Normalize the image. Operators: 1.(optional) Scale the imag...
2
stack_v2_sparse_classes_30k_train_017821
Implement the Python class `NormalizeImage` described below. Class description: Implement the NormalizeImage class. Method signatures and docstrings: - def __init__(self, mean=[0.485, 0.456, 0.406], std=[1, 1, 1], is_scale=True, is_channel_first=True): Args: mean (list): the pixel mean std (list): the pixel variance ...
Implement the Python class `NormalizeImage` described below. Class description: Implement the NormalizeImage class. Method signatures and docstrings: - def __init__(self, mean=[0.485, 0.456, 0.406], std=[1, 1, 1], is_scale=True, is_channel_first=True): Args: mean (list): the pixel mean std (list): the pixel variance ...
b402610a6f0b382a978e82473b541ea1fc6cf09a
<|skeleton|> class NormalizeImage: def __init__(self, mean=[0.485, 0.456, 0.406], std=[1, 1, 1], is_scale=True, is_channel_first=True): """Args: mean (list): the pixel mean std (list): the pixel variance""" <|body_0|> def __call__(self, im): """Normalize the image. Operators: 1.(option...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NormalizeImage: def __init__(self, mean=[0.485, 0.456, 0.406], std=[1, 1, 1], is_scale=True, is_channel_first=True): """Args: mean (list): the pixel mean std (list): the pixel variance""" self.mean = mean self.std = std self.is_scale = is_scale self.is_channel_first = i...
the_stack_v2_python_sparse
modules/image/object_detection/ssd_vgg16_512_coco2017/data_feed.py
PaddlePaddle/PaddleHub
train
12,914
a60ebebdb228325d569ab896d9bc7bca4f0d8500
[ "longest = ''\ndp_matrix = [[True for _ in range(len(s))] for start in range(len(s))]\nfor end in range(0, len(s)):\n for start in range(0, end + 1):\n if start == end:\n if len(longest) == 0:\n longest = s[start]\n elif s[start] == s[end] and start + 1 <= end and dp_matri...
<|body_start_0|> longest = '' dp_matrix = [[True for _ in range(len(s))] for start in range(len(s))] for end in range(0, len(s)): for start in range(0, end + 1): if start == end: if len(longest) == 0: longest = s[start] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestPalindrome(self, s: str) -> str: """naive dp; 8728ms 5%; 22.2MB, 5.23%; 遍历了所有可能的结果""" <|body_0|> def longestPalindrome2(self, s: str) -> str: """作者:skay2002 来源:力扣(LeetCode)""" <|body_1|> <|end_skeleton|> <|body_start_0|> longest...
stack_v2_sparse_classes_36k_train_007506
1,909
no_license
[ { "docstring": "naive dp; 8728ms 5%; 22.2MB, 5.23%; 遍历了所有可能的结果", "name": "longestPalindrome", "signature": "def longestPalindrome(self, s: str) -> str" }, { "docstring": "作者:skay2002 来源:力扣(LeetCode)", "name": "longestPalindrome2", "signature": "def longestPalindrome2(self, s: str) -> str...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s: str) -> str: naive dp; 8728ms 5%; 22.2MB, 5.23%; 遍历了所有可能的结果 - def longestPalindrome2(self, s: str) -> str: 作者:skay2002 来源:力扣(LeetCode)
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s: str) -> str: naive dp; 8728ms 5%; 22.2MB, 5.23%; 遍历了所有可能的结果 - def longestPalindrome2(self, s: str) -> str: 作者:skay2002 来源:力扣(LeetCode) <|skeleton|...
b6712c793bbfe443953e7186b5dbd876c01cd9a0
<|skeleton|> class Solution: def longestPalindrome(self, s: str) -> str: """naive dp; 8728ms 5%; 22.2MB, 5.23%; 遍历了所有可能的结果""" <|body_0|> def longestPalindrome2(self, s: str) -> str: """作者:skay2002 来源:力扣(LeetCode)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestPalindrome(self, s: str) -> str: """naive dp; 8728ms 5%; 22.2MB, 5.23%; 遍历了所有可能的结果""" longest = '' dp_matrix = [[True for _ in range(len(s))] for start in range(len(s))] for end in range(0, len(s)): for start in range(0, end + 1): ...
the_stack_v2_python_sparse
05_leetcode/5.最长回文子串.py
niceNASA/Python-Foundation-Suda
train
0
42bdc6d18d3394296c471f8f39f4cd62f052516a
[ "super(MultiHeadDenseLayer, self).__init__()\nself._output_units = output_units\nself._num_heads = num_heads\nself._use_bias = use_bias\nself._is_output_transform = is_output_transform\nself._activation = activation\nself._activation_fn = get_activation(activation)\nself._flatten_output_units = tf.nest.flatten(self...
<|body_start_0|> super(MultiHeadDenseLayer, self).__init__() self._output_units = output_units self._num_heads = num_heads self._use_bias = use_bias self._is_output_transform = is_output_transform self._activation = activation self._activation_fn = get_activation(...
Auto splitting or combining heads for the linear transformation.
MultiHeadDenseLayer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiHeadDenseLayer: """Auto splitting or combining heads for the linear transformation.""" def __init__(self, input_size, output_units, num_heads, activation=None, use_bias=True, is_output_transform=False): """Initializes MultiHeadDenseLayer. Args: input_size: The input dimension. o...
stack_v2_sparse_classes_36k_train_007507
15,012
permissive
[ { "docstring": "Initializes MultiHeadDenseLayer. Args: input_size: The input dimension. output_units: A int scalar or int list, indicating the transformed output units. It must be a int scalar when `is_output_transform` is True. num_heads: The head num. activation: A string or a callable function for activation...
4
null
Implement the Python class `MultiHeadDenseLayer` described below. Class description: Auto splitting or combining heads for the linear transformation. Method signatures and docstrings: - def __init__(self, input_size, output_units, num_heads, activation=None, use_bias=True, is_output_transform=False): Initializes Mult...
Implement the Python class `MultiHeadDenseLayer` described below. Class description: Auto splitting or combining heads for the linear transformation. Method signatures and docstrings: - def __init__(self, input_size, output_units, num_heads, activation=None, use_bias=True, is_output_transform=False): Initializes Mult...
06613a99305f02312a0e64ee3c3c50e7b00dcf0e
<|skeleton|> class MultiHeadDenseLayer: """Auto splitting or combining heads for the linear transformation.""" def __init__(self, input_size, output_units, num_heads, activation=None, use_bias=True, is_output_transform=False): """Initializes MultiHeadDenseLayer. Args: input_size: The input dimension. o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiHeadDenseLayer: """Auto splitting or combining heads for the linear transformation.""" def __init__(self, input_size, output_units, num_heads, activation=None, use_bias=True, is_output_transform=False): """Initializes MultiHeadDenseLayer. Args: input_size: The input dimension. output_units: ...
the_stack_v2_python_sparse
neurst/neurst_pt/layers/common_layers.py
ohlionel/Prune-Tune
train
12
b42a9579e2e2f4b0c1857bfe3354a2d234819ecf
[ "self.search_list = {}\nif content is None:\n self.content = ''\n self.content_list\nelse:\n self.content = content\n self.content_list = [word.strip('\"\\',?!./\\\\') for word in content.split()]", "if word not in self.search_list:\n self.search_list[word] = self.content_list.count(word)\nreturn s...
<|body_start_0|> self.search_list = {} if content is None: self.content = '' self.content_list else: self.content = content self.content_list = [word.strip('"\',?!./\\') for word in content.split()] <|end_body_0|> <|body_start_1|> if word ...
Book
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Book: def __init__(self, content): """both the content as string and content_list as list, which is a list of all words, are stored""" <|body_0|> def find_frequency(self, word): """>>> book = Book("The most mysterious season of Game of Thrones yet is also the best — ...
stack_v2_sparse_classes_36k_train_007508
1,247
no_license
[ { "docstring": "both the content as string and content_list as list, which is a list of all words, are stored", "name": "__init__", "signature": "def __init__(self, content)" }, { "docstring": ">>> book = Book(\"The most mysterious season of Game of Thrones yet is also the best — that’s accordin...
2
stack_v2_sparse_classes_30k_train_016006
Implement the Python class `Book` described below. Class description: Implement the Book class. Method signatures and docstrings: - def __init__(self, content): both the content as string and content_list as list, which is a list of all words, are stored - def find_frequency(self, word): >>> book = Book("The most mys...
Implement the Python class `Book` described below. Class description: Implement the Book class. Method signatures and docstrings: - def __init__(self, content): both the content as string and content_list as list, which is a list of all words, are stored - def find_frequency(self, word): >>> book = Book("The most mys...
d28ea71a1a5aaa97b23e23bb04c84aaa5f590a78
<|skeleton|> class Book: def __init__(self, content): """both the content as string and content_list as list, which is a list of all words, are stored""" <|body_0|> def find_frequency(self, word): """>>> book = Book("The most mysterious season of Game of Thrones yet is also the best — ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Book: def __init__(self, content): """both the content as string and content_list as list, which is a list of all words, are stored""" self.search_list = {} if content is None: self.content = '' self.content_list else: self.content = content ...
the_stack_v2_python_sparse
chapter16-moderate/16.2.py
yuanxu-li/careercup
train
0
d9764da633d7d0165f274e36e493ce62af080c72
[ "super().__init__()\nself.embed_dim, self.n_heads, self.head_dim = (embed_dim, n_heads, head_dim)\nself.qk_layer_norms = qk_layer_norms\nself.context_layer_norm = nn.LayerNorm(self.embed_dim)\nself.latents_layer_norm = nn.LayerNorm(self.embed_dim)\nif self.qk_layer_norms:\n self.q_layer_norm = nn.LayerNorm(self....
<|body_start_0|> super().__init__() self.embed_dim, self.n_heads, self.head_dim = (embed_dim, n_heads, head_dim) self.qk_layer_norms = qk_layer_norms self.context_layer_norm = nn.LayerNorm(self.embed_dim) self.latents_layer_norm = nn.LayerNorm(self.embed_dim) if self.qk_l...
IdeficsPerceiverAttention
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IdeficsPerceiverAttention: def __init__(self, embed_dim: int, n_heads: int, head_dim: int, qk_layer_norms: bool) -> None: """Perceiver Cross-Attention Module --> let long-form inputs be `context`, resampled embeddings be `latents`""" <|body_0|> def forward(self, context: tor...
stack_v2_sparse_classes_36k_train_007509
9,432
permissive
[ { "docstring": "Perceiver Cross-Attention Module --> let long-form inputs be `context`, resampled embeddings be `latents`", "name": "__init__", "signature": "def __init__(self, embed_dim: int, n_heads: int, head_dim: int, qk_layer_norms: bool) -> None" }, { "docstring": "Runs Perceiver Self-Atte...
2
stack_v2_sparse_classes_30k_train_015690
Implement the Python class `IdeficsPerceiverAttention` described below. Class description: Implement the IdeficsPerceiverAttention class. Method signatures and docstrings: - def __init__(self, embed_dim: int, n_heads: int, head_dim: int, qk_layer_norms: bool) -> None: Perceiver Cross-Attention Module --> let long-for...
Implement the Python class `IdeficsPerceiverAttention` described below. Class description: Implement the IdeficsPerceiverAttention class. Method signatures and docstrings: - def __init__(self, embed_dim: int, n_heads: int, head_dim: int, qk_layer_norms: bool) -> None: Perceiver Cross-Attention Module --> let long-for...
4fa0aff21ee083d0197a898cdf17ff476fae2ac3
<|skeleton|> class IdeficsPerceiverAttention: def __init__(self, embed_dim: int, n_heads: int, head_dim: int, qk_layer_norms: bool) -> None: """Perceiver Cross-Attention Module --> let long-form inputs be `context`, resampled embeddings be `latents`""" <|body_0|> def forward(self, context: tor...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IdeficsPerceiverAttention: def __init__(self, embed_dim: int, n_heads: int, head_dim: int, qk_layer_norms: bool) -> None: """Perceiver Cross-Attention Module --> let long-form inputs be `context`, resampled embeddings be `latents`""" super().__init__() self.embed_dim, self.n_heads, sel...
the_stack_v2_python_sparse
src/transformers/models/idefics/perceiver.py
huggingface/transformers
train
102,193
3c44016df7badbd9f28932a29b14369687079c32
[ "super(DCGAN_D, self).__init__()\nself.ngpu = ngpu\nself.use_sigmoid = use_sigmoid\nassert isize % 16 == 0, 'isize has to be a multiple of 16'\nmain = nn.Sequential()\nmain.add_module('initial_conv_{0}-{1}'.format(nc, ndf), nn.Conv2d(nc, ndf, 4, 2, 1, bias=False))\nmain.add_module('initial_relu_{0}'.format(ndf), nn...
<|body_start_0|> super(DCGAN_D, self).__init__() self.ngpu = ngpu self.use_sigmoid = use_sigmoid assert isize % 16 == 0, 'isize has to be a multiple of 16' main = nn.Sequential() main.add_module('initial_conv_{0}-{1}'.format(nc, ndf), nn.Conv2d(nc, ndf, 4, 2, 1, bias=Fals...
DCGAN Discriminator.
DCGAN_D
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DCGAN_D: """DCGAN Discriminator.""" def __init__(self, isize, nz, nc, ndf, ngpu, n_extra_layers=0, use_sigmoid=True, norm=nn.BatchNorm2d): """Constructor.""" <|body_0|> def forward(self, input): """Forward method.""" <|body_1|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_36k_train_007510
34,675
permissive
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self, isize, nz, nc, ndf, ngpu, n_extra_layers=0, use_sigmoid=True, norm=nn.BatchNorm2d)" }, { "docstring": "Forward method.", "name": "forward", "signature": "def forward(self, input)" } ]
2
stack_v2_sparse_classes_30k_train_012550
Implement the Python class `DCGAN_D` described below. Class description: DCGAN Discriminator. Method signatures and docstrings: - def __init__(self, isize, nz, nc, ndf, ngpu, n_extra_layers=0, use_sigmoid=True, norm=nn.BatchNorm2d): Constructor. - def forward(self, input): Forward method.
Implement the Python class `DCGAN_D` described below. Class description: DCGAN Discriminator. Method signatures and docstrings: - def __init__(self, isize, nz, nc, ndf, ngpu, n_extra_layers=0, use_sigmoid=True, norm=nn.BatchNorm2d): Constructor. - def forward(self, input): Forward method. <|skeleton|> class DCGAN_D:...
e1e4a8d9a2ab51c2108a4d167bc37fab101f0c2c
<|skeleton|> class DCGAN_D: """DCGAN Discriminator.""" def __init__(self, isize, nz, nc, ndf, ngpu, n_extra_layers=0, use_sigmoid=True, norm=nn.BatchNorm2d): """Constructor.""" <|body_0|> def forward(self, input): """Forward method.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DCGAN_D: """DCGAN Discriminator.""" def __init__(self, isize, nz, nc, ndf, ngpu, n_extra_layers=0, use_sigmoid=True, norm=nn.BatchNorm2d): """Constructor.""" super(DCGAN_D, self).__init__() self.ngpu = ngpu self.use_sigmoid = use_sigmoid assert isize % 16 == 0, 'is...
the_stack_v2_python_sparse
diffrend/torch/GAN/twin_networks.py
sainatarajan/pix2shape
train
0
1b4edbb96471d645944e4714ca19c7f2606b9a22
[ "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!')" ]
<|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...
Asset service definition.
AssetServiceServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AssetServiceServicer: """Asset service definition.""" def ExportAssets(self, request, context): """Exports assets with time and resource types to a given Cloud Storage location. The output format is newline-delimited JSON. This API implements the [google.longrunning.Operation][google...
stack_v2_sparse_classes_36k_train_007511
3,532
permissive
[ { "docstring": "Exports assets with time and resource types to a given Cloud Storage location. The output format is newline-delimited JSON. This API implements the [google.longrunning.Operation][google.longrunning.Operation] API allowing you to keep track of the export.", "name": "ExportAssets", "signat...
2
stack_v2_sparse_classes_30k_train_007305
Implement the Python class `AssetServiceServicer` described below. Class description: Asset service definition. Method signatures and docstrings: - def ExportAssets(self, request, context): Exports assets with time and resource types to a given Cloud Storage location. The output format is newline-delimited JSON. This...
Implement the Python class `AssetServiceServicer` described below. Class description: Asset service definition. Method signatures and docstrings: - def ExportAssets(self, request, context): Exports assets with time and resource types to a given Cloud Storage location. The output format is newline-delimited JSON. This...
d897d56bce03d1fda98b79afb08264e51d46c421
<|skeleton|> class AssetServiceServicer: """Asset service definition.""" def ExportAssets(self, request, context): """Exports assets with time and resource types to a given Cloud Storage location. The output format is newline-delimited JSON. This API implements the [google.longrunning.Operation][google...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AssetServiceServicer: """Asset service definition.""" def ExportAssets(self, request, context): """Exports assets with time and resource types to a given Cloud Storage location. The output format is newline-delimited JSON. This API implements the [google.longrunning.Operation][google.longrunning....
the_stack_v2_python_sparse
asset/google/cloud/asset_v1beta1/proto/asset_service_pb2_grpc.py
tswast/google-cloud-python
train
1
d99b5a3f0a61ae0e02d655921277d762d6d9fc53
[ "limit = request.args.get('limit', 10, int)\npage = request.args.get('page', 1, int)\ninfo = request.args.get('info', '', str)\nskip = limit * (page - 1)\nweekpasswd_db = db_name_conf()['weekpasswd_db']\ntotal = mongo_cli[weekpasswd_db].find({'task_name': re.compile(info)}).count()\ndict_resp = mongo_cli[weekpasswd...
<|body_start_0|> limit = request.args.get('limit', 10, int) page = request.args.get('page', 1, int) info = request.args.get('info', '', str) skip = limit * (page - 1) weekpasswd_db = db_name_conf()['weekpasswd_db'] total = mongo_cli[weekpasswd_db].find({'task_name': re.co...
AuthTesterDetectView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuthTesterDetectView: def get(self): """检出目标列表 --- tags: - 弱口令检测(auth_tester) definitions: - schema: id: dao.auth_tester_weekpasswd_info properties: _id: type: string description: _id date: type: string description: 扫描日期 username: type: string description: 账户 password: type: string descr...
stack_v2_sparse_classes_36k_train_007512
20,908
no_license
[ { "docstring": "检出目标列表 --- tags: - 弱口令检测(auth_tester) definitions: - schema: id: dao.auth_tester_weekpasswd_info properties: _id: type: string description: _id date: type: string description: 扫描日期 username: type: string description: 账户 password: type: string description: 密码 service: type: string description: 服务...
2
stack_v2_sparse_classes_30k_train_014719
Implement the Python class `AuthTesterDetectView` described below. Class description: Implement the AuthTesterDetectView class. Method signatures and docstrings: - def get(self): 检出目标列表 --- tags: - 弱口令检测(auth_tester) definitions: - schema: id: dao.auth_tester_weekpasswd_info properties: _id: type: string description:...
Implement the Python class `AuthTesterDetectView` described below. Class description: Implement the AuthTesterDetectView class. Method signatures and docstrings: - def get(self): 检出目标列表 --- tags: - 弱口令检测(auth_tester) definitions: - schema: id: dao.auth_tester_weekpasswd_info properties: _id: type: string description:...
aa75f06ad25b1238176165a0dcf4685c59cd8284
<|skeleton|> class AuthTesterDetectView: def get(self): """检出目标列表 --- tags: - 弱口令检测(auth_tester) definitions: - schema: id: dao.auth_tester_weekpasswd_info properties: _id: type: string description: _id date: type: string description: 扫描日期 username: type: string description: 账户 password: type: string descr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AuthTesterDetectView: def get(self): """检出目标列表 --- tags: - 弱口令检测(auth_tester) definitions: - schema: id: dao.auth_tester_weekpasswd_info properties: _id: type: string description: _id date: type: string description: 扫描日期 username: type: string description: 账户 password: type: string description: 密码 ser...
the_stack_v2_python_sparse
aquaman/views/auth_tester.py
jstang9527/aquaman
train
15
07b50952865e5d5814311b953089b1ad29ea9ea0
[ "with Database() as db:\n if id_lane is None and is_active is None:\n data = db.query(Table).all()\n elif id_lane is None:\n data = db.query(Table).filter(Table.is_active == is_active).all()\n else:\n data = db.query(Table).get(id_lane)\nreturn {'data': data}", "if self.has_permissio...
<|body_start_0|> with Database() as db: if id_lane is None and is_active is None: data = db.query(Table).all() elif id_lane is None: data = db.query(Table).filter(Table.is_active == is_active).all() else: data = db.query(Table)....
Lane
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Lane: def get(self, id_lane=None, is_active=None): """Return all lane information :param id_lane: UUID :param is_active: Boolean""" <|body_0|> def create(self, body): """Create a new lane :param body: { name: JSON, id_city: UUID }""" <|body_1|> def modif...
stack_v2_sparse_classes_36k_train_007513
2,668
no_license
[ { "docstring": "Return all lane information :param id_lane: UUID :param is_active: Boolean", "name": "get", "signature": "def get(self, id_lane=None, is_active=None)" }, { "docstring": "Create a new lane :param body: { name: JSON, id_city: UUID }", "name": "create", "signature": "def cre...
4
stack_v2_sparse_classes_30k_train_001260
Implement the Python class `Lane` described below. Class description: Implement the Lane class. Method signatures and docstrings: - def get(self, id_lane=None, is_active=None): Return all lane information :param id_lane: UUID :param is_active: Boolean - def create(self, body): Create a new lane :param body: { name: J...
Implement the Python class `Lane` described below. Class description: Implement the Lane class. Method signatures and docstrings: - def get(self, id_lane=None, is_active=None): Return all lane information :param id_lane: UUID :param is_active: Boolean - def create(self, body): Create a new lane :param body: { name: J...
43bd57c466a5cd3b133ddc437cb4a6b9f007d267
<|skeleton|> class Lane: def get(self, id_lane=None, is_active=None): """Return all lane information :param id_lane: UUID :param is_active: Boolean""" <|body_0|> def create(self, body): """Create a new lane :param body: { name: JSON, id_city: UUID }""" <|body_1|> def modif...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Lane: def get(self, id_lane=None, is_active=None): """Return all lane information :param id_lane: UUID :param is_active: Boolean""" with Database() as db: if id_lane is None and is_active is None: data = db.query(Table).all() elif id_lane is None: ...
the_stack_v2_python_sparse
resturls/lane.py
CAUCA-9-1-1/survip-api
train
1
576b132b6214fca3950086f0e1cd3034fb945875
[ "self._counters = counters\nself._name = name\nself._start = time.clock()", "if self._counters != None:\n elapsed = (time.clock() - self._start) * 1000\n self._counters._set_timing(self._name, elapsed)" ]
<|body_start_0|> self._counters = counters self._name = name self._start = time.clock() <|end_body_0|> <|body_start_1|> if self._counters != None: elapsed = (time.clock() - self._start) * 1000 self._counters._set_timing(self._name, elapsed) <|end_body_1|>
Implementation of ITiming interface that provides callback to end measuring execution time interface and update interval counter.
Timing
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Timing: """Implementation of ITiming interface that provides callback to end measuring execution time interface and update interval counter.""" def __init__(self, counters=None, name=None): """Creates instance of timing object that calculates elapsed time and stores it to specified p...
stack_v2_sparse_classes_36k_train_007514
1,356
permissive
[ { "docstring": "Creates instance of timing object that calculates elapsed time and stores it to specified performance counters component under specified name. Args: counters: a performance counters component to store calculated value. name: a name of the counter to record elapsed time interval.", "name": "_...
2
stack_v2_sparse_classes_30k_train_014249
Implement the Python class `Timing` described below. Class description: Implementation of ITiming interface that provides callback to end measuring execution time interface and update interval counter. Method signatures and docstrings: - def __init__(self, counters=None, name=None): Creates instance of timing object ...
Implement the Python class `Timing` described below. Class description: Implementation of ITiming interface that provides callback to end measuring execution time interface and update interval counter. Method signatures and docstrings: - def __init__(self, counters=None, name=None): Creates instance of timing object ...
70eca1ffc44bfdc45c9c65b0ee347fa578368849
<|skeleton|> class Timing: """Implementation of ITiming interface that provides callback to end measuring execution time interface and update interval counter.""" def __init__(self, counters=None, name=None): """Creates instance of timing object that calculates elapsed time and stores it to specified p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Timing: """Implementation of ITiming interface that provides callback to end measuring execution time interface and update interval counter.""" def __init__(self, counters=None, name=None): """Creates instance of timing object that calculates elapsed time and stores it to specified performance co...
the_stack_v2_python_sparse
pip_services_runtime/counters/Timing.py
pip-services-archive/pip-services-runtime-python
train
0
07aa91ae577356f7e02ed2642ea64e269421f89d
[ "model_summary_path = os.path.join(self.paths['exp_dir'], 'model_summary.csv')\nif self.model_summary is not None:\n self.model_summary.to_csv(model_summary_path)", "loss_name = self.configs.LOSS.LOSS_NAME\nloss_data_frame = pandas.DataFrame(loss_meter.recorded_values, columns=[loss_name])\nmetrics_data = {}\n...
<|body_start_0|> model_summary_path = os.path.join(self.paths['exp_dir'], 'model_summary.csv') if self.model_summary is not None: self.model_summary.to_csv(model_summary_path) <|end_body_0|> <|body_start_1|> loss_name = self.configs.LOSS.LOSS_NAME loss_data_frame = pandas.Da...
Agent for handling output files.
OutputHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OutputHandler: """Agent for handling output files.""" def save_model_summary(self): """Save model summary.""" <|body_0|> def save_metrics(self, output_dir, sample_ids, loss_meter, metric_meters): """Write out files of metrics values.""" <|body_1|> de...
stack_v2_sparse_classes_36k_train_007515
2,408
no_license
[ { "docstring": "Save model summary.", "name": "save_model_summary", "signature": "def save_model_summary(self)" }, { "docstring": "Write out files of metrics values.", "name": "save_metrics", "signature": "def save_metrics(self, output_dir, sample_ids, loss_meter, metric_meters)" }, ...
3
null
Implement the Python class `OutputHandler` described below. Class description: Agent for handling output files. Method signatures and docstrings: - def save_model_summary(self): Save model summary. - def save_metrics(self, output_dir, sample_ids, loss_meter, metric_meters): Write out files of metrics values. - def sa...
Implement the Python class `OutputHandler` described below. Class description: Agent for handling output files. Method signatures and docstrings: - def save_model_summary(self): Save model summary. - def save_metrics(self, output_dir, sample_ids, loss_meter, metric_meters): Write out files of metrics values. - def sa...
2d35b2d75f700277d2b465ecc34c8c864c77b651
<|skeleton|> class OutputHandler: """Agent for handling output files.""" def save_model_summary(self): """Save model summary.""" <|body_0|> def save_metrics(self, output_dir, sample_ids, loss_meter, metric_meters): """Write out files of metrics values.""" <|body_1|> de...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OutputHandler: """Agent for handling output files.""" def save_model_summary(self): """Save model summary.""" model_summary_path = os.path.join(self.paths['exp_dir'], 'model_summary.csv') if self.model_summary is not None: self.model_summary.to_csv(model_summary_path) ...
the_stack_v2_python_sparse
agents/handlers/output_handler.py
templeblock/OctaveConv-LinearConv-UNET
train
0
d899a9406e323751205c9405d8c20b1af8791ea9
[ "self.email_addresses = email_addresses\nself.email_delivery_targets = email_delivery_targets\nself.raise_object_level_failure_alert = raise_object_level_failure_alert", "if dictionary is None:\n return None\nemail_addresses = dictionary.get('emailAddresses')\nemail_delivery_targets = None\nif dictionary.get('...
<|body_start_0|> self.email_addresses = email_addresses self.email_delivery_targets = email_delivery_targets self.raise_object_level_failure_alert = raise_object_level_failure_alert <|end_body_0|> <|body_start_1|> if dictionary is None: return None email_addresses = ...
Implementation of the 'AlertingConfig' model. Specifies optional settings for alerting. Attributes: email_addresses (list of string): Exists to maintain backwards compatibility with versions before eff8198. email_delivery_targets (list of EmailDeliveryTarget): Specifies additional email addresses where alert notificati...
AlertingConfig
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlertingConfig: """Implementation of the 'AlertingConfig' model. Specifies optional settings for alerting. Attributes: email_addresses (list of string): Exists to maintain backwards compatibility with versions before eff8198. email_delivery_targets (list of EmailDeliveryTarget): Specifies additio...
stack_v2_sparse_classes_36k_train_007516
2,719
permissive
[ { "docstring": "Constructor for the AlertingConfig class", "name": "__init__", "signature": "def __init__(self, email_addresses=None, email_delivery_targets=None, raise_object_level_failure_alert=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dict...
2
stack_v2_sparse_classes_30k_train_002091
Implement the Python class `AlertingConfig` described below. Class description: Implementation of the 'AlertingConfig' model. Specifies optional settings for alerting. Attributes: email_addresses (list of string): Exists to maintain backwards compatibility with versions before eff8198. email_delivery_targets (list of ...
Implement the Python class `AlertingConfig` described below. Class description: Implementation of the 'AlertingConfig' model. Specifies optional settings for alerting. Attributes: email_addresses (list of string): Exists to maintain backwards compatibility with versions before eff8198. email_delivery_targets (list of ...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class AlertingConfig: """Implementation of the 'AlertingConfig' model. Specifies optional settings for alerting. Attributes: email_addresses (list of string): Exists to maintain backwards compatibility with versions before eff8198. email_delivery_targets (list of EmailDeliveryTarget): Specifies additio...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AlertingConfig: """Implementation of the 'AlertingConfig' model. Specifies optional settings for alerting. Attributes: email_addresses (list of string): Exists to maintain backwards compatibility with versions before eff8198. email_delivery_targets (list of EmailDeliveryTarget): Specifies additional email add...
the_stack_v2_python_sparse
cohesity_management_sdk/models/alerting_config.py
cohesity/management-sdk-python
train
24
6fa8ce9d1f166ef13328d0e5f538dff545cef425
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn ImportedWindowsAutopilotDeviceIdentityUpload()", "from .entity import Entity\nfrom .imported_windows_autopilot_device_identity import ImportedWindowsAutopilotDeviceIdentity\nfrom .imported_windows_autopilot_device_identity_upload_statu...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return ImportedWindowsAutopilotDeviceIdentityUpload() <|end_body_0|> <|body_start_1|> from .entity import Entity from .imported_windows_autopilot_device_identity import ImportedWindowsAutopilot...
Import windows autopilot devices using upload.
ImportedWindowsAutopilotDeviceIdentityUpload
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImportedWindowsAutopilotDeviceIdentityUpload: """Import windows autopilot devices using upload.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ImportedWindowsAutopilotDeviceIdentityUpload: """Creates a new instance of the appropriate class based on di...
stack_v2_sparse_classes_36k_train_007517
3,621
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: ImportedWindowsAutopilotDeviceIdentityUpload", "name": "create_from_discriminator_value", "signature": "def ...
3
stack_v2_sparse_classes_30k_train_016642
Implement the Python class `ImportedWindowsAutopilotDeviceIdentityUpload` described below. Class description: Import windows autopilot devices using upload. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ImportedWindowsAutopilotDeviceIdentityUpload: Cr...
Implement the Python class `ImportedWindowsAutopilotDeviceIdentityUpload` described below. Class description: Import windows autopilot devices using upload. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ImportedWindowsAutopilotDeviceIdentityUpload: Cr...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class ImportedWindowsAutopilotDeviceIdentityUpload: """Import windows autopilot devices using upload.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ImportedWindowsAutopilotDeviceIdentityUpload: """Creates a new instance of the appropriate class based on di...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImportedWindowsAutopilotDeviceIdentityUpload: """Import windows autopilot devices using upload.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ImportedWindowsAutopilotDeviceIdentityUpload: """Creates a new instance of the appropriate class based on discriminator v...
the_stack_v2_python_sparse
msgraph/generated/models/imported_windows_autopilot_device_identity_upload.py
microsoftgraph/msgraph-sdk-python
train
135
4e737ca4e8538c819c0d4aca09c48ea1f543e585
[ "if not bn_layers:\n _logger.info('High Bias folding is not supported for models without BatchNorm Layers')\n return\nfor cls_set_info in cls_set_info_list:\n for cls_pair_info in cls_set_info.cls_pair_info_list:\n if not cls_pair_info.layer1.use_bias or not cls_pair_info.layer2.use_bias or cls_pair...
<|body_start_0|> if not bn_layers: _logger.info('High Bias folding is not supported for models without BatchNorm Layers') return for cls_set_info in cls_set_info_list: for cls_pair_info in cls_set_info.cls_pair_info_list: if not cls_pair_info.layer1.us...
Code to apply the high-bias-fold technique to a model
HighBiasFold
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HighBiasFold: """Code to apply the high-bias-fold technique to a model""" def bias_fold(cls_set_info_list: typing.List[ClsSetInfo], bn_layers: typing.Dict[tf.keras.layers.Conv2D, tf.keras.layers.BatchNormalization]): """Folds bias values greater than 3 * sigma to next layer's bias :p...
stack_v2_sparse_classes_36k_train_007518
23,575
permissive
[ { "docstring": "Folds bias values greater than 3 * sigma to next layer's bias :param cls_set_info_list: List of info elements for each cls set :param bn_layers: Key: Conv/Linear layer Value: Corresponding folded BN layer", "name": "bias_fold", "signature": "def bias_fold(cls_set_info_list: typing.List[C...
4
null
Implement the Python class `HighBiasFold` described below. Class description: Code to apply the high-bias-fold technique to a model Method signatures and docstrings: - def bias_fold(cls_set_info_list: typing.List[ClsSetInfo], bn_layers: typing.Dict[tf.keras.layers.Conv2D, tf.keras.layers.BatchNormalization]): Folds b...
Implement the Python class `HighBiasFold` described below. Class description: Code to apply the high-bias-fold technique to a model Method signatures and docstrings: - def bias_fold(cls_set_info_list: typing.List[ClsSetInfo], bn_layers: typing.Dict[tf.keras.layers.Conv2D, tf.keras.layers.BatchNormalization]): Folds b...
5a406e657082b6a4f6e4bf48f0e46e085cb1e351
<|skeleton|> class HighBiasFold: """Code to apply the high-bias-fold technique to a model""" def bias_fold(cls_set_info_list: typing.List[ClsSetInfo], bn_layers: typing.Dict[tf.keras.layers.Conv2D, tf.keras.layers.BatchNormalization]): """Folds bias values greater than 3 * sigma to next layer's bias :p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HighBiasFold: """Code to apply the high-bias-fold technique to a model""" def bias_fold(cls_set_info_list: typing.List[ClsSetInfo], bn_layers: typing.Dict[tf.keras.layers.Conv2D, tf.keras.layers.BatchNormalization]): """Folds bias values greater than 3 * sigma to next layer's bias :param cls_set_...
the_stack_v2_python_sparse
TrainingExtensions/tensorflow/src/python/aimet_tensorflow/keras/cross_layer_equalization.py
quic/aimet
train
1,676
1f264addd8dce1ffefa0c251d36e0791e1ef2ba9
[ "self.acl = acl\nself.bucket_policy = bucket_policy\nself.efficient_mpu_enabled = efficient_mpu_enabled\nself.enable_obj_store_access = enable_obj_store_access\nself.init_cluster_id = init_cluster_id\nself.init_cluster_incarnation_id = init_cluster_incarnation_id\nself.lifecycle_config = lifecycle_config\nself.obje...
<|body_start_0|> self.acl = acl self.bucket_policy = bucket_policy self.efficient_mpu_enabled = efficient_mpu_enabled self.enable_obj_store_access = enable_obj_store_access self.init_cluster_id = init_cluster_id self.init_cluster_incarnation_id = init_cluster_incarnation_...
Implementation of the 'S3BucketConfigProto' model. TODO: type description here. Attributes: acl (ACLProto): ACL of the bucket. bucket_policy (BucketPolicy): Policy in effect for the bucket. efficient_mpu_enabled (bool): bool representing whether this mpu structure is based on S3 MPU 2.0 enable_obj_store_access (bool): ...
S3BucketConfigProto
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class S3BucketConfigProto: """Implementation of the 'S3BucketConfigProto' model. TODO: type description here. Attributes: acl (ACLProto): ACL of the bucket. bucket_policy (BucketPolicy): Policy in effect for the bucket. efficient_mpu_enabled (bool): bool representing whether this mpu structure is based...
stack_v2_sparse_classes_36k_train_007519
9,657
permissive
[ { "docstring": "Constructor for the S3BucketConfigProto class", "name": "__init__", "signature": "def __init__(self, acl=None, bucket_policy=None, efficient_mpu_enabled=None, enable_obj_store_access=None, init_cluster_id=None, init_cluster_incarnation_id=None, lifecycle_config=None, object_tags_added=No...
2
null
Implement the Python class `S3BucketConfigProto` described below. Class description: Implementation of the 'S3BucketConfigProto' model. TODO: type description here. Attributes: acl (ACLProto): ACL of the bucket. bucket_policy (BucketPolicy): Policy in effect for the bucket. efficient_mpu_enabled (bool): bool represent...
Implement the Python class `S3BucketConfigProto` described below. Class description: Implementation of the 'S3BucketConfigProto' model. TODO: type description here. Attributes: acl (ACLProto): ACL of the bucket. bucket_policy (BucketPolicy): Policy in effect for the bucket. efficient_mpu_enabled (bool): bool represent...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class S3BucketConfigProto: """Implementation of the 'S3BucketConfigProto' model. TODO: type description here. Attributes: acl (ACLProto): ACL of the bucket. bucket_policy (BucketPolicy): Policy in effect for the bucket. efficient_mpu_enabled (bool): bool representing whether this mpu structure is based...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class S3BucketConfigProto: """Implementation of the 'S3BucketConfigProto' model. TODO: type description here. Attributes: acl (ACLProto): ACL of the bucket. bucket_policy (BucketPolicy): Policy in effect for the bucket. efficient_mpu_enabled (bool): bool representing whether this mpu structure is based on S3 MPU 2....
the_stack_v2_python_sparse
cohesity_management_sdk/models/s3_bucket_config_proto.py
cohesity/management-sdk-python
train
24
3a8b2cf6d3f36cfe05234b8088f2db3fb8254e99
[ "self._logger = logger\nself._no_run = False\nif not is_exe(exe_path):\n self._logger.error('No convert_format script available (exiting)')\n sys.exit(1)\nself._exe_path = exe_path\nself.informat = 'fastq'\nself.outformat = 'fasta'", "self._outdirname = os.path.join(outdir)\nif not os.path.exists(self._outd...
<|body_start_0|> self._logger = logger self._no_run = False if not is_exe(exe_path): self._logger.error('No convert_format script available (exiting)') sys.exit(1) self._exe_path = exe_path self.informat = 'fastq' self.outformat = 'fasta' <|end_bod...
Class for working with convert_format
Convert_Format
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Convert_Format: """Class for working with convert_format""" def __init__(self, exe_path, logger): """Instantiate with location of executable""" <|body_0|> def run(self, infname, outdir, logger=None): """Run convert_format on the passed file""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_007520
3,597
permissive
[ { "docstring": "Instantiate with location of executable", "name": "__init__", "signature": "def __init__(self, exe_path, logger)" }, { "docstring": "Run convert_format on the passed file", "name": "run", "signature": "def run(self, infname, outdir, logger=None)" }, { "docstring":...
3
stack_v2_sparse_classes_30k_test_001067
Implement the Python class `Convert_Format` described below. Class description: Class for working with convert_format Method signatures and docstrings: - def __init__(self, exe_path, logger): Instantiate with location of executable - def run(self, infname, outdir, logger=None): Run convert_format on the passed file -...
Implement the Python class `Convert_Format` described below. Class description: Class for working with convert_format Method signatures and docstrings: - def __init__(self, exe_path, logger): Instantiate with location of executable - def run(self, infname, outdir, logger=None): Run convert_format on the passed file -...
a3c64198aad3709a5c4d969f48ae0af11fdc25db
<|skeleton|> class Convert_Format: """Class for working with convert_format""" def __init__(self, exe_path, logger): """Instantiate with location of executable""" <|body_0|> def run(self, infname, outdir, logger=None): """Run convert_format on the passed file""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Convert_Format: """Class for working with convert_format""" def __init__(self, exe_path, logger): """Instantiate with location of executable""" self._logger = logger self._no_run = False if not is_exe(exe_path): self._logger.error('No convert_format script avai...
the_stack_v2_python_sparse
metapy/pycits/seq_crumbs.py
peterthorpe5/public_scripts
train
35
6eb2d0ebd4a5c5a609ec6372fc419bc927dc06fb
[ "size = len(nums)\ns = sum(nums)\nif s & 1 == 1:\n return False\ntarget = s // 2\ndp = [[False for _ in range(target + 1)] for _ in range(size)]\nfor i in range(target + 1):\n dp[0][i] = False if nums[0] != i else True\nfor i in range(1, size):\n for j in range(target + 1):\n if j >= nums[i]:\n ...
<|body_start_0|> size = len(nums) s = sum(nums) if s & 1 == 1: return False target = s // 2 dp = [[False for _ in range(target + 1)] for _ in range(size)] for i in range(target + 1): dp[0][i] = False if nums[0] != i else True for i in range...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canPartition(self, nums: list) -> bool: """提示: 方法一:二维动态规划 可以把这道题转换为 0-1 背包问题: 有一些物品,它们的重量存储在列表 nums 中, 而你刚好有两个包,怎么装能让这两个包装的物品重量相等? 或者说,你只有一个包,怎么让这一个包刚好带走总重量一半的物品? 0-1 背包问题也是最基础的背包问题,它的特点是:待挑选的物品有且仅有一个,可以选择也可以不选择。 下面我们定义状态,不妨就用问题的问法定义状态。 dp[i][j]:表示从数组的 [0, i] 这个子区间内挑选一些正整数,...
stack_v2_sparse_classes_36k_train_007521
3,963
permissive
[ { "docstring": "提示: 方法一:二维动态规划 可以把这道题转换为 0-1 背包问题: 有一些物品,它们的重量存储在列表 nums 中, 而你刚好有两个包,怎么装能让这两个包装的物品重量相等? 或者说,你只有一个包,怎么让这一个包刚好带走总重量一半的物品? 0-1 背包问题也是最基础的背包问题,它的特点是:待挑选的物品有且仅有一个,可以选择也可以不选择。 下面我们定义状态,不妨就用问题的问法定义状态。 dp[i][j]:表示从数组的 [0, i] 这个子区间内挑选一些正整数,每个数只能用一次,使得这些数的和等于 j。 新来一个数,例如是 nums[i],这个数可能选择也可能不被选择: 如果不选择 num...
3
stack_v2_sparse_classes_30k_train_009137
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canPartition(self, nums: list) -> bool: 提示: 方法一:二维动态规划 可以把这道题转换为 0-1 背包问题: 有一些物品,它们的重量存储在列表 nums 中, 而你刚好有两个包,怎么装能让这两个包装的物品重量相等? 或者说,你只有一个包,怎么让这一个包刚好带走总重量一半的物品? 0-1 背包问题也是最基础的...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canPartition(self, nums: list) -> bool: 提示: 方法一:二维动态规划 可以把这道题转换为 0-1 背包问题: 有一些物品,它们的重量存储在列表 nums 中, 而你刚好有两个包,怎么装能让这两个包装的物品重量相等? 或者说,你只有一个包,怎么让这一个包刚好带走总重量一半的物品? 0-1 背包问题也是最基础的...
889d8fa489f1f2719c5a0dafd3ae51df7b4bf978
<|skeleton|> class Solution: def canPartition(self, nums: list) -> bool: """提示: 方法一:二维动态规划 可以把这道题转换为 0-1 背包问题: 有一些物品,它们的重量存储在列表 nums 中, 而你刚好有两个包,怎么装能让这两个包装的物品重量相等? 或者说,你只有一个包,怎么让这一个包刚好带走总重量一半的物品? 0-1 背包问题也是最基础的背包问题,它的特点是:待挑选的物品有且仅有一个,可以选择也可以不选择。 下面我们定义状态,不妨就用问题的问法定义状态。 dp[i][j]:表示从数组的 [0, i] 这个子区间内挑选一些正整数,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def canPartition(self, nums: list) -> bool: """提示: 方法一:二维动态规划 可以把这道题转换为 0-1 背包问题: 有一些物品,它们的重量存储在列表 nums 中, 而你刚好有两个包,怎么装能让这两个包装的物品重量相等? 或者说,你只有一个包,怎么让这一个包刚好带走总重量一半的物品? 0-1 背包问题也是最基础的背包问题,它的特点是:待挑选的物品有且仅有一个,可以选择也可以不选择。 下面我们定义状态,不妨就用问题的问法定义状态。 dp[i][j]:表示从数组的 [0, i] 这个子区间内挑选一些正整数,每个数只能用一次,使得这些数...
the_stack_v2_python_sparse
LeetCode/416-分割等和子集/canPartition.py
jinbooooom/coding-for-algorithms
train
14
6c118095d8b9ba55ba115713ebdbfa6d922d7eb5
[ "builder = plexus.builder\nlibs = tuple(self.filter(projects=plexus.projects))\nbuilder.add(plexus=plexus, assets=libs, target='libraries')\nbuilder.build(plexus=plexus, assets=libs)\nreturn", "channel = journal.info('merlin.lib.info')\nfor lib in self.filter(projects=plexus.projects):\n channel.line(f'{lib.py...
<|body_start_0|> builder = plexus.builder libs = tuple(self.filter(projects=plexus.projects)) builder.add(plexus=plexus, assets=libs, target='libraries') builder.build(plexus=plexus, assets=libs) return <|end_body_0|> <|body_start_1|> channel = journal.info('merlin.lib.i...
Access to the libraries of the current workspace
Libraries
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Libraries: """Access to the libraries of the current workspace""" def build(self, plexus, **kwds): """Build the selected libraries""" <|body_0|> def info(self, plexus, **kwds): """Display the names of the selected libraries""" <|body_1|> def sources(...
stack_v2_sparse_classes_36k_train_007522
4,439
permissive
[ { "docstring": "Build the selected libraries", "name": "build", "signature": "def build(self, plexus, **kwds)" }, { "docstring": "Display the names of the selected libraries", "name": "info", "signature": "def info(self, plexus, **kwds)" }, { "docstring": "Display the sources of ...
4
null
Implement the Python class `Libraries` described below. Class description: Access to the libraries of the current workspace Method signatures and docstrings: - def build(self, plexus, **kwds): Build the selected libraries - def info(self, plexus, **kwds): Display the names of the selected libraries - def sources(self...
Implement the Python class `Libraries` described below. Class description: Access to the libraries of the current workspace Method signatures and docstrings: - def build(self, plexus, **kwds): Build the selected libraries - def info(self, plexus, **kwds): Display the names of the selected libraries - def sources(self...
d741c44ffb3e9e1f726bf492202ac8738bb4aa1c
<|skeleton|> class Libraries: """Access to the libraries of the current workspace""" def build(self, plexus, **kwds): """Build the selected libraries""" <|body_0|> def info(self, plexus, **kwds): """Display the names of the selected libraries""" <|body_1|> def sources(...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Libraries: """Access to the libraries of the current workspace""" def build(self, plexus, **kwds): """Build the selected libraries""" builder = plexus.builder libs = tuple(self.filter(projects=plexus.projects)) builder.add(plexus=plexus, assets=libs, target='libraries') ...
the_stack_v2_python_sparse
packages/merlin/cli/Libraries.py
pyre/pyre
train
27
7e2c2b446199a82141470cc9a5b4c74c3b0e2ae2
[ "keys = {key: value for key, value in cls.__dict__.items() if not isinstance(value, classmethod) and (not isinstance(value, staticmethod)) and (not callable(value)) and (not key.startswith('__'))}\nrequired = [v for k, v in keys.items() if not k.endswith('_')]\noptional = [v for k, v in keys.items() if k.endswith('...
<|body_start_0|> keys = {key: value for key, value in cls.__dict__.items() if not isinstance(value, classmethod) and (not isinstance(value, staticmethod)) and (not callable(value)) and (not key.startswith('__'))} required = [v for k, v in keys.items() if not k.endswith('_')] optional = [v for k,...
Class to validate dictionary configurations.
ConfigKeys
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConfigKeys: """Class to validate dictionary configurations.""" def get_keys(cls) -> Tuple[List[str], List[str]]: """Gets all the required and optional config keys for this class. Returns: A tuple (required, optional) which are lists of the required/optional keys for this class.""" ...
stack_v2_sparse_classes_36k_train_007523
3,020
permissive
[ { "docstring": "Gets all the required and optional config keys for this class. Returns: A tuple (required, optional) which are lists of the required/optional keys for this class.", "name": "get_keys", "signature": "def get_keys(cls) -> Tuple[List[str], List[str]]" }, { "docstring": "Checks wheth...
2
stack_v2_sparse_classes_30k_train_005597
Implement the Python class `ConfigKeys` described below. Class description: Class to validate dictionary configurations. Method signatures and docstrings: - def get_keys(cls) -> Tuple[List[str], List[str]]: Gets all the required and optional config keys for this class. Returns: A tuple (required, optional) which are ...
Implement the Python class `ConfigKeys` described below. Class description: Class to validate dictionary configurations. Method signatures and docstrings: - def get_keys(cls) -> Tuple[List[str], List[str]]: Gets all the required and optional config keys for this class. Returns: A tuple (required, optional) which are ...
f1499e9c3fee00fd1d66de14cab66c4472c0085d
<|skeleton|> class ConfigKeys: """Class to validate dictionary configurations.""" def get_keys(cls) -> Tuple[List[str], List[str]]: """Gets all the required and optional config keys for this class. Returns: A tuple (required, optional) which are lists of the required/optional keys for this class.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConfigKeys: """Class to validate dictionary configurations.""" def get_keys(cls) -> Tuple[List[str], List[str]]: """Gets all the required and optional config keys for this class. Returns: A tuple (required, optional) which are lists of the required/optional keys for this class.""" keys = ...
the_stack_v2_python_sparse
src/zenml/config/config_keys.py
stefannica/zenml
train
0
0b28617aca1afad7a1da0bb406763eb3c1370f1c
[ "super(TrainConfiguration, self).__init__(**kwargs)\nself.cuda = False\nself.log_interval = 10\nself.optimizer_config = OptimizerConfiguration()\nself.save_config = None\nself.extra = {}\nself.set_necessary_configs(**kwargs)\nself.set_unnecessary_configs(**kwargs)", "try:\n self.epochs = kwargs['epochs']\nexce...
<|body_start_0|> super(TrainConfiguration, self).__init__(**kwargs) self.cuda = False self.log_interval = 10 self.optimizer_config = OptimizerConfiguration() self.save_config = None self.extra = {} self.set_necessary_configs(**kwargs) self.set_unnecessary_...
class stores the training configuration
TrainConfiguration
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TrainConfiguration: """class stores the training configuration""" def __init__(self, **kwargs): """initialize settings""" <|body_0|> def set_necessary_configs(self, **kwargs): """set train configs that necessarily provided by user""" <|body_1|> def s...
stack_v2_sparse_classes_36k_train_007524
3,307
no_license
[ { "docstring": "initialize settings", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "set train configs that necessarily provided by user", "name": "set_necessary_configs", "signature": "def set_necessary_configs(self, **kwargs)" }, { "docstring...
3
stack_v2_sparse_classes_30k_train_010164
Implement the Python class `TrainConfiguration` described below. Class description: class stores the training configuration Method signatures and docstrings: - def __init__(self, **kwargs): initialize settings - def set_necessary_configs(self, **kwargs): set train configs that necessarily provided by user - def set_u...
Implement the Python class `TrainConfiguration` described below. Class description: class stores the training configuration Method signatures and docstrings: - def __init__(self, **kwargs): initialize settings - def set_necessary_configs(self, **kwargs): set train configs that necessarily provided by user - def set_u...
b0e8f66b3ade742445a41d3d5667032a931d94d2
<|skeleton|> class TrainConfiguration: """class stores the training configuration""" def __init__(self, **kwargs): """initialize settings""" <|body_0|> def set_necessary_configs(self, **kwargs): """set train configs that necessarily provided by user""" <|body_1|> def s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TrainConfiguration: """class stores the training configuration""" def __init__(self, **kwargs): """initialize settings""" super(TrainConfiguration, self).__init__(**kwargs) self.cuda = False self.log_interval = 10 self.optimizer_config = OptimizerConfiguration() ...
the_stack_v2_python_sparse
config/train_config.py
wz139704646/MBRL_on_VAEs
train
1
5aa5e22ef4183a37e108d768ed49b2765474cfa1
[ "attr_obj = Attribute()\nattr_obj.deployable_id = deployable_id\nattr_obj.set_key_value_pair(self.key, self.value)\nattr_obj.create(context)", "attr_obj_list = Attribute.get_by_deployable_id(context, deployable_id)\nfor attr_obj in attr_obj_list:\n attr_obj.destroy(context)", "attr_obj_list = Attribute.get_b...
<|body_start_0|> attr_obj = Attribute() attr_obj.deployable_id = deployable_id attr_obj.set_key_value_pair(self.key, self.value) attr_obj.create(context) <|end_body_0|> <|body_start_1|> attr_obj_list = Attribute.get_by_deployable_id(context, deployable_id) for attr_obj i...
DriverAttribute
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DriverAttribute: def create(self, context, deployable_id): """Convert driver-side Attribute into Attribute Object so as to store in DB.""" <|body_0|> def destroy(cls, context, deployable_id): """Delete driver-side attribute list from the DB.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_007525
2,630
permissive
[ { "docstring": "Convert driver-side Attribute into Attribute Object so as to store in DB.", "name": "create", "signature": "def create(self, context, deployable_id)" }, { "docstring": "Delete driver-side attribute list from the DB.", "name": "destroy", "signature": "def destroy(cls, cont...
4
stack_v2_sparse_classes_30k_train_001087
Implement the Python class `DriverAttribute` described below. Class description: Implement the DriverAttribute class. Method signatures and docstrings: - def create(self, context, deployable_id): Convert driver-side Attribute into Attribute Object so as to store in DB. - def destroy(cls, context, deployable_id): Dele...
Implement the Python class `DriverAttribute` described below. Class description: Implement the DriverAttribute class. Method signatures and docstrings: - def create(self, context, deployable_id): Convert driver-side Attribute into Attribute Object so as to store in DB. - def destroy(cls, context, deployable_id): Dele...
ab8b8514242895b8adc2ec3dfbbb63a49f02c89e
<|skeleton|> class DriverAttribute: def create(self, context, deployable_id): """Convert driver-side Attribute into Attribute Object so as to store in DB.""" <|body_0|> def destroy(cls, context, deployable_id): """Delete driver-side attribute list from the DB.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DriverAttribute: def create(self, context, deployable_id): """Convert driver-side Attribute into Attribute Object so as to store in DB.""" attr_obj = Attribute() attr_obj.deployable_id = deployable_id attr_obj.set_key_value_pair(self.key, self.value) attr_obj.create(con...
the_stack_v2_python_sparse
cyborg/objects/driver_objects/driver_attribute.py
openstack/cyborg
train
41
299f75773a38b14c028cf2bd3598a238a33693ca
[ "self.epsilon = epsilon\nself.learningrate = alpha\nself.discountrate = gamma\nself.discrete_os_size = size_table\nself.num_state = len(num_state)\nself.num_actions = num_actions\nself.action_space = action_space\nself.discrete = discrete", "predict = self.Q[prev_state, prev_action]\ntarget = reward + self.gamma ...
<|body_start_0|> self.epsilon = epsilon self.learningrate = alpha self.discountrate = gamma self.discrete_os_size = size_table self.num_state = len(num_state) self.num_actions = num_actions self.action_space = action_space self.discrete = discrete <|end_bo...
The Agent that uses SARSA update to improve it's behaviour
SarsaAgent
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SarsaAgent: """The Agent that uses SARSA update to improve it's behaviour""" def __init__(self, epsilon, alpha, gamma, size_table, num_state, num_actions, action_space, discrete=True): """Constructor Args: epsilon: The degree of exploration gamma: The discount factor num_state: The n...
stack_v2_sparse_classes_36k_train_007526
2,205
no_license
[ { "docstring": "Constructor Args: epsilon: The degree of exploration gamma: The discount factor num_state: The number of states num_actions: The number of actions action_space: To call the random action", "name": "__init__", "signature": "def __init__(self, epsilon, alpha, gamma, size_table, num_state, ...
2
stack_v2_sparse_classes_30k_train_010544
Implement the Python class `SarsaAgent` described below. Class description: The Agent that uses SARSA update to improve it's behaviour Method signatures and docstrings: - def __init__(self, epsilon, alpha, gamma, size_table, num_state, num_actions, action_space, discrete=True): Constructor Args: epsilon: The degree o...
Implement the Python class `SarsaAgent` described below. Class description: The Agent that uses SARSA update to improve it's behaviour Method signatures and docstrings: - def __init__(self, epsilon, alpha, gamma, size_table, num_state, num_actions, action_space, discrete=True): Constructor Args: epsilon: The degree o...
0e7f598d57fa294cfe4f6b4fadff6480068a0390
<|skeleton|> class SarsaAgent: """The Agent that uses SARSA update to improve it's behaviour""" def __init__(self, epsilon, alpha, gamma, size_table, num_state, num_actions, action_space, discrete=True): """Constructor Args: epsilon: The degree of exploration gamma: The discount factor num_state: The n...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SarsaAgent: """The Agent that uses SARSA update to improve it's behaviour""" def __init__(self, epsilon, alpha, gamma, size_table, num_state, num_actions, action_space, discrete=True): """Constructor Args: epsilon: The degree of exploration gamma: The discount factor num_state: The number of stat...
the_stack_v2_python_sparse
TD_Tabular_Openai/Sarsa.py
RoboticsLabURJC/2018-phd-pedro-fernandez
train
2
5dff5c57b6504327d3e559c14ea77aa7d1cf8deb
[ "user_input = None\nwhile user_input != 2:\n print('\\n\\n=== The Pokemon Tamagotchi Game ===\\n')\n print('Hello there! Welcome to the world of POKEMON!\\nMy name is EUCALYPTUS. People call me the \\nPOKEMON PROF!\\n')\n print('This world is inhabited by creatures called \\nPOKEMON! For some people, POKEM...
<|body_start_0|> user_input = None while user_input != 2: print('\n\n=== The Pokemon Tamagotchi Game ===\n') print('Hello there! Welcome to the world of POKEMON!\nMy name is EUCALYPTUS. People call me the \nPOKEMON PROF!\n') print('This world is inhabited by creatures...
Display menu items and control the flow of logic for the menu itself.
GameUI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GameUI: """Display menu items and control the flow of logic for the menu itself.""" def display_start_menu(cls, game): """Display start menu (with no Pokemon hatched).""" <|body_0|> def display_pet_menu(cls, game): """Display list of possible pet interactions."""...
stack_v2_sparse_classes_36k_train_007527
9,307
no_license
[ { "docstring": "Display start menu (with no Pokemon hatched).", "name": "display_start_menu", "signature": "def display_start_menu(cls, game)" }, { "docstring": "Display list of possible pet interactions.", "name": "display_pet_menu", "signature": "def display_pet_menu(cls, game)" }, ...
5
stack_v2_sparse_classes_30k_test_000567
Implement the Python class `GameUI` described below. Class description: Display menu items and control the flow of logic for the menu itself. Method signatures and docstrings: - def display_start_menu(cls, game): Display start menu (with no Pokemon hatched). - def display_pet_menu(cls, game): Display list of possible...
Implement the Python class `GameUI` described below. Class description: Display menu items and control the flow of logic for the menu itself. Method signatures and docstrings: - def display_start_menu(cls, game): Display start menu (with no Pokemon hatched). - def display_pet_menu(cls, game): Display list of possible...
b7695cc7cf0860aa9c8bf492b1bd06bd88b9af41
<|skeleton|> class GameUI: """Display menu items and control the flow of logic for the menu itself.""" def display_start_menu(cls, game): """Display start menu (with no Pokemon hatched).""" <|body_0|> def display_pet_menu(cls, game): """Display list of possible pet interactions."""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GameUI: """Display menu items and control the flow of logic for the menu itself.""" def display_start_menu(cls, game): """Display start menu (with no Pokemon hatched).""" user_input = None while user_input != 2: print('\n\n=== The Pokemon Tamagotchi Game ===\n') ...
the_stack_v2_python_sparse
Lectures/Assignment2a/game.py
sakshambhardwaj523/Python-OOP-Projects
train
0
b5a33f6450019fff4535086ce66fb17a23707776
[ "context = context or {}\nids = isinstance(ids, (int, long)) and [ids] or ids\ncr_date = time.strftime('%Y-%m-%d')\nsp_brw = self.browse(cur, uid, ids[0], context=context)\nif not sp_brw.date_contract_expiry or (sp_brw.date_contract_expiry and cr_date <= sp_brw.date_contract_expiry) or context.get('force_expiry_pic...
<|body_start_0|> context = context or {} ids = isinstance(ids, (int, long)) and [ids] or ids cr_date = time.strftime('%Y-%m-%d') sp_brw = self.browse(cur, uid, ids[0], context=context) if not sp_brw.date_contract_expiry or (sp_brw.date_contract_expiry and cr_date <= sp_brw.date_c...
StockPickingIn
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StockPickingIn: def action_process(self, cur, uid, ids, context=None): """overwrite the method to add a verification of the contract due date before process the stock picking in.""" <|body_0|> def copy(self, default=None): """Ovwerwrite the copy method to also copy t...
stack_v2_sparse_classes_36k_train_007528
5,912
no_license
[ { "docstring": "overwrite the method to add a verification of the contract due date before process the stock picking in.", "name": "action_process", "signature": "def action_process(self, cur, uid, ids, context=None)" }, { "docstring": "Ovwerwrite the copy method to also copy the date_contract_e...
2
null
Implement the Python class `StockPickingIn` described below. Class description: Implement the StockPickingIn class. Method signatures and docstrings: - def action_process(self, cur, uid, ids, context=None): overwrite the method to add a verification of the contract due date before process the stock picking in. - def ...
Implement the Python class `StockPickingIn` described below. Class description: Implement the StockPickingIn class. Method signatures and docstrings: - def action_process(self, cur, uid, ids, context=None): overwrite the method to add a verification of the contract due date before process the stock picking in. - def ...
511dc410b4eba1f8ea939c6af02a5adea5122c92
<|skeleton|> class StockPickingIn: def action_process(self, cur, uid, ids, context=None): """overwrite the method to add a verification of the contract due date before process the stock picking in.""" <|body_0|> def copy(self, default=None): """Ovwerwrite the copy method to also copy t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StockPickingIn: def action_process(self, cur, uid, ids, context=None): """overwrite the method to add a verification of the contract due date before process the stock picking in.""" context = context or {} ids = isinstance(ids, (int, long)) and [ids] or ids cr_date = time.strft...
the_stack_v2_python_sparse
stock_purchase_expiry/model/stock.py
yelizariev/addons-vauxoo
train
3
757d5ea0f100e99e02551a4e15d25a4f2e89afa9
[ "tensor, mask = self.forward_embedding(input, positions, segments)\nif self.variant == 'xlm' or self.variant == 'bart':\n tensor = self.norm_embeddings(tensor)\ntensor = self.dropout(tensor)\ntensor *= mask.unsqueeze(-1).type_as(tensor)\ntensor = self.forward_layers(tensor, mask, **kwargs)\ntensor, weights = ten...
<|body_start_0|> tensor, mask = self.forward_embedding(input, positions, segments) if self.variant == 'xlm' or self.variant == 'bart': tensor = self.norm_embeddings(tensor) tensor = self.dropout(tensor) tensor *= mask.unsqueeze(-1).type_as(tensor) tensor = self.forwar...
Override TransformerEncoder to return the self-attn weights.
TransformerReturnWeightsEncoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransformerReturnWeightsEncoder: """Override TransformerEncoder to return the self-attn weights.""" def forward(self, input: torch.LongTensor, positions: Optional[torch.LongTensor]=None, segments: Optional[torch.LongTensor]=None, **kwargs) -> Union[Tuple[torch.Tensor, Optional[torch.Tensor]]...
stack_v2_sparse_classes_36k_train_007529
12,281
permissive
[ { "docstring": "Forward pass. Propagate kwargs", "name": "forward", "signature": "def forward(self, input: torch.LongTensor, positions: Optional[torch.LongTensor]=None, segments: Optional[torch.LongTensor]=None, **kwargs) -> Union[Tuple[torch.Tensor, Optional[torch.Tensor]], Tuple[torch.Tensor, torch.Bo...
3
stack_v2_sparse_classes_30k_train_003399
Implement the Python class `TransformerReturnWeightsEncoder` described below. Class description: Override TransformerEncoder to return the self-attn weights. Method signatures and docstrings: - def forward(self, input: torch.LongTensor, positions: Optional[torch.LongTensor]=None, segments: Optional[torch.LongTensor]=...
Implement the Python class `TransformerReturnWeightsEncoder` described below. Class description: Override TransformerEncoder to return the self-attn weights. Method signatures and docstrings: - def forward(self, input: torch.LongTensor, positions: Optional[torch.LongTensor]=None, segments: Optional[torch.LongTensor]=...
e1d899edfb92471552bae153f59ad30aa7fca468
<|skeleton|> class TransformerReturnWeightsEncoder: """Override TransformerEncoder to return the self-attn weights.""" def forward(self, input: torch.LongTensor, positions: Optional[torch.LongTensor]=None, segments: Optional[torch.LongTensor]=None, **kwargs) -> Union[Tuple[torch.Tensor, Optional[torch.Tensor]]...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TransformerReturnWeightsEncoder: """Override TransformerEncoder to return the self-attn weights.""" def forward(self, input: torch.LongTensor, positions: Optional[torch.LongTensor]=None, segments: Optional[torch.LongTensor]=None, **kwargs) -> Union[Tuple[torch.Tensor, Optional[torch.Tensor]], Tuple[torch...
the_stack_v2_python_sparse
projects/light_whoami/agents/poly_return_weights.py
facebookresearch/ParlAI
train
10,943
3acf05bcf141ed512f2b1033641a1c8336a22bbb
[ "self.num_points = num_points\nself.x_values = [0]\nself.y_values = [0]", "direction = choice([1, -1])\ndistance = choice([0, 1, 2, 3, 4])\nstep = direction * distance\nreturn step", "while len(self.x_values) < self.num_points:\n x_step = self.get_step()\n y_step = self.get_step()\n if x_step == 0 and ...
<|body_start_0|> self.num_points = num_points self.x_values = [0] self.y_values = [0] <|end_body_0|> <|body_start_1|> direction = choice([1, -1]) distance = choice([0, 1, 2, 3, 4]) step = direction * distance return step <|end_body_1|> <|body_start_2|> w...
Uma classe para gerar passeios aleatórios.
RandonWalk
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandonWalk: """Uma classe para gerar passeios aleatórios.""" def __init__(self, num_points=5000): """Inicia os atributos de um passeio.""" <|body_0|> def get_step(self): """Decide a direção a ser seguida e a distância a ser percorrida.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_007530
1,317
permissive
[ { "docstring": "Inicia os atributos de um passeio.", "name": "__init__", "signature": "def __init__(self, num_points=5000)" }, { "docstring": "Decide a direção a ser seguida e a distância a ser percorrida.", "name": "get_step", "signature": "def get_step(self)" }, { "docstring": ...
3
null
Implement the Python class `RandonWalk` described below. Class description: Uma classe para gerar passeios aleatórios. Method signatures and docstrings: - def __init__(self, num_points=5000): Inicia os atributos de um passeio. - def get_step(self): Decide a direção a ser seguida e a distância a ser percorrida. - def ...
Implement the Python class `RandonWalk` described below. Class description: Uma classe para gerar passeios aleatórios. Method signatures and docstrings: - def __init__(self, num_points=5000): Inicia os atributos de um passeio. - def get_step(self): Decide a direção a ser seguida e a distância a ser percorrida. - def ...
de88ba326cdd9c17a456161cdb2f9ca69f7da65e
<|skeleton|> class RandonWalk: """Uma classe para gerar passeios aleatórios.""" def __init__(self, num_points=5000): """Inicia os atributos de um passeio.""" <|body_0|> def get_step(self): """Decide a direção a ser seguida e a distância a ser percorrida.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RandonWalk: """Uma classe para gerar passeios aleatórios.""" def __init__(self, num_points=5000): """Inicia os atributos de um passeio.""" self.num_points = num_points self.x_values = [0] self.y_values = [0] def get_step(self): """Decide a direção a ser seguid...
the_stack_v2_python_sparse
PYTHON/Python-VisualizacaoDeDados/Dados-Gráficos/Random Walk/random_walk.py
sourcery-ai-bot/Estudos
train
0
44dc9f0a3f6effe38369f9184d746ea8b7c26f74
[ "min_val = arr[qs]\nfor x in xrange(qs + 1, qe + 1):\n min_val = min(min_val, arr[x])\nreturn min_val", "n = len(arr)\ntable = [[sys.maxint] * n for _ in xrange(n)]\nfor k in xrange(1, n + 1):\n for x in xrange(n - k):\n y = x + k - 1\n if x == y:\n table[x][y] = arr[x]\n els...
<|body_start_0|> min_val = arr[qs] for x in xrange(qs + 1, qe + 1): min_val = min(min_val, arr[x]) return min_val <|end_body_0|> <|body_start_1|> n = len(arr) table = [[sys.maxint] * n for _ in xrange(n)] for k in xrange(1, n + 1): for x in xrange...
Given an array of integer numbers, find the minimum value from a specified range from qs to qe. In total, there are 5 approaches to RMQ question. Here 3 of them are given. The other two algorithms are Square Root Decomposition and Sparse Table Algorithm.
RangeMinimumQuery
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RangeMinimumQuery: """Given an array of integer numbers, find the minimum value from a specified range from qs to qe. In total, there are 5 approaches to RMQ question. Here 3 of them are given. The other two algorithms are Square Root Decomposition and Sparse Table Algorithm.""" def simple_s...
stack_v2_sparse_classes_36k_train_007531
4,188
no_license
[ { "docstring": "A simple solution is to iterate and compare each elements from qs to qe. Time complexity is O(n) in worst case, and space complexity is O(1).", "name": "simple_solution", "signature": "def simple_solution(cls, arr, qs, qe)" }, { "docstring": "The solution uses a table to store th...
5
stack_v2_sparse_classes_30k_train_012477
Implement the Python class `RangeMinimumQuery` described below. Class description: Given an array of integer numbers, find the minimum value from a specified range from qs to qe. In total, there are 5 approaches to RMQ question. Here 3 of them are given. The other two algorithms are Square Root Decomposition and Spars...
Implement the Python class `RangeMinimumQuery` described below. Class description: Given an array of integer numbers, find the minimum value from a specified range from qs to qe. In total, there are 5 approaches to RMQ question. Here 3 of them are given. The other two algorithms are Square Root Decomposition and Spars...
cbe6a7e7f05eccb4f9c5fce8651c0d87e5168516
<|skeleton|> class RangeMinimumQuery: """Given an array of integer numbers, find the minimum value from a specified range from qs to qe. In total, there are 5 approaches to RMQ question. Here 3 of them are given. The other two algorithms are Square Root Decomposition and Sparse Table Algorithm.""" def simple_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RangeMinimumQuery: """Given an array of integer numbers, find the minimum value from a specified range from qs to qe. In total, there are 5 approaches to RMQ question. Here 3 of them are given. The other two algorithms are Square Root Decomposition and Sparse Table Algorithm.""" def simple_solution(cls, ...
the_stack_v2_python_sparse
src/array/RangeMinimumQuery.py
apepkuss/Cracking-Leetcode-in-Python
train
2
58a8b03777c5771f9c0479a0f92d5892c8b1e392
[ "super(SingleTaskStudent, self).__init__()\nif kwargs['language_model_type'] == 'bilstm':\n self.languageModel = BiLSTM(h_dim=kwargs['h_dim_l'], o_dim=kwargs['o_dim_l'], d_prob=kwargs['d_prob_l'], with_self_att=kwargs['with_self_att'], d_dim=kwargs['d_dim_l'], r_dim=kwargs['r_dim_l'], num_layers=kwargs['num_laye...
<|body_start_0|> super(SingleTaskStudent, self).__init__() if kwargs['language_model_type'] == 'bilstm': self.languageModel = BiLSTM(h_dim=kwargs['h_dim_l'], o_dim=kwargs['o_dim_l'], d_prob=kwargs['d_prob_l'], with_self_att=kwargs['with_self_att'], d_dim=kwargs['d_dim_l'], r_dim=kwargs['r_di...
Student takes langauge as input, develops a representation of the language and input stimulus, concatenates these representations together, and produces logits for the probability that the given stimulus belongs to the class described by the language.
SingleTaskStudent
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SingleTaskStudent: """Student takes langauge as input, develops a representation of the language and input stimulus, concatenates these representations together, and produces logits for the probability that the given stimulus belongs to the class described by the language.""" def __init__(se...
stack_v2_sparse_classes_36k_train_007532
3,199
no_license
[ { "docstring": "@param **kwargs: parameters associated with initializing the language model and the stimulus model.", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "x1: language (describing concept) x2: stimulus (from test set) x1_lengths: true lengths of text...
2
stack_v2_sparse_classes_30k_train_004268
Implement the Python class `SingleTaskStudent` described below. Class description: Student takes langauge as input, develops a representation of the language and input stimulus, concatenates these representations together, and produces logits for the probability that the given stimulus belongs to the class described b...
Implement the Python class `SingleTaskStudent` described below. Class description: Student takes langauge as input, develops a representation of the language and input stimulus, concatenates these representations together, and produces logits for the probability that the given stimulus belongs to the class described b...
2dca3ba909078739b49468ea8b772f346710d60b
<|skeleton|> class SingleTaskStudent: """Student takes langauge as input, develops a representation of the language and input stimulus, concatenates these representations together, and produces logits for the probability that the given stimulus belongs to the class described by the language.""" def __init__(se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SingleTaskStudent: """Student takes langauge as input, develops a representation of the language and input stimulus, concatenates these representations together, and produces logits for the probability that the given stimulus belongs to the class described by the language.""" def __init__(self, **kwargs)...
the_stack_v2_python_sparse
models/student/lfl/single_task_student.py
cocolab-projects/concept-captioning
train
0
60f20bb4d7b7964ceca30bd694f06e3681d15528
[ "neighbors = {}\nencoder = _IntegerEncoder()\nn_entries = len(table)\nfor n, (sequence, value) in enumerate(table.items()):\n if n % 1000000 == 0 or (n < 1000000 and n % 100000 == 0):\n logging.info('loading ScaM results %r/%r', n, n_entries)\n neighbor_sequences = [neighbor.docid for neighbor in value...
<|body_start_0|> neighbors = {} encoder = _IntegerEncoder() n_entries = len(table) for n, (sequence, value) in enumerate(table.items()): if n % 1000000 == 0 or (n < 1000000 and n % 100000 == 0): logging.info('loading ScaM results %r/%r', n, n_entries) ...
Matcher that uses pre-computed lookup tables generated by ScaM.
ScaMMatcher
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScaMMatcher: """Matcher that uses pre-computed lookup tables generated by ScaM.""" def __init__(self, table, dtype='u4'): """Initialize as ScaMMatcher. Args: table: Mapping[str, result_pb2.NearestNeighbor] mapping each sequence to all of its (approximate) neighbors within some fixed ...
stack_v2_sparse_classes_36k_train_007533
19,209
permissive
[ { "docstring": "Initialize as ScaMMatcher. Args: table: Mapping[str, result_pb2.NearestNeighbor] mapping each sequence to all of its (approximate) neighbors within some fixed edit distance. dtype: optional object convertable to numpy.dtype to use for storing positive integer IDs. Raises: ValueError: if dtype wa...
3
stack_v2_sparse_classes_30k_train_010167
Implement the Python class `ScaMMatcher` described below. Class description: Matcher that uses pre-computed lookup tables generated by ScaM. Method signatures and docstrings: - def __init__(self, table, dtype='u4'): Initialize as ScaMMatcher. Args: table: Mapping[str, result_pb2.NearestNeighbor] mapping each sequence...
Implement the Python class `ScaMMatcher` described below. Class description: Matcher that uses pre-computed lookup tables generated by ScaM. Method signatures and docstrings: - def __init__(self, table, dtype='u4'): Initialize as ScaMMatcher. Args: table: Mapping[str, result_pb2.NearestNeighbor] mapping each sequence...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class ScaMMatcher: """Matcher that uses pre-computed lookup tables generated by ScaM.""" def __init__(self, table, dtype='u4'): """Initialize as ScaMMatcher. Args: table: Mapping[str, result_pb2.NearestNeighbor] mapping each sequence to all of its (approximate) neighbors within some fixed ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ScaMMatcher: """Matcher that uses pre-computed lookup tables generated by ScaM.""" def __init__(self, table, dtype='u4'): """Initialize as ScaMMatcher. Args: table: Mapping[str, result_pb2.NearestNeighbor] mapping each sequence to all of its (approximate) neighbors within some fixed edit distance...
the_stack_v2_python_sparse
aptamers_mlpd/preprocess/clustering.py
Jimmy-INL/google-research
train
1
fe8540e1f9cd1760caa9b891945d32cb652b2039
[ "given = [[9, 8, 7, 6, 5, 4, 3, 2, 1, 0], [4, 1, 2, 1, 2, 4, 1, 2, 1, 4, 1], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [random.randrange(0, 10) for _ in range(10)], [random.randrange(0, 10) for _ in range(1000)], [random.randrange(0, 1000) for _ in range(1000)], [random.randrange(0, 100) for _ in range(10 ** 5)], [random.ran...
<|body_start_0|> given = [[9, 8, 7, 6, 5, 4, 3, 2, 1, 0], [4, 1, 2, 1, 2, 4, 1, 2, 1, 4, 1], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [random.randrange(0, 10) for _ in range(10)], [random.randrange(0, 10) for _ in range(1000)], [random.randrange(0, 1000) for _ in range(1000)], [random.randrange(0, 100) for _ in range(10...
Test the quick sort function
TestQuickSort
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestQuickSort: """Test the quick sort function""" def test_quick_sort_median(self): """Test the quick sort function for various cases. Should match the results of Python's sort func.""" <|body_0|> def test_quick_sort_simple(self): """Test the quick sort function ...
stack_v2_sparse_classes_36k_train_007534
3,778
no_license
[ { "docstring": "Test the quick sort function for various cases. Should match the results of Python's sort func.", "name": "test_quick_sort_median", "signature": "def test_quick_sort_median(self)" }, { "docstring": "Test the quick sort function for various cases. This test case uses the 'simple' ...
2
stack_v2_sparse_classes_30k_train_003656
Implement the Python class `TestQuickSort` described below. Class description: Test the quick sort function Method signatures and docstrings: - def test_quick_sort_median(self): Test the quick sort function for various cases. Should match the results of Python's sort func. - def test_quick_sort_simple(self): Test the...
Implement the Python class `TestQuickSort` described below. Class description: Test the quick sort function Method signatures and docstrings: - def test_quick_sort_median(self): Test the quick sort function for various cases. Should match the results of Python's sort func. - def test_quick_sort_simple(self): Test the...
0e8b528207faa44977f5b9d446d45d13c4fb430d
<|skeleton|> class TestQuickSort: """Test the quick sort function""" def test_quick_sort_median(self): """Test the quick sort function for various cases. Should match the results of Python's sort func.""" <|body_0|> def test_quick_sort_simple(self): """Test the quick sort function ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestQuickSort: """Test the quick sort function""" def test_quick_sort_median(self): """Test the quick sort function for various cases. Should match the results of Python's sort func.""" given = [[9, 8, 7, 6, 5, 4, 3, 2, 1, 0], [4, 1, 2, 1, 2, 4, 1, 2, 1, 4, 1], [0, 1, 2, 3, 4, 5, 6, 7, 8,...
the_stack_v2_python_sparse
__test__/quick_sort_test.py
marcus-grant/python-cs
train
0
da9ae6207c659f85d42aa5bf7811fa3e74720908
[ "self.host = host\nself.port = port\nself.user = user\nself.password = password\nself.database = database", "try:\n connection = connector.connect(host=self.host, port=self.port, user=self.user, password=self.password, database=self.database, use_pure=True)\n cursor = connection.cursor()\n cursor.execute...
<|body_start_0|> self.host = host self.port = port self.user = user self.password = password self.database = database <|end_body_0|> <|body_start_1|> try: connection = connector.connect(host=self.host, port=self.port, user=self.user, password=self.password, d...
MySqlHelper
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MySqlHelper: def __init__(self, host, port, user, password, database): """[summary]: Constructor Args: host ([type]): [description] port ([type]): [description] user ([type]): [description] password ([type]): [description] database ([type]): [description]""" <|body_0|> def f...
stack_v2_sparse_classes_36k_train_007535
4,113
permissive
[ { "docstring": "[summary]: Constructor Args: host ([type]): [description] port ([type]): [description] user ([type]): [description] password ([type]): [description] database ([type]): [description]", "name": "__init__", "signature": "def __init__(self, host, port, user, password, database)" }, { ...
5
stack_v2_sparse_classes_30k_train_015797
Implement the Python class `MySqlHelper` described below. Class description: Implement the MySqlHelper class. Method signatures and docstrings: - def __init__(self, host, port, user, password, database): [summary]: Constructor Args: host ([type]): [description] port ([type]): [description] user ([type]): [description...
Implement the Python class `MySqlHelper` described below. Class description: Implement the MySqlHelper class. Method signatures and docstrings: - def __init__(self, host, port, user, password, database): [summary]: Constructor Args: host ([type]): [description] port ([type]): [description] user ([type]): [description...
8332485421b04120924d4640d221f40cacb78741
<|skeleton|> class MySqlHelper: def __init__(self, host, port, user, password, database): """[summary]: Constructor Args: host ([type]): [description] port ([type]): [description] user ([type]): [description] password ([type]): [description] database ([type]): [description]""" <|body_0|> def f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MySqlHelper: def __init__(self, host, port, user, password, database): """[summary]: Constructor Args: host ([type]): [description] port ([type]): [description] user ([type]): [description] password ([type]): [description] database ([type]): [description]""" self.host = host self.port ...
the_stack_v2_python_sparse
src/utils/mysql_helper.py
Supreeth-Shetty/neuro-data
train
0
d6f49ba349e6f5ebe4536c845bad0af64518df0a
[ "if directory == None:\n directory = Settings.Settings().data_directory + '\\\\GlobalWarming'\nif not directory.endswith('\\\\'):\n directory += '\\\\'\nself.directory = directory\nraw_lines = self.__loadLines__('CodeTemplates.txt')\nlines = []\nself.codes_per_document = []\nfor l in raw_lines:\n ltrim = l...
<|body_start_0|> if directory == None: directory = Settings.Settings().data_directory + '\\GlobalWarming' if not directory.endswith('\\'): directory += '\\' self.directory = directory raw_lines = self.__loadLines__('CodeTemplates.txt') lines = [] s...
Creates an object with .codes and .templates properties
GwCodeTemplates
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GwCodeTemplates: """Creates an object with .codes and .templates properties""" def __init__(self, directory=None): """Constructor""" <|body_0|> def __loadLines__(self, fName): """Loads lines from a file and returns as a list file => []""" <|body_1|> <|en...
stack_v2_sparse_classes_36k_train_007536
1,896
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, directory=None)" }, { "docstring": "Loads lines from a file and returns as a list file => []", "name": "__loadLines__", "signature": "def __loadLines__(self, fName)" } ]
2
null
Implement the Python class `GwCodeTemplates` described below. Class description: Creates an object with .codes and .templates properties Method signatures and docstrings: - def __init__(self, directory=None): Constructor - def __loadLines__(self, fName): Loads lines from a file and returns as a list file => []
Implement the Python class `GwCodeTemplates` described below. Class description: Creates an object with .codes and .templates properties Method signatures and docstrings: - def __init__(self, directory=None): Constructor - def __loadLines__(self, fName): Loads lines from a file and returns as a list file => [] <|ske...
2bc2914ce93fcef6dbd26f8097eec20b7d0e476d
<|skeleton|> class GwCodeTemplates: """Creates an object with .codes and .templates properties""" def __init__(self, directory=None): """Constructor""" <|body_0|> def __loadLines__(self, fName): """Loads lines from a file and returns as a list file => []""" <|body_1|> <|en...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GwCodeTemplates: """Creates an object with .codes and .templates properties""" def __init__(self, directory=None): """Constructor""" if directory == None: directory = Settings.Settings().data_directory + '\\GlobalWarming' if not directory.endswith('\\'): di...
the_stack_v2_python_sparse
Data/GlobalWarming/GwCodeTemplates.py
simonhughes22/PythonNlpResearch
train
17
6d7a2eb11cf2f14d3092f0d9a0d0d4afd66740c3
[ "super().__init__()\npadding = int((kSize - 1) / 2)\nself.conv = nn.Conv2d(nIn, nOut, (kSize, kSize), stride=stride, padding=(padding, padding), bias=False)\nself.bn = nn.BatchNorm2d(nOut, eps=0.001)\nself.act = nn.PReLU(nOut)", "output = self.conv(input)\noutput = self.bn(output)\noutput = self.act(output)\nretu...
<|body_start_0|> super().__init__() padding = int((kSize - 1) / 2) self.conv = nn.Conv2d(nIn, nOut, (kSize, kSize), stride=stride, padding=(padding, padding), bias=False) self.bn = nn.BatchNorm2d(nOut, eps=0.001) self.act = nn.PReLU(nOut) <|end_body_0|> <|body_start_1|> ...
This class defines the convolution layer with batch normalization and PReLU activation
CBR
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CBR: """This class defines the convolution layer with batch normalization and PReLU activation""" def __init__(self, nIn, nOut, kSize, stride=1): """:param nIn: number of input channels :param nOut: number of output channels :param kSize: kernel size :param stride: stride rate for do...
stack_v2_sparse_classes_36k_train_007537
15,567
permissive
[ { "docstring": ":param nIn: number of input channels :param nOut: number of output channels :param kSize: kernel size :param stride: stride rate for down-sampling. Default is 1", "name": "__init__", "signature": "def __init__(self, nIn, nOut, kSize, stride=1)" }, { "docstring": ":param input: in...
2
null
Implement the Python class `CBR` described below. Class description: This class defines the convolution layer with batch normalization and PReLU activation Method signatures and docstrings: - def __init__(self, nIn, nOut, kSize, stride=1): :param nIn: number of input channels :param nOut: number of output channels :p...
Implement the Python class `CBR` described below. Class description: This class defines the convolution layer with batch normalization and PReLU activation Method signatures and docstrings: - def __init__(self, nIn, nOut, kSize, stride=1): :param nIn: number of input channels :param nOut: number of output channels :p...
f2993d3ce73a2f7ddba05da3891defb08547d504
<|skeleton|> class CBR: """This class defines the convolution layer with batch normalization and PReLU activation""" def __init__(self, nIn, nOut, kSize, stride=1): """:param nIn: number of input channels :param nOut: number of output channels :param kSize: kernel size :param stride: stride rate for do...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CBR: """This class defines the convolution layer with batch normalization and PReLU activation""" def __init__(self, nIn, nOut, kSize, stride=1): """:param nIn: number of input channels :param nOut: number of output channels :param kSize: kernel size :param stride: stride rate for down-sampling. ...
the_stack_v2_python_sparse
pytorch/pytorchcv/models/others/oth_espnet.py
osmr/imgclsmob
train
3,017
4f062843b3ea012798eb29633c3484d5a82d1d8e
[ "self.d = {'0': '0', '1': '1', '6': '9', '8': '8', '9': '6'}\n\ndef dfs(half, path, n):\n if len(path) == half:\n pathStr = ''.join(path)\n if half * 2 == n:\n toAppend = pathStr + ''.join([self.d[x] for x in pathStr[::-1]])\n toAppendInt = int(toAppend)\n if self.l...
<|body_start_0|> self.d = {'0': '0', '1': '1', '6': '9', '8': '8', '9': '6'} def dfs(half, path, n): if len(path) == half: pathStr = ''.join(path) if half * 2 == n: toAppend = pathStr + ''.join([self.d[x] for x in pathStr[::-1]]) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findStrobogrammatic(self, n): """:type n: int :rtype: List[str]""" <|body_0|> def strobogrammaticInRange(self, low, high): """:type low: str :type high: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.d = {'0': '0'...
stack_v2_sparse_classes_36k_train_007538
1,292
no_license
[ { "docstring": ":type n: int :rtype: List[str]", "name": "findStrobogrammatic", "signature": "def findStrobogrammatic(self, n)" }, { "docstring": ":type low: str :type high: str :rtype: int", "name": "strobogrammaticInRange", "signature": "def strobogrammaticInRange(self, low, high)" }...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findStrobogrammatic(self, n): :type n: int :rtype: List[str] - def strobogrammaticInRange(self, low, high): :type low: str :type high: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findStrobogrammatic(self, n): :type n: int :rtype: List[str] - def strobogrammaticInRange(self, low, high): :type low: str :type high: str :rtype: int <|skeleton|> class Sol...
929dde1723fb2f54870c8a9badc80fc23e8400d3
<|skeleton|> class Solution: def findStrobogrammatic(self, n): """:type n: int :rtype: List[str]""" <|body_0|> def strobogrammaticInRange(self, low, high): """:type low: str :type high: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findStrobogrammatic(self, n): """:type n: int :rtype: List[str]""" self.d = {'0': '0', '1': '1', '6': '9', '8': '8', '9': '6'} def dfs(half, path, n): if len(path) == half: pathStr = ''.join(path) if half * 2 == n: ...
the_stack_v2_python_sparse
_algorithms_challenges/leetcode/lc-all-solutions/248.strobogrammatic-number-iii/strobogrammatic-number-iii.py
syurskyi/Algorithms_and_Data_Structure
train
4
8dc399961b337d8324ae2ef537fed33ca75f82cd
[ "super(WikiParser, self).__init__(base_url)\nself.inclusions = [doc_id] if doc_id else []\nself.registerInternalLinkHook('Include', self._hook_include)\nself.registerInternalLinkHook('I', self._hook_include)\nself.registerInternalLinkHook('Template', self._hook_template)\nself.registerInternalLinkHook('T', self._ho...
<|body_start_0|> super(WikiParser, self).__init__(base_url) self.inclusions = [doc_id] if doc_id else [] self.registerInternalLinkHook('Include', self._hook_include) self.registerInternalLinkHook('I', self._hook_include) self.registerInternalLinkHook('Template', self._hook_templa...
An extension of the parser from the forums adding more crazy features {for} tags, inclusions, and templates--oh my!
WikiParser
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WikiParser: """An extension of the parser from the forums adding more crazy features {for} tags, inclusions, and templates--oh my!""" def __init__(self, base_url=None, doc_id=None): """doc_id -- If you want to be nice, pass the ID of the Document you are rendering. This will make rec...
stack_v2_sparse_classes_36k_train_007539
19,586
permissive
[ { "docstring": "doc_id -- If you want to be nice, pass the ID of the Document you are rendering. This will make recursive inclusions fail immediately rather than after the first round of recursion.", "name": "__init__", "signature": "def __init__(self, base_url=None, doc_id=None)" }, { "docstrin...
4
stack_v2_sparse_classes_30k_train_015292
Implement the Python class `WikiParser` described below. Class description: An extension of the parser from the forums adding more crazy features {for} tags, inclusions, and templates--oh my! Method signatures and docstrings: - def __init__(self, base_url=None, doc_id=None): doc_id -- If you want to be nice, pass the...
Implement the Python class `WikiParser` described below. Class description: An extension of the parser from the forums adding more crazy features {for} tags, inclusions, and templates--oh my! Method signatures and docstrings: - def __init__(self, base_url=None, doc_id=None): doc_id -- If you want to be nice, pass the...
67ec527bfc32c715bf9f29d5e01362c4903aebd2
<|skeleton|> class WikiParser: """An extension of the parser from the forums adding more crazy features {for} tags, inclusions, and templates--oh my!""" def __init__(self, base_url=None, doc_id=None): """doc_id -- If you want to be nice, pass the ID of the Document you are rendering. This will make rec...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WikiParser: """An extension of the parser from the forums adding more crazy features {for} tags, inclusions, and templates--oh my!""" def __init__(self, base_url=None, doc_id=None): """doc_id -- If you want to be nice, pass the ID of the Document you are rendering. This will make recursive inclus...
the_stack_v2_python_sparse
kitsune/wiki/parser.py
mozilla/kitsune
train
1,218
77c0634663d0a59ecd54f2326c60e5f7402067ec
[ "LOGGER.debug('Updating %r: %r', record.key, record.dict())\nfor source in self:\n await source.update(record)", "for source in self:\n async for record in source.records():\n for other_source in self.data[1:]:\n record.merge(await other_source.record(record.key))\n if validation is...
<|body_start_0|> LOGGER.debug('Updating %r: %r', record.key, record.dict()) for source in self: await source.update(record) <|end_body_0|> <|body_start_1|> for source in self: async for record in source.records(): for other_source in self.data[1:]: ...
SourcesContext
[ "MIT", "LicenseRef-scancode-generic-export-compliance" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SourcesContext: async def update(self, record: Record): """Updates a record for a source""" <|body_0|> async def records(self, validation: Optional[Callable[[Record], bool]]=None) -> AsyncIterator[Record]: """Retrieves records from all sources""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_007540
8,476
permissive
[ { "docstring": "Updates a record for a source", "name": "update", "signature": "async def update(self, record: Record)" }, { "docstring": "Retrieves records from all sources", "name": "records", "signature": "async def records(self, validation: Optional[Callable[[Record], bool]]=None) ->...
4
null
Implement the Python class `SourcesContext` described below. Class description: Implement the SourcesContext class. Method signatures and docstrings: - async def update(self, record: Record): Updates a record for a source - async def records(self, validation: Optional[Callable[[Record], bool]]=None) -> AsyncIterator[...
Implement the Python class `SourcesContext` described below. Class description: Implement the SourcesContext class. Method signatures and docstrings: - async def update(self, record: Record): Updates a record for a source - async def records(self, validation: Optional[Callable[[Record], bool]]=None) -> AsyncIterator[...
7d381bf67a72fe1ecb1012393d5726085564cb0e
<|skeleton|> class SourcesContext: async def update(self, record: Record): """Updates a record for a source""" <|body_0|> async def records(self, validation: Optional[Callable[[Record], bool]]=None) -> AsyncIterator[Record]: """Retrieves records from all sources""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SourcesContext: async def update(self, record: Record): """Updates a record for a source""" LOGGER.debug('Updating %r: %r', record.key, record.dict()) for source in self: await source.update(record) async def records(self, validation: Optional[Callable[[Record], bool]]...
the_stack_v2_python_sparse
dffml/source/source.py
intel/dffml
train
237
7628fce98bfabf0f71ab59c7dc6ef468947e416f
[ "if not len(matrix) or not len(matrix[0]):\n return False\nm, n = (len(matrix), len(matrix[0]))\nr, c = (0, n - 1)\nwhile r < m and c >= 0:\n if matrix[r][c] == target:\n return True\n elif matrix[r][c] > target:\n c -= 1\n else:\n r += 1\nreturn False", "if not len(matrix) or not...
<|body_start_0|> if not len(matrix) or not len(matrix[0]): return False m, n = (len(matrix), len(matrix[0])) r, c = (0, n - 1) while r < m and c >= 0: if matrix[r][c] == target: return True elif matrix[r][c] > target: c ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def searchMatrix(self, matrix, target): """:type matrix: List[List[int]] :type target: int :rtype: bool""" <|body_0|> def searchMatrix_v1(self, matrix, target): """:type matrix: List[List[int]] :type target: int :rtype: bool""" <|body_1|> def s...
stack_v2_sparse_classes_36k_train_007541
6,291
no_license
[ { "docstring": ":type matrix: List[List[int]] :type target: int :rtype: bool", "name": "searchMatrix", "signature": "def searchMatrix(self, matrix, target)" }, { "docstring": ":type matrix: List[List[int]] :type target: int :rtype: bool", "name": "searchMatrix_v1", "signature": "def sear...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchMatrix(self, matrix, target): :type matrix: List[List[int]] :type target: int :rtype: bool - def searchMatrix_v1(self, matrix, target): :type matrix: List[List[int]] :t...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchMatrix(self, matrix, target): :type matrix: List[List[int]] :type target: int :rtype: bool - def searchMatrix_v1(self, matrix, target): :type matrix: List[List[int]] :t...
b5e09f24e8e96454dc99e20281e853fb9fcc85ed
<|skeleton|> class Solution: def searchMatrix(self, matrix, target): """:type matrix: List[List[int]] :type target: int :rtype: bool""" <|body_0|> def searchMatrix_v1(self, matrix, target): """:type matrix: List[List[int]] :type target: int :rtype: bool""" <|body_1|> def s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def searchMatrix(self, matrix, target): """:type matrix: List[List[int]] :type target: int :rtype: bool""" if not len(matrix) or not len(matrix[0]): return False m, n = (len(matrix), len(matrix[0])) r, c = (0, n - 1) while r < m and c >= 0: ...
the_stack_v2_python_sparse
python/240_Search_a_2D_Matrix_II.py
Moby5/myleetcode
train
2
357afb0935bf369f97134a252697ba05bb117e23
[ "if isinstance(value, dict):\n value = json.dumps(value)\nself.map[key] = value", "try:\n for key_, value_ in keys.items():\n self.map[key_] = str(value_)\n print(key_ + ':' + str(value_))\nexcept BaseException as msg:\n print(msg)\n raise msg", "try:\n del self.map[key]\n return...
<|body_start_0|> if isinstance(value, dict): value = json.dumps(value) self.map[key] = value <|end_body_0|> <|body_start_1|> try: for key_, value_ in keys.items(): self.map[key_] = str(value_) print(key_ + ':' + str(value_)) except...
拼装成字典构造全局变量 借鉴map 包含变量的增删改查 各参数说明 luaDriver:公共drvier,初始化时创建的driver
GlobalVars
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GlobalVars: """拼装成字典构造全局变量 借鉴map 包含变量的增删改查 各参数说明 luaDriver:公共drvier,初始化时创建的driver""" def set_map(self, key, value): """设置单一变量值 :param key:变量名 :param value:变量值 :return:""" <|body_0|> def set(self, **keys): """设置多个变量 key-value :param keys: :return:""" <|bod...
stack_v2_sparse_classes_36k_train_007542
1,778
no_license
[ { "docstring": "设置单一变量值 :param key:变量名 :param value:变量值 :return:", "name": "set_map", "signature": "def set_map(self, key, value)" }, { "docstring": "设置多个变量 key-value :param keys: :return:", "name": "set", "signature": "def set(self, **keys)" }, { "docstring": "删除key对应值 :param ke...
4
stack_v2_sparse_classes_30k_test_000346
Implement the Python class `GlobalVars` described below. Class description: 拼装成字典构造全局变量 借鉴map 包含变量的增删改查 各参数说明 luaDriver:公共drvier,初始化时创建的driver Method signatures and docstrings: - def set_map(self, key, value): 设置单一变量值 :param key:变量名 :param value:变量值 :return: - def set(self, **keys): 设置多个变量 key-value :param keys: :ret...
Implement the Python class `GlobalVars` described below. Class description: 拼装成字典构造全局变量 借鉴map 包含变量的增删改查 各参数说明 luaDriver:公共drvier,初始化时创建的driver Method signatures and docstrings: - def set_map(self, key, value): 设置单一变量值 :param key:变量名 :param value:变量值 :return: - def set(self, **keys): 设置多个变量 key-value :param keys: :ret...
edc19480c3e94cbcbf004aa9d20099ec6d1b9304
<|skeleton|> class GlobalVars: """拼装成字典构造全局变量 借鉴map 包含变量的增删改查 各参数说明 luaDriver:公共drvier,初始化时创建的driver""" def set_map(self, key, value): """设置单一变量值 :param key:变量名 :param value:变量值 :return:""" <|body_0|> def set(self, **keys): """设置多个变量 key-value :param keys: :return:""" <|bod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GlobalVars: """拼装成字典构造全局变量 借鉴map 包含变量的增删改查 各参数说明 luaDriver:公共drvier,初始化时创建的driver""" def set_map(self, key, value): """设置单一变量值 :param key:变量名 :param value:变量值 :return:""" if isinstance(value, dict): value = json.dumps(value) self.map[key] = value def set(self, **k...
the_stack_v2_python_sparse
性能项目/德州-普通场/lua4.0/ali/src/com/globalVars.py
YiFeng0755/testcase
train
0
5ff5c10aaa745d32b60a640bd36f75a2f6afed6a
[ "if params.getboolean('Multiprocessing', 'measures'):\n logger.debug('Measuring the average fingerprint size using multiprocessing...')\n self._execute_using_multiprocessing()\nelse:\n logger.debug('Measuring the average fingerprint on a single process...')\n self._result = _compute_attribute_avg_size(s...
<|body_start_0|> if params.getboolean('Multiprocessing', 'measures'): logger.debug('Measuring the average fingerprint size using multiprocessing...') self._execute_using_multiprocessing() else: logger.debug('Measuring the average fingerprint on a single process...') ...
Measure the average fingerprint size of the attributes of a dataset.
AverageFingerprintSize
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AverageFingerprintSize: """Measure the average fingerprint size of the attributes of a dataset.""" def execute(self): """Measure the average fingerprint size of the attributes.""" <|body_0|> def _execute_using_multiprocessing(self): """Measure the average fingerp...
stack_v2_sparse_classes_36k_train_007543
5,221
permissive
[ { "docstring": "Measure the average fingerprint size of the attributes.", "name": "execute", "signature": "def execute(self)" }, { "docstring": "Measure the average fingerprint size using multiprocessing.", "name": "_execute_using_multiprocessing", "signature": "def _execute_using_multip...
3
stack_v2_sparse_classes_30k_train_011724
Implement the Python class `AverageFingerprintSize` described below. Class description: Measure the average fingerprint size of the attributes of a dataset. Method signatures and docstrings: - def execute(self): Measure the average fingerprint size of the attributes. - def _execute_using_multiprocessing(self): Measur...
Implement the Python class `AverageFingerprintSize` described below. Class description: Measure the average fingerprint size of the attributes of a dataset. Method signatures and docstrings: - def execute(self): Measure the average fingerprint size of the attributes. - def _execute_using_multiprocessing(self): Measur...
b687a356acc813d45dbaf5b5eb0f360df181904a
<|skeleton|> class AverageFingerprintSize: """Measure the average fingerprint size of the attributes of a dataset.""" def execute(self): """Measure the average fingerprint size of the attributes.""" <|body_0|> def _execute_using_multiprocessing(self): """Measure the average fingerp...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AverageFingerprintSize: """Measure the average fingerprint size of the attributes of a dataset.""" def execute(self): """Measure the average fingerprint size of the attributes.""" if params.getboolean('Multiprocessing', 'measures'): logger.debug('Measuring the average fingerpr...
the_stack_v2_python_sparse
brfast/measures/usability_cost/memory.py
trinhvanvuong/BrFAST
train
0
1f2011aa16b4793522f6d81e1fd09a5007f0b3c4
[ "if not root:\n return ''\nqueue = deque()\nqueue.append(root)\nresult = ''\nwhile queue:\n node = queue.popleft()\n if node:\n result += str(node.val) + ','\n queue.append(node.left)\n queue.append(node.right)\n else:\n result += '#,'\nresult = result[:-1]\nreturn result", ...
<|body_start_0|> if not root: return '' queue = deque() queue.append(root) result = '' while queue: node = queue.popleft() if node: result += str(node.val) + ',' queue.append(node.left) queue.appe...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_007544
2,640
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_001410
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
b62862b90886f85c33271b881ac1365871731dcc
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return '' queue = deque() queue.append(root) result = '' while queue: node = queue.popleft() if node: ...
the_stack_v2_python_sparse
serialize_tree.py
ashutosh-narkar/LeetCode
train
0
2710effbac552ef12ecfc8ad7d45104b25f771a6
[ "self.drizzle_params = drizzle_params.copy()\nself.mult_drizzle_par = mult_drizzle_par.copy()\nself.cont_info = cont_info\nself.opt_extr = opt_extr\nself.back = back\nif drztmp_dir != None:\n self.drztmp_dir = drztmp_dir\nelse:\n self.drztmp_dir = axeutils.getDRZTMP()\nif drizzle_dir != None:\n self.drizzl...
<|body_start_0|> self.drizzle_params = drizzle_params.copy() self.mult_drizzle_par = mult_drizzle_par.copy() self.cont_info = cont_info self.opt_extr = opt_extr self.back = back if drztmp_dir != None: self.drztmp_dir = drztmp_dir else: self...
List class for all objects to be drizzled
MulDrzObjList
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MulDrzObjList: """List class for all objects to be drizzled""" def __init__(self, drizzle_params, mult_drizzle_par, cont_info=None, opt_extr=False, back=False, drztmp_dir=None, drizzle_dir=None): """Initializes the class""" <|body_0|> def _objlist_to_drzobjects(self, obj...
stack_v2_sparse_classes_36k_train_007545
10,632
permissive
[ { "docstring": "Initializes the class", "name": "__init__", "signature": "def __init__(self, drizzle_params, mult_drizzle_par, cont_info=None, opt_extr=False, back=False, drztmp_dir=None, drizzle_dir=None)" }, { "docstring": "Converts the object list into drizzle objects", "name": "_objlist_...
4
stack_v2_sparse_classes_30k_train_012702
Implement the Python class `MulDrzObjList` described below. Class description: List class for all objects to be drizzled Method signatures and docstrings: - def __init__(self, drizzle_params, mult_drizzle_par, cont_info=None, opt_extr=False, back=False, drztmp_dir=None, drizzle_dir=None): Initializes the class - def ...
Implement the Python class `MulDrzObjList` described below. Class description: List class for all objects to be drizzled Method signatures and docstrings: - def __init__(self, drizzle_params, mult_drizzle_par, cont_info=None, opt_extr=False, back=False, drztmp_dir=None, drizzle_dir=None): Initializes the class - def ...
043c173fd5497c18c2b1bfe8bcff65180bca3996
<|skeleton|> class MulDrzObjList: """List class for all objects to be drizzled""" def __init__(self, drizzle_params, mult_drizzle_par, cont_info=None, opt_extr=False, back=False, drztmp_dir=None, drizzle_dir=None): """Initializes the class""" <|body_0|> def _objlist_to_drzobjects(self, obj...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MulDrzObjList: """List class for all objects to be drizzled""" def __init__(self, drizzle_params, mult_drizzle_par, cont_info=None, opt_extr=False, back=False, drztmp_dir=None, drizzle_dir=None): """Initializes the class""" self.drizzle_params = drizzle_params.copy() self.mult_dri...
the_stack_v2_python_sparse
stsdas/pkg/analysis/slitless/axe/axesrc/mdrzobjects.py
spacetelescope/stsdas_stripped
train
1
dad5f17927bee8733466622e63b95b0cda7948f5
[ "self.continuous_schedule = continuous_schedule\nself.daily_schedule = daily_schedule\nself.monthly_schedule = monthly_schedule\nself.name = name\nself.num_days_to_keep = num_days_to_keep\nself.num_retries = num_retries\nself.one_off_schedule = one_off_schedule\nself.periodicity = periodicity\nself.retry_delay_mins...
<|body_start_0|> self.continuous_schedule = continuous_schedule self.daily_schedule = daily_schedule self.monthly_schedule = monthly_schedule self.name = name self.num_days_to_keep = num_days_to_keep self.num_retries = num_retries self.one_off_schedule = one_off_s...
Implementation of the 'BackupPolicyProto' model. If a backup does not get a chance to when it's due (either due to the system being busy or a conflict with another instance of the same job), the backup will still be run when the conflicts go away. But, if there are multiple instances of the same job that are due to be ...
BackupPolicyProto
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BackupPolicyProto: """Implementation of the 'BackupPolicyProto' model. If a backup does not get a chance to when it's due (either due to the system being busy or a conflict with another instance of the same job), the backup will still be run when the conflicts go away. But, if there are multiple ...
stack_v2_sparse_classes_36k_train_007546
7,222
permissive
[ { "docstring": "Constructor for the BackupPolicyProto class", "name": "__init__", "signature": "def __init__(self, continuous_schedule=None, daily_schedule=None, monthly_schedule=None, name=None, num_days_to_keep=None, num_retries=None, one_off_schedule=None, periodicity=None, retry_delay_mins=None, sch...
2
null
Implement the Python class `BackupPolicyProto` described below. Class description: Implementation of the 'BackupPolicyProto' model. If a backup does not get a chance to when it's due (either due to the system being busy or a conflict with another instance of the same job), the backup will still be run when the conflic...
Implement the Python class `BackupPolicyProto` described below. Class description: Implementation of the 'BackupPolicyProto' model. If a backup does not get a chance to when it's due (either due to the system being busy or a conflict with another instance of the same job), the backup will still be run when the conflic...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class BackupPolicyProto: """Implementation of the 'BackupPolicyProto' model. If a backup does not get a chance to when it's due (either due to the system being busy or a conflict with another instance of the same job), the backup will still be run when the conflicts go away. But, if there are multiple ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BackupPolicyProto: """Implementation of the 'BackupPolicyProto' model. If a backup does not get a chance to when it's due (either due to the system being busy or a conflict with another instance of the same job), the backup will still be run when the conflicts go away. But, if there are multiple instances of ...
the_stack_v2_python_sparse
cohesity_management_sdk/models/backup_policy_proto.py
cohesity/management-sdk-python
train
24
32a311abc2bd003adb0748b6219b1878599289b4
[ "if issubclass(type(val), Vector):\n xyz = (val.x, val.y, val.z)\n return ' '.join((str(x) for x in xyz))\nelif not isinstance(val, str) and isinstance(val, Iterable):\n return ' '.join((str(x) for x in val))\nelse:\n return str(val)", "assert self.__class__.TAG is not None or root_el is not None, 'Xm...
<|body_start_0|> if issubclass(type(val), Vector): xyz = (val.x, val.y, val.z) return ' '.join((str(x) for x in xyz)) elif not isinstance(val, str) and isinstance(val, Iterable): return ' '.join((str(x) for x in val)) else: return str(val) <|end_bo...
Base class for all urdf xml objects.
XmlObject
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class XmlObject: """Base class for all urdf xml objects.""" def _get_val(self, val: Any) -> str: """Convert a value to a string that is included into the xml.""" <|body_0|> def create_xml(self, root_el: cET.Element=None) -> cET.Element: """Convert this instance into a ...
stack_v2_sparse_classes_36k_train_007547
5,284
permissive
[ { "docstring": "Convert a value to a string that is included into the xml.", "name": "_get_val", "signature": "def _get_val(self, val: Any) -> str" }, { "docstring": "Convert this instance into a xml element. * If the class of this instance does not define a tag, new xml elements from this insta...
3
null
Implement the Python class `XmlObject` described below. Class description: Base class for all urdf xml objects. Method signatures and docstrings: - def _get_val(self, val: Any) -> str: Convert a value to a string that is included into the xml. - def create_xml(self, root_el: cET.Element=None) -> cET.Element: Convert ...
Implement the Python class `XmlObject` described below. Class description: Base class for all urdf xml objects. Method signatures and docstrings: - def _get_val(self, val: Any) -> str: Convert a value to a string that is included into the xml. - def create_xml(self, root_el: cET.Element=None) -> cET.Element: Convert ...
8a9438b5a24c288721ae0302889fe55e26046310
<|skeleton|> class XmlObject: """Base class for all urdf xml objects.""" def _get_val(self, val: Any) -> str: """Convert a value to a string that is included into the xml.""" <|body_0|> def create_xml(self, root_el: cET.Element=None) -> cET.Element: """Convert this instance into a ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class XmlObject: """Base class for all urdf xml objects.""" def _get_val(self, val: Any) -> str: """Convert a value to a string that is included into the xml.""" if issubclass(type(val), Vector): xyz = (val.x, val.y, val.z) return ' '.join((str(x) for x in xyz)) ...
the_stack_v2_python_sparse
simulation/utils/urdf/core.py
KITcar-Team/kitcar-gazebo-simulation
train
19
f04a87ecd97e496d1c08f7773c7828cd31a7b949
[ "super().__init__()\nself.conv1 = nn.Conv3d(1, 96, kernel_size=(7, 7, 7), stride=2, padding=(3, 3, 3))\nself.bn1 = nn.BatchNorm3d(96)\nself.relu = nn.ReLU()\nself.maxpool1 = nn.MaxPool3d(kernel_size=(3, 3, 3), stride=2, padding=(1, 1, 1))\nself.transition = TransitionBlock(32)\nself.dense1 = DenseBlock(96, 128, 32,...
<|body_start_0|> super().__init__() self.conv1 = nn.Conv3d(1, 96, kernel_size=(7, 7, 7), stride=2, padding=(3, 3, 3)) self.bn1 = nn.BatchNorm3d(96) self.relu = nn.ReLU() self.maxpool1 = nn.MaxPool3d(kernel_size=(3, 3, 3), stride=2, padding=(1, 1, 1)) self.transition = Tra...
DenseUNet3d
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DenseUNet3d: def __init__(self): """Create the layers for the model""" <|body_0|> def forward(self, x: torch.Tensor) -> torch.Tensor: """Forward pass through the model :param x: image tensor :return: output of the forward pass""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_36k_train_007548
2,341
no_license
[ { "docstring": "Create the layers for the model", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Forward pass through the model :param x: image tensor :return: output of the forward pass", "name": "forward", "signature": "def forward(self, x: torch.Tensor) -> to...
2
stack_v2_sparse_classes_30k_train_007278
Implement the Python class `DenseUNet3d` described below. Class description: Implement the DenseUNet3d class. Method signatures and docstrings: - def __init__(self): Create the layers for the model - def forward(self, x: torch.Tensor) -> torch.Tensor: Forward pass through the model :param x: image tensor :return: out...
Implement the Python class `DenseUNet3d` described below. Class description: Implement the DenseUNet3d class. Method signatures and docstrings: - def __init__(self): Create the layers for the model - def forward(self, x: torch.Tensor) -> torch.Tensor: Forward pass through the model :param x: image tensor :return: out...
d3dd6310588770174e11752808b7fe4b71842220
<|skeleton|> class DenseUNet3d: def __init__(self): """Create the layers for the model""" <|body_0|> def forward(self, x: torch.Tensor) -> torch.Tensor: """Forward pass through the model :param x: image tensor :return: output of the forward pass""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DenseUNet3d: def __init__(self): """Create the layers for the model""" super().__init__() self.conv1 = nn.Conv3d(1, 96, kernel_size=(7, 7, 7), stride=2, padding=(3, 3, 3)) self.bn1 = nn.BatchNorm3d(96) self.relu = nn.ReLU() self.maxpool1 = nn.MaxPool3d(kernel_si...
the_stack_v2_python_sparse
dense_unet_3d/model/DenseUNet3d.py
NguyenJus/pytorch-dense-unet-3d
train
8
23a2efecaaee93fba349b83370d7d234e29a4885
[ "super(PFDict, self).__init__(inp)\nself.keyType = keyType\nself.valueType = valueType", "if type(key) == self.getClassFromType(self.keyType):\n super(PFDict, self).__setitem__(key, item)\nelse:\n raise Exception('Valid key should be a {0}'.format(self.getClassFromType(self.keyType)))", "pin = findPinClas...
<|body_start_0|> super(PFDict, self).__init__(inp) self.keyType = keyType self.valueType = valueType <|end_body_0|> <|body_start_1|> if type(key) == self.getClassFromType(self.keyType): super(PFDict, self).__setitem__(key, item) else: raise Exception('Val...
This subclass of python's :class:`dict` implements a key typed dictionary. Only defined data types can be used as keys, and only hashable ones as determined by >>> isinstance(dataType, collections.abc.Hashable) To make a class Hashable some methods should be implemented: Example: :: class C: def __init__(self, x): self...
PFDict
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PFDict: """This subclass of python's :class:`dict` implements a key typed dictionary. Only defined data types can be used as keys, and only hashable ones as determined by >>> isinstance(dataType, collections.abc.Hashable) To make a class Hashable some methods should be implemented: Example: :: cl...
stack_v2_sparse_classes_36k_train_007549
29,109
permissive
[ { "docstring": ":param keyType: Key dataType :param valueType: value dataType, defaults to None :type valueType: optional :param inp: Construct from another dict, defaults to {} :type inp: dict, optional", "name": "__init__", "signature": "def __init__(self, keyType, valueType='AnyPin', inp={})" }, ...
3
null
Implement the Python class `PFDict` described below. Class description: This subclass of python's :class:`dict` implements a key typed dictionary. Only defined data types can be used as keys, and only hashable ones as determined by >>> isinstance(dataType, collections.abc.Hashable) To make a class Hashable some method...
Implement the Python class `PFDict` described below. Class description: This subclass of python's :class:`dict` implements a key typed dictionary. Only defined data types can be used as keys, and only hashable ones as determined by >>> isinstance(dataType, collections.abc.Hashable) To make a class Hashable some method...
6a4445254b0024b39e1b9ce8d938748219d57fd5
<|skeleton|> class PFDict: """This subclass of python's :class:`dict` implements a key typed dictionary. Only defined data types can be used as keys, and only hashable ones as determined by >>> isinstance(dataType, collections.abc.Hashable) To make a class Hashable some methods should be implemented: Example: :: cl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PFDict: """This subclass of python's :class:`dict` implements a key typed dictionary. Only defined data types can be used as keys, and only hashable ones as determined by >>> isinstance(dataType, collections.abc.Hashable) To make a class Hashable some methods should be implemented: Example: :: class C: def __...
the_stack_v2_python_sparse
PyFlow/Core/Common.py
dlario/PyFlow
train
2
8a738aab595e384bb893fd2e95dd87db4caf6114
[ "self.rate_limit_s = max(rate_limit_s, 0)\nself.period_s = 1.0 / self.rate_limit_s if self.rate_limit_s > 0 else 0\nself.last_event = 0", "elapsed_s = time.time() - self.last_event\nsleep_amount = max(self.period_s - elapsed_s, 0)\ntime.sleep(sleep_amount)\nself.last_event = time.time()" ]
<|body_start_0|> self.rate_limit_s = max(rate_limit_s, 0) self.period_s = 1.0 / self.rate_limit_s if self.rate_limit_s > 0 else 0 self.last_event = 0 <|end_body_0|> <|body_start_1|> elapsed_s = time.time() - self.last_event sleep_amount = max(self.period_s - elapsed_s, 0) ...
Basic rate limiter that sleeps long enough to ensure the rate limit is not exceeded. Not thread safe.
ConstantRateLimiter
[ "BSD-3-Clause", "MIT", "BSD-3-Clause-Modification", "Unlicense", "Apache-2.0", "LGPL-3.0-only", "LicenseRef-scancode-public-domain", "BSD-2-Clause", "CC0-1.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConstantRateLimiter: """Basic rate limiter that sleeps long enough to ensure the rate limit is not exceeded. Not thread safe.""" def __init__(self, rate_limit_s): """:param rate_limit_s: rate limit in seconds""" <|body_0|> def sleep(self): """Sleeps long enough t...
stack_v2_sparse_classes_36k_train_007550
13,340
permissive
[ { "docstring": ":param rate_limit_s: rate limit in seconds", "name": "__init__", "signature": "def __init__(self, rate_limit_s)" }, { "docstring": "Sleeps long enough to enforce the rate limit", "name": "sleep", "signature": "def sleep(self)" } ]
2
null
Implement the Python class `ConstantRateLimiter` described below. Class description: Basic rate limiter that sleeps long enough to ensure the rate limit is not exceeded. Not thread safe. Method signatures and docstrings: - def __init__(self, rate_limit_s): :param rate_limit_s: rate limit in seconds - def sleep(self):...
Implement the Python class `ConstantRateLimiter` described below. Class description: Basic rate limiter that sleeps long enough to ensure the rate limit is not exceeded. Not thread safe. Method signatures and docstrings: - def __init__(self, rate_limit_s): :param rate_limit_s: rate limit in seconds - def sleep(self):...
406072e4294edff5b46b513f0cdf7c2c00fac9d2
<|skeleton|> class ConstantRateLimiter: """Basic rate limiter that sleeps long enough to ensure the rate limit is not exceeded. Not thread safe.""" def __init__(self, rate_limit_s): """:param rate_limit_s: rate limit in seconds""" <|body_0|> def sleep(self): """Sleeps long enough t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConstantRateLimiter: """Basic rate limiter that sleeps long enough to ensure the rate limit is not exceeded. Not thread safe.""" def __init__(self, rate_limit_s): """:param rate_limit_s: rate limit in seconds""" self.rate_limit_s = max(rate_limit_s, 0) self.period_s = 1.0 / self.r...
the_stack_v2_python_sparse
datadog_checks_base/datadog_checks/base/utils/db/utils.py
DataDog/integrations-core
train
852
edabaa1e51463808e7b04d6f8a8b900cd165f0b1
[ "self.event_dispatcher = event_dispatcher or EventDispatcher\nself.logger = _logging.adapt_logger(logger or _logging.NoOpLogger())\nself.notification_center = notification_center or _notification_center.NotificationCenter(self.logger)\nif not validator.is_notification_center_valid(self.notification_center):\n se...
<|body_start_0|> self.event_dispatcher = event_dispatcher or EventDispatcher self.logger = _logging.adapt_logger(logger or _logging.NoOpLogger()) self.notification_center = notification_center or _notification_center.NotificationCenter(self.logger) if not validator.is_notification_center...
ForwardingEventProcessor serves as the default EventProcessor. The ForwardingEventProcessor sends the LogEvent to EventDispatcher as soon as it is received.
ForwardingEventProcessor
[ "Apache-2.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ForwardingEventProcessor: """ForwardingEventProcessor serves as the default EventProcessor. The ForwardingEventProcessor sends the LogEvent to EventDispatcher as soon as it is received.""" def __init__(self, event_dispatcher: type[EventDispatcher] | CustomEventDispatcher, logger: Optional[_l...
stack_v2_sparse_classes_36k_train_007551
15,516
permissive
[ { "docstring": "ForwardingEventProcessor init method to configure event dispatching. Args: event_dispatcher: Provides a dispatch_event method which if given a URL and params sends a request to it. logger: Optional component which provides a log method to log messages. By default nothing would be logged. notific...
2
stack_v2_sparse_classes_30k_val_000447
Implement the Python class `ForwardingEventProcessor` described below. Class description: ForwardingEventProcessor serves as the default EventProcessor. The ForwardingEventProcessor sends the LogEvent to EventDispatcher as soon as it is received. Method signatures and docstrings: - def __init__(self, event_dispatcher...
Implement the Python class `ForwardingEventProcessor` described below. Class description: ForwardingEventProcessor serves as the default EventProcessor. The ForwardingEventProcessor sends the LogEvent to EventDispatcher as soon as it is received. Method signatures and docstrings: - def __init__(self, event_dispatcher...
bf000e737f391270f9adec97606646ce4761ecd8
<|skeleton|> class ForwardingEventProcessor: """ForwardingEventProcessor serves as the default EventProcessor. The ForwardingEventProcessor sends the LogEvent to EventDispatcher as soon as it is received.""" def __init__(self, event_dispatcher: type[EventDispatcher] | CustomEventDispatcher, logger: Optional[_l...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ForwardingEventProcessor: """ForwardingEventProcessor serves as the default EventProcessor. The ForwardingEventProcessor sends the LogEvent to EventDispatcher as soon as it is received.""" def __init__(self, event_dispatcher: type[EventDispatcher] | CustomEventDispatcher, logger: Optional[_logging.Logger...
the_stack_v2_python_sparse
optimizely/event/event_processor.py
optimizely/python-sdk
train
34
26d21503faa6a87c9423c36d17bbc0f0ef4a0a46
[ "if not array:\n return 0\nres = []\nmiddle_sum = 0\nfor x in array:\n if middle_sum <= 0:\n middle_sum = x\n else:\n middle_sum += x\n if not res or middle_sum > res[-1]:\n res.append(middle_sum)\n else:\n res.append(res[-1])\nprint(res)\nreturn max(res)", "if not array...
<|body_start_0|> if not array: return 0 res = [] middle_sum = 0 for x in array: if middle_sum <= 0: middle_sum = x else: middle_sum += x if not res or middle_sum > res[-1]: res.append(middle_s...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def max_sum_array(self, array): """动态规划""" <|body_0|> def max_sum_array_1(self, array): """动态规划""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not array: return 0 res = [] middle_sum = 0 for x in arr...
stack_v2_sparse_classes_36k_train_007552
1,493
no_license
[ { "docstring": "动态规划", "name": "max_sum_array", "signature": "def max_sum_array(self, array)" }, { "docstring": "动态规划", "name": "max_sum_array_1", "signature": "def max_sum_array_1(self, array)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def max_sum_array(self, array): 动态规划 - def max_sum_array_1(self, array): 动态规划
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def max_sum_array(self, array): 动态规划 - def max_sum_array_1(self, array): 动态规划 <|skeleton|> class Solution: def max_sum_array(self, array): """动态规划""" <|body...
3b8b36bcf8a983de4d8ce29734a85b6bfbe59fbc
<|skeleton|> class Solution: def max_sum_array(self, array): """动态规划""" <|body_0|> def max_sum_array_1(self, array): """动态规划""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def max_sum_array(self, array): """动态规划""" if not array: return 0 res = [] middle_sum = 0 for x in array: if middle_sum <= 0: middle_sum = x else: middle_sum += x if not res or mid...
the_stack_v2_python_sparse
TargetOffer/42、连续子数组的最大和.py
a625687551/Leetcode
train
0
956c867ee0d618937ac8725481f50878fb179bbe
[ "req_data, ret_data = init_views(request)\nfaq_db = req_data.get('faq_db', '')\nfaq_collection = req_data.get('faq_collection', '')\nif faq_db and faq_collection:\n db = MongoDB(faq_db)\n data = db.search_all({}, faq_collection)\n ret_data['data'] = list(map(lambda x: {'_id': str(x['_id']), 'question': x['...
<|body_start_0|> req_data, ret_data = init_views(request) faq_db = req_data.get('faq_db', '') faq_collection = req_data.get('faq_collection', '') if faq_db and faq_collection: db = MongoDB(faq_db) data = db.search_all({}, faq_collection) ret_data['data...
知识库操作
FaqViewSet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FaqViewSet: """知识库操作""" def describe_qas(self, request): """查询QA""" <|body_0|> def create_qa(self, request): """创建QA""" <|body_1|> def update_qa(self, request): """变更QA""" <|body_2|> def delete_qa(self, request): """删除QA"...
stack_v2_sparse_classes_36k_train_007553
5,178
permissive
[ { "docstring": "查询QA", "name": "describe_qas", "signature": "def describe_qas(self, request)" }, { "docstring": "创建QA", "name": "create_qa", "signature": "def create_qa(self, request)" }, { "docstring": "变更QA", "name": "update_qa", "signature": "def update_qa(self, reques...
4
null
Implement the Python class `FaqViewSet` described below. Class description: 知识库操作 Method signatures and docstrings: - def describe_qas(self, request): 查询QA - def create_qa(self, request): 创建QA - def update_qa(self, request): 变更QA - def delete_qa(self, request): 删除QA
Implement the Python class `FaqViewSet` described below. Class description: 知识库操作 Method signatures and docstrings: - def describe_qas(self, request): 查询QA - def create_qa(self, request): 创建QA - def update_qa(self, request): 变更QA - def delete_qa(self, request): 删除QA <|skeleton|> class FaqViewSet: """知识库操作""" ...
da37fb2197142eae32158cdb5c2b658100133fff
<|skeleton|> class FaqViewSet: """知识库操作""" def describe_qas(self, request): """查询QA""" <|body_0|> def create_qa(self, request): """创建QA""" <|body_1|> def update_qa(self, request): """变更QA""" <|body_2|> def delete_qa(self, request): """删除QA"...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FaqViewSet: """知识库操作""" def describe_qas(self, request): """查询QA""" req_data, ret_data = init_views(request) faq_db = req_data.get('faq_db', '') faq_collection = req_data.get('faq_collection', '') if faq_db and faq_collection: db = MongoDB(faq_db) ...
the_stack_v2_python_sparse
module_faq/views.py
cz-qq/bk-chatbot
train
0
1a87ae6e617cb66cb05c4f62ac70995a8b0b91eb
[ "super().__init__()\nself.input_conv = Conv1d(in_channels, hidden_channels, 1)\nself.encoder = WaveNet(in_channels=-1, out_channels=-1, kernel_size=kernel_size, layers=layers, stacks=stacks, base_dilation=base_dilation, residual_channels=hidden_channels, aux_channels=-1, gate_channels=hidden_channels * 2, skip_chan...
<|body_start_0|> super().__init__() self.input_conv = Conv1d(in_channels, hidden_channels, 1) self.encoder = WaveNet(in_channels=-1, out_channels=-1, kernel_size=kernel_size, layers=layers, stacks=stacks, base_dilation=base_dilation, residual_channels=hidden_channels, aux_channels=-1, gate_chann...
Posterior encoder module in VITS. This is a module of posterior encoder described in `Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speech`_. .. _`Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speech`: https://arxiv.org/abs/2006.04558
PosteriorEncoder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PosteriorEncoder: """Posterior encoder module in VITS. This is a module of posterior encoder described in `Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speech`_. .. _`Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speec...
stack_v2_sparse_classes_36k_train_007554
4,037
permissive
[ { "docstring": "Initilialize PosteriorEncoder module. Args: in_channels (int): Number of input channels. out_channels (int): Number of output channels. hidden_channels (int): Number of hidden channels. kernel_size (int): Kernel size in WaveNet. layers (int): Number of layers of WaveNet. stacks (int): Number of ...
2
stack_v2_sparse_classes_30k_train_017291
Implement the Python class `PosteriorEncoder` described below. Class description: Posterior encoder module in VITS. This is a module of posterior encoder described in `Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speech`_. .. _`Conditional Variational Autoencoder with Adversaria...
Implement the Python class `PosteriorEncoder` described below. Class description: Posterior encoder module in VITS. This is a module of posterior encoder described in `Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speech`_. .. _`Conditional Variational Autoencoder with Adversaria...
bcd20948db7846ee523443ef9fd78c7a1248c95e
<|skeleton|> class PosteriorEncoder: """Posterior encoder module in VITS. This is a module of posterior encoder described in `Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speech`_. .. _`Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speec...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PosteriorEncoder: """Posterior encoder module in VITS. This is a module of posterior encoder described in `Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speech`_. .. _`Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speech`: https://a...
the_stack_v2_python_sparse
espnet2/gan_tts/vits/posterior_encoder.py
espnet/espnet
train
7,242
761d059bc51ee29c9b235411e3002479972c7202
[ "adm = ProjectAdministration()\nproject_list = adm.get_all_projects()\nreturn project_list", "adm = ProjectAdministration()\nproj = Project.from_dict(api.payload)\nif proj is not None:\n proj = adm.create_project(proj.get_name(), proj.get_id(), proj.get_external_partners(), proj.get_capacity(), proj.get_weekly...
<|body_start_0|> adm = ProjectAdministration() project_list = adm.get_all_projects() return project_list <|end_body_0|> <|body_start_1|> adm = ProjectAdministration() proj = Project.from_dict(api.payload) if proj is not None: proj = adm.create_project(proj.ge...
ProjectListOperations
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProjectListOperations: def get(self): """Auslesen aller Project-Objekte""" <|body_0|> def post(self): """Anlegen eines neuen Project-Objekts""" <|body_1|> <|end_skeleton|> <|body_start_0|> adm = ProjectAdministration() project_list = adm.get...
stack_v2_sparse_classes_36k_train_007555
44,493
no_license
[ { "docstring": "Auslesen aller Project-Objekte", "name": "get", "signature": "def get(self)" }, { "docstring": "Anlegen eines neuen Project-Objekts", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_016735
Implement the Python class `ProjectListOperations` described below. Class description: Implement the ProjectListOperations class. Method signatures and docstrings: - def get(self): Auslesen aller Project-Objekte - def post(self): Anlegen eines neuen Project-Objekts
Implement the Python class `ProjectListOperations` described below. Class description: Implement the ProjectListOperations class. Method signatures and docstrings: - def get(self): Auslesen aller Project-Objekte - def post(self): Anlegen eines neuen Project-Objekts <|skeleton|> class ProjectListOperations: def ...
4b2826225525ae855e15e1174f5cf90466097021
<|skeleton|> class ProjectListOperations: def get(self): """Auslesen aller Project-Objekte""" <|body_0|> def post(self): """Anlegen eines neuen Project-Objekts""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProjectListOperations: def get(self): """Auslesen aller Project-Objekte""" adm = ProjectAdministration() project_list = adm.get_all_projects() return project_list def post(self): """Anlegen eines neuen Project-Objekts""" adm = ProjectAdministration() ...
the_stack_v2_python_sparse
src/main.py
KieserChristian/SW_Praktikum_Gruppe1
train
0
e2409730572d54a14b577d16af1a291b0906a650
[ "if not self.is_property_available('ServerRelativeUrl'):\n raise ValueError\nresponse = File.open_binary(self.context, self.properties['ServerRelativeUrl'])\nreturn response.content", "if not self.is_property_available('ServerRelativeUrl'):\n raise ValueError\nresponse = File.save_binary(self.context, self....
<|body_start_0|> if not self.is_property_available('ServerRelativeUrl'): raise ValueError response = File.open_binary(self.context, self.properties['ServerRelativeUrl']) return response.content <|end_body_0|> <|body_start_1|> if not self.is_property_available('ServerRelative...
AbstractFile
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AbstractFile: def read(self): """Immediately read content of file""" <|body_0|> def write(self, content): """Immediately writes content of file""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not self.is_property_available('ServerRelativeUrl'): ...
stack_v2_sparse_classes_36k_train_007556
35,548
permissive
[ { "docstring": "Immediately read content of file", "name": "read", "signature": "def read(self)" }, { "docstring": "Immediately writes content of file", "name": "write", "signature": "def write(self, content)" } ]
2
null
Implement the Python class `AbstractFile` described below. Class description: Implement the AbstractFile class. Method signatures and docstrings: - def read(self): Immediately read content of file - def write(self, content): Immediately writes content of file
Implement the Python class `AbstractFile` described below. Class description: Implement the AbstractFile class. Method signatures and docstrings: - def read(self): Immediately read content of file - def write(self, content): Immediately writes content of file <|skeleton|> class AbstractFile: def read(self): ...
cbd245d1af8d69e013c469cfc2a9851f51c91417
<|skeleton|> class AbstractFile: def read(self): """Immediately read content of file""" <|body_0|> def write(self, content): """Immediately writes content of file""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AbstractFile: def read(self): """Immediately read content of file""" if not self.is_property_available('ServerRelativeUrl'): raise ValueError response = File.open_binary(self.context, self.properties['ServerRelativeUrl']) return response.content def write(self,...
the_stack_v2_python_sparse
office365/sharepoint/files/file.py
vgrem/Office365-REST-Python-Client
train
1,006
3c30d4554b1013af19b7b35b68268411715019ec
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn EntitlementManagementSettings()", "from .access_package_external_user_lifecycle_action import AccessPackageExternalUserLifecycleAction\nfrom .entity import Entity\nfrom .access_package_external_user_lifecycle_action import AccessPackag...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return EntitlementManagementSettings() <|end_body_0|> <|body_start_1|> from .access_package_external_user_lifecycle_action import AccessPackageExternalUserLifecycleAction from .entity import En...
EntitlementManagementSettings
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EntitlementManagementSettings: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EntitlementManagementSettings: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator val...
stack_v2_sparse_classes_36k_train_007557
3,282
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: EntitlementManagementSettings", "name": "create_from_discriminator_value", "signature": "def create_from_dis...
3
stack_v2_sparse_classes_30k_train_004089
Implement the Python class `EntitlementManagementSettings` described below. Class description: Implement the EntitlementManagementSettings class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EntitlementManagementSettings: Creates a new instance of th...
Implement the Python class `EntitlementManagementSettings` described below. Class description: Implement the EntitlementManagementSettings class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EntitlementManagementSettings: Creates a new instance of th...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class EntitlementManagementSettings: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EntitlementManagementSettings: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator val...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EntitlementManagementSettings: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EntitlementManagementSettings: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create ...
the_stack_v2_python_sparse
msgraph/generated/models/entitlement_management_settings.py
microsoftgraph/msgraph-sdk-python
train
135
fa301fa0fb17209ed56fab2450a499942fd6eb41
[ "self.control = QtGui.QDateEdit()\nif hasattr(self.factory, 'qt_date_format'):\n self.control.setDisplayFormat(self.factory.qt_date_format)\nif not self.factory.allow_future:\n self.control.setMaximumDate(QtCore.QDate.currentDate())\nif getattr(self.factory, 'maximum_date_name', None):\n obj, extended_name...
<|body_start_0|> self.control = QtGui.QDateEdit() if hasattr(self.factory, 'qt_date_format'): self.control.setDisplayFormat(self.factory.qt_date_format) if not self.factory.allow_future: self.control.setMaximumDate(QtCore.QDate.currentDate()) if getattr(self.facto...
Simple Traits UI date editor that wraps QDateEdit.
SimpleEditor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimpleEditor: """Simple Traits UI date editor that wraps QDateEdit.""" def init(self, parent): """Finishes initializing the editor by creating the underlying toolkit widget.""" <|body_0|> def update_editor(self): """Updates the editor when the object trait change...
stack_v2_sparse_classes_36k_train_007558
6,787
no_license
[ { "docstring": "Finishes initializing the editor by creating the underlying toolkit widget.", "name": "init", "signature": "def init(self, parent)" }, { "docstring": "Updates the editor when the object trait changes externally to the editor.", "name": "update_editor", "signature": "def u...
3
null
Implement the Python class `SimpleEditor` described below. Class description: Simple Traits UI date editor that wraps QDateEdit. Method signatures and docstrings: - def init(self, parent): Finishes initializing the editor by creating the underlying toolkit widget. - def update_editor(self): Updates the editor when th...
Implement the Python class `SimpleEditor` described below. Class description: Simple Traits UI date editor that wraps QDateEdit. Method signatures and docstrings: - def init(self, parent): Finishes initializing the editor by creating the underlying toolkit widget. - def update_editor(self): Updates the editor when th...
b5059e7f121e4abb6888893f91f95dd79aed9ca4
<|skeleton|> class SimpleEditor: """Simple Traits UI date editor that wraps QDateEdit.""" def init(self, parent): """Finishes initializing the editor by creating the underlying toolkit widget.""" <|body_0|> def update_editor(self): """Updates the editor when the object trait change...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SimpleEditor: """Simple Traits UI date editor that wraps QDateEdit.""" def init(self, parent): """Finishes initializing the editor by creating the underlying toolkit widget.""" self.control = QtGui.QDateEdit() if hasattr(self.factory, 'qt_date_format'): self.control.se...
the_stack_v2_python_sparse
venv/Lib/site-packages/traitsui/qt4/date_editor.py
GenomePhD/Bio1-HIV
train
0
0f9244d00e04275cfad90becf80c7928b50a756e
[ "super().__init__(db_file_name, read_only)\nself.std = std\nself.mo = mo", "val_types = ['r', 'l']\nif sim_type not in val_types:\n raise ValueError('sim_type {0} is not valid has to be one of {1}'.format(sim_type, val_types))\nval_states = ['naive', 'trained', 'ideal', 'bfevolve', 'partevolve']\nif network_st...
<|body_start_0|> super().__init__(db_file_name, read_only) self.std = std self.mo = mo <|end_body_0|> <|body_start_1|> val_types = ['r', 'l'] if sim_type not in val_types: raise ValueError('sim_type {0} is not valid has to be one of {1}'.format(sim_type, val_types)) ...
Hdf5 backed store of simulation data
SimulationStore
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimulationStore: """Hdf5 backed store of simulation data""" def __init__(self, db_file_name, std: GradientStandards, mo: MoTypes, read_only=False): """Creates a new simulation store :param db_file_name: The backend database filename :param std: Gradient standards for input normalizat...
stack_v2_sparse_classes_36k_train_007559
10,990
permissive
[ { "docstring": "Creates a new simulation store :param db_file_name: The backend database filename :param std: Gradient standards for input normalization :param mo: Definition of model organism to use :param read_only: If true, no modifications will be made to the database", "name": "__init__", "signatur...
5
stack_v2_sparse_classes_30k_train_007767
Implement the Python class `SimulationStore` described below. Class description: Hdf5 backed store of simulation data Method signatures and docstrings: - def __init__(self, db_file_name, std: GradientStandards, mo: MoTypes, read_only=False): Creates a new simulation store :param db_file_name: The backend database fil...
Implement the Python class `SimulationStore` described below. Class description: Hdf5 backed store of simulation data Method signatures and docstrings: - def __init__(self, db_file_name, std: GradientStandards, mo: MoTypes, read_only=False): Creates a new simulation store :param db_file_name: The backend database fil...
679b48768ad74dccd58f8c2f434ad60036fc5cb7
<|skeleton|> class SimulationStore: """Hdf5 backed store of simulation data""" def __init__(self, db_file_name, std: GradientStandards, mo: MoTypes, read_only=False): """Creates a new simulation store :param db_file_name: The backend database filename :param std: Gradient standards for input normalizat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SimulationStore: """Hdf5 backed store of simulation data""" def __init__(self, db_file_name, std: GradientStandards, mo: MoTypes, read_only=False): """Creates a new simulation store :param db_file_name: The backend database filename :param std: Gradient standards for input normalization :param mo...
the_stack_v2_python_sparse
data_stores.py
treestreamymw/GradientPrediction
train
0
edba1402e44e984f36352b564538403c60656216
[ "from collections import Counter\ncounter = Counter(nums)\ni = 0\nfor color in range(3):\n for _ in range(counter[color]):\n nums[i] = color\n i += 1", "\"\"\"https://leetcode.com/problems/sort-colors/discuss/26481/Python-O(n)-1-pass-in-place-solution-with-explanation\"\"\"\nn = len(nums)\nl, r =...
<|body_start_0|> from collections import Counter counter = Counter(nums) i = 0 for color in range(3): for _ in range(counter[color]): nums[i] = color i += 1 <|end_body_0|> <|body_start_1|> """https://leetcode.com/problems/sort-colors/d...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def sortColors(self, nums: List[int]) -> None: """Counting Sort, Time: O(n), Space: O(n)""" <|body_0|> def sortColors(self, nums: List[int]) -> None: """Two Pointer, Time: O(n), Space: O(1)""" <|body_1|> <|end_skeleton|> <|body_start_0|> f...
stack_v2_sparse_classes_36k_train_007560
1,275
no_license
[ { "docstring": "Counting Sort, Time: O(n), Space: O(n)", "name": "sortColors", "signature": "def sortColors(self, nums: List[int]) -> None" }, { "docstring": "Two Pointer, Time: O(n), Space: O(1)", "name": "sortColors", "signature": "def sortColors(self, nums: List[int]) -> None" } ]
2
stack_v2_sparse_classes_30k_train_019417
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortColors(self, nums: List[int]) -> None: Counting Sort, Time: O(n), Space: O(n) - def sortColors(self, nums: List[int]) -> None: Two Pointer, Time: O(n), Space: O(1)
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortColors(self, nums: List[int]) -> None: Counting Sort, Time: O(n), Space: O(n) - def sortColors(self, nums: List[int]) -> None: Two Pointer, Time: O(n), Space: O(1) <|ske...
72136e3487d239f5b37e2d6393e034262a6bf599
<|skeleton|> class Solution: def sortColors(self, nums: List[int]) -> None: """Counting Sort, Time: O(n), Space: O(n)""" <|body_0|> def sortColors(self, nums: List[int]) -> None: """Two Pointer, Time: O(n), Space: O(1)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def sortColors(self, nums: List[int]) -> None: """Counting Sort, Time: O(n), Space: O(n)""" from collections import Counter counter = Counter(nums) i = 0 for color in range(3): for _ in range(counter[color]): nums[i] = color ...
the_stack_v2_python_sparse
python/75-Sort Colors.py
cwza/leetcode
train
0
b841e6e88e31852c0c612edb34d5ce72a9efbb62
[ "if not exactly_one(table, sql):\n raise ETLInputError('Only one of table, sql needed')\nsuper(ExtractRdsStep, self).__init__(**kwargs)\nif table:\n sql = 'SELECT * FROM %s;' % table\nelif sql:\n table = SelectStatement(sql).dependencies[0]\nelse:\n raise ETLInputError('Provide a sql statement or a tabl...
<|body_start_0|> if not exactly_one(table, sql): raise ETLInputError('Only one of table, sql needed') super(ExtractRdsStep, self).__init__(**kwargs) if table: sql = 'SELECT * FROM %s;' % table elif sql: table = SelectStatement(sql).dependencies[0] ...
Extract Redshift Step class that helps get data out of redshift
ExtractRdsStep
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExtractRdsStep: """Extract Redshift Step class that helps get data out of redshift""" def __init__(self, table=None, sql=None, host_name=None, database=None, output_path=None, splits=1, **kwargs): """Constructor for the ExtractRdsStep class Args: schema(str): schema from which table ...
stack_v2_sparse_classes_36k_train_007561
4,587
permissive
[ { "docstring": "Constructor for the ExtractRdsStep class Args: schema(str): schema from which table should be extracted table(path): table name for extract insert_mode(str): insert mode for redshift copy activity database(MysqlNode): database to excute the query splits(int): Number of files to split the output ...
2
null
Implement the Python class `ExtractRdsStep` described below. Class description: Extract Redshift Step class that helps get data out of redshift Method signatures and docstrings: - def __init__(self, table=None, sql=None, host_name=None, database=None, output_path=None, splits=1, **kwargs): Constructor for the Extract...
Implement the Python class `ExtractRdsStep` described below. Class description: Extract Redshift Step class that helps get data out of redshift Method signatures and docstrings: - def __init__(self, table=None, sql=None, host_name=None, database=None, output_path=None, splits=1, **kwargs): Constructor for the Extract...
797cb719e6c2abeda0751ada3339c72bfb19c8f2
<|skeleton|> class ExtractRdsStep: """Extract Redshift Step class that helps get data out of redshift""" def __init__(self, table=None, sql=None, host_name=None, database=None, output_path=None, splits=1, **kwargs): """Constructor for the ExtractRdsStep class Args: schema(str): schema from which table ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExtractRdsStep: """Extract Redshift Step class that helps get data out of redshift""" def __init__(self, table=None, sql=None, host_name=None, database=None, output_path=None, splits=1, **kwargs): """Constructor for the ExtractRdsStep class Args: schema(str): schema from which table should be ext...
the_stack_v2_python_sparse
dataduct/steps/extract_rds.py
EverFi/dataduct
train
3
10b90d3a609ebc9e366b286bc7946afadb8b97c0
[ "if member_id < 1 or not items:\n return False\nfor item in items:\n Cart.query.filter_by(product_id=item['id'], member_id=member_id).delete()\ndb.session.commit()\nreturn True", "if member_id < 1 or product_id < 1 or number < 1:\n return False\ncart_info = Cart.query.filter_by(product_id=product_id, mem...
<|body_start_0|> if member_id < 1 or not items: return False for item in items: Cart.query.filter_by(product_id=item['id'], member_id=member_id).delete() db.session.commit() return True <|end_body_0|> <|body_start_1|> if member_id < 1 or product_id < 1 or...
CartService
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CartService: def deleteItem(member_id=0, items=None): """:param member_id: :param items: :return: 会员是否存在""" <|body_0|> def setItems(member_id=0, product_id=0, number=0): """:param member_id: :param product_id: :param number: :return:向购物车添加/更新数量成功与否""" <|body_...
stack_v2_sparse_classes_36k_train_007562
2,346
no_license
[ { "docstring": ":param member_id: :param items: :return: 会员是否存在", "name": "deleteItem", "signature": "def deleteItem(member_id=0, items=None)" }, { "docstring": ":param member_id: :param product_id: :param number: :return:向购物车添加/更新数量成功与否", "name": "setItems", "signature": "def setItems(m...
3
stack_v2_sparse_classes_30k_train_012843
Implement the Python class `CartService` described below. Class description: Implement the CartService class. Method signatures and docstrings: - def deleteItem(member_id=0, items=None): :param member_id: :param items: :return: 会员是否存在 - def setItems(member_id=0, product_id=0, number=0): :param member_id: :param produ...
Implement the Python class `CartService` described below. Class description: Implement the CartService class. Method signatures and docstrings: - def deleteItem(member_id=0, items=None): :param member_id: :param items: :return: 会员是否存在 - def setItems(member_id=0, product_id=0, number=0): :param member_id: :param produ...
16e7110474fa24f1c05e16d13b0bca55e57c58e4
<|skeleton|> class CartService: def deleteItem(member_id=0, items=None): """:param member_id: :param items: :return: 会员是否存在""" <|body_0|> def setItems(member_id=0, product_id=0, number=0): """:param member_id: :param product_id: :param number: :return:向购物车添加/更新数量成功与否""" <|body_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CartService: def deleteItem(member_id=0, items=None): """:param member_id: :param items: :return: 会员是否存在""" if member_id < 1 or not items: return False for item in items: Cart.query.filter_by(product_id=item['id'], member_id=member_id).delete() db.sessio...
the_stack_v2_python_sparse
backend/ciwei/common/libs/mall/CartService.py
100101001/HedgehogHunt
train
1
8fbed2c779b46af5fb0ffd088004c2f3150d1ed7
[ "super(PerformanceKMeans, self).setUp()\nschema = [('Vec1', float), ('Vec2', float), ('Vec3', float), ('Vec4', float), ('Vec5', float), ('term', str)]\nds = self.get_file(self.id(), performance_file=True)\nself.frame_train = self.context.frame.import_csv(ds, schema=schema)", "with profiler.Timer('profile.' + self...
<|body_start_0|> super(PerformanceKMeans, self).setUp() schema = [('Vec1', float), ('Vec2', float), ('Vec3', float), ('Vec4', float), ('Vec5', float), ('term', str)] ds = self.get_file(self.id(), performance_file=True) self.frame_train = self.context.frame.import_csv(ds, schema=schema) <...
PerformanceKMeans
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PerformanceKMeans: def setUp(self): """Import the files to test against.""" <|body_0|> def test_kmeans_5by5(self): """Train a 5-feature, 5-class KMeans model""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(PerformanceKMeans, self).setUp() ...
stack_v2_sparse_classes_36k_train_007563
1,888
permissive
[ { "docstring": "Import the files to test against.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Train a 5-feature, 5-class KMeans model", "name": "test_kmeans_5by5", "signature": "def test_kmeans_5by5(self)" } ]
2
null
Implement the Python class `PerformanceKMeans` described below. Class description: Implement the PerformanceKMeans class. Method signatures and docstrings: - def setUp(self): Import the files to test against. - def test_kmeans_5by5(self): Train a 5-feature, 5-class KMeans model
Implement the Python class `PerformanceKMeans` described below. Class description: Implement the PerformanceKMeans class. Method signatures and docstrings: - def setUp(self): Import the files to test against. - def test_kmeans_5by5(self): Train a 5-feature, 5-class KMeans model <|skeleton|> class PerformanceKMeans: ...
5548fc925b5c278263cbdebbd9e8c7593320c2f4
<|skeleton|> class PerformanceKMeans: def setUp(self): """Import the files to test against.""" <|body_0|> def test_kmeans_5by5(self): """Train a 5-feature, 5-class KMeans model""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PerformanceKMeans: def setUp(self): """Import the files to test against.""" super(PerformanceKMeans, self).setUp() schema = [('Vec1', float), ('Vec2', float), ('Vec3', float), ('Vec4', float), ('Vec5', float), ('term', str)] ds = self.get_file(self.id(), performance_file=True) ...
the_stack_v2_python_sparse
regression-tests/sparktkregtests/testcases/performance/kmeans_perf_test.py
trustedanalytics/spark-tk
train
35
2c06afe79c4e3c68f8cb87f444efc1edbaf2739f
[ "self.project_name = self.project.title\nself.asso_name = self.project.asso.title\nself.update_project_levels()\nsuper().save(*args, **kwargs)", "self.project.achievement += self.amount\nself.project.donation_count += 1\nself.project.achievement_percent = round(self.project.achievement / self.project.target, 4)\n...
<|body_start_0|> self.project_name = self.project.title self.asso_name = self.project.asso.title self.update_project_levels() super().save(*args, **kwargs) <|end_body_0|> <|body_start_1|> self.project.achievement += self.amount self.project.donation_count += 1 se...
table that accounts for every donations done during orders
Donation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Donation: """table that accounts for every donations done during orders""" def save(self, *args, **kwargs): """to keep a track of asso and project even if the will be deleted""" <|body_0|> def update_project_levels(self): """update project levels""" <|bod...
stack_v2_sparse_classes_36k_train_007564
2,885
no_license
[ { "docstring": "to keep a track of asso and project even if the will be deleted", "name": "save", "signature": "def save(self, *args, **kwargs)" }, { "docstring": "update project levels", "name": "update_project_levels", "signature": "def update_project_levels(self)" } ]
2
null
Implement the Python class `Donation` described below. Class description: table that accounts for every donations done during orders Method signatures and docstrings: - def save(self, *args, **kwargs): to keep a track of asso and project even if the will be deleted - def update_project_levels(self): update project le...
Implement the Python class `Donation` described below. Class description: table that accounts for every donations done during orders Method signatures and docstrings: - def save(self, *args, **kwargs): to keep a track of asso and project even if the will be deleted - def update_project_levels(self): update project le...
616d68ecd102f3c39a0a0714dd5048812875ceb6
<|skeleton|> class Donation: """table that accounts for every donations done during orders""" def save(self, *args, **kwargs): """to keep a track of asso and project even if the will be deleted""" <|body_0|> def update_project_levels(self): """update project levels""" <|bod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Donation: """table that accounts for every donations done during orders""" def save(self, *args, **kwargs): """to keep a track of asso and project even if the will be deleted""" self.project_name = self.project.title self.asso_name = self.project.asso.title self.update_pro...
the_stack_v2_python_sparse
apps_fork/order/models.py
vitrolom/ecommerce
train
0
1044890ca8f16c8a24d44d4082f23e837b435235
[ "self.orgnr_field = orgnr_field\nself.kode_type_field = kode_type_field\nself.kode_tekst_field = kode_tekst_field\nself.navn_field = navn_field\nself.postnr_field = postnr_field\nself.poststed_field = poststed_field\nself.eierandel_field = eierandel_field\nself.additional_properties = additional_properties", "if ...
<|body_start_0|> self.orgnr_field = orgnr_field self.kode_type_field = kode_type_field self.kode_tekst_field = kode_tekst_field self.navn_field = navn_field self.postnr_field = postnr_field self.poststed_field = poststed_field self.eierandel_field = eierandel_fiel...
Implementation of the 'Datterselskap' model. TODO: type model description here. Attributes: orgnr_field (long|int): TODO: type description here. kode_type_field (string): TODO: type description here. kode_tekst_field (string): TODO: type description here. navn_field (string): TODO: type description here. postnr_field (...
Datterselskap
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Datterselskap: """Implementation of the 'Datterselskap' model. TODO: type model description here. Attributes: orgnr_field (long|int): TODO: type description here. kode_type_field (string): TODO: type description here. kode_tekst_field (string): TODO: type description here. navn_field (string): TO...
stack_v2_sparse_classes_36k_train_007565
3,522
permissive
[ { "docstring": "Constructor for the Datterselskap class", "name": "__init__", "signature": "def __init__(self, orgnr_field=None, kode_type_field=None, kode_tekst_field=None, navn_field=None, postnr_field=None, poststed_field=None, eierandel_field=None, additional_properties={})" }, { "docstring"...
2
null
Implement the Python class `Datterselskap` described below. Class description: Implementation of the 'Datterselskap' model. TODO: type model description here. Attributes: orgnr_field (long|int): TODO: type description here. kode_type_field (string): TODO: type description here. kode_tekst_field (string): TODO: type de...
Implement the Python class `Datterselskap` described below. Class description: Implementation of the 'Datterselskap' model. TODO: type model description here. Attributes: orgnr_field (long|int): TODO: type description here. kode_type_field (string): TODO: type description here. kode_tekst_field (string): TODO: type de...
fa3918a6c54ea0eedb9146578645b7eb1755b642
<|skeleton|> class Datterselskap: """Implementation of the 'Datterselskap' model. TODO: type model description here. Attributes: orgnr_field (long|int): TODO: type description here. kode_type_field (string): TODO: type description here. kode_tekst_field (string): TODO: type description here. navn_field (string): TO...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Datterselskap: """Implementation of the 'Datterselskap' model. TODO: type model description here. Attributes: orgnr_field (long|int): TODO: type description here. kode_type_field (string): TODO: type description here. kode_tekst_field (string): TODO: type description here. navn_field (string): TODO: type desc...
the_stack_v2_python_sparse
idfy_rest_client/models/datterselskap.py
dealflowteam/Idfy
train
0
9068143ea16fbe4a7ace7f46d559e1d650ff4774
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn KubernetesServiceEvidence()", "from .alert_evidence import AlertEvidence\nfrom .dictionary import Dictionary\nfrom .ip_evidence import IpEvidence\nfrom .kubernetes_namespace_evidence import KubernetesNamespaceEvidence\nfrom .kubernetes...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return KubernetesServiceEvidence() <|end_body_0|> <|body_start_1|> from .alert_evidence import AlertEvidence from .dictionary import Dictionary from .ip_evidence import IpEvidence ...
KubernetesServiceEvidence
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KubernetesServiceEvidence: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> KubernetesServiceEvidence: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and c...
stack_v2_sparse_classes_36k_train_007566
4,761
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: KubernetesServiceEvidence", "name": "create_from_discriminator_value", "signature": "def create_from_discrim...
3
stack_v2_sparse_classes_30k_train_007379
Implement the Python class `KubernetesServiceEvidence` described below. Class description: Implement the KubernetesServiceEvidence class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> KubernetesServiceEvidence: Creates a new instance of the appropriat...
Implement the Python class `KubernetesServiceEvidence` described below. Class description: Implement the KubernetesServiceEvidence class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> KubernetesServiceEvidence: Creates a new instance of the appropriat...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class KubernetesServiceEvidence: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> KubernetesServiceEvidence: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KubernetesServiceEvidence: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> KubernetesServiceEvidence: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the obje...
the_stack_v2_python_sparse
msgraph/generated/models/security/kubernetes_service_evidence.py
microsoftgraph/msgraph-sdk-python
train
135
46188758fbda68dd02400a4c68ab39701895dd56
[ "self.client = sclient.Client(wsdl_file)\nif is_ssl:\n trans = HttpAuthUsingCert('', '')\n self.client.set_options(transport=trans)\nif endpoint is not None:\n self.client.options.location = endpoint\nif is_ssl and username:\n passman = urllib2.HTTPPasswordMgrWithDefaultRealm()\n passman.add_password...
<|body_start_0|> self.client = sclient.Client(wsdl_file) if is_ssl: trans = HttpAuthUsingCert('', '') self.client.set_options(transport=trans) if endpoint is not None: self.client.options.location = endpoint if is_ssl and username: passman ...
This class repsent wraper for SOAP client
SoapInterface
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SoapInterface: """This class repsent wraper for SOAP client""" def __init__(self, wsdl_file, endpoint=None, is_ssl=False, username=None, password=None): """Constructor method @wsdl_file - URL representing WSDL file (local or global URL) @endpoint - SOAP endpoint URL @is_ssl - if True...
stack_v2_sparse_classes_36k_train_007567
5,178
no_license
[ { "docstring": "Constructor method @wsdl_file - URL representing WSDL file (local or global URL) @endpoint - SOAP endpoint URL @is_ssl - if True then initiate ssl connection @username - username for HTTP authentication (if None then no HTTP authentication) @password - password for HTTP authentication", "nam...
3
stack_v2_sparse_classes_30k_train_019480
Implement the Python class `SoapInterface` described below. Class description: This class repsent wraper for SOAP client Method signatures and docstrings: - def __init__(self, wsdl_file, endpoint=None, is_ssl=False, username=None, password=None): Constructor method @wsdl_file - URL representing WSDL file (local or gl...
Implement the Python class `SoapInterface` described below. Class description: This class repsent wraper for SOAP client Method signatures and docstrings: - def __init__(self, wsdl_file, endpoint=None, is_ssl=False, username=None, password=None): Constructor method @wsdl_file - URL representing WSDL file (local or gl...
e6bc6eb747e39dcacf5f3fd0738d82f16ed0f76d
<|skeleton|> class SoapInterface: """This class repsent wraper for SOAP client""" def __init__(self, wsdl_file, endpoint=None, is_ssl=False, username=None, password=None): """Constructor method @wsdl_file - URL representing WSDL file (local or global URL) @endpoint - SOAP endpoint URL @is_ssl - if True...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SoapInterface: """This class repsent wraper for SOAP client""" def __init__(self, wsdl_file, endpoint=None, is_ssl=False, username=None, password=None): """Constructor method @wsdl_file - URL representing WSDL file (local or global URL) @endpoint - SOAP endpoint URL @is_ssl - if True then initiat...
the_stack_v2_python_sparse
FablikFramework/FablikClient/bin/soapClient.py
fabregas/old_projects
train
0
aaab82149b0f00287a29b9afb8cda85599dcd5df
[ "mock_input = MockInputApi()\nmock_input.files = [MockFile('path/One.java', ['new Notification.Builder()']), MockFile('path/Two.java', ['new NotificationCompat.Builder()'])]\nerrors = PRESUBMIT._CheckNotificationConstructors(mock_input, MockOutputApi())\nself.assertEqual(1, len(errors))\nself.assertEqual(2, len(err...
<|body_start_0|> mock_input = MockInputApi() mock_input.files = [MockFile('path/One.java', ['new Notification.Builder()']), MockFile('path/Two.java', ['new NotificationCompat.Builder()'])] errors = PRESUBMIT._CheckNotificationConstructors(mock_input, MockOutputApi()) self.assertEqual(1, ...
Test the _CheckNotificationConstructors presubmit check.
CheckNotificationConstructors
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CheckNotificationConstructors: """Test the _CheckNotificationConstructors presubmit check.""" def testTruePositives(self): """Examples of when Notification.Builder use is correctly flagged.""" <|body_0|> def testFalsePositives(self): """Examples of when Notificat...
stack_v2_sparse_classes_36k_train_007568
4,016
permissive
[ { "docstring": "Examples of when Notification.Builder use is correctly flagged.", "name": "testTruePositives", "signature": "def testTruePositives(self)" }, { "docstring": "Examples of when Notification.Builder should not be flagged.", "name": "testFalsePositives", "signature": "def test...
2
null
Implement the Python class `CheckNotificationConstructors` described below. Class description: Test the _CheckNotificationConstructors presubmit check. Method signatures and docstrings: - def testTruePositives(self): Examples of when Notification.Builder use is correctly flagged. - def testFalsePositives(self): Examp...
Implement the Python class `CheckNotificationConstructors` described below. Class description: Test the _CheckNotificationConstructors presubmit check. Method signatures and docstrings: - def testTruePositives(self): Examples of when Notification.Builder use is correctly flagged. - def testFalsePositives(self): Examp...
d92465f71fb8e4345e27bd889532339204b26f1e
<|skeleton|> class CheckNotificationConstructors: """Test the _CheckNotificationConstructors presubmit check.""" def testTruePositives(self): """Examples of when Notification.Builder use is correctly flagged.""" <|body_0|> def testFalsePositives(self): """Examples of when Notificat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CheckNotificationConstructors: """Test the _CheckNotificationConstructors presubmit check.""" def testTruePositives(self): """Examples of when Notification.Builder use is correctly flagged.""" mock_input = MockInputApi() mock_input.files = [MockFile('path/One.java', ['new Notifica...
the_stack_v2_python_sparse
chromium/chrome/android/java/src/PRESUBMIT_test.py
Csineneo/Vivaldi
train
5
1a55c6789e5d75c60c38e232bfa5b6b43938252d
[ "if len(s) < 2:\n return s\nss = s + '#' + s[::-1]\nlength, M = (0, len(ss))\ni, lps = (1, [0] * M)\nwhile i < M:\n if ss[i] == ss[length]:\n length += 1\n lps[i] = length\n i += 1\n elif length == 0:\n lps[i] = 0\n i += 1\n else:\n length = lps[length - 1]\nret...
<|body_start_0|> if len(s) < 2: return s ss = s + '#' + s[::-1] length, M = (0, len(ss)) i, lps = (1, [0] * M) while i < M: if ss[i] == ss[length]: length += 1 lps[i] = length i += 1 elif length =...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def shortestPalindrome(self, s): """:type s: str :rtype: str""" <|body_0|> def shortestPalindrome2(self, s): """:type s: str :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(s) < 2: return s ss = s + '...
stack_v2_sparse_classes_36k_train_007569
2,505
no_license
[ { "docstring": ":type s: str :rtype: str", "name": "shortestPalindrome", "signature": "def shortestPalindrome(self, s)" }, { "docstring": ":type s: str :rtype: str", "name": "shortestPalindrome2", "signature": "def shortestPalindrome2(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_003429
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def shortestPalindrome(self, s): :type s: str :rtype: str - def shortestPalindrome2(self, s): :type s: str :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def shortestPalindrome(self, s): :type s: str :rtype: str - def shortestPalindrome2(self, s): :type s: str :rtype: str <|skeleton|> class Solution: def shortestPalindrome(s...
635af6e22aa8eef8e7920a585d43a45a891a8157
<|skeleton|> class Solution: def shortestPalindrome(self, s): """:type s: str :rtype: str""" <|body_0|> def shortestPalindrome2(self, s): """:type s: str :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def shortestPalindrome(self, s): """:type s: str :rtype: str""" if len(s) < 2: return s ss = s + '#' + s[::-1] length, M = (0, len(ss)) i, lps = (1, [0] * M) while i < M: if ss[i] == ss[length]: length += 1 ...
the_stack_v2_python_sparse
code214ShortestPalindrome.py
cybelewang/leetcode-python
train
0
db2bdd7c70f8e62d120d5a90e91f0fc749c33cac
[ "if name == 'ALLOW_CHANGE':\n raise AttributeError(\"attribute name 'ALLOW_CHANGE' has been occupied, please use another name\")\nif getattr(self, 'ALLOW_CHANGE', None):\n self.__dict__[name] = value\nelse:\n raise AttributeReadOnlyError(self, name)", "try:\n self.__dict__['ALLOW_CHANGE'] = True\n ...
<|body_start_0|> if name == 'ALLOW_CHANGE': raise AttributeError("attribute name 'ALLOW_CHANGE' has been occupied, please use another name") if getattr(self, 'ALLOW_CHANGE', None): self.__dict__[name] = value else: raise AttributeReadOnlyError(self, name) <|en...
a base class whose attributes are read-only, unless use the context _context_allow_change to change attributes
ReadOnlySpace
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReadOnlySpace: """a base class whose attributes are read-only, unless use the context _context_allow_change to change attributes""" def __setattr__(self, name, value): """attributes could not be change, unless in context _context_allow_change""" <|body_0|> def _context_a...
stack_v2_sparse_classes_36k_train_007570
1,524
permissive
[ { "docstring": "attributes could not be change, unless in context _context_allow_change", "name": "__setattr__", "signature": "def __setattr__(self, name, value)" }, { "docstring": "the context in which attributes could be change for example: 1.wrong way: would raise AttributeReadOnlyError self....
2
stack_v2_sparse_classes_30k_val_000078
Implement the Python class `ReadOnlySpace` described below. Class description: a base class whose attributes are read-only, unless use the context _context_allow_change to change attributes Method signatures and docstrings: - def __setattr__(self, name, value): attributes could not be change, unless in context _conte...
Implement the Python class `ReadOnlySpace` described below. Class description: a base class whose attributes are read-only, unless use the context _context_allow_change to change attributes Method signatures and docstrings: - def __setattr__(self, name, value): attributes could not be change, unless in context _conte...
f4abc48fff907a0785372b941afcd67e62eec825
<|skeleton|> class ReadOnlySpace: """a base class whose attributes are read-only, unless use the context _context_allow_change to change attributes""" def __setattr__(self, name, value): """attributes could not be change, unless in context _context_allow_change""" <|body_0|> def _context_a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReadOnlySpace: """a base class whose attributes are read-only, unless use the context _context_allow_change to change attributes""" def __setattr__(self, name, value): """attributes could not be change, unless in context _context_allow_change""" if name == 'ALLOW_CHANGE': rais...
the_stack_v2_python_sparse
api/BackendAPI/ReadOnlySpace.py
AutoCoinDCF/NEW_API
train
0
bad26b4500eb89e3da48ab3d363241ef355f823e
[ "self.ckpt_folder, self.summary_folder, self.save_path = prepare_folder(filename, sub_folder=sub_folder)\nself.load_ckpt = load_ckpt\nself.do_trace = do_trace\nself.do_save = do_save\nself.debug = debug_mode\nself.debug_step = debug_step\nself.log_device = log_device\nself.query_step = query_step\nself.imbalanced_u...
<|body_start_0|> self.ckpt_folder, self.summary_folder, self.save_path = prepare_folder(filename, sub_folder=sub_folder) self.load_ckpt = load_ckpt self.do_trace = do_trace self.do_save = do_save self.debug = debug_mode self.debug_step = debug_step self.log_device...
Agent
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Agent: def __init__(self, filename, sub_folder, load_ckpt=False, do_trace=False, do_save=True, debug_mode=False, debug_step=800, query_step=500, log_device=False, imbalanced_update=None, print_loss=True): """Agent is a wrapper for the MySession class, used for training and evaluating com...
stack_v2_sparse_classes_36k_train_007571
4,163
permissive
[ { "docstring": "Agent is a wrapper for the MySession class, used for training and evaluating complex model :param filename: :param sub_folder: :param load_ckpt: :param do_trace: :param do_save: :param debug_mode: :param log_device: :param query_step: :param imbalanced_update:", "name": "__init__", "sign...
2
stack_v2_sparse_classes_30k_train_000060
Implement the Python class `Agent` described below. Class description: Implement the Agent class. Method signatures and docstrings: - def __init__(self, filename, sub_folder, load_ckpt=False, do_trace=False, do_save=True, debug_mode=False, debug_step=800, query_step=500, log_device=False, imbalanced_update=None, prin...
Implement the Python class `Agent` described below. Class description: Implement the Agent class. Method signatures and docstrings: - def __init__(self, filename, sub_folder, load_ckpt=False, do_trace=False, do_save=True, debug_mode=False, debug_step=800, query_step=500, log_device=False, imbalanced_update=None, prin...
7522093498b658026344541ddd5c248095763fb6
<|skeleton|> class Agent: def __init__(self, filename, sub_folder, load_ckpt=False, do_trace=False, do_save=True, debug_mode=False, debug_step=800, query_step=500, log_device=False, imbalanced_update=None, print_loss=True): """Agent is a wrapper for the MySession class, used for training and evaluating com...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Agent: def __init__(self, filename, sub_folder, load_ckpt=False, do_trace=False, do_save=True, debug_mode=False, debug_step=800, query_step=500, log_device=False, imbalanced_update=None, print_loss=True): """Agent is a wrapper for the MySession class, used for training and evaluating complex model :pa...
the_stack_v2_python_sparse
GeneralTools/graph_funcs/agent.py
frhrdr/MMD-GAN
train
0
cbd0ef0ecb4c751f9bcaad01ca19239cb985318c
[ "id_sede = request.data['primary_key']\nsede = Sede.objects.get(id=id_sede)\nif len(sede.grupos.filter(activo=True)) > 0:\n return Response({'mensaje': 'La sede contiene grupos activos'}, status=status.HTTP_406_NOT_ACCEPTABLE)\nelse:\n sede.activa = False\n sede.save()\n return Response({'mensaje': 'Cam...
<|body_start_0|> id_sede = request.data['primary_key'] sede = Sede.objects.get(id=id_sede) if len(sede.grupos.filter(activo=True)) > 0: return Response({'mensaje': 'La sede contiene grupos activos'}, status=status.HTTP_406_NOT_ACCEPTABLE) else: sede.activa = False...
SedeViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SedeViewSet: def desactivar_sede(self, request, pk=None): """Metodo que cambia la disponibilidad de la sede""" <|body_0|> def desactivar_participante(self, request, pk=None): """Metodo que cambia la disponibilidad del participante""" <|body_1|> def actua...
stack_v2_sparse_classes_36k_train_007572
13,765
no_license
[ { "docstring": "Metodo que cambia la disponibilidad de la sede", "name": "desactivar_sede", "signature": "def desactivar_sede(self, request, pk=None)" }, { "docstring": "Metodo que cambia la disponibilidad del participante", "name": "desactivar_participante", "signature": "def desactivar...
3
null
Implement the Python class `SedeViewSet` described below. Class description: Implement the SedeViewSet class. Method signatures and docstrings: - def desactivar_sede(self, request, pk=None): Metodo que cambia la disponibilidad de la sede - def desactivar_participante(self, request, pk=None): Metodo que cambia la disp...
Implement the Python class `SedeViewSet` described below. Class description: Implement the SedeViewSet class. Method signatures and docstrings: - def desactivar_sede(self, request, pk=None): Metodo que cambia la disponibilidad de la sede - def desactivar_participante(self, request, pk=None): Metodo que cambia la disp...
0e37786d7173abe820fd10b094ffcc2db9593a9c
<|skeleton|> class SedeViewSet: def desactivar_sede(self, request, pk=None): """Metodo que cambia la disponibilidad de la sede""" <|body_0|> def desactivar_participante(self, request, pk=None): """Metodo que cambia la disponibilidad del participante""" <|body_1|> def actua...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SedeViewSet: def desactivar_sede(self, request, pk=None): """Metodo que cambia la disponibilidad de la sede""" id_sede = request.data['primary_key'] sede = Sede.objects.get(id=id_sede) if len(sede.grupos.filter(activo=True)) > 0: return Response({'mensaje': 'La sede...
the_stack_v2_python_sparse
src/apps/cyd/api_views.py
jinchuika/app-suni
train
7
7913db807fb37bb459bd9f1c8a69f1613fbe57b5
[ "self.check_parameters(params)\ncos = np.cos(params[0] / 2)\nsin = np.sin(params[0] / 2)\nreturn UnitaryMatrix([[cos, -sin], [sin, cos]])", "self.check_parameters(params)\ndcos = -np.sin(params[0] / 2) / 2\ndsin = np.cos(params[0] / 2) / 2\nreturn np.array([[[dcos, -dsin], [dsin, dcos]]], dtype=np.complex128)", ...
<|body_start_0|> self.check_parameters(params) cos = np.cos(params[0] / 2) sin = np.sin(params[0] / 2) return UnitaryMatrix([[cos, -sin], [sin, cos]]) <|end_body_0|> <|body_start_1|> self.check_parameters(params) dcos = -np.sin(params[0] / 2) / 2 dsin = np.cos(pa...
A gate representing an arbitrary rotation around the Y axis. It is given by the following parameterized unitary: .. math:: \\begin{pmatrix} \\cos{\\frac{\\theta}{2}} & -\\sin{\\frac{\\theta}{2}} \\\\ \\sin{\\frac{\\theta}{2}} & \\cos{\\frac{\\theta}{2}} \\\\ \\end{pmatrix}
RYGate
[ "LicenseRef-scancode-unknown-license-reference", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RYGate: """A gate representing an arbitrary rotation around the Y axis. It is given by the following parameterized unitary: .. math:: \\begin{pmatrix} \\cos{\\frac{\\theta}{2}} & -\\sin{\\frac{\\theta}{2}} \\\\ \\sin{\\frac{\\theta}{2}} & \\cos{\\frac{\\theta}{2}} \\\\ \\end{pmatrix}""" def ...
stack_v2_sparse_classes_36k_train_007573
2,402
permissive
[ { "docstring": "Return the unitary for this gate, see :class:`Unitary` for more.", "name": "get_unitary", "signature": "def get_unitary(self, params: RealVector=[]) -> UnitaryMatrix" }, { "docstring": "Return the gradient for this gate. See :class:`DifferentiableUnitary` for more info.", "na...
3
stack_v2_sparse_classes_30k_train_019302
Implement the Python class `RYGate` described below. Class description: A gate representing an arbitrary rotation around the Y axis. It is given by the following parameterized unitary: .. math:: \\begin{pmatrix} \\cos{\\frac{\\theta}{2}} & -\\sin{\\frac{\\theta}{2}} \\\\ \\sin{\\frac{\\theta}{2}} & \\cos{\\frac{\\thet...
Implement the Python class `RYGate` described below. Class description: A gate representing an arbitrary rotation around the Y axis. It is given by the following parameterized unitary: .. math:: \\begin{pmatrix} \\cos{\\frac{\\theta}{2}} & -\\sin{\\frac{\\theta}{2}} \\\\ \\sin{\\frac{\\theta}{2}} & \\cos{\\frac{\\thet...
c89112d15072e8ffffb68cf1757b184e2aeb3dc8
<|skeleton|> class RYGate: """A gate representing an arbitrary rotation around the Y axis. It is given by the following parameterized unitary: .. math:: \\begin{pmatrix} \\cos{\\frac{\\theta}{2}} & -\\sin{\\frac{\\theta}{2}} \\\\ \\sin{\\frac{\\theta}{2}} & \\cos{\\frac{\\theta}{2}} \\\\ \\end{pmatrix}""" def ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RYGate: """A gate representing an arbitrary rotation around the Y axis. It is given by the following parameterized unitary: .. math:: \\begin{pmatrix} \\cos{\\frac{\\theta}{2}} & -\\sin{\\frac{\\theta}{2}} \\\\ \\sin{\\frac{\\theta}{2}} & \\cos{\\frac{\\theta}{2}} \\\\ \\end{pmatrix}""" def get_unitary(s...
the_stack_v2_python_sparse
bqskit/ir/gates/parameterized/ry.py
BQSKit/bqskit
train
54
00b12a3aa7477cd4baf4dbf41de1b90a0f1e59e0
[ "setNums = set(nums)\nres = []\nfor i in range(1, len(nums) + 1):\n if i not in setNums:\n res.append(i)\nreturn res", "res = []\nfor i in range(len(nums)):\n m = abs(nums[i]) - 1\n nums[m] = -nums[m] if nums[m] > 0 else nums[m]\nfor i in range(len(nums)):\n if nums[i] > 0:\n res.append(...
<|body_start_0|> setNums = set(nums) res = [] for i in range(1, len(nums) + 1): if i not in setNums: res.append(i) return res <|end_body_0|> <|body_start_1|> res = [] for i in range(len(nums)): m = abs(nums[i]) - 1 nums...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findDisappearedNumbers2(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def findDisappearedNumbers(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> setNums = ...
stack_v2_sparse_classes_36k_train_007574
1,383
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "findDisappearedNumbers2", "signature": "def findDisappearedNumbers2(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "findDisappearedNumbers", "signature": "def findDisappearedNumbers(self...
2
stack_v2_sparse_classes_30k_train_009290
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findDisappearedNumbers2(self, nums): :type nums: List[int] :rtype: List[int] - def findDisappearedNumbers(self, nums): :type nums: List[int] :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findDisappearedNumbers2(self, nums): :type nums: List[int] :rtype: List[int] - def findDisappearedNumbers(self, nums): :type nums: List[int] :rtype: List[int] <|skeleton|> c...
0fdc1d60cfb3f4c26698a493da4986bfc873e02a
<|skeleton|> class Solution: def findDisappearedNumbers2(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def findDisappearedNumbers(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findDisappearedNumbers2(self, nums): """:type nums: List[int] :rtype: List[int]""" setNums = set(nums) res = [] for i in range(1, len(nums) + 1): if i not in setNums: res.append(i) return res def findDisappearedNumbers(self...
the_stack_v2_python_sparse
448_FindAllNumbersDisappearedInAnArray/448_FindAllNumbersDisappearedInAnArray.py
ranson/leetcode
train
0
42e73af0a8a0595994a59e3400f84348ec0959e1
[ "try:\n encounter: models.Encounter = models.Encounter.create_from_json(data=request.data, patient_profile=request.user.patient_profile)\nexcept custom_exceptions.DataForNewEncounterNotProvidedException as e:\n return response.Response(data=e.get_response_format(), status=status.HTTP_400_BAD_REQUEST)\nseriali...
<|body_start_0|> try: encounter: models.Encounter = models.Encounter.create_from_json(data=request.data, patient_profile=request.user.patient_profile) except custom_exceptions.DataForNewEncounterNotProvidedException as e: return response.Response(data=e.get_response_format(), sta...
Endpoints for Encounter objects.
EncountersEndpoint
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncountersEndpoint: """Endpoints for Encounter objects.""" def post(self, request: Request) -> response.Response: """Adds a new encounter for the user.""" <|body_0|> def put(self, request: Request) -> response.Response: """Updates an existing encounter.""" ...
stack_v2_sparse_classes_36k_train_007575
14,860
no_license
[ { "docstring": "Adds a new encounter for the user.", "name": "post", "signature": "def post(self, request: Request) -> response.Response" }, { "docstring": "Updates an existing encounter.", "name": "put", "signature": "def put(self, request: Request) -> response.Response" }, { "d...
3
stack_v2_sparse_classes_30k_val_000181
Implement the Python class `EncountersEndpoint` described below. Class description: Endpoints for Encounter objects. Method signatures and docstrings: - def post(self, request: Request) -> response.Response: Adds a new encounter for the user. - def put(self, request: Request) -> response.Response: Updates an existing...
Implement the Python class `EncountersEndpoint` described below. Class description: Endpoints for Encounter objects. Method signatures and docstrings: - def post(self, request: Request) -> response.Response: Adds a new encounter for the user. - def put(self, request: Request) -> response.Response: Updates an existing...
b6d757895132b9b3c8c6682c11efadf993d5905b
<|skeleton|> class EncountersEndpoint: """Endpoints for Encounter objects.""" def post(self, request: Request) -> response.Response: """Adds a new encounter for the user.""" <|body_0|> def put(self, request: Request) -> response.Response: """Updates an existing encounter.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EncountersEndpoint: """Endpoints for Encounter objects.""" def post(self, request: Request) -> response.Response: """Adds a new encounter for the user.""" try: encounter: models.Encounter = models.Encounter.create_from_json(data=request.data, patient_profile=request.user.patie...
the_stack_v2_python_sparse
main/model_api.py
kalolad1/cosmos
train
0
47ab5ac4fc8f1707236e4b7c785c21d539943c9c
[ "self.instance = kwargs.pop('instance', None)\ninitial = kwargs.setdefault('initial', {})\ninitial['name'] = self.instance.name\ninitial['description'] = self.instance.description\ninitial['status'] = self.instance.status\ninitial['cc_version'] = self.instance.cc_version\ninitial['idprefix'] = self.instance.case.id...
<|body_start_0|> self.instance = kwargs.pop('instance', None) initial = kwargs.setdefault('initial', {}) initial['name'] = self.instance.name initial['description'] = self.instance.description initial['status'] = self.instance.status initial['cc_version'] = self.instance....
Form for editing a case version.
EditCaseVersionForm
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EditCaseVersionForm: """Form for editing a case version.""" def __init__(self, *args, **kwargs): """Initialize EditCaseVersionForm, pulling instance from kwargs.""" <|body_0|> def save(self, user=None): """Save the edited caseversion.""" <|body_1|> <|end...
stack_v2_sparse_classes_36k_train_007576
16,711
permissive
[ { "docstring": "Initialize EditCaseVersionForm, pulling instance from kwargs.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Save the edited caseversion.", "name": "save", "signature": "def save(self, user=None)" } ]
2
stack_v2_sparse_classes_30k_train_003417
Implement the Python class `EditCaseVersionForm` described below. Class description: Form for editing a case version. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Initialize EditCaseVersionForm, pulling instance from kwargs. - def save(self, user=None): Save the edited caseversion.
Implement the Python class `EditCaseVersionForm` described below. Class description: Form for editing a case version. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Initialize EditCaseVersionForm, pulling instance from kwargs. - def save(self, user=None): Save the edited caseversion. <|skel...
ee54db2fe8ffbf2216d359b7a093b51f2574878e
<|skeleton|> class EditCaseVersionForm: """Form for editing a case version.""" def __init__(self, *args, **kwargs): """Initialize EditCaseVersionForm, pulling instance from kwargs.""" <|body_0|> def save(self, user=None): """Save the edited caseversion.""" <|body_1|> <|end...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EditCaseVersionForm: """Form for editing a case version.""" def __init__(self, *args, **kwargs): """Initialize EditCaseVersionForm, pulling instance from kwargs.""" self.instance = kwargs.pop('instance', None) initial = kwargs.setdefault('initial', {}) initial['name'] = se...
the_stack_v2_python_sparse
moztrap/view/manage/cases/forms.py
isakib/moztrap
train
1
45677cbd1a4371b89bfcf8d0c7b4f4c36348713a
[ "to_xml = format == 'xml'\nmimetype = self.JSON_FORMAT if not to_xml else self.XML_FORMAT\nres_dict = {'result': {'code': status_code, 'error': message}}\ncontent = convert_format(res_dict, to_xml)\nresponse = Response(content, mimetype=mimetype)\nresponse.status_code = status_code\nreturn response", "status_code...
<|body_start_0|> to_xml = format == 'xml' mimetype = self.JSON_FORMAT if not to_xml else self.XML_FORMAT res_dict = {'result': {'code': status_code, 'error': message}} content = convert_format(res_dict, to_xml) response = Response(content, mimetype=mimetype) response.stat...
ErrorResponse
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ErrorResponse: def response(self, status_code, message, format='json'): """make error response body :param status_code: http status code :param message: error message :param format: json or xml :returns flask.Response""" <|body_0|> def unauthorized(cls, message=None, format=...
stack_v2_sparse_classes_36k_train_007577
1,659
no_license
[ { "docstring": "make error response body :param status_code: http status code :param message: error message :param format: json or xml :returns flask.Response", "name": "response", "signature": "def response(self, status_code, message, format='json')" }, { "docstring": "Unauthorized response", ...
4
stack_v2_sparse_classes_30k_train_007991
Implement the Python class `ErrorResponse` described below. Class description: Implement the ErrorResponse class. Method signatures and docstrings: - def response(self, status_code, message, format='json'): make error response body :param status_code: http status code :param message: error message :param format: json...
Implement the Python class `ErrorResponse` described below. Class description: Implement the ErrorResponse class. Method signatures and docstrings: - def response(self, status_code, message, format='json'): make error response body :param status_code: http status code :param message: error message :param format: json...
b37cbd55e2b45c47c689cda8eefebebb29ee2c25
<|skeleton|> class ErrorResponse: def response(self, status_code, message, format='json'): """make error response body :param status_code: http status code :param message: error message :param format: json or xml :returns flask.Response""" <|body_0|> def unauthorized(cls, message=None, format=...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ErrorResponse: def response(self, status_code, message, format='json'): """make error response body :param status_code: http status code :param message: error message :param format: json or xml :returns flask.Response""" to_xml = format == 'xml' mimetype = self.JSON_FORMAT if not to_xm...
the_stack_v2_python_sparse
zip_address/error_response.py
shaper60/ZipToAddress
train
0
95f84fd12c584fdd90fb54d9f5b193c0c61bb680
[ "questions = Question.objects.filter(created_by=request.user)\nworld_id = request.query_params.get('world_id')\nif world_id:\n world = CustomWorld.objects.get(id=world_id)\n if world.created_by != request.user:\n raise PermissionDenied(detail='You do not have access to this Custom World')\n section ...
<|body_start_0|> questions = Question.objects.filter(created_by=request.user) world_id = request.query_params.get('world_id') if world_id: world = CustomWorld.objects.get(id=world_id) if world.created_by != request.user: raise PermissionDenied(detail='You ...
API for creating custom questions Requests handled: GET, POST
CustomQuestionView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomQuestionView: """API for creating custom questions Requests handled: GET, POST""" def get(self, request): """GET request handler. Accepts world_id as a query param for getting questions in the specified World id. :return: Custom questions and answers the user has created :raise...
stack_v2_sparse_classes_36k_train_007578
30,034
no_license
[ { "docstring": "GET request handler. Accepts world_id as a query param for getting questions in the specified World id. :return: Custom questions and answers the user has created :raises: PermissionDenied if world_id specified and User is not the creator of the World.", "name": "get", "signature": "def ...
2
stack_v2_sparse_classes_30k_test_001089
Implement the Python class `CustomQuestionView` described below. Class description: API for creating custom questions Requests handled: GET, POST Method signatures and docstrings: - def get(self, request): GET request handler. Accepts world_id as a query param for getting questions in the specified World id. :return:...
Implement the Python class `CustomQuestionView` described below. Class description: API for creating custom questions Requests handled: GET, POST Method signatures and docstrings: - def get(self, request): GET request handler. Accepts world_id as a query param for getting questions in the specified World id. :return:...
ea0e59de38505beba3b490a3b107f884b35986fd
<|skeleton|> class CustomQuestionView: """API for creating custom questions Requests handled: GET, POST""" def get(self, request): """GET request handler. Accepts world_id as a query param for getting questions in the specified World id. :return: Custom questions and answers the user has created :raise...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CustomQuestionView: """API for creating custom questions Requests handled: GET, POST""" def get(self, request): """GET request handler. Accepts world_id as a query param for getting questions in the specified World id. :return: Custom questions and answers the user has created :raises: Permission...
the_stack_v2_python_sparse
main/views.py
weixingp/slay-the-software-backend
train
0
435f48322403ca8e571f3bccfe8cc3a0a1677b7e
[ "super().__init__()\ncheck_boundaries(boundaries)\nself.filling = filling\nself.mode = mode\nself.boundaries = boundaries", "self.randomize(None)\nself.magnitude = self.R.uniform(low=self.boundaries[0], high=self.boundaries[1])\nlength = signal.shape[1]\nshift_idx = round(self.magnitude * length)\nsig = convert_d...
<|body_start_0|> super().__init__() check_boundaries(boundaries) self.filling = filling self.mode = mode self.boundaries = boundaries <|end_body_0|> <|body_start_1|> self.randomize(None) self.magnitude = self.R.uniform(low=self.boundaries[0], high=self.boundaries...
Apply a random shift on a signal
SignalRandShift
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SignalRandShift: """Apply a random shift on a signal""" def __init__(self, mode: str | None='wrap', filling: float | None=0.0, boundaries: Sequence[float]=(-1.0, 1.0)) -> None: """Args: mode: define how the extension of the input array is done beyond its boundaries, see for more deta...
stack_v2_sparse_classes_36k_train_007579
16,322
permissive
[ { "docstring": "Args: mode: define how the extension of the input array is done beyond its boundaries, see for more details : https://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.shift.html. filling: value to fill past edges of input if mode is ‘constant’. Default is 0.0. see for mode details : ht...
2
stack_v2_sparse_classes_30k_train_013452
Implement the Python class `SignalRandShift` described below. Class description: Apply a random shift on a signal Method signatures and docstrings: - def __init__(self, mode: str | None='wrap', filling: float | None=0.0, boundaries: Sequence[float]=(-1.0, 1.0)) -> None: Args: mode: define how the extension of the inp...
Implement the Python class `SignalRandShift` described below. Class description: Apply a random shift on a signal Method signatures and docstrings: - def __init__(self, mode: str | None='wrap', filling: float | None=0.0, boundaries: Sequence[float]=(-1.0, 1.0)) -> None: Args: mode: define how the extension of the inp...
e48c3e2c741fa3fc705c4425d17ac4a5afac6c47
<|skeleton|> class SignalRandShift: """Apply a random shift on a signal""" def __init__(self, mode: str | None='wrap', filling: float | None=0.0, boundaries: Sequence[float]=(-1.0, 1.0)) -> None: """Args: mode: define how the extension of the input array is done beyond its boundaries, see for more deta...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SignalRandShift: """Apply a random shift on a signal""" def __init__(self, mode: str | None='wrap', filling: float | None=0.0, boundaries: Sequence[float]=(-1.0, 1.0)) -> None: """Args: mode: define how the extension of the input array is done beyond its boundaries, see for more details : https:/...
the_stack_v2_python_sparse
monai/transforms/signal/array.py
Project-MONAI/MONAI
train
4,805
a2027fc35fac278eedc0d6b16539ecf32c5ecaa2
[ "super(FeatureNN, self).__init__()\nself._num_units = num_units\nself._dropout = dropout\nself._trainable = trainable\nself._tf_name_scope = name_scope\nself._feature_num = feature_num\nself._shallow = shallow\nself._activation = activation", "self.hidden_layers = [ActivationLayer(self._num_units, trainable=self....
<|body_start_0|> super(FeatureNN, self).__init__() self._num_units = num_units self._dropout = dropout self._trainable = trainable self._tf_name_scope = name_scope self._feature_num = feature_num self._shallow = shallow self._activation = activation <|end_...
Neural Network model for each individual feature. Attributes: hidden_layers: A list containing hidden layers. The first layer is an `ActivationLayer` containing `num_units` neurons with specified `activation`. If `shallow` is False, then it additionally contains 2 tf.keras.layers.Dense ReLU layers with 64, 32 hidden un...
FeatureNN
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FeatureNN: """Neural Network model for each individual feature. Attributes: hidden_layers: A list containing hidden layers. The first layer is an `ActivationLayer` containing `num_units` neurons with specified `activation`. If `shallow` is False, then it additionally contains 2 tf.keras.layers.De...
stack_v2_sparse_classes_36k_train_007580
10,796
permissive
[ { "docstring": "Initializes FeatureNN hyperparameters. Args: num_units: Number of hidden units in first hidden layer. dropout: Coefficient for dropout regularization. trainable: Whether the FeatureNN parameters are trainable or not. shallow: If True, then a shallow network with a single hidden layer is created,...
3
stack_v2_sparse_classes_30k_train_011110
Implement the Python class `FeatureNN` described below. Class description: Neural Network model for each individual feature. Attributes: hidden_layers: A list containing hidden layers. The first layer is an `ActivationLayer` containing `num_units` neurons with specified `activation`. If `shallow` is False, then it add...
Implement the Python class `FeatureNN` described below. Class description: Neural Network model for each individual feature. Attributes: hidden_layers: A list containing hidden layers. The first layer is an `ActivationLayer` containing `num_units` neurons with specified `activation`. If `shallow` is False, then it add...
727ec399ad17b4dd1f71ce69a26fc3b0371d9fa7
<|skeleton|> class FeatureNN: """Neural Network model for each individual feature. Attributes: hidden_layers: A list containing hidden layers. The first layer is an `ActivationLayer` containing `num_units` neurons with specified `activation`. If `shallow` is False, then it additionally contains 2 tf.keras.layers.De...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FeatureNN: """Neural Network model for each individual feature. Attributes: hidden_layers: A list containing hidden layers. The first layer is an `ActivationLayer` containing `num_units` neurons with specified `activation`. If `shallow` is False, then it additionally contains 2 tf.keras.layers.Dense ReLU laye...
the_stack_v2_python_sparse
neural_additive_models/models.py
Ayoob7/google-research
train
2
942e663d7dbb3c6e3cca7b1e16143f767e7f8059
[ "if not feature_vectors:\n return np.zeros((0, 0), dtype=int)\nfirst_vector = feature_vectors[0]\nmatrix_shape = (0, first_vector.shape[1])\nfeatures_matrix = np.zeros(matrix_shape, dtype=first_vector.dtype)\nfor lfv in feature_vectors:\n if lfv.shape[1] != first_vector.shape[1]:\n raise IndexError('Gi...
<|body_start_0|> if not feature_vectors: return np.zeros((0, 0), dtype=int) first_vector = feature_vectors[0] matrix_shape = (0, first_vector.shape[1]) features_matrix = np.zeros(matrix_shape, dtype=first_vector.dtype) for lfv in feature_vectors: if lfv.sh...
FeatureExtractor
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FeatureExtractor: def get_feature_matrix(feature_vectors: List[np.ndarray]) -> np.ndarray: """Given a list of feature vectors returns a matrix with each feature vector on one row with the row ordering matching the original ordering of the vector in the list. :param feature_vectors: The f...
stack_v2_sparse_classes_36k_train_007581
7,852
permissive
[ { "docstring": "Given a list of feature vectors returns a matrix with each feature vector on one row with the row ordering matching the original ordering of the vector in the list. :param feature_vectors: The feature vectors. :return: The matrix of feature vectors.", "name": "get_feature_matrix", "signa...
4
stack_v2_sparse_classes_30k_test_001103
Implement the Python class `FeatureExtractor` described below. Class description: Implement the FeatureExtractor class. Method signatures and docstrings: - def get_feature_matrix(feature_vectors: List[np.ndarray]) -> np.ndarray: Given a list of feature vectors returns a matrix with each feature vector on one row with...
Implement the Python class `FeatureExtractor` described below. Class description: Implement the FeatureExtractor class. Method signatures and docstrings: - def get_feature_matrix(feature_vectors: List[np.ndarray]) -> np.ndarray: Given a list of feature vectors returns a matrix with each feature vector on one row with...
abadbb1feca1fc970c1180641aaa00a268bb5692
<|skeleton|> class FeatureExtractor: def get_feature_matrix(feature_vectors: List[np.ndarray]) -> np.ndarray: """Given a list of feature vectors returns a matrix with each feature vector on one row with the row ordering matching the original ordering of the vector in the list. :param feature_vectors: The f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FeatureExtractor: def get_feature_matrix(feature_vectors: List[np.ndarray]) -> np.ndarray: """Given a list of feature vectors returns a matrix with each feature vector on one row with the row ordering matching the original ordering of the vector in the list. :param feature_vectors: The feature vectors...
the_stack_v2_python_sparse
feature_extraction.py
apoorvkhurasia/texpredict
train
0
acb83f03c8d760d3f16be11135a047cbfcfd08b3
[ "super().__init__(**kwargs)\nself.id = str(uuid.uuid1())\nself.coupon = coupon\nself.bond_yield = bond_yield\nfor name, value in kwargs.items():\n self.__setattr__(name, value)", "output = ''\noutput += self.stock_name + self.get_spaces(len(header[0]) - len(self.stock_name))\noutput += str(self.num_shares) + s...
<|body_start_0|> super().__init__(**kwargs) self.id = str(uuid.uuid1()) self.coupon = coupon self.bond_yield = bond_yield for name, value in kwargs.items(): self.__setattr__(name, value) <|end_body_0|> <|body_start_1|> output = '' output += self.stock...
A class for managing bonds.
Bond
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Bond: """A class for managing bonds.""" def __init__(self, coupon=None, bond_yield=None, **kwargs): """Sets the initial variables. These are used for printing content and storing initial data.""" <|body_0|> def print_output_row(self, header): """Prints individual...
stack_v2_sparse_classes_36k_train_007582
2,075
no_license
[ { "docstring": "Sets the initial variables. These are used for printing content and storing initial data.", "name": "__init__", "signature": "def __init__(self, coupon=None, bond_yield=None, **kwargs)" }, { "docstring": "Prints individual rows of bond data.", "name": "print_output_row", ...
2
stack_v2_sparse_classes_30k_train_010903
Implement the Python class `Bond` described below. Class description: A class for managing bonds. Method signatures and docstrings: - def __init__(self, coupon=None, bond_yield=None, **kwargs): Sets the initial variables. These are used for printing content and storing initial data. - def print_output_row(self, heade...
Implement the Python class `Bond` described below. Class description: A class for managing bonds. Method signatures and docstrings: - def __init__(self, coupon=None, bond_yield=None, **kwargs): Sets the initial variables. These are used for printing content and storing initial data. - def print_output_row(self, heade...
c6cf1d5367f2f5f8ee9cd63a8f7dd9a09fb07d6f
<|skeleton|> class Bond: """A class for managing bonds.""" def __init__(self, coupon=None, bond_yield=None, **kwargs): """Sets the initial variables. These are used for printing content and storing initial data.""" <|body_0|> def print_output_row(self, header): """Prints individual...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Bond: """A class for managing bonds.""" def __init__(self, coupon=None, bond_yield=None, **kwargs): """Sets the initial variables. These are used for printing content and storing initial data.""" super().__init__(**kwargs) self.id = str(uuid.uuid1()) self.coupon = coupon ...
the_stack_v2_python_sparse
five/carterk_assignment5_bond.py
kylecarter/ict-4370-python-programming
train
1
52199d5344bb74983cb53ee0493b9ae79490b3d4
[ "username = request.user.get_username()\nserializer = ViewSerializer(username=username, repo_base=repo_base, request=request)\nviews = serializer.list_views(repo_name)\nreturn Response(views, status=status.HTTP_200_OK)", "username = request.user.get_username()\nserializer = ViewSerializer(username=username, repo_...
<|body_start_0|> username = request.user.get_username() serializer = ViewSerializer(username=username, repo_base=repo_base, request=request) views = serializer.list_views(repo_name) return Response(views, status=status.HTTP_200_OK) <|end_body_0|> <|body_start_1|> username = requ...
Views
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Views: def get(self, request, repo_base, repo_name, format=None): """Views in a repo""" <|body_0|> def post(self, request, repo_base, repo_name, format=None): """Create a view in a repo --- omit_serializer: true parameters: - name: view_name in: body type: string des...
stack_v2_sparse_classes_36k_train_007583
31,465
permissive
[ { "docstring": "Views in a repo", "name": "get", "signature": "def get(self, request, repo_base, repo_name, format=None)" }, { "docstring": "Create a view in a repo --- omit_serializer: true parameters: - name: view_name in: body type: string description: name of the the view to be created requi...
2
stack_v2_sparse_classes_30k_train_000415
Implement the Python class `Views` described below. Class description: Implement the Views class. Method signatures and docstrings: - def get(self, request, repo_base, repo_name, format=None): Views in a repo - def post(self, request, repo_base, repo_name, format=None): Create a view in a repo --- omit_serializer: tr...
Implement the Python class `Views` described below. Class description: Implement the Views class. Method signatures and docstrings: - def get(self, request, repo_base, repo_name, format=None): Views in a repo - def post(self, request, repo_base, repo_name, format=None): Create a view in a repo --- omit_serializer: tr...
f066b472c2b66cc3b868bbe433aed2d4557aea32
<|skeleton|> class Views: def get(self, request, repo_base, repo_name, format=None): """Views in a repo""" <|body_0|> def post(self, request, repo_base, repo_name, format=None): """Create a view in a repo --- omit_serializer: true parameters: - name: view_name in: body type: string des...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Views: def get(self, request, repo_base, repo_name, format=None): """Views in a repo""" username = request.user.get_username() serializer = ViewSerializer(username=username, repo_base=repo_base, request=request) views = serializer.list_views(repo_name) return Response(v...
the_stack_v2_python_sparse
src/api/views.py
datahuborg/datahub
train
199
f05047ef220c21327da84322fb94a13c32dd9f6b
[ "super().__init__()\nself.cache_prior = cache_prior\nself._cache = {}\nself.t_conv1 = nn.Conv1d(adim, adim, kernel_size=3, padding=1)\nself.t_conv2 = nn.Conv1d(adim, adim, kernel_size=1, padding=0)\nself.f_conv1 = nn.Conv1d(odim, adim, kernel_size=3, padding=1)\nself.f_conv2 = nn.Conv1d(adim, adim, kernel_size=3, p...
<|body_start_0|> super().__init__() self.cache_prior = cache_prior self._cache = {} self.t_conv1 = nn.Conv1d(adim, adim, kernel_size=3, padding=1) self.t_conv2 = nn.Conv1d(adim, adim, kernel_size=1, padding=0) self.f_conv1 = nn.Conv1d(odim, adim, kernel_size=3, padding=1)...
Alignment Learning Framework proposed for parallel TTS models in: https://arxiv.org/abs/2108.10447
AlignmentModule
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlignmentModule: """Alignment Learning Framework proposed for parallel TTS models in: https://arxiv.org/abs/2108.10447""" def __init__(self, adim, odim, cache_prior=True): """Initialize AlignmentModule. Args: adim (int): Dimension of attention. odim (int): Dimension of feats. cache_p...
stack_v2_sparse_classes_36k_train_007584
7,515
permissive
[ { "docstring": "Initialize AlignmentModule. Args: adim (int): Dimension of attention. odim (int): Dimension of feats. cache_prior (bool): Whether to cache beta-binomial prior.", "name": "__init__", "signature": "def __init__(self, adim, odim, cache_prior=True)" }, { "docstring": "Calculate align...
3
null
Implement the Python class `AlignmentModule` described below. Class description: Alignment Learning Framework proposed for parallel TTS models in: https://arxiv.org/abs/2108.10447 Method signatures and docstrings: - def __init__(self, adim, odim, cache_prior=True): Initialize AlignmentModule. Args: adim (int): Dimens...
Implement the Python class `AlignmentModule` described below. Class description: Alignment Learning Framework proposed for parallel TTS models in: https://arxiv.org/abs/2108.10447 Method signatures and docstrings: - def __init__(self, adim, odim, cache_prior=True): Initialize AlignmentModule. Args: adim (int): Dimens...
bcd20948db7846ee523443ef9fd78c7a1248c95e
<|skeleton|> class AlignmentModule: """Alignment Learning Framework proposed for parallel TTS models in: https://arxiv.org/abs/2108.10447""" def __init__(self, adim, odim, cache_prior=True): """Initialize AlignmentModule. Args: adim (int): Dimension of attention. odim (int): Dimension of feats. cache_p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AlignmentModule: """Alignment Learning Framework proposed for parallel TTS models in: https://arxiv.org/abs/2108.10447""" def __init__(self, adim, odim, cache_prior=True): """Initialize AlignmentModule. Args: adim (int): Dimension of attention. odim (int): Dimension of feats. cache_prior (bool): ...
the_stack_v2_python_sparse
espnet2/gan_tts/jets/alignments.py
espnet/espnet
train
7,242
30d5c2e0091a6f2423f959a21bb21b035af51d12
[ "super(VenueModel, self).__init__()\nself.config = config\nself.vocab = vocab\nself.dim = 1", "num_ments = entity['count']\nif entity['v']:\n return len(entity['v']) / float(num_ments)\nelse:\n return 0.0", "fv = []\nfv.append(self.num_vs_over_num_ments(entity))\nreturn fv" ]
<|body_start_0|> super(VenueModel, self).__init__() self.config = config self.vocab = vocab self.dim = 1 <|end_body_0|> <|body_start_1|> num_ments = entity['count'] if entity['v']: return len(entity['v']) / float(num_ments) else: return 0....
VenueModel
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VenueModel: def __init__(self, config, vocab): """Init.""" <|body_0|> def num_vs_over_num_ments(self, entity): """(max year - min year) / # menmtions""" <|body_1|> def emb(self, entity): """:param routee: :param dest: :return: Some kind of vector...
stack_v2_sparse_classes_36k_train_007585
1,373
permissive
[ { "docstring": "Init.", "name": "__init__", "signature": "def __init__(self, config, vocab)" }, { "docstring": "(max year - min year) / # menmtions", "name": "num_vs_over_num_ments", "signature": "def num_vs_over_num_ments(self, entity)" }, { "docstring": ":param routee: :param d...
3
null
Implement the Python class `VenueModel` described below. Class description: Implement the VenueModel class. Method signatures and docstrings: - def __init__(self, config, vocab): Init. - def num_vs_over_num_ments(self, entity): (max year - min year) / # menmtions - def emb(self, entity): :param routee: :param dest: :...
Implement the Python class `VenueModel` described below. Class description: Implement the VenueModel class. Method signatures and docstrings: - def __init__(self, config, vocab): Init. - def num_vs_over_num_ments(self, entity): (max year - min year) / # menmtions - def emb(self, entity): :param routee: :param dest: :...
542659170897ad05f7612639cb918886859ae9d6
<|skeleton|> class VenueModel: def __init__(self, config, vocab): """Init.""" <|body_0|> def num_vs_over_num_ments(self, entity): """(max year - min year) / # menmtions""" <|body_1|> def emb(self, entity): """:param routee: :param dest: :return: Some kind of vector...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VenueModel: def __init__(self, config, vocab): """Init.""" super(VenueModel, self).__init__() self.config = config self.vocab = vocab self.dim = 1 def num_vs_over_num_ments(self, entity): """(max year - min year) / # menmtions""" num_ments = entity[...
the_stack_v2_python_sparse
src/python/coref/models/entity/VenueModel.py
nmonath/coref_tools
train
0
ff6289c34e50b80b05a4e2b1b9f700998e05b40b
[ "distribution = Counter(nums).keys()\nraw = set(range(1, len(nums) + 1))\nres = list(raw.difference(set(distribution)))\nreturn res", "for i in xrange(len(nums)):\n index = abs(nums[i]) - 1\n nums[index] = -abs(nums[index])\nreturn [i + 1 for i in range(len(nums)) if nums[i] > 0]" ]
<|body_start_0|> distribution = Counter(nums).keys() raw = set(range(1, len(nums) + 1)) res = list(raw.difference(set(distribution))) return res <|end_body_0|> <|body_start_1|> for i in xrange(len(nums)): index = abs(nums[i]) - 1 nums[index] = -abs(nums[i...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findDisappearedNumbers(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def findDisappearedNumbers2(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> distributi...
stack_v2_sparse_classes_36k_train_007586
875
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "findDisappearedNumbers", "signature": "def findDisappearedNumbers(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "findDisappearedNumbers2", "signature": "def findDisappearedNumbers2(self...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findDisappearedNumbers(self, nums): :type nums: List[int] :rtype: List[int] - def findDisappearedNumbers2(self, nums): :type nums: List[int] :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findDisappearedNumbers(self, nums): :type nums: List[int] :rtype: List[int] - def findDisappearedNumbers2(self, nums): :type nums: List[int] :rtype: List[int] <|skeleton|> c...
0fc4c7af59246e3064db41989a45d9db413a624b
<|skeleton|> class Solution: def findDisappearedNumbers(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def findDisappearedNumbers2(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findDisappearedNumbers(self, nums): """:type nums: List[int] :rtype: List[int]""" distribution = Counter(nums).keys() raw = set(range(1, len(nums) + 1)) res = list(raw.difference(set(distribution))) return res def findDisappearedNumbers2(self, nums): ...
the_stack_v2_python_sparse
448. Find All Numbers Disappeared in an Array/disappeared.py
Macielyoung/LeetCode
train
1
f11a0afe24f19099e5b33366d1722047b217899e
[ "super(DecodingAlgorithm, self).__init__(train_state_spec=decoder.state_spec, name=name)\nself._decoder = decoder\nself._loss = loss\nself._loss_weight = loss_weight", "input, target = inputs\npred, state = self._decoder(input, state=state)\nassert pred.shape == target.shape\nloss = self._loss(pred, target)\nasse...
<|body_start_0|> super(DecodingAlgorithm, self).__init__(train_state_spec=decoder.state_spec, name=name) self._decoder = decoder self._loss = loss self._loss_weight = loss_weight <|end_body_0|> <|body_start_1|> input, target = inputs pred, state = self._decoder(input, st...
Generic decoding algorithm.
DecodingAlgorithm
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DecodingAlgorithm: """Generic decoding algorithm.""" def __init__(self, decoder: Network, loss=torch.nn.MSELoss(reduction='none'), loss_weight=1.0, name='DecodingAlgorithm'): """Args: decoder (Network): network for decoding target from input. loss (Callable): loss function with signa...
stack_v2_sparse_classes_36k_train_007587
2,571
permissive
[ { "docstring": "Args: decoder (Network): network for decoding target from input. loss (Callable): loss function with signature ``loss(y_pred, y_true)``. Note that it should not reduce to a scalar. It should at least keep the batch dimension in the returned loss. loss_weight (float): weight for the loss.", "...
2
stack_v2_sparse_classes_30k_train_001649
Implement the Python class `DecodingAlgorithm` described below. Class description: Generic decoding algorithm. Method signatures and docstrings: - def __init__(self, decoder: Network, loss=torch.nn.MSELoss(reduction='none'), loss_weight=1.0, name='DecodingAlgorithm'): Args: decoder (Network): network for decoding tar...
Implement the Python class `DecodingAlgorithm` described below. Class description: Generic decoding algorithm. Method signatures and docstrings: - def __init__(self, decoder: Network, loss=torch.nn.MSELoss(reduction='none'), loss_weight=1.0, name='DecodingAlgorithm'): Args: decoder (Network): network for decoding tar...
b00ff2fa5e660de31020338ba340263183fbeaa4
<|skeleton|> class DecodingAlgorithm: """Generic decoding algorithm.""" def __init__(self, decoder: Network, loss=torch.nn.MSELoss(reduction='none'), loss_weight=1.0, name='DecodingAlgorithm'): """Args: decoder (Network): network for decoding target from input. loss (Callable): loss function with signa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DecodingAlgorithm: """Generic decoding algorithm.""" def __init__(self, decoder: Network, loss=torch.nn.MSELoss(reduction='none'), loss_weight=1.0, name='DecodingAlgorithm'): """Args: decoder (Network): network for decoding target from input. loss (Callable): loss function with signature ``loss(y...
the_stack_v2_python_sparse
alf/algorithms/decoding_algorithm.py
HorizonRobotics/alf
train
288
d01e533c15be3ffa5d7717e6909ec649a258309c
[ "self.__ops = ops\nself.__nops = len(ops)\nfor iop in range(self.__nops):\n if not isinstance(self.__ops[iop], operator):\n raise Exception('Elements of ops list must be of type operator')\nif self.__nops != len(dims):\n raise Exception('Number of dimensions (%d) must equal number of operators (%d)' % ...
<|body_start_0|> self.__ops = ops self.__nops = len(ops) for iop in range(self.__nops): if not isinstance(self.__ops[iop], operator): raise Exception('Elements of ops list must be of type operator') if self.__nops != len(dims): raise Exception('Num...
A diagonal operator
diagop
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class diagop: """A diagonal operator""" def __init__(self, ops, dims, epss=None): """diagop constructor Parameters ops - a list of operators used to form the row operator dims - a list of dictionaries that contain the dimensions of the inputs and outputs of the arrays For example dims = [{...
stack_v2_sparse_classes_36k_train_007588
13,837
no_license
[ { "docstring": "diagop constructor Parameters ops - a list of operators used to form the row operator dims - a list of dictionaries that contain the dimensions of the inputs and outputs of the arrays For example dims = [{'nrows': 10, 'ncols': 10},...] epss - a list of scalar values to be applied to the output o...
4
stack_v2_sparse_classes_30k_train_011893
Implement the Python class `diagop` described below. Class description: A diagonal operator Method signatures and docstrings: - def __init__(self, ops, dims, epss=None): diagop constructor Parameters ops - a list of operators used to form the row operator dims - a list of dictionaries that contain the dimensions of t...
Implement the Python class `diagop` described below. Class description: A diagonal operator Method signatures and docstrings: - def __init__(self, ops, dims, epss=None): diagop constructor Parameters ops - a list of operators used to form the row operator dims - a list of dictionaries that contain the dimensions of t...
32a303eddd13385d8778b8bb3b4fbbfbe78bea51
<|skeleton|> class diagop: """A diagonal operator""" def __init__(self, ops, dims, epss=None): """diagop constructor Parameters ops - a list of operators used to form the row operator dims - a list of dictionaries that contain the dimensions of the inputs and outputs of the arrays For example dims = [{...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class diagop: """A diagonal operator""" def __init__(self, ops, dims, epss=None): """diagop constructor Parameters ops - a list of operators used to form the row operator dims - a list of dictionaries that contain the dimensions of the inputs and outputs of the arrays For example dims = [{'nrows': 10, ...
the_stack_v2_python_sparse
opt/linopt/combops.py
ke0m/scaas
train
2
40ace0706c50fd0f067d7c3a9cc4e692ddc0ac5f
[ "self.Whf = np.random.randn(i + h, h)\nself.Whb = np.random.randn(i + h, h)\nself.Wy = np.random.randn(2 * h, o)\nself.bhf = np.zeros((1, h))\nself.bhb = np.zeros((1, h))\nself.by = np.zeros((1, o))", "stacked = np.hstack((h_prev, x_t))\nh_next = np.tanh(stacked @ self.Whf + self.bhf)\nreturn h_next" ]
<|body_start_0|> self.Whf = np.random.randn(i + h, h) self.Whb = np.random.randn(i + h, h) self.Wy = np.random.randn(2 * h, o) self.bhf = np.zeros((1, h)) self.bhb = np.zeros((1, h)) self.by = np.zeros((1, o)) <|end_body_0|> <|body_start_1|> stacked = np.hstack((...
BidirectionalCell class
BidirectionalCell
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BidirectionalCell: """BidirectionalCell class""" def __init__(self, i, h, o): """Initializer Arguments: i {int} -- Is dimensionality of the data h {int} -- Is dimensionality of hidden state o {int} -- Is dimensionality of the outputs""" <|body_0|> def forward(self, h_pre...
stack_v2_sparse_classes_36k_train_007589
1,119
no_license
[ { "docstring": "Initializer Arguments: i {int} -- Is dimensionality of the data h {int} -- Is dimensionality of hidden state o {int} -- Is dimensionality of the outputs", "name": "__init__", "signature": "def __init__(self, i, h, o)" }, { "docstring": "Performs forward propagation for one time s...
2
null
Implement the Python class `BidirectionalCell` described below. Class description: BidirectionalCell class Method signatures and docstrings: - def __init__(self, i, h, o): Initializer Arguments: i {int} -- Is dimensionality of the data h {int} -- Is dimensionality of hidden state o {int} -- Is dimensionality of the o...
Implement the Python class `BidirectionalCell` described below. Class description: BidirectionalCell class Method signatures and docstrings: - def __init__(self, i, h, o): Initializer Arguments: i {int} -- Is dimensionality of the data h {int} -- Is dimensionality of hidden state o {int} -- Is dimensionality of the o...
2ddae38cc25d914488451b8c30e1234f1fa55ebe
<|skeleton|> class BidirectionalCell: """BidirectionalCell class""" def __init__(self, i, h, o): """Initializer Arguments: i {int} -- Is dimensionality of the data h {int} -- Is dimensionality of hidden state o {int} -- Is dimensionality of the outputs""" <|body_0|> def forward(self, h_pre...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BidirectionalCell: """BidirectionalCell class""" def __init__(self, i, h, o): """Initializer Arguments: i {int} -- Is dimensionality of the data h {int} -- Is dimensionality of hidden state o {int} -- Is dimensionality of the outputs""" self.Whf = np.random.randn(i + h, h) self.Wh...
the_stack_v2_python_sparse
supervised_learning/0x0D-RNNs/5-bi_forward.py
KoeusIss/holbertonschool-machine_learning
train
0
b7117c6d58b6c2e48f6abe080cd7e4d15144f522
[ "starttime = request.query_params.get('value1')\nendtime = request.query_params.get('value2')\nprint(starttime, endtime)\nif starttime == '0':\n myBugResult = Bugs.objects.filter(delete_flag=0).order_by('team')\n serializer = Bugsserializer(myBugResult, many=True)\n return Response({'status': True, 'messag...
<|body_start_0|> starttime = request.query_params.get('value1') endtime = request.query_params.get('value2') print(starttime, endtime) if starttime == '0': myBugResult = Bugs.objects.filter(delete_flag=0).order_by('team') serializer = Bugsserializer(myBugResult, m...
bug汇总
Bug
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Bug: """bug汇总""" def get(self, request): """获取bug列表""" <|body_0|> def post(self, request): """新增bug""" <|body_1|> def put(self, request): """修改bug""" <|body_2|> def delete(self, request): """删除bug""" <|body_3|> <...
stack_v2_sparse_classes_36k_train_007590
3,316
no_license
[ { "docstring": "获取bug列表", "name": "get", "signature": "def get(self, request)" }, { "docstring": "新增bug", "name": "post", "signature": "def post(self, request)" }, { "docstring": "修改bug", "name": "put", "signature": "def put(self, request)" }, { "docstring": "删除bu...
4
stack_v2_sparse_classes_30k_train_016386
Implement the Python class `Bug` described below. Class description: bug汇总 Method signatures and docstrings: - def get(self, request): 获取bug列表 - def post(self, request): 新增bug - def put(self, request): 修改bug - def delete(self, request): 删除bug
Implement the Python class `Bug` described below. Class description: bug汇总 Method signatures and docstrings: - def get(self, request): 获取bug列表 - def post(self, request): 新增bug - def put(self, request): 修改bug - def delete(self, request): 删除bug <|skeleton|> class Bug: """bug汇总""" def get(self, request): ...
9ccebcc6820af3f950c28fc2a4dee4f41a3157f1
<|skeleton|> class Bug: """bug汇总""" def get(self, request): """获取bug列表""" <|body_0|> def post(self, request): """新增bug""" <|body_1|> def put(self, request): """修改bug""" <|body_2|> def delete(self, request): """删除bug""" <|body_3|> <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Bug: """bug汇总""" def get(self, request): """获取bug列表""" starttime = request.query_params.get('value1') endtime = request.query_params.get('value2') print(starttime, endtime) if starttime == '0': myBugResult = Bugs.objects.filter(delete_flag=0).order_by('...
the_stack_v2_python_sparse
moon/task/views_bug.py
xiaominwanglast/python
train
0
78f36744db74815d55abded3d2df0faf98fa8cd6
[ "edges_conclude_nodes = np.array([])\nfor node in I_list:\n edges_conclude_nodes = np.where(np.array(df_hyper_matrix.loc[node]) == 1)[0]\nnodes_in_edges = np.array([])\nfor edge in edges_conclude_nodes:\n nodes = np.where(np.array(df_hyper_matrix[edge]) == 1)[0]\n nodes_in_edges = np.append(nodes_in_edges,...
<|body_start_0|> edges_conclude_nodes = np.array([]) for node in I_list: edges_conclude_nodes = np.where(np.array(df_hyper_matrix.loc[node]) == 1)[0] nodes_in_edges = np.array([]) for edge in edges_conclude_nodes: nodes = np.where(np.array(df_hyper_matrix[edge]) =...
策略过程封装类:用于不同策略寻找可能感染的节点过程及筛选过程
ProcessFuncs
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProcessFuncs: """策略过程封装类:用于不同策略寻找可能感染的节点过程及筛选过程""" def findAdjNode_RP(self, I_list, df_hyper_matrix): """找到邻居节点集合 :param I_list: 感染节点集 :param df_hyper_matrix: 超图的点边矩阵 :return: 不重复的邻居节点集 np.unique(nodes_in_edges)""" <|body_0|> def findAdjNode_CP(self, I_list, df_hyper_mat...
stack_v2_sparse_classes_36k_train_007591
2,714
no_license
[ { "docstring": "找到邻居节点集合 :param I_list: 感染节点集 :param df_hyper_matrix: 超图的点边矩阵 :return: 不重复的邻居节点集 np.unique(nodes_in_edges)", "name": "findAdjNode_RP", "signature": "def findAdjNode_RP(self, I_list, df_hyper_matrix)" }, { "docstring": "找到邻居节点集合 :param I_list: 感染节点集 :param df_hyper_matrix: 超图的点边矩阵...
4
stack_v2_sparse_classes_30k_train_009696
Implement the Python class `ProcessFuncs` described below. Class description: 策略过程封装类:用于不同策略寻找可能感染的节点过程及筛选过程 Method signatures and docstrings: - def findAdjNode_RP(self, I_list, df_hyper_matrix): 找到邻居节点集合 :param I_list: 感染节点集 :param df_hyper_matrix: 超图的点边矩阵 :return: 不重复的邻居节点集 np.unique(nodes_in_edges) - def findAdjNo...
Implement the Python class `ProcessFuncs` described below. Class description: 策略过程封装类:用于不同策略寻找可能感染的节点过程及筛选过程 Method signatures and docstrings: - def findAdjNode_RP(self, I_list, df_hyper_matrix): 找到邻居节点集合 :param I_list: 感染节点集 :param df_hyper_matrix: 超图的点边矩阵 :return: 不重复的邻居节点集 np.unique(nodes_in_edges) - def findAdjNo...
42026f77b758168d59bc1d11ae643a5cadc7ce0d
<|skeleton|> class ProcessFuncs: """策略过程封装类:用于不同策略寻找可能感染的节点过程及筛选过程""" def findAdjNode_RP(self, I_list, df_hyper_matrix): """找到邻居节点集合 :param I_list: 感染节点集 :param df_hyper_matrix: 超图的点边矩阵 :return: 不重复的邻居节点集 np.unique(nodes_in_edges)""" <|body_0|> def findAdjNode_CP(self, I_list, df_hyper_mat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProcessFuncs: """策略过程封装类:用于不同策略寻找可能感染的节点过程及筛选过程""" def findAdjNode_RP(self, I_list, df_hyper_matrix): """找到邻居节点集合 :param I_list: 感染节点集 :param df_hyper_matrix: 超图的点边矩阵 :return: 不重复的邻居节点集 np.unique(nodes_in_edges)""" edges_conclude_nodes = np.array([]) for node in I_list: ...
the_stack_v2_python_sparse
practice/contagions/Hypergraph SI SIS SIR/packages/process_functions.py
chqlee/Hypergraphs
train
0
06e850714657e9824d7d193c6e7476800c351a07
[ "if not root:\n return 0\ntr_l = root.left\ntr_r = root.right\nmin_depth = 1\nif not tr_l and (not tr_r):\n return min_depth\nelif tr_l and (not tr_r):\n min_depth += self.minDepth(tr_l)\nelif not tr_l and tr_r:\n min_depth += self.minDepth(tr_r)\nelse:\n min_depth += min(self.minDepth(tr_l), self.mi...
<|body_start_0|> if not root: return 0 tr_l = root.left tr_r = root.right min_depth = 1 if not tr_l and (not tr_r): return min_depth elif tr_l and (not tr_r): min_depth += self.minDepth(tr_l) elif not tr_l and tr_r: ...
Solution
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minDepth(self, root: TreeNode) -> int: """DFS""" <|body_0|> def minDepth2(self, root): """BFS""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: return 0 tr_l = root.left tr_r = root.right ...
stack_v2_sparse_classes_36k_train_007592
1,714
permissive
[ { "docstring": "DFS", "name": "minDepth", "signature": "def minDepth(self, root: TreeNode) -> int" }, { "docstring": "BFS", "name": "minDepth2", "signature": "def minDepth2(self, root)" } ]
2
stack_v2_sparse_classes_30k_val_000548
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minDepth(self, root: TreeNode) -> int: DFS - def minDepth2(self, root): BFS
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minDepth(self, root: TreeNode) -> int: DFS - def minDepth2(self, root): BFS <|skeleton|> class Solution: def minDepth(self, root: TreeNode) -> int: """DFS""" ...
49a0b03c55d8a702785888d473ef96539265ce9c
<|skeleton|> class Solution: def minDepth(self, root: TreeNode) -> int: """DFS""" <|body_0|> def minDepth2(self, root): """BFS""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minDepth(self, root: TreeNode) -> int: """DFS""" if not root: return 0 tr_l = root.left tr_r = root.right min_depth = 1 if not tr_l and (not tr_r): return min_depth elif tr_l and (not tr_r): min_depth += ...
the_stack_v2_python_sparse
leetcode/0111_minimum_depth_of_binary_tree.py
chaosWsF/Python-Practice
train
1
8e1b2eb3033057d6a72f7428d58b3e1f888b430c
[ "super().__init__(port)\nself._prefix = None\nself._postfix = None\nself._replace_msg = None\nself._delay = 0\nself.lock = RLock()", "with self.lock:\n self._prefix = pre\n self._postfix = post\n self._replace_msg = msg\n self._delay = dly", "with self.lock:\n if self._replace_msg is not None:\n ...
<|body_start_0|> super().__init__(port) self._prefix = None self._postfix = None self._replace_msg = None self._delay = 0 self.lock = RLock() <|end_body_0|> <|body_start_1|> with self.lock: self._prefix = pre self._postfix = post ...
Responding COM-Client with configurable response.
ConfigurableEcho
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConfigurableEcho: """Responding COM-Client with configurable response.""" def __init__(self, port: str): """Create a COM-client with configrable echo. :param port: String of the port name to connect to""" <|body_0|> def reconfigure(self, pre: Optional[str]=None, post: Op...
stack_v2_sparse_classes_36k_train_007593
4,322
permissive
[ { "docstring": "Create a COM-client with configrable echo. :param port: String of the port name to connect to", "name": "__init__", "signature": "def __init__(self, port: str)" }, { "docstring": "Adjust the calculation of the server response. :param pre: String to be inserted before each actual ...
3
null
Implement the Python class `ConfigurableEcho` described below. Class description: Responding COM-Client with configurable response. Method signatures and docstrings: - def __init__(self, port: str): Create a COM-client with configrable echo. :param port: String of the port name to connect to - def reconfigure(self, p...
Implement the Python class `ConfigurableEcho` described below. Class description: Responding COM-Client with configurable response. Method signatures and docstrings: - def __init__(self, port: str): Create a COM-client with configrable echo. :param port: String of the port name to connect to - def reconfigure(self, p...
4c35f7dc08f976c05d0b7f27902236132f19c024
<|skeleton|> class ConfigurableEcho: """Responding COM-Client with configurable response.""" def __init__(self, port: str): """Create a COM-client with configrable echo. :param port: String of the port name to connect to""" <|body_0|> def reconfigure(self, pre: Optional[str]=None, post: Op...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConfigurableEcho: """Responding COM-Client with configurable response.""" def __init__(self, port: str): """Create a COM-client with configrable echo. :param port: String of the port name to connect to""" super().__init__(port) self._prefix = None self._postfix = None ...
the_stack_v2_python_sparse
src/clients/SerialEcho.py
pat-bert/gcode
train
0
ffe9dea314dd6227979c7d435704bab832fd39c6
[ "pages = self.for_slot(slot, barcamp=barcamp)\nif len(indexes) != pages.count():\n raise PageError('length of indexes (%s) does not match amount of pages (%s)' % (len(indexes), pages.count()))\npages = list(pages)\nfor page in pages:\n if page.index not in indexes:\n raise PageError('page with index %s...
<|body_start_0|> pages = self.for_slot(slot, barcamp=barcamp) if len(indexes) != pages.count(): raise PageError('length of indexes (%s) does not match amount of pages (%s)' % (len(indexes), pages.count())) pages = list(pages) for page in pages: if page.index not i...
Pages
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Pages: def reorder_slot(self, slot, indexes, barcamp=None): """reorders a slot. You give it the slot id in ``slot`` and the new sequence order in indexes in form of a list. Passing in [2,3,1] will reorder the existing pages in this order""" <|body_0|> def add_to_slot(self, s...
stack_v2_sparse_classes_36k_train_007594
4,171
permissive
[ { "docstring": "reorders a slot. You give it the slot id in ``slot`` and the new sequence order in indexes in form of a list. Passing in [2,3,1] will reorder the existing pages in this order", "name": "reorder_slot", "signature": "def reorder_slot(self, slot, indexes, barcamp=None)" }, { "docstr...
5
stack_v2_sparse_classes_30k_train_019986
Implement the Python class `Pages` described below. Class description: Implement the Pages class. Method signatures and docstrings: - def reorder_slot(self, slot, indexes, barcamp=None): reorders a slot. You give it the slot id in ``slot`` and the new sequence order in indexes in form of a list. Passing in [2,3,1] wi...
Implement the Python class `Pages` described below. Class description: Implement the Pages class. Method signatures and docstrings: - def reorder_slot(self, slot, indexes, barcamp=None): reorders a slot. You give it the slot id in ``slot`` and the new sequence order in indexes in form of a list. Passing in [2,3,1] wi...
9b45664e46c451b2cbe00bb55583b043e769083d
<|skeleton|> class Pages: def reorder_slot(self, slot, indexes, barcamp=None): """reorders a slot. You give it the slot id in ``slot`` and the new sequence order in indexes in form of a list. Passing in [2,3,1] will reorder the existing pages in this order""" <|body_0|> def add_to_slot(self, s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Pages: def reorder_slot(self, slot, indexes, barcamp=None): """reorders a slot. You give it the slot id in ``slot`` and the new sequence order in indexes in form of a list. Passing in [2,3,1] will reorder the existing pages in this order""" pages = self.for_slot(slot, barcamp=barcamp) ...
the_stack_v2_python_sparse
camper/db/pages.py
comlounge/camper
train
14
800e556eac6165aa814f0ed3e300451e5aeae838
[ "nastran_filename1 = os.path.join(NASTRAN_PATH, 'solid_bending', 'solid_bending.bdf')\nskin_filename = os.path.join(NASTRAN_PATH, 'solid_bending', 'solid_bending_skin.bdf')\nlog = get_logger(level='warning')\nwrite_skin_solid_faces(nastran_filename1, skin_filename, write_solids=True, write_shells=True, size=8, is_d...
<|body_start_0|> nastran_filename1 = os.path.join(NASTRAN_PATH, 'solid_bending', 'solid_bending.bdf') skin_filename = os.path.join(NASTRAN_PATH, 'solid_bending', 'solid_bending_skin.bdf') log = get_logger(level='warning') write_skin_solid_faces(nastran_filename1, skin_filename, write_sol...
defines UGRID tests
TestUgridGui
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestUgridGui: """defines UGRID tests""" def test_ugrid_gui_01(self): """tests solid_bending.bdf""" <|body_0|> def test_ugrid_gui_02(self): """tests plate_with_circular_hole""" <|body_1|> def test_ugrid2d_gui(self): """simple UGRID2D model""" ...
stack_v2_sparse_classes_36k_train_007595
4,389
no_license
[ { "docstring": "tests solid_bending.bdf", "name": "test_ugrid_gui_01", "signature": "def test_ugrid_gui_01(self)" }, { "docstring": "tests plate_with_circular_hole", "name": "test_ugrid_gui_02", "signature": "def test_ugrid_gui_02(self)" }, { "docstring": "simple UGRID2D model", ...
4
stack_v2_sparse_classes_30k_train_020358
Implement the Python class `TestUgridGui` described below. Class description: defines UGRID tests Method signatures and docstrings: - def test_ugrid_gui_01(self): tests solid_bending.bdf - def test_ugrid_gui_02(self): tests plate_with_circular_hole - def test_ugrid2d_gui(self): simple UGRID2D model - def test_ugrid3d...
Implement the Python class `TestUgridGui` described below. Class description: defines UGRID tests Method signatures and docstrings: - def test_ugrid_gui_01(self): tests solid_bending.bdf - def test_ugrid_gui_02(self): tests plate_with_circular_hole - def test_ugrid2d_gui(self): simple UGRID2D model - def test_ugrid3d...
d9ffdb4ac845b13bcf6aea96ff5d37cc026c5267
<|skeleton|> class TestUgridGui: """defines UGRID tests""" def test_ugrid_gui_01(self): """tests solid_bending.bdf""" <|body_0|> def test_ugrid_gui_02(self): """tests plate_with_circular_hole""" <|body_1|> def test_ugrid2d_gui(self): """simple UGRID2D model""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestUgridGui: """defines UGRID tests""" def test_ugrid_gui_01(self): """tests solid_bending.bdf""" nastran_filename1 = os.path.join(NASTRAN_PATH, 'solid_bending', 'solid_bending.bdf') skin_filename = os.path.join(NASTRAN_PATH, 'solid_bending', 'solid_bending_skin.bdf') log...
the_stack_v2_python_sparse
pyNastran/converters/aflr/ugrid/test_ugrid_gui.py
ratalex/pyNastran
train
0
88f6a00540fdc3710155857954fd928e5e11e26e
[ "first_max = second_max = third_max = -float('inf')\nfor val in nums:\n if val in (first_max, second_max, third_max):\n continue\n elif val > first_max:\n third_max, second_max, first_max = (second_max, first_max, val)\n elif val > second_max:\n third_max, second_max = (second_max, val...
<|body_start_0|> first_max = second_max = third_max = -float('inf') for val in nums: if val in (first_max, second_max, third_max): continue elif val > first_max: third_max, second_max, first_max = (second_max, first_max, val) elif val >...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def thirdMax_first_solution(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def third_max_second_solution(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> first_max = second_...
stack_v2_sparse_classes_36k_train_007596
1,342
permissive
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "thirdMax_first_solution", "signature": "def thirdMax_first_solution(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "third_max_second_solution", "signature": "def third_max_second_solution(self, nums...
2
stack_v2_sparse_classes_30k_train_004436
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def thirdMax_first_solution(self, nums): :type nums: List[int] :rtype: int - def third_max_second_solution(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def thirdMax_first_solution(self, nums): :type nums: List[int] :rtype: int - def third_max_second_solution(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solu...
1e99e0852b8329bf699eb149e7dfe312f82144bc
<|skeleton|> class Solution: def thirdMax_first_solution(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def third_max_second_solution(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def thirdMax_first_solution(self, nums): """:type nums: List[int] :rtype: int""" first_max = second_max = third_max = -float('inf') for val in nums: if val in (first_max, second_max, third_max): continue elif val > first_max: ...
the_stack_v2_python_sparse
easy/array/third_max/third_max.py
deepshig/leetcode-solutions
train
0
0f6c9292a28035d62f014f019b553edc200c0911
[ "default_optimizer_fn, optimizer_class = opt.get_optimizer_fn(opt.default_optimization_hparams()['optimizer'])\ndefault_optimizer = default_optimizer_fn(1.0)\nself.assertTrue(optimizer_class, tf.train.Optimizer)\nself.assertIsInstance(default_optimizer, tf.train.AdamOptimizer)\nhparams = {'type': 'MomentumOptimizer...
<|body_start_0|> default_optimizer_fn, optimizer_class = opt.get_optimizer_fn(opt.default_optimization_hparams()['optimizer']) default_optimizer = default_optimizer_fn(1.0) self.assertTrue(optimizer_class, tf.train.Optimizer) self.assertIsInstance(default_optimizer, tf.train.AdamOptimize...
Tests optimization.
OptimizationTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OptimizationTest: """Tests optimization.""" def test_get_optimizer(self): """Tests get_optimizer.""" <|body_0|> def test_get_learning_rate_decay_fn(self): """Tests get_learning_rate_decay_fn.""" <|body_1|> def test_get_gradient_clip_fn(self): ...
stack_v2_sparse_classes_36k_train_007597
5,510
permissive
[ { "docstring": "Tests get_optimizer.", "name": "test_get_optimizer", "signature": "def test_get_optimizer(self)" }, { "docstring": "Tests get_learning_rate_decay_fn.", "name": "test_get_learning_rate_decay_fn", "signature": "def test_get_learning_rate_decay_fn(self)" }, { "docstr...
4
stack_v2_sparse_classes_30k_train_015487
Implement the Python class `OptimizationTest` described below. Class description: Tests optimization. Method signatures and docstrings: - def test_get_optimizer(self): Tests get_optimizer. - def test_get_learning_rate_decay_fn(self): Tests get_learning_rate_decay_fn. - def test_get_gradient_clip_fn(self): Tests get_g...
Implement the Python class `OptimizationTest` described below. Class description: Tests optimization. Method signatures and docstrings: - def test_get_optimizer(self): Tests get_optimizer. - def test_get_learning_rate_decay_fn(self): Tests get_learning_rate_decay_fn. - def test_get_gradient_clip_fn(self): Tests get_g...
0704b3d4c93915b9a6f96b725e49ae20bf5d1e90
<|skeleton|> class OptimizationTest: """Tests optimization.""" def test_get_optimizer(self): """Tests get_optimizer.""" <|body_0|> def test_get_learning_rate_decay_fn(self): """Tests get_learning_rate_decay_fn.""" <|body_1|> def test_get_gradient_clip_fn(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OptimizationTest: """Tests optimization.""" def test_get_optimizer(self): """Tests get_optimizer.""" default_optimizer_fn, optimizer_class = opt.get_optimizer_fn(opt.default_optimization_hparams()['optimizer']) default_optimizer = default_optimizer_fn(1.0) self.assertTrue(...
the_stack_v2_python_sparse
texar/tf/core/optimization_test.py
arita37/texar
train
2
09e3f9402887eb02ea24f2612bcb67cdf655287f
[ "if method_name != 'knn' and method_name != 'lof' and (method_name != 'ocsvm'):\n sys.exit(\"There is no ad method named '{0}'. Please check the variable of method_name.\".format(method_name))\nself.method_name = method_name\nself.rate_of_outliers = rate_of_outliers\nself.gamma = gamma\nself.nu = nu\nself.n_neig...
<|body_start_0|> if method_name != 'knn' and method_name != 'lof' and (method_name != 'ocsvm'): sys.exit("There is no ad method named '{0}'. Please check the variable of method_name.".format(method_name)) self.method_name = method_name self.rate_of_outliers = rate_of_outliers ...
ApplicabilityDomain
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApplicabilityDomain: def __init__(self, method_name='ocsvm', rate_of_outliers=0.01, gamma='auto', nu=0.5, n_neighbors=10, metric='minkowski', p=2): """Applicability Domain (AD) Parameters ---------- method_name: str, default 'ocsvm' The name of method to set AD. 'knn', 'lof', or 'ocsvm' ...
stack_v2_sparse_classes_36k_train_007598
5,370
permissive
[ { "docstring": "Applicability Domain (AD) Parameters ---------- method_name: str, default 'ocsvm' The name of method to set AD. 'knn', 'lof', or 'ocsvm' rate_of_outliers: float, default 0.01 Rate of outlier samples. This is used to set threshold gamma : (only for 'ocsvm') float, default ’auto’ Kernel coefficien...
3
stack_v2_sparse_classes_30k_train_007238
Implement the Python class `ApplicabilityDomain` described below. Class description: Implement the ApplicabilityDomain class. Method signatures and docstrings: - def __init__(self, method_name='ocsvm', rate_of_outliers=0.01, gamma='auto', nu=0.5, n_neighbors=10, metric='minkowski', p=2): Applicability Domain (AD) Par...
Implement the Python class `ApplicabilityDomain` described below. Class description: Implement the ApplicabilityDomain class. Method signatures and docstrings: - def __init__(self, method_name='ocsvm', rate_of_outliers=0.01, gamma='auto', nu=0.5, n_neighbors=10, metric='minkowski', p=2): Applicability Domain (AD) Par...
ed966e79ab21f726c0f870258e486bde37166ffd
<|skeleton|> class ApplicabilityDomain: def __init__(self, method_name='ocsvm', rate_of_outliers=0.01, gamma='auto', nu=0.5, n_neighbors=10, metric='minkowski', p=2): """Applicability Domain (AD) Parameters ---------- method_name: str, default 'ocsvm' The name of method to set AD. 'knn', 'lof', or 'ocsvm' ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ApplicabilityDomain: def __init__(self, method_name='ocsvm', rate_of_outliers=0.01, gamma='auto', nu=0.5, n_neighbors=10, metric='minkowski', p=2): """Applicability Domain (AD) Parameters ---------- method_name: str, default 'ocsvm' The name of method to set AD. 'knn', 'lof', or 'ocsvm' rate_of_outlie...
the_stack_v2_python_sparse
dcekit/validation/applicability_domain.py
hkaneko1985/dcekit
train
44
c793207626c423bbf2cc159ffc8d8a5e88c08c86
[ "output = []\nfor rate in rates:\n _rate, created = Rate.objects.get_or_create(base_currency=base_currency, currency=rate.get('currency'), value_date=rate.get('date'), user=None, key=None)\n _rate.value = rate.get('value')\n _rate.save()\n output.append(_rate)\nreturn output", "service_name = rate_ser...
<|body_start_0|> output = [] for rate in rates: _rate, created = Rate.objects.get_or_create(base_currency=base_currency, currency=rate.get('currency'), value_date=rate.get('date'), user=None, key=None) _rate.value = rate.get('value') _rate.save() output.ap...
Manager for Rate model
RateManager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RateManager: """Manager for Rate model""" def __sync_rates__(rates: [], base_currency: str): """Sync rates to the database :param rates: array of dict of rates from service :param base_currency: base currency to fetch""" <|body_0|> def fetch_rates(self, base_currency: st...
stack_v2_sparse_classes_36k_train_007599
16,208
permissive
[ { "docstring": "Sync rates to the database :param rates: array of dict of rates from service :param base_currency: base currency to fetch", "name": "__sync_rates__", "signature": "def __sync_rates__(rates: [], base_currency: str)" }, { "docstring": "Get rates from a service for a base currency a...
5
stack_v2_sparse_classes_30k_train_015416
Implement the Python class `RateManager` described below. Class description: Manager for Rate model Method signatures and docstrings: - def __sync_rates__(rates: [], base_currency: str): Sync rates to the database :param rates: array of dict of rates from service :param base_currency: base currency to fetch - def fet...
Implement the Python class `RateManager` described below. Class description: Manager for Rate model Method signatures and docstrings: - def __sync_rates__(rates: [], base_currency: str): Sync rates to the database :param rates: array of dict of rates from service :param base_currency: base currency to fetch - def fet...
23cc075377d47ac631634cd71fd0e7d6b0a57bad
<|skeleton|> class RateManager: """Manager for Rate model""" def __sync_rates__(rates: [], base_currency: str): """Sync rates to the database :param rates: array of dict of rates from service :param base_currency: base currency to fetch""" <|body_0|> def fetch_rates(self, base_currency: st...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RateManager: """Manager for Rate model""" def __sync_rates__(rates: [], base_currency: str): """Sync rates to the database :param rates: array of dict of rates from service :param base_currency: base currency to fetch""" output = [] for rate in rates: _rate, created = ...
the_stack_v2_python_sparse
src/geocurrency/rates/models.py
fmeurou/geocurrency
train
5