blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
467
8.64k
id
stringlengths
40
40
length_bytes
int64
515
49.7k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
160
3.93k
prompted_full_text
stringlengths
681
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.09k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
331
8.3k
source
stringclasses
1 value
source_path
stringlengths
5
177
source_repo
stringlengths
6
88
split
stringclasses
1 value
star_events_count
int64
0
209k
ea9cd540f29c4f1fce25ec14930feed1d8616c9d
[ "budget = 0.5\nfor d in [100, 200]:\n for number_candidates in [2 ** 4, 2 ** 5]:\n for epsilon in [2, 3]:\n x = np.random.normal(0, 1, (d, 1))\n x = np.divide(x, np.linalg.norm(x, axis=0).reshape(1, -1))\n c1, c2, _, gamma = get_parameters.get_parameters_unbiased_miracle(e...
<|body_start_0|> budget = 0.5 for d in [100, 200]: for number_candidates in [2 ** 4, 2 ** 5]: for epsilon in [2, 3]: x = np.random.normal(0, 1, (d, 1)) x = np.divide(x, np.linalg.norm(x, axis=0).reshape(1, -1)) c1, c...
ModifyPiTest
[ "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModifyPiTest: def test_tilde_pi_is_a_distribution(self): """Test whether every distribution generated by modify_all sums to 1.""" <|body_0|> def test_tilde_pi_is_private(self): """Test whether tilde pi satisfies the DP constraint.""" <|body_1|> def test_...
stack_v2_sparse_classes_10k_train_006500
3,519
permissive
[ { "docstring": "Test whether every distribution generated by modify_all sums to 1.", "name": "test_tilde_pi_is_a_distribution", "signature": "def test_tilde_pi_is_a_distribution(self)" }, { "docstring": "Test whether tilde pi satisfies the DP constraint.", "name": "test_tilde_pi_is_private",...
3
stack_v2_sparse_classes_30k_train_000869
Implement the Python class `ModifyPiTest` described below. Class description: Implement the ModifyPiTest class. Method signatures and docstrings: - def test_tilde_pi_is_a_distribution(self): Test whether every distribution generated by modify_all sums to 1. - def test_tilde_pi_is_private(self): Test whether tilde pi ...
Implement the Python class `ModifyPiTest` described below. Class description: Implement the ModifyPiTest class. Method signatures and docstrings: - def test_tilde_pi_is_a_distribution(self): Test whether every distribution generated by modify_all sums to 1. - def test_tilde_pi_is_private(self): Test whether tilde pi ...
329e60fa56b87f691303638ceb9dfa1fc5083953
<|skeleton|> class ModifyPiTest: def test_tilde_pi_is_a_distribution(self): """Test whether every distribution generated by modify_all sums to 1.""" <|body_0|> def test_tilde_pi_is_private(self): """Test whether tilde pi satisfies the DP constraint.""" <|body_1|> def test_...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ModifyPiTest: def test_tilde_pi_is_a_distribution(self): """Test whether every distribution generated by modify_all sums to 1.""" budget = 0.5 for d in [100, 200]: for number_candidates in [2 ** 4, 2 ** 5]: for epsilon in [2, 3]: x = np.r...
the_stack_v2_python_sparse
rcc_dp/modify_pi_test.py
google-research/federated
train
595
90ae74e091adac5620debf889b0bda6ac7e80037
[ "if s == None:\n return False\nif self.isSameTree(s, t):\n return True\nreturn self.isSubtree(s.left, t) or self.isSubtree(s.right, t)", "if t1 == None and t2 == None:\n return True\nif t1 == None or t2 == None:\n return False\nif t1.val == t2.val:\n left = self.isSameTree(t1.left, t2.left)\n ri...
<|body_start_0|> if s == None: return False if self.isSameTree(s, t): return True return self.isSubtree(s.left, t) or self.isSubtree(s.right, t) <|end_body_0|> <|body_start_1|> if t1 == None and t2 == None: return True if t1 == None or t2 == N...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isSubtree(self, s, t): """:type s: TreeNode :type t: TreeNode :rtype: bool""" <|body_0|> def isSameTree(self, t1, t2): """Returns if t1 and t2 are exactly the same tree""" <|body_1|> <|end_skeleton|> <|body_start_0|> if s == None: ...
stack_v2_sparse_classes_10k_train_006501
1,488
no_license
[ { "docstring": ":type s: TreeNode :type t: TreeNode :rtype: bool", "name": "isSubtree", "signature": "def isSubtree(self, s, t)" }, { "docstring": "Returns if t1 and t2 are exactly the same tree", "name": "isSameTree", "signature": "def isSameTree(self, t1, t2)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isSubtree(self, s, t): :type s: TreeNode :type t: TreeNode :rtype: bool - def isSameTree(self, t1, t2): Returns if t1 and t2 are exactly the same tree
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isSubtree(self, s, t): :type s: TreeNode :type t: TreeNode :rtype: bool - def isSameTree(self, t1, t2): Returns if t1 and t2 are exactly the same tree <|skeleton|> class Sol...
844f502da4d6fb9cd69cf0a1ef71da3385a4d2b4
<|skeleton|> class Solution: def isSubtree(self, s, t): """:type s: TreeNode :type t: TreeNode :rtype: bool""" <|body_0|> def isSameTree(self, t1, t2): """Returns if t1 and t2 are exactly the same tree""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def isSubtree(self, s, t): """:type s: TreeNode :type t: TreeNode :rtype: bool""" if s == None: return False if self.isSameTree(s, t): return True return self.isSubtree(s.left, t) or self.isSubtree(s.right, t) def isSameTree(self, t1, t2):...
the_stack_v2_python_sparse
572-subtree_of_another_tree.py
stevestar888/leetcode-problems
train
2
24081bea73b4c503c2ea7969c412baef7baf5858
[ "self.n_inputs = n_inputs\nself.n_hiddens = n_hiddens\nself.s_act = s_act\nself.t_act = t_act\nself.n_layers = n_layers\nself.batch_norm = batch_norm\nself.input = tt.matrix('x')\nself.u = self.input\nlogdet_dudx = 0.0\nmask = theano.shared(np.arange(n_inputs, dtype=dtype) % 2, borrow=True)\nself.layers = []\nself....
<|body_start_0|> self.n_inputs = n_inputs self.n_hiddens = n_hiddens self.s_act = s_act self.t_act = t_act self.n_layers = n_layers self.batch_norm = batch_norm self.input = tt.matrix('x') self.u = self.input logdet_dudx = 0.0 mask = theano...
Real NVP, see Dinh et al, "Density estimation using Real NVP", 2016
RealNVP
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RealNVP: """Real NVP, see Dinh et al, "Density estimation using Real NVP", 2016""" def __init__(self, n_inputs, n_hiddens, s_act, t_act, n_layers, batch_norm=True): """Constructor. :param n_inputs: int, number of inputs :param n_hiddens: list of hidden widths for the nets in the coup...
stack_v2_sparse_classes_10k_train_006502
15,147
permissive
[ { "docstring": "Constructor. :param n_inputs: int, number of inputs :param n_hiddens: list of hidden widths for the nets in the coupling layers :param s_act: string, activation function for the scale net :param t_act: string, activation function for the translate net :param n_layers: int, number of coupling lay...
4
stack_v2_sparse_classes_30k_train_002930
Implement the Python class `RealNVP` described below. Class description: Real NVP, see Dinh et al, "Density estimation using Real NVP", 2016 Method signatures and docstrings: - def __init__(self, n_inputs, n_hiddens, s_act, t_act, n_layers, batch_norm=True): Constructor. :param n_inputs: int, number of inputs :param ...
Implement the Python class `RealNVP` described below. Class description: Real NVP, see Dinh et al, "Density estimation using Real NVP", 2016 Method signatures and docstrings: - def __init__(self, n_inputs, n_hiddens, s_act, t_act, n_layers, batch_norm=True): Constructor. :param n_inputs: int, number of inputs :param ...
d5fa619db637d19f0c3018aeb1431f657dd533bf
<|skeleton|> class RealNVP: """Real NVP, see Dinh et al, "Density estimation using Real NVP", 2016""" def __init__(self, n_inputs, n_hiddens, s_act, t_act, n_layers, batch_norm=True): """Constructor. :param n_inputs: int, number of inputs :param n_hiddens: list of hidden widths for the nets in the coup...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RealNVP: """Real NVP, see Dinh et al, "Density estimation using Real NVP", 2016""" def __init__(self, n_inputs, n_hiddens, s_act, t_act, n_layers, batch_norm=True): """Constructor. :param n_inputs: int, number of inputs :param n_hiddens: list of hidden widths for the nets in the coupling layers :...
the_stack_v2_python_sparse
ml/models/nvps.py
gpapamak/maf
train
199
1e4f9bbdb4a588afbde1174286cd83b793bc9738
[ "self.n_estimators = n_estimators\nself.random = random\nself.split = split\nself.meta_model = list(map(lambda x: copy.deepcopy(meta_model), range(n_estimators)))\nself.model = model", "dataset_blend_feature = np.zeros((x_pred.shape[0], self.n_estimators))\nfor index, estimator in enumerate(self.meta_model):\n ...
<|body_start_0|> self.n_estimators = n_estimators self.random = random self.split = split self.meta_model = list(map(lambda x: copy.deepcopy(meta_model), range(n_estimators))) self.model = model <|end_body_0|> <|body_start_1|> dataset_blend_feature = np.zeros((x_pred.sha...
Stacking
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Stacking: def __init__(self, n_estimators, meta_model, model, split=0.8, random=0): """:param n_estimators: 元模型的数量 :param random: 随机数种子 :param split: 训练集和测试集分割比例,训练集用于元模型进行训练,测试集用于元模型生成给决策模型的数据""" <|body_0|> def predict(self, x_pred): """把元模型的输出作为最终模型的特征 :param x_pre...
stack_v2_sparse_classes_10k_train_006503
2,589
no_license
[ { "docstring": ":param n_estimators: 元模型的数量 :param random: 随机数种子 :param split: 训练集和测试集分割比例,训练集用于元模型进行训练,测试集用于元模型生成给决策模型的数据", "name": "__init__", "signature": "def __init__(self, n_estimators, meta_model, model, split=0.8, random=0)" }, { "docstring": "把元模型的输出作为最终模型的特征 :param x_pred: 原始数据 :return...
3
stack_v2_sparse_classes_30k_test_000208
Implement the Python class `Stacking` described below. Class description: Implement the Stacking class. Method signatures and docstrings: - def __init__(self, n_estimators, meta_model, model, split=0.8, random=0): :param n_estimators: 元模型的数量 :param random: 随机数种子 :param split: 训练集和测试集分割比例,训练集用于元模型进行训练,测试集用于元模型生成给决策模型的...
Implement the Python class `Stacking` described below. Class description: Implement the Stacking class. Method signatures and docstrings: - def __init__(self, n_estimators, meta_model, model, split=0.8, random=0): :param n_estimators: 元模型的数量 :param random: 随机数种子 :param split: 训练集和测试集分割比例,训练集用于元模型进行训练,测试集用于元模型生成给决策模型的...
1e8d30add10ae46043b76e664e4250a3e2b22e3f
<|skeleton|> class Stacking: def __init__(self, n_estimators, meta_model, model, split=0.8, random=0): """:param n_estimators: 元模型的数量 :param random: 随机数种子 :param split: 训练集和测试集分割比例,训练集用于元模型进行训练,测试集用于元模型生成给决策模型的数据""" <|body_0|> def predict(self, x_pred): """把元模型的输出作为最终模型的特征 :param x_pre...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Stacking: def __init__(self, n_estimators, meta_model, model, split=0.8, random=0): """:param n_estimators: 元模型的数量 :param random: 随机数种子 :param split: 训练集和测试集分割比例,训练集用于元模型进行训练,测试集用于元模型生成给决策模型的数据""" self.n_estimators = n_estimators self.random = random self.split = split ...
the_stack_v2_python_sparse
ensemble_learning/algorithm/stacking.py
cherryMonth/machine_learning
train
2
314df25700f87375ea3d1405f29271416f7bbbdd
[ "TFBaseLayer.__init__(self)\nself.in_hidden = in_hidden\nself.hidden_sizes = hidden_sizes\nself.att_size = attention_size\nself.keep_prob = keep_prob\nself.training = training\nself.rnn_type = rnn_type\nself.scope = scope", "layer_hidden = self.in_hidden\nfor idx, hidden_size in enumerate(self.hidden_sizes):\n ...
<|body_start_0|> TFBaseLayer.__init__(self) self.in_hidden = in_hidden self.hidden_sizes = hidden_sizes self.att_size = attention_size self.keep_prob = keep_prob self.training = training self.rnn_type = rnn_type self.scope = scope <|end_body_0|> <|body_st...
多层bi-lstm加attention层封装 底层可以多个双向lstm,顶层是SoftAttention加权隐层表示。
TFBILSTMAttLayer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TFBILSTMAttLayer: """多层bi-lstm加attention层封装 底层可以多个双向lstm,顶层是SoftAttention加权隐层表示。""" def __init__(self, in_hidden, hidden_sizes, attention_size, keep_prob, training=True, rnn_type='GRU', scope='bilstm_attention'): """Bi-LSTM-ATTENTION初始化 Args: in_hidden: 输入层 hidden_sizes: 多层BILSTM中每层隐...
stack_v2_sparse_classes_10k_train_006504
3,762
permissive
[ { "docstring": "Bi-LSTM-ATTENTION初始化 Args: in_hidden: 输入层 hidden_sizes: 多层BILSTM中每层隐层维数大小 attention_size: 注意力矩阵宽度 keep_prob: 多层lstm之间dropout输出时激活概率 training: 是否训练模式 rnn_type: 可选择LSTM或GRU", "name": "__init__", "signature": "def __init__(self, in_hidden, hidden_sizes, attention_size, keep_prob, training=T...
3
stack_v2_sparse_classes_30k_train_005741
Implement the Python class `TFBILSTMAttLayer` described below. Class description: 多层bi-lstm加attention层封装 底层可以多个双向lstm,顶层是SoftAttention加权隐层表示。 Method signatures and docstrings: - def __init__(self, in_hidden, hidden_sizes, attention_size, keep_prob, training=True, rnn_type='GRU', scope='bilstm_attention'): Bi-LSTM-ATT...
Implement the Python class `TFBILSTMAttLayer` described below. Class description: 多层bi-lstm加attention层封装 底层可以多个双向lstm,顶层是SoftAttention加权隐层表示。 Method signatures and docstrings: - def __init__(self, in_hidden, hidden_sizes, attention_size, keep_prob, training=True, rnn_type='GRU', scope='bilstm_attention'): Bi-LSTM-ATT...
c4423c2625c398f5a93c747f3516f378b31ece46
<|skeleton|> class TFBILSTMAttLayer: """多层bi-lstm加attention层封装 底层可以多个双向lstm,顶层是SoftAttention加权隐层表示。""" def __init__(self, in_hidden, hidden_sizes, attention_size, keep_prob, training=True, rnn_type='GRU', scope='bilstm_attention'): """Bi-LSTM-ATTENTION初始化 Args: in_hidden: 输入层 hidden_sizes: 多层BILSTM中每层隐...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TFBILSTMAttLayer: """多层bi-lstm加attention层封装 底层可以多个双向lstm,顶层是SoftAttention加权隐层表示。""" def __init__(self, in_hidden, hidden_sizes, attention_size, keep_prob, training=True, rnn_type='GRU', scope='bilstm_attention'): """Bi-LSTM-ATTENTION初始化 Args: in_hidden: 输入层 hidden_sizes: 多层BILSTM中每层隐层维数大小 attenti...
the_stack_v2_python_sparse
layers/tf_bilstm_att_layer.py
snowhws/deeplearning
train
10
e316af4427639441ed2116da2deb81f2b19918eb
[ "data = self.get_json()\nname = data.get('galaxyName')\nif name is None:\n return self.error('galaxyName required to set object host')\nwith self.Session() as session:\n obj = session.scalars(Obj.select(session.user_or_token, mode='update').where(Obj.id == obj_id)).first()\n if obj is None:\n return...
<|body_start_0|> data = self.get_json() name = data.get('galaxyName') if name is None: return self.error('galaxyName required to set object host') with self.Session() as session: obj = session.scalars(Obj.select(session.user_or_token, mode='update').where(Obj.id =...
ObjHostHandler
[ "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObjHostHandler: def post(self, obj_id): """--- description: Set an object's host galaxy tags: - objs - galaxys parameters: - in: path name: obj_id required: true schema: type: string requestBody: content: application/json: schema: type: object properties: galaxyName: type: string descrip...
stack_v2_sparse_classes_10k_train_006505
41,985
permissive
[ { "docstring": "--- description: Set an object's host galaxy tags: - objs - galaxys parameters: - in: path name: obj_id required: true schema: type: string requestBody: content: application/json: schema: type: object properties: galaxyName: type: string description: | Name of the galaxy to associate with the ob...
2
null
Implement the Python class `ObjHostHandler` described below. Class description: Implement the ObjHostHandler class. Method signatures and docstrings: - def post(self, obj_id): --- description: Set an object's host galaxy tags: - objs - galaxys parameters: - in: path name: obj_id required: true schema: type: string re...
Implement the Python class `ObjHostHandler` described below. Class description: Implement the ObjHostHandler class. Method signatures and docstrings: - def post(self, obj_id): --- description: Set an object's host galaxy tags: - objs - galaxys parameters: - in: path name: obj_id required: true schema: type: string re...
161d3532ba3ba059446addcdac58ca96f39e9636
<|skeleton|> class ObjHostHandler: def post(self, obj_id): """--- description: Set an object's host galaxy tags: - objs - galaxys parameters: - in: path name: obj_id required: true schema: type: string requestBody: content: application/json: schema: type: object properties: galaxyName: type: string descrip...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ObjHostHandler: def post(self, obj_id): """--- description: Set an object's host galaxy tags: - objs - galaxys parameters: - in: path name: obj_id required: true schema: type: string requestBody: content: application/json: schema: type: object properties: galaxyName: type: string description: | Name o...
the_stack_v2_python_sparse
skyportal/handlers/api/galaxy.py
skyportal/skyportal
train
80
53240d84ef2b9d134e41d91d2ed18bc1f2ed5cef
[ "def foo(n):\n if not n:\n yield None\n return\n yield n.val\n yield from foo(n.left)\n yield from foo(n.right)\n\ndef bar(n):\n if not n:\n yield None\n return\n yield n.val\n yield from bar(n.right)\n yield from bar(n.left)\nif not root:\n return True\nn1, n2...
<|body_start_0|> def foo(n): if not n: yield None return yield n.val yield from foo(n.left) yield from foo(n.right) def bar(n): if not n: yield None return yield n.val...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isSymmetric_first(self, root: TreeNode) -> bool: """first attempt""" <|body_0|> def isSymmetric(self, root: TreeNode) -> bool: """optimization""" <|body_1|> <|end_skeleton|> <|body_start_0|> def foo(n): if not n: ...
stack_v2_sparse_classes_10k_train_006506
1,679
no_license
[ { "docstring": "first attempt", "name": "isSymmetric_first", "signature": "def isSymmetric_first(self, root: TreeNode) -> bool" }, { "docstring": "optimization", "name": "isSymmetric", "signature": "def isSymmetric(self, root: TreeNode) -> bool" } ]
2
stack_v2_sparse_classes_30k_train_004797
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isSymmetric_first(self, root: TreeNode) -> bool: first attempt - def isSymmetric(self, root: TreeNode) -> bool: optimization
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isSymmetric_first(self, root: TreeNode) -> bool: first attempt - def isSymmetric(self, root: TreeNode) -> bool: optimization <|skeleton|> class Solution: def isSymmetri...
d4d44e6dfd3df4cb47b855ad30e6849038cea0a5
<|skeleton|> class Solution: def isSymmetric_first(self, root: TreeNode) -> bool: """first attempt""" <|body_0|> def isSymmetric(self, root: TreeNode) -> bool: """optimization""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def isSymmetric_first(self, root: TreeNode) -> bool: """first attempt""" def foo(n): if not n: yield None return yield n.val yield from foo(n.left) yield from foo(n.right) def bar(n): ...
the_stack_v2_python_sparse
leetcode/amazon/trees_and_graphs/symmetric_tree.py
alvaronaschez/amazon
train
0
14e7633d024e895a24315e735a1d7792d235b9c6
[ "super(AdditiveUpsampleLayer, self).__init__(name=name)\nself.new_size = new_size\nself.n_splits = int(n_splits)", "check_divisible_channels(input_tensor, self.n_splits)\nresizing_layer = ResizingLayer(self.new_size)\nsplit = tf.split(resizing_layer(input_tensor), self.n_splits, axis=-1)\nsplit_tensor = tf.stack(...
<|body_start_0|> super(AdditiveUpsampleLayer, self).__init__(name=name) self.new_size = new_size self.n_splits = int(n_splits) <|end_body_0|> <|body_start_1|> check_divisible_channels(input_tensor, self.n_splits) resizing_layer = ResizingLayer(self.new_size) split = tf.s...
Implementation of bilinear (or trilinear) additive upsampling layer, described in paper: Wojna et al., The devil is in the decoder, https://arxiv.org/abs/1707.05847 In the paper 2D images are upsampled by a factor of 2 and ``n_splits = 4``
AdditiveUpsampleLayer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdditiveUpsampleLayer: """Implementation of bilinear (or trilinear) additive upsampling layer, described in paper: Wojna et al., The devil is in the decoder, https://arxiv.org/abs/1707.05847 In the paper 2D images are upsampled by a factor of 2 and ``n_splits = 4``""" def __init__(self, new_...
stack_v2_sparse_classes_10k_train_006507
4,253
permissive
[ { "docstring": ":param new_size: integer or a list of integers set the output 2D/3D spatial shape. If the parameter is an integer ``d``, it'll be expanded to ``(d, d)`` and ``(d, d, d)`` for 2D and 3D inputs respectively. :param n_splits: integer, the output tensor will have ``C / n_splits`` channels, where ``C...
2
stack_v2_sparse_classes_30k_train_006110
Implement the Python class `AdditiveUpsampleLayer` described below. Class description: Implementation of bilinear (or trilinear) additive upsampling layer, described in paper: Wojna et al., The devil is in the decoder, https://arxiv.org/abs/1707.05847 In the paper 2D images are upsampled by a factor of 2 and ``n_split...
Implement the Python class `AdditiveUpsampleLayer` described below. Class description: Implementation of bilinear (or trilinear) additive upsampling layer, described in paper: Wojna et al., The devil is in the decoder, https://arxiv.org/abs/1707.05847 In the paper 2D images are upsampled by a factor of 2 and ``n_split...
84dd0f85c9a1ab8a72f4c55fcf073379acf5ae1b
<|skeleton|> class AdditiveUpsampleLayer: """Implementation of bilinear (or trilinear) additive upsampling layer, described in paper: Wojna et al., The devil is in the decoder, https://arxiv.org/abs/1707.05847 In the paper 2D images are upsampled by a factor of 2 and ``n_splits = 4``""" def __init__(self, new_...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AdditiveUpsampleLayer: """Implementation of bilinear (or trilinear) additive upsampling layer, described in paper: Wojna et al., The devil is in the decoder, https://arxiv.org/abs/1707.05847 In the paper 2D images are upsampled by a factor of 2 and ``n_splits = 4``""" def __init__(self, new_size, n_split...
the_stack_v2_python_sparse
niftynet/layer/additive_upsample.py
12SigmaTechnologies/NiftyNet-1
train
2
d1d0fd8823504200abccdeeb501718200bfd4d00
[ "super(RNNEncoder, self).__init__()\nself.batch = batch\nself.units = units\nself.embedding = tf.keras.layers.Embedding(vocab, embedding)\nself.gru = tf.keras.layers.GRU(units, recurrent_initializer='glorot_uniform', return_sequences=True, return_state=True)", "initializer = tf.keras.initializers.Zeros()\nhidden ...
<|body_start_0|> super(RNNEncoder, self).__init__() self.batch = batch self.units = units self.embedding = tf.keras.layers.Embedding(vocab, embedding) self.gru = tf.keras.layers.GRU(units, recurrent_initializer='glorot_uniform', return_sequences=True, return_state=True) <|end_bod...
Rnn encoder class
RNNEncoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RNNEncoder: """Rnn encoder class""" def __init__(self, vocab, embedding, units, batch): """Function that initializes variables""" <|body_0|> def initialize_hidden_state(self): """Function that initializes the hidden states for the RNN cell to a tensor of zeros"""...
stack_v2_sparse_classes_10k_train_006508
1,198
no_license
[ { "docstring": "Function that initializes variables", "name": "__init__", "signature": "def __init__(self, vocab, embedding, units, batch)" }, { "docstring": "Function that initializes the hidden states for the RNN cell to a tensor of zeros", "name": "initialize_hidden_state", "signature...
3
stack_v2_sparse_classes_30k_train_006192
Implement the Python class `RNNEncoder` described below. Class description: Rnn encoder class Method signatures and docstrings: - def __init__(self, vocab, embedding, units, batch): Function that initializes variables - def initialize_hidden_state(self): Function that initializes the hidden states for the RNN cell to...
Implement the Python class `RNNEncoder` described below. Class description: Rnn encoder class Method signatures and docstrings: - def __init__(self, vocab, embedding, units, batch): Function that initializes variables - def initialize_hidden_state(self): Function that initializes the hidden states for the RNN cell to...
9dbf8221d4eb22dbc2487cb55e84a801a38aa5c8
<|skeleton|> class RNNEncoder: """Rnn encoder class""" def __init__(self, vocab, embedding, units, batch): """Function that initializes variables""" <|body_0|> def initialize_hidden_state(self): """Function that initializes the hidden states for the RNN cell to a tensor of zeros"""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RNNEncoder: """Rnn encoder class""" def __init__(self, vocab, embedding, units, batch): """Function that initializes variables""" super(RNNEncoder, self).__init__() self.batch = batch self.units = units self.embedding = tf.keras.layers.Embedding(vocab, embedding) ...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/0-rnn_encoder.py
yasmineholb/holbertonschool-machine_learning
train
0
6d49604ebfc1ffd5bc2cc0a201b896b3d70a3c54
[ "if not isinstance(value, list) and len(value) > 0:\n raise serializers.ValidationError(_('请选择至少一项服务'))\nif Service.objects.filter(id__in=value).count() != len(value):\n raise serializers.ValidationError(_('部分服务不存在'))\nreturn value", "try:\n catalog = ServiceCatalog.objects.get(id=value)\n if catalog....
<|body_start_0|> if not isinstance(value, list) and len(value) > 0: raise serializers.ValidationError(_('请选择至少一项服务')) if Service.objects.filter(id__in=value).count() != len(value): raise serializers.ValidationError(_('部分服务不存在')) return value <|end_body_0|> <|body_start_1...
服务目录关联操作序列化
CatalogServiceEditSerializer
[ "MIT", "LGPL-2.1-or-later", "LGPL-3.0-only" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CatalogServiceEditSerializer: """服务目录关联操作序列化""" def validate_services(self, value): """Check services""" <|body_0|> def validate_catalog_id(self, value): """Check catalog_id""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not isinstance(value...
stack_v2_sparse_classes_10k_train_006509
30,704
permissive
[ { "docstring": "Check services", "name": "validate_services", "signature": "def validate_services(self, value)" }, { "docstring": "Check catalog_id", "name": "validate_catalog_id", "signature": "def validate_catalog_id(self, value)" } ]
2
stack_v2_sparse_classes_30k_train_007014
Implement the Python class `CatalogServiceEditSerializer` described below. Class description: 服务目录关联操作序列化 Method signatures and docstrings: - def validate_services(self, value): Check services - def validate_catalog_id(self, value): Check catalog_id
Implement the Python class `CatalogServiceEditSerializer` described below. Class description: 服务目录关联操作序列化 Method signatures and docstrings: - def validate_services(self, value): Check services - def validate_catalog_id(self, value): Check catalog_id <|skeleton|> class CatalogServiceEditSerializer: """服务目录关联操作序列化...
2d708bd0d869d391456e0fb8d644af3b9f031acf
<|skeleton|> class CatalogServiceEditSerializer: """服务目录关联操作序列化""" def validate_services(self, value): """Check services""" <|body_0|> def validate_catalog_id(self, value): """Check catalog_id""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CatalogServiceEditSerializer: """服务目录关联操作序列化""" def validate_services(self, value): """Check services""" if not isinstance(value, list) and len(value) > 0: raise serializers.ValidationError(_('请选择至少一项服务')) if Service.objects.filter(id__in=value).count() != len(value): ...
the_stack_v2_python_sparse
itsm/service/serializers.py
TencentBlueKing/bk-itsm
train
100
60d943019663a7241697aa6a37838469a7db9581
[ "roots = np.asarray(roots)\nif len(roots.shape) != 1:\n raise ArgumentError('one-dimensional array of roots expected.')\nself.roots = roots", "from numpy.polynomial import Polynomial as P\np = P.fromroots(self.roots)\nreturn p.deriv(1).roots()", "p = np.asarray(points)\nif len(p.shape) > 1:\n raise Argume...
<|body_start_0|> roots = np.asarray(roots) if len(roots.shape) != 1: raise ArgumentError('one-dimensional array of roots expected.') self.roots = roots <|end_body_0|> <|body_start_1|> from numpy.polynomial import Polynomial as P p = P.fromroots(self.roots) re...
NormalizedRootsPolynomial
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NormalizedRootsPolynomial: def __init__(self, roots): """A polynomial with specified roots and p(0)=1. Represents the polynomial .. math:: p(\\lambda) = \\prod_{i=1}^n \\left(1-\\frac{\\lambda}{\\theta_i}\\right). :param roots: array with roots :math:`\\theta_1,\\dots,\\theta_n` of the p...
stack_v2_sparse_classes_10k_train_006510
10,845
permissive
[ { "docstring": "A polynomial with specified roots and p(0)=1. Represents the polynomial .. math:: p(\\\\lambda) = \\\\prod_{i=1}^n \\\\left(1-\\\\frac{\\\\lambda}{\\\\theta_i}\\\\right). :param roots: array with roots :math:`\\\\theta_1,\\\\dots,\\\\theta_n` of the polynomial and ``roots.shape==(n,)``.", "n...
3
stack_v2_sparse_classes_30k_train_005065
Implement the Python class `NormalizedRootsPolynomial` described below. Class description: Implement the NormalizedRootsPolynomial class. Method signatures and docstrings: - def __init__(self, roots): A polynomial with specified roots and p(0)=1. Represents the polynomial .. math:: p(\\lambda) = \\prod_{i=1}^n \\left...
Implement the Python class `NormalizedRootsPolynomial` described below. Class description: Implement the NormalizedRootsPolynomial class. Method signatures and docstrings: - def __init__(self, roots): A polynomial with specified roots and p(0)=1. Represents the polynomial .. math:: p(\\lambda) = \\prod_{i=1}^n \\left...
e6af3d227f1512c84a528f9c4407934973231b42
<|skeleton|> class NormalizedRootsPolynomial: def __init__(self, roots): """A polynomial with specified roots and p(0)=1. Represents the polynomial .. math:: p(\\lambda) = \\prod_{i=1}^n \\left(1-\\frac{\\lambda}{\\theta_i}\\right). :param roots: array with roots :math:`\\theta_1,\\dots,\\theta_n` of the p...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NormalizedRootsPolynomial: def __init__(self, roots): """A polynomial with specified roots and p(0)=1. Represents the polynomial .. math:: p(\\lambda) = \\prod_{i=1}^n \\left(1-\\frac{\\lambda}{\\theta_i}\\right). :param roots: array with roots :math:`\\theta_1,\\dots,\\theta_n` of the polynomial and ...
the_stack_v2_python_sparse
src/krylov/utils.py
mohamedlaminebabou/krylov
train
0
71ac0b72eab8c115312ed7736acd44609de6eefa
[ "self.foodToScore = defaultdict(int)\nself.foodToCuision = defaultdict(str)\nself.cuisionRank = defaultdict(lambda: SortedList(key=lambda x: (-x[0], x[1])))\nfor food, cuision, score in zip(foods, cuisines, ratings):\n self.foodToScore[food] = score\n self.foodToCuision[food] = cuision\n self.cuisionRank[c...
<|body_start_0|> self.foodToScore = defaultdict(int) self.foodToCuision = defaultdict(str) self.cuisionRank = defaultdict(lambda: SortedList(key=lambda x: (-x[0], x[1]))) for food, cuision, score in zip(foods, cuisines, ratings): self.foodToScore[food] = score sel...
FoodRatings
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FoodRatings: def __init__(self, foods: List[str], cuisines: List[str], ratings: List[int]): """foods[i] 是第 i 种食物的名字。 cuisines[i] 是第 i 种食物的烹饪方式。 ratings[i] 是第 i 种食物的最初评分。""" <|body_0|> def changeRating(self, food: str, newRating: int) -> None: """修改名字为 food 的食物的评分。删除旧...
stack_v2_sparse_classes_10k_train_006511
1,858
no_license
[ { "docstring": "foods[i] 是第 i 种食物的名字。 cuisines[i] 是第 i 种食物的烹饪方式。 ratings[i] 是第 i 种食物的最初评分。", "name": "__init__", "signature": "def __init__(self, foods: List[str], cuisines: List[str], ratings: List[int])" }, { "docstring": "修改名字为 food 的食物的评分。删除旧的,添加新的", "name": "changeRating", "signatur...
3
null
Implement the Python class `FoodRatings` described below. Class description: Implement the FoodRatings class. Method signatures and docstrings: - def __init__(self, foods: List[str], cuisines: List[str], ratings: List[int]): foods[i] 是第 i 种食物的名字。 cuisines[i] 是第 i 种食物的烹饪方式。 ratings[i] 是第 i 种食物的最初评分。 - def changeRating...
Implement the Python class `FoodRatings` described below. Class description: Implement the FoodRatings class. Method signatures and docstrings: - def __init__(self, foods: List[str], cuisines: List[str], ratings: List[int]): foods[i] 是第 i 种食物的名字。 cuisines[i] 是第 i 种食物的烹饪方式。 ratings[i] 是第 i 种食物的最初评分。 - def changeRating...
7e79e26bb8f641868561b186e34c1127ed63c9e0
<|skeleton|> class FoodRatings: def __init__(self, foods: List[str], cuisines: List[str], ratings: List[int]): """foods[i] 是第 i 种食物的名字。 cuisines[i] 是第 i 种食物的烹饪方式。 ratings[i] 是第 i 种食物的最初评分。""" <|body_0|> def changeRating(self, food: str, newRating: int) -> None: """修改名字为 food 的食物的评分。删除旧...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FoodRatings: def __init__(self, foods: List[str], cuisines: List[str], ratings: List[int]): """foods[i] 是第 i 种食物的名字。 cuisines[i] 是第 i 种食物的烹饪方式。 ratings[i] 是第 i 种食物的最初评分。""" self.foodToScore = defaultdict(int) self.foodToCuision = defaultdict(str) self.cuisionRank = defaultdict(...
the_stack_v2_python_sparse
4_set/有序集合/字典加SortedList设计类/6126. 设计食物评分系统.py
981377660LMT/algorithm-study
train
225
f268a944b2c05524456aed2f27bb804341611966
[ "self.cb = cb\nself.configeditor = configeditor\nself.store = gtk.ListStore(str, int)\ngtk.TreeView.__init__(self, self.store)\nrenderer = gtk.CellRendererText()\ncolumn = gtk.TreeViewColumn('Name', renderer, markup=0)\nself.append_column(column)\nself.set_headers_visible(False)\nself.connect('cursor-changed', self...
<|body_start_0|> self.cb = cb self.configeditor = configeditor self.store = gtk.ListStore(str, int) gtk.TreeView.__init__(self, self.store) renderer = gtk.CellRendererText() column = gtk.TreeViewColumn('Name', renderer, markup=0) self.append_column(column) ...
A treeview control for switching a notebook's tabs.
ListTree
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ListTree: """A treeview control for switching a notebook's tabs.""" def __init__(self, cb, configeditor): """Constructor. @param cb: An instance of the application class. @type cb: pida.main.Application @param configeditor: The configuration editor that the list is used for. @type co...
stack_v2_sparse_classes_10k_train_006512
15,563
no_license
[ { "docstring": "Constructor. @param cb: An instance of the application class. @type cb: pida.main.Application @param configeditor: The configuration editor that the list is used for. @type configeditor: pida.config.ConfigEditor", "name": "__init__", "signature": "def __init__(self, cb, configeditor)" ...
3
null
Implement the Python class `ListTree` described below. Class description: A treeview control for switching a notebook's tabs. Method signatures and docstrings: - def __init__(self, cb, configeditor): Constructor. @param cb: An instance of the application class. @type cb: pida.main.Application @param configeditor: The...
Implement the Python class `ListTree` described below. Class description: A treeview control for switching a notebook's tabs. Method signatures and docstrings: - def __init__(self, cb, configeditor): Constructor. @param cb: An instance of the application class. @type cb: pida.main.Application @param configeditor: The...
739147ed21a23cab23c2bba98f1c54108f8c2516
<|skeleton|> class ListTree: """A treeview control for switching a notebook's tabs.""" def __init__(self, cb, configeditor): """Constructor. @param cb: An instance of the application class. @type cb: pida.main.Application @param configeditor: The configuration editor that the list is used for. @type co...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ListTree: """A treeview control for switching a notebook's tabs.""" def __init__(self, cb, configeditor): """Constructor. @param cb: An instance of the application class. @type cb: pida.main.Application @param configeditor: The configuration editor that the list is used for. @type configeditor: p...
the_stack_v2_python_sparse
tags/release-0.2.1/src/configuration/config.py
BackupTheBerlios/pida-svn
train
1
1abd30863982dfc622f554848505d41fa359bd65
[ "result = list()\nn = len(digits)\nnum = 0\nfor a in range(n):\n num += digits[a] * 10 ** (n - 1)\n n -= 1\nnum = num + 1\nresult = result + [int(x) for x in str(num)]\nreturn result", "for i in range(len(digits) - 1, -1, -1):\n if digits[i] != 9:\n digits[i] += 1\n return digits\n else:...
<|body_start_0|> result = list() n = len(digits) num = 0 for a in range(n): num += digits[a] * 10 ** (n - 1) n -= 1 num = num + 1 result = result + [int(x) for x in str(num)] return result <|end_body_0|> <|body_start_1|> for i in r...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def plusOne(self, digits): """:type digits: List[int] :rtype: List[int]""" <|body_0|> def plusOne_2(self, digits): """:type digits: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> result = list() n = len...
stack_v2_sparse_classes_10k_train_006513
757
no_license
[ { "docstring": ":type digits: List[int] :rtype: List[int]", "name": "plusOne", "signature": "def plusOne(self, digits)" }, { "docstring": ":type digits: List[int] :rtype: List[int]", "name": "plusOne_2", "signature": "def plusOne_2(self, digits)" } ]
2
stack_v2_sparse_classes_30k_train_000048
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def plusOne(self, digits): :type digits: List[int] :rtype: List[int] - def plusOne_2(self, digits): :type digits: List[int] :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def plusOne(self, digits): :type digits: List[int] :rtype: List[int] - def plusOne_2(self, digits): :type digits: List[int] :rtype: List[int] <|skeleton|> class Solution: d...
d26c6a18749aa176eba0ef000b8276335979fedb
<|skeleton|> class Solution: def plusOne(self, digits): """:type digits: List[int] :rtype: List[int]""" <|body_0|> def plusOne_2(self, digits): """:type digits: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def plusOne(self, digits): """:type digits: List[int] :rtype: List[int]""" result = list() n = len(digits) num = 0 for a in range(n): num += digits[a] * 10 ** (n - 1) n -= 1 num = num + 1 result = result + [int(x) for x ...
the_stack_v2_python_sparse
mu_wang/9_13/Plus_One.py
mingming733/LCGroup
train
0
fab08cbf93e02acf724570c8f3ce07e38a696abf
[ "rev_total = self.tempo * self.count\nrev_total += review.tempo\nself.count += 1\nself.score = rev_total / self.count\nself.save()", "reviews = Review.objects.filger(song=self.song).filter(quality=self.tempo)\ncount = len(reviews)\nagg = sum" ]
<|body_start_0|> rev_total = self.tempo * self.count rev_total += review.tempo self.count += 1 self.score = rev_total / self.count self.save() <|end_body_0|> <|body_start_1|> reviews = Review.objects.filger(song=self.song).filter(quality=self.tempo) count = len(r...
ReviewAvg
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReviewAvg: def add_review(self, review): """Adjust the score and count with a new quality review""" <|body_0|> def reset_avg(self): """Totally resets the average by looking at all available scores for a quality""" <|body_1|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_10k_train_006514
1,308
no_license
[ { "docstring": "Adjust the score and count with a new quality review", "name": "add_review", "signature": "def add_review(self, review)" }, { "docstring": "Totally resets the average by looking at all available scores for a quality", "name": "reset_avg", "signature": "def reset_avg(self)...
2
null
Implement the Python class `ReviewAvg` described below. Class description: Implement the ReviewAvg class. Method signatures and docstrings: - def add_review(self, review): Adjust the score and count with a new quality review - def reset_avg(self): Totally resets the average by looking at all available scores for a qu...
Implement the Python class `ReviewAvg` described below. Class description: Implement the ReviewAvg class. Method signatures and docstrings: - def add_review(self, review): Adjust the score and count with a new quality review - def reset_avg(self): Totally resets the average by looking at all available scores for a qu...
36e08862d1bbcc9a4b535d948199e569ecbdd115
<|skeleton|> class ReviewAvg: def add_review(self, review): """Adjust the score and count with a new quality review""" <|body_0|> def reset_avg(self): """Totally resets the average by looking at all available scores for a quality""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ReviewAvg: def add_review(self, review): """Adjust the score and count with a new quality review""" rev_total = self.tempo * self.count rev_total += review.tempo self.count += 1 self.score = rev_total / self.count self.save() def reset_avg(self): ""...
the_stack_v2_python_sparse
Assignments/Brea/Capstone/capstone/models2.py
PdxCodeGuild/class_mudpuppy
train
5
19a6329a24310d7d5560a73d590348b88b070b87
[ "super(Encoder, self).__init__()\nself.hidden_size = hidden_size\nself.embedding = nn.Embedding(input_size, hidden_size, padding_idx=0)\nself.encoder = nn.LSTM(input_size=hidden_size, hidden_size=hidden_size, num_layers=num_layers, batch_first=True, bidirectional=True)", "embedded = self.embedding(x)\nencoder_out...
<|body_start_0|> super(Encoder, self).__init__() self.hidden_size = hidden_size self.embedding = nn.Embedding(input_size, hidden_size, padding_idx=0) self.encoder = nn.LSTM(input_size=hidden_size, hidden_size=hidden_size, num_layers=num_layers, batch_first=True, bidirectional=True) <|end...
Encoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Encoder: def __init__(self, input_size, hidden_size, num_layers): """:param input_size: vob_size :param hidden_size: 越大可以夠更好地記憶長序列中的信息 :param num_layers: 越大更好地捕捉輸入序列中的抽象特徵""" <|body_0|> def forward(self, x, encoder_hidden): """:param x: (batch_size, seq_len) :param e...
stack_v2_sparse_classes_10k_train_006515
16,677
permissive
[ { "docstring": ":param input_size: vob_size :param hidden_size: 越大可以夠更好地記憶長序列中的信息 :param num_layers: 越大更好地捕捉輸入序列中的抽象特徵", "name": "__init__", "signature": "def __init__(self, input_size, hidden_size, num_layers)" }, { "docstring": ":param x: (batch_size, seq_len) :param encoder_hidden:", "nam...
2
null
Implement the Python class `Encoder` described below. Class description: Implement the Encoder class. Method signatures and docstrings: - def __init__(self, input_size, hidden_size, num_layers): :param input_size: vob_size :param hidden_size: 越大可以夠更好地記憶長序列中的信息 :param num_layers: 越大更好地捕捉輸入序列中的抽象特徵 - def forward(self, ...
Implement the Python class `Encoder` described below. Class description: Implement the Encoder class. Method signatures and docstrings: - def __init__(self, input_size, hidden_size, num_layers): :param input_size: vob_size :param hidden_size: 越大可以夠更好地記憶長序列中的信息 :param num_layers: 越大更好地捕捉輸入序列中的抽象特徵 - def forward(self, ...
c360e81624296c9243fd662dea618042164e0aa7
<|skeleton|> class Encoder: def __init__(self, input_size, hidden_size, num_layers): """:param input_size: vob_size :param hidden_size: 越大可以夠更好地記憶長序列中的信息 :param num_layers: 越大更好地捕捉輸入序列中的抽象特徵""" <|body_0|> def forward(self, x, encoder_hidden): """:param x: (batch_size, seq_len) :param e...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Encoder: def __init__(self, input_size, hidden_size, num_layers): """:param input_size: vob_size :param hidden_size: 越大可以夠更好地記憶長序列中的信息 :param num_layers: 越大更好地捕捉輸入序列中的抽象特徵""" super(Encoder, self).__init__() self.hidden_size = hidden_size self.embedding = nn.Embedding(input_size...
the_stack_v2_python_sparse
torch-qa/test-lstm2.py
flashlin/Samples
train
3
cc7468515370e4a4845ed45bba1746e7a3b83941
[ "super().__init__()\nself.config = params\ntry:\n self.my_device = self.config['my_device']\nexcept:\n self.my_device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')\n'\\n NV uses padding = \"same\" to preserve the input and output size of conv.\\n We can do the same as follows:...
<|body_start_0|> super().__init__() self.config = params try: self.my_device = self.config['my_device'] except: self.my_device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu') '\n NV uses padding = "same" to preserve the input and ou...
Implement the architecture from Nielsen and Voigt (2018)
NVCNN
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NVCNN: """Implement the architecture from Nielsen and Voigt (2018)""" def __init__(self, params): """Params are: vocab_size: the number of dimensions in the 1-hot encoding lr: learning rate filter_number: number of filters (in NV, 1-512) filter_len: length of filters (in NV, 1-48) nu...
stack_v2_sparse_classes_10k_train_006516
34,560
no_license
[ { "docstring": "Params are: vocab_size: the number of dimensions in the 1-hot encoding lr: learning rate filter_number: number of filters (in NV, 1-512) filter_len: length of filters (in NV, 1-48) num_dense_nodes: size of dense layer after filters input_len: length of input (batch_size, vocab_size, input_len) n...
2
stack_v2_sparse_classes_30k_train_005515
Implement the Python class `NVCNN` described below. Class description: Implement the architecture from Nielsen and Voigt (2018) Method signatures and docstrings: - def __init__(self, params): Params are: vocab_size: the number of dimensions in the 1-hot encoding lr: learning rate filter_number: number of filters (in ...
Implement the Python class `NVCNN` described below. Class description: Implement the architecture from Nielsen and Voigt (2018) Method signatures and docstrings: - def __init__(self, params): Params are: vocab_size: the number of dimensions in the 1-hot encoding lr: learning rate filter_number: number of filters (in ...
b850f7c91e16e3dacca4d3b6377c77502960dd19
<|skeleton|> class NVCNN: """Implement the architecture from Nielsen and Voigt (2018)""" def __init__(self, params): """Params are: vocab_size: the number of dimensions in the 1-hot encoding lr: learning rate filter_number: number of filters (in NV, 1-512) filter_len: length of filters (in NV, 1-48) nu...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NVCNN: """Implement the architecture from Nielsen and Voigt (2018)""" def __init__(self, params): """Params are: vocab_size: the number of dimensions in the 1-hot encoding lr: learning rate filter_number: number of filters (in NV, 1-512) filter_len: length of filters (in NV, 1-48) num_dense_nodes...
the_stack_v2_python_sparse
common/mytorch.py
altLabs/attrib
train
1
8b6c6f48a0e6a2f10091c9ec9326d4992bd110e9
[ "self.domain = domain\nself.cliques = cliques\nself.variables = set()\nfor vs, matrix in cliques:\n self.variables.update(vs)", "p = 1.0\nfor var, pot in self.cliques:\n if 0 < len(var) < 2:\n p *= pot[configuration[var[0]]]\n else:\n p *= pot[configuration[var[0]], configuration[var[1]]]\n...
<|body_start_0|> self.domain = domain self.cliques = cliques self.variables = set() for vs, matrix in cliques: self.variables.update(vs) <|end_body_0|> <|body_start_1|> p = 1.0 for var, pot in self.cliques: if 0 < len(var) < 2: p *...
Mrf
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Mrf: def __init__(self, domain, cliques): """Domain: Values that the variables can take Cliques: List of tuples (variables,potential_matrix)""" <|body_0|> def get_potential(self, configuration): """Return the potential (unnormalized) of the given variable configurati...
stack_v2_sparse_classes_10k_train_006517
3,913
no_license
[ { "docstring": "Domain: Values that the variables can take Cliques: List of tuples (variables,potential_matrix)", "name": "__init__", "signature": "def __init__(self, domain, cliques)" }, { "docstring": "Return the potential (unnormalized) of the given variable configuration)", "name": "get_...
5
stack_v2_sparse_classes_30k_train_003190
Implement the Python class `Mrf` described below. Class description: Implement the Mrf class. Method signatures and docstrings: - def __init__(self, domain, cliques): Domain: Values that the variables can take Cliques: List of tuples (variables,potential_matrix) - def get_potential(self, configuration): Return the po...
Implement the Python class `Mrf` described below. Class description: Implement the Mrf class. Method signatures and docstrings: - def __init__(self, domain, cliques): Domain: Values that the variables can take Cliques: List of tuples (variables,potential_matrix) - def get_potential(self, configuration): Return the po...
2306f925f2932d2c0bde0ded15196be9597540f8
<|skeleton|> class Mrf: def __init__(self, domain, cliques): """Domain: Values that the variables can take Cliques: List of tuples (variables,potential_matrix)""" <|body_0|> def get_potential(self, configuration): """Return the potential (unnormalized) of the given variable configurati...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Mrf: def __init__(self, domain, cliques): """Domain: Values that the variables can take Cliques: List of tuples (variables,potential_matrix)""" self.domain = domain self.cliques = cliques self.variables = set() for vs, matrix in cliques: self.variables.updat...
the_stack_v2_python_sparse
berni/Uebung 6.py
anhDean/AI_Assignments
train
0
970b77954e3edb5d114b8701f2654963d2ef1263
[ "\"\"\"\n You'll have to do a set of jumps, and choose for each one whether \n to do it using a rope or bricks. It's always optimal to use ropes \n in the largest jumps.\n\n \"\"\"\nA = heights\nheap = []\n'\\n Iterate on the buildings, maintaining the largest r jumps and the \\n ...
<|body_start_0|> """ You'll have to do a set of jumps, and choose for each one whether to do it using a rope or bricks. It's always optimal to use ropes in the largest jumps. """ A = heights heap = [] '\n Iterate o...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def furthestBuilding(self, heights, bricks, ladders): """:type heights: List[int] :type bricks: int :type ladders: int :rtype: int""" <|body_0|> def furthestBuildingHeap(self, heights, bricks, ladders): """:type heights: List[int] :type bricks: int :type la...
stack_v2_sparse_classes_10k_train_006518
4,669
no_license
[ { "docstring": ":type heights: List[int] :type bricks: int :type ladders: int :rtype: int", "name": "furthestBuilding", "signature": "def furthestBuilding(self, heights, bricks, ladders)" }, { "docstring": ":type heights: List[int] :type bricks: int :type ladders: int :rtype: int", "name": "...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def furthestBuilding(self, heights, bricks, ladders): :type heights: List[int] :type bricks: int :type ladders: int :rtype: int - def furthestBuildingHeap(self, heights, bricks, ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def furthestBuilding(self, heights, bricks, ladders): :type heights: List[int] :type bricks: int :type ladders: int :rtype: int - def furthestBuildingHeap(self, heights, bricks, ...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def furthestBuilding(self, heights, bricks, ladders): """:type heights: List[int] :type bricks: int :type ladders: int :rtype: int""" <|body_0|> def furthestBuildingHeap(self, heights, bricks, ladders): """:type heights: List[int] :type bricks: int :type la...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def furthestBuilding(self, heights, bricks, ladders): """:type heights: List[int] :type bricks: int :type ladders: int :rtype: int""" """ You'll have to do a set of jumps, and choose for each one whether to do it using a rope or bricks. It's always op...
the_stack_v2_python_sparse
F/FurthestBuildingYouCanReach.py
bssrdf/pyleet
train
2
db5981bcb87979b8820c2aa6db9e410cf59f8cd3
[ "maarten = FilmFan.film_fans.get(name='Maarten')\nfan = me()\nself.assertEqual(fan, maarten)", "fan_number_one = FilmFan.film_fans.get(seq_nr=1)\nfan = me()\nself.assertIs(fan.seq_nr, fan_number_one.seq_nr)", "first_fan = FilmFan.film_fans.order_by('seq_nr')[0]\nmaarten = me()\nself.assertEqual(maarten, first_f...
<|body_start_0|> maarten = FilmFan.film_fans.get(name='Maarten') fan = me() self.assertEqual(fan, maarten) <|end_body_0|> <|body_start_1|> fan_number_one = FilmFan.film_fans.get(seq_nr=1) fan = me() self.assertIs(fan.seq_nr, fan_number_one.seq_nr) <|end_body_1|> <|body_...
FilmFanModelTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FilmFanModelTests: def test_film_fan_me_is_maarten(self): """me() always returns 'Maarten'.""" <|body_0|> def test_film_fan_me_is_number_one(self): """me() always has sequence number 1.""" <|body_1|> def test_film_fan_me_has_lowest_sequence_number(self):...
stack_v2_sparse_classes_10k_train_006519
17,658
no_license
[ { "docstring": "me() always returns 'Maarten'.", "name": "test_film_fan_me_is_maarten", "signature": "def test_film_fan_me_is_maarten(self)" }, { "docstring": "me() always has sequence number 1.", "name": "test_film_fan_me_is_number_one", "signature": "def test_film_fan_me_is_number_one(...
3
stack_v2_sparse_classes_30k_train_007302
Implement the Python class `FilmFanModelTests` described below. Class description: Implement the FilmFanModelTests class. Method signatures and docstrings: - def test_film_fan_me_is_maarten(self): me() always returns 'Maarten'. - def test_film_fan_me_is_number_one(self): me() always has sequence number 1. - def test_...
Implement the Python class `FilmFanModelTests` described below. Class description: Implement the FilmFanModelTests class. Method signatures and docstrings: - def test_film_fan_me_is_maarten(self): me() always returns 'Maarten'. - def test_film_fan_me_is_number_one(self): me() always has sequence number 1. - def test_...
4ebc9b43a07bbc627b5e21cae368ae31828d3d2e
<|skeleton|> class FilmFanModelTests: def test_film_fan_me_is_maarten(self): """me() always returns 'Maarten'.""" <|body_0|> def test_film_fan_me_is_number_one(self): """me() always has sequence number 1.""" <|body_1|> def test_film_fan_me_has_lowest_sequence_number(self):...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FilmFanModelTests: def test_film_fan_me_is_maarten(self): """me() always returns 'Maarten'.""" maarten = FilmFan.film_fans.get(name='Maarten') fan = me() self.assertEqual(fan, maarten) def test_film_fan_me_is_number_one(self): """me() always has sequence number 1."...
the_stack_v2_python_sparse
FilmRatings/film_list/tests.py
maar35/film-festival-planner
train
0
45a2b73b5b66b0059ee6dcbfeac393737c946a39
[ "super().__init__(pos_enc_class)\nself.conv = nn.Sequential(Conv2D(1, odim, 3, 2), nn.ReLU(), Conv2D(odim, odim, 5, 3), nn.ReLU())\nself.linear = Linear(odim * (((idim - 1) // 2 - 2) // 3), odim)\nself.subsampling_rate = 6\nself.right_context = 10", "x = x.unsqueeze(1)\nx = self.conv(x)\nb, c, t, f = x.shape\nx =...
<|body_start_0|> super().__init__(pos_enc_class) self.conv = nn.Sequential(Conv2D(1, odim, 3, 2), nn.ReLU(), Conv2D(odim, odim, 5, 3), nn.ReLU()) self.linear = Linear(odim * (((idim - 1) // 2 - 2) // 3), odim) self.subsampling_rate = 6 self.right_context = 10 <|end_body_0|> <|bo...
Convolutional 2D subsampling (to 1/6 length).
Conv2dSubsampling6
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Conv2dSubsampling6: """Convolutional 2D subsampling (to 1/6 length).""" def __init__(self, idim: int, odim: int, dropout_rate: float, pos_enc_class: nn.Layer=PositionalEncoding): """Construct an Conv2dSubsampling6 object. Args: idim (int): Input dimension. odim (int): Output dimensio...
stack_v2_sparse_classes_10k_train_006520
11,942
permissive
[ { "docstring": "Construct an Conv2dSubsampling6 object. Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate. pos_enc (PositionalEncoding): Custom position encoding layer.", "name": "__init__", "signature": "def __init__(self, idim: int, odim: int, dropout_...
2
stack_v2_sparse_classes_30k_train_003547
Implement the Python class `Conv2dSubsampling6` described below. Class description: Convolutional 2D subsampling (to 1/6 length). Method signatures and docstrings: - def __init__(self, idim: int, odim: int, dropout_rate: float, pos_enc_class: nn.Layer=PositionalEncoding): Construct an Conv2dSubsampling6 object. Args:...
Implement the Python class `Conv2dSubsampling6` described below. Class description: Convolutional 2D subsampling (to 1/6 length). Method signatures and docstrings: - def __init__(self, idim: int, odim: int, dropout_rate: float, pos_enc_class: nn.Layer=PositionalEncoding): Construct an Conv2dSubsampling6 object. Args:...
17854a04d43c231eff66bfed9d6aa55e94a29e79
<|skeleton|> class Conv2dSubsampling6: """Convolutional 2D subsampling (to 1/6 length).""" def __init__(self, idim: int, odim: int, dropout_rate: float, pos_enc_class: nn.Layer=PositionalEncoding): """Construct an Conv2dSubsampling6 object. Args: idim (int): Input dimension. odim (int): Output dimensio...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Conv2dSubsampling6: """Convolutional 2D subsampling (to 1/6 length).""" def __init__(self, idim: int, odim: int, dropout_rate: float, pos_enc_class: nn.Layer=PositionalEncoding): """Construct an Conv2dSubsampling6 object. Args: idim (int): Input dimension. odim (int): Output dimension. dropout_ra...
the_stack_v2_python_sparse
paddlespeech/s2t/modules/subsampling.py
anniyanvr/DeepSpeech-1
train
0
d661a27d6086beaca12f726338b2af02292fac66
[ "if not session_id:\n raise RedisKeyError('construct session_key required session_id')\nsession_key = self.key[session_id]\nif isinstance(session_key, bytes):\n session_key = session_key.decode('utf8')\nself.db.api.set(session_key, session_data)\nself.db.api.expire(session_key, timeout)", "if not session_id...
<|body_start_0|> if not session_id: raise RedisKeyError('construct session_key required session_id') session_key = self.key[session_id] if isinstance(session_key, bytes): session_key = session_key.decode('utf8') self.db.api.set(session_key, session_data) s...
session信息
SessionModel
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SessionModel: """session信息""" def set(self, session_id, session_data, timeout): """设置session信息""" <|body_0|> def get(self, session_id): """获取session信息""" <|body_1|> def delete(self, session_id): """删除session信息""" <|body_2|> <|end_ske...
stack_v2_sparse_classes_10k_train_006521
1,691
permissive
[ { "docstring": "设置session信息", "name": "set", "signature": "def set(self, session_id, session_data, timeout)" }, { "docstring": "获取session信息", "name": "get", "signature": "def get(self, session_id)" }, { "docstring": "删除session信息", "name": "delete", "signature": "def delet...
3
stack_v2_sparse_classes_30k_train_003313
Implement the Python class `SessionModel` described below. Class description: session信息 Method signatures and docstrings: - def set(self, session_id, session_data, timeout): 设置session信息 - def get(self, session_id): 获取session信息 - def delete(self, session_id): 删除session信息
Implement the Python class `SessionModel` described below. Class description: session信息 Method signatures and docstrings: - def set(self, session_id, session_data, timeout): 设置session信息 - def get(self, session_id): 获取session信息 - def delete(self, session_id): 删除session信息 <|skeleton|> class SessionModel: """sessio...
9999d70429d9f773501f9a11910997343ff2df93
<|skeleton|> class SessionModel: """session信息""" def set(self, session_id, session_data, timeout): """设置session信息""" <|body_0|> def get(self, session_id): """获取session信息""" <|body_1|> def delete(self, session_id): """删除session信息""" <|body_2|> <|end_ske...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SessionModel: """session信息""" def set(self, session_id, session_data, timeout): """设置session信息""" if not session_id: raise RedisKeyError('construct session_key required session_id') session_key = self.key[session_id] if isinstance(session_key, bytes): ...
the_stack_v2_python_sparse
api/model/redis/session.py
bopopescu/smp
train
0
92e73572b4c87f84fefac8bd2c4fb051458ff2ef
[ "super().__init__(*args, **kwargs)\nself.root: Any = LeoNode()\nself.root.h = 'ROOT'\nself.cur: Any = self.root\nself.idx = {}\nself.in_ = None\nself.in_attrs = {}\nself.path = []", "self.in_ = name\nself.in_attrs = attrs\nif name == 'v':\n nd = LeoNode()\n self.cur.children.append(nd)\n nd.parent = self...
<|body_start_0|> super().__init__(*args, **kwargs) self.root: Any = LeoNode() self.root.h = 'ROOT' self.cur: Any = self.root self.idx = {} self.in_ = None self.in_attrs = {} self.path = [] <|end_body_0|> <|body_start_1|> self.in_ = name se...
Read .leo files into a simple python data structure with h, b, u (unknown attribs), gnx and children information. Clones and derived files are ignored. Useful for scanning multiple .leo files quickly. :IVariables: root root node cur used internally during SAX read idx mapping from gnx to node `in_` name of XML element ...
LeoReader
[ "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LeoReader: """Read .leo files into a simple python data structure with h, b, u (unknown attribs), gnx and children information. Clones and derived files are ignored. Useful for scanning multiple .leo files quickly. :IVariables: root root node cur used internally during SAX read idx mapping from g...
stack_v2_sparse_classes_10k_train_006522
6,690
permissive
[ { "docstring": "Set ivars", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "collect information from v and t elements", "name": "startElement", "signature": "def startElement(self, name, attrs)" }, { "docstring": "decode unknownAttributes...
4
stack_v2_sparse_classes_30k_train_005162
Implement the Python class `LeoReader` described below. Class description: Read .leo files into a simple python data structure with h, b, u (unknown attribs), gnx and children information. Clones and derived files are ignored. Useful for scanning multiple .leo files quickly. :IVariables: root root node cur used intern...
Implement the Python class `LeoReader` described below. Class description: Read .leo files into a simple python data structure with h, b, u (unknown attribs), gnx and children information. Clones and derived files are ignored. Useful for scanning multiple .leo files quickly. :IVariables: root root node cur used intern...
a3f6c3ebda805dc40cd93123948f153a26eccee5
<|skeleton|> class LeoReader: """Read .leo files into a simple python data structure with h, b, u (unknown attribs), gnx and children information. Clones and derived files are ignored. Useful for scanning multiple .leo files quickly. :IVariables: root root node cur used internally during SAX read idx mapping from g...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LeoReader: """Read .leo files into a simple python data structure with h, b, u (unknown attribs), gnx and children information. Clones and derived files are ignored. Useful for scanning multiple .leo files quickly. :IVariables: root root node cur used internally during SAX read idx mapping from gnx to node `i...
the_stack_v2_python_sparse
leo/external/leosax.py
leo-editor/leo-editor
train
1,671
331f7416945d6b97a1324bb0ba1a0fd076c18677
[ "lookup_url_kwarg = self.lookup_url_kwarg or self.lookup_field\nlookup = self.kwargs.get(lookup_url_kwarg, None)\nif lookup is not None:\n return VideoUsers.objects.filter(video__hash_key=lookup).select_related('user', 'video').order_by('created_at')\nreturn VideoUsers.objects.none()", "if self.request.method ...
<|body_start_0|> lookup_url_kwarg = self.lookup_url_kwarg or self.lookup_field lookup = self.kwargs.get(lookup_url_kwarg, None) if lookup is not None: return VideoUsers.objects.filter(video__hash_key=lookup).select_related('user', 'video').order_by('created_at') return VideoU...
List all users of a video and add/invite new users. ## Reading ### Permissions * Only authenticated users can read this endpoint. * Only associated users can read this endpoint for a given video. ### Fields Reading this endpoint returns a list of VideoUser objects Name | Description | Type ----------------- | ---------...
VideoUserList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VideoUserList: """List all users of a video and add/invite new users. ## Reading ### Permissions * Only authenticated users can read this endpoint. * Only associated users can read this endpoint for a given video. ### Fields Reading this endpoint returns a list of VideoUser objects Name | Descrip...
stack_v2_sparse_classes_10k_train_006523
40,640
no_license
[ { "docstring": "This view should return a list of all associated users of a video as determined by the lookup parameters of the view.", "name": "get_queryset", "signature": "def get_queryset(self)" }, { "docstring": "a POST request implies video user creation so return the serializer for video u...
2
stack_v2_sparse_classes_30k_train_003695
Implement the Python class `VideoUserList` described below. Class description: List all users of a video and add/invite new users. ## Reading ### Permissions * Only authenticated users can read this endpoint. * Only associated users can read this endpoint for a given video. ### Fields Reading this endpoint returns a l...
Implement the Python class `VideoUserList` described below. Class description: List all users of a video and add/invite new users. ## Reading ### Permissions * Only authenticated users can read this endpoint. * Only associated users can read this endpoint for a given video. ### Fields Reading this endpoint returns a l...
1f4b4cd74c9b4280437f73bdfef4491536194eeb
<|skeleton|> class VideoUserList: """List all users of a video and add/invite new users. ## Reading ### Permissions * Only authenticated users can read this endpoint. * Only associated users can read this endpoint for a given video. ### Fields Reading this endpoint returns a list of VideoUser objects Name | Descrip...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class VideoUserList: """List all users of a video and add/invite new users. ## Reading ### Permissions * Only authenticated users can read this endpoint. * Only associated users can read this endpoint for a given video. ### Fields Reading this endpoint returns a list of VideoUser objects Name | Description | Type -...
the_stack_v2_python_sparse
gravvy/apps/video/views.py
nceruchalu/gravvy-server
train
1
751de327e538fea7fa1cfccc26afea28c0c0180e
[ "self._symbols = list()\nself._ngram = 1\nself.set_symbols(symbols)\nself.set_ngram(n)", "if len(symbols) == 0:\n raise EmptyError\nself._symbols = symbols", "n = int(n)\nif 0 < n <= MAX_NGRAM:\n self._ngram = n\nelse:\n raise InsideIntervalError(n, 1, MAX_NGRAM)", "if len(self._symbols) == 0:\n r...
<|body_start_0|> self._symbols = list() self._ngram = 1 self.set_symbols(symbols) self.set_ngram(n) <|end_body_0|> <|body_start_1|> if len(symbols) == 0: raise EmptyError self._symbols = symbols <|end_body_1|> <|body_start_2|> n = int(n) if 0...
Entropy estimation. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi Entropy is a measure of unpredictability of information content. Entropy is one of several ways to measure dive...
sppasEntropy
[ "GFDL-1.1-or-later", "GPL-3.0-only", "GPL-3.0-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class sppasEntropy: """Entropy estimation. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi Entropy is a measure of unpredictability of information content. Entrop...
stack_v2_sparse_classes_10k_train_006524
4,263
permissive
[ { "docstring": "Create a sppasEntropy instance with a list of symbols. :param symbols: (list) a vector of symbols of any type. :param n: (int) n value for n-gram estimation. n ranges 1..MAX_NGRAM", "name": "__init__", "signature": "def __init__(self, symbols, n=1)" }, { "docstring": "Set the lis...
4
null
Implement the Python class `sppasEntropy` described below. Class description: Entropy estimation. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi Entropy is a measure of unpredic...
Implement the Python class `sppasEntropy` described below. Class description: Entropy estimation. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi Entropy is a measure of unpredic...
3167b65f576abcc27a8767d24c274a04712bd948
<|skeleton|> class sppasEntropy: """Entropy estimation. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi Entropy is a measure of unpredictability of information content. Entrop...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class sppasEntropy: """Entropy estimation. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi Entropy is a measure of unpredictability of information content. Entropy is one of s...
the_stack_v2_python_sparse
sppas/sppas/src/calculus/infotheory/entropy.py
mirfan899/MTTS
train
0
eb5ae0cd1adeb6b277059c6a80b7205b5a984d2f
[ "self.width = width\nself.state = 0\nself.total = 0", "sys.stdout.write('[%s]' % (' ' * self.width))\nsys.stdout.flush()\nsys.stdout.write('\\x08' * (self.width + 1))\nself.state, self.total = (0, total_iterations)", "state_ = int(self.width * n) / int(self.total)\nif state_ == self.state:\n pass\nelif self....
<|body_start_0|> self.width = width self.state = 0 self.total = 0 <|end_body_0|> <|body_start_1|> sys.stdout.write('[%s]' % (' ' * self.width)) sys.stdout.flush() sys.stdout.write('\x08' * (self.width + 1)) self.state, self.total = (0, total_iterations) <|end_bod...
Progress Bar
ProgressBar
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProgressBar: """Progress Bar""" def __init__(self, width=40): """Initialise with some width""" <|body_0|> def start(self, total_iterations): """Set up a scaling factor for total iterations""" <|body_1|> def update(self, n): """Update the tick...
stack_v2_sparse_classes_10k_train_006525
2,362
no_license
[ { "docstring": "Initialise with some width", "name": "__init__", "signature": "def __init__(self, width=40)" }, { "docstring": "Set up a scaling factor for total iterations", "name": "start", "signature": "def start(self, total_iterations)" }, { "docstring": "Update the ticker", ...
4
stack_v2_sparse_classes_30k_train_003339
Implement the Python class `ProgressBar` described below. Class description: Progress Bar Method signatures and docstrings: - def __init__(self, width=40): Initialise with some width - def start(self, total_iterations): Set up a scaling factor for total iterations - def update(self, n): Update the ticker - def stop(s...
Implement the Python class `ProgressBar` described below. Class description: Progress Bar Method signatures and docstrings: - def __init__(self, width=40): Initialise with some width - def start(self, total_iterations): Set up a scaling factor for total iterations - def update(self, n): Update the ticker - def stop(s...
327f77e7a4f2fe874e2c66e5c9914de23aa224ed
<|skeleton|> class ProgressBar: """Progress Bar""" def __init__(self, width=40): """Initialise with some width""" <|body_0|> def start(self, total_iterations): """Set up a scaling factor for total iterations""" <|body_1|> def update(self, n): """Update the tick...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ProgressBar: """Progress Bar""" def __init__(self, width=40): """Initialise with some width""" self.width = width self.state = 0 self.total = 0 def start(self, total_iterations): """Set up a scaling factor for total iterations""" sys.stdout.write('[%s]...
the_stack_v2_python_sparse
python/util/ProgressBar.py
arunchaganty/spectral
train
0
ab653e3f647c9968115427fbb054d85039a08226
[ "tmp = []\nwhile head:\n tmp.append(head.val)\n head = head.next\nreturn tmp == tmp[::-1]", "tmp = []\nmove = head\nwhile move:\n tmp.append(move.val)\n move = move.next\nreturn tmp == tmp[::-1]" ]
<|body_start_0|> tmp = [] while head: tmp.append(head.val) head = head.next return tmp == tmp[::-1] <|end_body_0|> <|body_start_1|> tmp = [] move = head while move: tmp.append(move.val) move = move.next return tmp =...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isPalindrome(self, head: ListNode) -> bool: """复杂度分析: 时间复杂度:遍历链表并将值复制到数组中 O(n) 空间复杂度:O(n),其中n指的是链表元素个数,我们使用一个数组列表存放链表的元素值""" <|body_0|> def isPalindrome1(self, head: ListNode) -> bool: """最简单的方法就是将值复制到数组中,然后使用双指针法 确定数组列表是否回文很简单,我们可以用双指针来比较两端的元素,并向中间移动。 ...
stack_v2_sparse_classes_10k_train_006526
1,836
no_license
[ { "docstring": "复杂度分析: 时间复杂度:遍历链表并将值复制到数组中 O(n) 空间复杂度:O(n),其中n指的是链表元素个数,我们使用一个数组列表存放链表的元素值", "name": "isPalindrome", "signature": "def isPalindrome(self, head: ListNode) -> bool" }, { "docstring": "最简单的方法就是将值复制到数组中,然后使用双指针法 确定数组列表是否回文很简单,我们可以用双指针来比较两端的元素,并向中间移动。 一个指针从起点向中间移动,另一个指针从终点向中间移动,这需要 O(...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, head: ListNode) -> bool: 复杂度分析: 时间复杂度:遍历链表并将值复制到数组中 O(n) 空间复杂度:O(n),其中n指的是链表元素个数,我们使用一个数组列表存放链表的元素值 - def isPalindrome1(self, head: ListNode) -> bool: 最简单的...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, head: ListNode) -> bool: 复杂度分析: 时间复杂度:遍历链表并将值复制到数组中 O(n) 空间复杂度:O(n),其中n指的是链表元素个数,我们使用一个数组列表存放链表的元素值 - def isPalindrome1(self, head: ListNode) -> bool: 最简单的...
51943e2c2c4ec70c7c1d5b53c9fdf0a719428d7a
<|skeleton|> class Solution: def isPalindrome(self, head: ListNode) -> bool: """复杂度分析: 时间复杂度:遍历链表并将值复制到数组中 O(n) 空间复杂度:O(n),其中n指的是链表元素个数,我们使用一个数组列表存放链表的元素值""" <|body_0|> def isPalindrome1(self, head: ListNode) -> bool: """最简单的方法就是将值复制到数组中,然后使用双指针法 确定数组列表是否回文很简单,我们可以用双指针来比较两端的元素,并向中间移动。 ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def isPalindrome(self, head: ListNode) -> bool: """复杂度分析: 时间复杂度:遍历链表并将值复制到数组中 O(n) 空间复杂度:O(n),其中n指的是链表元素个数,我们使用一个数组列表存放链表的元素值""" tmp = [] while head: tmp.append(head.val) head = head.next return tmp == tmp[::-1] def isPalindrome1(self, hea...
the_stack_v2_python_sparse
LCCI/02_06_PalindromeLinkedList.py
LeBron-Jian/BasicAlgorithmPractice
train
13
01ab0524405545fffde9124f0b3bf31b6856d507
[ "self.voxel_size = voxel_size or voxel_data_dict['vox_size']\nself.vehicle_csys = vehicle_csys if vehicle_csys is not None else np.eye(4)\ntry:\n self.occupied_voxels = voxel_data_dict['value']\nexcept KeyError:\n self.occupied_voxels = voxel_data_dict['occupied_voxels']\nself.shape = self.occupied_voxels.sha...
<|body_start_0|> self.voxel_size = voxel_size or voxel_data_dict['vox_size'] self.vehicle_csys = vehicle_csys if vehicle_csys is not None else np.eye(4) try: self.occupied_voxels = voxel_data_dict['value'] except KeyError: self.occupied_voxels = voxel_data_dict['o...
Object to store information about a specific vehicle component, manikin, etc.
Component
[ "LicenseRef-scancode-other-permissive" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Component: """Object to store information about a specific vehicle component, manikin, etc.""" def __init__(self, voxel_data_dict, vehicle_csys=None, voxel_size=None): """:param voxel_data_dict: Output of voxelization routine, usually read in from file. :param voxel_size: The spacing...
stack_v2_sparse_classes_10k_train_006527
8,134
permissive
[ { "docstring": ":param voxel_data_dict: Output of voxelization routine, usually read in from file. :param voxel_size: The spacing between adjacent voxels. :param vehicle_csys: The transform matrix to go to the vehicle csys; usually ignored", "name": "__init__", "signature": "def __init__(self, voxel_dat...
6
null
Implement the Python class `Component` described below. Class description: Object to store information about a specific vehicle component, manikin, etc. Method signatures and docstrings: - def __init__(self, voxel_data_dict, vehicle_csys=None, voxel_size=None): :param voxel_data_dict: Output of voxelization routine, ...
Implement the Python class `Component` described below. Class description: Object to store information about a specific vehicle component, manikin, etc. Method signatures and docstrings: - def __init__(self, voxel_data_dict, vehicle_csys=None, voxel_size=None): :param voxel_data_dict: Output of voxelization routine, ...
bc7a05e04c7901f477fe553c59e478a837116d92
<|skeleton|> class Component: """Object to store information about a specific vehicle component, manikin, etc.""" def __init__(self, voxel_data_dict, vehicle_csys=None, voxel_size=None): """:param voxel_data_dict: Output of voxelization routine, usually read in from file. :param voxel_size: The spacing...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Component: """Object to store information about a specific vehicle component, manikin, etc.""" def __init__(self, voxel_data_dict, vehicle_csys=None, voxel_size=None): """:param voxel_data_dict: Output of voxelization routine, usually read in from file. :param voxel_size: The spacing between adja...
the_stack_v2_python_sparse
analysis_tools/PYTHON_RICARDO/output_ingress_egress/scripts/voxel_methods.py
metamorph-inc/meta-core
train
25
6020acf1143a12164983ea1e03fd1c2d2c0b8430
[ "try:\n verify_token(request.headers)\nexcept Exception as err:\n ns.abort(401, message=err)\ntry:\n prog = programas_sociales.read(id)\nexcept psycopg2.Error as err:\n ns.abort(400, message=get_msg_pgerror(err))\nexcept EmptySetError:\n ns.abort(404, message=self.progr_not_found)\nexcept Exception a...
<|body_start_0|> try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) try: prog = programas_sociales.read(id) except psycopg2.Error as err: ns.abort(400, message=get_msg_pgerror(err)) except EmptySe...
ProgramaSocial
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProgramaSocial: def get(self, id): """Recuperar un programa social""" <|body_0|> def put(self, id): """Actualizar un programa social""" <|body_1|> def delete(self, id): """Eliminar un programa social""" <|body_2|> <|end_skeleton|> <|bod...
stack_v2_sparse_classes_10k_train_006528
6,332
no_license
[ { "docstring": "Recuperar un programa social", "name": "get", "signature": "def get(self, id)" }, { "docstring": "Actualizar un programa social", "name": "put", "signature": "def put(self, id)" }, { "docstring": "Eliminar un programa social", "name": "delete", "signature"...
3
stack_v2_sparse_classes_30k_train_004710
Implement the Python class `ProgramaSocial` described below. Class description: Implement the ProgramaSocial class. Method signatures and docstrings: - def get(self, id): Recuperar un programa social - def put(self, id): Actualizar un programa social - def delete(self, id): Eliminar un programa social
Implement the Python class `ProgramaSocial` described below. Class description: Implement the ProgramaSocial class. Method signatures and docstrings: - def get(self, id): Recuperar un programa social - def put(self, id): Actualizar un programa social - def delete(self, id): Eliminar un programa social <|skeleton|> c...
e00610fac26ef3ca078fd037c0649b70fa0e9a09
<|skeleton|> class ProgramaSocial: def get(self, id): """Recuperar un programa social""" <|body_0|> def put(self, id): """Actualizar un programa social""" <|body_1|> def delete(self, id): """Eliminar un programa social""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ProgramaSocial: def get(self, id): """Recuperar un programa social""" try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) try: prog = programas_sociales.read(id) except psycopg2.Error as err: ...
the_stack_v2_python_sparse
DOS/soa/service/genl/endpoints/programas_sociales.py
Telematica/knight-rider
train
1
70c1a75cd41ccf9d1878125313543b58ef428e0a
[ "similarity_calc = region_similarity_calculator.IouSimilarity()\nmatcher = argmax_matcher.ArgMaxMatcher(match_threshold, unmatched_threshold=unmatched_threshold, negatives_lower_than_unmatched=True, force_match_for_each_row=True)\nbox_coder = faster_rcnn_box_coder.FasterRcnnBoxCoder()\nself._target_assigner = targe...
<|body_start_0|> similarity_calc = region_similarity_calculator.IouSimilarity() matcher = argmax_matcher.ArgMaxMatcher(match_threshold, unmatched_threshold=unmatched_threshold, negatives_lower_than_unmatched=True, force_match_for_each_row=True) box_coder = faster_rcnn_box_coder.FasterRcnnBoxCode...
Labeler for multiscale anchor boxes.
AnchorLabeler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnchorLabeler: """Labeler for multiscale anchor boxes.""" def __init__(self, anchors, num_classes, match_threshold=0.7, unmatched_threshold=0.3, rpn_batch_size_per_im=256, rpn_fg_fraction=0.5): """Constructs anchor labeler to assign labels to anchors. Args: anchors: an instance of cl...
stack_v2_sparse_classes_10k_train_006529
23,318
permissive
[ { "docstring": "Constructs anchor labeler to assign labels to anchors. Args: anchors: an instance of class Anchors. num_classes: integer number representing number of classes in the dataset. match_threshold: a float number between 0 and 1 representing the lower-bound threshold to assign positive labels for anch...
3
stack_v2_sparse_classes_30k_train_000577
Implement the Python class `AnchorLabeler` described below. Class description: Labeler for multiscale anchor boxes. Method signatures and docstrings: - def __init__(self, anchors, num_classes, match_threshold=0.7, unmatched_threshold=0.3, rpn_batch_size_per_im=256, rpn_fg_fraction=0.5): Constructs anchor labeler to a...
Implement the Python class `AnchorLabeler` described below. Class description: Labeler for multiscale anchor boxes. Method signatures and docstrings: - def __init__(self, anchors, num_classes, match_threshold=0.7, unmatched_threshold=0.3, rpn_batch_size_per_im=256, rpn_fg_fraction=0.5): Constructs anchor labeler to a...
4b387b6ad1066f2ee67b112e152e15cf37038130
<|skeleton|> class AnchorLabeler: """Labeler for multiscale anchor boxes.""" def __init__(self, anchors, num_classes, match_threshold=0.7, unmatched_threshold=0.3, rpn_batch_size_per_im=256, rpn_fg_fraction=0.5): """Constructs anchor labeler to assign labels to anchors. Args: anchors: an instance of cl...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AnchorLabeler: """Labeler for multiscale anchor boxes.""" def __init__(self, anchors, num_classes, match_threshold=0.7, unmatched_threshold=0.3, rpn_batch_size_per_im=256, rpn_fg_fraction=0.5): """Constructs anchor labeler to assign labels to anchors. Args: anchors: an instance of class Anchors. ...
the_stack_v2_python_sparse
models/experimental/mask_rcnn/anchors.py
boristown/tpu
train
5
86f36cced25211060eb700f305cef822ffd18378
[ "now = now or OSAUtil.get_now()\nbasetime = DateTimeUtil.toLoginTime(now)\nreturn basetime <= self.ltime", "if self.isToday(now=now):\n return self.point\nelse:\n return 0", "if self.isToday(now=now):\n return self.win\nelse:\n return 0", "if self.isToday(now=now):\n return self.winmax\nelse:\n...
<|body_start_0|> now = now or OSAUtil.get_now() basetime = DateTimeUtil.toLoginTime(now) return basetime <= self.ltime <|end_body_0|> <|body_start_1|> if self.isToday(now=now): return self.point else: return 0 <|end_body_1|> <|body_start_2|> if s...
プレイヤーのスコア情報.
BattleEventScore
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BattleEventScore: """プレイヤーのスコア情報.""" def isToday(self, now=None): """今日のスコアなのか判定.""" <|body_0|> def getPointToday(self, now=None): """本日獲得ポイントの取得.""" <|body_1|> def getWinToday(self, now=None): """本日現在連勝数の取得.""" <|body_2|> def ge...
stack_v2_sparse_classes_10k_train_006530
37,034
no_license
[ { "docstring": "今日のスコアなのか判定.", "name": "isToday", "signature": "def isToday(self, now=None)" }, { "docstring": "本日獲得ポイントの取得.", "name": "getPointToday", "signature": "def getPointToday(self, now=None)" }, { "docstring": "本日現在連勝数の取得.", "name": "getWinToday", "signature": "d...
6
null
Implement the Python class `BattleEventScore` described below. Class description: プレイヤーのスコア情報. Method signatures and docstrings: - def isToday(self, now=None): 今日のスコアなのか判定. - def getPointToday(self, now=None): 本日獲得ポイントの取得. - def getWinToday(self, now=None): 本日現在連勝数の取得. - def getWinMaxToday(self, now=None): 本日最大連勝数の取得...
Implement the Python class `BattleEventScore` described below. Class description: プレイヤーのスコア情報. Method signatures and docstrings: - def isToday(self, now=None): 今日のスコアなのか判定. - def getPointToday(self, now=None): 本日獲得ポイントの取得. - def getWinToday(self, now=None): 本日現在連勝数の取得. - def getWinMaxToday(self, now=None): 本日最大連勝数の取得...
492bf477ac00c380f2b2758c86b46aa7e58bbad9
<|skeleton|> class BattleEventScore: """プレイヤーのスコア情報.""" def isToday(self, now=None): """今日のスコアなのか判定.""" <|body_0|> def getPointToday(self, now=None): """本日獲得ポイントの取得.""" <|body_1|> def getWinToday(self, now=None): """本日現在連勝数の取得.""" <|body_2|> def ge...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BattleEventScore: """プレイヤーのスコア情報.""" def isToday(self, now=None): """今日のスコアなのか判定.""" now = now or OSAUtil.get_now() basetime = DateTimeUtil.toLoginTime(now) return basetime <= self.ltime def getPointToday(self, now=None): """本日獲得ポイントの取得.""" if self.isT...
the_stack_v2_python_sparse
src/dprj/platinumegg/app/cabaret/models/battleevent/BattleEvent.py
hitandaway100/caba
train
0
f7d89907cff987afc130332accfd777de62992ea
[ "if not 0.0 <= lr:\n raise ValueError('Invalid learning rate: {}'.format(lr))\nif not 0.0 <= betas[0] < 1.0:\n raise ValueError('Invalid beta parameter at index 0: {}'.format(betas[0]))\nif not 0.0 <= betas[1] < 1.0:\n raise ValueError('Invalid beta parameter at index 1: {}'.format(betas[1]))\ndefaults = d...
<|body_start_0|> if not 0.0 <= lr: raise ValueError('Invalid learning rate: {}'.format(lr)) if not 0.0 <= betas[0] < 1.0: raise ValueError('Invalid beta parameter at index 0: {}'.format(betas[0])) if not 0.0 <= betas[1] < 1.0: raise ValueError('Invalid beta pa...
Implements Lion algorithm. Generaly, it is recommended to divide lr used by AdamW by 10 and multiply the weight decay by 10.
Lion
[ "LicenseRef-scancode-proprietary-license", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Lion: """Implements Lion algorithm. Generaly, it is recommended to divide lr used by AdamW by 10 and multiply the weight decay by 10.""" def __init__(self, params: Union[Iterable[torch.Tensor], Iterable[dict]], lr: float=0.0001, betas: Tuple[float, float]=(0.9, 0.99), weight_decay: float=0.0...
stack_v2_sparse_classes_10k_train_006531
3,008
permissive
[ { "docstring": "Initialize the hyperparameters. :param params: Iterable of parameters to optimize or dicts defining parameter groups :param lr: Learning rate (default: 1e-4) :param betas: Coefficients used for computing running averages of gradient and its square (default: (0.9, 0.99)) :param weight_decay: Weig...
2
null
Implement the Python class `Lion` described below. Class description: Implements Lion algorithm. Generaly, it is recommended to divide lr used by AdamW by 10 and multiply the weight decay by 10. Method signatures and docstrings: - def __init__(self, params: Union[Iterable[torch.Tensor], Iterable[dict]], lr: float=0.0...
Implement the Python class `Lion` described below. Class description: Implements Lion algorithm. Generaly, it is recommended to divide lr used by AdamW by 10 and multiply the weight decay by 10. Method signatures and docstrings: - def __init__(self, params: Union[Iterable[torch.Tensor], Iterable[dict]], lr: float=0.0...
7240726cf6425b53a26ed2faec03672f30fee6be
<|skeleton|> class Lion: """Implements Lion algorithm. Generaly, it is recommended to divide lr used by AdamW by 10 and multiply the weight decay by 10.""" def __init__(self, params: Union[Iterable[torch.Tensor], Iterable[dict]], lr: float=0.0001, betas: Tuple[float, float]=(0.9, 0.99), weight_decay: float=0.0...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Lion: """Implements Lion algorithm. Generaly, it is recommended to divide lr used by AdamW by 10 and multiply the weight decay by 10.""" def __init__(self, params: Union[Iterable[torch.Tensor], Iterable[dict]], lr: float=0.0001, betas: Tuple[float, float]=(0.9, 0.99), weight_decay: float=0.0): ""...
the_stack_v2_python_sparse
src/super_gradients/training/utils/optimizers/lion.py
Deci-AI/super-gradients
train
3,237
e9c21be15e811cdaed551b974b9cc3bfa994ad37
[ "step = 0\nmedian_p = (len(nums1) + len(nums2) - 1) / 2\nmedian = []\nwhile True:\n if step - median_p >= 1:\n break\n if abs(step - median_p) <= 0.5:\n if len(nums1) == 0:\n median.append(nums2[0])\n elif len(nums2) == 0:\n median.append(nums1[0])\n else:\n ...
<|body_start_0|> step = 0 median_p = (len(nums1) + len(nums2) - 1) / 2 median = [] while True: if step - median_p >= 1: break if abs(step - median_p) <= 0.5: if len(nums1) == 0: median.append(nums2[0]) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float: """Set two pointer, get rid of min of two arrays each step. [1, 2] [_, 2] ^ => ^ [3, 4] [3, 4] ^ ^""" <|body_0|> def findMedianSortedArrays_2(self, nums1: List[int], nums2: List[int]) ->...
stack_v2_sparse_classes_10k_train_006532
2,905
no_license
[ { "docstring": "Set two pointer, get rid of min of two arrays each step. [1, 2] [_, 2] ^ => ^ [3, 4] [3, 4] ^ ^", "name": "findMedianSortedArrays", "signature": "def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float" }, { "docstring": "Step 4 pointer, get rid of a min and...
2
stack_v2_sparse_classes_30k_train_006506
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float: Set two pointer, get rid of min of two arrays each step. [1, 2] [_, 2] ^ => ^ [3, 4] [3, 4] ^ ^ - d...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float: Set two pointer, get rid of min of two arrays each step. [1, 2] [_, 2] ^ => ^ [3, 4] [3, 4] ^ ^ - d...
d679a06a72e6dc18aed95c7e79e25de87e9c18c2
<|skeleton|> class Solution: def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float: """Set two pointer, get rid of min of two arrays each step. [1, 2] [_, 2] ^ => ^ [3, 4] [3, 4] ^ ^""" <|body_0|> def findMedianSortedArrays_2(self, nums1: List[int], nums2: List[int]) ->...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float: """Set two pointer, get rid of min of two arrays each step. [1, 2] [_, 2] ^ => ^ [3, 4] [3, 4] ^ ^""" step = 0 median_p = (len(nums1) + len(nums2) - 1) / 2 median = [] while True: ...
the_stack_v2_python_sparse
leetcode/4-median-of-two-sorted-arrays.py
ninjaboynaru/my-python-demo
train
0
300884930c8f7a48387f7545d16949339280f686
[ "super().__init__()\nself.dropout = Dropout(dropout)\nself.hidden_size = hidden_size\nself.activation = ELU()\nself.log_softmax = LogSoftmax(dim=2)\nif hidden_size is None:\n self.layers = ModuleList([GraphAttentionLayer(in_features=in_features, out_features=out_features, dropout=dropout, alpha=alpha) for _ in r...
<|body_start_0|> super().__init__() self.dropout = Dropout(dropout) self.hidden_size = hidden_size self.activation = ELU() self.log_softmax = LogSoftmax(dim=2) if hidden_size is None: self.layers = ModuleList([GraphAttentionLayer(in_features=in_features, out_f...
图注意力模型,当前模型,最多支持两层
GAT
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GAT: """图注意力模型,当前模型,最多支持两层""" def __init__(self, in_features: int, out_features: int, dropout: float, alpha: float, num_heads: int, hidden_size: int=None): """初始化 :param in_features: 输入的 node 维度 :param out_features: 输出的 node 维度 :param dropout: dropout :param alpha: 在 GraphAttentionLa...
stack_v2_sparse_classes_10k_train_006533
6,041
permissive
[ { "docstring": "初始化 :param in_features: 输入的 node 维度 :param out_features: 输出的 node 维度 :param dropout: dropout :param alpha: 在 GraphAttentionLayer 中 LeakyRelu 用到的 alpha :param num_heads: 头的数量 :param hidden_size: 隐层 size,如果是 None 表示没有隐层; 否则,只有一个隐层", "name": "__init__", "signature": "def __init__(self, in_f...
2
stack_v2_sparse_classes_30k_train_001458
Implement the Python class `GAT` described below. Class description: 图注意力模型,当前模型,最多支持两层 Method signatures and docstrings: - def __init__(self, in_features: int, out_features: int, dropout: float, alpha: float, num_heads: int, hidden_size: int=None): 初始化 :param in_features: 输入的 node 维度 :param out_features: 输出的 node 维度...
Implement the Python class `GAT` described below. Class description: 图注意力模型,当前模型,最多支持两层 Method signatures and docstrings: - def __init__(self, in_features: int, out_features: int, dropout: float, alpha: float, num_heads: int, hidden_size: int=None): 初始化 :param in_features: 输入的 node 维度 :param out_features: 输出的 node 维度...
ef83261a366bd8d7c259aa112da14f3fa7cdf918
<|skeleton|> class GAT: """图注意力模型,当前模型,最多支持两层""" def __init__(self, in_features: int, out_features: int, dropout: float, alpha: float, num_heads: int, hidden_size: int=None): """初始化 :param in_features: 输入的 node 维度 :param out_features: 输出的 node 维度 :param dropout: dropout :param alpha: 在 GraphAttentionLa...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GAT: """图注意力模型,当前模型,最多支持两层""" def __init__(self, in_features: int, out_features: int, dropout: float, alpha: float, num_heads: int, hidden_size: int=None): """初始化 :param in_features: 输入的 node 维度 :param out_features: 输出的 node 维度 :param dropout: dropout :param alpha: 在 GraphAttentionLayer 中 LeakyRe...
the_stack_v2_python_sparse
easytext/modules/gat.py
freedomkite/easytext
train
0
cb74a270e851a21debf6da1acadf6d7a02df060f
[ "auth = request.authorization\nif auth:\n user_email = auth.username\n user = get_user_by_email(user_email)\n user_id = user.id\nelse:\n user_id = current_user.id\n user_email = current_user.email\nlogger.debug(f'Creating new question for user {user_email}.')\nlogger.debug(request.json)\nqid = ''.joi...
<|body_start_0|> auth = request.authorization if auth: user_email = auth.username user = get_user_by_email(user_email) user_id = user.id else: user_id = current_user.id user_email = current_user.email logger.debug(f'Creating new...
QuestionsAPI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuestionsAPI: def post(self): """Create new question --- tags: [question] parameters: - in: body name: question schema: $ref: '#/definitions/Question' required: true - name: RebuildCache in: header description: flag indicating whether to update the cached knowledge graph required: false ...
stack_v2_sparse_classes_10k_train_006534
5,476
no_license
[ { "docstring": "Create new question --- tags: [question] parameters: - in: body name: question schema: $ref: '#/definitions/Question' required: true - name: RebuildCache in: header description: flag indicating whether to update the cached knowledge graph required: false default: true type: string - name: Answer...
2
stack_v2_sparse_classes_30k_train_006914
Implement the Python class `QuestionsAPI` described below. Class description: Implement the QuestionsAPI class. Method signatures and docstrings: - def post(self): Create new question --- tags: [question] parameters: - in: body name: question schema: $ref: '#/definitions/Question' required: true - name: RebuildCache ...
Implement the Python class `QuestionsAPI` described below. Class description: Implement the QuestionsAPI class. Method signatures and docstrings: - def post(self): Create new question --- tags: [question] parameters: - in: body name: question schema: $ref: '#/definitions/Question' required: true - name: RebuildCache ...
23e3c72b364184d2a3fe23d8a5694a3a77872719
<|skeleton|> class QuestionsAPI: def post(self): """Create new question --- tags: [question] parameters: - in: body name: question schema: $ref: '#/definitions/Question' required: true - name: RebuildCache in: header description: flag indicating whether to update the cached knowledge graph required: false ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class QuestionsAPI: def post(self): """Create new question --- tags: [question] parameters: - in: body name: question schema: $ref: '#/definitions/Question' required: true - name: RebuildCache in: header description: flag indicating whether to update the cached knowledge graph required: false default: true ...
the_stack_v2_python_sparse
manager/api/questions_api.py
wahello/robokop
train
0
f505fb7fb8031af3ef4bf60a52df08165a467262
[ "self.asteroid_list = []\ni = 0\nwhile i < 100:\n self.asteroid_list.append(Asteroid(random.randint(1, 4), [random.randint(0, 100), random.randint(0, 100), random.randint(0, 100)], [random.randint(-5, 5), random.randint(-5, 5), random.randint(-5, 5)], datetime.now()))\n i += 1", "i = 0\nwhile i < int(second...
<|body_start_0|> self.asteroid_list = [] i = 0 while i < 100: self.asteroid_list.append(Asteroid(random.randint(1, 4), [random.randint(0, 100), random.randint(0, 100), random.randint(0, 100)], [random.randint(-5, 5), random.randint(-5, 5), random.randint(-5, 5)], datetime.now())) ...
A controller that controls asteroids
Controller
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Controller: """A controller that controls asteroids""" def __init__(self): """Initialization of a controller Creates 100 Asteroids.""" <|body_0|> def simulate(self, seconds): """Simulates the movements for asteroids. Accepts a number of seconds and move all aster...
stack_v2_sparse_classes_10k_train_006535
1,600
no_license
[ { "docstring": "Initialization of a controller Creates 100 Asteroids.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Simulates the movements for asteroids. Accepts a number of seconds and move all asteroids every second Prints resultant information :param seconds: an ...
2
stack_v2_sparse_classes_30k_train_000600
Implement the Python class `Controller` described below. Class description: A controller that controls asteroids Method signatures and docstrings: - def __init__(self): Initialization of a controller Creates 100 Asteroids. - def simulate(self, seconds): Simulates the movements for asteroids. Accepts a number of secon...
Implement the Python class `Controller` described below. Class description: A controller that controls asteroids Method signatures and docstrings: - def __init__(self): Initialization of a controller Creates 100 Asteroids. - def simulate(self, seconds): Simulates the movements for asteroids. Accepts a number of secon...
ec79fbccd6cab95192ba8ab0cb42aa3b52a8af99
<|skeleton|> class Controller: """A controller that controls asteroids""" def __init__(self): """Initialization of a controller Creates 100 Asteroids.""" <|body_0|> def simulate(self, seconds): """Simulates the movements for asteroids. Accepts a number of seconds and move all aster...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Controller: """A controller that controls asteroids""" def __init__(self): """Initialization of a controller Creates 100 Asteroids.""" self.asteroid_list = [] i = 0 while i < 100: self.asteroid_list.append(Asteroid(random.randint(1, 4), [random.randint(0, 100),...
the_stack_v2_python_sparse
Labs/Lab 1/controller.py
a01037479/Python_OOP_Projects
train
0
be5ec931135ab16a6c583c484734d52cba16bd5b
[ "logs = get_logging_container()\n_, parsed_data, logs = self.parse_stdout_from_retrieved(logs)\nbase_exit_code = self.check_base_errors(logs)\nif base_exit_code:\n return self.exit(base_exit_code, logs)\nself.out('output_parameters', Dict(dict=parsed_data))\nif 'ERROR_OUTPUT_STDOUT_INCOMPLETE' in logs.error:\n ...
<|body_start_0|> logs = get_logging_container() _, parsed_data, logs = self.parse_stdout_from_retrieved(logs) base_exit_code = self.check_base_errors(logs) if base_exit_code: return self.exit(base_exit_code, logs) self.out('output_parameters', Dict(dict=parsed_data)) ...
``Parser`` implementation for the ``Pw2gwCalculation`` calculation job class.
Pw2gwParser
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Pw2gwParser: """``Parser`` implementation for the ``Pw2gwCalculation`` calculation job class.""" def parse(self, **kwargs): """Parse the retrieved files of a completed ``Pw2gwCalculation`` into output nodes. Two nodes that are expected are the default 'retrieved' `FolderData` node wh...
stack_v2_sparse_classes_10k_train_006536
2,882
permissive
[ { "docstring": "Parse the retrieved files of a completed ``Pw2gwCalculation`` into output nodes. Two nodes that are expected are the default 'retrieved' `FolderData` node which will store the retrieved files permanently in the repository. The second required node is a filepath under the key ``retrieved_temporar...
2
stack_v2_sparse_classes_30k_train_000716
Implement the Python class `Pw2gwParser` described below. Class description: ``Parser`` implementation for the ``Pw2gwCalculation`` calculation job class. Method signatures and docstrings: - def parse(self, **kwargs): Parse the retrieved files of a completed ``Pw2gwCalculation`` into output nodes. Two nodes that are ...
Implement the Python class `Pw2gwParser` described below. Class description: ``Parser`` implementation for the ``Pw2gwCalculation`` calculation job class. Method signatures and docstrings: - def parse(self, **kwargs): Parse the retrieved files of a completed ``Pw2gwCalculation`` into output nodes. Two nodes that are ...
7263f92ccabcfc9f828b9da5473e1aefbc4b8eca
<|skeleton|> class Pw2gwParser: """``Parser`` implementation for the ``Pw2gwCalculation`` calculation job class.""" def parse(self, **kwargs): """Parse the retrieved files of a completed ``Pw2gwCalculation`` into output nodes. Two nodes that are expected are the default 'retrieved' `FolderData` node wh...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Pw2gwParser: """``Parser`` implementation for the ``Pw2gwCalculation`` calculation job class.""" def parse(self, **kwargs): """Parse the retrieved files of a completed ``Pw2gwCalculation`` into output nodes. Two nodes that are expected are the default 'retrieved' `FolderData` node which will stor...
the_stack_v2_python_sparse
src/aiida_quantumespresso/parsers/pw2gw.py
aiidateam/aiida-quantumespresso
train
56
58acf9b021c23cb8a6f947132690dd48af82702c
[ "res = 0\nwhile height.count(0) != len(height):\n ceng = [c != 0 for c in height]\n height = [c - 1 if c != 0 else 0 for c in height]\n stack = []\n for k in range(len(ceng)):\n if ceng[k] == 1:\n if stack != []:\n res += k - stack.pop() - 1\n stack.append(k)\...
<|body_start_0|> res = 0 while height.count(0) != len(height): ceng = [c != 0 for c in height] height = [c - 1 if c != 0 else 0 for c in height] stack = [] for k in range(len(ceng)): if ceng[k] == 1: if stack != []: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def trap2(self, height): """:type height: List[int] :rtype: int""" <|body_0|> def trap(self, height): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> res = 0 while height.count(0) != len(heigh...
stack_v2_sparse_classes_10k_train_006537
1,691
no_license
[ { "docstring": ":type height: List[int] :rtype: int", "name": "trap2", "signature": "def trap2(self, height)" }, { "docstring": ":type height: List[int] :rtype: int", "name": "trap", "signature": "def trap(self, height)" } ]
2
stack_v2_sparse_classes_30k_test_000246
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def trap2(self, height): :type height: List[int] :rtype: int - def trap(self, height): :type height: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def trap2(self, height): :type height: List[int] :rtype: int - def trap(self, height): :type height: List[int] :rtype: int <|skeleton|> class Solution: def trap2(self, heig...
3dec0f75cb9c04c3eed05eb87eb59254ec0b379a
<|skeleton|> class Solution: def trap2(self, height): """:type height: List[int] :rtype: int""" <|body_0|> def trap(self, height): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def trap2(self, height): """:type height: List[int] :rtype: int""" res = 0 while height.count(0) != len(height): ceng = [c != 0 for c in height] height = [c - 1 if c != 0 else 0 for c in height] stack = [] for k in range(len(cen...
the_stack_v2_python_sparse
42. Trapping Rain Water.py
cosJin/top100liked
train
0
b2caca50b861acd136c5211fc6d478e9b6671a05
[ "self.xmax = max(self.xmax, x)\nif node.left:\n xleft = x + 1 if node.left.val == node.val + 1 else 1\n self.backtrack(xleft, node.left)\nif node.right:\n xright = x + 1 if node.right.val == node.val + 1 else 1\n self.backtrack(xright, node.right)", "self.xmax = 0\nif root:\n self.backtrack(1, root...
<|body_start_0|> self.xmax = max(self.xmax, x) if node.left: xleft = x + 1 if node.left.val == node.val + 1 else 1 self.backtrack(xleft, node.left) if node.right: xright = x + 1 if node.right.val == node.val + 1 else 1 self.backtrack(xright, node.r...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def backtrack(self, x, node): """x: length of consecutive path to this node.""" <|body_0|> def longestConsecutive(self, root: TreeNode) -> int: """DFS""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.xmax = max(self.xmax, x) if...
stack_v2_sparse_classes_10k_train_006538
1,006
no_license
[ { "docstring": "x: length of consecutive path to this node.", "name": "backtrack", "signature": "def backtrack(self, x, node)" }, { "docstring": "DFS", "name": "longestConsecutive", "signature": "def longestConsecutive(self, root: TreeNode) -> int" } ]
2
stack_v2_sparse_classes_30k_test_000236
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def backtrack(self, x, node): x: length of consecutive path to this node. - def longestConsecutive(self, root: TreeNode) -> int: DFS
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def backtrack(self, x, node): x: length of consecutive path to this node. - def longestConsecutive(self, root: TreeNode) -> int: DFS <|skeleton|> class Solution: def backtr...
6043134736452a6f4704b62857d0aed2e9571164
<|skeleton|> class Solution: def backtrack(self, x, node): """x: length of consecutive path to this node.""" <|body_0|> def longestConsecutive(self, root: TreeNode) -> int: """DFS""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def backtrack(self, x, node): """x: length of consecutive path to this node.""" self.xmax = max(self.xmax, x) if node.left: xleft = x + 1 if node.left.val == node.val + 1 else 1 self.backtrack(xleft, node.left) if node.right: xright...
the_stack_v2_python_sparse
src/0200-0299/0298.longest.consecutive.path.bt.py
gyang274/leetcode
train
1
9d23470887d73755c46c900dd53009a8fa564faf
[ "if verbosity == 1:\n return '{}'.format(self.terse_message)\nelif verbosity == 2:\n return '{}: {}'.format(self.general_message, self.terse_message)\nelse:\n raise Exception('Unrecognized verbosity setting, {}.'.format(verbosity))", "self.function = function\nif line_numbers:\n self.line_numbers = li...
<|body_start_0|> if verbosity == 1: return '{}'.format(self.terse_message) elif verbosity == 2: return '{}: {}'.format(self.general_message, self.terse_message) else: raise Exception('Unrecognized verbosity setting, {}.'.format(verbosity)) <|end_body_0|> <|bo...
The base error class for any darglint error.
DarglintError
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DarglintError: """The base error class for any darglint error.""" def message(self, verbosity=1): """Get the message for this error, according to the verbosity. Args: verbosity: An integer in the set {1,2}, where 1 is a more terse message, and 2 includes a general description. Raises...
stack_v2_sparse_classes_10k_train_006539
19,613
permissive
[ { "docstring": "Get the message for this error, according to the verbosity. Args: verbosity: An integer in the set {1,2}, where 1 is a more terse message, and 2 includes a general description. Raises: Exception: If the verbosity level is not recognized. Returns: An error message.", "name": "message", "s...
2
stack_v2_sparse_classes_30k_train_006877
Implement the Python class `DarglintError` described below. Class description: The base error class for any darglint error. Method signatures and docstrings: - def message(self, verbosity=1): Get the message for this error, according to the verbosity. Args: verbosity: An integer in the set {1,2}, where 1 is a more te...
Implement the Python class `DarglintError` described below. Class description: The base error class for any darglint error. Method signatures and docstrings: - def message(self, verbosity=1): Get the message for this error, according to the verbosity. Args: verbosity: An integer in the set {1,2}, where 1 is a more te...
abc26b768cd7135d848223ba53f68323593c33d5
<|skeleton|> class DarglintError: """The base error class for any darglint error.""" def message(self, verbosity=1): """Get the message for this error, according to the verbosity. Args: verbosity: An integer in the set {1,2}, where 1 is a more terse message, and 2 includes a general description. Raises...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DarglintError: """The base error class for any darglint error.""" def message(self, verbosity=1): """Get the message for this error, according to the verbosity. Args: verbosity: An integer in the set {1,2}, where 1 is a more terse message, and 2 includes a general description. Raises: Exception: ...
the_stack_v2_python_sparse
darglint/errors.py
terrencepreilly/darglint
train
487
cc5937f78c4f2f3a2461ecd2850b1d3dc4c4f9b4
[ "primitive = C_STORE()\nprimitive.MessageID = 7\nprimitive.AffectedSOPClassUID = '1.1.1'\nprimitive.AffectedSOPInstanceUID = '1.2.1'\nprimitive.Priority = 2\nprimitive.MoveOriginatorApplicationEntityTitle = b'UNITTEST'\nprimitive.MoveOriginatorMessageID = 3\nprimitive.DataSet = BytesIO(encode(DATASET, True, True))\...
<|body_start_0|> primitive = C_STORE() primitive.MessageID = 7 primitive.AffectedSOPClassUID = '1.1.1' primitive.AffectedSOPInstanceUID = '1.2.1' primitive.Priority = 2 primitive.MoveOriginatorApplicationEntityTitle = b'UNITTEST' primitive.MoveOriginatorMessageID ...
TestDecodeMessage
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestDecodeMessage: def setup_method(self): """Run prior to each test""" <|body_0|> def time_decode(self): """Benchmark for standard decode.""" <|body_1|> <|end_skeleton|> <|body_start_0|> primitive = C_STORE() primitive.MessageID = 7 ...
stack_v2_sparse_classes_10k_train_006540
1,948
permissive
[ { "docstring": "Run prior to each test", "name": "setup_method", "signature": "def setup_method(self)" }, { "docstring": "Benchmark for standard decode.", "name": "time_decode", "signature": "def time_decode(self)" } ]
2
stack_v2_sparse_classes_30k_train_003761
Implement the Python class `TestDecodeMessage` described below. Class description: Implement the TestDecodeMessage class. Method signatures and docstrings: - def setup_method(self): Run prior to each test - def time_decode(self): Benchmark for standard decode.
Implement the Python class `TestDecodeMessage` described below. Class description: Implement the TestDecodeMessage class. Method signatures and docstrings: - def setup_method(self): Run prior to each test - def time_decode(self): Benchmark for standard decode. <|skeleton|> class TestDecodeMessage: def setup_met...
2aa9ed7e3f7f03a0c9af48fe8b0049c82e74ee48
<|skeleton|> class TestDecodeMessage: def setup_method(self): """Run prior to each test""" <|body_0|> def time_decode(self): """Benchmark for standard decode.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestDecodeMessage: def setup_method(self): """Run prior to each test""" primitive = C_STORE() primitive.MessageID = 7 primitive.AffectedSOPClassUID = '1.1.1' primitive.AffectedSOPInstanceUID = '1.2.1' primitive.Priority = 2 primitive.MoveOriginatorApplic...
the_stack_v2_python_sparse
pynetdicom/benchmarks/bench_dimse_message.py
pydicom/pynetdicom
train
342
d0c33176a0e1c743df6302c91421a9611fc437ac
[ "self.flag = True\nif not matrix or not matrix[0]:\n self.flag = False\n return\nself.rows, self.cols = (len(matrix), len(matrix[0]))\nself.sum_matrix = [[0] * self.cols for _ in range(self.rows)]\nself.sum_matrix[0][0] = matrix[0][0]\nfor row in range(1, self.rows):\n self.sum_matrix[row][0] = matrix[row]...
<|body_start_0|> self.flag = True if not matrix or not matrix[0]: self.flag = False return self.rows, self.cols = (len(matrix), len(matrix[0])) self.sum_matrix = [[0] * self.cols for _ in range(self.rows)] self.sum_matrix[0][0] = matrix[0][0] for r...
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_10k_train_006541
2,683
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
null
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:...
238995bd23c8a6c40c6035890e94baa2473d4bbc
<|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_10k
data/stack_v2_sparse_classes_30k
class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" self.flag = True if not matrix or not matrix[0]: self.flag = False return self.rows, self.cols = (len(matrix), len(matrix[0])) self.sum_matrix = [[0] * self.cols for _ in ...
the_stack_v2_python_sparse
problems/N304_Range_Sum_Query_2d_immutable.py
wan-catherine/Leetcode
train
5
f60ffd73766652aa362fc12229e2e3393a4a99a3
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn UserExperienceAnalyticsAppHealthDevicePerformanceDetails()", "from .entity import Entity\nfrom .entity import Entity\nfields: Dict[str, Callable[[Any], None]] = {'appDisplayName': lambda n: setattr(self, 'app_display_name', n.get_str_v...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return UserExperienceAnalyticsAppHealthDevicePerformanceDetails() <|end_body_0|> <|body_start_1|> from .entity import Entity from .entity import Entity fields: Dict[str, Callable[[Any],...
The user experience analytics device performance entity contains device performance details.
UserExperienceAnalyticsAppHealthDevicePerformanceDetails
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserExperienceAnalyticsAppHealthDevicePerformanceDetails: """The user experience analytics device performance entity contains device performance details.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserExperienceAnalyticsAppHealthDevicePerformanceDetails: ...
stack_v2_sparse_classes_10k_train_006542
4,377
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: UserExperienceAnalyticsAppHealthDevicePerformanceDetails", "name": "create_from_discriminator_value", "signa...
3
null
Implement the Python class `UserExperienceAnalyticsAppHealthDevicePerformanceDetails` described below. Class description: The user experience analytics device performance entity contains device performance details. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]...
Implement the Python class `UserExperienceAnalyticsAppHealthDevicePerformanceDetails` described below. Class description: The user experience analytics device performance entity contains device performance details. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class UserExperienceAnalyticsAppHealthDevicePerformanceDetails: """The user experience analytics device performance entity contains device performance details.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserExperienceAnalyticsAppHealthDevicePerformanceDetails: ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UserExperienceAnalyticsAppHealthDevicePerformanceDetails: """The user experience analytics device performance entity contains device performance details.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserExperienceAnalyticsAppHealthDevicePerformanceDetails: """Cr...
the_stack_v2_python_sparse
msgraph/generated/models/user_experience_analytics_app_health_device_performance_details.py
microsoftgraph/msgraph-sdk-python
train
135
e3d81a88d2beae1934c4d4bd3cc410487944496d
[ "self.is_entire_drive_required = is_entire_drive_required\nself.restore_drive_id = restore_drive_id\nself.restore_drive_name = restore_drive_name\nself.restore_path_vec = restore_path_vec", "if dictionary is None:\n return None\nis_entire_drive_required = dictionary.get('isEntireDriveRequired')\nrestore_drive_...
<|body_start_0|> self.is_entire_drive_required = is_entire_drive_required self.restore_drive_id = restore_drive_id self.restore_drive_name = restore_drive_name self.restore_path_vec = restore_path_vec <|end_body_0|> <|body_start_1|> if dictionary is None: return None...
Implementation of the 'RestoreSiteParams_SiteOwner_Drive' model. TODO: type description here. Attributes: is_entire_drive_required (bool): Specify if the entire drive is to be restored. This field should be false if restore_item_vec size > 0. restore_drive_id (string): Id of the drive whose items are being restored. re...
RestoreSiteParams_SiteOwner_Drive
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RestoreSiteParams_SiteOwner_Drive: """Implementation of the 'RestoreSiteParams_SiteOwner_Drive' model. TODO: type description here. Attributes: is_entire_drive_required (bool): Specify if the entire drive is to be restored. This field should be false if restore_item_vec size > 0. restore_drive_id...
stack_v2_sparse_classes_10k_train_006543
3,026
permissive
[ { "docstring": "Constructor for the RestoreSiteParams_SiteOwner_Drive class", "name": "__init__", "signature": "def __init__(self, is_entire_drive_required=None, restore_drive_id=None, restore_drive_name=None, restore_path_vec=None)" }, { "docstring": "Creates an instance of this model from a di...
2
null
Implement the Python class `RestoreSiteParams_SiteOwner_Drive` described below. Class description: Implementation of the 'RestoreSiteParams_SiteOwner_Drive' model. TODO: type description here. Attributes: is_entire_drive_required (bool): Specify if the entire drive is to be restored. This field should be false if rest...
Implement the Python class `RestoreSiteParams_SiteOwner_Drive` described below. Class description: Implementation of the 'RestoreSiteParams_SiteOwner_Drive' model. TODO: type description here. Attributes: is_entire_drive_required (bool): Specify if the entire drive is to be restored. This field should be false if rest...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class RestoreSiteParams_SiteOwner_Drive: """Implementation of the 'RestoreSiteParams_SiteOwner_Drive' model. TODO: type description here. Attributes: is_entire_drive_required (bool): Specify if the entire drive is to be restored. This field should be false if restore_item_vec size > 0. restore_drive_id...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RestoreSiteParams_SiteOwner_Drive: """Implementation of the 'RestoreSiteParams_SiteOwner_Drive' model. TODO: type description here. Attributes: is_entire_drive_required (bool): Specify if the entire drive is to be restored. This field should be false if restore_item_vec size > 0. restore_drive_id (string): Id...
the_stack_v2_python_sparse
cohesity_management_sdk/models/restore_site_params_site_owner_drive.py
cohesity/management-sdk-python
train
24
aa9a09bc595ade1419abb2183ac8589ae774764a
[ "self.seq = []\nfor i in range(0, len(A), 2):\n if A[i] == 0:\n continue\n self.seq.append([A[i], A[i + 1]])\nself.seq.reverse()", "last_num = -1\nwhile self.seq and n >= self.seq[-1][0]:\n n -= self.seq[-1][0]\n last_num = self.seq[-1][1]\n self.seq.pop()\nif n > 0 and self.seq:\n self.s...
<|body_start_0|> self.seq = [] for i in range(0, len(A), 2): if A[i] == 0: continue self.seq.append([A[i], A[i + 1]]) self.seq.reverse() <|end_body_0|> <|body_start_1|> last_num = -1 while self.seq and n >= self.seq[-1][0]: n -...
RLEIterator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RLEIterator: def __init__(self, A): """:type A: List[int]""" <|body_0|> def next(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.seq = [] for i in range(0, len(A), 2): if A[i] == 0: ...
stack_v2_sparse_classes_10k_train_006544
826
no_license
[ { "docstring": ":type A: List[int]", "name": "__init__", "signature": "def __init__(self, A)" }, { "docstring": ":type n: int :rtype: int", "name": "next", "signature": "def next(self, n)" } ]
2
null
Implement the Python class `RLEIterator` described below. Class description: Implement the RLEIterator class. Method signatures and docstrings: - def __init__(self, A): :type A: List[int] - def next(self, n): :type n: int :rtype: int
Implement the Python class `RLEIterator` described below. Class description: Implement the RLEIterator class. Method signatures and docstrings: - def __init__(self, A): :type A: List[int] - def next(self, n): :type n: int :rtype: int <|skeleton|> class RLEIterator: def __init__(self, A): """:type A: Lis...
d6fac85a94a7188e93d4e202e67b6485562d12bd
<|skeleton|> class RLEIterator: def __init__(self, A): """:type A: List[int]""" <|body_0|> def next(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RLEIterator: def __init__(self, A): """:type A: List[int]""" self.seq = [] for i in range(0, len(A), 2): if A[i] == 0: continue self.seq.append([A[i], A[i + 1]]) self.seq.reverse() def next(self, n): """:type n: int :rtype: i...
the_stack_v2_python_sparse
lc900.py
GeorgyZhou/Leetcode-Problem
train
0
b73d7e5faafb0c90fd244e8862bb4af25afdfc21
[ "try:\n instance_message = await get_data_from_req(self.request).messages.get()\nexcept (ResourceNotFoundError, ResourceConflictError):\n return json_response(None)\nreturn json_response(instance_message)", "user_id = self.request['client'].user_id\ninstance_message = await get_data_from_req(self.request).m...
<|body_start_0|> try: instance_message = await get_data_from_req(self.request).messages.get() except (ResourceNotFoundError, ResourceConflictError): return json_response(None) return json_response(instance_message) <|end_body_0|> <|body_start_1|> user_id = self.r...
MessagesView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MessagesView: async def get(self) -> r200[Optional[MessageResponse]]: """Get the administrative instance message. Fetches the active administrative instance message. Status Codes: 200: Successful operation""" <|body_0|> async def put(self, data: CreateMessageRequest) -> r200...
stack_v2_sparse_classes_10k_train_006545
2,470
permissive
[ { "docstring": "Get the administrative instance message. Fetches the active administrative instance message. Status Codes: 200: Successful operation", "name": "get", "signature": "async def get(self) -> r200[Optional[MessageResponse]]" }, { "docstring": "Create an administrative instance message...
3
null
Implement the Python class `MessagesView` described below. Class description: Implement the MessagesView class. Method signatures and docstrings: - async def get(self) -> r200[Optional[MessageResponse]]: Get the administrative instance message. Fetches the active administrative instance message. Status Codes: 200: Su...
Implement the Python class `MessagesView` described below. Class description: Implement the MessagesView class. Method signatures and docstrings: - async def get(self) -> r200[Optional[MessageResponse]]: Get the administrative instance message. Fetches the active administrative instance message. Status Codes: 200: Su...
1d17d2ba570cf5487e7514bec29250a5b368bb0a
<|skeleton|> class MessagesView: async def get(self) -> r200[Optional[MessageResponse]]: """Get the administrative instance message. Fetches the active administrative instance message. Status Codes: 200: Successful operation""" <|body_0|> async def put(self, data: CreateMessageRequest) -> r200...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MessagesView: async def get(self) -> r200[Optional[MessageResponse]]: """Get the administrative instance message. Fetches the active administrative instance message. Status Codes: 200: Successful operation""" try: instance_message = await get_data_from_req(self.request).messages.ge...
the_stack_v2_python_sparse
virtool/messages/api.py
virtool/virtool
train
45
ea275596f3bf4587236334e41112bc1cf25d5e55
[ "res = 0\nfor i in range(32):\n cnt = 0\n bit = 1 << i\n for num in nums:\n if num & bit != 0:\n cnt += 1\n if cnt % 3 != 0:\n res |= bit\nreturn res - 2 ** 32 if res > 2 ** 31 - 1 else res", "two, one = (0, 0)\nfor num in nums:\n one = one ^ num & ~two\n two = two ^ num...
<|body_start_0|> res = 0 for i in range(32): cnt = 0 bit = 1 << i for num in nums: if num & bit != 0: cnt += 1 if cnt % 3 != 0: res |= bit return res - 2 ** 32 if res > 2 ** 31 - 1 else res <|end_...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def CountContinuousSequence2(self, nums) -> int: """找出数组中统计除了出现3次的数据 方法:位运算 :param nums: :return: 时间复杂度O(N),空间复杂度O(1)""" <|body_0|> def CountContinuousSequence2Plus(self, nums) -> int: """使用有穷自动机来解决实际问题,此种方法比较适合当前场景,但是不是用其他的,比如n个数据出现一次的情形 :param nums: :retu...
stack_v2_sparse_classes_10k_train_006546
2,511
no_license
[ { "docstring": "找出数组中统计除了出现3次的数据 方法:位运算 :param nums: :return: 时间复杂度O(N),空间复杂度O(1)", "name": "CountContinuousSequence2", "signature": "def CountContinuousSequence2(self, nums) -> int" }, { "docstring": "使用有穷自动机来解决实际问题,此种方法比较适合当前场景,但是不是用其他的,比如n个数据出现一次的情形 :param nums: :return:", "name": "CountC...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def CountContinuousSequence2(self, nums) -> int: 找出数组中统计除了出现3次的数据 方法:位运算 :param nums: :return: 时间复杂度O(N),空间复杂度O(1) - def CountContinuousSequence2Plus(self, nums) -> int: 使用有穷自动机来...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def CountContinuousSequence2(self, nums) -> int: 找出数组中统计除了出现3次的数据 方法:位运算 :param nums: :return: 时间复杂度O(N),空间复杂度O(1) - def CountContinuousSequence2Plus(self, nums) -> int: 使用有穷自动机来...
32941ee052d0985a9569441d314378700ff4d225
<|skeleton|> class Solution: def CountContinuousSequence2(self, nums) -> int: """找出数组中统计除了出现3次的数据 方法:位运算 :param nums: :return: 时间复杂度O(N),空间复杂度O(1)""" <|body_0|> def CountContinuousSequence2Plus(self, nums) -> int: """使用有穷自动机来解决实际问题,此种方法比较适合当前场景,但是不是用其他的,比如n个数据出现一次的情形 :param nums: :retu...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def CountContinuousSequence2(self, nums) -> int: """找出数组中统计除了出现3次的数据 方法:位运算 :param nums: :return: 时间复杂度O(N),空间复杂度O(1)""" res = 0 for i in range(32): cnt = 0 bit = 1 << i for num in nums: if num & bit != 0: ...
the_stack_v2_python_sparse
cecilia-python/剑指offer/chapter-1/CountContinuousSequence-2.py
Cecilia520/algorithmic-learning-leetcode
train
7
0573ca78872eec37eeed929768b62cd86cc7fb11
[ "self.log = logging.getLogger('%s.%s.%s.msg-%d' % (__name__, self.__class__.__name__, mailbox.name, msg_key))\nself.mailbox = mailbox\nself.msg_key = msg_key\nself.seq_max = seq_max\nself.uid_max = uid_max\nself.msg_number = msg_number\nself.mailbox_sequences = sequences\nself.path = os.path.join(mailbox.mailbox._p...
<|body_start_0|> self.log = logging.getLogger('%s.%s.%s.msg-%d' % (__name__, self.__class__.__name__, mailbox.name, msg_key)) self.mailbox = mailbox self.msg_key = msg_key self.seq_max = seq_max self.uid_max = uid_max self.msg_number = msg_number self.mailbox_sequ...
When running searches on we store various bits of context information that the IMAPSearch object may need to determine if a specific message is matched or not.
SearchContext
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SearchContext: """When running searches on we store various bits of context information that the IMAPSearch object may need to determine if a specific message is matched or not.""" def __init__(self, mailbox, msg_key, msg_number, seq_max, uid_max, sequences): """A container to hold t...
stack_v2_sparse_classes_10k_train_006547
18,739
permissive
[ { "docstring": "A container to hold the contextual information an IMAPSearch objects to actually perform its matching function. Arguments: - `mailbox`: The mailbox the message lives in - `msg_key`: The message key (mailbox.get_message(msg_key)) - `msg_number`: The imap message number for this message - `seq_max...
5
stack_v2_sparse_classes_30k_train_003565
Implement the Python class `SearchContext` described below. Class description: When running searches on we store various bits of context information that the IMAPSearch object may need to determine if a specific message is matched or not. Method signatures and docstrings: - def __init__(self, mailbox, msg_key, msg_nu...
Implement the Python class `SearchContext` described below. Class description: When running searches on we store various bits of context information that the IMAPSearch object may need to determine if a specific message is matched or not. Method signatures and docstrings: - def __init__(self, mailbox, msg_key, msg_nu...
dabbb5d815d67fe0b6dc07d7d0c32fa01df5d26a
<|skeleton|> class SearchContext: """When running searches on we store various bits of context information that the IMAPSearch object may need to determine if a specific message is matched or not.""" def __init__(self, mailbox, msg_key, msg_number, seq_max, uid_max, sequences): """A container to hold t...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SearchContext: """When running searches on we store various bits of context information that the IMAPSearch object may need to determine if a specific message is matched or not.""" def __init__(self, mailbox, msg_key, msg_number, seq_max, uid_max, sequences): """A container to hold the contextual...
the_stack_v2_python_sparse
asimap/search.py
scanner/asimap
train
37
eea546c9627f70698af4bd5c1b753adcd3e5a8c0
[ "for form in self.forms:\n status = form.cleaned_data.get('status')\n if not status:\n raise ValidationError('Keinen Status', 'error')", "super(CustomStatusFormset, self).__init__(*args, **kwargs)\nfor form in self.forms:\n for field in form.fields:\n form.fields[field].widget.attrs.update(...
<|body_start_0|> for form in self.forms: status = form.cleaned_data.get('status') if not status: raise ValidationError('Keinen Status', 'error') <|end_body_0|> <|body_start_1|> super(CustomStatusFormset, self).__init__(*args, **kwargs) for form in self.fo...
Django BaseInlineFormset used to create SchadensmeldungStatus objects on Schadensmeldung creation
CustomStatusFormset
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomStatusFormset: """Django BaseInlineFormset used to create SchadensmeldungStatus objects on Schadensmeldung creation""" def clean(self): """Custom clean method that raises ValidationError if a status is not selected""" <|body_0|> def __init__(self, *args, **kwargs):...
stack_v2_sparse_classes_10k_train_006548
9,202
no_license
[ { "docstring": "Custom clean method that raises ValidationError if a status is not selected", "name": "clean", "signature": "def clean(self)" }, { "docstring": "Custom __init__ method that adds Bootstrap styling to all fields", "name": "__init__", "signature": "def __init__(self, *args, ...
2
stack_v2_sparse_classes_30k_train_006350
Implement the Python class `CustomStatusFormset` described below. Class description: Django BaseInlineFormset used to create SchadensmeldungStatus objects on Schadensmeldung creation Method signatures and docstrings: - def clean(self): Custom clean method that raises ValidationError if a status is not selected - def ...
Implement the Python class `CustomStatusFormset` described below. Class description: Django BaseInlineFormset used to create SchadensmeldungStatus objects on Schadensmeldung creation Method signatures and docstrings: - def clean(self): Custom clean method that raises ValidationError if a status is not selected - def ...
2493b8d5c865452f75290566ba43cab548d573bd
<|skeleton|> class CustomStatusFormset: """Django BaseInlineFormset used to create SchadensmeldungStatus objects on Schadensmeldung creation""" def clean(self): """Custom clean method that raises ValidationError if a status is not selected""" <|body_0|> def __init__(self, *args, **kwargs):...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CustomStatusFormset: """Django BaseInlineFormset used to create SchadensmeldungStatus objects on Schadensmeldung creation""" def clean(self): """Custom clean method that raises ValidationError if a status is not selected""" for form in self.forms: status = form.cleaned_data.ge...
the_stack_v2_python_sparse
apps/insurance/forms.py
ryanpdaly/megabike_crm_django
train
0
e2d789f7cf28b747e67913c7712ceaa4a8ef8274
[ "self.radius = radius\nself.radius2 = radius ** 2\nself.xc = x_center\nself.xmin = x_center - radius\nself.xmax = x_center + radius\nself.yc = y_center\nself.ymin = y_center - radius\nself.ymax = y_center + radius", "while True:\n x = random.uniform(self.xmin, self.xmax)\n y = random.uniform(self.ymin, self...
<|body_start_0|> self.radius = radius self.radius2 = radius ** 2 self.xc = x_center self.xmin = x_center - radius self.xmax = x_center + radius self.yc = y_center self.ymin = y_center - radius self.ymax = y_center + radius <|end_body_0|> <|body_start_1|> ...
Solution
[ "MIT" ]
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.radius = radi...
stack_v2_sparse_classes_10k_train_006549
914
permissive
[ { "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...
3719f5cb059eefd66b83eb8ae990652f4b7fd124
<|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_10k
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.radius = radius self.radius2 = radius ** 2 self.xc = x_center self.xmin = x_center - radius self.xmax = x_center + radius ...
the_stack_v2_python_sparse
Python3/0478-Generate-Random-Point-in-a-Circle/soln.py
wyaadarsh/LeetCode-Solutions
train
0
2bb148bb1f649c687f528846d6d21a2766ac8a84
[ "engine = models.LoaderEngine.objects.get(mnemo='asco', active=True)\nhandler = leh.ASCOUploadHandler(engine, **{k: v for k, v in engine.config.__dict__.iteritems()})\nhandler.process()", "engine = models.LoaderEngine.objects.get(mnemo='hopkinsmedicine', active=True)\nhandler = leh.HopkinsMedicineUploadHandler(en...
<|body_start_0|> engine = models.LoaderEngine.objects.get(mnemo='asco', active=True) handler = leh.ASCOUploadHandler(engine, **{k: v for k, v in engine.config.__dict__.iteritems()}) handler.process() <|end_body_0|> <|body_start_1|> engine = models.LoaderEngine.objects.get(mnemo='hopkins...
ExpertsLoadedStorageAdmin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExpertsLoadedStorageAdmin: def start_asco_load_engine(self, request, queryset): """Load data from asco.org""" <|body_0|> def start_hopkins_load_engine(self, request, queryset=[]): """Load data from hopkinsmedicine.org""" <|body_1|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_10k_train_006550
2,421
no_license
[ { "docstring": "Load data from asco.org", "name": "start_asco_load_engine", "signature": "def start_asco_load_engine(self, request, queryset)" }, { "docstring": "Load data from hopkinsmedicine.org", "name": "start_hopkins_load_engine", "signature": "def start_hopkins_load_engine(self, re...
2
stack_v2_sparse_classes_30k_train_005756
Implement the Python class `ExpertsLoadedStorageAdmin` described below. Class description: Implement the ExpertsLoadedStorageAdmin class. Method signatures and docstrings: - def start_asco_load_engine(self, request, queryset): Load data from asco.org - def start_hopkins_load_engine(self, request, queryset=[]): Load d...
Implement the Python class `ExpertsLoadedStorageAdmin` described below. Class description: Implement the ExpertsLoadedStorageAdmin class. Method signatures and docstrings: - def start_asco_load_engine(self, request, queryset): Load data from asco.org - def start_hopkins_load_engine(self, request, queryset=[]): Load d...
6e4ec18fd987f70345f93335fd49e7f27899324c
<|skeleton|> class ExpertsLoadedStorageAdmin: def start_asco_load_engine(self, request, queryset): """Load data from asco.org""" <|body_0|> def start_hopkins_load_engine(self, request, queryset=[]): """Load data from hopkinsmedicine.org""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ExpertsLoadedStorageAdmin: def start_asco_load_engine(self, request, queryset): """Load data from asco.org""" engine = models.LoaderEngine.objects.get(mnemo='asco', active=True) handler = leh.ASCOUploadHandler(engine, **{k: v for k, v in engine.config.__dict__.iteritems()}) han...
the_stack_v2_python_sparse
loaders/admin.py
powerdev1212/Dev
train
0
a5b6d6e3deeb7fbdb7824467544d34fcee5502fb
[ "amount_secured = '100'\ninterest_paid_indicator = 'No'\nFinancialChargeDetailsValidator.validate(amount_secured, interest_paid_indicator, '')\ncalls = [call(amount_secured, 'amount-secured', 'Amount originally secured', mock_error_builder(), summary_message='Amount is required', inline_message=\"If you don't know ...
<|body_start_0|> amount_secured = '100' interest_paid_indicator = 'No' FinancialChargeDetailsValidator.validate(amount_secured, interest_paid_indicator, '') calls = [call(amount_secured, 'amount-secured', 'Amount originally secured', mock_error_builder(), summary_message='Amount is requi...
TestFinancialChargeDetailsValidator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestFinancialChargeDetailsValidator: def test_min_params_passed(self, mock_field_validator, mock_error_builder): """should pass the given parameter to the fieldset validator and call the expected validations""" <|body_0|> def test_max_params_passed(self, mock_field_validator...
stack_v2_sparse_classes_10k_train_006551
6,886
permissive
[ { "docstring": "should pass the given parameter to the fieldset validator and call the expected validations", "name": "test_min_params_passed", "signature": "def test_min_params_passed(self, mock_field_validator, mock_error_builder)" }, { "docstring": "should pass the given parameter to the fiel...
6
null
Implement the Python class `TestFinancialChargeDetailsValidator` described below. Class description: Implement the TestFinancialChargeDetailsValidator class. Method signatures and docstrings: - def test_min_params_passed(self, mock_field_validator, mock_error_builder): should pass the given parameter to the fieldset ...
Implement the Python class `TestFinancialChargeDetailsValidator` described below. Class description: Implement the TestFinancialChargeDetailsValidator class. Method signatures and docstrings: - def test_min_params_passed(self, mock_field_validator, mock_error_builder): should pass the given parameter to the fieldset ...
d92446a9972ebbcd9a43a7a7444a528aa2f30bf7
<|skeleton|> class TestFinancialChargeDetailsValidator: def test_min_params_passed(self, mock_field_validator, mock_error_builder): """should pass the given parameter to the fieldset validator and call the expected validations""" <|body_0|> def test_max_params_passed(self, mock_field_validator...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestFinancialChargeDetailsValidator: def test_min_params_passed(self, mock_field_validator, mock_error_builder): """should pass the given parameter to the fieldset validator and call the expected validations""" amount_secured = '100' interest_paid_indicator = 'No' FinancialChar...
the_stack_v2_python_sparse
unit_tests/Add_land_charge/validation/test_financial_charge_details_validator.py
uk-gov-mirror/LandRegistry.maintain-frontend
train
0
9c756a6141f5477340b66a77efaa26821bf7ef29
[ "work_pool = await models.workers.read_work_pool_by_name(session=session, work_pool_name=work_pool_name)\nif not work_pool:\n raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail=f'Work pool \"{work_pool_name}\" not found.')\nreturn work_pool.id", "work_pool = await models.workers.read_work_pool_b...
<|body_start_0|> work_pool = await models.workers.read_work_pool_by_name(session=session, work_pool_name=work_pool_name) if not work_pool: raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail=f'Work pool "{work_pool_name}" not found.') return work_pool.id <|end_body_0|> ...
WorkerLookups
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkerLookups: async def _get_work_pool_id_from_name(self, session: AsyncSession, work_pool_name: str) -> UUID: """Given a work pool name, return its ID. Used for translating user-facing APIs (which are name-based) to internal ones (which are id-based).""" <|body_0|> async d...
stack_v2_sparse_classes_10k_train_006552
18,979
permissive
[ { "docstring": "Given a work pool name, return its ID. Used for translating user-facing APIs (which are name-based) to internal ones (which are id-based).", "name": "_get_work_pool_id_from_name", "signature": "async def _get_work_pool_id_from_name(self, session: AsyncSession, work_pool_name: str) -> UUI...
3
null
Implement the Python class `WorkerLookups` described below. Class description: Implement the WorkerLookups class. Method signatures and docstrings: - async def _get_work_pool_id_from_name(self, session: AsyncSession, work_pool_name: str) -> UUID: Given a work pool name, return its ID. Used for translating user-facing...
Implement the Python class `WorkerLookups` described below. Class description: Implement the WorkerLookups class. Method signatures and docstrings: - async def _get_work_pool_id_from_name(self, session: AsyncSession, work_pool_name: str) -> UUID: Given a work pool name, return its ID. Used for translating user-facing...
2c50d2b64c811c364cbc5faa2b5c80a742572090
<|skeleton|> class WorkerLookups: async def _get_work_pool_id_from_name(self, session: AsyncSession, work_pool_name: str) -> UUID: """Given a work pool name, return its ID. Used for translating user-facing APIs (which are name-based) to internal ones (which are id-based).""" <|body_0|> async d...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WorkerLookups: async def _get_work_pool_id_from_name(self, session: AsyncSession, work_pool_name: str) -> UUID: """Given a work pool name, return its ID. Used for translating user-facing APIs (which are name-based) to internal ones (which are id-based).""" work_pool = await models.workers.read...
the_stack_v2_python_sparse
src/prefect/server/api/workers.py
PrefectHQ/prefect
train
12,917
1877e23eff9562fe06931f621dc42a2468fc9911
[ "text = actions.edit.selected_text()\nnew_lines = []\nfor line in text.split('\\n'):\n one_line_if_match = re.match('(\\\\s*)(.+?):\\\\s*((.+)=(.+))$', line)\n if one_line_if_match:\n ws, if_statement, assignment, *_ = one_line_if_match.groups()\n new_lines.append(f'{ws}{if_statement}')\n ...
<|body_start_0|> text = actions.edit.selected_text() new_lines = [] for line in text.split('\n'): one_line_if_match = re.match('(\\s*)(.+?):\\s*((.+)=(.+))$', line) if one_line_if_match: ws, if_statement, assignment, *_ = one_line_if_match.groups() ...
Actions
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Actions: def print_all_assignments(): """Adds a print statement below each assignment in a selected block of python code.""" <|body_0|> def print_arguments(): """Adds a print statement below a selected function declaration containing its arguments.""" <|body_...
stack_v2_sparse_classes_10k_train_006553
12,812
no_license
[ { "docstring": "Adds a print statement below each assignment in a selected block of python code.", "name": "print_all_assignments", "signature": "def print_all_assignments()" }, { "docstring": "Adds a print statement below a selected function declaration containing its arguments.", "name": "...
3
stack_v2_sparse_classes_30k_train_000851
Implement the Python class `Actions` described below. Class description: Implement the Actions class. Method signatures and docstrings: - def print_all_assignments(): Adds a print statement below each assignment in a selected block of python code. - def print_arguments(): Adds a print statement below a selected funct...
Implement the Python class `Actions` described below. Class description: Implement the Actions class. Method signatures and docstrings: - def print_all_assignments(): Adds a print statement below each assignment in a selected block of python code. - def print_arguments(): Adds a print statement below a selected funct...
03c6479989ab4231d8ae6bbab24ac8b57c3ef809
<|skeleton|> class Actions: def print_all_assignments(): """Adds a print statement below each assignment in a selected block of python code.""" <|body_0|> def print_arguments(): """Adds a print statement below a selected function declaration containing its arguments.""" <|body_...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Actions: def print_all_assignments(): """Adds a print statement below each assignment in a selected block of python code.""" text = actions.edit.selected_text() new_lines = [] for line in text.split('\n'): one_line_if_match = re.match('(\\s*)(.+?):\\s*((.+)=(.+))$',...
the_stack_v2_python_sparse
lang/python/python.py
mrob95/MR-talon
train
15
fe4dffe6027b94e6ed0890e24680a99cf1c53c7a
[ "if featurizer is not None and scoring_model is None or (featurizer is None and scoring_model is not None):\n raise ValueError('featurizer/scoring_model must both be set or must both be None.')\nself.base_dir = tempfile.mkdtemp()\nself.pose_generator = pose_generator\nself.featurizer = featurizer\nself.scoring_m...
<|body_start_0|> if featurizer is not None and scoring_model is None or (featurizer is None and scoring_model is not None): raise ValueError('featurizer/scoring_model must both be set or must both be None.') self.base_dir = tempfile.mkdtemp() self.pose_generator = pose_generator ...
A generic molecular docking class This class provides a docking engine which uses provided models for featurization, pose generation, and scoring. Most pieces of docking software are command line tools that are invoked from the shell. The goal of this class is to provide a python clean API for invoking molecular dockin...
Docker
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Docker: """A generic molecular docking class This class provides a docking engine which uses provided models for featurization, pose generation, and scoring. Most pieces of docking software are command line tools that are invoked from the shell. The goal of this class is to provide a python clean...
stack_v2_sparse_classes_10k_train_006554
6,105
permissive
[ { "docstring": "Builds model. Parameters ---------- pose_generator: PoseGenerator The pose generator to use for this model featurizer: ComplexFeaturizer, optional (default None) Featurizer associated with `scoring_model` scoring_model: Model, optional (default None) Should make predictions on molecular complex....
2
null
Implement the Python class `Docker` described below. Class description: A generic molecular docking class This class provides a docking engine which uses provided models for featurization, pose generation, and scoring. Most pieces of docking software are command line tools that are invoked from the shell. The goal of ...
Implement the Python class `Docker` described below. Class description: A generic molecular docking class This class provides a docking engine which uses provided models for featurization, pose generation, and scoring. Most pieces of docking software are command line tools that are invoked from the shell. The goal of ...
ee6e67ebcf7bf04259cf13aff6388e2b791fea3d
<|skeleton|> class Docker: """A generic molecular docking class This class provides a docking engine which uses provided models for featurization, pose generation, and scoring. Most pieces of docking software are command line tools that are invoked from the shell. The goal of this class is to provide a python clean...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Docker: """A generic molecular docking class This class provides a docking engine which uses provided models for featurization, pose generation, and scoring. Most pieces of docking software are command line tools that are invoked from the shell. The goal of this class is to provide a python clean API for invo...
the_stack_v2_python_sparse
deepchem/dock/docking.py
deepchem/deepchem
train
4,876
c77c50153c757aae12552c1e1880a31ec1d9f9a1
[ "kwargs['add_start'] = True\nkwargs['add_end'] = True\nobs = TorchRankerAgent.vectorize(self, *args, **kwargs)\nreturn obs", "if 'add_start' in kwargs:\n kwargs['add_start'] = True\n kwargs['add_end'] = True\nreturn super()._vectorize_text(*args, **kwargs)", "obs = super()._set_text_vec(*args, **kwargs)\n...
<|body_start_0|> kwargs['add_start'] = True kwargs['add_end'] = True obs = TorchRankerAgent.vectorize(self, *args, **kwargs) return obs <|end_body_0|> <|body_start_1|> if 'add_start' in kwargs: kwargs['add_start'] = True kwargs['add_end'] = True r...
Bi-encoder Transformer Agent. Equivalent of bert_ranker/biencoder but does not rely on an external library (hugging face).
BiencoderAgent
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BiencoderAgent: """Bi-encoder Transformer Agent. Equivalent of bert_ranker/biencoder but does not rely on an external library (hugging face).""" def vectorize(self, *args, **kwargs): """Add the start and end token to the text.""" <|body_0|> def _vectorize_text(self, *arg...
stack_v2_sparse_classes_10k_train_006555
5,244
permissive
[ { "docstring": "Add the start and end token to the text.", "name": "vectorize", "signature": "def vectorize(self, *args, **kwargs)" }, { "docstring": "Override to add start end tokens. necessary for fixed cands.", "name": "_vectorize_text", "signature": "def _vectorize_text(self, *args, ...
3
stack_v2_sparse_classes_30k_train_005614
Implement the Python class `BiencoderAgent` described below. Class description: Bi-encoder Transformer Agent. Equivalent of bert_ranker/biencoder but does not rely on an external library (hugging face). Method signatures and docstrings: - def vectorize(self, *args, **kwargs): Add the start and end token to the text. ...
Implement the Python class `BiencoderAgent` described below. Class description: Bi-encoder Transformer Agent. Equivalent of bert_ranker/biencoder but does not rely on an external library (hugging face). Method signatures and docstrings: - def vectorize(self, *args, **kwargs): Add the start and end token to the text. ...
e1d899edfb92471552bae153f59ad30aa7fca468
<|skeleton|> class BiencoderAgent: """Bi-encoder Transformer Agent. Equivalent of bert_ranker/biencoder but does not rely on an external library (hugging face).""" def vectorize(self, *args, **kwargs): """Add the start and end token to the text.""" <|body_0|> def _vectorize_text(self, *arg...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BiencoderAgent: """Bi-encoder Transformer Agent. Equivalent of bert_ranker/biencoder but does not rely on an external library (hugging face).""" def vectorize(self, *args, **kwargs): """Add the start and end token to the text.""" kwargs['add_start'] = True kwargs['add_end'] = True...
the_stack_v2_python_sparse
parlai/agents/transformer/biencoder.py
facebookresearch/ParlAI
train
10,943
f6e43e2e6705cb23932543627f5d824a485557fa
[ "cur = head\nprev = None\nwhile cur != tail:\n next = cur.next\n cur.next = prev\n prev = cur\n cur = next\nreturn prev", "res = ListNode(0)\nres.next = head\ncur = res\nwhile head:\n tail = head\n for i in range(k):\n if tail != None:\n tail = tail.next\n else:\n ...
<|body_start_0|> cur = head prev = None while cur != tail: next = cur.next cur.next = prev prev = cur cur = next return prev <|end_body_0|> <|body_start_1|> res = ListNode(0) res.next = head cur = res while ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseList(self, head, tail): """:param head: ListNode :param tail: ListNode :return: ListNode""" <|body_0|> def reverseKGroup(self, head, k): """:type head: ListNode :type k: int :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_10k_train_006556
1,217
no_license
[ { "docstring": ":param head: ListNode :param tail: ListNode :return: ListNode", "name": "reverseList", "signature": "def reverseList(self, head, tail)" }, { "docstring": ":type head: ListNode :type k: int :rtype: ListNode", "name": "reverseKGroup", "signature": "def reverseKGroup(self, h...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head, tail): :param head: ListNode :param tail: ListNode :return: ListNode - def reverseKGroup(self, head, k): :type head: ListNode :type k: int :rtype: Lis...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head, tail): :param head: ListNode :param tail: ListNode :return: ListNode - def reverseKGroup(self, head, k): :type head: ListNode :type k: int :rtype: Lis...
43bcf65d31f1b729ac8ca293635f46ffbe03c80b
<|skeleton|> class Solution: def reverseList(self, head, tail): """:param head: ListNode :param tail: ListNode :return: ListNode""" <|body_0|> def reverseKGroup(self, head, k): """:type head: ListNode :type k: int :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def reverseList(self, head, tail): """:param head: ListNode :param tail: ListNode :return: ListNode""" cur = head prev = None while cur != tail: next = cur.next cur.next = prev prev = cur cur = next return prev ...
the_stack_v2_python_sparse
25.py
luckkyzhou/leetcode
train
0
92764cc506d89c81b82f3a303b70db97368ef6ab
[ "if not root:\n return []\n_queue = [root]\nresult = []\nwhile _queue:\n node = _queue.pop(0)\n if node:\n result.append(node.val)\n _queue.append(node.left)\n _queue.append(node.right)\n else:\n result.append('#')\nreturn result", "if not data:\n return None\nroot = Tre...
<|body_start_0|> if not root: return [] _queue = [root] result = [] while _queue: node = _queue.pop(0) if node: result.append(node.val) _queue.append(node.left) _queue.append(node.right) else:...
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_10k_train_006557
1,619
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_006648
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:...
9687f8e743a8b6396fff192f22b5256d1025f86b
<|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_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return [] _queue = [root] result = [] while _queue: node = _queue.pop(0) if node: result.append(n...
the_stack_v2_python_sparse
2017/tree/CodecTree.py
buhuipao/LeetCode
train
5
62411eff9a6f0c5f43ac6b41a126fd027a076ecc
[ "url_parts = request.META.get('PATH_INFO').split('/')\ntry:\n given_uuid = str(UUID(url_parts[url_parts.index('cost-models') + 1]))\nexcept ValueError:\n given_uuid = None\nreturn given_uuid", "if settings.ENHANCED_ORG_ADMIN and request.user.admin:\n return True\nif not request.user.access:\n return F...
<|body_start_0|> url_parts = request.META.get('PATH_INFO').split('/') try: given_uuid = str(UUID(url_parts[url_parts.index('cost-models') + 1])) except ValueError: given_uuid = None return given_uuid <|end_body_0|> <|body_start_1|> if settings.ENHANCED_OR...
Determines if a user has access to Cost Model APIs.
CostModelsAccessPermission
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CostModelsAccessPermission: """Determines if a user has access to Cost Model APIs.""" def get_uuid_from_url(self, request): """Get the uuid from the request url.""" <|body_0|> def has_permission(self, request, view): """Check permission based on the defined acces...
stack_v2_sparse_classes_10k_train_006558
1,396
permissive
[ { "docstring": "Get the uuid from the request url.", "name": "get_uuid_from_url", "signature": "def get_uuid_from_url(self, request)" }, { "docstring": "Check permission based on the defined access.", "name": "has_permission", "signature": "def has_permission(self, request, view)" } ]
2
stack_v2_sparse_classes_30k_train_005156
Implement the Python class `CostModelsAccessPermission` described below. Class description: Determines if a user has access to Cost Model APIs. Method signatures and docstrings: - def get_uuid_from_url(self, request): Get the uuid from the request url. - def has_permission(self, request, view): Check permission based...
Implement the Python class `CostModelsAccessPermission` described below. Class description: Determines if a user has access to Cost Model APIs. Method signatures and docstrings: - def get_uuid_from_url(self, request): Get the uuid from the request url. - def has_permission(self, request, view): Check permission based...
0416e5216eb1ec4b41c8dd4999adde218b1ab2e1
<|skeleton|> class CostModelsAccessPermission: """Determines if a user has access to Cost Model APIs.""" def get_uuid_from_url(self, request): """Get the uuid from the request url.""" <|body_0|> def has_permission(self, request, view): """Check permission based on the defined acces...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CostModelsAccessPermission: """Determines if a user has access to Cost Model APIs.""" def get_uuid_from_url(self, request): """Get the uuid from the request url.""" url_parts = request.META.get('PATH_INFO').split('/') try: given_uuid = str(UUID(url_parts[url_parts.inde...
the_stack_v2_python_sparse
koku/api/common/permissions/cost_models_access.py
project-koku/koku
train
225
0bc299a6fbecb2b0478433fe30927c2aae2e6e86
[ "self.df = df\nself.parsed_col = parsed_col\nself.feats_from_spacy_doc = feats_from_spacy_doc", "category_col = 'Category'\nwhile category_col in self.df:\n category_col = 'Category_' + ''.join((np.random.choice(string.ascii_letters) for _ in range(5)))\nreturn CorpusFromParsedDocuments(self.df.assign(**{categ...
<|body_start_0|> self.df = df self.parsed_col = parsed_col self.feats_from_spacy_doc = feats_from_spacy_doc <|end_body_0|> <|body_start_1|> category_col = 'Category' while category_col in self.df: category_col = 'Category_' + ''.join((np.random.choice(string.ascii_le...
CorpusWithoutCategoriesFromParsedDocuments
[ "MIT", "CC-BY-NC-SA-4.0", "LicenseRef-scancode-proprietary-license", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CorpusWithoutCategoriesFromParsedDocuments: def __init__(self, df, parsed_col, feats_from_spacy_doc=FeatsFromSpacyDoc()): """Parameters ---------- df : pd.DataFrame contains category_col, and parse_col, were parsed col is entirely spacy docs parsed_col : str name of spacy parsed column i...
stack_v2_sparse_classes_10k_train_006559
1,276
permissive
[ { "docstring": "Parameters ---------- df : pd.DataFrame contains category_col, and parse_col, were parsed col is entirely spacy docs parsed_col : str name of spacy parsed column in convention_df feats_from_spacy_doc : FeatsFromSpacyDoc", "name": "__init__", "signature": "def __init__(self, df, parsed_co...
2
null
Implement the Python class `CorpusWithoutCategoriesFromParsedDocuments` described below. Class description: Implement the CorpusWithoutCategoriesFromParsedDocuments class. Method signatures and docstrings: - def __init__(self, df, parsed_col, feats_from_spacy_doc=FeatsFromSpacyDoc()): Parameters ---------- df : pd.Da...
Implement the Python class `CorpusWithoutCategoriesFromParsedDocuments` described below. Class description: Implement the CorpusWithoutCategoriesFromParsedDocuments class. Method signatures and docstrings: - def __init__(self, df, parsed_col, feats_from_spacy_doc=FeatsFromSpacyDoc()): Parameters ---------- df : pd.Da...
b41e3a875faf6dd886e49e524345202432db1b21
<|skeleton|> class CorpusWithoutCategoriesFromParsedDocuments: def __init__(self, df, parsed_col, feats_from_spacy_doc=FeatsFromSpacyDoc()): """Parameters ---------- df : pd.DataFrame contains category_col, and parse_col, were parsed col is entirely spacy docs parsed_col : str name of spacy parsed column i...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CorpusWithoutCategoriesFromParsedDocuments: def __init__(self, df, parsed_col, feats_from_spacy_doc=FeatsFromSpacyDoc()): """Parameters ---------- df : pd.DataFrame contains category_col, and parse_col, were parsed col is entirely spacy docs parsed_col : str name of spacy parsed column in convention_d...
the_stack_v2_python_sparse
scattertext/CorpusWithoutCategoriesFromParsedDocuments.py
JasonKessler/scattertext
train
2,187
72c8fceeef23a4e6e05622e250e9fe5af02d2bb2
[ "dd1 = {}\ndd2 = {}\nstr_list = str.split(' ')\nif len(pattern) != len(str_list):\n return False\nfor i in range(len(pattern)):\n if pattern[i] not in dd1 and str_list[i] not in dd2:\n dd1[pattern[i]] = str_list[i]\n dd2[str_list[i]] = pattern[i]\n elif pattern[i] in dd1 and dd1[pattern[i]] !...
<|body_start_0|> dd1 = {} dd2 = {} str_list = str.split(' ') if len(pattern) != len(str_list): return False for i in range(len(pattern)): if pattern[i] not in dd1 and str_list[i] not in dd2: dd1[pattern[i]] = str_list[i] dd2...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def wordPattern(self, pattern, str): """:type pattern: str :type str: str :rtype: bool""" <|body_0|> def wordPattern1(self, pattern, str): """:type pattern: str :type str: str :rtype: bool""" <|body_1|> def wordPattern2(self, pattern, s): ...
stack_v2_sparse_classes_10k_train_006560
2,239
no_license
[ { "docstring": ":type pattern: str :type str: str :rtype: bool", "name": "wordPattern", "signature": "def wordPattern(self, pattern, str)" }, { "docstring": ":type pattern: str :type str: str :rtype: bool", "name": "wordPattern1", "signature": "def wordPattern1(self, pattern, str)" }, ...
3
stack_v2_sparse_classes_30k_train_001726
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def wordPattern(self, pattern, str): :type pattern: str :type str: str :rtype: bool - def wordPattern1(self, pattern, str): :type pattern: str :type str: str :rtype: bool - def w...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def wordPattern(self, pattern, str): :type pattern: str :type str: str :rtype: bool - def wordPattern1(self, pattern, str): :type pattern: str :type str: str :rtype: bool - def w...
c55b0cfd2967a2221c27ed738e8de15034775945
<|skeleton|> class Solution: def wordPattern(self, pattern, str): """:type pattern: str :type str: str :rtype: bool""" <|body_0|> def wordPattern1(self, pattern, str): """:type pattern: str :type str: str :rtype: bool""" <|body_1|> def wordPattern2(self, pattern, s): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def wordPattern(self, pattern, str): """:type pattern: str :type str: str :rtype: bool""" dd1 = {} dd2 = {} str_list = str.split(' ') if len(pattern) != len(str_list): return False for i in range(len(pattern)): if pattern[i] not...
the_stack_v2_python_sparse
PycharmProjects/leetcode/Find/WordPattern290.py
crystal30/DataStructure
train
0
9e29cb93c5c0377ee1aa43c33b7a7b4e53a51616
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('jkmoy_mfflynn', 'jkmoy_mfflynn')\ncollection = list(repo['jkmoy_mfflynn.crime'].find())\ntotal = len(collection)\ndata = [(doc['DAY_OF_WEEK'], 1) for doc in collection if doc['DAY_OF_WEEK'].strip != '']\...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('jkmoy_mfflynn', 'jkmoy_mfflynn') collection = list(repo['jkmoy_mfflynn.crime'].find()) total = len(collection) data = [(doc['DAY_OF_WEEK']...
dotw
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class dotw: 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 everything happenin...
stack_v2_sparse_classes_10k_train_006561
3,857
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
null
Implement the Python class `dotw` described below. Class description: Implement the dotw 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=None, endTime=None): Crea...
Implement the Python class `dotw` described below. Class description: Implement the dotw 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=None, endTime=None): Crea...
90284cf3debbac36eead07b8d2339cdd191b86cf
<|skeleton|> class dotw: 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 everything happenin...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class dotw: 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('jkmoy_mfflynn', 'jkmoy_mfflynn') colle...
the_stack_v2_python_sparse
jkmoy_mfflynn/dotw.py
maximega/course-2019-spr-proj
train
2
51633b24a1d87d27399ba133d3647e6e468df6cb
[ "self.body = {(0, 0)}\nself.food = food[::-1]\nself.snake = collections.deque([(0, 0)])\nself.score = 0\nself.dirs = dict(zip('ULRD', ((-1, 0), (0, -1), (0, 1), (1, 0))))\nself.C = width\nself.R = height", "dr, dc = self.dirs[direction]\nr, c = self.snake[-1]\nnr, nc = (r + dr, c + dc)\nif nr < 0 or nr >= self.R ...
<|body_start_0|> self.body = {(0, 0)} self.food = food[::-1] self.snake = collections.deque([(0, 0)]) self.score = 0 self.dirs = dict(zip('ULRD', ((-1, 0), (0, -1), (0, 1), (1, 0)))) self.C = width self.R = height <|end_body_0|> <|body_start_1|> dr, dc = ...
SnakeGame
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SnakeGame: def __init__(self, width: int, height: int, food: List[List[int]]): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], t...
stack_v2_sparse_classes_10k_train_006562
1,817
permissive
[ { "docstring": "Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0].", "name": "__init__", "signature": "def __init__(self, widt...
2
stack_v2_sparse_classes_30k_train_005135
Implement the Python class `SnakeGame` described below. Class description: Implement the SnakeGame class. Method signatures and docstrings: - def __init__(self, width: int, height: int, food: List[List[int]]): Initialize your data structure here. @param width - screen width @param height - screen height @param food -...
Implement the Python class `SnakeGame` described below. Class description: Implement the SnakeGame class. Method signatures and docstrings: - def __init__(self, width: int, height: int, food: List[List[int]]): Initialize your data structure here. @param width - screen width @param height - screen height @param food -...
3719f5cb059eefd66b83eb8ae990652f4b7fd124
<|skeleton|> class SnakeGame: def __init__(self, width: int, height: int, food: List[List[int]]): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], t...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SnakeGame: def __init__(self, width: int, height: int, food: List[List[int]]): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is a...
the_stack_v2_python_sparse
Python3/0353-Design-Snake-Game/soln-1.py
wyaadarsh/LeetCode-Solutions
train
0
957af1f455c3986a871f29441c61d050dc21fe4c
[ "try:\n if document_id is None:\n return resource_utils.path_param_error_response('document ID')\n account_id = resource_utils.get_account_id(request)\n if account_id is None:\n return resource_utils.account_required_response()\n if not authorized(account_id, jwt):\n return resource...
<|body_start_0|> try: if document_id is None: return resource_utils.path_param_error_response('document ID') account_id = resource_utils.get_account_id(request) if account_id is None: return resource_utils.account_required_response() ...
Resource for maintaining existing, individual draft statements.
MaintainDraftResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MaintainDraftResource: """Resource for maintaining existing, individual draft statements.""" def get(document_id): """Get a draft statement by document ID.""" <|body_0|> def put(document_id): """Update a draft statement by document ID with data in the request bod...
stack_v2_sparse_classes_10k_train_006563
9,959
permissive
[ { "docstring": "Get a draft statement by document ID.", "name": "get", "signature": "def get(document_id)" }, { "docstring": "Update a draft statement by document ID with data in the request body.", "name": "put", "signature": "def put(document_id)" }, { "docstring": "Delete a dr...
3
stack_v2_sparse_classes_30k_val_000071
Implement the Python class `MaintainDraftResource` described below. Class description: Resource for maintaining existing, individual draft statements. Method signatures and docstrings: - def get(document_id): Get a draft statement by document ID. - def put(document_id): Update a draft statement by document ID with da...
Implement the Python class `MaintainDraftResource` described below. Class description: Resource for maintaining existing, individual draft statements. Method signatures and docstrings: - def get(document_id): Get a draft statement by document ID. - def put(document_id): Update a draft statement by document ID with da...
af1a4458bb78c16ecca484514d4bd0d1d8c24b5d
<|skeleton|> class MaintainDraftResource: """Resource for maintaining existing, individual draft statements.""" def get(document_id): """Get a draft statement by document ID.""" <|body_0|> def put(document_id): """Update a draft statement by document ID with data in the request bod...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MaintainDraftResource: """Resource for maintaining existing, individual draft statements.""" def get(document_id): """Get a draft statement by document ID.""" try: if document_id is None: return resource_utils.path_param_error_response('document ID') ...
the_stack_v2_python_sparse
ppr-api/src/ppr_api/resources/drafts.py
bcgov/ppr
train
4
1342dc471bb9ad0f89f4fba35056fa78a29404ec
[ "data_train = tfds.load('ted_hrlr_translate/pt_to_en', split='train', as_supervised=True)\ntokenizer_pt, tokenizer_en = self.tokenize_dataset(data_train)\nself.tokenizer_pt = tokenizer_pt\nself.tokenizer_en = tokenizer_en\nself.data_train = data_train.map(self.tf_encode)\ndata_valid = tfds.load('ted_hrlr_translate/...
<|body_start_0|> data_train = tfds.load('ted_hrlr_translate/pt_to_en', split='train', as_supervised=True) tokenizer_pt, tokenizer_en = self.tokenize_dataset(data_train) self.tokenizer_pt = tokenizer_pt self.tokenizer_en = tokenizer_en self.data_train = data_train.map(self.tf_enco...
Dataset class
Dataset
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dataset: """Dataset class""" def __init__(self): """Constructor""" <|body_0|> def tokenize_dataset(self, data): """Method that creates sub-word tokenizers for our dataset""" <|body_1|> def encode(self, pt, en): """Method that encodes a transl...
stack_v2_sparse_classes_10k_train_006564
2,032
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Method that creates sub-word tokenizers for our dataset", "name": "tokenize_dataset", "signature": "def tokenize_dataset(self, data)" }, { "docstring": "Method that encodes a tr...
4
stack_v2_sparse_classes_30k_train_004368
Implement the Python class `Dataset` described below. Class description: Dataset class Method signatures and docstrings: - def __init__(self): Constructor - def tokenize_dataset(self, data): Method that creates sub-word tokenizers for our dataset - def encode(self, pt, en): Method that encodes a translation into toke...
Implement the Python class `Dataset` described below. Class description: Dataset class Method signatures and docstrings: - def __init__(self): Constructor - def tokenize_dataset(self, data): Method that creates sub-word tokenizers for our dataset - def encode(self, pt, en): Method that encodes a translation into toke...
131be8fcf61aafb5a4ddc0b3853ba625560eb786
<|skeleton|> class Dataset: """Dataset class""" def __init__(self): """Constructor""" <|body_0|> def tokenize_dataset(self, data): """Method that creates sub-word tokenizers for our dataset""" <|body_1|> def encode(self, pt, en): """Method that encodes a transl...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Dataset: """Dataset class""" def __init__(self): """Constructor""" data_train = tfds.load('ted_hrlr_translate/pt_to_en', split='train', as_supervised=True) tokenizer_pt, tokenizer_en = self.tokenize_dataset(data_train) self.tokenizer_pt = tokenizer_pt self.tokenize...
the_stack_v2_python_sparse
supervised_learning/0x12-transformer_apps/2-dataset.py
zahraaassaad/holbertonschool-machine_learning
train
1
1aa44e3832e1c7b16b5fbd31f7c544db1bc00552
[ "stats = self._generate_stats(host_state, weight_properties)\nLOG.debug(\"Checking host '%s'\", stats[0]['host_stats']['host'])\nresult = max((self._check_goodness_function(stat) for stat in stats))\nLOG.debug('Goodness weight for %(host)s: %(res)s', {'res': result, 'host': stats[0]['host_stats']['host']})\nreturn ...
<|body_start_0|> stats = self._generate_stats(host_state, weight_properties) LOG.debug("Checking host '%s'", stats[0]['host_stats']['host']) result = max((self._check_goodness_function(stat) for stat in stats)) LOG.debug('Goodness weight for %(host)s: %(res)s', {'res': result, 'host': st...
Goodness Weigher. Assign weights based on a host's goodness function. Goodness rating is the following: .. code-block:: none 0 -- host is a poor choice . . 50 -- host is a good choice . . 100 -- host is a perfect choice
GoodnessWeigher
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GoodnessWeigher: """Goodness Weigher. Assign weights based on a host's goodness function. Goodness rating is the following: .. code-block:: none 0 -- host is a poor choice . . 50 -- host is a good choice . . 100 -- host is a perfect choice""" def _weigh_object(self, host_state, weight_proper...
stack_v2_sparse_classes_10k_train_006565
6,639
permissive
[ { "docstring": "Determine host's goodness rating based on a goodness_function.", "name": "_weigh_object", "signature": "def _weigh_object(self, host_state, weight_properties)" }, { "docstring": "Gets a host's goodness rating based on its goodness function.", "name": "_check_goodness_function...
4
stack_v2_sparse_classes_30k_train_004407
Implement the Python class `GoodnessWeigher` described below. Class description: Goodness Weigher. Assign weights based on a host's goodness function. Goodness rating is the following: .. code-block:: none 0 -- host is a poor choice . . 50 -- host is a good choice . . 100 -- host is a perfect choice Method signatures...
Implement the Python class `GoodnessWeigher` described below. Class description: Goodness Weigher. Assign weights based on a host's goodness function. Goodness rating is the following: .. code-block:: none 0 -- host is a poor choice . . 50 -- host is a good choice . . 100 -- host is a perfect choice Method signatures...
04a5d6b8c28271f6aefe2bbae6a1e16c1c235835
<|skeleton|> class GoodnessWeigher: """Goodness Weigher. Assign weights based on a host's goodness function. Goodness rating is the following: .. code-block:: none 0 -- host is a poor choice . . 50 -- host is a good choice . . 100 -- host is a perfect choice""" def _weigh_object(self, host_state, weight_proper...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GoodnessWeigher: """Goodness Weigher. Assign weights based on a host's goodness function. Goodness rating is the following: .. code-block:: none 0 -- host is a poor choice . . 50 -- host is a good choice . . 100 -- host is a perfect choice""" def _weigh_object(self, host_state, weight_properties): ...
the_stack_v2_python_sparse
cinder/scheduler/weights/goodness.py
LINBIT/openstack-cinder
train
9
514df190515b8f56183b7b031362c656e48f3a5f
[ "self.n += len(fs)\n_f = self.setdefault\nreturn tuple((_f(f, f) for f in map(float, fs)))", "Cx = _Coeffs(coeffs)\nCx.set_(ALorder=ALorder, n=self.n, u=len(self.keys()))\nreturn Cx" ]
<|body_start_0|> self.n += len(fs) _f = self.setdefault return tuple((_f(f, f) for f in map(float, fs))) <|end_body_0|> <|body_start_1|> Cx = _Coeffs(coeffs) Cx.set_(ALorder=ALorder, n=self.n, u=len(self.keys())) return Cx <|end_body_1|>
(INTERNAL) "Uniquify" floats.
_Ufloats
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _Ufloats: """(INTERNAL) "Uniquify" floats.""" def __call__(self, *fs): """Return a tuple of "uniquified" floats.""" <|body_0|> def _Coeffs(self, ALorder, coeffs): """Return C{coeffs} (C{_Coeffs}, I{embellished}).""" <|body_1|> <|end_skeleton|> <|body_st...
stack_v2_sparse_classes_10k_train_006566
7,992
permissive
[ { "docstring": "Return a tuple of \"uniquified\" floats.", "name": "__call__", "signature": "def __call__(self, *fs)" }, { "docstring": "Return C{coeffs} (C{_Coeffs}, I{embellished}).", "name": "_Coeffs", "signature": "def _Coeffs(self, ALorder, coeffs)" } ]
2
stack_v2_sparse_classes_30k_train_006335
Implement the Python class `_Ufloats` described below. Class description: (INTERNAL) "Uniquify" floats. Method signatures and docstrings: - def __call__(self, *fs): Return a tuple of "uniquified" floats. - def _Coeffs(self, ALorder, coeffs): Return C{coeffs} (C{_Coeffs}, I{embellished}).
Implement the Python class `_Ufloats` described below. Class description: (INTERNAL) "Uniquify" floats. Method signatures and docstrings: - def __call__(self, *fs): Return a tuple of "uniquified" floats. - def _Coeffs(self, ALorder, coeffs): Return C{coeffs} (C{_Coeffs}, I{embellished}). <|skeleton|> class _Ufloats:...
eba35704b248a7a0388b30f3cea19793921e99b7
<|skeleton|> class _Ufloats: """(INTERNAL) "Uniquify" floats.""" def __call__(self, *fs): """Return a tuple of "uniquified" floats.""" <|body_0|> def _Coeffs(self, ALorder, coeffs): """Return C{coeffs} (C{_Coeffs}, I{embellished}).""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class _Ufloats: """(INTERNAL) "Uniquify" floats.""" def __call__(self, *fs): """Return a tuple of "uniquified" floats.""" self.n += len(fs) _f = self.setdefault return tuple((_f(f, f) for f in map(float, fs))) def _Coeffs(self, ALorder, coeffs): """Return C{coeffs} ...
the_stack_v2_python_sparse
pygeodesy/auxilats/auxily.py
mrJean1/PyGeodesy
train
283
a8ef28be87004bcd6d936df1350d6bbdea4b415c
[ "super(Decoder, self).__init__()\nself.dec_units = dec_units\nself.embedding = tf.keras.layers.Embedding(vocab_size, embedding_dim)\nself.gru = tf.keras.layers.GRU(self.dec_units, return_sequences=True, return_state=True, recurrent_initializer='glorot_uniform', recurrent_dropout=dropout)\nself.fc = tf.keras.layers....
<|body_start_0|> super(Decoder, self).__init__() self.dec_units = dec_units self.embedding = tf.keras.layers.Embedding(vocab_size, embedding_dim) self.gru = tf.keras.layers.GRU(self.dec_units, return_sequences=True, return_state=True, recurrent_initializer='glorot_uniform', recurrent_dro...
Decoder of the gru with attention model.
Decoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Decoder: """Decoder of the gru with attention model.""" def __init__(self, vocab_size, embedding_dim, dec_units, dropout): """Create the decoder.""" <|body_0|> def call(self, x, hidden, enc_output, training): """Call the foward past. Note that the call must be fo...
stack_v2_sparse_classes_10k_train_006567
8,984
no_license
[ { "docstring": "Create the decoder.", "name": "__init__", "signature": "def __init__(self, vocab_size, embedding_dim, dec_units, dropout)" }, { "docstring": "Call the foward past. Note that the call must be for one caracter/word at a time.", "name": "call", "signature": "def call(self, x...
2
stack_v2_sparse_classes_30k_train_001371
Implement the Python class `Decoder` described below. Class description: Decoder of the gru with attention model. Method signatures and docstrings: - def __init__(self, vocab_size, embedding_dim, dec_units, dropout): Create the decoder. - def call(self, x, hidden, enc_output, training): Call the foward past. Note tha...
Implement the Python class `Decoder` described below. Class description: Decoder of the gru with attention model. Method signatures and docstrings: - def __init__(self, vocab_size, embedding_dim, dec_units, dropout): Create the decoder. - def call(self, x, hidden, enc_output, training): Call the foward past. Note tha...
4502d9e7461520664e72165a91bedd8e65464bae
<|skeleton|> class Decoder: """Decoder of the gru with attention model.""" def __init__(self, vocab_size, embedding_dim, dec_units, dropout): """Create the decoder.""" <|body_0|> def call(self, x, hidden, enc_output, training): """Call the foward past. Note that the call must be fo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Decoder: """Decoder of the gru with attention model.""" def __init__(self, vocab_size, embedding_dim, dec_units, dropout): """Create the decoder.""" super(Decoder, self).__init__() self.dec_units = dec_units self.embedding = tf.keras.layers.Embedding(vocab_size, embedding_...
the_stack_v2_python_sparse
src/model/gru_attention.py
nathanielsimard/Low-Resource-Machine-Translation
train
0
d444c8584b6f6d64b2fd5d21491a087105385d0a
[ "if value is self.field.missing_value:\n return {}\nreturn value", "if not value or len([a for a in value.values() if a]) == 0:\n return self.field.missing_value\nreturn value" ]
<|body_start_0|> if value is self.field.missing_value: return {} return value <|end_body_0|> <|body_start_1|> if not value or len([a for a in value.values() if a]) == 0: return self.field.missing_value return value <|end_body_1|>
ColorDictDataConverter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ColorDictDataConverter: def toWidgetValue(self, value): """See interfaces.IDataConverter""" <|body_0|> def toFieldValue(self, value): """See interfaces.IDataConverter""" <|body_1|> <|end_skeleton|> <|body_start_0|> if value is self.field.missing_val...
stack_v2_sparse_classes_10k_train_006568
3,681
no_license
[ { "docstring": "See interfaces.IDataConverter", "name": "toWidgetValue", "signature": "def toWidgetValue(self, value)" }, { "docstring": "See interfaces.IDataConverter", "name": "toFieldValue", "signature": "def toFieldValue(self, value)" } ]
2
stack_v2_sparse_classes_30k_train_000786
Implement the Python class `ColorDictDataConverter` described below. Class description: Implement the ColorDictDataConverter class. Method signatures and docstrings: - def toWidgetValue(self, value): See interfaces.IDataConverter - def toFieldValue(self, value): See interfaces.IDataConverter
Implement the Python class `ColorDictDataConverter` described below. Class description: Implement the ColorDictDataConverter class. Method signatures and docstrings: - def toWidgetValue(self, value): See interfaces.IDataConverter - def toFieldValue(self, value): See interfaces.IDataConverter <|skeleton|> class Color...
4a1b303bca881caa8326c093c56cdc432d38a787
<|skeleton|> class ColorDictDataConverter: def toWidgetValue(self, value): """See interfaces.IDataConverter""" <|body_0|> def toFieldValue(self, value): """See interfaces.IDataConverter""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ColorDictDataConverter: def toWidgetValue(self, value): """See interfaces.IDataConverter""" if value is self.field.missing_value: return {} return value def toFieldValue(self, value): """See interfaces.IDataConverter""" if not value or len([a for a in v...
the_stack_v2_python_sparse
Solgema/fullcalendar/widgets/widgets.py
Solgema/Solgema.fullcalendar
train
2
fe1b68be12c5b5606e3c516dd1543be259d091e3
[ "data_list = []\nresults = self.query.all()\nformatter = self.request.locale.dates.getFormatter('date', 'short')\nfor result in results:\n data = {}\n data['qid'] = 'b_' + str(result.bill_id)\n data['subject'] = result.short_name\n data['title'] = result.short_name\n data['result_item_class'] = 'work...
<|body_start_0|> data_list = [] results = self.query.all() formatter = self.request.locale.dates.getFormatter('date', 'short') for result in results: data = {} data['qid'] = 'b_' + str(result.bill_id) data['subject'] = result.short_name dat...
Display all bills that can be scheduled for a parliamentary sitting
BillItemsViewlet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BillItemsViewlet: """Display all bills that can be scheduled for a parliamentary sitting""" def getData(self): """return the data of the query""" <|body_0|> def update(self): """refresh the query""" <|body_1|> <|end_skeleton|> <|body_start_0|> d...
stack_v2_sparse_classes_10k_train_006569
35,739
no_license
[ { "docstring": "return the data of the query", "name": "getData", "signature": "def getData(self)" }, { "docstring": "refresh the query", "name": "update", "signature": "def update(self)" } ]
2
null
Implement the Python class `BillItemsViewlet` described below. Class description: Display all bills that can be scheduled for a parliamentary sitting Method signatures and docstrings: - def getData(self): return the data of the query - def update(self): refresh the query
Implement the Python class `BillItemsViewlet` described below. Class description: Display all bills that can be scheduled for a parliamentary sitting Method signatures and docstrings: - def getData(self): return the data of the query - def update(self): refresh the query <|skeleton|> class BillItemsViewlet: """D...
5cf0ba31dfbff8d2c1b4aa8ab6f69c7a0ae9870d
<|skeleton|> class BillItemsViewlet: """Display all bills that can be scheduled for a parliamentary sitting""" def getData(self): """return the data of the query""" <|body_0|> def update(self): """refresh the query""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BillItemsViewlet: """Display all bills that can be scheduled for a parliamentary sitting""" def getData(self): """return the data of the query""" data_list = [] results = self.query.all() formatter = self.request.locale.dates.getFormatter('date', 'short') for resul...
the_stack_v2_python_sparse
bungeni.buildout/branches/bungeni.buildout-refactor-2010-06-02/src/bungeni.main/bungeni/ui/viewlets/workspace.py
malangalanga/bungeni-portal
train
0
1f4d47c84e44ae70d4a2cb87a6e3db858d545bc6
[ "super(RMinimumSeeker, self).__init__()\nself._callback = callback\nself._accuracy = accuracy", "start_value = self._callback(start)\nend_value = self._callback(end)\nmiddle_value = self._callback(middle)\nreturn middle_value < start_value and middle_value < end_value", "start = -2\nend = -1\nprint()\nfor i in ...
<|body_start_0|> super(RMinimumSeeker, self).__init__() self._callback = callback self._accuracy = accuracy <|end_body_0|> <|body_start_1|> start_value = self._callback(start) end_value = self._callback(end) middle_value = self._callback(middle) return middle_val...
Класс, реализующий функции для поиска минимума на отрезке, и поиска отрезка, содержащего минимум функции.
RMinimumSeeker
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RMinimumSeeker: """Класс, реализующий функции для поиска минимума на отрезке, и поиска отрезка, содержащего минимум функции.""" def __init__(self, callback, accuracy=0.01): """Конструктор класса, входными аргументами которого являются функция и точность, с которой вычисляется минимум...
stack_v2_sparse_classes_10k_train_006570
5,946
no_license
[ { "docstring": "Конструктор класса, входными аргументами которого являются функция и точность, с которой вычисляется минимум. Значение точности по умолчанию 0.01", "name": "__init__", "signature": "def __init__(self, callback, accuracy=0.01)" }, { "docstring": "Вспомогательный метод, определяюща...
5
stack_v2_sparse_classes_30k_train_006670
Implement the Python class `RMinimumSeeker` described below. Class description: Класс, реализующий функции для поиска минимума на отрезке, и поиска отрезка, содержащего минимум функции. Method signatures and docstrings: - def __init__(self, callback, accuracy=0.01): Конструктор класса, входными аргументами которого я...
Implement the Python class `RMinimumSeeker` described below. Class description: Класс, реализующий функции для поиска минимума на отрезке, и поиска отрезка, содержащего минимум функции. Method signatures and docstrings: - def __init__(self, callback, accuracy=0.01): Конструктор класса, входными аргументами которого я...
8c05e15417e99d7236744fe9f960f4d6b09e4e31
<|skeleton|> class RMinimumSeeker: """Класс, реализующий функции для поиска минимума на отрезке, и поиска отрезка, содержащего минимум функции.""" def __init__(self, callback, accuracy=0.01): """Конструктор класса, входными аргументами которого являются функция и точность, с которой вычисляется минимум...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RMinimumSeeker: """Класс, реализующий функции для поиска минимума на отрезке, и поиска отрезка, содержащего минимум функции.""" def __init__(self, callback, accuracy=0.01): """Конструктор класса, входными аргументами которого являются функция и точность, с которой вычисляется минимум. Значение то...
the_stack_v2_python_sparse
educational/optimization-methods/one-dimentional-optimization/lab1.py
montreal91/workshop
train
3
435f48322403ca8e571f3bccfe8cc3a0a1677b7e
[ "super().__init__()\ncheck_boundaries(boundaries)\nself.boundaries = boundaries", "self.randomize(None)\nself.magnitude = self.R.uniform(low=self.boundaries[0], high=self.boundaries[1])\nlength = signal.shape[-1]\nmask = torch.zeros(round(self.magnitude * length))\ntrange = torch.arange(length)\nloc = trange[torc...
<|body_start_0|> super().__init__() check_boundaries(boundaries) self.boundaries = boundaries <|end_body_0|> <|body_start_1|> self.randomize(None) self.magnitude = self.R.uniform(low=self.boundaries[0], high=self.boundaries[1]) length = signal.shape[-1] mask = to...
Randomly drop a portion of a signal
SignalRandDrop
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SignalRandDrop: """Randomly drop a portion of a signal""" def __init__(self, boundaries: Sequence[float]=(0.0, 1.0)) -> None: """Args: boundaries: list defining lower and upper boundaries for the signal drop, lower and upper values need to be positive default : ``[0.0, 1.0]``""" ...
stack_v2_sparse_classes_10k_train_006571
16,322
permissive
[ { "docstring": "Args: boundaries: list defining lower and upper boundaries for the signal drop, lower and upper values need to be positive default : ``[0.0, 1.0]``", "name": "__init__", "signature": "def __init__(self, boundaries: Sequence[float]=(0.0, 1.0)) -> None" }, { "docstring": "Args: sig...
2
stack_v2_sparse_classes_30k_train_002624
Implement the Python class `SignalRandDrop` described below. Class description: Randomly drop a portion of a signal Method signatures and docstrings: - def __init__(self, boundaries: Sequence[float]=(0.0, 1.0)) -> None: Args: boundaries: list defining lower and upper boundaries for the signal drop, lower and upper va...
Implement the Python class `SignalRandDrop` described below. Class description: Randomly drop a portion of a signal Method signatures and docstrings: - def __init__(self, boundaries: Sequence[float]=(0.0, 1.0)) -> None: Args: boundaries: list defining lower and upper boundaries for the signal drop, lower and upper va...
e48c3e2c741fa3fc705c4425d17ac4a5afac6c47
<|skeleton|> class SignalRandDrop: """Randomly drop a portion of a signal""" def __init__(self, boundaries: Sequence[float]=(0.0, 1.0)) -> None: """Args: boundaries: list defining lower and upper boundaries for the signal drop, lower and upper values need to be positive default : ``[0.0, 1.0]``""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SignalRandDrop: """Randomly drop a portion of a signal""" def __init__(self, boundaries: Sequence[float]=(0.0, 1.0)) -> None: """Args: boundaries: list defining lower and upper boundaries for the signal drop, lower and upper values need to be positive default : ``[0.0, 1.0]``""" super()._...
the_stack_v2_python_sparse
monai/transforms/signal/array.py
Project-MONAI/MONAI
train
4,805
966c0cf276de17547391f6ca332ee22e40a07cad
[ "if data is not None:\n data = np.atleast_2d(data)\n self.mean = data.mean(axis=0)\n self.std = data.std(axis=0)\n self.nobservations = data.shape[0]\n self.ndimensions = data.shape[1]\nelse:\n self.nobservations = 0", "if self.nobservations == 0:\n self.__init__(data)\nelse:\n data = np.a...
<|body_start_0|> if data is not None: data = np.atleast_2d(data) self.mean = data.mean(axis=0) self.std = data.std(axis=0) self.nobservations = data.shape[0] self.ndimensions = data.shape[1] else: self.nobservations = 0 <|end_body_0...
StatsRecords is usefull when computing mean and standard deviation in a huge amount of data. source: http://notmatthancock.github.io/2017/03/23/simple-batch-stat-updates.html
StatsRecorder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StatsRecorder: """StatsRecords is usefull when computing mean and standard deviation in a huge amount of data. source: http://notmatthancock.github.io/2017/03/23/simple-batch-stat-updates.html""" def __init__(self, data=None): """data: ndarray, shape (nobservations, ndimensions)""" ...
stack_v2_sparse_classes_10k_train_006572
2,332
no_license
[ { "docstring": "data: ndarray, shape (nobservations, ndimensions)", "name": "__init__", "signature": "def __init__(self, data=None)" }, { "docstring": "data: ndarray, shape (nobservations, ndimensions)", "name": "update", "signature": "def update(self, data)" } ]
2
stack_v2_sparse_classes_30k_train_001577
Implement the Python class `StatsRecorder` described below. Class description: StatsRecords is usefull when computing mean and standard deviation in a huge amount of data. source: http://notmatthancock.github.io/2017/03/23/simple-batch-stat-updates.html Method signatures and docstrings: - def __init__(self, data=None...
Implement the Python class `StatsRecorder` described below. Class description: StatsRecords is usefull when computing mean and standard deviation in a huge amount of data. source: http://notmatthancock.github.io/2017/03/23/simple-batch-stat-updates.html Method signatures and docstrings: - def __init__(self, data=None...
ceceebe143e14475bad55bee6554524d3fb3c53b
<|skeleton|> class StatsRecorder: """StatsRecords is usefull when computing mean and standard deviation in a huge amount of data. source: http://notmatthancock.github.io/2017/03/23/simple-batch-stat-updates.html""" def __init__(self, data=None): """data: ndarray, shape (nobservations, ndimensions)""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class StatsRecorder: """StatsRecords is usefull when computing mean and standard deviation in a huge amount of data. source: http://notmatthancock.github.io/2017/03/23/simple-batch-stat-updates.html""" def __init__(self, data=None): """data: ndarray, shape (nobservations, ndimensions)""" if dat...
the_stack_v2_python_sparse
models/base/utils.py
felippe-mendonca/tf-human-action-datasets
train
5
e722a83e7cea1f59c51ee9abc5558f8cc4a40dc3
[ "condition = ['parameter_name_one', '*', '4.0', '+', 'parameter_name_two']\nexpected = ['parameter_name_one', 'parameter_name_two']\nresult = get_parameter_names(condition)\nself.assertEqual(result, expected)", "condition = [['parameter_name_one', '*', '4.0', '+', 'parameter_name_two'], ['parameter_name_three', '...
<|body_start_0|> condition = ['parameter_name_one', '*', '4.0', '+', 'parameter_name_two'] expected = ['parameter_name_one', 'parameter_name_two'] result = get_parameter_names(condition) self.assertEqual(result, expected) <|end_body_0|> <|body_start_1|> condition = [['parameter_...
Test the get_parameter_names method.
Test_get_parameter_names
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_get_parameter_names: """Test the get_parameter_names method.""" def test_basic(self): """Test that the get_parameter_names method does what it says.""" <|body_0|> def test_nested(self): """Test getting parameter names from nested lists.""" <|body_1|>...
stack_v2_sparse_classes_10k_train_006573
28,171
permissive
[ { "docstring": "Test that the get_parameter_names method does what it says.", "name": "test_basic", "signature": "def test_basic(self)" }, { "docstring": "Test getting parameter names from nested lists.", "name": "test_nested", "signature": "def test_nested(self)" } ]
2
null
Implement the Python class `Test_get_parameter_names` described below. Class description: Test the get_parameter_names method. Method signatures and docstrings: - def test_basic(self): Test that the get_parameter_names method does what it says. - def test_nested(self): Test getting parameter names from nested lists.
Implement the Python class `Test_get_parameter_names` described below. Class description: Test the get_parameter_names method. Method signatures and docstrings: - def test_basic(self): Test that the get_parameter_names method does what it says. - def test_nested(self): Test getting parameter names from nested lists. ...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test_get_parameter_names: """Test the get_parameter_names method.""" def test_basic(self): """Test that the get_parameter_names method does what it says.""" <|body_0|> def test_nested(self): """Test getting parameter names from nested lists.""" <|body_1|>...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Test_get_parameter_names: """Test the get_parameter_names method.""" def test_basic(self): """Test that the get_parameter_names method does what it says.""" condition = ['parameter_name_one', '*', '4.0', '+', 'parameter_name_two'] expected = ['parameter_name_one', 'parameter_name_...
the_stack_v2_python_sparse
improver_tests/wxcode/wxcode/test_utilities.py
metoppv/improver
train
101
8dfc3442c251ef8949ed8a70d83706a9437218d7
[ "if n < 1:\n return []\nself.result = []\nself.cols = set()\nself.pie = set()\nself.na = set()\nself._dfs(n, 0, [])\nreturn self._generate_result(n)", "if row >= n:\n self.result.append(cur_state)\n return\nfor col in range(n):\n if col in self.cols or row + col in self.pie or row - col in self.na:\n ...
<|body_start_0|> if n < 1: return [] self.result = [] self.cols = set() self.pie = set() self.na = set() self._dfs(n, 0, []) return self._generate_result(n) <|end_body_0|> <|body_start_1|> if row >= n: self.result.append(cur_state)...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def solveNQueens(self, n): """:type n: int :rtype: List[List[str]]""" <|body_0|> def _dfs(self, n, row, cur_state): """迭代函数 :param n: n个皇后 :param row: 行数 :param cur_state: 当前情况下的皇后位置""" <|body_1|> def _generate_result(self, n): """将皇后位置...
stack_v2_sparse_classes_10k_train_006574
1,774
no_license
[ { "docstring": ":type n: int :rtype: List[List[str]]", "name": "solveNQueens", "signature": "def solveNQueens(self, n)" }, { "docstring": "迭代函数 :param n: n个皇后 :param row: 行数 :param cur_state: 当前情况下的皇后位置", "name": "_dfs", "signature": "def _dfs(self, n, row, cur_state)" }, { "docs...
3
stack_v2_sparse_classes_30k_train_002428
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def solveNQueens(self, n): :type n: int :rtype: List[List[str]] - def _dfs(self, n, row, cur_state): 迭代函数 :param n: n个皇后 :param row: 行数 :param cur_state: 当前情况下的皇后位置 - def _genera...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def solveNQueens(self, n): :type n: int :rtype: List[List[str]] - def _dfs(self, n, row, cur_state): 迭代函数 :param n: n个皇后 :param row: 行数 :param cur_state: 当前情况下的皇后位置 - def _genera...
a58e53715493688db0108611761946f7c4481ddd
<|skeleton|> class Solution: def solveNQueens(self, n): """:type n: int :rtype: List[List[str]]""" <|body_0|> def _dfs(self, n, row, cur_state): """迭代函数 :param n: n个皇后 :param row: 行数 :param cur_state: 当前情况下的皇后位置""" <|body_1|> def _generate_result(self, n): """将皇后位置...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def solveNQueens(self, n): """:type n: int :rtype: List[List[str]]""" if n < 1: return [] self.result = [] self.cols = set() self.pie = set() self.na = set() self._dfs(n, 0, []) return self._generate_result(n) def _dfs(...
the_stack_v2_python_sparse
51.py
yourSprite/LeetCodeExcercise
train
0
1b092a95b449c370c424c99435276797fe30572d
[ "super().__init__(opt, name=name)\nself._opt = opt\nif num_mini_batches < 1:\n raise ValueError('num_mini_batches must be a positive number.')\nself._num_mini_batches = num_mini_batches\nself._offload_weight_update_variables = offload_weight_update_variables\nself._replicated_optimizer_state_sharding = replicate...
<|body_start_0|> super().__init__(opt, name=name) self._opt = opt if num_mini_batches < 1: raise ValueError('num_mini_batches must be a positive number.') self._num_mini_batches = num_mini_batches self._offload_weight_update_variables = offload_weight_update_variables...
An optimizer where instead of performing the weight update for every batch, gradients across multiple batches are accumulated. After multiple batches have been processed, their accumulated gradients are used to compute the weight update. This feature of neural networks allows us to simulate bigger batch sizes. For exam...
GradientAccumulationOptimizerV2
[ "MIT", "Apache-2.0", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GradientAccumulationOptimizerV2: """An optimizer where instead of performing the weight update for every batch, gradients across multiple batches are accumulated. After multiple batches have been processed, their accumulated gradients are used to compute the weight update. This feature of neural ...
stack_v2_sparse_classes_10k_train_006575
18,009
permissive
[ { "docstring": "Construct a Gradient Accumulation Optimizer V2. Args: opt: An existing `Optimizer` to encapsulate. num_mini_batches: Number of mini-batches the gradients will be accumulated for. offload_weight_update_variables: When enabled, any `tf.Variable` which is only used by the weight update of the pipel...
2
null
Implement the Python class `GradientAccumulationOptimizerV2` described below. Class description: An optimizer where instead of performing the weight update for every batch, gradients across multiple batches are accumulated. After multiple batches have been processed, their accumulated gradients are used to compute the...
Implement the Python class `GradientAccumulationOptimizerV2` described below. Class description: An optimizer where instead of performing the weight update for every batch, gradients across multiple batches are accumulated. After multiple batches have been processed, their accumulated gradients are used to compute the...
085b20a4b6287eff8c0b792425d52422ab8cbab3
<|skeleton|> class GradientAccumulationOptimizerV2: """An optimizer where instead of performing the weight update for every batch, gradients across multiple batches are accumulated. After multiple batches have been processed, their accumulated gradients are used to compute the weight update. This feature of neural ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GradientAccumulationOptimizerV2: """An optimizer where instead of performing the weight update for every batch, gradients across multiple batches are accumulated. After multiple batches have been processed, their accumulated gradients are used to compute the weight update. This feature of neural networks allo...
the_stack_v2_python_sparse
tensorflow/python/ipu/optimizers/gradient_accumulation_optimizer.py
graphcore/tensorflow
train
84
5bb00eab175218c14123f30ae3f02272492d26f3
[ "self.username = username\npassword = password.encode('utf8')\nself.password = md5(password).hexdigest()\nself.soft_id = soft_id\nself.base_params = {'user': self.username, 'pass2': self.password, 'softid': self.soft_id}\nself.headers = {'Accept-Encoding': 'gzip, deflate, sdch', 'Accept-Language': 'en-US,en;q=0.8',...
<|body_start_0|> self.username = username password = password.encode('utf8') self.password = md5(password).hexdigest() self.soft_id = soft_id self.base_params = {'user': self.username, 'pass2': self.password, 'softid': self.soft_id} self.headers = {'Accept-Encoding': 'gzi...
Chaojiying
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Chaojiying: def __init__(self, username, password, soft_id): """:param username: :param password: :param soft_id:""" <|body_0|> def PostPic(self, im, codetype): """:param im: 图片字节 :param codetype: 题目类型 参考 http://www.chaojiying.com/price.html :return:""" <|bod...
stack_v2_sparse_classes_10k_train_006576
7,494
no_license
[ { "docstring": ":param username: :param password: :param soft_id:", "name": "__init__", "signature": "def __init__(self, username, password, soft_id)" }, { "docstring": ":param im: 图片字节 :param codetype: 题目类型 参考 http://www.chaojiying.com/price.html :return:", "name": "PostPic", "signature...
3
stack_v2_sparse_classes_30k_train_003987
Implement the Python class `Chaojiying` described below. Class description: Implement the Chaojiying class. Method signatures and docstrings: - def __init__(self, username, password, soft_id): :param username: :param password: :param soft_id: - def PostPic(self, im, codetype): :param im: 图片字节 :param codetype: 题目类型 参考...
Implement the Python class `Chaojiying` described below. Class description: Implement the Chaojiying class. Method signatures and docstrings: - def __init__(self, username, password, soft_id): :param username: :param password: :param soft_id: - def PostPic(self, im, codetype): :param im: 图片字节 :param codetype: 题目类型 参考...
a9705ebc3a6f95160ad9571d48675bc59876bd32
<|skeleton|> class Chaojiying: def __init__(self, username, password, soft_id): """:param username: :param password: :param soft_id:""" <|body_0|> def PostPic(self, im, codetype): """:param im: 图片字节 :param codetype: 题目类型 参考 http://www.chaojiying.com/price.html :return:""" <|bod...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Chaojiying: def __init__(self, username, password, soft_id): """:param username: :param password: :param soft_id:""" self.username = username password = password.encode('utf8') self.password = md5(password).hexdigest() self.soft_id = soft_id self.base_params = {...
the_stack_v2_python_sparse
codes/Module_4/lecture_23/lecture_23_1.py
Gedanke/Reptile_study_notes
train
5
d3780d70e5a147f2bb59781c3b19ccfac1c3c115
[ "self.run_name = run_name\nself.experiments = experiments\nself.experiment_suffix = ''\nself.experiment_arg_name = experiment_arg_name\nself.experiment_dir_arg_name = experiment_dir_arg_name\nself.customize_experiment_name = customize_experiment_name\nself.param_prefix = param_prefix", "for experiment in self.exp...
<|body_start_0|> self.run_name = run_name self.experiments = experiments self.experiment_suffix = '' self.experiment_arg_name = experiment_arg_name self.experiment_dir_arg_name = experiment_dir_arg_name self.customize_experiment_name = customize_experiment_name se...
RunDescription
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RunDescription: def __init__(self, run_name, experiments, experiment_arg_name='--experiment', experiment_dir_arg_name='--train_dir', customize_experiment_name=True, param_prefix='--'): """:param run_name: overall name of the experiment and the name of the root folder :param experiments: ...
stack_v2_sparse_classes_10k_train_006577
7,490
permissive
[ { "docstring": ":param run_name: overall name of the experiment and the name of the root folder :param experiments: a list of Experiment objects to run :param experiment_arg_name: CLI argument of the underlying experiment that determines it's unique name to be generated by the launcher. Default: --experiment :p...
2
stack_v2_sparse_classes_30k_train_006601
Implement the Python class `RunDescription` described below. Class description: Implement the RunDescription class. Method signatures and docstrings: - def __init__(self, run_name, experiments, experiment_arg_name='--experiment', experiment_dir_arg_name='--train_dir', customize_experiment_name=True, param_prefix='--'...
Implement the Python class `RunDescription` described below. Class description: Implement the RunDescription class. Method signatures and docstrings: - def __init__(self, run_name, experiments, experiment_arg_name='--experiment', experiment_dir_arg_name='--train_dir', customize_experiment_name=True, param_prefix='--'...
7e1e69550f4de4cdc003d8db5bb39e186803aee9
<|skeleton|> class RunDescription: def __init__(self, run_name, experiments, experiment_arg_name='--experiment', experiment_dir_arg_name='--train_dir', customize_experiment_name=True, param_prefix='--'): """:param run_name: overall name of the experiment and the name of the root folder :param experiments: ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RunDescription: def __init__(self, run_name, experiments, experiment_arg_name='--experiment', experiment_dir_arg_name='--train_dir', customize_experiment_name=True, param_prefix='--'): """:param run_name: overall name of the experiment and the name of the root folder :param experiments: a list of Expe...
the_stack_v2_python_sparse
sample_factory/launcher/run_description.py
alex-petrenko/sample-factory
train
644
02e12193bbef7b7f41814f3e9b4521ef5280b694
[ "self.model_statistics = model_statistics\nself.model_constraints = model_constraints\nself.model_data_statistics = model_data_statistics\nself.model_data_constraints = model_data_constraints\nself.bias = bias\nself.explainability = explainability", "model_metrics_request = {}\nmodel_quality = {}\nif self.model_s...
<|body_start_0|> self.model_statistics = model_statistics self.model_constraints = model_constraints self.model_data_statistics = model_data_statistics self.model_data_constraints = model_data_constraints self.bias = bias self.explainability = explainability <|end_body_0|...
Accepts model metrics parameters for conversion to request dict.
ModelMetrics
[ "Apache-2.0", "BSD-2-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModelMetrics: """Accepts model metrics parameters for conversion to request dict.""" def __init__(self, model_statistics=None, model_constraints=None, model_data_statistics=None, model_data_constraints=None, bias=None, explainability=None): """Initialize a ``ModelMetrics`` instance a...
stack_v2_sparse_classes_10k_train_006578
6,045
permissive
[ { "docstring": "Initialize a ``ModelMetrics`` instance and turn parameters into dict. # TODO: flesh out docstrings Args: model_constraints (MetricsSource): model_data_constraints (MetricsSource): model_data_statistics (MetricsSource): bias (MetricsSource): explainability (MetricsSource):", "name": "__init__...
2
stack_v2_sparse_classes_30k_train_004167
Implement the Python class `ModelMetrics` described below. Class description: Accepts model metrics parameters for conversion to request dict. Method signatures and docstrings: - def __init__(self, model_statistics=None, model_constraints=None, model_data_statistics=None, model_data_constraints=None, bias=None, expla...
Implement the Python class `ModelMetrics` described below. Class description: Accepts model metrics parameters for conversion to request dict. Method signatures and docstrings: - def __init__(self, model_statistics=None, model_constraints=None, model_data_statistics=None, model_data_constraints=None, bias=None, expla...
43dae4b28531cde167598f104f582168b0a4141f
<|skeleton|> class ModelMetrics: """Accepts model metrics parameters for conversion to request dict.""" def __init__(self, model_statistics=None, model_constraints=None, model_data_statistics=None, model_data_constraints=None, bias=None, explainability=None): """Initialize a ``ModelMetrics`` instance a...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ModelMetrics: """Accepts model metrics parameters for conversion to request dict.""" def __init__(self, model_statistics=None, model_constraints=None, model_data_statistics=None, model_data_constraints=None, bias=None, explainability=None): """Initialize a ``ModelMetrics`` instance and turn param...
the_stack_v2_python_sparse
end_to_end/fraud_detection/demo_helpers.py
aws/amazon-sagemaker-examples
train
4,797
02b7572458a23a3ce384e19c4594cf02f7429179
[ "p = histogram\np /= np.sum(p)\nq = np.power(histogram, gamma)\nq /= np.sum(q)\nc = 1.0 / k\nalpha = np.sum((p - q) * (p - q)) / np.sum((p - c) * (p - c))\nrate = (1 - alpha) / (1 - alpha + c)\nreturn rate", "n_category = np.max(dataset)\nself.n_category = n_category\nself.dataset = np.array(dataset)\nhistogram =...
<|body_start_0|> p = histogram p /= np.sum(p) q = np.power(histogram, gamma) q /= np.sum(q) c = 1.0 / k alpha = np.sum((p - q) * (p - q)) / np.sum((p - c) * (p - c)) rate = (1 - alpha) / (1 - alpha + c) return rate <|end_body_0|> <|body_start_1|> ...
Categoricl Sampler - the sampler for getting negative samples
CategoricalSampler
[ "BSD-3-Clause", "MIT", "LicenseRef-scancode-proprietary-license", "Apache-2.0", "CC-BY-NC-4.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CategoricalSampler: """Categoricl Sampler - the sampler for getting negative samples""" def calc_random_method_selection_rate(self, k, histogram, gamma): """Calculate 2 random type selection rate In this example, the sampler combines 2 random method - sample from dataset - sample fro...
stack_v2_sparse_classes_10k_train_006579
11,796
permissive
[ { "docstring": "Calculate 2 random type selection rate In this example, the sampler combines 2 random method - sample from dataset - sample from uniform random of n_category This operation intends to simulate the distribution of powered histogram. This function calculate the rate of 2 random method minimizing t...
3
null
Implement the Python class `CategoricalSampler` described below. Class description: Categoricl Sampler - the sampler for getting negative samples Method signatures and docstrings: - def calc_random_method_selection_rate(self, k, histogram, gamma): Calculate 2 random type selection rate In this example, the sampler co...
Implement the Python class `CategoricalSampler` described below. Class description: Categoricl Sampler - the sampler for getting negative samples Method signatures and docstrings: - def calc_random_method_selection_rate(self, k, histogram, gamma): Calculate 2 random type selection rate In this example, the sampler co...
41f71faa6efff7774a76bbd5af3198322a90a6ab
<|skeleton|> class CategoricalSampler: """Categoricl Sampler - the sampler for getting negative samples""" def calc_random_method_selection_rate(self, k, histogram, gamma): """Calculate 2 random type selection rate In this example, the sampler combines 2 random method - sample from dataset - sample fro...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CategoricalSampler: """Categoricl Sampler - the sampler for getting negative samples""" def calc_random_method_selection_rate(self, k, histogram, gamma): """Calculate 2 random type selection rate In this example, the sampler combines 2 random method - sample from dataset - sample from uniform ran...
the_stack_v2_python_sparse
language-modeling/word2vec/word_embedding.py
sony/nnabla-examples
train
308
67accf3fed9388232f1475cce18f47182102ffd0
[ "self.mount_error = mount_error\nself.mount_point = mount_point\nself.volume_name = volume_name", "if dictionary is None:\n return None\nmount_error = cohesity_management_sdk.models.request_error.RequestError.from_dictionary(dictionary.get('mountError')) if dictionary.get('mountError') else None\nmount_point =...
<|body_start_0|> self.mount_error = mount_error self.mount_point = mount_point self.volume_name = volume_name <|end_body_0|> <|body_start_1|> if dictionary is None: return None mount_error = cohesity_management_sdk.models.request_error.RequestError.from_dictionary(di...
Implementation of the 'MountVolumeResultDetails' model. Specifies the result of mounting an individual mount volume in a Restore Task. Attributes: mount_error (RequestError): Specifies the cause of the mount failure if the mounting of a volume failed. mount_point (string): Specifies the mount point where the volume is ...
MountVolumeResultDetails
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MountVolumeResultDetails: """Implementation of the 'MountVolumeResultDetails' model. Specifies the result of mounting an individual mount volume in a Restore Task. Attributes: mount_error (RequestError): Specifies the cause of the mount failure if the mounting of a volume failed. mount_point (str...
stack_v2_sparse_classes_10k_train_006580
2,345
permissive
[ { "docstring": "Constructor for the MountVolumeResultDetails class", "name": "__init__", "signature": "def __init__(self, mount_error=None, mount_point=None, volume_name=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary repr...
2
stack_v2_sparse_classes_30k_train_004213
Implement the Python class `MountVolumeResultDetails` described below. Class description: Implementation of the 'MountVolumeResultDetails' model. Specifies the result of mounting an individual mount volume in a Restore Task. Attributes: mount_error (RequestError): Specifies the cause of the mount failure if the mounti...
Implement the Python class `MountVolumeResultDetails` described below. Class description: Implementation of the 'MountVolumeResultDetails' model. Specifies the result of mounting an individual mount volume in a Restore Task. Attributes: mount_error (RequestError): Specifies the cause of the mount failure if the mounti...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class MountVolumeResultDetails: """Implementation of the 'MountVolumeResultDetails' model. Specifies the result of mounting an individual mount volume in a Restore Task. Attributes: mount_error (RequestError): Specifies the cause of the mount failure if the mounting of a volume failed. mount_point (str...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MountVolumeResultDetails: """Implementation of the 'MountVolumeResultDetails' model. Specifies the result of mounting an individual mount volume in a Restore Task. Attributes: mount_error (RequestError): Specifies the cause of the mount failure if the mounting of a volume failed. mount_point (string): Specifi...
the_stack_v2_python_sparse
cohesity_management_sdk/models/mount_volume_result_details.py
cohesity/management-sdk-python
train
24
022fb2f9a7f0f5aa9375428969e7cfdd0f387277
[ "node = head\nwhile n and node:\n node = node.next\n n -= 1\nif n:\n return head\npp = None\np = head\nwhile node:\n node = node.next\n pp = p\n p = p.next\nif not pp:\n return p.next\npp.next = p.next\nreturn head", "def length(node: ListNode):\n l = 0\n while node:\n l += 1\n ...
<|body_start_0|> node = head while n and node: node = node.next n -= 1 if n: return head pp = None p = head while node: node = node.next pp = p p = p.next if not pp: return p.next ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: """One pass using two pointers Time complexity: O(n) Space complexity: O(1)""" <|body_0|> def removeNthFromEnd(self, head: Optional[ListNode], n: int) -> Optional[ListNode]: """10/16/2022 16:33...
stack_v2_sparse_classes_10k_train_006581
2,249
no_license
[ { "docstring": "One pass using two pointers Time complexity: O(n) Space complexity: O(1)", "name": "removeNthFromEnd", "signature": "def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode" }, { "docstring": "10/16/2022 16:33", "name": "removeNthFromEnd", "signature": "def removeN...
2
stack_v2_sparse_classes_30k_train_003071
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: One pass using two pointers Time complexity: O(n) Space complexity: O(1) - def removeNthFromEnd(self, head: Option...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: One pass using two pointers Time complexity: O(n) Space complexity: O(1) - def removeNthFromEnd(self, head: Option...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: """One pass using two pointers Time complexity: O(n) Space complexity: O(1)""" <|body_0|> def removeNthFromEnd(self, head: Optional[ListNode], n: int) -> Optional[ListNode]: """10/16/2022 16:33...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: """One pass using two pointers Time complexity: O(n) Space complexity: O(1)""" node = head while n and node: node = node.next n -= 1 if n: return head pp = None...
the_stack_v2_python_sparse
leetcode/solved/19_Remove_nth_Node_From_End_of_List/solution.py
sungminoh/algorithms
train
0
0b263e755b4086f0a77716c001ac0c52c4775874
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn AccessReviewStage()", "from .access_review_instance_decision_item import AccessReviewInstanceDecisionItem\nfrom .access_review_reviewer_scope import AccessReviewReviewerScope\nfrom .entity import Entity\nfrom .access_review_instance_de...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return AccessReviewStage() <|end_body_0|> <|body_start_1|> from .access_review_instance_decision_item import AccessReviewInstanceDecisionItem from .access_review_reviewer_scope import AccessRev...
AccessReviewStage
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccessReviewStage: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessReviewStage: """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_10k_train_006582
5,005
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: AccessReviewStage", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_v...
3
null
Implement the Python class `AccessReviewStage` described below. Class description: Implement the AccessReviewStage class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessReviewStage: Creates a new instance of the appropriate class based on discrim...
Implement the Python class `AccessReviewStage` described below. Class description: Implement the AccessReviewStage class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessReviewStage: Creates a new instance of the appropriate class based on discrim...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class AccessReviewStage: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessReviewStage: """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_10k
data/stack_v2_sparse_classes_30k
class AccessReviewStage: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessReviewStage: """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: Acce...
the_stack_v2_python_sparse
msgraph/generated/models/access_review_stage.py
microsoftgraph/msgraph-sdk-python
train
135
686f1521e5922df9ba2dc5d8009f1997401c16b0
[ "length = len(nums)\nsum_num = sum(nums)\nif sum_num % 2 == 1:\n return False\nhalf = sum_num // 2\ndp = [[False for _ in range(half + 1)] for _ in range(length)]\nfor c in range(half + 1):\n if c == nums[0]:\n dp[0][c] = True\nfor i in range(1, length):\n for c in range(half + 1):\n if nums[...
<|body_start_0|> length = len(nums) sum_num = sum(nums) if sum_num % 2 == 1: return False half = sum_num // 2 dp = [[False for _ in range(half + 1)] for _ in range(length)] for c in range(half + 1): if c == nums[0]: dp[0][c] = True ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canPartition(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def _canPartition(self, nums): """:type nums: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> length = len(nums) sum_num = sum...
stack_v2_sparse_classes_10k_train_006583
1,953
no_license
[ { "docstring": ":type nums: List[int] :rtype: bool", "name": "canPartition", "signature": "def canPartition(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: bool", "name": "_canPartition", "signature": "def _canPartition(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_004234
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 _canPartition(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 _canPartition(self, nums): :type nums: List[int] :rtype: bool <|skeleton|> class Solution: def canPar...
1d1ffe25d8b49832acc1791261c959ce436a6362
<|skeleton|> class Solution: def canPartition(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def _canPartition(self, nums): """:type nums: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def canPartition(self, nums): """:type nums: List[int] :rtype: bool""" length = len(nums) sum_num = sum(nums) if sum_num % 2 == 1: return False half = sum_num // 2 dp = [[False for _ in range(half + 1)] for _ in range(length)] for c...
the_stack_v2_python_sparse
00-每日一题/20200325_416.py
qiaozhi827/leetcode-1
train
0
6b04bb6d719f32a86b1bc83ce357179226385ced
[ "self.kl_weight = 1e-08\nself.num_hypotheses = num_hypotheses\nself.outputs = outputs\nif weights is None:\n self.weights = [1.0] * len(self.outputs)\nelse:\n self.weights = weights\nif stats is not None and len(stats) > 0:\n if len(stats) == 1:\n stats = stats * self.num_hypotheses\n self.st...
<|body_start_0|> self.kl_weight = 1e-08 self.num_hypotheses = num_hypotheses self.outputs = outputs if weights is None: self.weights = [1.0] * len(self.outputs) else: self.weights = weights if stats is not None and len(stats) > 0: if le...
This version of the MHP loss assumes that it will receive multiple outputs.
MhpLossWithShape
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MhpLossWithShape: """This version of the MHP loss assumes that it will receive multiple outputs.""" def __init__(self, num_hypotheses, outputs, weights=None, loss='mse', avg_weight=0.05, stats=[]): """Parameters: ----------- num_hypotheses: number of hypotheses outputs: length of eac...
stack_v2_sparse_classes_10k_train_006584
7,780
permissive
[ { "docstring": "Parameters: ----------- num_hypotheses: number of hypotheses outputs: length of each output weights: None or vector of weights for each target loss: loss function or vector of loss function names to use (keras) avg_weight: amount of weight to give to average loss across all hypotheses stats: mea...
2
null
Implement the Python class `MhpLossWithShape` described below. Class description: This version of the MHP loss assumes that it will receive multiple outputs. Method signatures and docstrings: - def __init__(self, num_hypotheses, outputs, weights=None, loss='mse', avg_weight=0.05, stats=[]): Parameters: ----------- nu...
Implement the Python class `MhpLossWithShape` described below. Class description: This version of the MHP loss assumes that it will receive multiple outputs. Method signatures and docstrings: - def __init__(self, num_hypotheses, outputs, weights=None, loss='mse', avg_weight=0.05, stats=[]): Parameters: ----------- nu...
be5c12f9d0e9d7078e6a5c283d3be059e7f3d040
<|skeleton|> class MhpLossWithShape: """This version of the MHP loss assumes that it will receive multiple outputs.""" def __init__(self, num_hypotheses, outputs, weights=None, loss='mse', avg_weight=0.05, stats=[]): """Parameters: ----------- num_hypotheses: number of hypotheses outputs: length of eac...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MhpLossWithShape: """This version of the MHP loss assumes that it will receive multiple outputs.""" def __init__(self, num_hypotheses, outputs, weights=None, loss='mse', avg_weight=0.05, stats=[]): """Parameters: ----------- num_hypotheses: number of hypotheses outputs: length of each output weig...
the_stack_v2_python_sparse
costar_models/python/costar_models/mhp_loss.py
lk-greenbird/costar_plan
train
0
95400d35d973a11887c6073d57a98c2e27cc9f85
[ "self.file_system = file_system\nself.name = name\nself.storage_array = storage_array\nself.mtype = mtype", "if dictionary is None:\n return None\nfile_system = cohesity_management_sdk.models.flash_blade_file_system.FlashBladeFileSystem.from_dictionary(dictionary.get('fileSystem')) if dictionary.get('fileSyste...
<|body_start_0|> self.file_system = file_system self.name = name self.storage_array = storage_array self.mtype = mtype <|end_body_0|> <|body_start_1|> if dictionary is None: return None file_system = cohesity_management_sdk.models.flash_blade_file_system.Flas...
Implementation of the 'FlashBladeProtectionSource' model. Specifies a Protection Source in Pure Storage FlashBlade environment. Attributes: file_system (FlashBladeFileSystem): Specifies a Pure Storage FlashBlade File System information. This is set only when the object type is 'kFileSystem'. name (string): Specifies a ...
FlashBladeProtectionSource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FlashBladeProtectionSource: """Implementation of the 'FlashBladeProtectionSource' model. Specifies a Protection Source in Pure Storage FlashBlade environment. Attributes: file_system (FlashBladeFileSystem): Specifies a Pure Storage FlashBlade File System information. This is set only when the obj...
stack_v2_sparse_classes_10k_train_006585
3,009
permissive
[ { "docstring": "Constructor for the FlashBladeProtectionSource class", "name": "__init__", "signature": "def __init__(self, file_system=None, name=None, storage_array=None, mtype=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictio...
2
null
Implement the Python class `FlashBladeProtectionSource` described below. Class description: Implementation of the 'FlashBladeProtectionSource' model. Specifies a Protection Source in Pure Storage FlashBlade environment. Attributes: file_system (FlashBladeFileSystem): Specifies a Pure Storage FlashBlade File System inf...
Implement the Python class `FlashBladeProtectionSource` described below. Class description: Implementation of the 'FlashBladeProtectionSource' model. Specifies a Protection Source in Pure Storage FlashBlade environment. Attributes: file_system (FlashBladeFileSystem): Specifies a Pure Storage FlashBlade File System inf...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class FlashBladeProtectionSource: """Implementation of the 'FlashBladeProtectionSource' model. Specifies a Protection Source in Pure Storage FlashBlade environment. Attributes: file_system (FlashBladeFileSystem): Specifies a Pure Storage FlashBlade File System information. This is set only when the obj...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FlashBladeProtectionSource: """Implementation of the 'FlashBladeProtectionSource' model. Specifies a Protection Source in Pure Storage FlashBlade environment. Attributes: file_system (FlashBladeFileSystem): Specifies a Pure Storage FlashBlade File System information. This is set only when the object type is '...
the_stack_v2_python_sparse
cohesity_management_sdk/models/flash_blade_protection_source.py
cohesity/management-sdk-python
train
24
6c0fa090a6cfb14576aa2adc98c69dd5075836d5
[ "res = deque()\nfor i in range(len(nums)):\n if nums[i] % 2 == 0:\n res.append(nums[i])\n else:\n res.appendleft(nums[i])\nreturn list(res)", "i, j = (0, len(nums) - 1)\nwhile i < j:\n while i < j and nums[i] & 1 == 1:\n i += 1\n while i < j and nums[j] & 1 == 0:\n j -= 1\n...
<|body_start_0|> res = deque() for i in range(len(nums)): if nums[i] % 2 == 0: res.append(nums[i]) else: res.appendleft(nums[i]) return list(res) <|end_body_0|> <|body_start_1|> i, j = (0, len(nums) - 1) while i < j: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def exchange_1(self, nums: List[int]) -> List[int]: """双端队列 时间复杂度 O(N) 空间复杂度 O(N) :param nums: :return:""" <|body_0|> def exchange_2(self, nums: List[int]) -> List[int]: """双指针 时间复杂度 O(N) 空间复杂度 O(1) :param nums: :return:""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_10k_train_006586
1,516
no_license
[ { "docstring": "双端队列 时间复杂度 O(N) 空间复杂度 O(N) :param nums: :return:", "name": "exchange_1", "signature": "def exchange_1(self, nums: List[int]) -> List[int]" }, { "docstring": "双指针 时间复杂度 O(N) 空间复杂度 O(1) :param nums: :return:", "name": "exchange_2", "signature": "def exchange_2(self, nums: L...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def exchange_1(self, nums: List[int]) -> List[int]: 双端队列 时间复杂度 O(N) 空间复杂度 O(N) :param nums: :return: - def exchange_2(self, nums: List[int]) -> List[int]: 双指针 时间复杂度 O(N) 空间复杂度 O(...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def exchange_1(self, nums: List[int]) -> List[int]: 双端队列 时间复杂度 O(N) 空间复杂度 O(N) :param nums: :return: - def exchange_2(self, nums: List[int]) -> List[int]: 双指针 时间复杂度 O(N) 空间复杂度 O(...
62419b49000e79962bcdc99cd98afd2fb82ea345
<|skeleton|> class Solution: def exchange_1(self, nums: List[int]) -> List[int]: """双端队列 时间复杂度 O(N) 空间复杂度 O(N) :param nums: :return:""" <|body_0|> def exchange_2(self, nums: List[int]) -> List[int]: """双指针 时间复杂度 O(N) 空间复杂度 O(1) :param nums: :return:""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def exchange_1(self, nums: List[int]) -> List[int]: """双端队列 时间复杂度 O(N) 空间复杂度 O(N) :param nums: :return:""" res = deque() for i in range(len(nums)): if nums[i] % 2 == 0: res.append(nums[i]) else: res.appendleft(nums[i]) ...
the_stack_v2_python_sparse
剑指 Offer(第 2 版)/exchange.py
MaoningGuan/LeetCode
train
3
12254d006245e24817d2ad965fe1b577c2cc1286
[ "import time\nimport thread\nthread.start_new_thread(self.run, ())", "import viewer_basics\ntry:\n self.app = viewer_basics.SecondThreadApp(0)\n self.app.MainLoop()\nexcept TypeError:\n self.app = None", "import viewer_basics\nif self.app:\n evt = viewer_basics.AddCone()\n viewer_basics.wxPostEve...
<|body_start_0|> import time import thread thread.start_new_thread(self.run, ()) <|end_body_0|> <|body_start_1|> import viewer_basics try: self.app = viewer_basics.SecondThreadApp(0) self.app.MainLoop() except TypeError: self.app = Non...
viewer_thread
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class viewer_thread: def start(self): """start the GUI thread""" <|body_0|> def run(self): """Note that viewer_basices is first imported ***here***. This is the second thread. viewer_basics imports wxPython. if we imported it at the module level instead of in this function...
stack_v2_sparse_classes_10k_train_006587
3,430
no_license
[ { "docstring": "start the GUI thread", "name": "start", "signature": "def start(self)" }, { "docstring": "Note that viewer_basices is first imported ***here***. This is the second thread. viewer_basics imports wxPython. if we imported it at the module level instead of in this function, the impor...
3
null
Implement the Python class `viewer_thread` described below. Class description: Implement the viewer_thread class. Method signatures and docstrings: - def start(self): start the GUI thread - def run(self): Note that viewer_basices is first imported ***here***. This is the second thread. viewer_basics imports wxPython....
Implement the Python class `viewer_thread` described below. Class description: Implement the viewer_thread class. Method signatures and docstrings: - def start(self): start the GUI thread - def run(self): Note that viewer_basices is first imported ***here***. This is the second thread. viewer_basics imports wxPython....
13cceab2a1891ab443e62078be729dc1e1e2e283
<|skeleton|> class viewer_thread: def start(self): """start the GUI thread""" <|body_0|> def run(self): """Note that viewer_basices is first imported ***here***. This is the second thread. viewer_basics imports wxPython. if we imported it at the module level instead of in this function...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class viewer_thread: def start(self): """start the GUI thread""" import time import thread thread.start_new_thread(self.run, ()) def run(self): """Note that viewer_basices is first imported ***here***. This is the second thread. viewer_basics imports wxPython. if we impo...
the_stack_v2_python_sparse
wxPython/demo/viewer.py
nvaccess/wxPython
train
1
2cd833ca6d134f13f2797769fa2822cb85484337
[ "if not email:\n raise ValueError(_('Users must have an email address'))\nuser = self.model(email=self.normalize_email(email), name=name, phone1=phone1, signed_up=signed_up)\nuser.set_password(password)\nuser.save(using=self._db)\nMyUserProfile.objects.create(myuser=user)\nNotifClick.objects.create(myuser=user)\...
<|body_start_0|> if not email: raise ValueError(_('Users must have an email address')) user = self.model(email=self.normalize_email(email), name=name, phone1=phone1, signed_up=signed_up) user.set_password(password) user.save(using=self._db) MyUserProfile.objects.creat...
MyUserManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyUserManager: def create_user(self, email, name, phone1, password=None, signed_up=timezone.localtime()): """Creates and saves a User with the given email, name and password.""" <|body_0|> def create_superuser(self, email, name, phone1, password=None, signed_up=timezone.loca...
stack_v2_sparse_classes_10k_train_006588
4,013
no_license
[ { "docstring": "Creates and saves a User with the given email, name and password.", "name": "create_user", "signature": "def create_user(self, email, name, phone1, password=None, signed_up=timezone.localtime())" }, { "docstring": "Creates and saves a superuser with the given email, name and pass...
2
stack_v2_sparse_classes_30k_train_002101
Implement the Python class `MyUserManager` described below. Class description: Implement the MyUserManager class. Method signatures and docstrings: - def create_user(self, email, name, phone1, password=None, signed_up=timezone.localtime()): Creates and saves a User with the given email, name and password. - def creat...
Implement the Python class `MyUserManager` described below. Class description: Implement the MyUserManager class. Method signatures and docstrings: - def create_user(self, email, name, phone1, password=None, signed_up=timezone.localtime()): Creates and saves a User with the given email, name and password. - def creat...
94751753d907b1299613fd35b0cf8a2cec3cd208
<|skeleton|> class MyUserManager: def create_user(self, email, name, phone1, password=None, signed_up=timezone.localtime()): """Creates and saves a User with the given email, name and password.""" <|body_0|> def create_superuser(self, email, name, phone1, password=None, signed_up=timezone.loca...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MyUserManager: def create_user(self, email, name, phone1, password=None, signed_up=timezone.localtime()): """Creates and saves a User with the given email, name and password.""" if not email: raise ValueError(_('Users must have an email address')) user = self.model(email=se...
the_stack_v2_python_sparse
join/models.py
lcbiplove/frutonp
train
0
46682b443a236631018e7fd5b11a67d01df03995
[ "self.classifiers = classifiers\nself.named_classifiers = {key: value for key, value in _name_estimators(classifiers)}\nself.vote = vote\nself.weights = weights\nself.lablenc_ = LabelEncoder()\nself.classifiers_ = []\nself.classes_ = []", "if self.vote not in ('probability', 'classlabel'):\n raise ValueError(\...
<|body_start_0|> self.classifiers = classifiers self.named_classifiers = {key: value for key, value in _name_estimators(classifiers)} self.vote = vote self.weights = weights self.lablenc_ = LabelEncoder() self.classifiers_ = [] self.classes_ = [] <|end_body_0|> <...
A majority vote ensemble classifier Parameters ---------- classifiers : array-like, shape = [n_classifiers] Different classifiers for the ensemble vote : str, {'classlabel', 'probability'} (default='label') If 'classlabel' the prediction is based on the argmax of class labels. Else if 'probability', the argmax of the s...
MajorityVoteClassifier
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MajorityVoteClassifier: """A majority vote ensemble classifier Parameters ---------- classifiers : array-like, shape = [n_classifiers] Different classifiers for the ensemble vote : str, {'classlabel', 'probability'} (default='label') If 'classlabel' the prediction is based on the argmax of class ...
stack_v2_sparse_classes_10k_train_006589
9,495
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, classifiers, vote='classlabel', weights=None)" }, { "docstring": "Fit classifiers. Parameters ---------- X : {array-like, sparse matrix}, shape = [n_samples, n_features] Matrix of training samples. y : array-like,...
5
stack_v2_sparse_classes_30k_test_000106
Implement the Python class `MajorityVoteClassifier` described below. Class description: A majority vote ensemble classifier Parameters ---------- classifiers : array-like, shape = [n_classifiers] Different classifiers for the ensemble vote : str, {'classlabel', 'probability'} (default='label') If 'classlabel' the pred...
Implement the Python class `MajorityVoteClassifier` described below. Class description: A majority vote ensemble classifier Parameters ---------- classifiers : array-like, shape = [n_classifiers] Different classifiers for the ensemble vote : str, {'classlabel', 'probability'} (default='label') If 'classlabel' the pred...
957c49300ae59571eda590ddf13e7e092fdd96aa
<|skeleton|> class MajorityVoteClassifier: """A majority vote ensemble classifier Parameters ---------- classifiers : array-like, shape = [n_classifiers] Different classifiers for the ensemble vote : str, {'classlabel', 'probability'} (default='label') If 'classlabel' the prediction is based on the argmax of class ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MajorityVoteClassifier: """A majority vote ensemble classifier Parameters ---------- classifiers : array-like, shape = [n_classifiers] Different classifiers for the ensemble vote : str, {'classlabel', 'probability'} (default='label') If 'classlabel' the prediction is based on the argmax of class labels. Else ...
the_stack_v2_python_sparse
research/ml_analysis/dev_work/majority_vote.py
mccarvik/python_for_finance
train
3
c87ead78bd14ca7ec3d015fdaab4213591348bb9
[ "ret = dict([(p, unicode(getattr(self, p))) for p in self.properties()])\nret['id'] = self.key().id_or_name()\nret['items'] = self.items\nreturn ret", "if description is None or description == '':\n raise ValueError(' description not set')\nproduct = None\nif key is not None:\n product = Product.get_by_id(i...
<|body_start_0|> ret = dict([(p, unicode(getattr(self, p))) for p in self.properties()]) ret['id'] = self.key().id_or_name() ret['items'] = self.items return ret <|end_body_0|> <|body_start_1|> if description is None or description == '': raise ValueError(' descripti...
Model class for ShoppingList
ShoppingList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShoppingList: """Model class for ShoppingList""" def to_dict(self): """For JSON serialization""" <|body_0|> def add_item(self, description, key, quantity): """Add an item to the list""" <|body_1|> def get_items(self): """Get all items""" ...
stack_v2_sparse_classes_10k_train_006590
3,485
no_license
[ { "docstring": "For JSON serialization", "name": "to_dict", "signature": "def to_dict(self)" }, { "docstring": "Add an item to the list", "name": "add_item", "signature": "def add_item(self, description, key, quantity)" }, { "docstring": "Get all items", "name": "get_items", ...
5
stack_v2_sparse_classes_30k_train_000928
Implement the Python class `ShoppingList` described below. Class description: Model class for ShoppingList Method signatures and docstrings: - def to_dict(self): For JSON serialization - def add_item(self, description, key, quantity): Add an item to the list - def get_items(self): Get all items - def delete_item(self...
Implement the Python class `ShoppingList` described below. Class description: Model class for ShoppingList Method signatures and docstrings: - def to_dict(self): For JSON serialization - def add_item(self, description, key, quantity): Add an item to the list - def get_items(self): Get all items - def delete_item(self...
394b4821b65191df221d62f807ba2895f38e86a3
<|skeleton|> class ShoppingList: """Model class for ShoppingList""" def to_dict(self): """For JSON serialization""" <|body_0|> def add_item(self, description, key, quantity): """Add an item to the list""" <|body_1|> def get_items(self): """Get all items""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ShoppingList: """Model class for ShoppingList""" def to_dict(self): """For JSON serialization""" ret = dict([(p, unicode(getattr(self, p))) for p in self.properties()]) ret['id'] = self.key().id_or_name() ret['items'] = self.items return ret def add_item(self,...
the_stack_v2_python_sparse
model/shoppinglist.py
szilardhuber/shopper
train
1
439211ae824a3b0c6df190407576414fe56453da
[ "self.name = name\nself.start = None\nself.end = None\nself.interval = None", "sys.stdout.write('{:30}'.format(self.name + '...'))\nsys.stdout.flush()\nself.start = time.clock()\nreturn self", "self.end = time.clock()\nself.interval = self.end - self.start\nsys.stdout.write(' {:.3f}s'.format(self.interval))\npr...
<|body_start_0|> self.name = name self.start = None self.end = None self.interval = None <|end_body_0|> <|body_start_1|> sys.stdout.write('{:30}'.format(self.name + '...')) sys.stdout.flush() self.start = time.clock() return self <|end_body_1|> <|body_st...
Keep track of execution time, printing status and time before and after.
Timer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Timer: """Keep track of execution time, printing status and time before and after.""" def __init__(self, name='Timing'): """Optionally give it a name.""" <|body_0|> def __enter__(self): """When the context in entered, start the timer and print the timer name.""" ...
stack_v2_sparse_classes_10k_train_006591
1,528
permissive
[ { "docstring": "Optionally give it a name.", "name": "__init__", "signature": "def __init__(self, name='Timing')" }, { "docstring": "When the context in entered, start the timer and print the timer name.", "name": "__enter__", "signature": "def __enter__(self)" }, { "docstring": ...
3
stack_v2_sparse_classes_30k_train_006522
Implement the Python class `Timer` described below. Class description: Keep track of execution time, printing status and time before and after. Method signatures and docstrings: - def __init__(self, name='Timing'): Optionally give it a name. - def __enter__(self): When the context in entered, start the timer and prin...
Implement the Python class `Timer` described below. Class description: Keep track of execution time, printing status and time before and after. Method signatures and docstrings: - def __init__(self, name='Timing'): Optionally give it a name. - def __enter__(self): When the context in entered, start the timer and prin...
f65ba15890542db8a6c0b2024e500e895cee33d5
<|skeleton|> class Timer: """Keep track of execution time, printing status and time before and after.""" def __init__(self, name='Timing'): """Optionally give it a name.""" <|body_0|> def __enter__(self): """When the context in entered, start the timer and print the timer name.""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Timer: """Keep track of execution time, printing status and time before and after.""" def __init__(self, name='Timing'): """Optionally give it a name.""" self.name = name self.start = None self.end = None self.interval = None def __enter__(self): """Wh...
the_stack_v2_python_sparse
asr_tools/util.py
belambert/asr-tools
train
6
60abc9cbd5f2a3ab903e0e970f21f64a21e8ff37
[ "headers = {'tenant-id': tenant_id, 'user-auth-token': token, 'user-login-type': AgentApp.agent_login_type, 'device-uuid': AgentApp.device_uuid, 'user-id': user_id, 'agent-app': AgentApp.agent_app, 'Api-version': AgentApp.Api_Version}\nparams = {}\nparams.update(kwargs)\nurl = AgentApp.fws + '/appapi/v4/bkges/bkges...
<|body_start_0|> headers = {'tenant-id': tenant_id, 'user-auth-token': token, 'user-login-type': AgentApp.agent_login_type, 'device-uuid': AgentApp.device_uuid, 'user-id': user_id, 'agent-app': AgentApp.agent_app, 'Api-version': AgentApp.Api_Version} params = {} params.update(kwargs) url...
Bkges
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Bkges: def get_bkge_indexs(self, token, user_id, tenant_id, **kwargs): """佣金统计页面""" <|body_0|> def get_channel_bkge_list(self, token, user_id, tenant_id, **kwargs): """通道佣金列表创""" <|body_1|> <|end_skeleton|> <|body_start_0|> headers = {'tenant-id': t...
stack_v2_sparse_classes_10k_train_006592
1,428
no_license
[ { "docstring": "佣金统计页面", "name": "get_bkge_indexs", "signature": "def get_bkge_indexs(self, token, user_id, tenant_id, **kwargs)" }, { "docstring": "通道佣金列表创", "name": "get_channel_bkge_list", "signature": "def get_channel_bkge_list(self, token, user_id, tenant_id, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_val_000392
Implement the Python class `Bkges` described below. Class description: Implement the Bkges class. Method signatures and docstrings: - def get_bkge_indexs(self, token, user_id, tenant_id, **kwargs): 佣金统计页面 - def get_channel_bkge_list(self, token, user_id, tenant_id, **kwargs): 通道佣金列表创
Implement the Python class `Bkges` described below. Class description: Implement the Bkges class. Method signatures and docstrings: - def get_bkge_indexs(self, token, user_id, tenant_id, **kwargs): 佣金统计页面 - def get_channel_bkge_list(self, token, user_id, tenant_id, **kwargs): 通道佣金列表创 <|skeleton|> class Bkges: d...
2278222cf86887bf16f88cde0ebcce5b5ec98b8f
<|skeleton|> class Bkges: def get_bkge_indexs(self, token, user_id, tenant_id, **kwargs): """佣金统计页面""" <|body_0|> def get_channel_bkge_list(self, token, user_id, tenant_id, **kwargs): """通道佣金列表创""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Bkges: def get_bkge_indexs(self, token, user_id, tenant_id, **kwargs): """佣金统计页面""" headers = {'tenant-id': tenant_id, 'user-auth-token': token, 'user-login-type': AgentApp.agent_login_type, 'device-uuid': AgentApp.device_uuid, 'user-id': user_id, 'agent-app': AgentApp.agent_app, 'Api-version'...
the_stack_v2_python_sparse
api/bkges.py
Tiffanyfei/agent_app_api
train
0
6702ed69e8b8b657f69824e879d632a9ef624975
[ "super(RandomWander, self).__init__()\nself.iteration = 0\nself.rate = rate\nself.speed = 0\nself.heading = 0", "if self.iteration > self.rate:\n self.iteration = 0\n heading = random.random() * 180 - 90\n self.speed = 0.1\n if heading >= 0:\n self.heading = heading\n else:\n self.hea...
<|body_start_0|> super(RandomWander, self).__init__() self.iteration = 0 self.rate = rate self.speed = 0 self.heading = 0 <|end_body_0|> <|body_start_1|> if self.iteration > self.rate: self.iteration = 0 heading = random.random() * 180 - 90 ...
Simple behavior tht wanders, turning with some randomness each time.
RandomWander
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomWander: """Simple behavior tht wanders, turning with some randomness each time.""" def __init__(self, rate): """Sets up the behavior with all rates set to zero.""" <|body_0|> def update(self): """wanders with a random heading.""" <|body_1|> <|end_s...
stack_v2_sparse_classes_10k_train_006593
8,374
no_license
[ { "docstring": "Sets up the behavior with all rates set to zero.", "name": "__init__", "signature": "def __init__(self, rate)" }, { "docstring": "wanders with a random heading.", "name": "update", "signature": "def update(self)" } ]
2
stack_v2_sparse_classes_30k_train_002629
Implement the Python class `RandomWander` described below. Class description: Simple behavior tht wanders, turning with some randomness each time. Method signatures and docstrings: - def __init__(self, rate): Sets up the behavior with all rates set to zero. - def update(self): wanders with a random heading.
Implement the Python class `RandomWander` described below. Class description: Simple behavior tht wanders, turning with some randomness each time. Method signatures and docstrings: - def __init__(self, rate): Sets up the behavior with all rates set to zero. - def update(self): wanders with a random heading. <|skelet...
97bb378a325b1639110de06b88d6e237dffc7330
<|skeleton|> class RandomWander: """Simple behavior tht wanders, turning with some randomness each time.""" def __init__(self, rate): """Sets up the behavior with all rates set to zero.""" <|body_0|> def update(self): """wanders with a random heading.""" <|body_1|> <|end_s...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RandomWander: """Simple behavior tht wanders, turning with some randomness each time.""" def __init__(self, rate): """Sets up the behavior with all rates set to zero.""" super(RandomWander, self).__init__() self.iteration = 0 self.rate = rate self.speed = 0 ...
the_stack_v2_python_sparse
src/match_seeker/scripts/FieldBehaviors.py
FoxRobotLab/catkin_ws
train
6
2e62641b35c9ec779526a68adaa0907b9614eb65
[ "count = 0\nfor i, v in enumerate(nums):\n if v == 0:\n count += 1\n elif count:\n nums[i - count] = v\nif count:\n nums[-count:] = [0] * count\nprint(nums)", "j = 0\nfor i in range(len(nums)):\n if nums[i]:\n nums[j] = nums[i]\n j += 1" ]
<|body_start_0|> count = 0 for i, v in enumerate(nums): if v == 0: count += 1 elif count: nums[i - count] = v if count: nums[-count:] = [0] * count print(nums) <|end_body_0|> <|body_start_1|> j = 0 for i...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def moveZeroes(self, nums: List[int]) -> None: """Do not return anything, modify nums in-place instead.""" <|body_0|> def moveZeroes2(self, nums: List[int]) -> None: """better way :param nums: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_10k_train_006594
1,067
no_license
[ { "docstring": "Do not return anything, modify nums in-place instead.", "name": "moveZeroes", "signature": "def moveZeroes(self, nums: List[int]) -> None" }, { "docstring": "better way :param nums: :return:", "name": "moveZeroes2", "signature": "def moveZeroes2(self, nums: List[int]) -> ...
2
stack_v2_sparse_classes_30k_train_005591
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def moveZeroes(self, nums: List[int]) -> None: Do not return anything, modify nums in-place instead. - def moveZeroes2(self, nums: List[int]) -> None: better way :param nums: :re...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def moveZeroes(self, nums: List[int]) -> None: Do not return anything, modify nums in-place instead. - def moveZeroes2(self, nums: List[int]) -> None: better way :param nums: :re...
0abc04bc44e6fedf6ce59e83dd37be5787b88a25
<|skeleton|> class Solution: def moveZeroes(self, nums: List[int]) -> None: """Do not return anything, modify nums in-place instead.""" <|body_0|> def moveZeroes2(self, nums: List[int]) -> None: """better way :param nums: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def moveZeroes(self, nums: List[int]) -> None: """Do not return anything, modify nums in-place instead.""" count = 0 for i, v in enumerate(nums): if v == 0: count += 1 elif count: nums[i - count] = v if count: ...
the_stack_v2_python_sparse
MoveZeroes.py
oratun/Py-LeetCode
train
0
56067c6f0a794af1aed6cc0a3bef410bf64255fa
[ "path = urlJoin(urls.ROGUE_LOCATION['GET_AP_LOC'], macaddr)\nparams = {'offset': offset, 'limit': limit, 'units': units}\nresp = conn.command(apiMethod='GET', apiPath=path, apiParams=params)\nreturn resp", "path = urlJoin(urls.ROGUE_LOCATION['GET_FLOOR_APS'], floor_id)\nparams = {'offset': offset, 'limit': limit,...
<|body_start_0|> path = urlJoin(urls.ROGUE_LOCATION['GET_AP_LOC'], macaddr) params = {'offset': offset, 'limit': limit, 'units': units} resp = conn.command(apiMethod='GET', apiPath=path, apiParams=params) return resp <|end_body_0|> <|body_start_1|> path = urlJoin(urls.ROGUE_LOCA...
A python class to obtain location of rogue access points
RougueLocation
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RougueLocation: """A python class to obtain location of rogue access points""" def get_rogueap_location(self, conn, macaddr: str, offset=0, limit=100, units='FEET'): """Get location of rogue a access point based on its Mac Address :param conn: Instance of class:`pycentral.ArubaCentra...
stack_v2_sparse_classes_10k_train_006595
13,713
permissive
[ { "docstring": "Get location of rogue a access point based on its Mac Address :param conn: Instance of class:`pycentral.ArubaCentralBase` to make an API call. :type conn: class:`pycentral.ArubaCentralBase` :param macaddr: Provide Mac Address of an Access Point :type macaddr: str :param offset: Pagination start ...
2
stack_v2_sparse_classes_30k_train_000326
Implement the Python class `RougueLocation` described below. Class description: A python class to obtain location of rogue access points Method signatures and docstrings: - def get_rogueap_location(self, conn, macaddr: str, offset=0, limit=100, units='FEET'): Get location of rogue a access point based on its Mac Addr...
Implement the Python class `RougueLocation` described below. Class description: A python class to obtain location of rogue access points Method signatures and docstrings: - def get_rogueap_location(self, conn, macaddr: str, offset=0, limit=100, units='FEET'): Get location of rogue a access point based on its Mac Addr...
d938396a18193473afbe54e6cc6697d2bd4954a7
<|skeleton|> class RougueLocation: """A python class to obtain location of rogue access points""" def get_rogueap_location(self, conn, macaddr: str, offset=0, limit=100, units='FEET'): """Get location of rogue a access point based on its Mac Address :param conn: Instance of class:`pycentral.ArubaCentra...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RougueLocation: """A python class to obtain location of rogue access points""" def get_rogueap_location(self, conn, macaddr: str, offset=0, limit=100, units='FEET'): """Get location of rogue a access point based on its Mac Address :param conn: Instance of class:`pycentral.ArubaCentralBase` to mak...
the_stack_v2_python_sparse
pycentral/visualrf.py
jayp193/pycentral
train
0
20e0306cd560e76acd9c4edc56dd17cd5260700b
[ "overrides = overrides or {}\nis_training = overrides.pop('is_training', False)\nconfig = config or build_dict(name='ModelConfig')\nself.config = config\nself.config.update(overrides)\ninput_channels = self.config['input_channels']\nmodel_name = self.config['model_name']\ninput_shape = (None, None, input_channels)\...
<|body_start_0|> overrides = overrides or {} is_training = overrides.pop('is_training', False) config = config or build_dict(name='ModelConfig') self.config = config self.config.update(overrides) input_channels = self.config['input_channels'] model_name = self.con...
Wrapper class for an EfficientNet Keras model. Contains helper methods to build, manage, and save metadata about the model.
EfficientNet
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EfficientNet: """Wrapper class for an EfficientNet Keras model. Contains helper methods to build, manage, and save metadata about the model.""" def __init__(self, config: Dict[Text, Any]=None, overrides: Dict[Text, Any]=None): """Create an EfficientNet model. Args: config: (optional)...
stack_v2_sparse_classes_10k_train_006596
11,511
permissive
[ { "docstring": "Create an EfficientNet model. Args: config: (optional) the main model parameters to create the model overrides: (optional) a dict containing keys that can override config", "name": "__init__", "signature": "def __init__(self, config: Dict[Text, Any]=None, overrides: Dict[Text, Any]=None)...
2
stack_v2_sparse_classes_30k_train_001997
Implement the Python class `EfficientNet` described below. Class description: Wrapper class for an EfficientNet Keras model. Contains helper methods to build, manage, and save metadata about the model. Method signatures and docstrings: - def __init__(self, config: Dict[Text, Any]=None, overrides: Dict[Text, Any]=None...
Implement the Python class `EfficientNet` described below. Class description: Wrapper class for an EfficientNet Keras model. Contains helper methods to build, manage, and save metadata about the model. Method signatures and docstrings: - def __init__(self, config: Dict[Text, Any]=None, overrides: Dict[Text, Any]=None...
2d555548b698e4fc207965b7121f525c37e0401c
<|skeleton|> class EfficientNet: """Wrapper class for an EfficientNet Keras model. Contains helper methods to build, manage, and save metadata about the model.""" def __init__(self, config: Dict[Text, Any]=None, overrides: Dict[Text, Any]=None): """Create an EfficientNet model. Args: config: (optional)...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EfficientNet: """Wrapper class for an EfficientNet Keras model. Contains helper methods to build, manage, and save metadata about the model.""" def __init__(self, config: Dict[Text, Any]=None, overrides: Dict[Text, Any]=None): """Create an EfficientNet model. Args: config: (optional) the main mod...
the_stack_v2_python_sparse
TensorFlow2/Classification/ConvNets/efficientnet/model/efficientnet_model.py
resemble-ai/DeepLearningExamples
train
4
42bb99899a670c6f12420e86c653c46af24dbe82
[ "startTime = datetime.datetime.now()\nprint('')\nprint('inserting zillow search data...')\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('ekmak_gzhou_kaylaipp_shen99', 'ekmak_gzhou_kaylaipp_shen99')\nurl = 'http://datamechanics.io/data/zillow_getsearchresults_data.json'\nresponse = urlli...
<|body_start_0|> startTime = datetime.datetime.now() print('') print('inserting zillow search data...') client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('ekmak_gzhou_kaylaipp_shen99', 'ekmak_gzhou_kaylaipp_shen99') url = 'http://datamechanic...
get_zillow_search_data
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class get_zillow_search_data: def execute(trial=True): """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 ev...
stack_v2_sparse_classes_10k_train_006597
7,270
no_license
[ { "docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).", "name": "execute", "signature": "def execute(trial=True)" }, { "docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new do...
2
stack_v2_sparse_classes_30k_train_005088
Implement the Python class `get_zillow_search_data` described below. Class description: Implement the get_zillow_search_data class. Method signatures and docstrings: - def execute(trial=True): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), ...
Implement the Python class `get_zillow_search_data` described below. Class description: Implement the get_zillow_search_data class. Method signatures and docstrings: - def execute(trial=True): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), ...
90284cf3debbac36eead07b8d2339cdd191b86cf
<|skeleton|> class get_zillow_search_data: def execute(trial=True): """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 ev...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class get_zillow_search_data: def execute(trial=True): """Retrieve some data sets (not using the API here for the sake of simplicity).""" startTime = datetime.datetime.now() print('') print('inserting zillow search data...') client = dml.pymongo.MongoClient() repo = c...
the_stack_v2_python_sparse
ekmak_gzhou_kaylaipp_shen99/get_zillow_search_data.py
maximega/course-2019-spr-proj
train
2
01fd7df4bb3171651def567c2c1f7892418ba4b2
[ "rows = []\nfor index in range(1, numrows):\n rows.append(int(rowcount / numrows * index))\nrows.append(int(rowcount / numrows * numrows) - 1)\nreturn rows", "np_patient_reshaped = np.empty((0, 5 * len(Worker.columns) * Worker.frames_per_excersise))\nindicator = None\nfor combination in patient_combinations:\n...
<|body_start_0|> rows = [] for index in range(1, numrows): rows.append(int(rowcount / numrows * index)) rows.append(int(rowcount / numrows * numrows) - 1) return rows <|end_body_0|> <|body_start_1|> np_patient_reshaped = np.empty((0, 5 * len(Worker.columns) * Worker....
Worker
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Worker: def select_rows(rowcount, numrows): """creates a list of evenly devided row indexes based on size of an table. Arguments: rowcount [int] -- amount of rows in the table. numrows [int] -- number of rows to devide in. Returns: [list] -- list of row indexes based on size of table."""...
stack_v2_sparse_classes_10k_train_006598
3,644
no_license
[ { "docstring": "creates a list of evenly devided row indexes based on size of an table. Arguments: rowcount [int] -- amount of rows in the table. numrows [int] -- number of rows to devide in. Returns: [list] -- list of row indexes based on size of table.", "name": "select_rows", "signature": "def select...
3
stack_v2_sparse_classes_30k_test_000179
Implement the Python class `Worker` described below. Class description: Implement the Worker class. Method signatures and docstrings: - def select_rows(rowcount, numrows): creates a list of evenly devided row indexes based on size of an table. Arguments: rowcount [int] -- amount of rows in the table. numrows [int] --...
Implement the Python class `Worker` described below. Class description: Implement the Worker class. Method signatures and docstrings: - def select_rows(rowcount, numrows): creates a list of evenly devided row indexes based on size of an table. Arguments: rowcount [int] -- amount of rows in the table. numrows [int] --...
e850ea81b3f1e92b9c6a9bbd401fd5aaab1a3cf2
<|skeleton|> class Worker: def select_rows(rowcount, numrows): """creates a list of evenly devided row indexes based on size of an table. Arguments: rowcount [int] -- amount of rows in the table. numrows [int] -- number of rows to devide in. Returns: [list] -- list of row indexes based on size of table."""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Worker: def select_rows(rowcount, numrows): """creates a list of evenly devided row indexes based on size of an table. Arguments: rowcount [int] -- amount of rows in the table. numrows [int] -- number of rows to devide in. Returns: [list] -- list of row indexes based on size of table.""" rows ...
the_stack_v2_python_sparse
Fingerprinting/DataScience/src/tools/worker.py
lvkoppen/DataScienceMinor
train
0
290e8cd268006000cee9af28736b19d9a4ad31e6
[ "super(Obelisk, self).at_object_creation()\nself.db.tutorial_info = 'This object changes its desc randomly, and makes sure to remember which one you saw.'\nself.locks.add('get:false()')", "clueindex = random.randint(0, len(OBELISK_DESCS) - 1)\nstring = 'The surface of the obelisk seem to waver, shift and writhe u...
<|body_start_0|> super(Obelisk, self).at_object_creation() self.db.tutorial_info = 'This object changes its desc randomly, and makes sure to remember which one you saw.' self.locks.add('get:false()') <|end_body_0|> <|body_start_1|> clueindex = random.randint(0, len(OBELISK_DESCS) - 1) ...
This object changes its description randomly.
Obelisk
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Obelisk: """This object changes its description randomly.""" def at_object_creation(self): """Called when object is created.""" <|body_0|> def return_appearance(self, caller): """Overload the default version of this hook.""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_10k_train_006599
36,948
permissive
[ { "docstring": "Called when object is created.", "name": "at_object_creation", "signature": "def at_object_creation(self)" }, { "docstring": "Overload the default version of this hook.", "name": "return_appearance", "signature": "def return_appearance(self, caller)" } ]
2
stack_v2_sparse_classes_30k_train_005261
Implement the Python class `Obelisk` described below. Class description: This object changes its description randomly. Method signatures and docstrings: - def at_object_creation(self): Called when object is created. - def return_appearance(self, caller): Overload the default version of this hook.
Implement the Python class `Obelisk` described below. Class description: This object changes its description randomly. Method signatures and docstrings: - def at_object_creation(self): Called when object is created. - def return_appearance(self, caller): Overload the default version of this hook. <|skeleton|> class ...
4515b6b569f919b18223ff2b241ea70f3e787e1e
<|skeleton|> class Obelisk: """This object changes its description randomly.""" def at_object_creation(self): """Called when object is created.""" <|body_0|> def return_appearance(self, caller): """Overload the default version of this hook.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Obelisk: """This object changes its description randomly.""" def at_object_creation(self): """Called when object is created.""" super(Obelisk, self).at_object_creation() self.db.tutorial_info = 'This object changes its desc randomly, and makes sure to remember which one you saw.' ...
the_stack_v2_python_sparse
contrib/tutorial_world/objects.py
mergederg/deuterium
train
1