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
bccf03a5d784531c056a1303c081dad54fe73c66
[ "if not nums:\n return 0\nsteps = [0] * len(nums)\nmax_reach = 0\nfor i, num in enumerate(nums):\n for j in range(max_reach + 1, min(len(nums), i + num + 1)):\n if steps[j] > steps[i] + 1 or steps[j] == 0:\n steps[j] = steps[i] + 1\n max_reach = max(max_reach, i + num)\n if max_reach >...
<|body_start_0|> if not nums: return 0 steps = [0] * len(nums) max_reach = 0 for i, num in enumerate(nums): for j in range(max_reach + 1, min(len(nums), i + num + 1)): if steps[j] > steps[i] + 1 or steps[j] == 0: steps[j] = step...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def jump(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def jumpi2(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not nums: return 0 steps = [0] * l...
stack_v2_sparse_classes_36k_train_032900
1,021
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "jump", "signature": "def jump(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "jumpi2", "signature": "def jumpi2(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def jump(self, nums): :type nums: List[int] :rtype: int - def jumpi2(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 jump(self, nums): :type nums: List[int] :rtype: int - def jumpi2(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def jump(self, nums): ...
4aa3a3a0da8b911e140446352debb9b567b6d78b
<|skeleton|> class Solution: def jump(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def jumpi2(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 jump(self, nums): """:type nums: List[int] :rtype: int""" if not nums: return 0 steps = [0] * len(nums) max_reach = 0 for i, num in enumerate(nums): for j in range(max_reach + 1, min(len(nums), i + num + 1)): if step...
the_stack_v2_python_sparse
jump_game2_45.py
adiggo/leetcode_py
train
0
3a57e50ea3c0b0c4be0395a6dd50c45dd6241de9
[ "args = (Set(),)\nself._nconditions = 0\nComplementarity.__init__(self, *args, **kwargs)\nself._rule = None", "self._nconditions += 1\nself._index_set.add(self._nconditions)\nreturn Complementarity.add(self, self._nconditions, expr)", "if is_debug_set(logger):\n logger.debug('Constructing complementarity lis...
<|body_start_0|> args = (Set(),) self._nconditions = 0 Complementarity.__init__(self, *args, **kwargs) self._rule = None <|end_body_0|> <|body_start_1|> self._nconditions += 1 self._index_set.add(self._nconditions) return Complementarity.add(self, self._nconditio...
A complementarity component that represents a list of complementarity conditions. Each condition can be indexed by its index, but when added an index value is not specified.
ComplementarityList
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ComplementarityList: """A complementarity component that represents a list of complementarity conditions. Each condition can be indexed by its index, but when added an index value is not specified.""" def __init__(self, **kwargs): """Constructor""" <|body_0|> def add(sel...
stack_v2_sparse_classes_36k_train_032901
13,652
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "Add a complementarity condition with an implicit index.", "name": "add", "signature": "def add(self, expr)" }, { "docstring": "Construct the expression(s) for this com...
3
null
Implement the Python class `ComplementarityList` described below. Class description: A complementarity component that represents a list of complementarity conditions. Each condition can be indexed by its index, but when added an index value is not specified. Method signatures and docstrings: - def __init__(self, **kw...
Implement the Python class `ComplementarityList` described below. Class description: A complementarity component that represents a list of complementarity conditions. Each condition can be indexed by its index, but when added an index value is not specified. Method signatures and docstrings: - def __init__(self, **kw...
05ed25d76d244d983a3aee3ebc84545b276688a1
<|skeleton|> class ComplementarityList: """A complementarity component that represents a list of complementarity conditions. Each condition can be indexed by its index, but when added an index value is not specified.""" def __init__(self, **kwargs): """Constructor""" <|body_0|> def add(sel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ComplementarityList: """A complementarity component that represents a list of complementarity conditions. Each condition can be indexed by its index, but when added an index value is not specified.""" def __init__(self, **kwargs): """Constructor""" args = (Set(),) self._ncondition...
the_stack_v2_python_sparse
pyomo/mpec/complementarity.py
mrmundt/pyomo
train
2
8b20623c8052aa52c4548f58fdf9cec5ee44555b
[ "if not self.subdomain:\n raise errors.ErrorMessage(400, 'No subdomain specified.')\nif self.request.get('hub.mode') in ['subscribe', 'unsubscribe']:\n topic = self.request.get('hub.topic')\n signature = self.request.get('hub.verify_token')\n if not crypto.verify('hub_verify', topic, signature):\n ...
<|body_start_0|> if not self.subdomain: raise errors.ErrorMessage(400, 'No subdomain specified.') if self.request.get('hub.mode') in ['subscribe', 'unsubscribe']: topic = self.request.get('hub.topic') signature = self.request.get('hub.verify_token') if not...
Feed
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Feed: def get(self): """Emits entries in the delta feed; also handles subscription checks.""" <|body_0|> def post(self): """Feed update notification from hub.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not self.subdomain: raise e...
stack_v2_sparse_classes_36k_train_032902
7,401
permissive
[ { "docstring": "Emits entries in the delta feed; also handles subscription checks.", "name": "get", "signature": "def get(self)" }, { "docstring": "Feed update notification from hub.", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_003548
Implement the Python class `Feed` described below. Class description: Implement the Feed class. Method signatures and docstrings: - def get(self): Emits entries in the delta feed; also handles subscription checks. - def post(self): Feed update notification from hub.
Implement the Python class `Feed` described below. Class description: Implement the Feed class. Method signatures and docstrings: - def get(self): Emits entries in the delta feed; also handles subscription checks. - def post(self): Feed update notification from hub. <|skeleton|> class Feed: def get(self): ...
7715276b3c588f7c457de04944559052c8170f7e
<|skeleton|> class Feed: def get(self): """Emits entries in the delta feed; also handles subscription checks.""" <|body_0|> def post(self): """Feed update notification from hub.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Feed: def get(self): """Emits entries in the delta feed; also handles subscription checks.""" if not self.subdomain: raise errors.ErrorMessage(400, 'No subdomain specified.') if self.request.get('hub.mode') in ['subscribe', 'unsubscribe']: topic = self.request.g...
the_stack_v2_python_sparse
app/feeds_delta.py
Princessgladys/googleresourcefinder
train
0
812ed9daeee0b0f5667bed4975ecdabede2338ed
[ "from collections import deque as dq\norder = []\nlevel_nodes = dq()\nif root is None:\n return []\nqueue = dq([root, None])\nis_left = True\nwhile len(queue) > 0:\n curr_node = queue.popleft()\n if curr_node:\n if is_left:\n level_nodes.append(curr_node.val)\n else:\n l...
<|body_start_0|> from collections import deque as dq order = [] level_nodes = dq() if root is None: return [] queue = dq([root, None]) is_left = True while len(queue) > 0: curr_node = queue.popleft() if curr_node: ...
ZigZag
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZigZag: def level_order_travesal(self, root: TreeNode) -> List[List[int]]: """Approach: Breadth First Search Time Complexity: O(N) Space Complexity: O(N) :param root: :return:""" <|body_0|> def level_order_travesal(self, root: TreeNode) -> List[List[int]]: """Approac...
stack_v2_sparse_classes_36k_train_032903
2,270
no_license
[ { "docstring": "Approach: Breadth First Search Time Complexity: O(N) Space Complexity: O(N) :param root: :return:", "name": "level_order_travesal", "signature": "def level_order_travesal(self, root: TreeNode) -> List[List[int]]" }, { "docstring": "Approach: Depth First Search Time Complexity: O(...
2
stack_v2_sparse_classes_30k_train_008404
Implement the Python class `ZigZag` described below. Class description: Implement the ZigZag class. Method signatures and docstrings: - def level_order_travesal(self, root: TreeNode) -> List[List[int]]: Approach: Breadth First Search Time Complexity: O(N) Space Complexity: O(N) :param root: :return: - def level_order...
Implement the Python class `ZigZag` described below. Class description: Implement the ZigZag class. Method signatures and docstrings: - def level_order_travesal(self, root: TreeNode) -> List[List[int]]: Approach: Breadth First Search Time Complexity: O(N) Space Complexity: O(N) :param root: :return: - def level_order...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class ZigZag: def level_order_travesal(self, root: TreeNode) -> List[List[int]]: """Approach: Breadth First Search Time Complexity: O(N) Space Complexity: O(N) :param root: :return:""" <|body_0|> def level_order_travesal(self, root: TreeNode) -> List[List[int]]: """Approac...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ZigZag: def level_order_travesal(self, root: TreeNode) -> List[List[int]]: """Approach: Breadth First Search Time Complexity: O(N) Space Complexity: O(N) :param root: :return:""" from collections import deque as dq order = [] level_nodes = dq() if root is None: ...
the_stack_v2_python_sparse
data_structures/tree_node/zig_zag_order.py
Shiv2157k/leet_code
train
1
e64a434b5f868b2e681ac5ea03d0313c06339728
[ "initial_vals = kwargs.pop('initial', None)\nreadonly = kwargs.pop('readonly', None)\nsuper(IngestionRequestForm, self).__init__(*args, **kwargs)\nself.fields['dataset_type_ref'].queryset = DatasetType.objects.using('agdc').filter(Q(definition__has_keys=['managed']) & Q(definition__has_keys=['measurements']))\nif i...
<|body_start_0|> initial_vals = kwargs.pop('initial', None) readonly = kwargs.pop('readonly', None) super(IngestionRequestForm, self).__init__(*args, **kwargs) self.fields['dataset_type_ref'].queryset = DatasetType.objects.using('agdc').filter(Q(definition__has_keys=['managed']) & Q(defi...
Information required to submit an ingestion request, including start/end date and geographic bounds. Can be initialized as a bound form with initial data or as a readonly form
IngestionRequestForm
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IngestionRequestForm: """Information required to submit an ingestion request, including start/end date and geographic bounds. Can be initialized as a bound form with initial data or as a readonly form""" def __init__(self, *args, **kwargs): """Initialize the ingestion request form wi...
stack_v2_sparse_classes_36k_train_032904
22,231
permissive
[ { "docstring": "Initialize the ingestion request form with optional kwargs Args: initial_vals: dict with form data - sets initial rather than binding readonly: boolean value signifying whether or not this form should be modified.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" ...
2
stack_v2_sparse_classes_30k_train_014555
Implement the Python class `IngestionRequestForm` described below. Class description: Information required to submit an ingestion request, including start/end date and geographic bounds. Can be initialized as a bound form with initial data or as a readonly form Method signatures and docstrings: - def __init__(self, *...
Implement the Python class `IngestionRequestForm` described below. Class description: Information required to submit an ingestion request, including start/end date and geographic bounds. Can be initialized as a bound form with initial data or as a readonly form Method signatures and docstrings: - def __init__(self, *...
ef50e918df89313f130d735e7cb7c0a069da410e
<|skeleton|> class IngestionRequestForm: """Information required to submit an ingestion request, including start/end date and geographic bounds. Can be initialized as a bound form with initial data or as a readonly form""" def __init__(self, *args, **kwargs): """Initialize the ingestion request form wi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IngestionRequestForm: """Information required to submit an ingestion request, including start/end date and geographic bounds. Can be initialized as a bound form with initial data or as a readonly form""" def __init__(self, *args, **kwargs): """Initialize the ingestion request form with optional k...
the_stack_v2_python_sparse
apps/data_cube_manager/forms/ingestion.py
ceos-seo/data_cube_ui
train
47
e37c7a2b403a5ea08a4c4dca7671bbb891921288
[ "super(LayerNorm, self).__init__()\nself.beta = paddle.create_parameter(shape=[hidden_size], dtype='float32', default_initializer=nn.initializer.Assign(paddle.zeros([hidden_size], 'float32')))\nself.gamma = paddle.create_parameter(shape=[hidden_size], dtype='float32', default_initializer=nn.initializer.Assign(paddl...
<|body_start_0|> super(LayerNorm, self).__init__() self.beta = paddle.create_parameter(shape=[hidden_size], dtype='float32', default_initializer=nn.initializer.Assign(paddle.zeros([hidden_size], 'float32'))) self.gamma = paddle.create_parameter(shape=[hidden_size], dtype='float32', default_initi...
Customized LayerNorm
LayerNorm
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LayerNorm: """Customized LayerNorm""" def __init__(self, hidden_size, variance_epsilon=1e-12): """Initialization""" <|body_0|> def forward(self, x): """LayerNorm""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(LayerNorm, self).__init__() ...
stack_v2_sparse_classes_36k_train_032905
12,741
permissive
[ { "docstring": "Initialization", "name": "__init__", "signature": "def __init__(self, hidden_size, variance_epsilon=1e-12)" }, { "docstring": "LayerNorm", "name": "forward", "signature": "def forward(self, x)" } ]
2
null
Implement the Python class `LayerNorm` described below. Class description: Customized LayerNorm Method signatures and docstrings: - def __init__(self, hidden_size, variance_epsilon=1e-12): Initialization - def forward(self, x): LayerNorm
Implement the Python class `LayerNorm` described below. Class description: Customized LayerNorm Method signatures and docstrings: - def __init__(self, hidden_size, variance_epsilon=1e-12): Initialization - def forward(self, x): LayerNorm <|skeleton|> class LayerNorm: """Customized LayerNorm""" def __init__(...
e6ab0261eb719c21806bbadfd94001ecfe27de45
<|skeleton|> class LayerNorm: """Customized LayerNorm""" def __init__(self, hidden_size, variance_epsilon=1e-12): """Initialization""" <|body_0|> def forward(self, x): """LayerNorm""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LayerNorm: """Customized LayerNorm""" def __init__(self, hidden_size, variance_epsilon=1e-12): """Initialization""" super(LayerNorm, self).__init__() self.beta = paddle.create_parameter(shape=[hidden_size], dtype='float32', default_initializer=nn.initializer.Assign(paddle.zeros([h...
the_stack_v2_python_sparse
apps/drug_target_interaction/moltrans_dti/double_towers.py
PaddlePaddle/PaddleHelix
train
771
4275d3fd05bd9a4a5266bf84d183a1b1426a5e64
[ "m = len(board)\nif not m:\n return\nn = len(board[0])\nif not n:\n return\ni, j = (0, 0)\nwhile i < m:\n self.check_using_queue(i, 0, board, m, n)\n if n > 1:\n self.check_using_queue(i, n - 1, board, m, n)\n i += 1\nwhile j < n:\n self.check_using_queue(0, j, board, m, n)\n if m > 1:\n...
<|body_start_0|> m = len(board) if not m: return n = len(board[0]) if not n: return i, j = (0, 0) while i < m: self.check_using_queue(i, 0, board, m, n) if n > 1: self.check_using_queue(i, n - 1, board, m, n)...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def solve(self, board: list) -> None: """Using DFS(Recursive traversal). Traverse all the node recursively on the boarder of the board. If the node value is 'O', change all the node within the same region to 'S'. And then change the other node to X. At last change 'S' node back...
stack_v2_sparse_classes_36k_train_032906
4,167
no_license
[ { "docstring": "Using DFS(Recursive traversal). Traverse all the node recursively on the boarder of the board. If the node value is 'O', change all the node within the same region to 'S'. And then change the other node to X. At last change 'S' node back to 'O'. Args: board: list(list(str)), like GO chessboard. ...
3
stack_v2_sparse_classes_30k_train_018367
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def solve(self, board: list) -> None: Using DFS(Recursive traversal). Traverse all the node recursively on the boarder of the board. If the node value is 'O', change all the node...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def solve(self, board: list) -> None: Using DFS(Recursive traversal). Traverse all the node recursively on the boarder of the board. If the node value is 'O', change all the node...
ecbb8fb7f96f644c16dbb0cf7ffb69bc959a5647
<|skeleton|> class Solution: def solve(self, board: list) -> None: """Using DFS(Recursive traversal). Traverse all the node recursively on the boarder of the board. If the node value is 'O', change all the node within the same region to 'S'. And then change the other node to X. At last change 'S' node back...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def solve(self, board: list) -> None: """Using DFS(Recursive traversal). Traverse all the node recursively on the boarder of the board. If the node value is 'O', change all the node within the same region to 'S'. And then change the other node to X. At last change 'S' node back to 'O'. Args:...
the_stack_v2_python_sparse
source_code/LC130_SurroundedRegions.py
CircleZ3791117/CodingPractice
train
14
caca140d2660a52236cfae1967a9bad5d0d1429a
[ "if not root:\n return '$'\nreturn f'{root.val},{self.serialize(root.left)},{self.serialize(root.right)}'", "def construct(pos=0):\n if nodes[pos] == '$':\n return (None, pos + 1)\n node = TreeNode(nodes[pos])\n node.left, pos = construct(pos + 1)\n node.right, pos = construct(pos)\n retu...
<|body_start_0|> if not root: return '$' return f'{root.val},{self.serialize(root.left)},{self.serialize(root.right)}' <|end_body_0|> <|body_start_1|> def construct(pos=0): if nodes[pos] == '$': return (None, pos + 1) node = TreeNode(nodes[pos...
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_032907
1,173
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
null
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:...
e3b0571182369c5308e0c29fb87106bb0b0d615a
<|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 '$' return f'{root.val},{self.serialize(root.left)},{self.serialize(root.right)}' def deserialize(self, data): """Decodes your encode...
the_stack_v2_python_sparse
hard/SerializeAndDeserializeBinaryTree.py
GeorgianBadita/LeetCode
train
3
74b26613aa5e69863760bfda100f0ba2940b51c4
[ "super().__init__(**kwargs)\nself.output_attentions = config.output_attentions\nself.output_hidden_states = config.output_hidden_states\nself.layer = [TFFastSpeechLayer(config, name='layer_._{}'.format(i)) for i in range(config.num_hidden_layers)]", "hidden_states, key, attention_mask, mel_mask = inputs\nall_hidd...
<|body_start_0|> super().__init__(**kwargs) self.output_attentions = config.output_attentions self.output_hidden_states = config.output_hidden_states self.layer = [TFFastSpeechLayer(config, name='layer_._{}'.format(i)) for i in range(config.num_hidden_layers)] <|end_body_0|> <|body_star...
Fast Speech encoder module.
TFFastSpeechEncoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TFFastSpeechEncoder: """Fast Speech encoder module.""" def __init__(self, config, **kwargs): """Init variables.""" <|body_0|> def call(self, inputs, training=False): """Call logic.""" <|body_1|> <|end_skeleton|> <|body_start_0|> super().__init__...
stack_v2_sparse_classes_36k_train_032908
17,606
permissive
[ { "docstring": "Init variables.", "name": "__init__", "signature": "def __init__(self, config, **kwargs)" }, { "docstring": "Call logic.", "name": "call", "signature": "def call(self, inputs, training=False)" } ]
2
null
Implement the Python class `TFFastSpeechEncoder` described below. Class description: Fast Speech encoder module. Method signatures and docstrings: - def __init__(self, config, **kwargs): Init variables. - def call(self, inputs, training=False): Call logic.
Implement the Python class `TFFastSpeechEncoder` described below. Class description: Fast Speech encoder module. Method signatures and docstrings: - def __init__(self, config, **kwargs): Init variables. - def call(self, inputs, training=False): Call logic. <|skeleton|> class TFFastSpeechEncoder: """Fast Speech e...
4343c409340c608a426cc6f0926fbe2c1661783e
<|skeleton|> class TFFastSpeechEncoder: """Fast Speech encoder module.""" def __init__(self, config, **kwargs): """Init variables.""" <|body_0|> def call(self, inputs, training=False): """Call logic.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TFFastSpeechEncoder: """Fast Speech encoder module.""" def __init__(self, config, **kwargs): """Init variables.""" super().__init__(**kwargs) self.output_attentions = config.output_attentions self.output_hidden_states = config.output_hidden_states self.layer = [TFF...
the_stack_v2_python_sparse
malaya_speech/train/model/fastspeech/model_aligner.py
Ariffleng/malaya-speech
train
0
205f8d79fd1671acd47073b90983b0ae65aed7cc
[ "if isinstance(queryset_or_model, ContentNode):\n self.query = ContentNode.filter_by_pk(pk=queryset_or_model.pk)\nelse:\n self.query = queryset_or_model\nself.annotations = annotations\nself.metadata = None", "clone = Metadata(self.query, **self.annotations)\nclone.annotations.update(annotations)\nreturn cl...
<|body_start_0|> if isinstance(queryset_or_model, ContentNode): self.query = ContentNode.filter_by_pk(pk=queryset_or_model.pk) else: self.query = queryset_or_model self.annotations = annotations self.metadata = None <|end_body_0|> <|body_start_1|> clone =...
Helper class to query for various ContentNode metadata, for multiple node-trees, while minimizing database query volume. Example: nodes = ContentNode.objects.filter(pk__in=['123...abc', ...]) md = Metadata(nodes, some_thing=MetadataAnnotation()) data = md.get('123...abc') Example: node = ContentNode.objects.get(pk='123...
Metadata
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Metadata: """Helper class to query for various ContentNode metadata, for multiple node-trees, while minimizing database query volume. Example: nodes = ContentNode.objects.filter(pk__in=['123...abc', ...]) md = Metadata(nodes, some_thing=MetadataAnnotation()) data = md.get('123...abc') Example: no...
stack_v2_sparse_classes_36k_train_032909
3,934
permissive
[ { "docstring": ":param queryset_or_model: A ContentNode or queryset :param annotations: A dict of annotations", "name": "__init__", "signature": "def __init__(self, queryset_or_model=None, **annotations)" }, { "docstring": ":param annotations: Dict of annotations that should be instances of Meta...
4
stack_v2_sparse_classes_30k_train_018004
Implement the Python class `Metadata` described below. Class description: Helper class to query for various ContentNode metadata, for multiple node-trees, while minimizing database query volume. Example: nodes = ContentNode.objects.filter(pk__in=['123...abc', ...]) md = Metadata(nodes, some_thing=MetadataAnnotation())...
Implement the Python class `Metadata` described below. Class description: Helper class to query for various ContentNode metadata, for multiple node-trees, while minimizing database query volume. Example: nodes = ContentNode.objects.filter(pk__in=['123...abc', ...]) md = Metadata(nodes, some_thing=MetadataAnnotation())...
dc357ccb5fd0cf16e2a5968fab720deaebc68972
<|skeleton|> class Metadata: """Helper class to query for various ContentNode metadata, for multiple node-trees, while minimizing database query volume. Example: nodes = ContentNode.objects.filter(pk__in=['123...abc', ...]) md = Metadata(nodes, some_thing=MetadataAnnotation()) data = md.get('123...abc') Example: no...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Metadata: """Helper class to query for various ContentNode metadata, for multiple node-trees, while minimizing database query volume. Example: nodes = ContentNode.objects.filter(pk__in=['123...abc', ...]) md = Metadata(nodes, some_thing=MetadataAnnotation()) data = md.get('123...abc') Example: node = ContentN...
the_stack_v2_python_sparse
contentcuration/contentcuration/node_metadata/query.py
learningequality/studio
train
73
30aa6807a35fe9eaa6ee5e49d14e6993b2d5fa6d
[ "if type(units) is not int:\n raise TypeError('units must be int representing the number of hidden units')\nsuper(SelfAttention, self).__init__()\nself.W = tf.keras.layers.Dense(units=units)\nself.U = tf.keras.layers.Dense(units=units)\nself.V = tf.keras.layers.Dense(units=1)", "W = self.W(tf.expand_dims(s_pre...
<|body_start_0|> if type(units) is not int: raise TypeError('units must be int representing the number of hidden units') super(SelfAttention, self).__init__() self.W = tf.keras.layers.Dense(units=units) self.U = tf.keras.layers.Dense(units=units) self.V = tf.keras.lay...
Class to calculate the attention for machine translation class constructor: def __init__(self, units) public instance attribute: W: a Dense layer with units number of units, to be applied to the previous decoder hidden state U: a Dense layer with units number of units, to be applied to the encoder hidden state V: a Den...
SelfAttention
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SelfAttention: """Class to calculate the attention for machine translation class constructor: def __init__(self, units) public instance attribute: W: a Dense layer with units number of units, to be applied to the previous decoder hidden state U: a Dense layer with units number of units, to be app...
stack_v2_sparse_classes_36k_train_032910
2,885
no_license
[ { "docstring": "Class constructor parameters: units [int]: represents the number of hidden units in the alignment model sets the public instance attributes: W: a Dense layer with units number of units, to be applied to the previous decoder hidden state U: a Dense layer with units number of units, to be applied ...
2
null
Implement the Python class `SelfAttention` described below. Class description: Class to calculate the attention for machine translation class constructor: def __init__(self, units) public instance attribute: W: a Dense layer with units number of units, to be applied to the previous decoder hidden state U: a Dense laye...
Implement the Python class `SelfAttention` described below. Class description: Class to calculate the attention for machine translation class constructor: def __init__(self, units) public instance attribute: W: a Dense layer with units number of units, to be applied to the previous decoder hidden state U: a Dense laye...
8834b201ca84937365e4dcc0fac978656cdf5293
<|skeleton|> class SelfAttention: """Class to calculate the attention for machine translation class constructor: def __init__(self, units) public instance attribute: W: a Dense layer with units number of units, to be applied to the previous decoder hidden state U: a Dense layer with units number of units, to be app...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SelfAttention: """Class to calculate the attention for machine translation class constructor: def __init__(self, units) public instance attribute: W: a Dense layer with units number of units, to be applied to the previous decoder hidden state U: a Dense layer with units number of units, to be applied to the e...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/1-self_attention.py
ejonakodra/holbertonschool-machine_learning-1
train
0
34ae2a1749cc75de488c361eb89fe51d52d84d6a
[ "pygame.init()\nself.screen_width = 1200\nself.screen_height = 800\nself.screen = pygame.display.set_mode((self.screen_width, self.screen_height))\npygame.display.set_caption('Rain Drops')\nself.bg_color = (255, 255, 255)\nself.raindrops = pygame.sprite.Group()\nself._creat_raining()", "raindrop = RainDrop(self)\...
<|body_start_0|> pygame.init() self.screen_width = 1200 self.screen_height = 800 self.screen = pygame.display.set_mode((self.screen_width, self.screen_height)) pygame.display.set_caption('Rain Drops') self.bg_color = (255, 255, 255) self.raindrops = pygame.sprite....
Overall class for a raining screen.
RainDrops
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RainDrops: """Overall class for a raining screen.""" def __init__(self): """Initialize the game and background resources.""" <|body_0|> def _creat_raining(self): """Create a raining screen.""" <|body_1|> def _creat_raindrop(self, raindrop_number, row...
stack_v2_sparse_classes_36k_train_032911
3,365
no_license
[ { "docstring": "Initialize the game and background resources.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Create a raining screen.", "name": "_creat_raining", "signature": "def _creat_raining(self)" }, { "docstring": "Create a raindrop and place in ...
4
stack_v2_sparse_classes_30k_train_020671
Implement the Python class `RainDrops` described below. Class description: Overall class for a raining screen. Method signatures and docstrings: - def __init__(self): Initialize the game and background resources. - def _creat_raining(self): Create a raining screen. - def _creat_raindrop(self, raindrop_number, row_num...
Implement the Python class `RainDrops` described below. Class description: Overall class for a raining screen. Method signatures and docstrings: - def __init__(self): Initialize the game and background resources. - def _creat_raining(self): Create a raining screen. - def _creat_raindrop(self, raindrop_number, row_num...
de8b257c1d69eb2a71dd95114f5f7adf58e00a53
<|skeleton|> class RainDrops: """Overall class for a raining screen.""" def __init__(self): """Initialize the game and background resources.""" <|body_0|> def _creat_raining(self): """Create a raining screen.""" <|body_1|> def _creat_raindrop(self, raindrop_number, row...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RainDrops: """Overall class for a raining screen.""" def __init__(self): """Initialize the game and background resources.""" pygame.init() self.screen_width = 1200 self.screen_height = 800 self.screen = pygame.display.set_mode((self.screen_width, self.screen_height...
the_stack_v2_python_sparse
ch12_tryityourslef/raindrops.py
thewchan/python_crash_course
train
0
f2c1ef9a1b7c75b50cf673b0c029b57c7f71376d
[ "itrs_m = defaultdict(list)\nfor w in words:\n itrs_m[w[0]].append(iter(w[1:]))\nfor a in S:\n itrs = itrs_m.pop(a, [])\n for itr in itrs:\n v = next(itr, None)\n itrs_m[v].append(itr)\nreturn len(itrs_m[None])", "I = [0 for _ in words]\nfor a in S:\n for wi, i in enumerate(I):\n ...
<|body_start_0|> itrs_m = defaultdict(list) for w in words: itrs_m[w[0]].append(iter(w[1:])) for a in S: itrs = itrs_m.pop(a, []) for itr in itrs: v = next(itr, None) itrs_m[v].append(itr) return len(itrs_m[None]) <|end_...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numMatchingSubseq(self, S: str, words: List[str]) -> int: """Linear O(|S| + sum(|word|)) no need to if-check HashMap + Iterator""" <|body_0|> def numMatchingSubseq_TLE(self, S: str, words: List[str]) -> int: """Brute force O(|S| |Words| M) Is a better w...
stack_v2_sparse_classes_36k_train_032912
1,814
no_license
[ { "docstring": "Linear O(|S| + sum(|word|)) no need to if-check HashMap + Iterator", "name": "numMatchingSubseq", "signature": "def numMatchingSubseq(self, S: str, words: List[str]) -> int" }, { "docstring": "Brute force O(|S| |Words| M) Is a better way to check subsequence? No Can we parallel t...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numMatchingSubseq(self, S: str, words: List[str]) -> int: Linear O(|S| + sum(|word|)) no need to if-check HashMap + Iterator - def numMatchingSubseq_TLE(self, S: str, words: ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numMatchingSubseq(self, S: str, words: List[str]) -> int: Linear O(|S| + sum(|word|)) no need to if-check HashMap + Iterator - def numMatchingSubseq_TLE(self, S: str, words: ...
929dde1723fb2f54870c8a9badc80fc23e8400d3
<|skeleton|> class Solution: def numMatchingSubseq(self, S: str, words: List[str]) -> int: """Linear O(|S| + sum(|word|)) no need to if-check HashMap + Iterator""" <|body_0|> def numMatchingSubseq_TLE(self, S: str, words: List[str]) -> int: """Brute force O(|S| |Words| M) Is a better w...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def numMatchingSubseq(self, S: str, words: List[str]) -> int: """Linear O(|S| + sum(|word|)) no need to if-check HashMap + Iterator""" itrs_m = defaultdict(list) for w in words: itrs_m[w[0]].append(iter(w[1:])) for a in S: itrs = itrs_m.pop(a, ...
the_stack_v2_python_sparse
_algorithms_challenges/leetcode/LeetCode/792 Number of Matching Subsequences.py
syurskyi/Algorithms_and_Data_Structure
train
4
f412396e91d2f2361122087372009147e9c5ae4a
[ "try:\n if legal_type in Business.CORP_TYPE_CONVERSION[Business.LearBusinessTypes.BCOMP.value]:\n identifier = identifier[-7:]\n corp_types = Business.CORP_TYPE_CONVERSION.get(legal_type, [legal_type])\n business = Business.find_by_identifier(identifier, corp_types)\n if not business:\n re...
<|body_start_0|> try: if legal_type in Business.CORP_TYPE_CONVERSION[Business.LearBusinessTypes.BCOMP.value]: identifier = identifier[-7:] corp_types = Business.CORP_TYPE_CONVERSION.get(legal_type, [legal_type]) business = Business.find_by_identifier(identifie...
Meta information about the overall service.
BusinessInfo
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BusinessInfo: """Meta information about the overall service.""" def get(legal_type: str, identifier: str): """Return the complete business info.""" <|body_0|> def post(legal_type: str): """Create and return a new corp number for the given legal type.""" <...
stack_v2_sparse_classes_36k_train_032913
7,382
permissive
[ { "docstring": "Return the complete business info.", "name": "get", "signature": "def get(legal_type: str, identifier: str)" }, { "docstring": "Create and return a new corp number for the given legal type.", "name": "post", "signature": "def post(legal_type: str)" } ]
2
null
Implement the Python class `BusinessInfo` described below. Class description: Meta information about the overall service. Method signatures and docstrings: - def get(legal_type: str, identifier: str): Return the complete business info. - def post(legal_type: str): Create and return a new corp number for the given leg...
Implement the Python class `BusinessInfo` described below. Class description: Meta information about the overall service. Method signatures and docstrings: - def get(legal_type: str, identifier: str): Return the complete business info. - def post(legal_type: str): Create and return a new corp number for the given leg...
d90f11a7b14411b02c07fe97d2c1fc31cd4a9b32
<|skeleton|> class BusinessInfo: """Meta information about the overall service.""" def get(legal_type: str, identifier: str): """Return the complete business info.""" <|body_0|> def post(legal_type: str): """Create and return a new corp number for the given legal type.""" <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BusinessInfo: """Meta information about the overall service.""" def get(legal_type: str, identifier: str): """Return the complete business info.""" try: if legal_type in Business.CORP_TYPE_CONVERSION[Business.LearBusinessTypes.BCOMP.value]: identifier = identif...
the_stack_v2_python_sparse
colin-api/src/colin_api/resources/business.py
bcgov/lear
train
13
6639a52fe035376e27d36b6c69b3fa15f564f458
[ "self.sum_hit_at_one = 0.0\nself.sum_perr = 0.0\nself.sum_loss = 0.0\nself.map_calculator = map_calculator.MeanAveragePrecisionCalculator(num_class)\nself.global_ap_calculator = ap_calculator.AveragePrecisionCalculator()\nself.pr_calculator = PRCalculator()\nself.pr_calculator_per_tag = PRCalculatorPerTag(num_class...
<|body_start_0|> self.sum_hit_at_one = 0.0 self.sum_perr = 0.0 self.sum_loss = 0.0 self.map_calculator = map_calculator.MeanAveragePrecisionCalculator(num_class) self.global_ap_calculator = ap_calculator.AveragePrecisionCalculator() self.pr_calculator = PRCalculator() ...
A class to store the evaluation metrics.
EvaluationMetrics
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EvaluationMetrics: """A class to store the evaluation metrics.""" def __init__(self, num_class, top_k, accumulate_per_tag=False): """Construct an EvaluationMetrics object to store the evaluation metrics. Args: num_class: A positive integer specifying the number of classes. top_k: A p...
stack_v2_sparse_classes_36k_train_032914
24,184
no_license
[ { "docstring": "Construct an EvaluationMetrics object to store the evaluation metrics. Args: num_class: A positive integer specifying the number of classes. top_k: A positive integer specifying how many predictions are considered per video. Raises: ValueError: An error occurred when MeanAveragePrecisionCalculat...
4
stack_v2_sparse_classes_30k_train_002769
Implement the Python class `EvaluationMetrics` described below. Class description: A class to store the evaluation metrics. Method signatures and docstrings: - def __init__(self, num_class, top_k, accumulate_per_tag=False): Construct an EvaluationMetrics object to store the evaluation metrics. Args: num_class: A posi...
Implement the Python class `EvaluationMetrics` described below. Class description: A class to store the evaluation metrics. Method signatures and docstrings: - def __init__(self, num_class, top_k, accumulate_per_tag=False): Construct an EvaluationMetrics object to store the evaluation metrics. Args: num_class: A posi...
aa5083f15e68b637403cd96bd43633b93dc59844
<|skeleton|> class EvaluationMetrics: """A class to store the evaluation metrics.""" def __init__(self, num_class, top_k, accumulate_per_tag=False): """Construct an EvaluationMetrics object to store the evaluation metrics. Args: num_class: A positive integer specifying the number of classes. top_k: A p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EvaluationMetrics: """A class to store the evaluation metrics.""" def __init__(self, num_class, top_k, accumulate_per_tag=False): """Construct an EvaluationMetrics object to store the evaluation metrics. Args: num_class: A positive integer specifying the number of classes. top_k: A positive integ...
the_stack_v2_python_sparse
utils/train_util.py
hezhiqian01/MultiModal-Tagging
train
4
e7d766f34572154b7a0fec27fef9cf801aa40c0f
[ "super(SpatialPath, self).__init__()\nself.conv_7x7 = ConvBnRelu(in_planes, inner_channel, 7, 2, 3, norm_layer=norm_layer, Conv2d=Conv2d)\nself.conv_3x3_1 = ConvBnRelu(inner_channel, inner_channel, 3, 2, 1, norm_layer=norm_layer, Conv2d=Conv2d)\nself.conv_3x3_2 = ConvBnRelu(inner_channel, inner_channel, 3, 2, 1, no...
<|body_start_0|> super(SpatialPath, self).__init__() self.conv_7x7 = ConvBnRelu(in_planes, inner_channel, 7, 2, 3, norm_layer=norm_layer, Conv2d=Conv2d) self.conv_3x3_1 = ConvBnRelu(inner_channel, inner_channel, 3, 2, 1, norm_layer=norm_layer, Conv2d=Conv2d) self.conv_3x3_2 = ConvBnRelu(...
SpatialPath module.
SpatialPath
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpatialPath: """SpatialPath module.""" def __init__(self, in_planes, out_planes, norm_layer='BN', Conv2d=nn.Conv2d, inner_channel=64, **kwargs): """Create SpatialPath. :param in_planes: input channels :param out_planes: output channels :param norm_layer: type of norm layer. :param Co...
stack_v2_sparse_classes_36k_train_032915
9,350
permissive
[ { "docstring": "Create SpatialPath. :param in_planes: input channels :param out_planes: output channels :param norm_layer: type of norm layer. :param Conv2d: type of conv layer. :param inner_channel: number of inner channels.", "name": "__init__", "signature": "def __init__(self, in_planes, out_planes, ...
2
stack_v2_sparse_classes_30k_train_000434
Implement the Python class `SpatialPath` described below. Class description: SpatialPath module. Method signatures and docstrings: - def __init__(self, in_planes, out_planes, norm_layer='BN', Conv2d=nn.Conv2d, inner_channel=64, **kwargs): Create SpatialPath. :param in_planes: input channels :param out_planes: output ...
Implement the Python class `SpatialPath` described below. Class description: SpatialPath module. Method signatures and docstrings: - def __init__(self, in_planes, out_planes, norm_layer='BN', Conv2d=nn.Conv2d, inner_channel=64, **kwargs): Create SpatialPath. :param in_planes: input channels :param out_planes: output ...
e4ef3a1c92d19d1d08c3ef0e2156b6fecefdbe04
<|skeleton|> class SpatialPath: """SpatialPath module.""" def __init__(self, in_planes, out_planes, norm_layer='BN', Conv2d=nn.Conv2d, inner_channel=64, **kwargs): """Create SpatialPath. :param in_planes: input channels :param out_planes: output channels :param norm_layer: type of norm layer. :param Co...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SpatialPath: """SpatialPath module.""" def __init__(self, in_planes, out_planes, norm_layer='BN', Conv2d=nn.Conv2d, inner_channel=64, **kwargs): """Create SpatialPath. :param in_planes: input channels :param out_planes: output channels :param norm_layer: type of norm layer. :param Conv2d: type of...
the_stack_v2_python_sparse
zeus/networks/pytorch/customs/bisenet.py
huawei-noah/xingtian
train
308
9382ed4f817f0f23af9c6d1783faf42786545eec
[ "num_strings = 0\nlengths = self.countTilSwitch(s[0], s)\nfor i in range(len(lengths) - 1):\n for j in range(i + 1, len(lengths)):\n num_strings += min([lengths[i], lengths[j]])\n break\nreturn num_strings", "lengths = []\ncount = 0\nfor val in string:\n if val == start:\n count += 1\n ...
<|body_start_0|> num_strings = 0 lengths = self.countTilSwitch(s[0], s) for i in range(len(lengths) - 1): for j in range(i + 1, len(lengths)): num_strings += min([lengths[i], lengths[j]]) break return num_strings <|end_body_0|> <|body_start_1|...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countBinarySubstrings(self, s): """Returns the number of non-empty substrings in s that have the same number of 0s and 1s, where all 0s and 1s are grouped consecutively. :type s: str :rtype: int""" <|body_0|> def countTilSwitch(self, start, string): """...
stack_v2_sparse_classes_36k_train_032916
1,360
no_license
[ { "docstring": "Returns the number of non-empty substrings in s that have the same number of 0s and 1s, where all 0s and 1s are grouped consecutively. :type s: str :rtype: int", "name": "countBinarySubstrings", "signature": "def countBinarySubstrings(self, s)" }, { "docstring": "Returns list of ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countBinarySubstrings(self, s): Returns the number of non-empty substrings in s that have the same number of 0s and 1s, where all 0s and 1s are grouped consecutively. :type s...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countBinarySubstrings(self, s): Returns the number of non-empty substrings in s that have the same number of 0s and 1s, where all 0s and 1s are grouped consecutively. :type s...
308889e57e71c369aa8516fba8a2064f6a26abee
<|skeleton|> class Solution: def countBinarySubstrings(self, s): """Returns the number of non-empty substrings in s that have the same number of 0s and 1s, where all 0s and 1s are grouped consecutively. :type s: str :rtype: int""" <|body_0|> def countTilSwitch(self, start, string): """...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def countBinarySubstrings(self, s): """Returns the number of non-empty substrings in s that have the same number of 0s and 1s, where all 0s and 1s are grouped consecutively. :type s: str :rtype: int""" num_strings = 0 lengths = self.countTilSwitch(s[0], s) for i in ra...
the_stack_v2_python_sparse
leet_696.py
mike-jolliffe/Learning
train
0
deddc093edcbd0ecbe5e5a821330de0d03642b86
[ "if 'next' in self.request.POST:\n return self.request.POST.get('next')\nreturn reverse('my_reservations')", "if 'pk' in request.POST:\n pk = request.POST.get('pk')\n try:\n reservation = Reservation.objects.get(pk=pk)\n if reservation.can_delete(request.user):\n reservation.dele...
<|body_start_0|> if 'next' in self.request.POST: return self.request.POST.get('next') return reverse('my_reservations') <|end_body_0|> <|body_start_1|> if 'pk' in request.POST: pk = request.POST.get('pk') try: reservation = Reservation.objects...
View for deleting a reservation (Cannot be DeleteView due to the abstract inheritance of reservations)
DeleteReservationView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeleteReservationView: """View for deleting a reservation (Cannot be DeleteView due to the abstract inheritance of reservations)""" def get_redirect_url(self, *args, **kwargs): """Gives the redirect url for when the reservation is deleted :return: The redirect url""" <|body_0...
stack_v2_sparse_classes_36k_train_032917
12,808
permissive
[ { "docstring": "Gives the redirect url for when the reservation is deleted :return: The redirect url", "name": "get_redirect_url", "signature": "def get_redirect_url(self, *args, **kwargs)" }, { "docstring": "Delete the reservation if it can be deleted by the current user and exists :param reque...
2
stack_v2_sparse_classes_30k_train_005143
Implement the Python class `DeleteReservationView` described below. Class description: View for deleting a reservation (Cannot be DeleteView due to the abstract inheritance of reservations) Method signatures and docstrings: - def get_redirect_url(self, *args, **kwargs): Gives the redirect url for when the reservation...
Implement the Python class `DeleteReservationView` described below. Class description: View for deleting a reservation (Cannot be DeleteView due to the abstract inheritance of reservations) Method signatures and docstrings: - def get_redirect_url(self, *args, **kwargs): Gives the redirect url for when the reservation...
1d190a86e3277315804bfcc0b8f9abd4f9c1d780
<|skeleton|> class DeleteReservationView: """View for deleting a reservation (Cannot be DeleteView due to the abstract inheritance of reservations)""" def get_redirect_url(self, *args, **kwargs): """Gives the redirect url for when the reservation is deleted :return: The redirect url""" <|body_0...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DeleteReservationView: """View for deleting a reservation (Cannot be DeleteView due to the abstract inheritance of reservations)""" def get_redirect_url(self, *args, **kwargs): """Gives the redirect url for when the reservation is deleted :return: The redirect url""" if 'next' in self.req...
the_stack_v2_python_sparse
make_queue/views/reservation/reservation.py
mahoyen/web
train
0
50e761f8fb74ad9f325c675cd3bea3d7d5d2e89d
[ "mylog.info('执行测试用例[%s],url=%s' % (name, yl.getFixedData(key1='CB_arData_url')))\nsign_data = tng_signdata_rsa(yl.getFixedData(key1='rsa_private_key'), getTestdata_CB(row))\nmylog.info('请求值:[%s]' % sign_data)\nr = requests.post(url=yl.getFixedData(key1='CB_arData_url'), data=sign_data, headers=headers)\nmylog.info(...
<|body_start_0|> mylog.info('执行测试用例[%s],url=%s' % (name, yl.getFixedData(key1='CB_arData_url'))) sign_data = tng_signdata_rsa(yl.getFixedData(key1='rsa_private_key'), getTestdata_CB(row)) mylog.info('请求值:[%s]' % sign_data) r = requests.post(url=yl.getFixedData(key1='CB_arData_url'), data...
TestCB
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCB: def test_01_arData(self, row, name): """AR数据下载接口""" <|body_0|> def test_02_txnDownload(self, row, name): """城巴交易数据下载""" <|body_1|> def test_03_refund(self, row, name): """城巴订单退款""" <|body_2|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_032918
2,864
no_license
[ { "docstring": "AR数据下载接口", "name": "test_01_arData", "signature": "def test_01_arData(self, row, name)" }, { "docstring": "城巴交易数据下载", "name": "test_02_txnDownload", "signature": "def test_02_txnDownload(self, row, name)" }, { "docstring": "城巴订单退款", "name": "test_03_refund", ...
3
null
Implement the Python class `TestCB` described below. Class description: Implement the TestCB class. Method signatures and docstrings: - def test_01_arData(self, row, name): AR数据下载接口 - def test_02_txnDownload(self, row, name): 城巴交易数据下载 - def test_03_refund(self, row, name): 城巴订单退款
Implement the Python class `TestCB` described below. Class description: Implement the TestCB class. Method signatures and docstrings: - def test_01_arData(self, row, name): AR数据下载接口 - def test_02_txnDownload(self, row, name): 城巴交易数据下载 - def test_03_refund(self, row, name): 城巴订单退款 <|skeleton|> class TestCB: def ...
5fea35c536dd643080c23bc31cca1c321f3c7074
<|skeleton|> class TestCB: def test_01_arData(self, row, name): """AR数据下载接口""" <|body_0|> def test_02_txnDownload(self, row, name): """城巴交易数据下载""" <|body_1|> def test_03_refund(self, row, name): """城巴订单退款""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestCB: def test_01_arData(self, row, name): """AR数据下载接口""" mylog.info('执行测试用例[%s],url=%s' % (name, yl.getFixedData(key1='CB_arData_url'))) sign_data = tng_signdata_rsa(yl.getFixedData(key1='rsa_private_key'), getTestdata_CB(row)) mylog.info('请求值:[%s]' % sign_data) r = ...
the_stack_v2_python_sparse
tng_ts_api/case/test_003_CB.py
zhenfang95/Jiekou
train
1
3b9e74fd1122a3c00ac32541dee53d2680744d97
[ "if not isinstance(contents_path, str):\n raise TypeError('contents_path should be str')\nif not isinstance(query_path, str):\n raise TypeError('query_path should be str')\nwith open(contents_path, encoding='utf-8') as file:\n self.content = file.read()\n self.content = self.content.lower()\n self.co...
<|body_start_0|> if not isinstance(contents_path, str): raise TypeError('contents_path should be str') if not isinstance(query_path, str): raise TypeError('query_path should be str') with open(contents_path, encoding='utf-8') as file: self.content = file.read(...
txt文档的分析
TxtHandle
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TxtHandle: """txt文档的分析""" def __init__(self, contents_path, query_path): """导入待分析文件""" <|body_0|> def query_file(self, path): """导入查询文件,把里面的单词弄成一个列表1""" <|body_1|> def file_analysis(self): """对两个文档进行处理,调用findSubscript进行单词在句子、句子在列表中的位置定位""" ...
stack_v2_sparse_classes_36k_train_032919
2,684
no_license
[ { "docstring": "导入待分析文件", "name": "__init__", "signature": "def __init__(self, contents_path, query_path)" }, { "docstring": "导入查询文件,把里面的单词弄成一个列表1", "name": "query_file", "signature": "def query_file(self, path)" }, { "docstring": "对两个文档进行处理,调用findSubscript进行单词在句子、句子在列表中的位置定位", ...
3
stack_v2_sparse_classes_30k_train_006991
Implement the Python class `TxtHandle` described below. Class description: txt文档的分析 Method signatures and docstrings: - def __init__(self, contents_path, query_path): 导入待分析文件 - def query_file(self, path): 导入查询文件,把里面的单词弄成一个列表1 - def file_analysis(self): 对两个文档进行处理,调用findSubscript进行单词在句子、句子在列表中的位置定位
Implement the Python class `TxtHandle` described below. Class description: txt文档的分析 Method signatures and docstrings: - def __init__(self, contents_path, query_path): 导入待分析文件 - def query_file(self, path): 导入查询文件,把里面的单词弄成一个列表1 - def file_analysis(self): 对两个文档进行处理,调用findSubscript进行单词在句子、句子在列表中的位置定位 <|skeleton|> class ...
dfbe3942babd7843e159a9e2b569c975a93bb34c
<|skeleton|> class TxtHandle: """txt文档的分析""" def __init__(self, contents_path, query_path): """导入待分析文件""" <|body_0|> def query_file(self, path): """导入查询文件,把里面的单词弄成一个列表1""" <|body_1|> def file_analysis(self): """对两个文档进行处理,调用findSubscript进行单词在句子、句子在列表中的位置定位""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TxtHandle: """txt文档的分析""" def __init__(self, contents_path, query_path): """导入待分析文件""" if not isinstance(contents_path, str): raise TypeError('contents_path should be str') if not isinstance(query_path, str): raise TypeError('query_path should be str') ...
the_stack_v2_python_sparse
英文检索单元测试、覆盖率测试/ChapterTwoExercises.py
xffffffffffff/nickYang
train
0
7e94e739a81a6c91335204b8d05115c1be7e26c9
[ "if annotation_file and gt_dataset or (not annotation_file and (not gt_dataset)):\n raise ValueError('One and only one of `annotation_file` and `gt_dataset` needs to be specified.')\nif eval_type not in ['box', 'mask']:\n raise ValueError('The `eval_type` can only be either `box` or `mask`.')\ncoco.COCO.__ini...
<|body_start_0|> if annotation_file and gt_dataset or (not annotation_file and (not gt_dataset)): raise ValueError('One and only one of `annotation_file` and `gt_dataset` needs to be specified.') if eval_type not in ['box', 'mask']: raise ValueError('The `eval_type` can only be e...
COCO wrapper class. This class wraps COCO API object, which provides the following additional functionalities: 1. Support string type image id. 2. Support loading the groundtruth dataset using the external annotation dictionary. 3. Support loading the prediction results using the external annotation dictionary.
COCOWrapper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class COCOWrapper: """COCO wrapper class. This class wraps COCO API object, which provides the following additional functionalities: 1. Support string type image id. 2. Support loading the groundtruth dataset using the external annotation dictionary. 3. Support loading the prediction results using the ...
stack_v2_sparse_classes_36k_train_032920
16,692
permissive
[ { "docstring": "Instantiates a COCO-style API object. Args: eval_type: either 'box' or 'mask'. annotation_file: a JSON file that stores annotations of the eval dataset. This is required if `gt_dataset` is not provided. gt_dataset: the groundtruth eval datatset in COCO API format.", "name": "__init__", "...
2
stack_v2_sparse_classes_30k_train_010223
Implement the Python class `COCOWrapper` described below. Class description: COCO wrapper class. This class wraps COCO API object, which provides the following additional functionalities: 1. Support string type image id. 2. Support loading the groundtruth dataset using the external annotation dictionary. 3. Support lo...
Implement the Python class `COCOWrapper` described below. Class description: COCO wrapper class. This class wraps COCO API object, which provides the following additional functionalities: 1. Support string type image id. 2. Support loading the groundtruth dataset using the external annotation dictionary. 3. Support lo...
0f7adb97a93ec3e3485c261d030c507eb16b33e4
<|skeleton|> class COCOWrapper: """COCO wrapper class. This class wraps COCO API object, which provides the following additional functionalities: 1. Support string type image id. 2. Support loading the groundtruth dataset using the external annotation dictionary. 3. Support loading the prediction results using the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class COCOWrapper: """COCO wrapper class. This class wraps COCO API object, which provides the following additional functionalities: 1. Support string type image id. 2. Support loading the groundtruth dataset using the external annotation dictionary. 3. Support loading the prediction results using the external anno...
the_stack_v2_python_sparse
models/official/detection/evaluation/coco_utils.py
tensorflow/tpu
train
5,627
57a7cd7346f7ceb3a5f5b9c5d8841e129b844b98
[ "self.fc1 = nn.Linear(self.observation_space.shape[0], 32)\nself.fc2 = nn.Linear(32, 32)\nself.fc3 = nn.Linear(32, 32)\nself.dist = Categorical(32, self.action_space.n)", "x = F.relu(self.fc1(x))\nx = F.relu(self.fc2(x))\nx = F.relu(self.fc3(x))\nreturn self.dist(x)" ]
<|body_start_0|> self.fc1 = nn.Linear(self.observation_space.shape[0], 32) self.fc2 = nn.Linear(32, 32) self.fc3 = nn.Linear(32, 32) self.dist = Categorical(32, self.action_space.n) <|end_body_0|> <|body_start_1|> x = F.relu(self.fc1(x)) x = F.relu(self.fc2(x)) x...
Policy network.
PiBase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PiBase: """Policy network.""" def build(self): """Build Network.""" <|body_0|> def forward(self, x): """Forward.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.fc1 = nn.Linear(self.observation_space.shape[0], 32) self.fc2 = nn.Line...
stack_v2_sparse_classes_36k_train_032921
5,956
no_license
[ { "docstring": "Build Network.", "name": "build", "signature": "def build(self)" }, { "docstring": "Forward.", "name": "forward", "signature": "def forward(self, x)" } ]
2
stack_v2_sparse_classes_30k_test_000438
Implement the Python class `PiBase` described below. Class description: Policy network. Method signatures and docstrings: - def build(self): Build Network. - def forward(self, x): Forward.
Implement the Python class `PiBase` described below. Class description: Policy network. Method signatures and docstrings: - def build(self): Build Network. - def forward(self, x): Forward. <|skeleton|> class PiBase: """Policy network.""" def build(self): """Build Network.""" <|body_0|> ...
e71c4b12955b01bfb907aa31c91ded6bcd8aaec8
<|skeleton|> class PiBase: """Policy network.""" def build(self): """Build Network.""" <|body_0|> def forward(self, x): """Forward.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PiBase: """Policy network.""" def build(self): """Build Network.""" self.fc1 = nn.Linear(self.observation_space.shape[0], 32) self.fc2 = nn.Linear(32, 32) self.fc3 = nn.Linear(32, 32) self.dist = Categorical(32, self.action_space.n) def forward(self, x): ...
the_stack_v2_python_sparse
dl/rl/algorithms/sac_discrete.py
cbschaff/dl
train
1
fa8fc943a3ed3989ac740a4ba965bd855eb29dfe
[ "check_type(session, RestSession)\nsuper(AdminAuditEventsAPI, self).__init__()\nself._session = session\nself._object_factory = object_factory", "check_type(orgId, basestring)\ncheck_type(_from, basestring)\ncheck_type(to, basestring)\ncheck_type(actorId, basestring, optional=True)\ncheck_type(max, int)\ncheck_ty...
<|body_start_0|> check_type(session, RestSession) super(AdminAuditEventsAPI, self).__init__() self._session = session self._object_factory = object_factory <|end_body_0|> <|body_start_1|> check_type(orgId, basestring) check_type(_from, basestring) check_type(to, ...
Admin Audit Events API. Wraps the Webex Teams Admin Audit Events API and exposes the API as native Python methods that return native Python objects.
AdminAuditEventsAPI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdminAuditEventsAPI: """Admin Audit Events API. Wraps the Webex Teams Admin Audit Events API and exposes the API as native Python methods that return native Python objects.""" def __init__(self, session, object_factory): """Init a new AdminAuditEventsAPI object with the provided Rest...
stack_v2_sparse_classes_36k_train_032922
4,953
permissive
[ { "docstring": "Init a new AdminAuditEventsAPI object with the provided RestSession. Args: session(RestSession): The RESTful session object to be used for API calls to the Webex Teams service. Raises: TypeError: If the parameter types are incorrect.", "name": "__init__", "signature": "def __init__(self,...
2
stack_v2_sparse_classes_30k_train_016364
Implement the Python class `AdminAuditEventsAPI` described below. Class description: Admin Audit Events API. Wraps the Webex Teams Admin Audit Events API and exposes the API as native Python methods that return native Python objects. Method signatures and docstrings: - def __init__(self, session, object_factory): Ini...
Implement the Python class `AdminAuditEventsAPI` described below. Class description: Admin Audit Events API. Wraps the Webex Teams Admin Audit Events API and exposes the API as native Python methods that return native Python objects. Method signatures and docstrings: - def __init__(self, session, object_factory): Ini...
d031aab82e3fa5ce7cf57b257fef8c9a4c63d71e
<|skeleton|> class AdminAuditEventsAPI: """Admin Audit Events API. Wraps the Webex Teams Admin Audit Events API and exposes the API as native Python methods that return native Python objects.""" def __init__(self, session, object_factory): """Init a new AdminAuditEventsAPI object with the provided Rest...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdminAuditEventsAPI: """Admin Audit Events API. Wraps the Webex Teams Admin Audit Events API and exposes the API as native Python methods that return native Python objects.""" def __init__(self, session, object_factory): """Init a new AdminAuditEventsAPI object with the provided RestSession. Args...
the_stack_v2_python_sparse
venv/lib/python3.9/site-packages/webexteamssdk/api/admin_audit_events.py
CiscoDevNet/meraki-code
train
67
dabfa70bb3b8814b1a7d6b475c103f3d3302e625
[ "assert self.substitute_func == torch.nn.functional.linear\nnode_kind = 'call_function'\nnode_target = self.substitute_func\nnode_args = (input_proxy, other_proxy)\nnode_kwargs = {}\nnon_bias_func_proxy = self.tracer.create_proxy(node_kind, node_target, node_args, node_kwargs)\nreturn non_bias_func_proxy", "bias_...
<|body_start_0|> assert self.substitute_func == torch.nn.functional.linear node_kind = 'call_function' node_target = self.substitute_func node_args = (input_proxy, other_proxy) node_kwargs = {} non_bias_func_proxy = self.tracer.create_proxy(node_kind, node_target, node_ar...
This class is used to construct the restructure computation graph for call_func node based on F.linear.
LinearBasedBiasFunc
[ "BSD-3-Clause", "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0", "BSD-2-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinearBasedBiasFunc: """This class is used to construct the restructure computation graph for call_func node based on F.linear.""" def create_non_bias_func_proxy(self, input_proxy, other_proxy): """This method is used to create the non_bias_func proxy, the node created by this proxy ...
stack_v2_sparse_classes_36k_train_032923
4,471
permissive
[ { "docstring": "This method is used to create the non_bias_func proxy, the node created by this proxy will compute the main computation, such as convolution, with bias option banned.", "name": "create_non_bias_func_proxy", "signature": "def create_non_bias_func_proxy(self, input_proxy, other_proxy)" }...
2
stack_v2_sparse_classes_30k_train_013288
Implement the Python class `LinearBasedBiasFunc` described below. Class description: This class is used to construct the restructure computation graph for call_func node based on F.linear. Method signatures and docstrings: - def create_non_bias_func_proxy(self, input_proxy, other_proxy): This method is used to create...
Implement the Python class `LinearBasedBiasFunc` described below. Class description: This class is used to construct the restructure computation graph for call_func node based on F.linear. Method signatures and docstrings: - def create_non_bias_func_proxy(self, input_proxy, other_proxy): This method is used to create...
c7b60f75470f067d1342705708810a660eabd684
<|skeleton|> class LinearBasedBiasFunc: """This class is used to construct the restructure computation graph for call_func node based on F.linear.""" def create_non_bias_func_proxy(self, input_proxy, other_proxy): """This method is used to create the non_bias_func proxy, the node created by this proxy ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LinearBasedBiasFunc: """This class is used to construct the restructure computation graph for call_func node based on F.linear.""" def create_non_bias_func_proxy(self, input_proxy, other_proxy): """This method is used to create the non_bias_func proxy, the node created by this proxy will compute ...
the_stack_v2_python_sparse
colossalai/fx/tracer/bias_addition_patch/patched_bias_addition_function/bias_addition_function.py
hpcaitech/ColossalAI
train
32,044
b7fc9714dd34cd8af2b3a521ec87d6f680a3b1dc
[ "delegate_view = SearchResultView()\nquery = delegate_view.parse_search_criteria(escape(self.request.QUERY_PARAMS.get('q', None)))\nresult = {}\nif query:\n queryset = delegate_view.search_in_works(query)\n result = SimpleWorkSerializer(queryset, many=True).data\nreturn Response(result)", "queryset = Work.o...
<|body_start_0|> delegate_view = SearchResultView() query = delegate_view.parse_search_criteria(escape(self.request.QUERY_PARAMS.get('q', None))) result = {} if query: queryset = delegate_view.search_in_works(query) result = SimpleWorkSerializer(queryset, many=Tru...
Viewset for handling current user feed actions
CompleteWorkViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CompleteWorkViewSet: """Viewset for handling current user feed actions""" def list(self, request): """Work search""" <|body_0|> def retrieve(self, request, pk=None): """Single work data retrieve""" <|body_1|> <|end_skeleton|> <|body_start_0|> de...
stack_v2_sparse_classes_36k_train_032924
7,837
no_license
[ { "docstring": "Work search", "name": "list", "signature": "def list(self, request)" }, { "docstring": "Single work data retrieve", "name": "retrieve", "signature": "def retrieve(self, request, pk=None)" } ]
2
stack_v2_sparse_classes_30k_train_015021
Implement the Python class `CompleteWorkViewSet` described below. Class description: Viewset for handling current user feed actions Method signatures and docstrings: - def list(self, request): Work search - def retrieve(self, request, pk=None): Single work data retrieve
Implement the Python class `CompleteWorkViewSet` described below. Class description: Viewset for handling current user feed actions Method signatures and docstrings: - def list(self, request): Work search - def retrieve(self, request, pk=None): Single work data retrieve <|skeleton|> class CompleteWorkViewSet: ""...
4f7aa41fd0697af61539efd1aba2062addb63009
<|skeleton|> class CompleteWorkViewSet: """Viewset for handling current user feed actions""" def list(self, request): """Work search""" <|body_0|> def retrieve(self, request, pk=None): """Single work data retrieve""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CompleteWorkViewSet: """Viewset for handling current user feed actions""" def list(self, request): """Work search""" delegate_view = SearchResultView() query = delegate_view.parse_search_criteria(escape(self.request.QUERY_PARAMS.get('q', None))) result = {} if quer...
the_stack_v2_python_sparse
barddo/api/views.py
bruno-ortiz/barddo
train
0
57a99536b2639899da9092aa34a11dc71d112685
[ "self.beta = Para.beta\nself.Pi = Para.Pi\nself.G = Para.G\nself.S = len(Para.Pi)\nself.Theta = Para.Theta\nself.Para = Para\nself.xbar = [min(xgrid), max(xgrid)]\nself.time_0 = False\nself.z0 = {}\ncf, nf, xprimef = policies0\nfor s_ in range(self.S):\n for x in xgrid:\n self.z0[x, s_] = np.hstack([cf[s_...
<|body_start_0|> self.beta = Para.beta self.Pi = Para.Pi self.G = Para.G self.S = len(Para.Pi) self.Theta = Para.Theta self.Para = Para self.xbar = [min(xgrid), max(xgrid)] self.time_0 = False self.z0 = {} cf, nf, xprimef = policies0 ...
Bellman equation for the continuation of the Lucas-Stokey Problem
BellmanEquation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BellmanEquation: """Bellman equation for the continuation of the Lucas-Stokey Problem""" def __init__(self, Para, xgrid, policies0): """Initializes the class from the calibration Para""" <|body_0|> def find_first_best(self): """Find the first best allocation""" ...
stack_v2_sparse_classes_36k_train_032925
9,454
permissive
[ { "docstring": "Initializes the class from the calibration Para", "name": "__init__", "signature": "def __init__(self, Para, xgrid, policies0)" }, { "docstring": "Find the first best allocation", "name": "find_first_best", "signature": "def find_first_best(self)" }, { "docstring"...
5
null
Implement the Python class `BellmanEquation` described below. Class description: Bellman equation for the continuation of the Lucas-Stokey Problem Method signatures and docstrings: - def __init__(self, Para, xgrid, policies0): Initializes the class from the calibration Para - def find_first_best(self): Find the first...
Implement the Python class `BellmanEquation` described below. Class description: Bellman equation for the continuation of the Lucas-Stokey Problem Method signatures and docstrings: - def __init__(self, Para, xgrid, policies0): Initializes the class from the calibration Para - def find_first_best(self): Find the first...
8832a74acd219a71cb0a99dc63c5e976598ac999
<|skeleton|> class BellmanEquation: """Bellman equation for the continuation of the Lucas-Stokey Problem""" def __init__(self, Para, xgrid, policies0): """Initializes the class from the calibration Para""" <|body_0|> def find_first_best(self): """Find the first best allocation""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BellmanEquation: """Bellman equation for the continuation of the Lucas-Stokey Problem""" def __init__(self, Para, xgrid, policies0): """Initializes the class from the calibration Para""" self.beta = Para.beta self.Pi = Para.Pi self.G = Para.G self.S = len(Para.Pi) ...
the_stack_v2_python_sparse
amss/amss.py
chenwang/QuantEcon.lectures.code
train
0
07a203c157e3207352b4542eedc76eb993a5dbad
[ "self.entity_description = description\nself._attr_unique_id = f'{DOMAIN}-{description.key}-{inverter.serial_number}'\nself._attr_device_info = device_info\nself._attr_native_value = float(current_value)\nself._inverter: Inverter = inverter", "await self.entity_description.setter(self._inverter, int(value))\nself...
<|body_start_0|> self.entity_description = description self._attr_unique_id = f'{DOMAIN}-{description.key}-{inverter.serial_number}' self._attr_device_info = device_info self._attr_native_value = float(current_value) self._inverter: Inverter = inverter <|end_body_0|> <|body_star...
Inverter numeric setting entity.
InverterNumberEntity
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InverterNumberEntity: """Inverter numeric setting entity.""" def __init__(self, device_info: DeviceInfo, description: GoodweNumberEntityDescription, inverter: Inverter, current_value: int) -> None: """Initialize the number inverter setting entity.""" <|body_0|> async def...
stack_v2_sparse_classes_36k_train_032926
5,018
permissive
[ { "docstring": "Initialize the number inverter setting entity.", "name": "__init__", "signature": "def __init__(self, device_info: DeviceInfo, description: GoodweNumberEntityDescription, inverter: Inverter, current_value: int) -> None" }, { "docstring": "Set new value.", "name": "async_set_n...
2
stack_v2_sparse_classes_30k_train_017393
Implement the Python class `InverterNumberEntity` described below. Class description: Inverter numeric setting entity. Method signatures and docstrings: - def __init__(self, device_info: DeviceInfo, description: GoodweNumberEntityDescription, inverter: Inverter, current_value: int) -> None: Initialize the number inve...
Implement the Python class `InverterNumberEntity` described below. Class description: Inverter numeric setting entity. Method signatures and docstrings: - def __init__(self, device_info: DeviceInfo, description: GoodweNumberEntityDescription, inverter: Inverter, current_value: int) -> None: Initialize the number inve...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class InverterNumberEntity: """Inverter numeric setting entity.""" def __init__(self, device_info: DeviceInfo, description: GoodweNumberEntityDescription, inverter: Inverter, current_value: int) -> None: """Initialize the number inverter setting entity.""" <|body_0|> async def...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InverterNumberEntity: """Inverter numeric setting entity.""" def __init__(self, device_info: DeviceInfo, description: GoodweNumberEntityDescription, inverter: Inverter, current_value: int) -> None: """Initialize the number inverter setting entity.""" self.entity_description = description ...
the_stack_v2_python_sparse
homeassistant/components/goodwe/number.py
home-assistant/core
train
35,501
896710a50b6a81bb782a3c9852cf7a51dd384abb
[ "self.name = name\nself.bord = []\nfor i in range(0, 4):\n self.bord.append(PuzzleGirafeBord(definition[i * 2:i * 2 + 2]))\nself.orientation = 0\nself.position = position\nself.numero = numero", "image = pygame.image.load(self.name)\nself.image = pygame.transform.scale(image, (250, 250))\ns = self.image.get_si...
<|body_start_0|> self.name = name self.bord = [] for i in range(0, 4): self.bord.append(PuzzleGirafeBord(definition[i * 2:i * 2 + 2])) self.orientation = 0 self.position = position self.numero = numero <|end_body_0|> <|body_start_1|> image = pygame.im...
Définition d'une pièce du puzzle, celle-ci inclut : - **bord** : cette liste contient quatre objets de type Bord, cette liste ne changera plus - **position** : c'est la position de la pièce dans le puzzle, ce qui nous intéresse, c'est la position finale de la pièce dans le puzzle, cette information va donc bouger au fu...
PuzzleGirafePiece
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PuzzleGirafePiece: """Définition d'une pièce du puzzle, celle-ci inclut : - **bord** : cette liste contient quatre objets de type Bord, cette liste ne changera plus - **position** : c'est la position de la pièce dans le puzzle, ce qui nous intéresse, c'est la position finale de la pièce dans le p...
stack_v2_sparse_classes_36k_train_032927
17,048
permissive
[ { "docstring": "on définit la pièce @param name nom de l'image représentant la pièce @param definition chaîne de 8 caractères, c'est une suite de 4 x 2 caractères définissant chaque bord, voir la classe bord pour leur signification @param position c'est la position initiale de la pièce, on suppose que l'orienta...
5
stack_v2_sparse_classes_30k_train_015863
Implement the Python class `PuzzleGirafePiece` described below. Class description: Définition d'une pièce du puzzle, celle-ci inclut : - **bord** : cette liste contient quatre objets de type Bord, cette liste ne changera plus - **position** : c'est la position de la pièce dans le puzzle, ce qui nous intéresse, c'est l...
Implement the Python class `PuzzleGirafePiece` described below. Class description: Définition d'une pièce du puzzle, celle-ci inclut : - **bord** : cette liste contient quatre objets de type Bord, cette liste ne changera plus - **position** : c'est la position de la pièce dans le puzzle, ce qui nous intéresse, c'est l...
2abbc7a20c7437f9ab91d1ec83a6aecdefceb028
<|skeleton|> class PuzzleGirafePiece: """Définition d'une pièce du puzzle, celle-ci inclut : - **bord** : cette liste contient quatre objets de type Bord, cette liste ne changera plus - **position** : c'est la position de la pièce dans le puzzle, ce qui nous intéresse, c'est la position finale de la pièce dans le p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PuzzleGirafePiece: """Définition d'une pièce du puzzle, celle-ci inclut : - **bord** : cette liste contient quatre objets de type Bord, cette liste ne changera plus - **position** : c'est la position de la pièce dans le puzzle, ce qui nous intéresse, c'est la position finale de la pièce dans le puzzle, cette ...
the_stack_v2_python_sparse
src/ensae_teaching_cs/special/puzzle_girafe.py
Pandinosaurus/ensae_teaching_cs
train
1
5cee8f5de037c00a8a219bd097bcd41da9b85faa
[ "self.value_dict = {}\nfor i in range(len(nums)):\n if nums[i]:\n self.value_dict[i] = nums[i]", "a_value_dict = self.value_dict\nb_value_dict = vec.value_dict\ntemp_value = 0\nif len(a_value_dict) > len(b_value_dict):\n b_value_dict, a_value_dict = (a_value_dict, b_value_dict)\nfor key, value in a_v...
<|body_start_0|> self.value_dict = {} for i in range(len(nums)): if nums[i]: self.value_dict[i] = nums[i] <|end_body_0|> <|body_start_1|> a_value_dict = self.value_dict b_value_dict = vec.value_dict temp_value = 0 if len(a_value_dict) > len(b_...
SparseVector
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SparseVector: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def dotProduct(self, vec): """:type vec: 'SparseVector' :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.value_dict = {} for i in range(len(nums))...
stack_v2_sparse_classes_36k_train_032928
1,129
no_license
[ { "docstring": ":type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": ":type vec: 'SparseVector' :rtype: int", "name": "dotProduct", "signature": "def dotProduct(self, vec)" } ]
2
stack_v2_sparse_classes_30k_train_015391
Implement the Python class `SparseVector` described below. Class description: Implement the SparseVector class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def dotProduct(self, vec): :type vec: 'SparseVector' :rtype: int
Implement the Python class `SparseVector` described below. Class description: Implement the SparseVector class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def dotProduct(self, vec): :type vec: 'SparseVector' :rtype: int <|skeleton|> class SparseVector: def __init__(sel...
dc45210cb2cc50bfefd8c21c865e6ee2163a022a
<|skeleton|> class SparseVector: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def dotProduct(self, vec): """:type vec: 'SparseVector' :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SparseVector: def __init__(self, nums): """:type nums: List[int]""" self.value_dict = {} for i in range(len(nums)): if nums[i]: self.value_dict[i] = nums[i] def dotProduct(self, vec): """:type vec: 'SparseVector' :rtype: int""" a_value_d...
the_stack_v2_python_sparse
practice/solution/1570_dot_product_of_two_sparse_vectors.py
kesarb/leetcode-summary-python
train
0
cca77157033c806c8fd8a168a9feec25e1ad6429
[ "self.auth = auth\nif isinstance(sid, PracticeSchool):\n self.school = sid\nelse:\n self.school = self.get_school_model(sid)", "if not sid:\n return None\nschool = PracticeSchool.objects.get_once(pk=sid)\nif not school:\n raise PracticeSchoolInfoExcept.school_is_not_exists()\nreturn school", "if not...
<|body_start_0|> self.auth = auth if isinstance(sid, PracticeSchool): self.school = sid else: self.school = self.get_school_model(sid) <|end_body_0|> <|body_start_1|> if not sid: return None school = PracticeSchool.objects.get_once(pk=sid) ...
SchoolLogic
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SchoolLogic: def __init__(self, auth, sid): """INIT :param auth: :param sid:""" <|body_0|> def get_school_model(self, sid): """获取学校model :param sid: :return:""" <|body_1|> def get_school_info(self): """获取学校信息 :return:""" <|body_2|> <|end...
stack_v2_sparse_classes_36k_train_032929
1,120
no_license
[ { "docstring": "INIT :param auth: :param sid:", "name": "__init__", "signature": "def __init__(self, auth, sid)" }, { "docstring": "获取学校model :param sid: :return:", "name": "get_school_model", "signature": "def get_school_model(self, sid)" }, { "docstring": "获取学校信息 :return:", ...
3
null
Implement the Python class `SchoolLogic` described below. Class description: Implement the SchoolLogic class. Method signatures and docstrings: - def __init__(self, auth, sid): INIT :param auth: :param sid: - def get_school_model(self, sid): 获取学校model :param sid: :return: - def get_school_info(self): 获取学校信息 :return:
Implement the Python class `SchoolLogic` described below. Class description: Implement the SchoolLogic class. Method signatures and docstrings: - def __init__(self, auth, sid): INIT :param auth: :param sid: - def get_school_model(self, sid): 获取学校model :param sid: :return: - def get_school_info(self): 获取学校信息 :return: ...
7467cd66e1fc91f0b3a264f8fc9b93f22f09fe7b
<|skeleton|> class SchoolLogic: def __init__(self, auth, sid): """INIT :param auth: :param sid:""" <|body_0|> def get_school_model(self, sid): """获取学校model :param sid: :return:""" <|body_1|> def get_school_info(self): """获取学校信息 :return:""" <|body_2|> <|end...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SchoolLogic: def __init__(self, auth, sid): """INIT :param auth: :param sid:""" self.auth = auth if isinstance(sid, PracticeSchool): self.school = sid else: self.school = self.get_school_model(sid) def get_school_model(self, sid): """获取学校mod...
the_stack_v2_python_sparse
FireHydrant/server/practice/logics/school.py
shoogoome/FireHydrant
train
4
e8d059f09f073f9569871df34e88dae4a05e5a90
[ "class Group(object):\n group_id = 'group_id'\nself.pool = object()\nself.treq = object()\nself.clock = Clock()\nself.rcs = _FakeRCS()\nself.group = Group()\nself.servers = [{'metadata': {'rax:autoscale:group:id': 'wrong_id'}}, {'metadata': {}}]\n\ndef _list_servers(rcs, pool, _treq):\n self.assertEqual(rcs, ...
<|body_start_0|> class Group(object): group_id = 'group_id' self.pool = object() self.treq = object() self.clock = Clock() self.rcs = _FakeRCS() self.group = Group() self.servers = [{'metadata': {'rax:autoscale:group:id': 'wrong_id'}}, {'metadata': {}}...
Tests for :func:`nova.wait_for_server`.
NovaWaitForServersTestCase
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NovaWaitForServersTestCase: """Tests for :func:`nova.wait_for_server`.""" def setUp(self): """Set up fake pool, treq, responses, and RCS.""" <|body_0|> def test_wait_for_servers_retries_until_matcher_matches(self): """If the matcher does not match the nova server...
stack_v2_sparse_classes_36k_train_032930
9,051
permissive
[ { "docstring": "Set up fake pool, treq, responses, and RCS.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "If the matcher does not match the nova servers state, retries until it does.", "name": "test_wait_for_servers_retries_until_matcher_matches", "signature": "def...
4
null
Implement the Python class `NovaWaitForServersTestCase` described below. Class description: Tests for :func:`nova.wait_for_server`. Method signatures and docstrings: - def setUp(self): Set up fake pool, treq, responses, and RCS. - def test_wait_for_servers_retries_until_matcher_matches(self): If the matcher does not ...
Implement the Python class `NovaWaitForServersTestCase` described below. Class description: Tests for :func:`nova.wait_for_server`. Method signatures and docstrings: - def setUp(self): Set up fake pool, treq, responses, and RCS. - def test_wait_for_servers_retries_until_matcher_matches(self): If the matcher does not ...
7199cdd67255fe116dbcbedea660c13453671134
<|skeleton|> class NovaWaitForServersTestCase: """Tests for :func:`nova.wait_for_server`.""" def setUp(self): """Set up fake pool, treq, responses, and RCS.""" <|body_0|> def test_wait_for_servers_retries_until_matcher_matches(self): """If the matcher does not match the nova server...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NovaWaitForServersTestCase: """Tests for :func:`nova.wait_for_server`.""" def setUp(self): """Set up fake pool, treq, responses, and RCS.""" class Group(object): group_id = 'group_id' self.pool = object() self.treq = object() self.clock = Clock() ...
the_stack_v2_python_sparse
otter/integration/lib/test_nova.py
rackerlabs/otter
train
20
fb25f86d4956d0617e8e8b9df02a666e9f948b18
[ "declared = []\nfor obj in Rt.objective:\n var_list = split('[+*/-]', obj)\n for v in var_list:\n if v not in declared:\n self.add_input(v)\n declared.append(v)\n self.add_output('Objective function ' + obj)", "cpacs = CPACS(Rt.modules[-1].cpacs_out)\nupdate_dict(cpacs.tixi, ...
<|body_start_0|> declared = [] for obj in Rt.objective: var_list = split('[+*/-]', obj) for v in var_list: if v not in declared: self.add_input(v) declared.append(v) self.add_output('Objective function ' + obj) <...
Class to compute the objective function(s)
Objective
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Objective: """Class to compute the objective function(s)""" def setup(self): """Setup inputs and outputs""" <|body_0|> def compute(self, inputs, outputs): """Compute the objective expression""" <|body_1|> <|end_skeleton|> <|body_start_0|> declar...
stack_v2_sparse_classes_36k_train_032931
20,064
permissive
[ { "docstring": "Setup inputs and outputs", "name": "setup", "signature": "def setup(self)" }, { "docstring": "Compute the objective expression", "name": "compute", "signature": "def compute(self, inputs, outputs)" } ]
2
stack_v2_sparse_classes_30k_train_012462
Implement the Python class `Objective` described below. Class description: Class to compute the objective function(s) Method signatures and docstrings: - def setup(self): Setup inputs and outputs - def compute(self, inputs, outputs): Compute the objective expression
Implement the Python class `Objective` described below. Class description: Class to compute the objective function(s) Method signatures and docstrings: - def setup(self): Setup inputs and outputs - def compute(self, inputs, outputs): Compute the objective expression <|skeleton|> class Objective: """Class to comp...
30ca55b39dc14e3f8ec1e00a475f76024d1b5fef
<|skeleton|> class Objective: """Class to compute the objective function(s)""" def setup(self): """Setup inputs and outputs""" <|body_0|> def compute(self, inputs, outputs): """Compute the objective expression""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Objective: """Class to compute the objective function(s)""" def setup(self): """Setup inputs and outputs""" declared = [] for obj in Rt.objective: var_list = split('[+*/-]', obj) for v in var_list: if v not in declared: s...
the_stack_v2_python_sparse
ceasiompy/Optimisation/optimisation.py
cfsengineering/CEASIOMpy
train
60
f47a9060f8844cd2e36496bb6e0ad964fc1a06ad
[ "if id is not None:\n self.id = id\nelse:\n Base.__nb_objects += 1\n self.id = Base.__nb_objects", "if list_dictionaries is None:\n return '[]'\nelse:\n return json.dumps(list_dictionaries)", "if list_objs is None:\n list_objs = []\nl = []\nfor obj in list_objs:\n l.append(cls.to_dictionary...
<|body_start_0|> if id is not None: self.id = id else: Base.__nb_objects += 1 self.id = Base.__nb_objects <|end_body_0|> <|body_start_1|> if list_dictionaries is None: return '[]' else: return json.dumps(list_dictionaries) <|en...
Manage id attribute in all future classes
Base
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Base: """Manage id attribute in all future classes""" def __init__(self, id=None): """the init method""" <|body_0|> def to_json_string(list_dictionaries): """convert to a json string""" <|body_1|> def save_to_file(cls, list_objs): """save to ...
stack_v2_sparse_classes_36k_train_032932
1,506
no_license
[ { "docstring": "the init method", "name": "__init__", "signature": "def __init__(self, id=None)" }, { "docstring": "convert to a json string", "name": "to_json_string", "signature": "def to_json_string(list_dictionaries)" }, { "docstring": "save to json file", "name": "save_t...
5
stack_v2_sparse_classes_30k_train_011978
Implement the Python class `Base` described below. Class description: Manage id attribute in all future classes Method signatures and docstrings: - def __init__(self, id=None): the init method - def to_json_string(list_dictionaries): convert to a json string - def save_to_file(cls, list_objs): save to json file - def...
Implement the Python class `Base` described below. Class description: Manage id attribute in all future classes Method signatures and docstrings: - def __init__(self, id=None): the init method - def to_json_string(list_dictionaries): convert to a json string - def save_to_file(cls, list_objs): save to json file - def...
04c2424c6e98680ead4efa974ec2d948d21024ad
<|skeleton|> class Base: """Manage id attribute in all future classes""" def __init__(self, id=None): """the init method""" <|body_0|> def to_json_string(list_dictionaries): """convert to a json string""" <|body_1|> def save_to_file(cls, list_objs): """save to ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Base: """Manage id attribute in all future classes""" def __init__(self, id=None): """the init method""" if id is not None: self.id = id else: Base.__nb_objects += 1 self.id = Base.__nb_objects def to_json_string(list_dictionaries): ...
the_stack_v2_python_sparse
0x0C-python-almost_a_circle/models/base.py
AhlemKaabi/holbertonschool-higher_level_programming
train
1
5be3116168ea24101367af63ceab04f856d176db
[ "self.capacity = capacity\nself.store = {}\nself.order_list = []", "if key in self.store:\n self.order_list.remove(key)\n self.order_list.append(key)\n return self.store[key]\nreturn -1", "if key in self.store:\n self.store[key] = value\n self.order_list.remove(key)\n self.order_list.append(ke...
<|body_start_0|> self.capacity = capacity self.store = {} self.order_list = [] <|end_body_0|> <|body_start_1|> if key in self.store: self.order_list.remove(key) self.order_list.append(key) return self.store[key] return -1 <|end_body_1|> <|bod...
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k_train_032933
2,431
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: None", "name": "pu...
3
null
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: None
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: None <|sk...
ee2a50e57d810d63c373db2696dc6ab28c4cdce1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LRUCache: def __init__(self, capacity): """:type capacity: int""" self.capacity = capacity self.store = {} self.order_list = [] def get(self, key): """:type key: int :rtype: int""" if key in self.store: self.order_list.remove(key) se...
the_stack_v2_python_sparse
lru-cache.py
simyy/leetcode
train
0
77b746b9e4c9476baeae6f71916a67c7136f0346
[ "self.collection_summary = collection_summary\nself.collection_parent = collection_parent\nself.collection_item = collection_item", "if dictionary is None:\n return None\ncollection_summary = awsecommerceservice.models.collection_summary.CollectionSummary.from_dictionary(dictionary.get('CollectionSummary')) if...
<|body_start_0|> self.collection_summary = collection_summary self.collection_parent = collection_parent self.collection_item = collection_item <|end_body_0|> <|body_start_1|> if dictionary is None: return None collection_summary = awsecommerceservice.models.collecti...
Implementation of the 'Collection' model. TODO: type model description here. Attributes: collection_summary (CollectionSummary): TODO: type description here. collection_parent (CollectionParent): TODO: type description here. collection_item (list of CollectionItem): TODO: type description here.
Collection
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Collection: """Implementation of the 'Collection' model. TODO: type model description here. Attributes: collection_summary (CollectionSummary): TODO: type description here. collection_parent (CollectionParent): TODO: type description here. collection_item (list of CollectionItem): TODO: type desc...
stack_v2_sparse_classes_36k_train_032934
2,741
permissive
[ { "docstring": "Constructor for the Collection class", "name": "__init__", "signature": "def __init__(self, collection_summary=None, collection_parent=None, collection_item=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary r...
2
stack_v2_sparse_classes_30k_train_014323
Implement the Python class `Collection` described below. Class description: Implementation of the 'Collection' model. TODO: type model description here. Attributes: collection_summary (CollectionSummary): TODO: type description here. collection_parent (CollectionParent): TODO: type description here. collection_item (l...
Implement the Python class `Collection` described below. Class description: Implementation of the 'Collection' model. TODO: type model description here. Attributes: collection_summary (CollectionSummary): TODO: type description here. collection_parent (CollectionParent): TODO: type description here. collection_item (l...
26ea1019115a1de3b1b37a4b830525e164ac55ce
<|skeleton|> class Collection: """Implementation of the 'Collection' model. TODO: type model description here. Attributes: collection_summary (CollectionSummary): TODO: type description here. collection_parent (CollectionParent): TODO: type description here. collection_item (list of CollectionItem): TODO: type desc...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Collection: """Implementation of the 'Collection' model. TODO: type model description here. Attributes: collection_summary (CollectionSummary): TODO: type description here. collection_parent (CollectionParent): TODO: type description here. collection_item (list of CollectionItem): TODO: type description here....
the_stack_v2_python_sparse
awsecommerceservice/models/collection.py
nidaizamir/Test-PY
train
0
ba895f997106d4fd656ba44b2994b363a664f2d5
[ "params = Response(job_id=job_id)\nlog.info('删除任务[params: %s]' % str(params))\nreturn params", "params = Response(job_id=job_id)\nlog.info('获取任务[params: %s]' % str(params))\nreturn params", "payload = get_payload()\nparams = Response(job_id=job_id, interface_id=int(payload.get('interface_id', 0)), job_name=payl...
<|body_start_0|> params = Response(job_id=job_id) log.info('删除任务[params: %s]' % str(params)) return params <|end_body_0|> <|body_start_1|> params = Response(job_id=job_id) log.info('获取任务[params: %s]' % str(params)) return params <|end_body_1|> <|body_start_2|> p...
JobDetail
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JobDetail: def delete(job_id): """删除任务""" <|body_0|> def get(job_id): """获取任务""" <|body_1|> def put(job_id): """修改任务""" <|body_2|> <|end_skeleton|> <|body_start_0|> params = Response(job_id=job_id) log.info('删除任务[params:...
stack_v2_sparse_classes_36k_train_032935
6,246
no_license
[ { "docstring": "删除任务", "name": "delete", "signature": "def delete(job_id)" }, { "docstring": "获取任务", "name": "get", "signature": "def get(job_id)" }, { "docstring": "修改任务", "name": "put", "signature": "def put(job_id)" } ]
3
stack_v2_sparse_classes_30k_test_000275
Implement the Python class `JobDetail` described below. Class description: Implement the JobDetail class. Method signatures and docstrings: - def delete(job_id): 删除任务 - def get(job_id): 获取任务 - def put(job_id): 修改任务
Implement the Python class `JobDetail` described below. Class description: Implement the JobDetail class. Method signatures and docstrings: - def delete(job_id): 删除任务 - def get(job_id): 获取任务 - def put(job_id): 修改任务 <|skeleton|> class JobDetail: def delete(job_id): """删除任务""" <|body_0|> def ...
0374684612a13af1e4d41dcd97ba8c80ecd89710
<|skeleton|> class JobDetail: def delete(job_id): """删除任务""" <|body_0|> def get(job_id): """获取任务""" <|body_1|> def put(job_id): """修改任务""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JobDetail: def delete(job_id): """删除任务""" params = Response(job_id=job_id) log.info('删除任务[params: %s]' % str(params)) return params def get(job_id): """获取任务""" params = Response(job_id=job_id) log.info('获取任务[params: %s]' % str(params)) retur...
the_stack_v2_python_sparse
resources/job.py
ChanningWong/HCNDC-web
train
0
e1880ad05e6eb8e04a90d77deebb111cd5ce871c
[ "self.also_found_at = {source_name: url_values.get('clickthrough-url') for source_name, url_values in listing.get('also_found_at', {}).iteritems()}\nself.apply_url = listing.get('apply_url')\nself.city = listing.get('city')\nself.company_key = listing.get('company_key')\nself.distance_from_search_location = listing...
<|body_start_0|> self.also_found_at = {source_name: url_values.get('clickthrough-url') for source_name, url_values in listing.get('also_found_at', {}).iteritems()} self.apply_url = listing.get('apply_url') self.city = listing.get('city') self.company_key = listing.get('company_key') ...
Inner class MoreTools object to store more tools information.
MoreTools
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MoreTools: """Inner class MoreTools object to store more tools information.""" def __init__(self, listing, bridge_search_query): """Initialize MoreTools object.""" <|body_0|> def _convert_key_dashes_to_underscores(self, orig_dict=None): """Return a copy of passed...
stack_v2_sparse_classes_36k_train_032936
5,331
no_license
[ { "docstring": "Initialize MoreTools object.", "name": "__init__", "signature": "def __init__(self, listing, bridge_search_query)" }, { "docstring": "Return a copy of passed-in dictionary with all dashes in keys converted to underscores.", "name": "_convert_key_dashes_to_underscores", "s...
3
stack_v2_sparse_classes_30k_train_020569
Implement the Python class `MoreTools` described below. Class description: Inner class MoreTools object to store more tools information. Method signatures and docstrings: - def __init__(self, listing, bridge_search_query): Initialize MoreTools object. - def _convert_key_dashes_to_underscores(self, orig_dict=None): Re...
Implement the Python class `MoreTools` described below. Class description: Inner class MoreTools object to store more tools information. Method signatures and docstrings: - def __init__(self, listing, bridge_search_query): Initialize MoreTools object. - def _convert_key_dashes_to_underscores(self, orig_dict=None): Re...
da3073eec6d676dfe0164502b80d2a1c75e89575
<|skeleton|> class MoreTools: """Inner class MoreTools object to store more tools information.""" def __init__(self, listing, bridge_search_query): """Initialize MoreTools object.""" <|body_0|> def _convert_key_dashes_to_underscores(self, orig_dict=None): """Return a copy of passed...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MoreTools: """Inner class MoreTools object to store more tools information.""" def __init__(self, listing, bridge_search_query): """Initialize MoreTools object.""" self.also_found_at = {source_name: url_values.get('clickthrough-url') for source_name, url_values in listing.get('also_found_...
the_stack_v2_python_sparse
web-serpng/code/serpng/jobs/services/search/job.py
alyago/django-web
train
0
d1cf2693d6534155191cf92b85d6544d2c307cd2
[ "data = np.array([[1, 2, 3], [2, 4, 6], [5, 10, 15]])\nself.diff_in_y_array = np.array([[1, 2, 3], [3, 6, 9]])\nself.cube = set_up_variable_cube(data, 'wind_speed', 'm s-1', 'equalarea')\nself.plugin = DifferenceBetweenAdjacentGridSquares()", "points = self.cube.coord(axis='y').points\nexpected_y = (points[1:] + ...
<|body_start_0|> data = np.array([[1, 2, 3], [2, 4, 6], [5, 10, 15]]) self.diff_in_y_array = np.array([[1, 2, 3], [3, 6, 9]]) self.cube = set_up_variable_cube(data, 'wind_speed', 'm s-1', 'equalarea') self.plugin = DifferenceBetweenAdjacentGridSquares() <|end_body_0|> <|body_start_1|> ...
Test the create_difference_cube method.
Test_create_difference_cube
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_create_difference_cube: """Test the create_difference_cube method.""" def setUp(self): """Set up cube.""" <|body_0|> def test_y_dimension(self): """Test differences calculated along the y dimension.""" <|body_1|> def test_x_dimension(self): ...
stack_v2_sparse_classes_36k_train_032937
8,701
permissive
[ { "docstring": "Set up cube.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test differences calculated along the y dimension.", "name": "test_y_dimension", "signature": "def test_y_dimension(self)" }, { "docstring": "Test differences calculated along the x ...
4
null
Implement the Python class `Test_create_difference_cube` described below. Class description: Test the create_difference_cube method. Method signatures and docstrings: - def setUp(self): Set up cube. - def test_y_dimension(self): Test differences calculated along the y dimension. - def test_x_dimension(self): Test dif...
Implement the Python class `Test_create_difference_cube` described below. Class description: Test the create_difference_cube method. Method signatures and docstrings: - def setUp(self): Set up cube. - def test_y_dimension(self): Test differences calculated along the y dimension. - def test_x_dimension(self): Test dif...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test_create_difference_cube: """Test the create_difference_cube method.""" def setUp(self): """Set up cube.""" <|body_0|> def test_y_dimension(self): """Test differences calculated along the y dimension.""" <|body_1|> def test_x_dimension(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test_create_difference_cube: """Test the create_difference_cube method.""" def setUp(self): """Set up cube.""" data = np.array([[1, 2, 3], [2, 4, 6], [5, 10, 15]]) self.diff_in_y_array = np.array([[1, 2, 3], [3, 6, 9]]) self.cube = set_up_variable_cube(data, 'wind_speed', ...
the_stack_v2_python_sparse
improver_tests/utilities/test_DifferenceBetweenAdjacentGridSquares.py
metoppv/improver
train
101
9ed3c9b3df737c1e17fe1e02aa4f564f81562f9c
[ "self.arr = []\nself.size = maxSize\nself.offset = []", "if len(self.arr) == self.size:\n return\nself.arr.append(x)\nself.offset.append(0)", "if not self.arr:\n return -1\nif len(self.offset) > 1:\n self.offset[-2] += self.offset[-1]\nreturn self.arr.pop() + self.offset.pop()", "if not self.arr:\n ...
<|body_start_0|> self.arr = [] self.size = maxSize self.offset = [] <|end_body_0|> <|body_start_1|> if len(self.arr) == self.size: return self.arr.append(x) self.offset.append(0) <|end_body_1|> <|body_start_2|> if not self.arr: return -1 ...
CustomStack
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomStack: def __init__(self, maxSize): """:type maxSize: int""" <|body_0|> def push(self, x): """:type x: int :rtype: None""" <|body_1|> def pop(self): """:rtype: int""" <|body_2|> def increment(self, k, val): """:type k: ...
stack_v2_sparse_classes_36k_train_032938
954
no_license
[ { "docstring": ":type maxSize: int", "name": "__init__", "signature": "def __init__(self, maxSize)" }, { "docstring": ":type x: int :rtype: None", "name": "push", "signature": "def push(self, x)" }, { "docstring": ":rtype: int", "name": "pop", "signature": "def pop(self)"...
4
stack_v2_sparse_classes_30k_train_011697
Implement the Python class `CustomStack` described below. Class description: Implement the CustomStack class. Method signatures and docstrings: - def __init__(self, maxSize): :type maxSize: int - def push(self, x): :type x: int :rtype: None - def pop(self): :rtype: int - def increment(self, k, val): :type k: int :typ...
Implement the Python class `CustomStack` described below. Class description: Implement the CustomStack class. Method signatures and docstrings: - def __init__(self, maxSize): :type maxSize: int - def push(self, x): :type x: int :rtype: None - def pop(self): :rtype: int - def increment(self, k, val): :type k: int :typ...
238995bd23c8a6c40c6035890e94baa2473d4bbc
<|skeleton|> class CustomStack: def __init__(self, maxSize): """:type maxSize: int""" <|body_0|> def push(self, x): """:type x: int :rtype: None""" <|body_1|> def pop(self): """:rtype: int""" <|body_2|> def increment(self, k, val): """:type k: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CustomStack: def __init__(self, maxSize): """:type maxSize: int""" self.arr = [] self.size = maxSize self.offset = [] def push(self, x): """:type x: int :rtype: None""" if len(self.arr) == self.size: return self.arr.append(x) sel...
the_stack_v2_python_sparse
problems/N1381_Design_A_Stack_With_Increment_Operation.py
wan-catherine/Leetcode
train
5
d1565af10a938cb36ddf7b6ec5b43224700f01f2
[ "if isinstance(reference, pd.DataFrame):\n reference = reference.values\nself.reference = reference\nself.scalers = {}", "if not (log, scale) in self.scalers.keys():\n scaler = None\n ref = self.reference.copy()\n if log:\n ref = np.log2(ref + 1)\n if scale == 'minmax':\n scaler = pp....
<|body_start_0|> if isinstance(reference, pd.DataFrame): reference = reference.values self.reference = reference self.scalers = {} <|end_body_0|> <|body_start_1|> if not (log, scale) in self.scalers.keys(): scaler = None ref = self.reference.copy() ...
CustomScaler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomScaler: def __init__(self, reference): """:param reference:""" <|body_0|> def transform(self, data, log, scale: str): """:param data: :param log: log2(data+1) :param scale: 'minmax','m0s1','divide_mean' :return:""" <|body_1|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_36k_train_032939
45,930
no_license
[ { "docstring": ":param reference:", "name": "__init__", "signature": "def __init__(self, reference)" }, { "docstring": ":param data: :param log: log2(data+1) :param scale: 'minmax','m0s1','divide_mean' :return:", "name": "transform", "signature": "def transform(self, data, log, scale: st...
2
stack_v2_sparse_classes_30k_train_004982
Implement the Python class `CustomScaler` described below. Class description: Implement the CustomScaler class. Method signatures and docstrings: - def __init__(self, reference): :param reference: - def transform(self, data, log, scale: str): :param data: :param log: log2(data+1) :param scale: 'minmax','m0s1','divide...
Implement the Python class `CustomScaler` described below. Class description: Implement the CustomScaler class. Method signatures and docstrings: - def __init__(self, reference): :param reference: - def transform(self, data, log, scale: str): :param data: :param log: log2(data+1) :param scale: 'minmax','m0s1','divide...
6d11df5e8ca37e53e048d261ac287f859ba6e9b9
<|skeleton|> class CustomScaler: def __init__(self, reference): """:param reference:""" <|body_0|> def transform(self, data, log, scale: str): """:param data: :param log: log2(data+1) :param scale: 'minmax','m0s1','divide_mean' :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CustomScaler: def __init__(self, reference): """:param reference:""" if isinstance(reference, pd.DataFrame): reference = reference.values self.reference = reference self.scalers = {} def transform(self, data, log, scale: str): """:param data: :param log...
the_stack_v2_python_sparse
stages_DE/stages_library.py
biolab/baylor-dicty
train
0
52c56be8c0934026a4f5c5321120e5fe513a8936
[ "self.outvar = outvar\nself.invar = invar\nself.binvar = binvar\nself.binscale = binscale\nself.mask = mask\nself.scale = scale\nself.bias = bias\nself.sense = sense", "biases = np.reshape(self.bias[index, ...], [-1])\nslopes = np.reshape(self.scale[index, ...], [-1])\nbinslopes = np.reshape(self.binscale[index, ...
<|body_start_0|> self.outvar = outvar self.invar = invar self.binvar = binvar self.binscale = binscale self.mask = mask self.scale = scale self.bias = bias self.sense = sense <|end_body_0|> <|body_start_1|> biases = np.reshape(self.bias[index, ......
MIP constraint to encode activation.
MIPActivationConstraint
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MIPActivationConstraint: """MIP constraint to encode activation.""" def __init__(self, outvar, invar, binvar, mask, binscale, scale, bias, sense): """Represents: outvar =(>)(<) scale * invar + binscale * binvar + bias.""" <|body_0|> def encode_into_solver(self, solver: '...
stack_v2_sparse_classes_36k_train_032940
26,545
permissive
[ { "docstring": "Represents: outvar =(>)(<) scale * invar + binscale * binvar + bias.", "name": "__init__", "signature": "def __init__(self, outvar, invar, binvar, mask, binscale, scale, bias, sense)" }, { "docstring": "Encode the linear constraints into the provided solver. Args: solver: MIPSolv...
2
stack_v2_sparse_classes_30k_val_000723
Implement the Python class `MIPActivationConstraint` described below. Class description: MIP constraint to encode activation. Method signatures and docstrings: - def __init__(self, outvar, invar, binvar, mask, binscale, scale, bias, sense): Represents: outvar =(>)(<) scale * invar + binscale * binvar + bias. - def en...
Implement the Python class `MIPActivationConstraint` described below. Class description: MIP constraint to encode activation. Method signatures and docstrings: - def __init__(self, outvar, invar, binvar, mask, binscale, scale, bias, sense): Represents: outvar =(>)(<) scale * invar + binscale * binvar + bias. - def en...
96e4abb160f5022af4bf1aa8bb854822eb45a59b
<|skeleton|> class MIPActivationConstraint: """MIP constraint to encode activation.""" def __init__(self, outvar, invar, binvar, mask, binscale, scale, bias, sense): """Represents: outvar =(>)(<) scale * invar + binscale * binvar + bias.""" <|body_0|> def encode_into_solver(self, solver: '...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MIPActivationConstraint: """MIP constraint to encode activation.""" def __init__(self, outvar, invar, binvar, mask, binscale, scale, bias, sense): """Represents: outvar =(>)(<) scale * invar + binscale * binvar + bias.""" self.outvar = outvar self.invar = invar self.binvar...
the_stack_v2_python_sparse
jax_verify/src/mip_solver/relaxation.py
harmonicm/jax_verify
train
0
109a7f4b043dc9bb993cd3ba83c004b66adc1b9c
[ "plugin = NeighbourSelection()\nresult = str(plugin)\nmsg = \"<NeighbourSelection: land_constraint: False, minimum_dz: False, search_radius: 10000.0, site_coordinate_system: <class 'cartopy.crs.PlateCarree'>, site_x_coordinate:longitude, site_y_coordinate: latitude, node_limit: 36>\"\nself.assertEqual(result, msg)"...
<|body_start_0|> plugin = NeighbourSelection() result = str(plugin) msg = "<NeighbourSelection: land_constraint: False, minimum_dz: False, search_radius: 10000.0, site_coordinate_system: <class 'cartopy.crs.PlateCarree'>, site_x_coordinate:longitude, site_y_coordinate: latitude, node_limit: 36>"...
Tests the class __repr__ function.
Test__repr__
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test__repr__: """Tests the class __repr__ function.""" def test_basic(self): """Test that the __repr__ returns the expected string with defaults.""" <|body_0|> def test_non_default(self): """Test that the __repr__ returns the expected string with defaults.""" ...
stack_v2_sparse_classes_36k_train_032941
40,371
permissive
[ { "docstring": "Test that the __repr__ returns the expected string with defaults.", "name": "test_basic", "signature": "def test_basic(self)" }, { "docstring": "Test that the __repr__ returns the expected string with defaults.", "name": "test_non_default", "signature": "def test_non_defa...
2
null
Implement the Python class `Test__repr__` described below. Class description: Tests the class __repr__ function. Method signatures and docstrings: - def test_basic(self): Test that the __repr__ returns the expected string with defaults. - def test_non_default(self): Test that the __repr__ returns the expected string ...
Implement the Python class `Test__repr__` described below. Class description: Tests the class __repr__ function. Method signatures and docstrings: - def test_basic(self): Test that the __repr__ returns the expected string with defaults. - def test_non_default(self): Test that the __repr__ returns the expected string ...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test__repr__: """Tests the class __repr__ function.""" def test_basic(self): """Test that the __repr__ returns the expected string with defaults.""" <|body_0|> def test_non_default(self): """Test that the __repr__ returns the expected string with defaults.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test__repr__: """Tests the class __repr__ function.""" def test_basic(self): """Test that the __repr__ returns the expected string with defaults.""" plugin = NeighbourSelection() result = str(plugin) msg = "<NeighbourSelection: land_constraint: False, minimum_dz: False, se...
the_stack_v2_python_sparse
improver_tests/spotdata/test_NeighbourSelection.py
metoppv/improver
train
101
b15fc00fca98dc8e6cd574dd22bd024021e6d4f6
[ "data = base_importData()\ndata.read_csv(filename)\ndata.format_data()\nself.add_data_stage02_isotopomer_measuredFluxes(data.data)\ndata.clear_data()", "data = base_importData()\ndata.read_csv(filename)\ndata.format_data()\nself.add_data_stage02_isotopomer_measuredFragments(data.data)\ndata.clear_data()", "data...
<|body_start_0|> data = base_importData() data.read_csv(filename) data.format_data() self.add_data_stage02_isotopomer_measuredFluxes(data.data) data.clear_data() <|end_body_0|> <|body_start_1|> data = base_importData() data.read_csv(filename) data.format_...
stage02_isotopomer_measuredData_io
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class stage02_isotopomer_measuredData_io: def import_data_stage02_isotopomer_measuredFluxes_add(self, filename): """table adds""" <|body_0|> def import_data_stage02_isotopomer_measuredFragments_add(self, filename): """table adds""" <|body_1|> def export_data_s...
stack_v2_sparse_classes_36k_train_032942
3,229
permissive
[ { "docstring": "table adds", "name": "import_data_stage02_isotopomer_measuredFluxes_add", "signature": "def import_data_stage02_isotopomer_measuredFluxes_add(self, filename)" }, { "docstring": "table adds", "name": "import_data_stage02_isotopomer_measuredFragments_add", "signature": "def...
4
stack_v2_sparse_classes_30k_train_006095
Implement the Python class `stage02_isotopomer_measuredData_io` described below. Class description: Implement the stage02_isotopomer_measuredData_io class. Method signatures and docstrings: - def import_data_stage02_isotopomer_measuredFluxes_add(self, filename): table adds - def import_data_stage02_isotopomer_measure...
Implement the Python class `stage02_isotopomer_measuredData_io` described below. Class description: Implement the stage02_isotopomer_measuredData_io class. Method signatures and docstrings: - def import_data_stage02_isotopomer_measuredFluxes_add(self, filename): table adds - def import_data_stage02_isotopomer_measure...
005e1d34c2ace7e28c53dffcab3e9cb8c7e7ce18
<|skeleton|> class stage02_isotopomer_measuredData_io: def import_data_stage02_isotopomer_measuredFluxes_add(self, filename): """table adds""" <|body_0|> def import_data_stage02_isotopomer_measuredFragments_add(self, filename): """table adds""" <|body_1|> def export_data_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class stage02_isotopomer_measuredData_io: def import_data_stage02_isotopomer_measuredFluxes_add(self, filename): """table adds""" data = base_importData() data.read_csv(filename) data.format_data() self.add_data_stage02_isotopomer_measuredFluxes(data.data) data.clear_...
the_stack_v2_python_sparse
SBaaS_MFA/stage02_isotopomer_measuredData_io.py
dmccloskey/SBaaS_MFA
train
0
981287fb679a01c68bd55345c85b4383efa1ec18
[ "fileName = '10Lines'\nexpectedResult = [12.0, 13.5, 1.0, 5.5, 9.0, 19.5, 12.0, 23.5, 5.0, 51.0]\nactuatlResponse = PSPQuickSortInput.getArray(fileName)\nself.assertTrue(expectedResult, actuatlResponse)", "fileName = '10Lines1'\nactuatlResponse = PSPQuickSortInput.getArray(fileName)\nself.assertTrue(actuatlRespon...
<|body_start_0|> fileName = '10Lines' expectedResult = [12.0, 13.5, 1.0, 5.5, 9.0, 19.5, 12.0, 23.5, 5.0, 51.0] actuatlResponse = PSPQuickSortInput.getArray(fileName) self.assertTrue(expectedResult, actuatlResponse) <|end_body_0|> <|body_start_1|> fileName = '10Lines1' a...
TestStringMethods
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestStringMethods: def test_getArray_success_with_valid_values(self): """This is testing for normal files""" <|body_0|> def test_getArray_error_with_not_existing_file(self): """This is test for Non Existing file""" <|body_1|> def test_getArray_error_with...
stack_v2_sparse_classes_36k_train_032943
2,577
no_license
[ { "docstring": "This is testing for normal files", "name": "test_getArray_success_with_valid_values", "signature": "def test_getArray_success_with_valid_values(self)" }, { "docstring": "This is test for Non Existing file", "name": "test_getArray_error_with_not_existing_file", "signature"...
6
stack_v2_sparse_classes_30k_train_018827
Implement the Python class `TestStringMethods` described below. Class description: Implement the TestStringMethods class. Method signatures and docstrings: - def test_getArray_success_with_valid_values(self): This is testing for normal files - def test_getArray_error_with_not_existing_file(self): This is test for Non...
Implement the Python class `TestStringMethods` described below. Class description: Implement the TestStringMethods class. Method signatures and docstrings: - def test_getArray_success_with_valid_values(self): This is testing for normal files - def test_getArray_error_with_not_existing_file(self): This is test for Non...
72181672d800ec59bac06978cab08a59e734933e
<|skeleton|> class TestStringMethods: def test_getArray_success_with_valid_values(self): """This is testing for normal files""" <|body_0|> def test_getArray_error_with_not_existing_file(self): """This is test for Non Existing file""" <|body_1|> def test_getArray_error_with...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestStringMethods: def test_getArray_success_with_valid_values(self): """This is testing for normal files""" fileName = '10Lines' expectedResult = [12.0, 13.5, 1.0, 5.5, 9.0, 19.5, 12.0, 23.5, 5.0, 51.0] actuatlResponse = PSPQuickSortInput.getArray(fileName) self.assert...
the_stack_v2_python_sparse
02_PSP/PSP/unitest.py
yemarn510/YM_Python
train
0
b90c0642a014e376fe2a0c5d7eaafd3fcce135a1
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('cwsonn_levyjr', 'cwsonn_levyjr')\nCbikepath = repo['cwsonn_levyjr.Cbikepath'].find()\nbikePathCoords = []\nlenlst = []\nfor c in Cbikepath:\n pathCoords = c['geometry']['coordinates']\n len = c['pr...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('cwsonn_levyjr', 'cwsonn_levyjr') Cbikepath = repo['cwsonn_levyjr.Cbikepath'].find() bikePathCoords = [] lenlst = [] for c in Cbike...
bikeComparisonCam
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class bikeComparisonCam: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everyt...
stack_v2_sparse_classes_36k_train_032944
4,548
no_license
[ { "docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).", "name": "execute", "signature": "def execute(trial=False)" }, { "docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d...
2
stack_v2_sparse_classes_30k_train_016269
Implement the Python class `bikeComparisonCam` described below. Class description: Implement the bikeComparisonCam class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime...
Implement the Python class `bikeComparisonCam` described below. Class description: Implement the bikeComparisonCam class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime...
b5ccaad97f6e35f9580e645ca764f36eb3406f43
<|skeleton|> class bikeComparisonCam: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everyt...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class bikeComparisonCam: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('cwsonn_levyjr', 'cwsonn_levyjr') ...
the_stack_v2_python_sparse
cwsonn_levyjr/bikeComparisonCam.py
dwang1995/course-2018-spr-proj
train
1
4854b02d5ef6582486b3c8e7eb8a1042a98f49c1
[ "self._engine = create_engine('sqlite:///a.db', echo=False)\nBase.metadata.drop_all(self._engine)\nBase.metadata.create_all(self._engine)\nself.__session = None", "if self.__session is None:\n DBSession = sessionmaker(bind=self._engine)\n self.__session = DBSession()\nreturn self.__session", "user = User(...
<|body_start_0|> self._engine = create_engine('sqlite:///a.db', echo=False) Base.metadata.drop_all(self._engine) Base.metadata.create_all(self._engine) self.__session = None <|end_body_0|> <|body_start_1|> if self.__session is None: DBSession = sessionmaker(bind=self...
Database class
DB
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DB: """Database class""" def __init__(self): """Initializes class attributes""" <|body_0|> def _session(self): """Private method that returns a session""" <|body_1|> def add_user(self, email: str, hashed_password: str) -> User: """Save new th...
stack_v2_sparse_classes_36k_train_032945
2,320
no_license
[ { "docstring": "Initializes class attributes", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Private method that returns a session", "name": "_session", "signature": "def _session(self)" }, { "docstring": "Save new the user to the database", "name":...
5
stack_v2_sparse_classes_30k_train_017258
Implement the Python class `DB` described below. Class description: Database class Method signatures and docstrings: - def __init__(self): Initializes class attributes - def _session(self): Private method that returns a session - def add_user(self, email: str, hashed_password: str) -> User: Save new the user to the d...
Implement the Python class `DB` described below. Class description: Database class Method signatures and docstrings: - def __init__(self): Initializes class attributes - def _session(self): Private method that returns a session - def add_user(self, email: str, hashed_password: str) -> User: Save new the user to the d...
151c5c063b15c8474c1fa4ab5ce27f94f36c42b5
<|skeleton|> class DB: """Database class""" def __init__(self): """Initializes class attributes""" <|body_0|> def _session(self): """Private method that returns a session""" <|body_1|> def add_user(self, email: str, hashed_password: str) -> User: """Save new th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DB: """Database class""" def __init__(self): """Initializes class attributes""" self._engine = create_engine('sqlite:///a.db', echo=False) Base.metadata.drop_all(self._engine) Base.metadata.create_all(self._engine) self.__session = None def _session(self): ...
the_stack_v2_python_sparse
0x08-user_authentication_service/db.py
Gzoref/holbertonschool-web_back_end
train
0
ba41479e5b95d63fd5f72590ed9929bcf26ac00c
[ "diff = defaultdict(int)\nfor left, right in flowers:\n diff[left] += 1\n diff[right + 1] -= 1\nkeys = sorted(diff)\ndiff = list(accumulate((diff[key] for key in keys), initial=0))\nreturn [diff[bisect_right(keys, p)] for p in persons]", "D = Discretizer()\nfor left, right in flowers:\n D.add(left)\n ...
<|body_start_0|> diff = defaultdict(int) for left, right in flowers: diff[left] += 1 diff[right + 1] -= 1 keys = sorted(diff) diff = list(accumulate((diff[key] for key in keys), initial=0)) return [diff[bisect_right(keys, p)] for p in persons] <|end_body_0...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def fullBloomFlowers(self, flowers: List[List[int]], persons: List[int]) -> List[int]: """单点查询时:只对flowers离散化,开字典+二分查找query值被映射成啥""" <|body_0|> def fullBloomFlowers2(self, flowers: List[List[int]], persons: List[int]) -> List[int]: """单点查询时:如果同时也把person添加到离散...
stack_v2_sparse_classes_36k_train_032946
1,793
no_license
[ { "docstring": "单点查询时:只对flowers离散化,开字典+二分查找query值被映射成啥", "name": "fullBloomFlowers", "signature": "def fullBloomFlowers(self, flowers: List[List[int]], persons: List[int]) -> List[int]" }, { "docstring": "单点查询时:如果同时也把person添加到离散化,就不用二分查找了/不用开字典了", "name": "fullBloomFlowers2", "signature"...
2
stack_v2_sparse_classes_30k_train_000637
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fullBloomFlowers(self, flowers: List[List[int]], persons: List[int]) -> List[int]: 单点查询时:只对flowers离散化,开字典+二分查找query值被映射成啥 - def fullBloomFlowers2(self, flowers: List[List[int...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fullBloomFlowers(self, flowers: List[List[int]], persons: List[int]) -> List[int]: 单点查询时:只对flowers离散化,开字典+二分查找query值被映射成啥 - def fullBloomFlowers2(self, flowers: List[List[int...
7e79e26bb8f641868561b186e34c1127ed63c9e0
<|skeleton|> class Solution: def fullBloomFlowers(self, flowers: List[List[int]], persons: List[int]) -> List[int]: """单点查询时:只对flowers离散化,开字典+二分查找query值被映射成啥""" <|body_0|> def fullBloomFlowers2(self, flowers: List[List[int]], persons: List[int]) -> List[int]: """单点查询时:如果同时也把person添加到离散...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def fullBloomFlowers(self, flowers: List[List[int]], persons: List[int]) -> List[int]: """单点查询时:只对flowers离散化,开字典+二分查找query值被映射成啥""" diff = defaultdict(int) for left, right in flowers: diff[left] += 1 diff[right + 1] -= 1 keys = sorted(diff) ...
the_stack_v2_python_sparse
22_专题/前缀与差分/差分数组/离散化/6044. 花期内花的数目-单点查询-差分+离散化.py
981377660LMT/algorithm-study
train
225
ba6382be0f078c5c95a398b1dc56cd64efeb2b58
[ "if type(submittedValue) is DateTime:\n return []\nerrors = []\nsubmittedValue = submittedValue.strip()\ntry:\n if len(submittedValue) == 10:\n StringToDate(submittedValue, '%Y-%m-%d')\n elif submittedValue[-2:] in ['AM', 'PM']:\n StringToDate(submittedValue, '%Y-%m-%d %I:%M %p')\n else:\n...
<|body_start_0|> if type(submittedValue) is DateTime: return [] errors = [] submittedValue = submittedValue.strip() try: if len(submittedValue) == 10: StringToDate(submittedValue, '%Y-%m-%d') elif submittedValue[-2:] in ['AM', 'PM']: ...
Date time field
DatetimeField
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DatetimeField: """Date time field""" def validate(self, submittedValue): """Validate date time value""" <|body_0|> def processInput(self, submittedValue): """Process date time value input""" <|body_1|> def getFieldValue(self, form, doc=None, editmode...
stack_v2_sparse_classes_36k_train_032947
5,816
no_license
[ { "docstring": "Validate date time value", "name": "validate", "signature": "def validate(self, submittedValue)" }, { "docstring": "Process date time value input", "name": "processInput", "signature": "def processInput(self, submittedValue)" }, { "docstring": "Get date time field...
4
stack_v2_sparse_classes_30k_test_000246
Implement the Python class `DatetimeField` described below. Class description: Date time field Method signatures and docstrings: - def validate(self, submittedValue): Validate date time value - def processInput(self, submittedValue): Process date time value input - def getFieldValue(self, form, doc=None, editmode_obs...
Implement the Python class `DatetimeField` described below. Class description: Date time field Method signatures and docstrings: - def validate(self, submittedValue): Validate date time value - def processInput(self, submittedValue): Process date time value input - def getFieldValue(self, form, doc=None, editmode_obs...
6423d9cc1c97d578f09af35805da6a949115a153
<|skeleton|> class DatetimeField: """Date time field""" def validate(self, submittedValue): """Validate date time value""" <|body_0|> def processInput(self, submittedValue): """Process date time value input""" <|body_1|> def getFieldValue(self, form, doc=None, editmode...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DatetimeField: """Date time field""" def validate(self, submittedValue): """Validate date time value""" if type(submittedValue) is DateTime: return [] errors = [] submittedValue = submittedValue.strip() try: if len(submittedValue) == 10: ...
the_stack_v2_python_sparse
src/Products/CMFPlomino/fields/datetime.py
Covantec/Plomino
train
0
964964a23a07ff5cdfd58fc23863081689afaab5
[ "total = sum(nums)\nlength = 2 * total + 1\noffset = total\ndp = [False] * length\ndp[offset] = True\nfor n in nums:\n temp = [False] * length\n for i in range(n, length - n):\n if dp[i]:\n temp[i - n] = True\n temp[i + n] = True\n dp = temp\nreturn dp[offset]", "total = sum(...
<|body_start_0|> total = sum(nums) length = 2 * total + 1 offset = total dp = [False] * length dp[offset] = True for n in nums: temp = [False] * length for i in range(n, length - n): if dp[i]: temp[i - n] = True ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canPartition(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def canPartition1(self, nums): """:type nums: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> total = sum(nums) length = 2 * t...
stack_v2_sparse_classes_36k_train_032948
1,600
no_license
[ { "docstring": ":type nums: List[int] :rtype: bool", "name": "canPartition", "signature": "def canPartition(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: bool", "name": "canPartition1", "signature": "def canPartition1(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canPartition(self, nums): :type nums: List[int] :rtype: bool - def canPartition1(self, nums): :type nums: List[int] :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canPartition(self, nums): :type nums: List[int] :rtype: bool - def canPartition1(self, nums): :type nums: List[int] :rtype: bool <|skeleton|> class Solution: def canPar...
857b8c7fccfe8216da59228c1cf3675444855673
<|skeleton|> class Solution: def canPartition(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def canPartition1(self, nums): """:type nums: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def canPartition(self, nums): """:type nums: List[int] :rtype: bool""" total = sum(nums) length = 2 * total + 1 offset = total dp = [False] * length dp[offset] = True for n in nums: temp = [False] * length for i in range...
the_stack_v2_python_sparse
algorithm/Partition-Equal-Subset-Sum.py
atashi/LLL
train
0
59b7ed8442af60c91213b2cc65e3be37dcd03031
[ "if len(matrix) == 0 or len(matrix[0]) == 0:\n return\nlength = len(matrix)\nwidth = len(matrix[0])\nself.cache = [[0] * (width + 1) for i in range(length)]\nfor i in range(length):\n for j in range(width):\n self.cache[i][j + 1] = self.cache[i][j] + matrix[i][j]", "res = 0\nfor i in range(row1, row2...
<|body_start_0|> if len(matrix) == 0 or len(matrix[0]) == 0: return length = len(matrix) width = len(matrix[0]) self.cache = [[0] * (width + 1) for i in range(length)] for i in range(length): for j in range(width): self.cache[i][j + 1] = se...
NumMatrix
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """:type row1: int :type col1: int :type row2: int :type col2: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_36k_train_032949
929
no_license
[ { "docstring": ":type matrix: List[List[int]]", "name": "__init__", "signature": "def __init__(self, matrix)" }, { "docstring": ":type row1: int :type col1: int :type row2: int :type col2: int :rtype: int", "name": "sumRegion", "signature": "def sumRegion(self, row1, col1, row2, col2)" ...
2
stack_v2_sparse_classes_30k_train_020691
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:...
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:...
48196dedf60076bbc3769e067f1ecbaa36ca0b5f
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """:type row1: int :type col1: int :type row2: int :type col2: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" if len(matrix) == 0 or len(matrix[0]) == 0: return length = len(matrix) width = len(matrix[0]) self.cache = [[0] * (width + 1) for i in range(length)] for i in range(length): ...
the_stack_v2_python_sparse
Range Sum Query 2D - Immutable.py
xukaiyuan/leetcode-medium
train
0
9c92976cc44735c8181fda6b49d999cfe9630247
[ "if server_ip == '' and server_port != 0 or (server_ip != '' and server_port == 0):\n raise Exception('server_ip和server_port必须同时指定')\nself._server_ip = server_ip\nself._server_port = server_port\nself._service_name = service_name\nself._host = host", "headers = {'org': org, 'user': user}\nroute_name = ''\nserv...
<|body_start_0|> if server_ip == '' and server_port != 0 or (server_ip != '' and server_port == 0): raise Exception('server_ip和server_port必须同时指定') self._server_ip = server_ip self._server_port = server_port self._service_name = service_name self._host = host <|end_bod...
ExecuteClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExecuteClient: def __init__(self, server_ip='', server_port=0, service_name='', host=''): """初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server_ip和servi...
stack_v2_sparse_classes_36k_train_032950
6,070
permissive
[ { "docstring": "初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server_ip和service_name同时设置,server_ip优先级更高 :param host: 指定sdk请求服务的host名称, 如cmdb.easyops-only.com", "name": "__ini...
4
stack_v2_sparse_classes_30k_train_015068
Implement the Python class `ExecuteClient` described below. Class description: Implement the ExecuteClient class. Method signatures and docstrings: - def __init__(self, server_ip='', server_port=0, service_name='', host=''): 初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_p...
Implement the Python class `ExecuteClient` described below. Class description: Implement the ExecuteClient class. Method signatures and docstrings: - def __init__(self, server_ip='', server_port=0, service_name='', host=''): 初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_p...
adf6e3bad33fa6266b5fa0a449dd4ac42f8447d0
<|skeleton|> class ExecuteClient: def __init__(self, server_ip='', server_port=0, service_name='', host=''): """初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server_ip和servi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExecuteClient: def __init__(self, server_ip='', server_port=0, service_name='', host=''): """初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server_ip和service_name同时设置,se...
the_stack_v2_python_sparse
flow_sdk/api/execute/execute_client.py
easyopsapis/easyops-api-python
train
5
482aa1e58c9def71be41f1509f56a9b658a3c770
[ "date_time_now = datetime.now()\nsession = db.session\ntry:\n notice = SmSysNotice(ID=cls.md5_generator('sm_sys_notice' + str(date_time_now)), Time=date_time_now, CreatorID=admin_user.ID, **para)\n session.add(notice)\n session.commit()\n cls.create_log(admin_user.ID, '公告', '创建公告', date_time_now, '管理员' ...
<|body_start_0|> date_time_now = datetime.now() session = db.session try: notice = SmSysNotice(ID=cls.md5_generator('sm_sys_notice' + str(date_time_now)), Time=date_time_now, CreatorID=admin_user.ID, **para) session.add(notice) session.commit() cls...
notice管理service
SmSysNoticeService
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SmSysNoticeService: """notice管理service""" def create_sys_notice(cls, admin_user, **para): """创建系统公告 :param admin_user: 管理员 :param para: 参数 :return: 返回结果 阐述 0 公告创建成功 1 参数错误""" <|body_0|> def query_all_notice(cls, user_type='admin', Page=None, PageSize=None): """查询...
stack_v2_sparse_classes_36k_train_032951
2,415
no_license
[ { "docstring": "创建系统公告 :param admin_user: 管理员 :param para: 参数 :return: 返回结果 阐述 0 公告创建成功 1 参数错误", "name": "create_sys_notice", "signature": "def create_sys_notice(cls, admin_user, **para)" }, { "docstring": "查询所有notice :param user_type: 用户类型 :param Page: 页数 :param PageSize: 每页数量 :return: 结果", ...
2
stack_v2_sparse_classes_30k_train_014442
Implement the Python class `SmSysNoticeService` described below. Class description: notice管理service Method signatures and docstrings: - def create_sys_notice(cls, admin_user, **para): 创建系统公告 :param admin_user: 管理员 :param para: 参数 :return: 返回结果 阐述 0 公告创建成功 1 参数错误 - def query_all_notice(cls, user_type='admin', Page=Non...
Implement the Python class `SmSysNoticeService` described below. Class description: notice管理service Method signatures and docstrings: - def create_sys_notice(cls, admin_user, **para): 创建系统公告 :param admin_user: 管理员 :param para: 参数 :return: 返回结果 阐述 0 公告创建成功 1 参数错误 - def query_all_notice(cls, user_type='admin', Page=Non...
c88e68debe28831617ddea1d34f39dd4ae05045d
<|skeleton|> class SmSysNoticeService: """notice管理service""" def create_sys_notice(cls, admin_user, **para): """创建系统公告 :param admin_user: 管理员 :param para: 参数 :return: 返回结果 阐述 0 公告创建成功 1 参数错误""" <|body_0|> def query_all_notice(cls, user_type='admin', Page=None, PageSize=None): """查询...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SmSysNoticeService: """notice管理service""" def create_sys_notice(cls, admin_user, **para): """创建系统公告 :param admin_user: 管理员 :param para: 参数 :return: 返回结果 阐述 0 公告创建成功 1 参数错误""" date_time_now = datetime.now() session = db.session try: notice = SmSysNotice(ID=cls.m...
the_stack_v2_python_sparse
application/service/sys_notice_service.py
Mario-szk/sm_system_server
train
0
fc0e9dc3991a4a11a26621ea824ebf1b047b67d3
[ "def count(s):\n ret = [0, 0]\n for c in s:\n ret[int(c)] += 1\n return ret\ncnt = [count(s) for s in strs]\n\n@lru_cache(None)\ndef _rec(i, m, n):\n if i >= len(strs):\n return 0\n ret = _rec(i + 1, m, n)\n a, b = cnt[i]\n if m >= a and n >= b:\n ret = max(ret, 1 + _rec(i ...
<|body_start_0|> def count(s): ret = [0, 0] for c in s: ret[int(c)] += 1 return ret cnt = [count(s) for s in strs] @lru_cache(None) def _rec(i, m, n): if i >= len(strs): return 0 ret = _rec(i + 1...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMaxForm(self, strs: List[str], m: int, n: int) -> int: """05/09/2020 17:55 Time complexity: O(k*m'*n') Space complexity: O(k*m'*n')""" <|body_0|> def findMaxForm(self, strs: List[str], m: int, n: int) -> int: """04/21/2021 01:20 Time complexity: O(k...
stack_v2_sparse_classes_36k_train_032952
4,254
no_license
[ { "docstring": "05/09/2020 17:55 Time complexity: O(k*m'*n') Space complexity: O(k*m'*n')", "name": "findMaxForm", "signature": "def findMaxForm(self, strs: List[str], m: int, n: int) -> int" }, { "docstring": "04/21/2021 01:20 Time complexity: O(k*m'*n' + klogk) Space complexity: O(k*m'*n')", ...
4
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMaxForm(self, strs: List[str], m: int, n: int) -> int: 05/09/2020 17:55 Time complexity: O(k*m'*n') Space complexity: O(k*m'*n') - def findMaxForm(self, strs: List[str], ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMaxForm(self, strs: List[str], m: int, n: int) -> int: 05/09/2020 17:55 Time complexity: O(k*m'*n') Space complexity: O(k*m'*n') - def findMaxForm(self, strs: List[str], ...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def findMaxForm(self, strs: List[str], m: int, n: int) -> int: """05/09/2020 17:55 Time complexity: O(k*m'*n') Space complexity: O(k*m'*n')""" <|body_0|> def findMaxForm(self, strs: List[str], m: int, n: int) -> int: """04/21/2021 01:20 Time complexity: O(k...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findMaxForm(self, strs: List[str], m: int, n: int) -> int: """05/09/2020 17:55 Time complexity: O(k*m'*n') Space complexity: O(k*m'*n')""" def count(s): ret = [0, 0] for c in s: ret[int(c)] += 1 return ret cnt = [count(s...
the_stack_v2_python_sparse
leetcode/solved/474_Ones_and_Zeroes/solution.py
sungminoh/algorithms
train
0
7219e6eda24c85b742be0a2092d97eceb8dde47a
[ "np.random.seed(56789)\nproto_dat_list = []\nproto_lab_list = []\nN, d = traindata.shape\nclasses = list(set(trainlabels))\nnum_classes = len(classes)\nfor K in K_list:\n data = np.zeros((K * num_classes, d))\n labels = np.zeros(K * num_classes, dtype=np.int64)\n for c in range(num_classes):\n clust...
<|body_start_0|> np.random.seed(56789) proto_dat_list = [] proto_lab_list = [] N, d = traindata.shape classes = list(set(trainlabels)) num_classes = len(classes) for K in K_list: data = np.zeros((K * num_classes, d)) labels = np.zeros(K * n...
Question3
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Question3: def generatePrototypes(self, traindata, trainlabels, K_list): """Generate prototypes from labeled data. You can use the KMeans function from the sklearn package. **For grading purposes only:** Do NOT change the random seed, otherwise we are not able to grade your code! Paramet...
stack_v2_sparse_classes_36k_train_032953
15,694
no_license
[ { "docstring": "Generate prototypes from labeled data. You can use the KMeans function from the sklearn package. **For grading purposes only:** Do NOT change the random seed, otherwise we are not able to grade your code! Parameters: 1. traindata (Nt, d) numpy ndarray. The features in the training set. 2. trainl...
2
null
Implement the Python class `Question3` described below. Class description: Implement the Question3 class. Method signatures and docstrings: - def generatePrototypes(self, traindata, trainlabels, K_list): Generate prototypes from labeled data. You can use the KMeans function from the sklearn package. **For grading pur...
Implement the Python class `Question3` described below. Class description: Implement the Question3 class. Method signatures and docstrings: - def generatePrototypes(self, traindata, trainlabels, K_list): Generate prototypes from labeled data. You can use the KMeans function from the sklearn package. **For grading pur...
adcb6b47164a909fe8b3cd3969c8bc3f3696893a
<|skeleton|> class Question3: def generatePrototypes(self, traindata, trainlabels, K_list): """Generate prototypes from labeled data. You can use the KMeans function from the sklearn package. **For grading purposes only:** Do NOT change the random seed, otherwise we are not able to grade your code! Paramet...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Question3: def generatePrototypes(self, traindata, trainlabels, K_list): """Generate prototypes from labeled data. You can use the KMeans function from the sklearn package. **For grading purposes only:** Do NOT change the random seed, otherwise we are not able to grade your code! Parameters: 1. traind...
the_stack_v2_python_sparse
ECE365/ML/lab4/main.py
RickyL-2000/ZJUI-lib
train
1
8b21e392f5d54b43ece8cebe847f55c82b16b411
[ "self.head = None\nself.tail = None\nself.capacity = capacity\nself.map = {}", "if key in self.map:\n node = self.map[key]\n if self.tail == node:\n return node.val\n if self.head == node:\n q = node.next\n self.head = q\n q.prev = None\n node.next = None\n node....
<|body_start_0|> self.head = None self.tail = None self.capacity = capacity self.map = {} <|end_body_0|> <|body_start_1|> if key in self.map: node = self.map[key] if self.tail == node: return node.val if self.head == node: ...
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k_train_032954
2,729
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: None", "name": "pu...
3
stack_v2_sparse_classes_30k_train_016896
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: None
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: None <|sk...
1d8821da01c9c200732a6b7037b8631689e2f7e7
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LRUCache: def __init__(self, capacity): """:type capacity: int""" self.head = None self.tail = None self.capacity = capacity self.map = {} def get(self, key): """:type key: int :rtype: int""" if key in self.map: node = self.map[key] ...
the_stack_v2_python_sparse
Leetcode0146.py
xiaojinghu/Leetcode
train
0
2dbf3d54c3cdce0619b317f0fb059cd179135a5b
[ "self.loss_scale = init_scale\nself.scale_factor = scale_factor\nself.scale_window = scale_window\nself.tolerance = tolerance\nself.threshold = threshold\nself._iter = 0\nself._last_overflow_iter = -1\nself._last_rescale_iter = -1\nself._overflows_since_rescale = 0", "iter_since_rescale = self._iter - self._last_...
<|body_start_0|> self.loss_scale = init_scale self.scale_factor = scale_factor self.scale_window = scale_window self.tolerance = tolerance self.threshold = threshold self._iter = 0 self._last_overflow_iter = -1 self._last_rescale_iter = -1 self._ov...
Dynamically adjusts the loss scaling factor. Dynamic loss scalers are important in mixed-precision training. They help us avoid underflows and overflows in low-precision gradients. See here for information: <https://docs.nvidia.com/deeplearning/performance/mixed-precision-training/index.html#lossscaling> Shamelessly st...
DynamicLossScaler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DynamicLossScaler: """Dynamically adjusts the loss scaling factor. Dynamic loss scalers are important in mixed-precision training. They help us avoid underflows and overflows in low-precision gradients. See here for information: <https://docs.nvidia.com/deeplearning/performance/mixed-precision-tr...
stack_v2_sparse_classes_36k_train_032955
31,338
permissive
[ { "docstring": ":param init_scale: Initial loss scale. :param scale_factor: Factor by which to increase or decrease loss scale. :param scale_window: If we do not experience overflow in scale_window iterations, loss scale will increase by scale_factor. :param tolerance: Pct of iterations that have overflowed aft...
3
stack_v2_sparse_classes_30k_train_007619
Implement the Python class `DynamicLossScaler` described below. Class description: Dynamically adjusts the loss scaling factor. Dynamic loss scalers are important in mixed-precision training. They help us avoid underflows and overflows in low-precision gradients. See here for information: <https://docs.nvidia.com/deep...
Implement the Python class `DynamicLossScaler` described below. Class description: Dynamically adjusts the loss scaling factor. Dynamic loss scalers are important in mixed-precision training. They help us avoid underflows and overflows in low-precision gradients. See here for information: <https://docs.nvidia.com/deep...
e1d899edfb92471552bae153f59ad30aa7fca468
<|skeleton|> class DynamicLossScaler: """Dynamically adjusts the loss scaling factor. Dynamic loss scalers are important in mixed-precision training. They help us avoid underflows and overflows in low-precision gradients. See here for information: <https://docs.nvidia.com/deeplearning/performance/mixed-precision-tr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DynamicLossScaler: """Dynamically adjusts the loss scaling factor. Dynamic loss scalers are important in mixed-precision training. They help us avoid underflows and overflows in low-precision gradients. See here for information: <https://docs.nvidia.com/deeplearning/performance/mixed-precision-training/index....
the_stack_v2_python_sparse
parlai/utils/fp16.py
facebookresearch/ParlAI
train
10,943
b7d9936dd717970e944e261d56f7e28eb873b962
[ "if len(nums) > 1:\n slow = nums[0]\n fast = nums[nums[0]]\n while slow != fast:\n slow = nums[slow]\n fast = nums[nums[fast]]\n fast = 0\n while slow != fast:\n fast = nums[fast]\n slow = nums[slow]\n return fast", "n = len(nums)\nfast = 0\nslow = 0\ncount = 1\nwhile...
<|body_start_0|> if len(nums) > 1: slow = nums[0] fast = nums[nums[0]] while slow != fast: slow = nums[slow] fast = nums[nums[fast]] fast = 0 while slow != fast: fast = nums[fast] slow = n...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findDuplicate(self, nums): """assuming n is the length of the nums time complexity: O(n)""" <|body_0|> def findDuplicate2(self, nums): """this will not assume the n is the length of the array time complexity: O(nlogn) :type nums: List[int] :rtype: int""...
stack_v2_sparse_classes_36k_train_032956
2,180
permissive
[ { "docstring": "assuming n is the length of the nums time complexity: O(n)", "name": "findDuplicate", "signature": "def findDuplicate(self, nums)" }, { "docstring": "this will not assume the n is the length of the array time complexity: O(nlogn) :type nums: List[int] :rtype: int", "name": "f...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findDuplicate(self, nums): assuming n is the length of the nums time complexity: O(n) - def findDuplicate2(self, nums): this will not assume the n is the length of the array ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findDuplicate(self, nums): assuming n is the length of the nums time complexity: O(n) - def findDuplicate2(self, nums): this will not assume the n is the length of the array ...
1ed22267156fb968671731c2e983b0e65f670750
<|skeleton|> class Solution: def findDuplicate(self, nums): """assuming n is the length of the nums time complexity: O(n)""" <|body_0|> def findDuplicate2(self, nums): """this will not assume the n is the length of the array time complexity: O(nlogn) :type nums: List[int] :rtype: int""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findDuplicate(self, nums): """assuming n is the length of the nums time complexity: O(n)""" if len(nums) > 1: slow = nums[0] fast = nums[nums[0]] while slow != fast: slow = nums[slow] fast = nums[nums[fast]] ...
the_stack_v2_python_sparse
leetcode/287.py
pingrunhuang/CodeChallenge
train
0
d81b0b3aa6a3e97f4112567e8547e45c97af5634
[ "SinglePanelPlot.__init__(self)\nself.__triggername = triggername\nself.__triggereff = triggerefficiency", "self._OpenCanvas('trgEffSumm', 'Summed trigger efficiency')\npad = self._GetFramedPad()\npad.DrawFrame(TriggerEfficiencyFrame('tframe'))\npad.DrawGraphicsObject(GraphicsObject(self.__triggereff.GetEfficienc...
<|body_start_0|> SinglePanelPlot.__init__(self) self.__triggername = triggername self.__triggereff = triggerefficiency <|end_body_0|> <|body_start_1|> self._OpenCanvas('trgEffSumm', 'Summed trigger efficiency') pad = self._GetFramedPad() pad.DrawFrame(TriggerEfficiencyFr...
Plot the summed trigger efficiency from different pt-hard bins
TriggerEfficiencySumPlot
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TriggerEfficiencySumPlot: """Plot the summed trigger efficiency from different pt-hard bins""" def __init__(self, triggername, triggerefficiency): """Constructor""" <|body_0|> def Create(self): """Create the plot""" <|body_1|> <|end_skeleton|> <|body_st...
stack_v2_sparse_classes_36k_train_032957
5,978
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, triggername, triggerefficiency)" }, { "docstring": "Create the plot", "name": "Create", "signature": "def Create(self)" } ]
2
stack_v2_sparse_classes_30k_train_001792
Implement the Python class `TriggerEfficiencySumPlot` described below. Class description: Plot the summed trigger efficiency from different pt-hard bins Method signatures and docstrings: - def __init__(self, triggername, triggerefficiency): Constructor - def Create(self): Create the plot
Implement the Python class `TriggerEfficiencySumPlot` described below. Class description: Plot the summed trigger efficiency from different pt-hard bins Method signatures and docstrings: - def __init__(self, triggername, triggerefficiency): Constructor - def Create(self): Create the plot <|skeleton|> class TriggerEf...
5df28b2b415e78e81273b0d9bf5c1b99feda3348
<|skeleton|> class TriggerEfficiencySumPlot: """Plot the summed trigger efficiency from different pt-hard bins""" def __init__(self, triggername, triggerefficiency): """Constructor""" <|body_0|> def Create(self): """Create the plot""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TriggerEfficiencySumPlot: """Plot the summed trigger efficiency from different pt-hard bins""" def __init__(self, triggername, triggerefficiency): """Constructor""" SinglePanelPlot.__init__(self) self.__triggername = triggername self.__triggereff = triggerefficiency d...
the_stack_v2_python_sparse
PWGJE/EMCALJetTasks/Tracks/analysis/plots/TriggerEfficiencyPlotMC.py
alisw/AliPhysics
train
129
b7eec9d8fec8c1ecf26c2a75c4069192d8e95ab9
[ "def transform(node):\n if not node:\n return\n val = node.val\n vals.append(str(val))\n vals.append(str(len(node.children)))\n for child in node.children:\n transform(child)\nvals = []\ntransform(root)\nreturn ' '.join(vals)", "def helper():\n if not queue:\n return\n va...
<|body_start_0|> def transform(node): if not node: return val = node.val vals.append(str(val)) vals.append(str(len(node.children))) for child in node.children: transform(child) vals = [] transform(root) ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root: 'Node') -> str: """Encodes a tree to a single string. :type root: Node :rtype: str""" <|body_0|> def deserialize(self, data: str) -> 'Node': """Decodes your encoded data to tree. :type data: str :rtype: Node""" <|body_1|> <|e...
stack_v2_sparse_classes_36k_train_032958
1,464
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: Node :rtype: str", "name": "serialize", "signature": "def serialize(self, root: 'Node') -> str" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: Node", "name": "deserialize", "signature": "def des...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: 'Node') -> str: Encodes a tree to a single string. :type root: Node :rtype: str - def deserialize(self, data: str) -> 'Node': Decodes your encoded data to tre...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: 'Node') -> str: Encodes a tree to a single string. :type root: Node :rtype: str - def deserialize(self, data: str) -> 'Node': Decodes your encoded data to tre...
502e121cc25fcd81afe3d029145aeee56db794f0
<|skeleton|> class Codec: def serialize(self, root: 'Node') -> str: """Encodes a tree to a single string. :type root: Node :rtype: str""" <|body_0|> def deserialize(self, data: str) -> 'Node': """Decodes your encoded data to tree. :type data: str :rtype: Node""" <|body_1|> <|e...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root: 'Node') -> str: """Encodes a tree to a single string. :type root: Node :rtype: str""" def transform(node): if not node: return val = node.val vals.append(str(val)) vals.append(str(len(node.children...
the_stack_v2_python_sparse
428serialize.py
qinzhouhit/leetcode
train
0
db21072daadeca851cb0cb9fa33afafe62f53382
[ "super(StandardSkillBuilder, self).__init__()\nself.table_name = table_name\nself.auto_create_table = auto_create_table\nself.partition_keygen = partition_keygen\nself.dynamodb_client = dynamodb_client", "skill_config = super(StandardSkillBuilder, self).skill_configuration\nskill_config.api_client = DefaultApiCli...
<|body_start_0|> super(StandardSkillBuilder, self).__init__() self.table_name = table_name self.auto_create_table = auto_create_table self.partition_keygen = partition_keygen self.dynamodb_client = dynamodb_client <|end_body_0|> <|body_start_1|> skill_config = super(Stan...
Skill Builder with api client and db adapter coupling to Skill. Standard Skill Builder is an implementation of :py:class:`ask_sdk_core.skill_builder.SkillBuilder` with coupling of DynamoDb Persistence Adapter settings and a Default Api Client added to the :py:class:`ask_sdk_core.skill.Skill`. :param table_name: Name of...
StandardSkillBuilder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StandardSkillBuilder: """Skill Builder with api client and db adapter coupling to Skill. Standard Skill Builder is an implementation of :py:class:`ask_sdk_core.skill_builder.SkillBuilder` with coupling of DynamoDb Persistence Adapter settings and a Default Api Client added to the :py:class:`ask_s...
stack_v2_sparse_classes_36k_train_032959
4,223
permissive
[ { "docstring": "Skill Builder with api client and db adapter coupling to Skill. Standard Skill Builder is an implementation of :py:class:`ask_sdk_core.skill_builder.SkillBuilder` with coupling of DynamoDb Persistence Adapter settings and a Default Api Client added to the :py:class:`ask_sdk_core.skill.Skill`. :p...
2
null
Implement the Python class `StandardSkillBuilder` described below. Class description: Skill Builder with api client and db adapter coupling to Skill. Standard Skill Builder is an implementation of :py:class:`ask_sdk_core.skill_builder.SkillBuilder` with coupling of DynamoDb Persistence Adapter settings and a Default A...
Implement the Python class `StandardSkillBuilder` described below. Class description: Skill Builder with api client and db adapter coupling to Skill. Standard Skill Builder is an implementation of :py:class:`ask_sdk_core.skill_builder.SkillBuilder` with coupling of DynamoDb Persistence Adapter settings and a Default A...
7e13ca69b240985584dff6ec633a27598a154ca1
<|skeleton|> class StandardSkillBuilder: """Skill Builder with api client and db adapter coupling to Skill. Standard Skill Builder is an implementation of :py:class:`ask_sdk_core.skill_builder.SkillBuilder` with coupling of DynamoDb Persistence Adapter settings and a Default Api Client added to the :py:class:`ask_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StandardSkillBuilder: """Skill Builder with api client and db adapter coupling to Skill. Standard Skill Builder is an implementation of :py:class:`ask_sdk_core.skill_builder.SkillBuilder` with coupling of DynamoDb Persistence Adapter settings and a Default Api Client added to the :py:class:`ask_sdk_core.skill...
the_stack_v2_python_sparse
ask-sdk/ask_sdk/standard.py
alexa/alexa-skills-kit-sdk-for-python
train
560
95262f2ab4e171626936426643c895fbd331eeeb
[ "mapper = {}\nleft = max_len = 0\nfor right, char in enumerate(s):\n if char in mapper:\n left = max(left, mapper[char] + 1)\n max_len = max(max_len, right - left + 1)\n mapper[char] = right\nreturn max_len", "mapper = {}\nleft = max_len = 0\nfor right, char in enumerate(s):\n if char in mapper...
<|body_start_0|> mapper = {} left = max_len = 0 for right, char in enumerate(s): if char in mapper: left = max(left, mapper[char] + 1) max_len = max(max_len, right - left + 1) mapper[char] = right return max_len <|end_body_0|> <|body_s...
String
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class String: def longest_substring_without_repetition_(self, s: str) -> int: """Approach: Sliding Window using max fun Time Complexity: O(n) Space Complexity: O(m) :param s: :return:""" <|body_0|> def longest_substring_without_repetition(self, s: str) -> int: """Approach:...
stack_v2_sparse_classes_36k_train_032960
3,182
no_license
[ { "docstring": "Approach: Sliding Window using max fun Time Complexity: O(n) Space Complexity: O(m) :param s: :return:", "name": "longest_substring_without_repetition_", "signature": "def longest_substring_without_repetition_(self, s: str) -> int" }, { "docstring": "Approach: Sliding Window Time...
4
stack_v2_sparse_classes_30k_val_000571
Implement the Python class `String` described below. Class description: Implement the String class. Method signatures and docstrings: - def longest_substring_without_repetition_(self, s: str) -> int: Approach: Sliding Window using max fun Time Complexity: O(n) Space Complexity: O(m) :param s: :return: - def longest_s...
Implement the Python class `String` described below. Class description: Implement the String class. Method signatures and docstrings: - def longest_substring_without_repetition_(self, s: str) -> int: Approach: Sliding Window using max fun Time Complexity: O(n) Space Complexity: O(m) :param s: :return: - def longest_s...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class String: def longest_substring_without_repetition_(self, s: str) -> int: """Approach: Sliding Window using max fun Time Complexity: O(n) Space Complexity: O(m) :param s: :return:""" <|body_0|> def longest_substring_without_repetition(self, s: str) -> int: """Approach:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class String: def longest_substring_without_repetition_(self, s: str) -> int: """Approach: Sliding Window using max fun Time Complexity: O(n) Space Complexity: O(m) :param s: :return:""" mapper = {} left = max_len = 0 for right, char in enumerate(s): if char in mapper: ...
the_stack_v2_python_sparse
revisited/math_and_strings/strings/longest_substring_without_repeating_chars.py
Shiv2157k/leet_code
train
1
257b9cdc8d96441b08703f08820911ef9ca979e3
[ "k_n = df.Constant(t1 - t0)\ntheta = self.parameters['theta']\nM_i = self._M_i\nt = t0 + theta * (t1 - t0)\nself.time.assign(t)\nchi = self.parameters['Chi']\ncapacitance = self.parameters['Cm']\nlam = self.parameters['lambda']\nlam_frac = df.Constant(lam / (1 + lam))\nv = df.TrialFunction(self.V)\nw = df.TestFunct...
<|body_start_0|> k_n = df.Constant(t1 - t0) theta = self.parameters['theta'] M_i = self._M_i t = t0 + theta * (t1 - t0) self.time.assign(t) chi = self.parameters['Chi'] capacitance = self.parameters['Cm'] lam = self.parameters['lambda'] lam_frac = ...
BasicMonodomainSolver
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BasicMonodomainSolver: def step(self, t0: float, t1: float) -> None: """Solve on the given time interval (t0, t1). *Arguments* interval (:py:class:`tuple`) The time interval (t0, t1) for the step *Invariants* Assuming that v\\_ is in the correct state for t0, gives self.v in correct stat...
stack_v2_sparse_classes_36k_train_032961
16,610
no_license
[ { "docstring": "Solve on the given time interval (t0, t1). *Arguments* interval (:py:class:`tuple`) The time interval (t0, t1) for the step *Invariants* Assuming that v\\\\_ is in the correct state for t0, gives self.v in correct state at t1.", "name": "step", "signature": "def step(self, t0: float, t1:...
2
stack_v2_sparse_classes_30k_train_015943
Implement the Python class `BasicMonodomainSolver` described below. Class description: Implement the BasicMonodomainSolver class. Method signatures and docstrings: - def step(self, t0: float, t1: float) -> None: Solve on the given time interval (t0, t1). *Arguments* interval (:py:class:`tuple`) The time interval (t0,...
Implement the Python class `BasicMonodomainSolver` described below. Class description: Implement the BasicMonodomainSolver class. Method signatures and docstrings: - def step(self, t0: float, t1: float) -> None: Solve on the given time interval (t0, t1). *Arguments* interval (:py:class:`tuple`) The time interval (t0,...
baef350a4f63b9f560fc1f413cd597a3d1ac5773
<|skeleton|> class BasicMonodomainSolver: def step(self, t0: float, t1: float) -> None: """Solve on the given time interval (t0, t1). *Arguments* interval (:py:class:`tuple`) The time interval (t0, t1) for the step *Invariants* Assuming that v\\_ is in the correct state for t0, gives self.v in correct stat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BasicMonodomainSolver: def step(self, t0: float, t1: float) -> None: """Solve on the given time interval (t0, t1). *Arguments* interval (:py:class:`tuple`) The time interval (t0, t1) for the step *Invariants* Assuming that v\\_ is in the correct state for t0, gives self.v in correct state at t1.""" ...
the_stack_v2_python_sparse
xalbrain/monodomainsolver.py
jakobes/xalbrain
train
1
5ffb60229f475908e39b1b01363c8c5f5dfeb5bf
[ "certPath = '..\\\\testCerts\\\\keyCertSignNotCA.pem'\nlint_ca_is_ca.init()\nwith open(certPath, 'rb') as f:\n cert = x509.load_pem_x509_certificate(f.read(), default_backend())\n out = base.Lints['e_ca_is_ca'].Execute(cert)\n self.assertEqual(base.LintStatus.Error, out.Status)", "certPath = '..\\\\testC...
<|body_start_0|> certPath = '..\\testCerts\\keyCertSignNotCA.pem' lint_ca_is_ca.init() with open(certPath, 'rb') as f: cert = x509.load_pem_x509_certificate(f.read(), default_backend()) out = base.Lints['e_ca_is_ca'].Execute(cert) self.assertEqual(base.LintSta...
Test lint_ca_is_ca.py
test_KeyCertSignNotCA
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class test_KeyCertSignNotCA: """Test lint_ca_is_ca.py""" def test_BasicConstNotCrit(self): """Test BasicConstNotCrit""" <|body_0|> def test_KeyCertSignCA(self): """Test lint_basic_constraints_critical.py""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_032962
1,166
no_license
[ { "docstring": "Test BasicConstNotCrit", "name": "test_BasicConstNotCrit", "signature": "def test_BasicConstNotCrit(self)" }, { "docstring": "Test lint_basic_constraints_critical.py", "name": "test_KeyCertSignCA", "signature": "def test_KeyCertSignCA(self)" } ]
2
null
Implement the Python class `test_KeyCertSignNotCA` described below. Class description: Test lint_ca_is_ca.py Method signatures and docstrings: - def test_BasicConstNotCrit(self): Test BasicConstNotCrit - def test_KeyCertSignCA(self): Test lint_basic_constraints_critical.py
Implement the Python class `test_KeyCertSignNotCA` described below. Class description: Test lint_ca_is_ca.py Method signatures and docstrings: - def test_BasicConstNotCrit(self): Test BasicConstNotCrit - def test_KeyCertSignCA(self): Test lint_basic_constraints_critical.py <|skeleton|> class test_KeyCertSignNotCA: ...
c7e7ca27e5d04bbaa4e7ad71d8e86ec5c9388987
<|skeleton|> class test_KeyCertSignNotCA: """Test lint_ca_is_ca.py""" def test_BasicConstNotCrit(self): """Test BasicConstNotCrit""" <|body_0|> def test_KeyCertSignCA(self): """Test lint_basic_constraints_critical.py""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class test_KeyCertSignNotCA: """Test lint_ca_is_ca.py""" def test_BasicConstNotCrit(self): """Test BasicConstNotCrit""" certPath = '..\\testCerts\\keyCertSignNotCA.pem' lint_ca_is_ca.init() with open(certPath, 'rb') as f: cert = x509.load_pem_x509_certificate(f.read(...
the_stack_v2_python_sparse
testlints/test_lint_ca_is_ca.py
846468230/Plint
train
1
c36707a2e7fe408d5c42c8bebd2a0bac0afa944b
[ "database.clear()\ntest_count, test_errors = database.import_data(os.getcwd(), 'prod_none.csv', 'cust_none.csv', 'rental_none.csv')\nself.assertEqual(test_count, (0, 0, 0))\nself.assertEqual(test_errors, (1, 1, 1))\ntest_count, test_errors = database.import_data(os.getcwd(), 'products.csv', 'customers.csv', 'rental...
<|body_start_0|> database.clear() test_count, test_errors = database.import_data(os.getcwd(), 'prod_none.csv', 'cust_none.csv', 'rental_none.csv') self.assertEqual(test_count, (0, 0, 0)) self.assertEqual(test_errors, (1, 1, 1)) test_count, test_errors = database.import_data(os.ge...
Test Class
TestDatabase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestDatabase: """Test Class""" def test_import_data(self): """testing import for three cases, empty, correct, repetitive""" <|body_0|> def test_show_available_products(self): """Test show_available_products""" <|body_1|> def test_show_rentals(self): ...
stack_v2_sparse_classes_36k_train_032963
3,227
no_license
[ { "docstring": "testing import for three cases, empty, correct, repetitive", "name": "test_import_data", "signature": "def test_import_data(self)" }, { "docstring": "Test show_available_products", "name": "test_show_available_products", "signature": "def test_show_available_products(self...
3
null
Implement the Python class `TestDatabase` described below. Class description: Test Class Method signatures and docstrings: - def test_import_data(self): testing import for three cases, empty, correct, repetitive - def test_show_available_products(self): Test show_available_products - def test_show_rentals(self): Test...
Implement the Python class `TestDatabase` described below. Class description: Test Class Method signatures and docstrings: - def test_import_data(self): testing import for three cases, empty, correct, repetitive - def test_show_available_products(self): Test show_available_products - def test_show_rentals(self): Test...
5dac60f39e3909ff05b26721d602ed20f14d6be3
<|skeleton|> class TestDatabase: """Test Class""" def test_import_data(self): """testing import for three cases, empty, correct, repetitive""" <|body_0|> def test_show_available_products(self): """Test show_available_products""" <|body_1|> def test_show_rentals(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestDatabase: """Test Class""" def test_import_data(self): """testing import for three cases, empty, correct, repetitive""" database.clear() test_count, test_errors = database.import_data(os.getcwd(), 'prod_none.csv', 'cust_none.csv', 'rental_none.csv') self.assertEqual(te...
the_stack_v2_python_sparse
students/Nick_Lenssen/lesson10/assignment/test_database.py
JavaRod/SP_Python220B_2019
train
1
207076fd8ab3146cfe118ccec53b72566d9f2ea9
[ "curScenePath = cmds.file(q=True, sceneName=True)\ncurWorkDir = os.path.dirname(curScenePath)\nif mode == 'save':\n filePath = cmds.fileDialog2(fileMode=0, caption='Save', startingDirectory=curWorkDir, fileFilter='*.txt')[0]\nelif mode == 'load':\n filePath = cmds.fileDialog2(fileMode=1, caption='Load', start...
<|body_start_0|> curScenePath = cmds.file(q=True, sceneName=True) curWorkDir = os.path.dirname(curScenePath) if mode == 'save': filePath = cmds.fileDialog2(fileMode=0, caption='Save', startingDirectory=curWorkDir, fileFilter='*.txt')[0] elif mode == 'load': filePa...
Save scene information base class. Contain common attributes and methods for saving scene information and reading scene information.
SceneInfoBase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SceneInfoBase: """Save scene information base class. Contain common attributes and methods for saving scene information and reading scene information.""" def getFilePath(self, mode): """Get file path and return.""" <|body_0|> def saveInfo(self, info, filePath): "...
stack_v2_sparse_classes_36k_train_032964
5,415
no_license
[ { "docstring": "Get file path and return.", "name": "getFilePath", "signature": "def getFilePath(self, mode)" }, { "docstring": "Write information in a text file.", "name": "saveInfo", "signature": "def saveInfo(self, info, filePath)" }, { "docstring": "Read information from a te...
3
null
Implement the Python class `SceneInfoBase` described below. Class description: Save scene information base class. Contain common attributes and methods for saving scene information and reading scene information. Method signatures and docstrings: - def getFilePath(self, mode): Get file path and return. - def saveInfo(...
Implement the Python class `SceneInfoBase` described below. Class description: Save scene information base class. Contain common attributes and methods for saving scene information and reading scene information. Method signatures and docstrings: - def getFilePath(self, mode): Get file path and return. - def saveInfo(...
bd98679cbab869a0c96eac34cb2f199dfbf8fee8
<|skeleton|> class SceneInfoBase: """Save scene information base class. Contain common attributes and methods for saving scene information and reading scene information.""" def getFilePath(self, mode): """Get file path and return.""" <|body_0|> def saveInfo(self, info, filePath): "...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SceneInfoBase: """Save scene information base class. Contain common attributes and methods for saving scene information and reading scene information.""" def getFilePath(self, mode): """Get file path and return.""" curScenePath = cmds.file(q=True, sceneName=True) curWorkDir = os.p...
the_stack_v2_python_sparse
python/tak_saveSceneInfo.py
jasonbrackman/scripts
train
0
666544a592026b46ada7e2ff54a92c105001fc02
[ "if self.entity.exists:\n return self.entity['Owner'].get_entity()\nelse:\n return None", "if self.entity.exists:\n with self.entity['Owner'].open() as collection:\n collection.clear()\nelse:\n self.entity['Owner'].ClearBindings()" ]
<|body_start_0|> if self.entity.exists: return self.entity['Owner'].get_entity() else: return None <|end_body_0|> <|body_start_1|> if self.entity.exists: with self.entity['Owner'].open() as collection: collection.clear() else: ...
MultiTenantSession
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiTenantSession: def get_owner(self): """Returns the owner of the session The owner is the person logged in to the root of the application. It may be None. This should not be confused with a user associated with the session via an LTI launch. If there is no owner, None is returned."""...
stack_v2_sparse_classes_36k_train_032965
18,986
permissive
[ { "docstring": "Returns the owner of the session The owner is the person logged in to the root of the application. It may be None. This should not be confused with a user associated with the session via an LTI launch. If there is no owner, None is returned.", "name": "get_owner", "signature": "def get_o...
2
stack_v2_sparse_classes_30k_train_016393
Implement the Python class `MultiTenantSession` described below. Class description: Implement the MultiTenantSession class. Method signatures and docstrings: - def get_owner(self): Returns the owner of the session The owner is the person logged in to the root of the application. It may be None. This should not be con...
Implement the Python class `MultiTenantSession` described below. Class description: Implement the MultiTenantSession class. Method signatures and docstrings: - def get_owner(self): Returns the owner of the session The owner is the person logged in to the root of the application. It may be None. This should not be con...
ef27dd6bb6fbd6d47687a349508cd4ab2989a0ad
<|skeleton|> class MultiTenantSession: def get_owner(self): """Returns the owner of the session The owner is the person logged in to the root of the application. It may be None. This should not be confused with a user associated with the session via an LTI launch. If there is no owner, None is returned."""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiTenantSession: def get_owner(self): """Returns the owner of the session The owner is the person logged in to the root of the application. It may be None. This should not be confused with a user associated with the session via an LTI launch. If there is no owner, None is returned.""" if se...
the_stack_v2_python_sparse
samples/noticeboard/mtnoticeboard.py
j5int/pyslet
train
2
0412076db90ea11821a480fa6f180f97512f384a
[ "existing_tag = Tag.query.filter_by(tag=g.json['tag']).first()\nif existing_tag:\n return (jsonify(existing_tag.to_dict()), OK)\nelse:\n new_tag = Tag(**g.json)\n db.session.add(new_tag)\n db.session.commit()\n tag_data = new_tag.to_dict(unpack_relationships=('agents', 'jobs'))\n logger.info('crea...
<|body_start_0|> existing_tag = Tag.query.filter_by(tag=g.json['tag']).first() if existing_tag: return (jsonify(existing_tag.to_dict()), OK) else: new_tag = Tag(**g.json) db.session.add(new_tag) db.session.commit() tag_data = new_tag.to...
TagIndexAPI
[ "BSD-3-Clause", "Apache-2.0", "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TagIndexAPI: def post(self): """A ``POST`` to this endpoint will do one of two things: * create a new tag and return the row * return the row for an existing tag Tags only have one column, the tag name. Two tags are automatically considered equal if the tag names are equal. .. http:post:...
stack_v2_sparse_classes_36k_train_032966
17,872
permissive
[ { "docstring": "A ``POST`` to this endpoint will do one of two things: * create a new tag and return the row * return the row for an existing tag Tags only have one column, the tag name. Two tags are automatically considered equal if the tag names are equal. .. http:post:: /api/v1/tags/ HTTP/1.1 **Request** .. ...
2
stack_v2_sparse_classes_30k_train_016888
Implement the Python class `TagIndexAPI` described below. Class description: Implement the TagIndexAPI class. Method signatures and docstrings: - def post(self): A ``POST`` to this endpoint will do one of two things: * create a new tag and return the row * return the row for an existing tag Tags only have one column,...
Implement the Python class `TagIndexAPI` described below. Class description: Implement the TagIndexAPI class. Method signatures and docstrings: - def post(self): A ``POST`` to this endpoint will do one of two things: * create a new tag and return the row * return the row for an existing tag Tags only have one column,...
ea04bbcb807eb669415c569417b4b1b68e75d29d
<|skeleton|> class TagIndexAPI: def post(self): """A ``POST`` to this endpoint will do one of two things: * create a new tag and return the row * return the row for an existing tag Tags only have one column, the tag name. Two tags are automatically considered equal if the tag names are equal. .. http:post:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TagIndexAPI: def post(self): """A ``POST`` to this endpoint will do one of two things: * create a new tag and return the row * return the row for an existing tag Tags only have one column, the tag name. Two tags are automatically considered equal if the tag names are equal. .. http:post:: /api/v1/tags...
the_stack_v2_python_sparse
pyfarm/master/api/tags.py
pyfarm/pyfarm-master
train
2
37c585c0ed5e4ce24230ca74ecffef3c117ab1f2
[ "requires = field.requires\nif not hasattr(requires, 'options'):\n return TAG['input'](self.label(), **attr)\nitems = [self.label(), self.hint()] + self.items(requires.options())\nreturn TAG['select1'](items, **attr)", "items = []\nsetstr = self.setstr\ngetstr = self.getstr\nfor index, option in enumerate(opti...
<|body_start_0|> requires = field.requires if not hasattr(requires, 'options'): return TAG['input'](self.label(), **attr) items = [self.label(), self.hint()] + self.items(requires.options()) return TAG['select1'](items, **attr) <|end_body_0|> <|body_start_1|> items =...
Options Widget for XForms
S3XFormsOptionsWidget
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class S3XFormsOptionsWidget: """Options Widget for XForms""" def widget(self, field, attr): """Widget renderer (parameter description see base class)""" <|body_0|> def items(self, options): """Render the items for the selector Args: options: the options, list of tuples...
stack_v2_sparse_classes_36k_train_032967
29,818
permissive
[ { "docstring": "Widget renderer (parameter description see base class)", "name": "widget", "signature": "def widget(self, field, attr)" }, { "docstring": "Render the items for the selector Args: options: the options, list of tuples (value, text)", "name": "items", "signature": "def items...
2
stack_v2_sparse_classes_30k_train_007668
Implement the Python class `S3XFormsOptionsWidget` described below. Class description: Options Widget for XForms Method signatures and docstrings: - def widget(self, field, attr): Widget renderer (parameter description see base class) - def items(self, options): Render the items for the selector Args: options: the op...
Implement the Python class `S3XFormsOptionsWidget` described below. Class description: Options Widget for XForms Method signatures and docstrings: - def widget(self, field, attr): Widget renderer (parameter description see base class) - def items(self, options): Render the items for the selector Args: options: the op...
7ec4b959d009daf26d5ca6ce91dd9c3c0bd978d6
<|skeleton|> class S3XFormsOptionsWidget: """Options Widget for XForms""" def widget(self, field, attr): """Widget renderer (parameter description see base class)""" <|body_0|> def items(self, options): """Render the items for the selector Args: options: the options, list of tuples...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class S3XFormsOptionsWidget: """Options Widget for XForms""" def widget(self, field, attr): """Widget renderer (parameter description see base class)""" requires = field.requires if not hasattr(requires, 'options'): return TAG['input'](self.label(), **attr) items = [...
the_stack_v2_python_sparse
modules/core/methods/xforms.py
nursix/drkcm
train
3
b1de44c08769af8ce50c24a51300b7a023bbc604
[ "point = list(self.primitive.plane.point)\nnormal = list(self.primitive.plane.normal)\nradius = self.primitive.radius\ncircles = [{'plane': [point, normal], 'radius': radius, 'color': self.color, 'name': self.name}]\nguids = compas_rhino.draw_circles(circles, layer=self.layer, clear=False, redraw=False)\nself._guid...
<|body_start_0|> point = list(self.primitive.plane.point) normal = list(self.primitive.plane.normal) radius = self.primitive.radius circles = [{'plane': [point, normal], 'radius': radius, 'color': self.color, 'name': self.name}] guids = compas_rhino.draw_circles(circles, layer=se...
Artist for drawing circles. Parameters ---------- primitive : :class:`compas.geometry.Circle` A COMPAS circle. Notes ----- See :class:`compas_rhino.artists.PrimitiveArtist` for all other parameters.
CircleArtist
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CircleArtist: """Artist for drawing circles. Parameters ---------- primitive : :class:`compas.geometry.Circle` A COMPAS circle. Notes ----- See :class:`compas_rhino.artists.PrimitiveArtist` for all other parameters.""" def draw(self): """Draw the circle. Returns ------- list The GUID...
stack_v2_sparse_classes_36k_train_032968
3,375
permissive
[ { "docstring": "Draw the circle. Returns ------- list The GUIDs of the created Rhino objects.", "name": "draw", "signature": "def draw(self)" }, { "docstring": "Draw a collection of circles. Parameters ---------- collection : list of :class:`compas.geometry.Circle` A collection of circles. names...
2
stack_v2_sparse_classes_30k_val_000591
Implement the Python class `CircleArtist` described below. Class description: Artist for drawing circles. Parameters ---------- primitive : :class:`compas.geometry.Circle` A COMPAS circle. Notes ----- See :class:`compas_rhino.artists.PrimitiveArtist` for all other parameters. Method signatures and docstrings: - def d...
Implement the Python class `CircleArtist` described below. Class description: Artist for drawing circles. Parameters ---------- primitive : :class:`compas.geometry.Circle` A COMPAS circle. Notes ----- See :class:`compas_rhino.artists.PrimitiveArtist` for all other parameters. Method signatures and docstrings: - def d...
4d1101cf302f95a4472a01a1265cc64eaec6aa4a
<|skeleton|> class CircleArtist: """Artist for drawing circles. Parameters ---------- primitive : :class:`compas.geometry.Circle` A COMPAS circle. Notes ----- See :class:`compas_rhino.artists.PrimitiveArtist` for all other parameters.""" def draw(self): """Draw the circle. Returns ------- list The GUID...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CircleArtist: """Artist for drawing circles. Parameters ---------- primitive : :class:`compas.geometry.Circle` A COMPAS circle. Notes ----- See :class:`compas_rhino.artists.PrimitiveArtist` for all other parameters.""" def draw(self): """Draw the circle. Returns ------- list The GUIDs of the crea...
the_stack_v2_python_sparse
src/compas_rhino/artists/circleartist.py
KEERTHANAUDAY/compas
train
0
d0c44c99119ac2e02260ff2f0b0d23a3c6d45be4
[ "super().__init__()\nself.message_passing = MessagePassing(node_channels=hidden_channels, edge_channels=hidden_channels, hidden_channels=hidden_channels, dropout=dropout)\nself.co_attention = CoAttention(input_channels=hidden_channels, output_channels=hidden_channels, dropout=dropout)\nself.linear = nn.LayerNorm(hi...
<|body_start_0|> super().__init__() self.message_passing = MessagePassing(node_channels=hidden_channels, edge_channels=hidden_channels, hidden_channels=hidden_channels, dropout=dropout) self.co_attention = CoAttention(input_channels=hidden_channels, output_channels=hidden_channels, dropout=dropo...
Coattention message passing layer.
CoAttentionMessagePassingNetwork
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CoAttentionMessagePassingNetwork: """Coattention message passing layer.""" def __init__(self, hidden_channels: int, readout_channels: int, dropout: float=0.5): """Initialize a co-attention message passing network. :param hidden_channels: Input channel number. :param readout_channels:...
stack_v2_sparse_classes_36k_train_032969
25,672
no_license
[ { "docstring": "Initialize a co-attention message passing network. :param hidden_channels: Input channel number. :param readout_channels: Readout channel number. :param dropout: Rate of dropout.", "name": "__init__", "signature": "def __init__(self, hidden_channels: int, readout_channels: int, dropout: ...
4
stack_v2_sparse_classes_30k_train_019284
Implement the Python class `CoAttentionMessagePassingNetwork` described below. Class description: Coattention message passing layer. Method signatures and docstrings: - def __init__(self, hidden_channels: int, readout_channels: int, dropout: float=0.5): Initialize a co-attention message passing network. :param hidden...
Implement the Python class `CoAttentionMessagePassingNetwork` described below. Class description: Coattention message passing layer. Method signatures and docstrings: - def __init__(self, hidden_channels: int, readout_channels: int, dropout: float=0.5): Initialize a co-attention message passing network. :param hidden...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class CoAttentionMessagePassingNetwork: """Coattention message passing layer.""" def __init__(self, hidden_channels: int, readout_channels: int, dropout: float=0.5): """Initialize a co-attention message passing network. :param hidden_channels: Input channel number. :param readout_channels:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CoAttentionMessagePassingNetwork: """Coattention message passing layer.""" def __init__(self, hidden_channels: int, readout_channels: int, dropout: float=0.5): """Initialize a co-attention message passing network. :param hidden_channels: Input channel number. :param readout_channels: Readout chan...
the_stack_v2_python_sparse
generated/test_AstraZeneca_chemicalx.py
jansel/pytorch-jit-paritybench
train
35
39e3829f7a19c9b559bbc89fec9d2da947ced615
[ "if stones[1] != 1:\n return False\nstone_set, fail = (set(stones), set())\nstack = [(0, 0)]\nwhile stack:\n stone, jump = stack.pop()\n for jump_step in (jump - 1, jump, jump + 1):\n stone_next = stone + jump_step\n if jump_step > 0 and stone_next in stone_set and ((stone_next, jump_step) no...
<|body_start_0|> if stones[1] != 1: return False stone_set, fail = (set(stones), set()) stack = [(0, 0)] while stack: stone, jump = stack.pop() for jump_step in (jump - 1, jump, jump + 1): stone_next = stone + jump_step ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canCross(self, stones): """:type stones: List[int] :rtype: bool beats 94.74%""" <|body_0|> def canCross1(self, stones): """:type stones: List[int] :rtype: bool https://discuss.leetcode.com/topic/59570/python-documented-solution-that-is-easy-to-understan...
stack_v2_sparse_classes_36k_train_032970
2,969
no_license
[ { "docstring": ":type stones: List[int] :rtype: bool beats 94.74%", "name": "canCross", "signature": "def canCross(self, stones)" }, { "docstring": ":type stones: List[int] :rtype: bool https://discuss.leetcode.com/topic/59570/python-documented-solution-that-is-easy-to-understand beats 31.58%", ...
3
stack_v2_sparse_classes_30k_train_004743
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canCross(self, stones): :type stones: List[int] :rtype: bool beats 94.74% - def canCross1(self, stones): :type stones: List[int] :rtype: bool https://discuss.leetcode.com/top...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canCross(self, stones): :type stones: List[int] :rtype: bool beats 94.74% - def canCross1(self, stones): :type stones: List[int] :rtype: bool https://discuss.leetcode.com/top...
7e0e917c15d3e35f49da3a00ef395bd5ff180d79
<|skeleton|> class Solution: def canCross(self, stones): """:type stones: List[int] :rtype: bool beats 94.74%""" <|body_0|> def canCross1(self, stones): """:type stones: List[int] :rtype: bool https://discuss.leetcode.com/topic/59570/python-documented-solution-that-is-easy-to-understan...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def canCross(self, stones): """:type stones: List[int] :rtype: bool beats 94.74%""" if stones[1] != 1: return False stone_set, fail = (set(stones), set()) stack = [(0, 0)] while stack: stone, jump = stack.pop() for jump_step...
the_stack_v2_python_sparse
LeetCode/403_frog_jump.py
yao23/Machine_Learning_Playground
train
12
035fc5f531599e00bfb626055807d57d4280e436
[ "self.__buffer_ptr = StringIO()\nself.__path = path\nself.__delete = delete\nself.__level = level\nself.__restore_level = None\nself.__logger = logging.getLogger(name)\nself.__handler = logging.StreamHandler(self.__buffer_ptr) if not self.__path else logging.FileHandler(self.__path, mode='a', encoding='utf-8')\nsel...
<|body_start_0|> self.__buffer_ptr = StringIO() self.__path = path self.__delete = delete self.__level = level self.__restore_level = None self.__logger = logging.getLogger(name) self.__handler = logging.StreamHandler(self.__buffer_ptr) if not self.__path else log...
A class used to allow one to instantiate loggers that write to memory for temporary purposes. e.g.: 1. with LogCapture() as captured: 2. 3. # Send our notification(s) 4. aobj.notify("hello world") 5. 6. # retrieve our logs produced by the above call via our 7. # `captured` StringIO object we have access to within the `...
LogCapture
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LogCapture: """A class used to allow one to instantiate loggers that write to memory for temporary purposes. e.g.: 1. with LogCapture() as captured: 2. 3. # Send our notification(s) 4. aobj.notify("hello world") 5. 6. # retrieve our logs produced by the above call via our 7. # `captured` StringIO...
stack_v2_sparse_classes_36k_train_032971
7,126
permissive
[ { "docstring": "Instantiate a temporary log capture object If a path is specified, then log content is sent to that file instead of a StringIO object. You can optionally specify a logging level such as logging.INFO if you wish, otherwise by default the script uses whatever logging has been set globally. If you ...
3
null
Implement the Python class `LogCapture` described below. Class description: A class used to allow one to instantiate loggers that write to memory for temporary purposes. e.g.: 1. with LogCapture() as captured: 2. 3. # Send our notification(s) 4. aobj.notify("hello world") 5. 6. # retrieve our logs produced by the abov...
Implement the Python class `LogCapture` described below. Class description: A class used to allow one to instantiate loggers that write to memory for temporary purposes. e.g.: 1. with LogCapture() as captured: 2. 3. # Send our notification(s) 4. aobj.notify("hello world") 5. 6. # retrieve our logs produced by the abov...
be3baed7e3d33bae973f1714df4ebbf65aa33f85
<|skeleton|> class LogCapture: """A class used to allow one to instantiate loggers that write to memory for temporary purposes. e.g.: 1. with LogCapture() as captured: 2. 3. # Send our notification(s) 4. aobj.notify("hello world") 5. 6. # retrieve our logs produced by the above call via our 7. # `captured` StringIO...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LogCapture: """A class used to allow one to instantiate loggers that write to memory for temporary purposes. e.g.: 1. with LogCapture() as captured: 2. 3. # Send our notification(s) 4. aobj.notify("hello world") 5. 6. # retrieve our logs produced by the above call via our 7. # `captured` StringIO object we ha...
the_stack_v2_python_sparse
apprise/logger.py
caronc/apprise
train
8,426
325c32215a9def40e1776540593a190e8eb8ae57
[ "color = self.color\nif color is not None:\n glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE)\n glEnable(GL_COLOR_MATERIAL)\n glColorPointer(3, GL_FLOAT, 0, color)\n glEnableClientState(GL_COLOR_ARRAY)\n return 1\nelse:\n return 0", "normal = self.normal\nif normal is not None:\n glNormalPointe...
<|body_start_0|> color = self.color if color is not None: glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE) glEnable(GL_COLOR_MATERIAL) glColorPointer(3, GL_FLOAT, 0, color) glEnableClientState(GL_COLOR_ARRAY) return 1 else: re...
Substitutes as object to hold vbo values
Holder
[ "GPL-1.0-or-later", "MIT", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-other-copyleft", "LGPL-2.1-or-later", "GPL-3.0-only", "LGPL-2.0-or-later", "GPL-3.0-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Holder: """Substitutes as object to hold vbo values""" def _enableColors(self, node): """Enable the colour array if possible""" <|body_0|> def _enableNormals(self, node): """Enable the normal array if possible""" <|body_1|> def _enableTextures(self, ...
stack_v2_sparse_classes_36k_train_032972
12,165
permissive
[ { "docstring": "Enable the colour array if possible", "name": "_enableColors", "signature": "def _enableColors(self, node)" }, { "docstring": "Enable the normal array if possible", "name": "_enableNormals", "signature": "def _enableNormals(self, node)" }, { "docstring": "Enable t...
4
null
Implement the Python class `Holder` described below. Class description: Substitutes as object to hold vbo values Method signatures and docstrings: - def _enableColors(self, node): Enable the colour array if possible - def _enableNormals(self, node): Enable the normal array if possible - def _enableTextures(self, node...
Implement the Python class `Holder` described below. Class description: Substitutes as object to hold vbo values Method signatures and docstrings: - def _enableColors(self, node): Enable the colour array if possible - def _enableNormals(self, node): Enable the normal array if possible - def _enableTextures(self, node...
7f600ad153270feff12aa7aa86d7ed0a49ebc71c
<|skeleton|> class Holder: """Substitutes as object to hold vbo values""" def _enableColors(self, node): """Enable the colour array if possible""" <|body_0|> def _enableNormals(self, node): """Enable the normal array if possible""" <|body_1|> def _enableTextures(self, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Holder: """Substitutes as object to hold vbo values""" def _enableColors(self, node): """Enable the colour array if possible""" color = self.color if color is not None: glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE) glEnable(GL_COLOR_MATERIAL) g...
the_stack_v2_python_sparse
pythonAnimations/pyOpenGLChess/engineDirectory/oglc-env/lib/python2.7/site-packages/OpenGLContext/scenegraph/indexedpolygons.py
alexus37/AugmentedRealityChess
train
1
6831b0fbb7a6dadcaef55a6df4497df57ec91df1
[ "if head == None or head.next == None:\n return head\ncur = self.reverseList_recursive(head.next)\nhead.next.next = head\nhead.next = None\nreturn cur", "pre = None\ncur = head\nwhile cur:\n tmp = cur.next\n cur.next = pre\n pre = cur\n cur = tmp\nreturn pre" ]
<|body_start_0|> if head == None or head.next == None: return head cur = self.reverseList_recursive(head.next) head.next.next = head head.next = None return cur <|end_body_0|> <|body_start_1|> pre = None cur = head while cur: tmp =...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseList_recursive(self, head: ListNode) -> ListNode: """递归解法 :type head: ListNode :rtype: ListNode""" <|body_0|> def reverseList_iterate(self, head: ListNode) -> ListNode: """迭代解法 :type head: ListNode :rtype: ListNode""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_36k_train_032973
2,567
no_license
[ { "docstring": "递归解法 :type head: ListNode :rtype: ListNode", "name": "reverseList_recursive", "signature": "def reverseList_recursive(self, head: ListNode) -> ListNode" }, { "docstring": "迭代解法 :type head: ListNode :rtype: ListNode", "name": "reverseList_iterate", "signature": "def revers...
2
stack_v2_sparse_classes_30k_train_011471
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList_recursive(self, head: ListNode) -> ListNode: 递归解法 :type head: ListNode :rtype: ListNode - def reverseList_iterate(self, head: ListNode) -> ListNode: 迭代解法 :type he...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList_recursive(self, head: ListNode) -> ListNode: 递归解法 :type head: ListNode :rtype: ListNode - def reverseList_iterate(self, head: ListNode) -> ListNode: 迭代解法 :type he...
62419b49000e79962bcdc99cd98afd2fb82ea345
<|skeleton|> class Solution: def reverseList_recursive(self, head: ListNode) -> ListNode: """递归解法 :type head: ListNode :rtype: ListNode""" <|body_0|> def reverseList_iterate(self, head: ListNode) -> ListNode: """迭代解法 :type head: ListNode :rtype: ListNode""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reverseList_recursive(self, head: ListNode) -> ListNode: """递归解法 :type head: ListNode :rtype: ListNode""" if head == None or head.next == None: return head cur = self.reverseList_recursive(head.next) head.next.next = head head.next = None ...
the_stack_v2_python_sparse
字节跳动测试开发工程师面试准备/reverseList.py
MaoningGuan/LeetCode
train
3
c3a63413ace6e5358fae2058e07f91d8f6aab61a
[ "super(CustomRuntimeInstanceFactory, self).__init__(request_data, max_concurrent_requests=1, max_background_threads=0)\nself._runtime_config_getter = runtime_config_getter\nself._module_configuration = module_configuration", "def instance_config_getter():\n runtime_config = self._runtime_config_getter()\n r...
<|body_start_0|> super(CustomRuntimeInstanceFactory, self).__init__(request_data, max_concurrent_requests=1, max_background_threads=0) self._runtime_config_getter = runtime_config_getter self._module_configuration = module_configuration <|end_body_0|> <|body_start_1|> def instance_confi...
A factory that creates new custom runtime Instances.
CustomRuntimeInstanceFactory
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomRuntimeInstanceFactory: """A factory that creates new custom runtime Instances.""" def __init__(self, request_data, runtime_config_getter, module_configuration): """Initializer for CustomRuntimeInstanceFactory. Args: request_data: A wsgi_request_info.WSGIRequestInfo that will b...
stack_v2_sparse_classes_36k_train_032974
3,328
permissive
[ { "docstring": "Initializer for CustomRuntimeInstanceFactory. Args: request_data: A wsgi_request_info.WSGIRequestInfo that will be provided with request information for use by API stubs. runtime_config_getter: A function that can be called without arguments and returns the runtime_config_pb2.Config containing t...
2
stack_v2_sparse_classes_30k_train_017111
Implement the Python class `CustomRuntimeInstanceFactory` described below. Class description: A factory that creates new custom runtime Instances. Method signatures and docstrings: - def __init__(self, request_data, runtime_config_getter, module_configuration): Initializer for CustomRuntimeInstanceFactory. Args: requ...
Implement the Python class `CustomRuntimeInstanceFactory` described below. Class description: A factory that creates new custom runtime Instances. Method signatures and docstrings: - def __init__(self, request_data, runtime_config_getter, module_configuration): Initializer for CustomRuntimeInstanceFactory. Args: requ...
b36916181d87f4f31f5bbbb976a7e88f55296986
<|skeleton|> class CustomRuntimeInstanceFactory: """A factory that creates new custom runtime Instances.""" def __init__(self, request_data, runtime_config_getter, module_configuration): """Initializer for CustomRuntimeInstanceFactory. Args: request_data: A wsgi_request_info.WSGIRequestInfo that will b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CustomRuntimeInstanceFactory: """A factory that creates new custom runtime Instances.""" def __init__(self, request_data, runtime_config_getter, module_configuration): """Initializer for CustomRuntimeInstanceFactory. Args: request_data: A wsgi_request_info.WSGIRequestInfo that will be provided wi...
the_stack_v2_python_sparse
google/appengine/tools/devappserver2/custom_runtime.py
vicmortelmans/catholicmissale
train
1
73c941d2a1930a2c8b69352358e3195852c6483f
[ "original = dict(self.file_dict).copy()\noriginal_repos = original.pop(KEY_REPOS, [])\nsuggested = {KEY_REPOS: []} if original_repos else {}\nfor repo in original_repos:\n new_repo = dict(repo)\n hooks_or_yaml = repo.get(KEY_HOOKS, repo.get(KEY_YAML, {}))\n if KEY_YAML in repo:\n repo_list = YAMLFor...
<|body_start_0|> original = dict(self.file_dict).copy() original_repos = original.pop(KEY_REPOS, []) suggested = {KEY_REPOS: []} if original_repos else {} for repo in original_repos: new_repo = dict(repo) hooks_or_yaml = repo.get(KEY_HOOKS, repo.get(KEY_YAML, {}))...
Checker for the `.pre-commit-config.yaml <https://pre-commit.com/#pre-commit-configyaml---top-level>`_ file. Example: :ref:`the default pre-commit hooks <default-pre-commit-hooks>`.
PreCommitPlugin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PreCommitPlugin: """Checker for the `.pre-commit-config.yaml <https://pre-commit.com/#pre-commit-configyaml---top-level>`_ file. Example: :ref:`the default pre-commit hooks <default-pre-commit-hooks>`.""" def suggest_initial_contents(self) -> str: """Suggest the initial content for t...
stack_v2_sparse_classes_36k_train_032975
9,000
permissive
[ { "docstring": "Suggest the initial content for this missing file.", "name": "suggest_initial_contents", "signature": "def suggest_initial_contents(self) -> str" }, { "docstring": "Check the rules for the pre-commit hooks.", "name": "check_rules", "signature": "def check_rules(self) -> Y...
6
stack_v2_sparse_classes_30k_train_000304
Implement the Python class `PreCommitPlugin` described below. Class description: Checker for the `.pre-commit-config.yaml <https://pre-commit.com/#pre-commit-configyaml---top-level>`_ file. Example: :ref:`the default pre-commit hooks <default-pre-commit-hooks>`. Method signatures and docstrings: - def suggest_initial...
Implement the Python class `PreCommitPlugin` described below. Class description: Checker for the `.pre-commit-config.yaml <https://pre-commit.com/#pre-commit-configyaml---top-level>`_ file. Example: :ref:`the default pre-commit hooks <default-pre-commit-hooks>`. Method signatures and docstrings: - def suggest_initial...
cf00d741d4d52d7591dffa4af0211bc652ba2e55
<|skeleton|> class PreCommitPlugin: """Checker for the `.pre-commit-config.yaml <https://pre-commit.com/#pre-commit-configyaml---top-level>`_ file. Example: :ref:`the default pre-commit hooks <default-pre-commit-hooks>`.""" def suggest_initial_contents(self) -> str: """Suggest the initial content for t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PreCommitPlugin: """Checker for the `.pre-commit-config.yaml <https://pre-commit.com/#pre-commit-configyaml---top-level>`_ file. Example: :ref:`the default pre-commit hooks <default-pre-commit-hooks>`.""" def suggest_initial_contents(self) -> str: """Suggest the initial content for this missing f...
the_stack_v2_python_sparse
src/nitpick/plugins/pre_commit.py
admdev8/nitpick
train
0
1b1f6d36acc2f6bfdeb4eb77017c94610fba38ef
[ "self.x = x_center\nself.y = y_center\nself.r = radius", "while True:\n x = uniform(-1, 1)\n y = uniform(-1, 1)\n if x ** 2 + y ** 2 <= 1:\n break\nreturn (self.x + x * self.r, self.y + y * self.r)" ]
<|body_start_0|> self.x = x_center self.y = y_center self.r = radius <|end_body_0|> <|body_start_1|> while True: x = uniform(-1, 1) y = uniform(-1, 1) if x ** 2 + y ** 2 <= 1: break return (self.x + x * self.r, self.y + y * sel...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, radius, x_center, y_center): """:type radius: float :type x_center: float :type y_center: float""" <|body_0|> def randPoint(self): """:rtype: List[float]""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.x = x_center ...
stack_v2_sparse_classes_36k_train_032976
666
no_license
[ { "docstring": ":type radius: float :type x_center: float :type y_center: float", "name": "__init__", "signature": "def __init__(self, radius, x_center, y_center)" }, { "docstring": ":rtype: List[float]", "name": "randPoint", "signature": "def randPoint(self)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, radius, x_center, y_center): :type radius: float :type x_center: float :type y_center: float - def randPoint(self): :rtype: List[float]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, radius, x_center, y_center): :type radius: float :type x_center: float :type y_center: float - def randPoint(self): :rtype: List[float] <|skeleton|> class Sol...
97533d53c8892b6519e99f344489fa4fd4c9ab93
<|skeleton|> class Solution: def __init__(self, radius, x_center, y_center): """:type radius: float :type x_center: float :type y_center: float""" <|body_0|> def randPoint(self): """:rtype: List[float]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, radius, x_center, y_center): """:type radius: float :type x_center: float :type y_center: float""" self.x = x_center self.y = y_center self.r = radius def randPoint(self): """:rtype: List[float]""" while True: x = un...
the_stack_v2_python_sparse
19. Random/478.py
proTao/leetcode
train
0
01adddf32d23c741c2993e28520f57578d3d2478
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn WorkbookWorksheet()", "from .entity import Entity\nfrom .workbook_chart import WorkbookChart\nfrom .workbook_named_item import WorkbookNamedItem\nfrom .workbook_pivot_table import WorkbookPivotTable\nfrom .workbook_table import Workboo...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return WorkbookWorksheet() <|end_body_0|> <|body_start_1|> from .entity import Entity from .workbook_chart import WorkbookChart from .workbook_named_item import WorkbookNamedItem ...
WorkbookWorksheet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkbookWorksheet: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookWorksheet: """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...
stack_v2_sparse_classes_36k_train_032977
4,905
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: WorkbookWorksheet", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_v...
3
null
Implement the Python class `WorkbookWorksheet` described below. Class description: Implement the WorkbookWorksheet class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookWorksheet: Creates a new instance of the appropriate class based on discrim...
Implement the Python class `WorkbookWorksheet` described below. Class description: Implement the WorkbookWorksheet class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookWorksheet: Creates a new instance of the appropriate class based on discrim...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class WorkbookWorksheet: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookWorksheet: """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...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WorkbookWorksheet: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookWorksheet: """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: Work...
the_stack_v2_python_sparse
msgraph/generated/models/workbook_worksheet.py
microsoftgraph/msgraph-sdk-python
train
135
2127007e349316612f066556f963c3f0c9c2f05f
[ "if not os.path.isfile(facets_groups_file_path):\n raise self.FacetsGroupsConfigurationManagerError(f'The path {facets_groups_file_path} does not exist!')\nself.facets_groups_file_path = facets_groups_file_path\nself.property_configuration_manager = property_configuration_manager", "cache_key = f'facets_config...
<|body_start_0|> if not os.path.isfile(facets_groups_file_path): raise self.FacetsGroupsConfigurationManagerError(f'The path {facets_groups_file_path} does not exist!') self.facets_groups_file_path = facets_groups_file_path self.property_configuration_manager = property_configuration...
Class that handles the configuration of the groups of facets for the interface
FacetsGroupsConfiguration
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FacetsGroupsConfiguration: """Class that handles the configuration of the groups of facets for the interface""" def __init__(self, facets_groups_file_path, property_configuration_manager): """:param facets_groups_file_path: path to the file where the facets groups config is :param pr...
stack_v2_sparse_classes_36k_train_032978
5,735
no_license
[ { "docstring": ":param facets_groups_file_path: path to the file where the facets groups config is :param property_configuration_manager: instance of the properties configuration manager", "name": "__init__", "signature": "def __init__(self, facets_groups_file_path, property_configuration_manager)" },...
4
stack_v2_sparse_classes_30k_train_012748
Implement the Python class `FacetsGroupsConfiguration` described below. Class description: Class that handles the configuration of the groups of facets for the interface Method signatures and docstrings: - def __init__(self, facets_groups_file_path, property_configuration_manager): :param facets_groups_file_path: pat...
Implement the Python class `FacetsGroupsConfiguration` described below. Class description: Class that handles the configuration of the groups of facets for the interface Method signatures and docstrings: - def __init__(self, facets_groups_file_path, property_configuration_manager): :param facets_groups_file_path: pat...
97019d11f5f93c78d87aa6480548f92ccc426838
<|skeleton|> class FacetsGroupsConfiguration: """Class that handles the configuration of the groups of facets for the interface""" def __init__(self, facets_groups_file_path, property_configuration_manager): """:param facets_groups_file_path: path to the file where the facets groups config is :param pr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FacetsGroupsConfiguration: """Class that handles the configuration of the groups of facets for the interface""" def __init__(self, facets_groups_file_path, property_configuration_manager): """:param facets_groups_file_path: path to the file where the facets groups config is :param property_config...
the_stack_v2_python_sparse
app/properties_configuration/facets_groups_configuration_manager.py
BNext-IQT/elasticsearch-proxy-api
train
0
bcfbde64ce11edec887e623888b7b8fb092c26a4
[ "inputs = tf.placeholder(dtype=tf.float32, shape=[None, None, 100])\nencoder = BidirectionalRNNEncoder()\n_, _ = encoder(inputs)\nself.assertEqual(len(encoder.trainable_variables), 4)\nhparams = {'rnn_cell_fw': {'dropout': {'input_keep_prob': 0.5}}}\nencoder = BidirectionalRNNEncoder(hparams=hparams)\n_, _ = encode...
<|body_start_0|> inputs = tf.placeholder(dtype=tf.float32, shape=[None, None, 100]) encoder = BidirectionalRNNEncoder() _, _ = encoder(inputs) self.assertEqual(len(encoder.trainable_variables), 4) hparams = {'rnn_cell_fw': {'dropout': {'input_keep_prob': 0.5}}} encoder = ...
Tests :class:`~texar.tf.modules.BidirectionalRNNEncoder` class.
BidirectionalRNNEncoderTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BidirectionalRNNEncoderTest: """Tests :class:`~texar.tf.modules.BidirectionalRNNEncoder` class.""" def test_trainable_variables(self): """Tests the functionality of automatically collecting trainable variables.""" <|body_0|> def test_encode(self): """Tests encodi...
stack_v2_sparse_classes_36k_train_032979
9,397
permissive
[ { "docstring": "Tests the functionality of automatically collecting trainable variables.", "name": "test_trainable_variables", "signature": "def test_trainable_variables(self)" }, { "docstring": "Tests encoding.", "name": "test_encode", "signature": "def test_encode(self)" } ]
2
stack_v2_sparse_classes_30k_train_014830
Implement the Python class `BidirectionalRNNEncoderTest` described below. Class description: Tests :class:`~texar.tf.modules.BidirectionalRNNEncoder` class. Method signatures and docstrings: - def test_trainable_variables(self): Tests the functionality of automatically collecting trainable variables. - def test_encod...
Implement the Python class `BidirectionalRNNEncoderTest` described below. Class description: Tests :class:`~texar.tf.modules.BidirectionalRNNEncoder` class. Method signatures and docstrings: - def test_trainable_variables(self): Tests the functionality of automatically collecting trainable variables. - def test_encod...
0704b3d4c93915b9a6f96b725e49ae20bf5d1e90
<|skeleton|> class BidirectionalRNNEncoderTest: """Tests :class:`~texar.tf.modules.BidirectionalRNNEncoder` class.""" def test_trainable_variables(self): """Tests the functionality of automatically collecting trainable variables.""" <|body_0|> def test_encode(self): """Tests encodi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BidirectionalRNNEncoderTest: """Tests :class:`~texar.tf.modules.BidirectionalRNNEncoder` class.""" def test_trainable_variables(self): """Tests the functionality of automatically collecting trainable variables.""" inputs = tf.placeholder(dtype=tf.float32, shape=[None, None, 100]) ...
the_stack_v2_python_sparse
texar/tf/modules/encoders/rnn_encoders_test.py
arita37/texar
train
2
0a233a99e8228497b896dcee74d297ecb106bcb7
[ "with file(path, 'r') as stream:\n notaries = self.parse_stream(stream)\nreturn notaries", "notaries = Notaries()\nwhile True:\n notary = self._parse_notary(stream)\n if notary is None:\n break\n else:\n notaries.append(notary)\nreturn notaries", "hostname, port, public_key = (None, No...
<|body_start_0|> with file(path, 'r') as stream: notaries = self.parse_stream(stream) return notaries <|end_body_0|> <|body_start_1|> notaries = Notaries() while True: notary = self._parse_notary(stream) if notary is None: break ...
Parse serialized Notaries and return a Notaries instance
NotaryParser
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NotaryParser: """Parse serialized Notaries and return a Notaries instance""" def parse_file(self, path): """Return Notaries described in file. See parse_stream() for expected format""" <|body_0|> def parse_stream(self, stream): """Return Notaries described in str...
stack_v2_sparse_classes_36k_train_032980
3,198
no_license
[ { "docstring": "Return Notaries described in file. See parse_stream() for expected format", "name": "parse_file", "signature": "def parse_file(self, path)" }, { "docstring": "Return Notaries described in stream. Expected format for each Notary is: # Lines starting with '#' are comments and ignor...
4
stack_v2_sparse_classes_30k_train_018121
Implement the Python class `NotaryParser` described below. Class description: Parse serialized Notaries and return a Notaries instance Method signatures and docstrings: - def parse_file(self, path): Return Notaries described in file. See parse_stream() for expected format - def parse_stream(self, stream): Return Nota...
Implement the Python class `NotaryParser` described below. Class description: Parse serialized Notaries and return a Notaries instance Method signatures and docstrings: - def parse_file(self, path): Return Notaries described in file. See parse_stream() for expected format - def parse_stream(self, stream): Return Nota...
92883090bb3e9f8ccdf3e4a39dce47ba3697ed63
<|skeleton|> class NotaryParser: """Parse serialized Notaries and return a Notaries instance""" def parse_file(self, path): """Return Notaries described in file. See parse_stream() for expected format""" <|body_0|> def parse_stream(self, stream): """Return Notaries described in str...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NotaryParser: """Parse serialized Notaries and return a Notaries instance""" def parse_file(self, path): """Return Notaries described in file. See parse_stream() for expected format""" with file(path, 'r') as stream: notaries = self.parse_stream(stream) return notaries...
the_stack_v2_python_sparse
Perspectives/NotaryParser.py
von/pyPerspectives
train
2
1f9ba8647301914a4961c0ba940186474cba209e
[ "fake_head = ListNode(0)\np, p1, p2 = (fake_head, l1, l2)\nwhile p1 and p2:\n if p1.val < p2.val:\n p.next = ListNode(p1.val)\n p1 = p1.next\n else:\n p.next = ListNode(p2.val)\n p2 = p2.next\n p = p.next\np.next = p1 or p2\nreturn fake_head.next", "if not l1 or not l2:\n r...
<|body_start_0|> fake_head = ListNode(0) p, p1, p2 = (fake_head, l1, l2) while p1 and p2: if p1.val < p2.val: p.next = ListNode(p1.val) p1 = p1.next else: p.next = ListNode(p2.val) p2 = p2.next p ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mergeTwoLists_iterative(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def mergeTwoLists_recursive(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_36k_train_032981
1,522
no_license
[ { "docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode", "name": "mergeTwoLists_iterative", "signature": "def mergeTwoLists_iterative(self, l1, l2)" }, { "docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode", "name": "mergeTwoLists_recursive", "signature":...
2
stack_v2_sparse_classes_30k_val_001083
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists_iterative(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def mergeTwoLists_recursive(self, l1, l2): :type l1: ListNode :type l2: ListNo...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists_iterative(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def mergeTwoLists_recursive(self, l1, l2): :type l1: ListNode :type l2: ListNo...
9ac54720f571a4bea09d0cceb0039381a78df9e8
<|skeleton|> class Solution: def mergeTwoLists_iterative(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def mergeTwoLists_recursive(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def mergeTwoLists_iterative(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" fake_head = ListNode(0) p, p1, p2 = (fake_head, l1, l2) while p1 and p2: if p1.val < p2.val: p.next = ListNode(p1.val) p...
the_stack_v2_python_sparse
code/021_merge-two-sorted-lists.py
linhdvu14/leetcode-solutions
train
2
ede53238cc74e2cb0e60d726d9f8155e9f60a387
[ "self.queue = []\nself.limit = capacity\nself.mapping = {}", "for i in range(len(self.queue) + 1):\n if i == len(self.queue):\n return -1\n if self.queue[i] == key:\n break\ndel self.queue[i]\nself.queue.append(key)\nreturn self.mapping[key]", "if key in self.mapping:\n self.mapping[key] ...
<|body_start_0|> self.queue = [] self.limit = capacity self.mapping = {} <|end_body_0|> <|body_start_1|> for i in range(len(self.queue) + 1): if i == len(self.queue): return -1 if self.queue[i] == key: break del self.queue[...
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k_train_032982
1,459
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: None", "name": "pu...
3
stack_v2_sparse_classes_30k_val_001123
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: None
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: None <|sk...
43a14e90b42ce1febb515e02cdd9d93781929173
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LRUCache: def __init__(self, capacity): """:type capacity: int""" self.queue = [] self.limit = capacity self.mapping = {} def get(self, key): """:type key: int :rtype: int""" for i in range(len(self.queue) + 1): if i == len(self.queue): ...
the_stack_v2_python_sparse
146.py
sp-shaopeng/leetcode-practice
train
0
3af9cf77c8fbc4e81f26d3da574c834a130934fa
[ "self._api = UrlBuilder(self._ensure_url_has_scheme(base_api_url))\nself._network = Network()\nself._logger = log.get_logger(__name__)", "url = url.strip()\nif not url.startswith('http'):\n url = '{}://{}'.format(Configuration['protocol_scheme'], url)\nreturn url" ]
<|body_start_0|> self._api = UrlBuilder(self._ensure_url_has_scheme(base_api_url)) self._network = Network() self._logger = log.get_logger(__name__) <|end_body_0|> <|body_start_1|> url = url.strip() if not url.startswith('http'): url = '{}://{}'.format(Configuration[...
This is the base class for REST API wrappers around the master and slave services.
ClusterAPIClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClusterAPIClient: """This is the base class for REST API wrappers around the master and slave services.""" def __init__(self, base_api_url): """:param base_api_url: The base API url of the service (e.g., 'http(s)://localhost:43000') :type base_api_url: str""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_032983
12,749
permissive
[ { "docstring": ":param base_api_url: The base API url of the service (e.g., 'http(s)://localhost:43000') :type base_api_url: str", "name": "__init__", "signature": "def __init__(self, base_api_url)" }, { "docstring": "If url does not start with 'http' or 'https', add 'http://' or 'https://' at t...
2
stack_v2_sparse_classes_30k_train_018644
Implement the Python class `ClusterAPIClient` described below. Class description: This is the base class for REST API wrappers around the master and slave services. Method signatures and docstrings: - def __init__(self, base_api_url): :param base_api_url: The base API url of the service (e.g., 'http(s)://localhost:43...
Implement the Python class `ClusterAPIClient` described below. Class description: This is the base class for REST API wrappers around the master and slave services. Method signatures and docstrings: - def __init__(self, base_api_url): :param base_api_url: The base API url of the service (e.g., 'http(s)://localhost:43...
55d18016f2c7d2dbb8aec5879459cae654edb045
<|skeleton|> class ClusterAPIClient: """This is the base class for REST API wrappers around the master and slave services.""" def __init__(self, base_api_url): """:param base_api_url: The base API url of the service (e.g., 'http(s)://localhost:43000') :type base_api_url: str""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClusterAPIClient: """This is the base class for REST API wrappers around the master and slave services.""" def __init__(self, base_api_url): """:param base_api_url: The base API url of the service (e.g., 'http(s)://localhost:43000') :type base_api_url: str""" self._api = UrlBuilder(self._...
the_stack_v2_python_sparse
app/client/cluster_api_client.py
box/ClusterRunner
train
168
943be5fca1f4a25075e5ae8a05c425e6bab3a95a
[ "if not root:\n return 0\n\ndef dfs(node, dep, deps):\n if not node.left and (not node.right):\n deps.append(dep)\n return\n if node.left:\n dfs(node.left, dep + 1, deps)\n if node.right:\n dfs(node.right, dep + 1, deps)\ndeps = []\ndfs(node, 0, deps)\nreturn max(deps)", "i...
<|body_start_0|> if not root: return 0 def dfs(node, dep, deps): if not node.left and (not node.right): deps.append(dep) return if node.left: dfs(node.left, dep + 1, deps) if node.right: dfs(...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxDepth(self, root): """pretty fast, but need maintain a list.""" <|body_0|> def maxDepth(self, root): """do not need to maintain a list but little slower because need to call max every recursion.""" <|body_1|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_36k_train_032984
1,320
no_license
[ { "docstring": "pretty fast, but need maintain a list.", "name": "maxDepth", "signature": "def maxDepth(self, root)" }, { "docstring": "do not need to maintain a list but little slower because need to call max every recursion.", "name": "maxDepth", "signature": "def maxDepth(self, root)"...
2
stack_v2_sparse_classes_30k_train_005909
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxDepth(self, root): pretty fast, but need maintain a list. - def maxDepth(self, root): do not need to maintain a list but little slower because need to call max every recur...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxDepth(self, root): pretty fast, but need maintain a list. - def maxDepth(self, root): do not need to maintain a list but little slower because need to call max every recur...
eafadd711f6ec1b60d78442280f1c44b6296209d
<|skeleton|> class Solution: def maxDepth(self, root): """pretty fast, but need maintain a list.""" <|body_0|> def maxDepth(self, root): """do not need to maintain a list but little slower because need to call max every recursion.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxDepth(self, root): """pretty fast, but need maintain a list.""" if not root: return 0 def dfs(node, dep, deps): if not node.left and (not node.right): deps.append(dep) return if node.left: ...
the_stack_v2_python_sparse
cyc/tree/recursion/104.py
Veraph/LeetCode_Practice
train
0
b7d755196d8f0dc08a47237e70227f2d1ceb84fc
[ "super().__init__()\npygame.sprite.Sprite.__init__(self)\nsprite_sheet = SpriteSheet('Lava.png')\nimage = sprite_sheet.get_image(spriteCho[0], spriteCho[1], spriteCho[2], spriteCho[3])\nself.image = image\nself.rect = self.image.get_rect()", "self.rect.x += 3\nif self.rect.x >= constants.SCREEN_WIDTH:\n self.r...
<|body_start_0|> super().__init__() pygame.sprite.Sprite.__init__(self) sprite_sheet = SpriteSheet('Lava.png') image = sprite_sheet.get_image(spriteCho[0], spriteCho[1], spriteCho[2], spriteCho[3]) self.image = image self.rect = self.image.get_rect() <|end_body_0|> <|bod...
The lava
lava
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class lava: """The lava""" def __init__(self, spriteCho): """:param spriteCho: The chosen sprite to use""" <|body_0|> def update(self): """Updates lava, making it move to the right""" <|body_1|> <|end_skeleton|> <|body_start_0|> super().__init__() ...
stack_v2_sparse_classes_36k_train_032985
7,514
no_license
[ { "docstring": ":param spriteCho: The chosen sprite to use", "name": "__init__", "signature": "def __init__(self, spriteCho)" }, { "docstring": "Updates lava, making it move to the right", "name": "update", "signature": "def update(self)" } ]
2
null
Implement the Python class `lava` described below. Class description: The lava Method signatures and docstrings: - def __init__(self, spriteCho): :param spriteCho: The chosen sprite to use - def update(self): Updates lava, making it move to the right
Implement the Python class `lava` described below. Class description: The lava Method signatures and docstrings: - def __init__(self, spriteCho): :param spriteCho: The chosen sprite to use - def update(self): Updates lava, making it move to the right <|skeleton|> class lava: """The lava""" def __init__(self...
56fbcfc786dfc373f477270468f06e31b6271749
<|skeleton|> class lava: """The lava""" def __init__(self, spriteCho): """:param spriteCho: The chosen sprite to use""" <|body_0|> def update(self): """Updates lava, making it move to the right""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class lava: """The lava""" def __init__(self, spriteCho): """:param spriteCho: The chosen sprite to use""" super().__init__() pygame.sprite.Sprite.__init__(self) sprite_sheet = SpriteSheet('Lava.png') image = sprite_sheet.get_image(spriteCho[0], spriteCho[1], spriteCho[2...
the_stack_v2_python_sparse
Doki Doki Island/platforms.py
cashpop5000/DokiProject
train
0
2b896966bd93afb60e6662b5400c54aa3edef7ff
[ "full_layer_specs = []\nfor i, layer_spec in enumerate(layer_specs):\n full_layer_spec = [3, layer_spec[0], layer_spec[1], 1]\n full_layer_specs.append(full_layer_spec)\nsuper().__init__(name=name, layer_specs=full_layer_specs, activation_fn=activation_fn, last_activation_fn=None, regularizer=regularizer, pad...
<|body_start_0|> full_layer_specs = [] for i, layer_spec in enumerate(layer_specs): full_layer_spec = [3, layer_spec[0], layer_spec[1], 1] full_layer_specs.append(full_layer_spec) super().__init__(name=name, layer_specs=full_layer_specs, activation_fn=activation_fn, last_...
LateralConnection
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LateralConnection: def __init__(self, name, layer_specs, activation_fn=leaky_relu, total_dropout_rate=0.0, regularizer=None): """:param name: Str. For variable scoping. :param layer_specs: Array of shape [num_layers, 2]. Constrained version of parent class' layer_specs. The second dimens...
stack_v2_sparse_classes_36k_train_032986
6,555
no_license
[ { "docstring": ":param name: Str. For variable scoping. :param layer_specs: Array of shape [num_layers, 2]. Constrained version of parent class' layer_specs. The second dimension consists of [num_output_features, dilation]. :param activation_fn: Tensorflow activation function. This will not be applied on the la...
2
stack_v2_sparse_classes_30k_train_001007
Implement the Python class `LateralConnection` described below. Class description: Implement the LateralConnection class. Method signatures and docstrings: - def __init__(self, name, layer_specs, activation_fn=leaky_relu, total_dropout_rate=0.0, regularizer=None): :param name: Str. For variable scoping. :param layer_...
Implement the Python class `LateralConnection` described below. Class description: Implement the LateralConnection class. Method signatures and docstrings: - def __init__(self, name, layer_specs, activation_fn=leaky_relu, total_dropout_rate=0.0, regularizer=None): :param name: Str. For variable scoping. :param layer_...
494d503c729ba018614fc742f1aee1e48d37127e
<|skeleton|> class LateralConnection: def __init__(self, name, layer_specs, activation_fn=leaky_relu, total_dropout_rate=0.0, regularizer=None): """:param name: Str. For variable scoping. :param layer_specs: Array of shape [num_layers, 2]. Constrained version of parent class' layer_specs. The second dimens...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LateralConnection: def __init__(self, name, layer_specs, activation_fn=leaky_relu, total_dropout_rate=0.0, regularizer=None): """:param name: Str. For variable scoping. :param layer_specs: Array of shape [num_layers, 2]. Constrained version of parent class' layer_specs. The second dimension consists o...
the_stack_v2_python_sparse
context_interp/gridnet/connections/connections.py
NeedsMorePie/interpolator
train
2
34b4d9c6f074d754ac6e2897cdb3ce524fddddde
[ "filePath = os.path.join(templatePath, 'python')\nself.env = jinja2.Environment(loader=jinja2.FileSystemLoader(filePath))\nself.modelTemplate = self.env.get_template('model.template')\nself.exportPath = exportPath", "ds = mysql_export_db_model.MysqlExportDbModel().export_model(conf)\nprint(ds)\nmodelPath = os.pat...
<|body_start_0|> filePath = os.path.join(templatePath, 'python') self.env = jinja2.Environment(loader=jinja2.FileSystemLoader(filePath)) self.modelTemplate = self.env.get_template('model.template') self.exportPath = exportPath <|end_body_0|> <|body_start_1|> ds = mysql_export_db...
PythonModelGenerate
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PythonModelGenerate: def __init__(self, templatePath: str, exportPath: str): """初始化 Args: templatePath (str): 模板路径 exportPath (str): 输出路径""" <|body_0|> def generate_model_file(self, conf: config_model.DataSourceConfig): """生成bo po文件 Args: conf (config_model.DataSourc...
stack_v2_sparse_classes_36k_train_032987
1,529
no_license
[ { "docstring": "初始化 Args: templatePath (str): 模板路径 exportPath (str): 输出路径", "name": "__init__", "signature": "def __init__(self, templatePath: str, exportPath: str)" }, { "docstring": "生成bo po文件 Args: conf (config_model.DataSourceConfig): [description] ds (ds_model.DataSourceModel): [description...
2
stack_v2_sparse_classes_30k_train_013127
Implement the Python class `PythonModelGenerate` described below. Class description: Implement the PythonModelGenerate class. Method signatures and docstrings: - def __init__(self, templatePath: str, exportPath: str): 初始化 Args: templatePath (str): 模板路径 exportPath (str): 输出路径 - def generate_model_file(self, conf: conf...
Implement the Python class `PythonModelGenerate` described below. Class description: Implement the PythonModelGenerate class. Method signatures and docstrings: - def __init__(self, templatePath: str, exportPath: str): 初始化 Args: templatePath (str): 模板路径 exportPath (str): 输出路径 - def generate_model_file(self, conf: conf...
8763e5ead6be54a2cb03f5e8dabde1a7957b3aa6
<|skeleton|> class PythonModelGenerate: def __init__(self, templatePath: str, exportPath: str): """初始化 Args: templatePath (str): 模板路径 exportPath (str): 输出路径""" <|body_0|> def generate_model_file(self, conf: config_model.DataSourceConfig): """生成bo po文件 Args: conf (config_model.DataSourc...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PythonModelGenerate: def __init__(self, templatePath: str, exportPath: str): """初始化 Args: templatePath (str): 模板路径 exportPath (str): 输出路径""" filePath = os.path.join(templatePath, 'python') self.env = jinja2.Environment(loader=jinja2.FileSystemLoader(filePath)) self.modelTemplat...
the_stack_v2_python_sparse
soc_common/tools/code/code_generate/python/generate_model_by_db.py
treeyh/soc-python-common
train
1
028ee31e186cfe465f00c8969a46595e35492c60
[ "model = GmmHmmLikelihoodSimilarity(None, None, None, loadModel=True)\nwith open(modelLoadPath, 'rb') as fl:\n loadDict = pickle.load(fl)\nmodel.model = loadDict['model']\nmodel.closestLikelihoodObsDiff = loadDict['closestLikelihoodObsDiff']\nmodel.dimension = loadDict['dimension']\nreturn model", "if loadMode...
<|body_start_0|> model = GmmHmmLikelihoodSimilarity(None, None, None, loadModel=True) with open(modelLoadPath, 'rb') as fl: loadDict = pickle.load(fl) model.model = loadDict['model'] model.closestLikelihoodObsDiff = loadDict['closestLikelihoodObsDiff'] model.dimension...
GMM-HMM forecasting model based on the paper: "Stock Market Forecasting Using Hidden Markov Model: A New Approach Md. Rafiul Hassan and Baikunth Nath, The University of Melbourne, Carlton 3010, Australia" link: http://mleg.cse.sc.edu/edu/csce768/uploads/Main.ReadingList/HMM-stock.pdf
GmmHmmLikelihoodSimilarity
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GmmHmmLikelihoodSimilarity: """GMM-HMM forecasting model based on the paper: "Stock Market Forecasting Using Hidden Markov Model: A New Approach Md. Rafiul Hassan and Baikunth Nath, The University of Melbourne, Carlton 3010, Australia" link: http://mleg.cse.sc.edu/edu/csce768/uploads/Main.Reading...
stack_v2_sparse_classes_36k_train_032988
8,041
no_license
[ { "docstring": "Loads the model from the provided filepath :param modelLoadPath: path from where to load the model :return: model which is loaded from the given path", "name": "load", "signature": "def load(modelLoadPath)" }, { "docstring": "Initialize GMM-HMM model using the provided parameters...
5
null
Implement the Python class `GmmHmmLikelihoodSimilarity` described below. Class description: GMM-HMM forecasting model based on the paper: "Stock Market Forecasting Using Hidden Markov Model: A New Approach Md. Rafiul Hassan and Baikunth Nath, The University of Melbourne, Carlton 3010, Australia" link: http://mleg.cse....
Implement the Python class `GmmHmmLikelihoodSimilarity` described below. Class description: GMM-HMM forecasting model based on the paper: "Stock Market Forecasting Using Hidden Markov Model: A New Approach Md. Rafiul Hassan and Baikunth Nath, The University of Melbourne, Carlton 3010, Australia" link: http://mleg.cse....
62f6fa0d5e832d2d1786eae729d9462b78d9b459
<|skeleton|> class GmmHmmLikelihoodSimilarity: """GMM-HMM forecasting model based on the paper: "Stock Market Forecasting Using Hidden Markov Model: A New Approach Md. Rafiul Hassan and Baikunth Nath, The University of Melbourne, Carlton 3010, Australia" link: http://mleg.cse.sc.edu/edu/csce768/uploads/Main.Reading...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GmmHmmLikelihoodSimilarity: """GMM-HMM forecasting model based on the paper: "Stock Market Forecasting Using Hidden Markov Model: A New Approach Md. Rafiul Hassan and Baikunth Nath, The University of Melbourne, Carlton 3010, Australia" link: http://mleg.cse.sc.edu/edu/csce768/uploads/Main.ReadingList/HMM-stoc...
the_stack_v2_python_sparse
ts/model/gmm_hmm_likelihood_similarity.py
tedlaw09/time_series_forecaster
train
1
4b6067c100ce6a7b09cdbe428f242c7ec8bc52ac
[ "self.s = compressedString\nself.idx = 0\nself.c = ''\nself.count = 0\nself.hasNext()", "if self.count == 0:\n if not self.hasNext():\n return ' '\nself.count -= 1\nreturn self.c", "if self.count > 0:\n return True\nif self.idx >= len(self.s):\n self.count = 0\n return False\nself.c = self.s[...
<|body_start_0|> self.s = compressedString self.idx = 0 self.c = '' self.count = 0 self.hasNext() <|end_body_0|> <|body_start_1|> if self.count == 0: if not self.hasNext(): return ' ' self.count -= 1 return self.c <|end_body_1|...
StringIterator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StringIterator: def __init__(self, compressedString): """:type compressedString: str""" <|body_0|> def next(self): """:rtype: str""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end_skeleton|> <|body_start_0|> s...
stack_v2_sparse_classes_36k_train_032989
2,052
no_license
[ { "docstring": ":type compressedString: str", "name": "__init__", "signature": "def __init__(self, compressedString)" }, { "docstring": ":rtype: str", "name": "next", "signature": "def next(self)" }, { "docstring": ":rtype: bool", "name": "hasNext", "signature": "def hasN...
3
null
Implement the Python class `StringIterator` described below. Class description: Implement the StringIterator class. Method signatures and docstrings: - def __init__(self, compressedString): :type compressedString: str - def next(self): :rtype: str - def hasNext(self): :rtype: bool
Implement the Python class `StringIterator` described below. Class description: Implement the StringIterator class. Method signatures and docstrings: - def __init__(self, compressedString): :type compressedString: str - def next(self): :rtype: str - def hasNext(self): :rtype: bool <|skeleton|> class StringIterator: ...
9190d3d178f1733aa226973757ee7e045b7bab00
<|skeleton|> class StringIterator: def __init__(self, compressedString): """:type compressedString: str""" <|body_0|> def next(self): """:rtype: str""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StringIterator: def __init__(self, compressedString): """:type compressedString: str""" self.s = compressedString self.idx = 0 self.c = '' self.count = 0 self.hasNext() def next(self): """:rtype: str""" if self.count == 0: if not...
the_stack_v2_python_sparse
DesignCompressedStringIterator.py
ellinx/LC-python
train
1
da1b082ea60ba91fd8143cb7914b313a29004fc9
[ "user_object = User.objects.get(pk=request.user.pk)\nprofile_data = {}\ntry:\n profile = UserProfile.objects.get(user_id=request.user.pk)\n profile_data = model_to_dict(profile, fields=['recording_time', 'parental_lock', 'package'])\nexcept ObjectDoesNotExist:\n pass\nuser_data = model_to_dict(user_object,...
<|body_start_0|> user_object = User.objects.get(pk=request.user.pk) profile_data = {} try: profile = UserProfile.objects.get(user_id=request.user.pk) profile_data = model_to_dict(profile, fields=['recording_time', 'parental_lock', 'package']) except ObjectDoesNotE...
This View handles retreiving and updating of users profile
ProfileView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProfileView: """This View handles retreiving and updating of users profile""" def get(self, request): """Retreive a users profile without their security answer and question""" <|body_0|> def patch(self, request): """Update a users profile""" <|body_1|> <...
stack_v2_sparse_classes_36k_train_032990
11,267
no_license
[ { "docstring": "Retreive a users profile without their security answer and question", "name": "get", "signature": "def get(self, request)" }, { "docstring": "Update a users profile", "name": "patch", "signature": "def patch(self, request)" } ]
2
stack_v2_sparse_classes_30k_test_000248
Implement the Python class `ProfileView` described below. Class description: This View handles retreiving and updating of users profile Method signatures and docstrings: - def get(self, request): Retreive a users profile without their security answer and question - def patch(self, request): Update a users profile
Implement the Python class `ProfileView` described below. Class description: This View handles retreiving and updating of users profile Method signatures and docstrings: - def get(self, request): Retreive a users profile without their security answer and question - def patch(self, request): Update a users profile <|...
5dcda7b791a8f0c71d2b176f0f27c4a9e85ccea0
<|skeleton|> class ProfileView: """This View handles retreiving and updating of users profile""" def get(self, request): """Retreive a users profile without their security answer and question""" <|body_0|> def patch(self, request): """Update a users profile""" <|body_1|> <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProfileView: """This View handles retreiving and updating of users profile""" def get(self, request): """Retreive a users profile without their security answer and question""" user_object = User.objects.get(pk=request.user.pk) profile_data = {} try: profile = U...
the_stack_v2_python_sparse
authentication/v3views.py
rk110047/ipserver
train
0
61c5b9172e39000306c6b65cb5f00ffe6915601d
[ "n = len(nums)\nq = [(-nums[i], i) for i in range(k)]\nheapq.heapify(q)\nres = [-q[0][0]]\nfor i in range(k, n):\n heapq.heappush(q, (-nums[i], i))\n while q[0][1] <= i - k:\n heapq.heappop(q)\n res.append(-q[0][0])\nreturn res", "n = len(nums)\nif n == 0:\n return []\nres = []\nwindow = deque(...
<|body_start_0|> n = len(nums) q = [(-nums[i], i) for i in range(k)] heapq.heapify(q) res = [-q[0][0]] for i in range(k, n): heapq.heappush(q, (-nums[i], i)) while q[0][1] <= i - k: heapq.heappop(q) res.append(-q[0][0]) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxSlidingWindow(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[int]""" <|body_0|> def maxSlidingWindow(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_36k_train_032991
1,548
no_license
[ { "docstring": ":type nums: List[int] :type k: int :rtype: List[int]", "name": "maxSlidingWindow", "signature": "def maxSlidingWindow(self, nums, k)" }, { "docstring": ":type nums: List[int] :type k: int :rtype: List[int]", "name": "maxSlidingWindow", "signature": "def maxSlidingWindow(s...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSlidingWindow(self, nums, k): :type nums: List[int] :type k: int :rtype: List[int] - def maxSlidingWindow(self, nums, k): :type nums: List[int] :type k: int :rtype: List[i...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSlidingWindow(self, nums, k): :type nums: List[int] :type k: int :rtype: List[int] - def maxSlidingWindow(self, nums, k): :type nums: List[int] :type k: int :rtype: List[i...
a509b383a42f54313970168d9faa11f088f18708
<|skeleton|> class Solution: def maxSlidingWindow(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[int]""" <|body_0|> def maxSlidingWindow(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxSlidingWindow(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[int]""" n = len(nums) q = [(-nums[i], i) for i in range(k)] heapq.heapify(q) res = [-q[0][0]] for i in range(k, n): heapq.heappush(q, (-nums[i], i)) ...
the_stack_v2_python_sparse
0239_Sliding_Window_Maximum.py
bingli8802/leetcode
train
0
7d2bf70a1736b50409a315ef6f4f601f3d63e250
[ "super(Matern52, self).__init__(n_dims=n_dims, active_dims=active_dims, name=name)\nlogger.debug('Initializing %s kernel.' % self.name)\nself.variance = np.float64(variance)\nself.lengthscale = np.float64(lengthscale)\nself.parameter_list = ['variance', 'lengthscale']\nself.constraint_map = {'variance': '+ve', 'len...
<|body_start_0|> super(Matern52, self).__init__(n_dims=n_dims, active_dims=active_dims, name=name) logger.debug('Initializing %s kernel.' % self.name) self.variance = np.float64(variance) self.lengthscale = np.float64(lengthscale) self.parameter_list = ['variance', 'lengthscale']...
Matern52
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Matern52: def __init__(self, n_dims, variance=1.0, lengthscale=1.0, active_dims=None, name=None): """squared exponential kernel Inputs: n_dims : number of dimensions variance : kernel variance lengthscale : kernel lengthscale active_dims : all dims active by default, subset can be specif...
stack_v2_sparse_classes_36k_train_032992
9,047
no_license
[ { "docstring": "squared exponential kernel Inputs: n_dims : number of dimensions variance : kernel variance lengthscale : kernel lengthscale active_dims : all dims active by default, subset can be specified", "name": "__init__", "signature": "def __init__(self, n_dims, variance=1.0, lengthscale=1.0, act...
2
stack_v2_sparse_classes_30k_train_018083
Implement the Python class `Matern52` described below. Class description: Implement the Matern52 class. Method signatures and docstrings: - def __init__(self, n_dims, variance=1.0, lengthscale=1.0, active_dims=None, name=None): squared exponential kernel Inputs: n_dims : number of dimensions variance : kernel varianc...
Implement the Python class `Matern52` described below. Class description: Implement the Matern52 class. Method signatures and docstrings: - def __init__(self, n_dims, variance=1.0, lengthscale=1.0, active_dims=None, name=None): squared exponential kernel Inputs: n_dims : number of dimensions variance : kernel varianc...
1bed882b8a94ee58fd0bde6920ee85f81ffb77bb
<|skeleton|> class Matern52: def __init__(self, n_dims, variance=1.0, lengthscale=1.0, active_dims=None, name=None): """squared exponential kernel Inputs: n_dims : number of dimensions variance : kernel variance lengthscale : kernel lengthscale active_dims : all dims active by default, subset can be specif...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Matern52: def __init__(self, n_dims, variance=1.0, lengthscale=1.0, active_dims=None, name=None): """squared exponential kernel Inputs: n_dims : number of dimensions variance : kernel variance lengthscale : kernel lengthscale active_dims : all dims active by default, subset can be specified""" ...
the_stack_v2_python_sparse
gp_grief/kern/stationary.py
scwolof/gp_grief
train
2
d4eb0db0e548f45c61ec98bbf9476ef9f91f4251
[ "super(MultiHeadedAttention, self).__init__()\nassert d_model % h == 0\nself.d_k = d_model // h\nself.h = h\nself.linears = clones(nn.Linear(d_model, d_model), 4)\nself.attn = None\nself.dropout = nn.Dropout(p=dropout)", "if mask is not None:\n mask = mask.unsqueeze(1)\nnbatches = query.size(0)\nquery, key, va...
<|body_start_0|> super(MultiHeadedAttention, self).__init__() assert d_model % h == 0 self.d_k = d_model // h self.h = h self.linears = clones(nn.Linear(d_model, d_model), 4) self.attn = None self.dropout = nn.Dropout(p=dropout) <|end_body_0|> <|body_start_1|> ...
MultiHeadedAttention
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiHeadedAttention: def __init__(self, h, d_model, dropout=0.1): """Take in model size and number of heads.""" <|body_0|> def forward(self, query, key, value, mask=None): """Implements Figure 2""" <|body_1|> <|end_skeleton|> <|body_start_0|> super...
stack_v2_sparse_classes_36k_train_032993
29,163
no_license
[ { "docstring": "Take in model size and number of heads.", "name": "__init__", "signature": "def __init__(self, h, d_model, dropout=0.1)" }, { "docstring": "Implements Figure 2", "name": "forward", "signature": "def forward(self, query, key, value, mask=None)" } ]
2
stack_v2_sparse_classes_30k_train_005691
Implement the Python class `MultiHeadedAttention` described below. Class description: Implement the MultiHeadedAttention class. Method signatures and docstrings: - def __init__(self, h, d_model, dropout=0.1): Take in model size and number of heads. - def forward(self, query, key, value, mask=None): Implements Figure ...
Implement the Python class `MultiHeadedAttention` described below. Class description: Implement the MultiHeadedAttention class. Method signatures and docstrings: - def __init__(self, h, d_model, dropout=0.1): Take in model size and number of heads. - def forward(self, query, key, value, mask=None): Implements Figure ...
d0c7f5872d7965f832a4122bb2ee63536406eb14
<|skeleton|> class MultiHeadedAttention: def __init__(self, h, d_model, dropout=0.1): """Take in model size and number of heads.""" <|body_0|> def forward(self, query, key, value, mask=None): """Implements Figure 2""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiHeadedAttention: def __init__(self, h, d_model, dropout=0.1): """Take in model size and number of heads.""" super(MultiHeadedAttention, self).__init__() assert d_model % h == 0 self.d_k = d_model // h self.h = h self.linears = clones(nn.Linear(d_model, d_mo...
the_stack_v2_python_sparse
Attention_is_all_you_need.py
Beira-BF/EatPytorch
train
2
8371054e14af4463292b2d89bd3e6f1696336d5d
[ "class _Simple:\n pass\nr = pcapy.open_offline(TestPcapy._96PINGS)\nself.assertEqual(sys.getrefcount(r.next()[0]), sys.getrefcount(_Simple()))", "class _Simple:\n pass\nr = pcapy.open_offline(TestPcapy._96PINGS)\ni = 0\nrefNone = sys.getrefcount(None)\ns = r.next()\nwhile not s[0] is None:\n s = r.next()...
<|body_start_0|> class _Simple: pass r = pcapy.open_offline(TestPcapy._96PINGS) self.assertEqual(sys.getrefcount(r.next()[0]), sys.getrefcount(_Simple())) <|end_body_0|> <|body_start_1|> class _Simple: pass r = pcapy.open_offline(TestPcapy._96PINGS) ...
TestPcapy
[ "Apache-2.0", "Apache-1.1", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestPcapy: def testPacketHeaderRefCount(self): """#1:when next() creates a pkthdr it make one extra reference""" <|body_0|> def testEOFValue(self): """#1:when next() creates a pkthdr it make one extra reference""" <|body_1|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_36k_train_032994
1,545
permissive
[ { "docstring": "#1:when next() creates a pkthdr it make one extra reference", "name": "testPacketHeaderRefCount", "signature": "def testPacketHeaderRefCount(self)" }, { "docstring": "#1:when next() creates a pkthdr it make one extra reference", "name": "testEOFValue", "signature": "def t...
2
stack_v2_sparse_classes_30k_train_010318
Implement the Python class `TestPcapy` described below. Class description: Implement the TestPcapy class. Method signatures and docstrings: - def testPacketHeaderRefCount(self): #1:when next() creates a pkthdr it make one extra reference - def testEOFValue(self): #1:when next() creates a pkthdr it make one extra refe...
Implement the Python class `TestPcapy` described below. Class description: Implement the TestPcapy class. Method signatures and docstrings: - def testPacketHeaderRefCount(self): #1:when next() creates a pkthdr it make one extra reference - def testEOFValue(self): #1:when next() creates a pkthdr it make one extra refe...
8f929d72cd28275e1a841c8d949955b5573236a7
<|skeleton|> class TestPcapy: def testPacketHeaderRefCount(self): """#1:when next() creates a pkthdr it make one extra reference""" <|body_0|> def testEOFValue(self): """#1:when next() creates a pkthdr it make one extra reference""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestPcapy: def testPacketHeaderRefCount(self): """#1:when next() creates a pkthdr it make one extra reference""" class _Simple: pass r = pcapy.open_offline(TestPcapy._96PINGS) self.assertEqual(sys.getrefcount(r.next()[0]), sys.getrefcount(_Simple())) def testEO...
the_stack_v2_python_sparse
pkgs/pcapy-0.10.8/build/scripts-2.7/pcapytests.py
DsRoyster/DeadlineRouting
train
2
777e01cd540052ebf0205b6c83fe8bec94722ae9
[ "email = self.cleaned_data['email']\ntry:\n User.objects.get(email=email)\nexcept User.DoesNotExist:\n return email\nraise forms.ValidationError(self.error_messages['duplicate_email'], code='duplicate_email')", "password1 = self.cleaned_data.get('password1')\npassword2 = self.cleaned_data.get('password2')\n...
<|body_start_0|> email = self.cleaned_data['email'] try: User.objects.get(email=email) except User.DoesNotExist: return email raise forms.ValidationError(self.error_messages['duplicate_email'], code='duplicate_email') <|end_body_0|> <|body_start_1|> passw...
A form for creating new users. Includes all the required fields, plus a repeated password.
UserCreationForm
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserCreationForm: """A form for creating new users. Includes all the required fields, plus a repeated password.""" def clean_email(self): """Clean form email. :return str email: cleaned email :raise forms.ValidationError: Email is duplicated""" <|body_0|> def clean_passw...
stack_v2_sparse_classes_36k_train_032995
10,735
permissive
[ { "docstring": "Clean form email. :return str email: cleaned email :raise forms.ValidationError: Email is duplicated", "name": "clean_email", "signature": "def clean_email(self)" }, { "docstring": "Check that the two password entries match. :return str password2: cleaned password2 :raise forms.V...
3
stack_v2_sparse_classes_30k_train_000018
Implement the Python class `UserCreationForm` described below. Class description: A form for creating new users. Includes all the required fields, plus a repeated password. Method signatures and docstrings: - def clean_email(self): Clean form email. :return str email: cleaned email :raise forms.ValidationError: Email...
Implement the Python class `UserCreationForm` described below. Class description: A form for creating new users. Includes all the required fields, plus a repeated password. Method signatures and docstrings: - def clean_email(self): Clean form email. :return str email: cleaned email :raise forms.ValidationError: Email...
27ecc4b1a0d4e1bf479f8a8848a02374478f92cd
<|skeleton|> class UserCreationForm: """A form for creating new users. Includes all the required fields, plus a repeated password.""" def clean_email(self): """Clean form email. :return str email: cleaned email :raise forms.ValidationError: Email is duplicated""" <|body_0|> def clean_passw...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserCreationForm: """A form for creating new users. Includes all the required fields, plus a repeated password.""" def clean_email(self): """Clean form email. :return str email: cleaned email :raise forms.ValidationError: Email is duplicated""" email = self.cleaned_data['email'] t...
the_stack_v2_python_sparse
src/users/forms.py
twtrubiks/pycon.tw
train
1
18363a04382446d58b09b64db8aa1c2f22ea617f
[ "PanZoomCamera.__init__(self, *args, **kwargs)\nself._ax = 0 if sc_axis == 'x' else 1\nself._limits = limits\nself._smooth = smooth", "if event.handled or not self.interactive:\n return\nBaseCamera.viewbox_mouse_event(self, event)\nif event.type == 'mouse_wheel':\n pos = list(self.rect.pos)\n ax = self._...
<|body_start_0|> PanZoomCamera.__init__(self, *args, **kwargs) self._ax = 0 if sc_axis == 'x' else 1 self._limits = limits self._smooth = smooth <|end_body_0|> <|body_start_1|> if event.handled or not self.interactive: return BaseCamera.viewbox_mouse_event(se...
Scrolling camera. Parameters ---------- args : tuple Arguments to pass to the PanZoom camera. sc_axis : {'x', 'y'} Scrolling axes. limits : tuple | None Tuple of floats describing the axis limits. smooth : float | 1. Scrolling smooth factor. Higher values can be used to reduce the scrolling. kwargs : dict | {} Optional...
ScrollCamera
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScrollCamera: """Scrolling camera. Parameters ---------- args : tuple Arguments to pass to the PanZoom camera. sc_axis : {'x', 'y'} Scrolling axes. limits : tuple | None Tuple of floats describing the axis limits. smooth : float | 1. Scrolling smooth factor. Higher values can be used to reduce th...
stack_v2_sparse_classes_36k_train_032996
7,133
permissive
[ { "docstring": "Init.", "name": "__init__", "signature": "def __init__(self, *args, sc_axis='x', limits=None, smooth=1.0, **kwargs)" }, { "docstring": "Ignore mouse event.", "name": "viewbox_mouse_event", "signature": "def viewbox_mouse_event(self, event)" } ]
2
null
Implement the Python class `ScrollCamera` described below. Class description: Scrolling camera. Parameters ---------- args : tuple Arguments to pass to the PanZoom camera. sc_axis : {'x', 'y'} Scrolling axes. limits : tuple | None Tuple of floats describing the axis limits. smooth : float | 1. Scrolling smooth factor....
Implement the Python class `ScrollCamera` described below. Class description: Scrolling camera. Parameters ---------- args : tuple Arguments to pass to the PanZoom camera. sc_axis : {'x', 'y'} Scrolling axes. limits : tuple | None Tuple of floats describing the axis limits. smooth : float | 1. Scrolling smooth factor....
be096aa8a7058c329e7120d0bdb45d3c9eb8be42
<|skeleton|> class ScrollCamera: """Scrolling camera. Parameters ---------- args : tuple Arguments to pass to the PanZoom camera. sc_axis : {'x', 'y'} Scrolling axes. limits : tuple | None Tuple of floats describing the axis limits. smooth : float | 1. Scrolling smooth factor. Higher values can be used to reduce th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ScrollCamera: """Scrolling camera. Parameters ---------- args : tuple Arguments to pass to the PanZoom camera. sc_axis : {'x', 'y'} Scrolling axes. limits : tuple | None Tuple of floats describing the axis limits. smooth : float | 1. Scrolling smooth factor. Higher values can be used to reduce the scrolling. ...
the_stack_v2_python_sparse
visbrain/utils/cameras.py
lassemadsen/visbrain
train
0
7eeda109dbaff0e820cf0bce37e376d1e14f74e5
[ "cmd = config.DIFFUSION2NRRD_COMMAND\ncmd = cmd.replace('%diffusion_directory%', diffusion_directory)\ncmd = cmd.replace('%diffusion_nrrd%', diffusion_nrrd_file)\nsp = subprocess.Popen(['/bin/bash', '-c', cmd], bufsize=0, stdout=sys.stdout, stderr=sys.stderr)\nsp.communicate()", "cmd = config.NRRD2NII_COMMAND\ncm...
<|body_start_0|> cmd = config.DIFFUSION2NRRD_COMMAND cmd = cmd.replace('%diffusion_directory%', diffusion_directory) cmd = cmd.replace('%diffusion_nrrd%', diffusion_nrrd_file) sp = subprocess.Popen(['/bin/bash', '-c', cmd], bufsize=0, stdout=sys.stdout, stderr=sys.stderr) sp.comm...
Preparation steps and actions (Quality Control). Inspired by https://gist.github.com/satra/5578926
Preparation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Preparation: """Preparation steps and actions (Quality Control). Inspired by https://gist.github.com/satra/5578926""" def diffusion2nrrd(diffusion_directory, diffusion_nrrd_file): """Parse a diffusion DICOM series and create a .NRRD. diffusion_directory the diffusion DICOM directory ...
stack_v2_sparse_classes_36k_train_032997
2,265
no_license
[ { "docstring": "Parse a diffusion DICOM series and create a .NRRD. diffusion_directory the diffusion DICOM directory diffusion_nrrd_file the diffusion output file path", "name": "diffusion2nrrd", "signature": "def diffusion2nrrd(diffusion_directory, diffusion_nrrd_file)" }, { "docstring": "Conve...
3
stack_v2_sparse_classes_30k_test_000681
Implement the Python class `Preparation` described below. Class description: Preparation steps and actions (Quality Control). Inspired by https://gist.github.com/satra/5578926 Method signatures and docstrings: - def diffusion2nrrd(diffusion_directory, diffusion_nrrd_file): Parse a diffusion DICOM series and create a ...
Implement the Python class `Preparation` described below. Class description: Preparation steps and actions (Quality Control). Inspired by https://gist.github.com/satra/5578926 Method signatures and docstrings: - def diffusion2nrrd(diffusion_directory, diffusion_nrrd_file): Parse a diffusion DICOM series and create a ...
33df2096229240727ceaf4974f227056a79790e1
<|skeleton|> class Preparation: """Preparation steps and actions (Quality Control). Inspired by https://gist.github.com/satra/5578926""" def diffusion2nrrd(diffusion_directory, diffusion_nrrd_file): """Parse a diffusion DICOM series and create a .NRRD. diffusion_directory the diffusion DICOM directory ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Preparation: """Preparation steps and actions (Quality Control). Inspired by https://gist.github.com/satra/5578926""" def diffusion2nrrd(diffusion_directory, diffusion_nrrd_file): """Parse a diffusion DICOM series and create a .NRRD. diffusion_directory the diffusion DICOM directory diffusion_nrr...
the_stack_v2_python_sparse
_core/preparation.py
FNNDSC/F3000
train
0
5a1159fa16184c1d4523c5400782b40a1a23eef0
[ "if 'reference' in destination_config:\n es_config = config.get_value('es_index_setting/' + destination_config['reference'])\n es_config = merge(es_config, destination_config)\n assert es_config, 'the reference is not exist, reference={0}'.format(destination_config)\nelse:\n es_config = dict(destination...
<|body_start_0|> if 'reference' in destination_config: es_config = config.get_value('es_index_setting/' + destination_config['reference']) es_config = merge(es_config, destination_config) assert es_config, 'the reference is not exist, reference={0}'.format(destination_config)...
ElasticsearchSuggestDestination
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ElasticsearchSuggestDestination: def push(self, destination_config, data): """将数据推到ES,数据流的最后一步 :param destination_config: :param data: :param param: :return:""" <|body_0|> def clear(self, destination_config, param): """清除掉ES数据源中得所有数据 :param destination_config: :param...
stack_v2_sparse_classes_36k_train_032998
12,159
permissive
[ { "docstring": "将数据推到ES,数据流的最后一步 :param destination_config: :param data: :param param: :return:", "name": "push", "signature": "def push(self, destination_config, data)" }, { "docstring": "清除掉ES数据源中得所有数据 :param destination_config: :param data: :return:", "name": "clear", "signature": "de...
2
stack_v2_sparse_classes_30k_train_002363
Implement the Python class `ElasticsearchSuggestDestination` described below. Class description: Implement the ElasticsearchSuggestDestination class. Method signatures and docstrings: - def push(self, destination_config, data): 将数据推到ES,数据流的最后一步 :param destination_config: :param data: :param param: :return: - def clea...
Implement the Python class `ElasticsearchSuggestDestination` described below. Class description: Implement the ElasticsearchSuggestDestination class. Method signatures and docstrings: - def push(self, destination_config, data): 将数据推到ES,数据流的最后一步 :param destination_config: :param data: :param param: :return: - def clea...
a72b4e4d78b4375f69887e75abcc1e6a6782c551
<|skeleton|> class ElasticsearchSuggestDestination: def push(self, destination_config, data): """将数据推到ES,数据流的最后一步 :param destination_config: :param data: :param param: :return:""" <|body_0|> def clear(self, destination_config, param): """清除掉ES数据源中得所有数据 :param destination_config: :param...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ElasticsearchSuggestDestination: def push(self, destination_config, data): """将数据推到ES,数据流的最后一步 :param destination_config: :param data: :param param: :return:""" if 'reference' in destination_config: es_config = config.get_value('es_index_setting/' + destination_config['reference'])...
the_stack_v2_python_sparse
suggest/destinations.py
RitterHou/search_platform
train
0
317b9ce5345b881dee08757ac31de25088eb556d
[ "self.pokemon = pokemon\nself.action = None\nentries = []\nfor pokemon in self.pokemon.getTrainer().beltPokemon:\n entries.append(PokemonMenuEntry(pokemon, self.setAction))\nself.menu = Menu(entries, columns=2)\nscreen = SwitchMenuScreen(self.menu)\ncmds = {commands.UP: self.menu.up, commands.DOWN: self.menu.dow...
<|body_start_0|> self.pokemon = pokemon self.action = None entries = [] for pokemon in self.pokemon.getTrainer().beltPokemon: entries.append(PokemonMenuEntry(pokemon, self.setAction)) self.menu = Menu(entries, columns=2) screen = SwitchMenuScreen(self.menu) ...
Controller for Switch Menu
SwitchMenuController
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SwitchMenuController: """Controller for Switch Menu""" def __init__(self, pokemon, cancellable=True): """Initialize the Switch Menu""" <|body_0|> def setAction(self, entry): """Set the Chosen Action""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_032999
1,988
no_license
[ { "docstring": "Initialize the Switch Menu", "name": "__init__", "signature": "def __init__(self, pokemon, cancellable=True)" }, { "docstring": "Set the Chosen Action", "name": "setAction", "signature": "def setAction(self, entry)" } ]
2
stack_v2_sparse_classes_30k_train_011107
Implement the Python class `SwitchMenuController` described below. Class description: Controller for Switch Menu Method signatures and docstrings: - def __init__(self, pokemon, cancellable=True): Initialize the Switch Menu - def setAction(self, entry): Set the Chosen Action
Implement the Python class `SwitchMenuController` described below. Class description: Controller for Switch Menu Method signatures and docstrings: - def __init__(self, pokemon, cancellable=True): Initialize the Switch Menu - def setAction(self, entry): Set the Chosen Action <|skeleton|> class SwitchMenuController: ...
3931eee5fd04e18bb1738a0b27a4c6979dc4db01
<|skeleton|> class SwitchMenuController: """Controller for Switch Menu""" def __init__(self, pokemon, cancellable=True): """Initialize the Switch Menu""" <|body_0|> def setAction(self, entry): """Set the Chosen Action""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SwitchMenuController: """Controller for Switch Menu""" def __init__(self, pokemon, cancellable=True): """Initialize the Switch Menu""" self.pokemon = pokemon self.action = None entries = [] for pokemon in self.pokemon.getTrainer().beltPokemon: entries.a...
the_stack_v2_python_sparse
src/Screen/Pygame/Menu/ActionMenu/SwitchMenu/switch_menu_controller.py
sgtnourry/Pokemon-Project
train
0