blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
c307b1a541a8541710c5cfa34e4a57b40733e25c
[ "self.params = {}\n'\\n 我们用标准差为weight_scale的高斯分布初始化参数W,\\n 偏置B的初始化都为0:\\n (其中randn函数是基于零均值和标准差的一个高斯分布)\\n '\nself.params['W1'] = weight_scale * np.random.randn(input_dims, hidden_dims)\nself.params['b1'] = np.zeros((hidden_dims,))\nself.params['W2'] = weight_scale * np.random.randn(hidde...
<|body_start_0|> self.params = {} '\n 我们用标准差为weight_scale的高斯分布初始化参数W,\n 偏置B的初始化都为0:\n (其中randn函数是基于零均值和标准差的一个高斯分布)\n ' self.params['W1'] = weight_scale * np.random.randn(input_dims, hidden_dims) self.params['b1'] = np.zeros((hidden_dims,)) self.params[...
首先,先初始化我们的神经网络。 毕竟,数据从输入层第一次流入到神经网络里,参数(W,B)不能为空,(w,b)是 一层的参数;(W,B)是所有层参数的统一。参数初始化也不能太大或太小,因此 (W,B)的初始化时很重要的,对整个神经网络的训练影响巨大,但如何proper 的初始化参数还没定论。
TwoLayerNet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TwoLayerNet: """首先,先初始化我们的神经网络。 毕竟,数据从输入层第一次流入到神经网络里,参数(W,B)不能为空,(w,b)是 一层的参数;(W,B)是所有层参数的统一。参数初始化也不能太大或太小,因此 (W,B)的初始化时很重要的,对整个神经网络的训练影响巨大,但如何proper 的初始化参数还没定论。""" def __init__(self, input_dims=32 * 32 * 3, hidden_dims=100, num_classes=10, weight_scale=0.001): """我们把需要学习的参数(W,B)都存在s...
stack_v2_sparse_classes_36k_train_015600
36,287
no_license
[ { "docstring": "我们把需要学习的参数(W,B)都存在self.params字典中, 其中每个元素都是numpy array:", "name": "__init__", "signature": "def __init__(self, input_dims=32 * 32 * 3, hidden_dims=100, num_classes=10, weight_scale=0.001)" }, { "docstring": "首先,输入的数据X是一个多维的array,shape为(样本图片的个数N * 32*32*3), y是与输入数据X对应的正确标签,shape为(N...
2
stack_v2_sparse_classes_30k_train_015691
Implement the Python class `TwoLayerNet` described below. Class description: 首先,先初始化我们的神经网络。 毕竟,数据从输入层第一次流入到神经网络里,参数(W,B)不能为空,(w,b)是 一层的参数;(W,B)是所有层参数的统一。参数初始化也不能太大或太小,因此 (W,B)的初始化时很重要的,对整个神经网络的训练影响巨大,但如何proper 的初始化参数还没定论。 Method signatures and docstrings: - def __init__(self, input_dims=32 * 32 * 3, hidden_dims=100,...
Implement the Python class `TwoLayerNet` described below. Class description: 首先,先初始化我们的神经网络。 毕竟,数据从输入层第一次流入到神经网络里,参数(W,B)不能为空,(w,b)是 一层的参数;(W,B)是所有层参数的统一。参数初始化也不能太大或太小,因此 (W,B)的初始化时很重要的,对整个神经网络的训练影响巨大,但如何proper 的初始化参数还没定论。 Method signatures and docstrings: - def __init__(self, input_dims=32 * 32 * 3, hidden_dims=100,...
e82d9577d8a7f4ce9950bc7e5a950592dff34bbd
<|skeleton|> class TwoLayerNet: """首先,先初始化我们的神经网络。 毕竟,数据从输入层第一次流入到神经网络里,参数(W,B)不能为空,(w,b)是 一层的参数;(W,B)是所有层参数的统一。参数初始化也不能太大或太小,因此 (W,B)的初始化时很重要的,对整个神经网络的训练影响巨大,但如何proper 的初始化参数还没定论。""" def __init__(self, input_dims=32 * 32 * 3, hidden_dims=100, num_classes=10, weight_scale=0.001): """我们把需要学习的参数(W,B)都存在s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TwoLayerNet: """首先,先初始化我们的神经网络。 毕竟,数据从输入层第一次流入到神经网络里,参数(W,B)不能为空,(w,b)是 一层的参数;(W,B)是所有层参数的统一。参数初始化也不能太大或太小,因此 (W,B)的初始化时很重要的,对整个神经网络的训练影响巨大,但如何proper 的初始化参数还没定论。""" def __init__(self, input_dims=32 * 32 * 3, hidden_dims=100, num_classes=10, weight_scale=0.001): """我们把需要学习的参数(W,B)都存在self.params字典中...
the_stack_v2_python_sparse
assigment2/full_connect.py
hduyuanfu/SHUQI_SHIYAN
train
0
ea5eac98686f4395729fa3158cebdda0e467c4d0
[ "self.cmd_base = cmd_base\nself.env_vars = env_vars.copy() if env_vars is not None else dict()\nself.ros_args = ros_args", "cmd = self.cmd_base\nfor name, val in self.ros_args.items():\n cmd += f' {name}:={val}'\nreturn cmd", "for var, val in self.env_vars.items():\n os.environ[var] = str(val)\nprocess = ...
<|body_start_0|> self.cmd_base = cmd_base self.env_vars = env_vars.copy() if env_vars is not None else dict() self.ros_args = ros_args <|end_body_0|> <|body_start_1|> cmd = self.cmd_base for name, val in self.ros_args.items(): cmd += f' {name}:={val}' return ...
Holds data for a ROS command and makes it executable.
ROSCmd
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ROSCmd: """Holds data for a ROS command and makes it executable.""" def __init__(self, cmd_base: str, *, env_vars: Dict[str, Any], **ros_args): """Initialize ROSCmd. Args: cmd_base: Command string without arguments. env_vars: Environment variables set prior to running the command. ro...
stack_v2_sparse_classes_36k_train_015601
1,808
permissive
[ { "docstring": "Initialize ROSCmd. Args: cmd_base: Command string without arguments. env_vars: Environment variables set prior to running the command. ros_args: ROS arguments passed when running the command.", "name": "__init__", "signature": "def __init__(self, cmd_base: str, *, env_vars: Dict[str, Any...
3
null
Implement the Python class `ROSCmd` described below. Class description: Holds data for a ROS command and makes it executable. Method signatures and docstrings: - def __init__(self, cmd_base: str, *, env_vars: Dict[str, Any], **ros_args): Initialize ROSCmd. Args: cmd_base: Command string without arguments. env_vars: E...
Implement the Python class `ROSCmd` described below. Class description: Holds data for a ROS command and makes it executable. Method signatures and docstrings: - def __init__(self, cmd_base: str, *, env_vars: Dict[str, Any], **ros_args): Initialize ROSCmd. Args: cmd_base: Command string without arguments. env_vars: E...
8a9438b5a24c288721ae0302889fe55e26046310
<|skeleton|> class ROSCmd: """Holds data for a ROS command and makes it executable.""" def __init__(self, cmd_base: str, *, env_vars: Dict[str, Any], **ros_args): """Initialize ROSCmd. Args: cmd_base: Command string without arguments. env_vars: Environment variables set prior to running the command. ro...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ROSCmd: """Holds data for a ROS command and makes it executable.""" def __init__(self, cmd_base: str, *, env_vars: Dict[str, Any], **ros_args): """Initialize ROSCmd. Args: cmd_base: Command string without arguments. env_vars: Environment variables set prior to running the command. ros_args: ROS a...
the_stack_v2_python_sparse
simulation/utils/basics/ros_cmd.py
KITcar-Team/kitcar-gazebo-simulation
train
19
d3d1b10a2cf47e6226b8b6226cb53fe0879bfcfc
[ "super(MultiHeadedAttention, self).__init__()\nassert d_model % h == 0\nself.d_k = d_model // h\nself.h = h\nself.attenuation_lambda = torch.nn.Parameter(torch.tensor(attenuation_lambda, requires_grad=True))\nself.linears = clones(nn.Linear(d_model, d_model), 5)\nself.message = None\nself.leaky_relu_slope = leaky_r...
<|body_start_0|> super(MultiHeadedAttention, self).__init__() assert d_model % h == 0 self.d_k = d_model // h self.h = h self.attenuation_lambda = torch.nn.Parameter(torch.tensor(attenuation_lambda, requires_grad=True)) self.linears = clones(nn.Linear(d_model, d_model), 5...
MultiHeadedAttention
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiHeadedAttention: def __init__(self, h, d_model, leaky_relu_slope=0.1, dropout=0.1, attenuation_lambda=0.1, distance_matrix_kernel='softmax'): """Take in model size and number of heads.""" <|body_0|> def forward(self, query_node, value_node, key_edge, adj_matrix, mask=No...
stack_v2_sparse_classes_36k_train_015602
18,947
permissive
[ { "docstring": "Take in model size and number of heads.", "name": "__init__", "signature": "def __init__(self, h, d_model, leaky_relu_slope=0.1, dropout=0.1, attenuation_lambda=0.1, distance_matrix_kernel='softmax')" }, { "docstring": "Implements Figure 2", "name": "forward", "signature"...
2
stack_v2_sparse_classes_30k_val_000460
Implement the Python class `MultiHeadedAttention` described below. Class description: Implement the MultiHeadedAttention class. Method signatures and docstrings: - def __init__(self, h, d_model, leaky_relu_slope=0.1, dropout=0.1, attenuation_lambda=0.1, distance_matrix_kernel='softmax'): Take in model size and number...
Implement the Python class `MultiHeadedAttention` described below. Class description: Implement the MultiHeadedAttention class. Method signatures and docstrings: - def __init__(self, h, d_model, leaky_relu_slope=0.1, dropout=0.1, attenuation_lambda=0.1, distance_matrix_kernel='softmax'): Take in model size and number...
11a36843a83ddc93748c5437f5a21f2507b66c77
<|skeleton|> class MultiHeadedAttention: def __init__(self, h, d_model, leaky_relu_slope=0.1, dropout=0.1, attenuation_lambda=0.1, distance_matrix_kernel='softmax'): """Take in model size and number of heads.""" <|body_0|> def forward(self, query_node, value_node, key_edge, adj_matrix, mask=No...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiHeadedAttention: def __init__(self, h, d_model, leaky_relu_slope=0.1, dropout=0.1, attenuation_lambda=0.1, distance_matrix_kernel='softmax'): """Take in model size and number of heads.""" super(MultiHeadedAttention, self).__init__() assert d_model % h == 0 self.d_k = d_mod...
the_stack_v2_python_sparse
MolRep/Models/sequence_based/CoMPT.py
biomed-AI/MolRep
train
104
4d542d06223e08a24c96a31d4d834483f1bf64da
[ "def preorder(root):\n if not root:\n return '#,'\n return str(root.val) + ',' + self.serialize(root.left) + self.serialize(root.right)\nreturn preorder(root)", "if not data or data == '#':\n return\nnodes = data.split(',')\n\ndef preorder(i):\n if i >= len(nodes) or nodes[i] == '#':\n r...
<|body_start_0|> def preorder(root): if not root: return '#,' return str(root.val) + ',' + self.serialize(root.left) + self.serialize(root.right) return preorder(root) <|end_body_0|> <|body_start_1|> if not data or data == '#': return ...
CodecDFS
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CodecDFS: 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|> <|bo...
stack_v2_sparse_classes_36k_train_015603
2,652
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `CodecDFS` described below. Class description: Implement the CodecDFS 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 :...
Implement the Python class `CodecDFS` described below. Class description: Implement the CodecDFS 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 :...
3a5649357e0f21cbbc5e238351300cd706d533b3
<|skeleton|> class CodecDFS: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CodecDFS: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" def preorder(root): if not root: return '#,' return str(root.val) + ',' + self.serialize(root.left) + self.serialize(root.right) return...
the_stack_v2_python_sparse
leetcode-py/leetcode297.py
cicihou/LearningProject
train
0
a2858548c3a0a28448c13609aa7fb19d37a00e7c
[ "self.title = 'Convert Miles to Kilometres'\nself.root = Builder.load_file('convert_miles_km.kv')\nreturn self.root", "value = self.get_valid_miles()\nresult = value * FACTOR_MILES_TO_KM\nself.root.ids.output_label.text = str(result)", "value = self.get_valid_miles() + change\nself.root.ids.input_miles.text = s...
<|body_start_0|> self.title = 'Convert Miles to Kilometres' self.root = Builder.load_file('convert_miles_km.kv') return self.root <|end_body_0|> <|body_start_1|> value = self.get_valid_miles() result = value * FACTOR_MILES_TO_KM self.root.ids.output_label.text = str(resu...
MilesConverterApp is a Kivy App for the conversion of miles into kilometres.
MilesConverterApp
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MilesConverterApp: """MilesConverterApp is a Kivy App for the conversion of miles into kilometres.""" def build(self): """Build the Kivy App from the Kv file.""" <|body_0|> def handle_calculate(self): """Handle the conversion from miles to kilometres.""" ...
stack_v2_sparse_classes_36k_train_015604
1,548
no_license
[ { "docstring": "Build the Kivy App from the Kv file.", "name": "build", "signature": "def build(self)" }, { "docstring": "Handle the conversion from miles to kilometres.", "name": "handle_calculate", "signature": "def handle_calculate(self)" }, { "docstring": "Handle pressing \"U...
4
null
Implement the Python class `MilesConverterApp` described below. Class description: MilesConverterApp is a Kivy App for the conversion of miles into kilometres. Method signatures and docstrings: - def build(self): Build the Kivy App from the Kv file. - def handle_calculate(self): Handle the conversion from miles to ki...
Implement the Python class `MilesConverterApp` described below. Class description: MilesConverterApp is a Kivy App for the conversion of miles into kilometres. Method signatures and docstrings: - def build(self): Build the Kivy App from the Kv file. - def handle_calculate(self): Handle the conversion from miles to ki...
25ce5696ee15aee95521541441a01eb18820bc93
<|skeleton|> class MilesConverterApp: """MilesConverterApp is a Kivy App for the conversion of miles into kilometres.""" def build(self): """Build the Kivy App from the Kv file.""" <|body_0|> def handle_calculate(self): """Handle the conversion from miles to kilometres.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MilesConverterApp: """MilesConverterApp is a Kivy App for the conversion of miles into kilometres.""" def build(self): """Build the Kivy App from the Kv file.""" self.title = 'Convert Miles to Kilometres' self.root = Builder.load_file('convert_miles_km.kv') return self.roo...
the_stack_v2_python_sparse
prac_07/convert_miles_km.py
MomoeYoshida/cp1404practicals
train
0
c4f8bc50fab035004d08b163828024a791e52c1d
[ "dummy = ListNode()\np = dummy\nwhile l1 and l2:\n if l1.val < l2.val:\n p.next, l1 = (l1, l1.next)\n else:\n p.next, l2 = (l2, l2.next)\n p = p.next\np.next = l1 or l2\nreturn dummy.next", "if not l1:\n return l2\nif not l2:\n return l1\nif l1.val < l2.val:\n l1.next = self.mergeT...
<|body_start_0|> dummy = ListNode() p = dummy while l1 and l2: if l1.val < l2.val: p.next, l1 = (l1, l1.next) else: p.next, l2 = (l2, l2.next) p = p.next p.next = l1 or l2 return dummy.next <|end_body_0|> <|body...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mergeTwoLists1(self, l1: ListNode, l2: ListNode) -> ListNode: """Solution #1: iteratively Time: O(n) Space: O(1)""" <|body_0|> def mergeTwoLists2(self, l1: ListNode, l2: ListNode) -> ListNode: """Solution #2: recursively Time: O(n) Space: O(1)""" ...
stack_v2_sparse_classes_36k_train_015605
1,325
no_license
[ { "docstring": "Solution #1: iteratively Time: O(n) Space: O(1)", "name": "mergeTwoLists1", "signature": "def mergeTwoLists1(self, l1: ListNode, l2: ListNode) -> ListNode" }, { "docstring": "Solution #2: recursively Time: O(n) Space: O(1)", "name": "mergeTwoLists2", "signature": "def mer...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists1(self, l1: ListNode, l2: ListNode) -> ListNode: Solution #1: iteratively Time: O(n) Space: O(1) - def mergeTwoLists2(self, l1: ListNode, l2: ListNode) -> ListNo...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists1(self, l1: ListNode, l2: ListNode) -> ListNode: Solution #1: iteratively Time: O(n) Space: O(1) - def mergeTwoLists2(self, l1: ListNode, l2: ListNode) -> ListNo...
59c8b144f4245ed4a8b06a458954ca05c0c73aea
<|skeleton|> class Solution: def mergeTwoLists1(self, l1: ListNode, l2: ListNode) -> ListNode: """Solution #1: iteratively Time: O(n) Space: O(1)""" <|body_0|> def mergeTwoLists2(self, l1: ListNode, l2: ListNode) -> ListNode: """Solution #2: recursively Time: O(n) Space: O(1)""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def mergeTwoLists1(self, l1: ListNode, l2: ListNode) -> ListNode: """Solution #1: iteratively Time: O(n) Space: O(1)""" dummy = ListNode() p = dummy while l1 and l2: if l1.val < l2.val: p.next, l1 = (l1, l1.next) else: ...
the_stack_v2_python_sparse
01/merge-two-sorted-lists.py
TrisDing/algorithm010
train
1
6a5a722a81a13f364138040e05080a46d6b8c506
[ "self.theta = theta_0\nself.step_size = step_size\nself.max_iter = max_iter\nself.eps = eps\nself.verbose = verbose", "phi = y.mean()\nmu = np.array([X[y == k].mean(axis=0) for k in [0, 1]])\nX_u = X.copy()\nfor k in [0, 1]:\n X_u[y == k] -= mu[k]\nEpsilon = X_u.T.dot(X_u) / len(y)\ninvEpsilon = np.linalg.pinv...
<|body_start_0|> self.theta = theta_0 self.step_size = step_size self.max_iter = max_iter self.eps = eps self.verbose = verbose <|end_body_0|> <|body_start_1|> phi = y.mean() mu = np.array([X[y == k].mean(axis=0) for k in [0, 1]]) X_u = X.copy() f...
Gaussian Discriminant Analysis. Example usage: > clf = GDA() > clf.fit(x_train, y_train) > clf.predict(x_eval)
GDA
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GDA: """Gaussian Discriminant Analysis. Example usage: > clf = GDA() > clf.fit(x_train, y_train) > clf.predict(x_eval)""" def __init__(self, step_size=0.01, max_iter=10000, eps=1e-05, theta_0=None, verbose=True): """Args: step_size: Step size for iterative solvers only. max_iter: Max...
stack_v2_sparse_classes_36k_train_015606
14,754
no_license
[ { "docstring": "Args: step_size: Step size for iterative solvers only. max_iter: Maximum number of iterations for the solver. eps: Threshold for determining convergence. theta_0: Initial guess for theta. If None, use the zero vector. verbose: Print loss values during training.", "name": "__init__", "sig...
3
stack_v2_sparse_classes_30k_val_000122
Implement the Python class `GDA` described below. Class description: Gaussian Discriminant Analysis. Example usage: > clf = GDA() > clf.fit(x_train, y_train) > clf.predict(x_eval) Method signatures and docstrings: - def __init__(self, step_size=0.01, max_iter=10000, eps=1e-05, theta_0=None, verbose=True): Args: step_...
Implement the Python class `GDA` described below. Class description: Gaussian Discriminant Analysis. Example usage: > clf = GDA() > clf.fit(x_train, y_train) > clf.predict(x_eval) Method signatures and docstrings: - def __init__(self, step_size=0.01, max_iter=10000, eps=1e-05, theta_0=None, verbose=True): Args: step_...
2cd881b33103435a45068fe7d5d1ac26b2d944c3
<|skeleton|> class GDA: """Gaussian Discriminant Analysis. Example usage: > clf = GDA() > clf.fit(x_train, y_train) > clf.predict(x_eval)""" def __init__(self, step_size=0.01, max_iter=10000, eps=1e-05, theta_0=None, verbose=True): """Args: step_size: Step size for iterative solvers only. max_iter: Max...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GDA: """Gaussian Discriminant Analysis. Example usage: > clf = GDA() > clf.fit(x_train, y_train) > clf.predict(x_eval)""" def __init__(self, step_size=0.01, max_iter=10000, eps=1e-05, theta_0=None, verbose=True): """Args: step_size: Step size for iterative solvers only. max_iter: Maximum number o...
the_stack_v2_python_sparse
Course Assignments/CP8318 - Machine Learning Assignments/CP8318 Assignment 2 - Rohaan Ahmed/linearclass/gda_rohaan.py
rohaan-ahmed/Master-Repository
train
0
0683b59638a98126eda2b66c920a77bfb0965ede
[ "obj = context.object\nif obj is None:\n return False\nreturn all([bool(obj), obj.type == 'MESH', obj.mode == 'EDIT'])", "pg = context.scene.pdt_pg\npg.command = f'etf'\nreturn {'FINISHED'}" ]
<|body_start_0|> obj = context.object if obj is None: return False return all([bool(obj), obj.type == 'MESH', obj.mode == 'EDIT']) <|end_body_0|> <|body_start_1|> pg = context.scene.pdt_pg pg.command = f'etf' return {'FINISHED'} <|end_body_1|>
Extend Selected Edge to Projected Intersection with Selected Face
PDT_OT_EdgeToFace
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PDT_OT_EdgeToFace: """Extend Selected Edge to Projected Intersection with Selected Face""" def poll(cls, context): """Only allow this to work if a mesh is selected in EDIT mode. Args: context: Blender bpy.context instance. Returns: Boolean.""" <|body_0|> def execute(self...
stack_v2_sparse_classes_36k_train_015607
3,809
permissive
[ { "docstring": "Only allow this to work if a mesh is selected in EDIT mode. Args: context: Blender bpy.context instance. Returns: Boolean.", "name": "poll", "signature": "def poll(cls, context)" }, { "docstring": "Extends Disconnected Edge to Intersect with Face. Args: context: Blender bpy.conte...
2
null
Implement the Python class `PDT_OT_EdgeToFace` described below. Class description: Extend Selected Edge to Projected Intersection with Selected Face Method signatures and docstrings: - def poll(cls, context): Only allow this to work if a mesh is selected in EDIT mode. Args: context: Blender bpy.context instance. Retu...
Implement the Python class `PDT_OT_EdgeToFace` described below. Class description: Extend Selected Edge to Projected Intersection with Selected Face Method signatures and docstrings: - def poll(cls, context): Only allow this to work if a mesh is selected in EDIT mode. Args: context: Blender bpy.context instance. Retu...
4d5c304878c1e0018d97c1b07bcaa3981632265a
<|skeleton|> class PDT_OT_EdgeToFace: """Extend Selected Edge to Projected Intersection with Selected Face""" def poll(cls, context): """Only allow this to work if a mesh is selected in EDIT mode. Args: context: Blender bpy.context instance. Returns: Boolean.""" <|body_0|> def execute(self...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PDT_OT_EdgeToFace: """Extend Selected Edge to Projected Intersection with Selected Face""" def poll(cls, context): """Only allow this to work if a mesh is selected in EDIT mode. Args: context: Blender bpy.context instance. Returns: Boolean.""" obj = context.object if obj is None: ...
the_stack_v2_python_sparse
src/bpy/3.6/scripts/addons/precision_drawing_tools/pdt_etof.py
RnoB/3DVisualSwarm
train
0
ddd8518621ddf74300d9e546c366545c2324b4a1
[ "self.id = process.id\nself.pid = process.pid\nself.name = process.name\nself.cpu = None\nself.mem = None\nself.etime = None", "repr_string = '{}('.format(self.__class__.__name__)\nrepr_string += 'id={}, '.format(self.id)\nrepr_string += 'pid={}, '.format(self.pid)\nrepr_string += 'name={}, '.format(self.name)\nr...
<|body_start_0|> self.id = process.id self.pid = process.pid self.name = process.name self.cpu = None self.mem = None self.etime = None <|end_body_0|> <|body_start_1|> repr_string = '{}('.format(self.__class__.__name__) repr_string += 'id={}, '.format(sel...
MonitorData is a container for processes that are monitored by StorageMonitor. It is designed to be pickled and send as a Message payload.
MonitorData
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MonitorData: """MonitorData is a container for processes that are monitored by StorageMonitor. It is designed to be pickled and send as a Message payload.""" def __init__(self, process): """Initializes a MonitorData with: Args: process: A multiprocessing.Process instance""" <...
stack_v2_sparse_classes_36k_train_015608
6,615
no_license
[ { "docstring": "Initializes a MonitorData with: Args: process: A multiprocessing.Process instance", "name": "__init__", "signature": "def __init__(self, process)" }, { "docstring": "Provides a repr() implementation for MonitorData. Returns: A repr string for MonitorData.", "name": "__repr__"...
2
stack_v2_sparse_classes_30k_train_008767
Implement the Python class `MonitorData` described below. Class description: MonitorData is a container for processes that are monitored by StorageMonitor. It is designed to be pickled and send as a Message payload. Method signatures and docstrings: - def __init__(self, process): Initializes a MonitorData with: Args:...
Implement the Python class `MonitorData` described below. Class description: MonitorData is a container for processes that are monitored by StorageMonitor. It is designed to be pickled and send as a Message payload. Method signatures and docstrings: - def __init__(self, process): Initializes a MonitorData with: Args:...
e2b7136c7feda4deb667bd1e6cba3c1ef7eeff9d
<|skeleton|> class MonitorData: """MonitorData is a container for processes that are monitored by StorageMonitor. It is designed to be pickled and send as a Message payload.""" def __init__(self, process): """Initializes a MonitorData with: Args: process: A multiprocessing.Process instance""" <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MonitorData: """MonitorData is a container for processes that are monitored by StorageMonitor. It is designed to be pickled and send as a Message payload.""" def __init__(self, process): """Initializes a MonitorData with: Args: process: A multiprocessing.Process instance""" self.id = proc...
the_stack_v2_python_sparse
client/monitor.py
NickBayard/sf
train
0
36e30795b5bbff7d51d39795f421f2d0cb57429a
[ "super().__init__(**kwargs)\nself._vocab_size = vocab_size\nself._num_mixtures = num_mixtures\nself._use_input_context_gate = use_input_context_gate\nself._use_output_context_gate = use_output_context_gate\nself._vocab_as_last_dim = vocab_as_last_dim\nself._normalizer_params = normalizer_params\nself._l2_regularize...
<|body_start_0|> super().__init__(**kwargs) self._vocab_size = vocab_size self._num_mixtures = num_mixtures self._use_input_context_gate = use_input_context_gate self._use_output_context_gate = use_output_context_gate self._vocab_as_last_dim = vocab_as_last_dim se...
A softmax over a mixture of logistic models (with L2 regularization).
MoeModel
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MoeModel: """A softmax over a mixture of logistic models (with L2 regularization).""" def __init__(self, vocab_size: int=3862, num_mixtures: int=2, use_input_context_gate: bool=False, use_output_context_gate: bool=False, normalizer_params: Optional[dict[str, Any]]=None, vocab_as_last_dim: bo...
stack_v2_sparse_classes_36k_train_015609
5,262
permissive
[ { "docstring": "Creates a Mixture of (Logistic) Experts model. The model consists of a per-class softmax distribution over a configurable number of logistic classifiers. One of the classifiers in the mixture is not trained, and always predicts 0. Args: vocab_size: The number of classes in the dataset. num_mixtu...
2
stack_v2_sparse_classes_30k_train_020615
Implement the Python class `MoeModel` described below. Class description: A softmax over a mixture of logistic models (with L2 regularization). Method signatures and docstrings: - def __init__(self, vocab_size: int=3862, num_mixtures: int=2, use_input_context_gate: bool=False, use_output_context_gate: bool=False, nor...
Implement the Python class `MoeModel` described below. Class description: A softmax over a mixture of logistic models (with L2 regularization). Method signatures and docstrings: - def __init__(self, vocab_size: int=3862, num_mixtures: int=2, use_input_context_gate: bool=False, use_output_context_gate: bool=False, nor...
9c78e7f643231c0fc9cc64c991d2b8d5628b9668
<|skeleton|> class MoeModel: """A softmax over a mixture of logistic models (with L2 regularization).""" def __init__(self, vocab_size: int=3862, num_mixtures: int=2, use_input_context_gate: bool=False, use_output_context_gate: bool=False, normalizer_params: Optional[dict[str, Any]]=None, vocab_as_last_dim: bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MoeModel: """A softmax over a mixture of logistic models (with L2 regularization).""" def __init__(self, vocab_size: int=3862, num_mixtures: int=2, use_input_context_gate: bool=False, use_output_context_gate: bool=False, normalizer_params: Optional[dict[str, Any]]=None, vocab_as_last_dim: bool=False, l2_...
the_stack_v2_python_sparse
official/projects/yt8m/modeling/heads/moe.py
tensorflow/models
train
86,763
0d7435c9c3f78fea8212d02288beb662458c31ff
[ "category = get_object_or_404(Category, pk=category_id)\nserializer = CategorySerializer(category)\nreturn Response(serializer.data)", "category = get_object_or_404(Category, pk=category_id)\nserializer = CategorySerializer(category, data=request.data)\nif serializer.is_valid():\n serializer.save()\n return...
<|body_start_0|> category = get_object_or_404(Category, pk=category_id) serializer = CategorySerializer(category) return Response(serializer.data) <|end_body_0|> <|body_start_1|> category = get_object_or_404(Category, pk=category_id) serializer = CategorySerializer(category, dat...
CategoryDetail
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CategoryDetail: def get(self, request, category_id, format=None): """Get category details""" <|body_0|> def put(self, request, category_id, format=None): """Edit category --- serializer: administrator.serializers.CategorySerializer""" <|body_1|> def dele...
stack_v2_sparse_classes_36k_train_015610
30,608
permissive
[ { "docstring": "Get category details", "name": "get", "signature": "def get(self, request, category_id, format=None)" }, { "docstring": "Edit category --- serializer: administrator.serializers.CategorySerializer", "name": "put", "signature": "def put(self, request, category_id, format=No...
3
stack_v2_sparse_classes_30k_train_016953
Implement the Python class `CategoryDetail` described below. Class description: Implement the CategoryDetail class. Method signatures and docstrings: - def get(self, request, category_id, format=None): Get category details - def put(self, request, category_id, format=None): Edit category --- serializer: administrator...
Implement the Python class `CategoryDetail` described below. Class description: Implement the CategoryDetail class. Method signatures and docstrings: - def get(self, request, category_id, format=None): Get category details - def put(self, request, category_id, format=None): Edit category --- serializer: administrator...
73728463badb3bfd4413aa0f7aeb44a9606fdfea
<|skeleton|> class CategoryDetail: def get(self, request, category_id, format=None): """Get category details""" <|body_0|> def put(self, request, category_id, format=None): """Edit category --- serializer: administrator.serializers.CategorySerializer""" <|body_1|> def dele...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CategoryDetail: def get(self, request, category_id, format=None): """Get category details""" category = get_object_or_404(Category, pk=category_id) serializer = CategorySerializer(category) return Response(serializer.data) def put(self, request, category_id, format=None): ...
the_stack_v2_python_sparse
administrator/views.py
belatrix/BackendAllStars
train
5
14aa790df38d91f32b18fde02c3e38fab109e0c9
[ "if operation == 'update' and self.request.authenticated_role != self.context.author:\n self.request.errors.add('url', 'role', 'Can update document only author')\n self.request.errors.status = 403\n raise error_handler(self.request.errors)\nif self.request.validated['tender_status'] not in ['active.qualifi...
<|body_start_0|> if operation == 'update' and self.request.authenticated_role != self.context.author: self.request.errors.add('url', 'role', 'Can update document only author') self.request.errors.status = 403 raise error_handler(self.request.errors) if self.request.va...
TenderUaAwardComplaintDocumentResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TenderUaAwardComplaintDocumentResource: def validate_complaint_document(self, operation): """TODO move validators This class is inherited in limited and openeu (qualification complaint) package, but validate_complaint_document function has different validators. For now, we have no way to...
stack_v2_sparse_classes_36k_train_015611
5,315
permissive
[ { "docstring": "TODO move validators This class is inherited in limited and openeu (qualification complaint) package, but validate_complaint_document function has different validators. For now, we have no way to use different validators on methods according to procedure type.", "name": "validate_complaint_d...
4
stack_v2_sparse_classes_30k_train_017779
Implement the Python class `TenderUaAwardComplaintDocumentResource` described below. Class description: Implement the TenderUaAwardComplaintDocumentResource class. Method signatures and docstrings: - def validate_complaint_document(self, operation): TODO move validators This class is inherited in limited and openeu (...
Implement the Python class `TenderUaAwardComplaintDocumentResource` described below. Class description: Implement the TenderUaAwardComplaintDocumentResource class. Method signatures and docstrings: - def validate_complaint_document(self, operation): TODO move validators This class is inherited in limited and openeu (...
5afdd3a62a8e562cf77e2d963d88f1a26613d16a
<|skeleton|> class TenderUaAwardComplaintDocumentResource: def validate_complaint_document(self, operation): """TODO move validators This class is inherited in limited and openeu (qualification complaint) package, but validate_complaint_document function has different validators. For now, we have no way to...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TenderUaAwardComplaintDocumentResource: def validate_complaint_document(self, operation): """TODO move validators This class is inherited in limited and openeu (qualification complaint) package, but validate_complaint_document function has different validators. For now, we have no way to use different...
the_stack_v2_python_sparse
src/openprocurement/tender/openua/views/award_complaint_document.py
pontostroy/api
train
0
282b489010f78169458d2ff26ea85b45ed529cd9
[ "super(TSKVolume, self).__init__(file_entry.name)\nself._file_entry = file_entry\nself._bytes_per_sector = bytes_per_sector", "tsk_vs_part = self._file_entry.GetTSKVsPart()\ntsk_addr = getattr(tsk_vs_part, 'addr', None)\nif tsk_addr is not None:\n address = volume_system.VolumeAttribute('address', tsk_addr)\n ...
<|body_start_0|> super(TSKVolume, self).__init__(file_entry.name) self._file_entry = file_entry self._bytes_per_sector = bytes_per_sector <|end_body_0|> <|body_start_1|> tsk_vs_part = self._file_entry.GetTSKVsPart() tsk_addr = getattr(tsk_vs_part, 'addr', None) if tsk_ad...
Volume that uses pytsk3.
TSKVolume
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TSKVolume: """Volume that uses pytsk3.""" def __init__(self, file_entry, bytes_per_sector): """Initializes a volume. Args: file_entry (TSKPartitionFileEntry): a TSK partition file entry. bytes_per_sector (int): number of bytes per sector.""" <|body_0|> def _Parse(self): ...
stack_v2_sparse_classes_36k_train_015612
3,054
permissive
[ { "docstring": "Initializes a volume. Args: file_entry (TSKPartitionFileEntry): a TSK partition file entry. bytes_per_sector (int): number of bytes per sector.", "name": "__init__", "signature": "def __init__(self, file_entry, bytes_per_sector)" }, { "docstring": "Extracts attributes and extents...
2
null
Implement the Python class `TSKVolume` described below. Class description: Volume that uses pytsk3. Method signatures and docstrings: - def __init__(self, file_entry, bytes_per_sector): Initializes a volume. Args: file_entry (TSKPartitionFileEntry): a TSK partition file entry. bytes_per_sector (int): number of bytes ...
Implement the Python class `TSKVolume` described below. Class description: Volume that uses pytsk3. Method signatures and docstrings: - def __init__(self, file_entry, bytes_per_sector): Initializes a volume. Args: file_entry (TSKPartitionFileEntry): a TSK partition file entry. bytes_per_sector (int): number of bytes ...
28756d910e951a22c5f0b2bcf5184f055a19d544
<|skeleton|> class TSKVolume: """Volume that uses pytsk3.""" def __init__(self, file_entry, bytes_per_sector): """Initializes a volume. Args: file_entry (TSKPartitionFileEntry): a TSK partition file entry. bytes_per_sector (int): number of bytes per sector.""" <|body_0|> def _Parse(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TSKVolume: """Volume that uses pytsk3.""" def __init__(self, file_entry, bytes_per_sector): """Initializes a volume. Args: file_entry (TSKPartitionFileEntry): a TSK partition file entry. bytes_per_sector (int): number of bytes per sector.""" super(TSKVolume, self).__init__(file_entry.name...
the_stack_v2_python_sparse
dfvfs/volume/tsk_volume_system.py
log2timeline/dfvfs
train
197
119e30c29a9dfa932f3f47b5e3676c8b8152e84c
[ "if not root:\n return []\nqueue = deque()\nqueue.append(root)\nres = []\nx = 0\nwhile queue:\n size = len(queue)\n i = 0\n level = []\n while i < size:\n if x & 1 == 0:\n tmp = queue.popleft()\n if tmp.left:\n queue.append(tmp.left)\n if tmp.rig...
<|body_start_0|> if not root: return [] queue = deque() queue.append(root) res = [] x = 0 while queue: size = len(queue) i = 0 level = [] while i < size: if x & 1 == 0: tmp = q...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def zigzagLevelOrder(self, root: TreeNode) -> List[List[int]]: """直接使用双端队列deque,模拟遍历过程。 :param root: :return:""" <|body_0|> def zigzagLevelOrder2(self, root: TreeNode) -> List[List[int]]: """大佬的思路。 使用一个标记位,标记当前在那一层,True为偶数层,False为奇数层 :param root: :return:""...
stack_v2_sparse_classes_36k_train_015613
2,821
no_license
[ { "docstring": "直接使用双端队列deque,模拟遍历过程。 :param root: :return:", "name": "zigzagLevelOrder", "signature": "def zigzagLevelOrder(self, root: TreeNode) -> List[List[int]]" }, { "docstring": "大佬的思路。 使用一个标记位,标记当前在那一层,True为偶数层,False为奇数层 :param root: :return:", "name": "zigzagLevelOrder2", "signa...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def zigzagLevelOrder(self, root: TreeNode) -> List[List[int]]: 直接使用双端队列deque,模拟遍历过程。 :param root: :return: - def zigzagLevelOrder2(self, root: TreeNode) -> List[List[int]]: 大佬的思路...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def zigzagLevelOrder(self, root: TreeNode) -> List[List[int]]: 直接使用双端队列deque,模拟遍历过程。 :param root: :return: - def zigzagLevelOrder2(self, root: TreeNode) -> List[List[int]]: 大佬的思路...
578cacff5851c5c2522981693c34e3c318002d30
<|skeleton|> class Solution: def zigzagLevelOrder(self, root: TreeNode) -> List[List[int]]: """直接使用双端队列deque,模拟遍历过程。 :param root: :return:""" <|body_0|> def zigzagLevelOrder2(self, root: TreeNode) -> List[List[int]]: """大佬的思路。 使用一个标记位,标记当前在那一层,True为偶数层,False为奇数层 :param root: :return:""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def zigzagLevelOrder(self, root: TreeNode) -> List[List[int]]: """直接使用双端队列deque,模拟遍历过程。 :param root: :return:""" if not root: return [] queue = deque() queue.append(root) res = [] x = 0 while queue: size = len(queue) ...
the_stack_v2_python_sparse
二叉树的锯齿形层序遍历.py
cjrzs/MyLeetCode
train
8
caeaf1d808ac9917645b985392db23e63befdf42
[ "user = User.objects.create_user(username='hede', password='hede')\nurl = reverse('user-reports', args=[user.username])\nself.token_login()\ndata = simplejson.dumps({'text': 'Test'})\nrequest = self.c.post(path=url, content_type='application/json', data=data, **self.client_header)\nself.assertEqual(request.status_c...
<|body_start_0|> user = User.objects.create_user(username='hede', password='hede') url = reverse('user-reports', args=[user.username]) self.token_login() data = simplejson.dumps({'text': 'Test'}) request = self.c.post(path=url, content_type='application/json', data=data, **self.c...
UserReportTestCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserReportTestCase: def test_report_create(self): """Create Report""" <|body_0|> def test_invalid_user_create_report(self): """invalid user Create Report""" <|body_1|> def test_report_list(self): """Report List""" <|body_2|> def test...
stack_v2_sparse_classes_36k_train_015614
10,007
no_license
[ { "docstring": "Create Report", "name": "test_report_create", "signature": "def test_report_create(self)" }, { "docstring": "invalid user Create Report", "name": "test_invalid_user_create_report", "signature": "def test_invalid_user_create_report(self)" }, { "docstring": "Report ...
5
stack_v2_sparse_classes_30k_train_017829
Implement the Python class `UserReportTestCase` described below. Class description: Implement the UserReportTestCase class. Method signatures and docstrings: - def test_report_create(self): Create Report - def test_invalid_user_create_report(self): invalid user Create Report - def test_report_list(self): Report List ...
Implement the Python class `UserReportTestCase` described below. Class description: Implement the UserReportTestCase class. Method signatures and docstrings: - def test_report_create(self): Create Report - def test_invalid_user_create_report(self): invalid user Create Report - def test_report_list(self): Report List ...
b8ba25fdde5d4ee92a3f73cb42ff892ed436d3f2
<|skeleton|> class UserReportTestCase: def test_report_create(self): """Create Report""" <|body_0|> def test_invalid_user_create_report(self): """invalid user Create Report""" <|body_1|> def test_report_list(self): """Report List""" <|body_2|> def test...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserReportTestCase: def test_report_create(self): """Create Report""" user = User.objects.create_user(username='hede', password='hede') url = reverse('user-reports', args=[user.username]) self.token_login() data = simplejson.dumps({'text': 'Test'}) request = sel...
the_stack_v2_python_sparse
chatproject/apps/account/tests.py
QilinGu/chat-project
train
0
c84fb7d2617417eae3ace92bef568570a923d8f0
[ "try:\n business = Business.objects.filter(users__in=[request.user])\nexcept Business.DoesNotExist:\n return Response({'message': _('Negocio no encontrado')}, status=status.HTTP_404_NOT_FOUND)\nif len(business) > 0:\n serializer = self.serializer_class(business[0])\n return Response(serializer.data, sta...
<|body_start_0|> try: business = Business.objects.filter(users__in=[request.user]) except Business.DoesNotExist: return Response({'message': _('Negocio no encontrado')}, status=status.HTTP_404_NOT_FOUND) if len(business) > 0: serializer = self.serializer_class...
View for handle business actions
BusinessView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BusinessView: """View for handle business actions""" def get(self, request, business_pk): """Get the business data using Token authorization :param business_pk: :param request: :return:""" <|body_0|> def put(self, request, business_pk): """Handle the business dat...
stack_v2_sparse_classes_36k_train_015615
5,744
no_license
[ { "docstring": "Get the business data using Token authorization :param business_pk: :param request: :return:", "name": "get", "signature": "def get(self, request, business_pk)" }, { "docstring": "Handle the business data update :param business_pk: :param request: :return:", "name": "put", ...
2
null
Implement the Python class `BusinessView` described below. Class description: View for handle business actions Method signatures and docstrings: - def get(self, request, business_pk): Get the business data using Token authorization :param business_pk: :param request: :return: - def put(self, request, business_pk): Ha...
Implement the Python class `BusinessView` described below. Class description: View for handle business actions Method signatures and docstrings: - def get(self, request, business_pk): Get the business data using Token authorization :param business_pk: :param request: :return: - def put(self, request, business_pk): Ha...
5c6f6443c7aaffbd0414c25f9adcdba72aeb7638
<|skeleton|> class BusinessView: """View for handle business actions""" def get(self, request, business_pk): """Get the business data using Token authorization :param business_pk: :param request: :return:""" <|body_0|> def put(self, request, business_pk): """Handle the business dat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BusinessView: """View for handle business actions""" def get(self, request, business_pk): """Get the business data using Token authorization :param business_pk: :param request: :return:""" try: business = Business.objects.filter(users__in=[request.user]) except Busines...
the_stack_v2_python_sparse
shop/applications/api_v1/views/business.py
RobertoFZ/shop-api
train
0
0c8008f35fa32204097792d63c776296d4cccd6d
[ "self.optimizer = self.OptimCls(agent.parameters(), lr=self.learning_rate, **self.optim_kwargs)\nif self.initial_optim_state_dict is not None:\n self.optimizer.load_state_dict(self.initial_optim_state_dict)\nself.agent = agent\nself.n_itr = n_itr\nself.batch_spec = batch_spec\nself.mid_batch_reset = mid_batch_re...
<|body_start_0|> self.optimizer = self.OptimCls(agent.parameters(), lr=self.learning_rate, **self.optim_kwargs) if self.initial_optim_state_dict is not None: self.optimizer.load_state_dict(self.initial_optim_state_dict) self.agent = agent self.n_itr = n_itr self.batch...
Base policy gradient / actor-critic algorithm, which includes initialization procedure and processing of data samples to compute advantages.
PolicyGradientAlgo
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PolicyGradientAlgo: """Base policy gradient / actor-critic algorithm, which includes initialization procedure and processing of data samples to compute advantages.""" def initialize(self, agent, n_itr, batch_spec, mid_batch_reset=False, examples=None, world_size=1, rank=0): """Build ...
stack_v2_sparse_classes_36k_train_015616
3,139
permissive
[ { "docstring": "Build the torch optimizer and store other input attributes. Params ``batch_spec`` and ``examples`` are unused.", "name": "initialize", "signature": "def initialize(self, agent, n_itr, batch_spec, mid_batch_reset=False, examples=None, world_size=1, rank=0)" }, { "docstring": "Comp...
2
stack_v2_sparse_classes_30k_train_021669
Implement the Python class `PolicyGradientAlgo` described below. Class description: Base policy gradient / actor-critic algorithm, which includes initialization procedure and processing of data samples to compute advantages. Method signatures and docstrings: - def initialize(self, agent, n_itr, batch_spec, mid_batch_...
Implement the Python class `PolicyGradientAlgo` described below. Class description: Base policy gradient / actor-critic algorithm, which includes initialization procedure and processing of data samples to compute advantages. Method signatures and docstrings: - def initialize(self, agent, n_itr, batch_spec, mid_batch_...
98681a23bae9e8e5e9fbf68a0316ca2a22a27593
<|skeleton|> class PolicyGradientAlgo: """Base policy gradient / actor-critic algorithm, which includes initialization procedure and processing of data samples to compute advantages.""" def initialize(self, agent, n_itr, batch_spec, mid_batch_reset=False, examples=None, world_size=1, rank=0): """Build ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PolicyGradientAlgo: """Base policy gradient / actor-critic algorithm, which includes initialization procedure and processing of data samples to compute advantages.""" def initialize(self, agent, n_itr, batch_spec, mid_batch_reset=False, examples=None, world_size=1, rank=0): """Build the torch opt...
the_stack_v2_python_sparse
dependencies/rlpyt/rlpyt/algos/pg/base.py
keirp/glamor
train
5
c581754286e5329a33b15c42b59075d3b5d56812
[ "self.score_components = constants.score_components\nself.score_type = constants.score_type\nself.qsar_models = constants.qsar_models\nself.device = constants.device\nself.max_n_nodes = constants.max_n_nodes\nself.score_thresholds = constants.score_thresholds\nself.n_graphs = None\nassert len(self.score_components)...
<|body_start_0|> self.score_components = constants.score_components self.score_type = constants.score_type self.qsar_models = constants.qsar_models self.device = constants.device self.max_n_nodes = constants.max_n_nodes self.score_thresholds = constants.score_thresholds ...
A class for defining the scoring function components.
ScoringFunction
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScoringFunction: """A class for defining the scoring function components.""" def __init__(self, constants: namedtuple) -> None: """Args: ---- constants (namedtuple) : Contains job parameters as well as global constants.""" <|body_0|> def compute_score(self, graphs: list,...
stack_v2_sparse_classes_36k_train_015617
7,314
permissive
[ { "docstring": "Args: ---- constants (namedtuple) : Contains job parameters as well as global constants.", "name": "__init__", "signature": "def __init__(self, constants: namedtuple) -> None" }, { "docstring": "Computes the overall score for the input molecular graphs. Args: ---- graphs (list) :...
4
stack_v2_sparse_classes_30k_train_018555
Implement the Python class `ScoringFunction` described below. Class description: A class for defining the scoring function components. Method signatures and docstrings: - def __init__(self, constants: namedtuple) -> None: Args: ---- constants (namedtuple) : Contains job parameters as well as global constants. - def c...
Implement the Python class `ScoringFunction` described below. Class description: A class for defining the scoring function components. Method signatures and docstrings: - def __init__(self, constants: namedtuple) -> None: Args: ---- constants (namedtuple) : Contains job parameters as well as global constants. - def c...
bdd69ffd11816f8781be9fc8f807750375f61809
<|skeleton|> class ScoringFunction: """A class for defining the scoring function components.""" def __init__(self, constants: namedtuple) -> None: """Args: ---- constants (namedtuple) : Contains job parameters as well as global constants.""" <|body_0|> def compute_score(self, graphs: list,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ScoringFunction: """A class for defining the scoring function components.""" def __init__(self, constants: namedtuple) -> None: """Args: ---- constants (namedtuple) : Contains job parameters as well as global constants.""" self.score_components = constants.score_components self.sc...
the_stack_v2_python_sparse
graphinvent/ScoringFunction.py
JennyW5/GraphINVENT
train
0
636166ce6e1fa3c54cfe991490a75026a7e87698
[ "self.track_data_list = track_data_list\nnum_examples = [t.num_tracklet_pairs() for t in track_data_list]\ntotal_examples = sum(num_examples)\nself.prob = [float(n) / float(total_examples) for n in num_examples]\nself.queues = [Queue(128) for _ in track_data_list]\nself.procs = [Process(target=_random_example_from_...
<|body_start_0|> self.track_data_list = track_data_list num_examples = [t.num_tracklet_pairs() for t in track_data_list] total_examples = sum(num_examples) self.prob = [float(n) / float(total_examples) for n in num_examples] self.queues = [Queue(128) for _ in track_data_list] ...
TrackletProvider
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TrackletProvider: def __init__(self, track_data_list, batch_size, timesteps): """Loads tracklet pair indices and sets variables for sampling them.""" <|body_0|> def generate(self): """Builds a batch.""" <|body_1|> <|end_skeleton|> <|body_start_0|> s...
stack_v2_sparse_classes_36k_train_015618
3,173
permissive
[ { "docstring": "Loads tracklet pair indices and sets variables for sampling them.", "name": "__init__", "signature": "def __init__(self, track_data_list, batch_size, timesteps)" }, { "docstring": "Builds a batch.", "name": "generate", "signature": "def generate(self)" } ]
2
null
Implement the Python class `TrackletProvider` described below. Class description: Implement the TrackletProvider class. Method signatures and docstrings: - def __init__(self, track_data_list, batch_size, timesteps): Loads tracklet pair indices and sets variables for sampling them. - def generate(self): Builds a batch...
Implement the Python class `TrackletProvider` described below. Class description: Implement the TrackletProvider class. Method signatures and docstrings: - def __init__(self, track_data_list, batch_size, timesteps): Loads tracklet pair indices and sets variables for sampling them. - def generate(self): Builds a batch...
fae655f396380dbe74413812a41b734e267faffe
<|skeleton|> class TrackletProvider: def __init__(self, track_data_list, batch_size, timesteps): """Loads tracklet pair indices and sets variables for sampling them.""" <|body_0|> def generate(self): """Builds a batch.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TrackletProvider: def __init__(self, track_data_list, batch_size, timesteps): """Loads tracklet pair indices and sets variables for sampling them.""" self.track_data_list = track_data_list num_examples = [t.num_tracklet_pairs() for t in track_data_list] total_examples = sum(num...
the_stack_v2_python_sparse
train/siamese/providers/tracklet_provider.py
openem-team/openem
train
11
a60a9d1d7b4bed0bfd34ee413200b467037d3910
[ "self.initial_backoff = initial_backoff\nself.increment_base = increment_base\nself.random_jitter_range = random_jitter_range\nsuper(ExponentialRetry, self).__init__(retry_total=retry_total, retry_to_secondary=retry_to_secondary, **kwargs)", "random_generator = random.Random()\nbackoff = self.initial_backoff + (0...
<|body_start_0|> self.initial_backoff = initial_backoff self.increment_base = increment_base self.random_jitter_range = random_jitter_range super(ExponentialRetry, self).__init__(retry_total=retry_total, retry_to_secondary=retry_to_secondary, **kwargs) <|end_body_0|> <|body_start_1|> ...
Exponential retry.
ExponentialRetry
[ "MIT", "LicenseRef-scancode-generic-cla", "LGPL-2.1-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExponentialRetry: """Exponential retry.""" def __init__(self, initial_backoff=15, increment_base=3, retry_total=3, retry_to_secondary=False, random_jitter_range=3, **kwargs): """Constructs an Exponential retry object. The initial_backoff is used for the first retry. Subsequent retrie...
stack_v2_sparse_classes_36k_train_015619
26,717
permissive
[ { "docstring": "Constructs an Exponential retry object. The initial_backoff is used for the first retry. Subsequent retries are retried after initial_backoff + increment_power^retry_count seconds. For example, by default the first retry occurs after 15 seconds, the second after (15+3^1) = 18 seconds, and the th...
2
stack_v2_sparse_classes_30k_train_000500
Implement the Python class `ExponentialRetry` described below. Class description: Exponential retry. Method signatures and docstrings: - def __init__(self, initial_backoff=15, increment_base=3, retry_total=3, retry_to_secondary=False, random_jitter_range=3, **kwargs): Constructs an Exponential retry object. The initi...
Implement the Python class `ExponentialRetry` described below. Class description: Exponential retry. Method signatures and docstrings: - def __init__(self, initial_backoff=15, increment_base=3, retry_total=3, retry_to_secondary=False, random_jitter_range=3, **kwargs): Constructs an Exponential retry object. The initi...
c2ca191e736bb06bfbbbc9493e8325763ba990bb
<|skeleton|> class ExponentialRetry: """Exponential retry.""" def __init__(self, initial_backoff=15, increment_base=3, retry_total=3, retry_to_secondary=False, random_jitter_range=3, **kwargs): """Constructs an Exponential retry object. The initial_backoff is used for the first retry. Subsequent retrie...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExponentialRetry: """Exponential retry.""" def __init__(self, initial_backoff=15, increment_base=3, retry_total=3, retry_to_secondary=False, random_jitter_range=3, **kwargs): """Constructs an Exponential retry object. The initial_backoff is used for the first retry. Subsequent retries are retried...
the_stack_v2_python_sparse
sdk/eventhub/azure-eventhub-checkpointstoreblob-aio/azure/eventhub/extensions/checkpointstoreblobaio/_vendor/storage/blob/_shared/policies.py
Azure/azure-sdk-for-python
train
4,046
f413c10154c22b1bf608fa618d1ca85f7482bb58
[ "self.randomSampling = []\nself.dataRange = dataRange\nself.tot = tot\nself.len = len", "try:\n isLegalNumList(self.dataRange)\nexcept Exception as err:\n print('An exception happened: ' + str(err))\n sys.exit()\nself.randomSampling = []\nwhile len(self.randomSampling) != self.tot:\n it = iter(self.da...
<|body_start_0|> self.randomSampling = [] self.dataRange = dataRange self.tot = tot self.len = len <|end_body_0|> <|body_start_1|> try: isLegalNumList(self.dataRange) except Exception as err: print('An exception happened: ' + str(err)) ...
elementSamplingFactory
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class elementSamplingFactory: def __init__(self, dataRange, tot, len=6): """:param dataRange:数据范围 :param tot: 数据量 :param len: 若生成字符串,字符串长度""" <|body_0|> def randomIntSampling(self): """:return: 生成数据""" <|body_1|> def randomFloatSampling(self): """:retu...
stack_v2_sparse_classes_36k_train_015620
2,834
no_license
[ { "docstring": ":param dataRange:数据范围 :param tot: 数据量 :param len: 若生成字符串,字符串长度", "name": "__init__", "signature": "def __init__(self, dataRange, tot, len=6)" }, { "docstring": ":return: 生成数据", "name": "randomIntSampling", "signature": "def randomIntSampling(self)" }, { "docstring...
4
stack_v2_sparse_classes_30k_train_008326
Implement the Python class `elementSamplingFactory` described below. Class description: Implement the elementSamplingFactory class. Method signatures and docstrings: - def __init__(self, dataRange, tot, len=6): :param dataRange:数据范围 :param tot: 数据量 :param len: 若生成字符串,字符串长度 - def randomIntSampling(self): :return: 生成数据...
Implement the Python class `elementSamplingFactory` described below. Class description: Implement the elementSamplingFactory class. Method signatures and docstrings: - def __init__(self, dataRange, tot, len=6): :param dataRange:数据范围 :param tot: 数据量 :param len: 若生成字符串,字符串长度 - def randomIntSampling(self): :return: 生成数据...
661dba7ea846859056fd6ee7a310d352ca178e98
<|skeleton|> class elementSamplingFactory: def __init__(self, dataRange, tot, len=6): """:param dataRange:数据范围 :param tot: 数据量 :param len: 若生成字符串,字符串长度""" <|body_0|> def randomIntSampling(self): """:return: 生成数据""" <|body_1|> def randomFloatSampling(self): """:retu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class elementSamplingFactory: def __init__(self, dataRange, tot, len=6): """:param dataRange:数据范围 :param tot: 数据量 :param len: 若生成字符串,字符串长度""" self.randomSampling = [] self.dataRange = dataRange self.tot = tot self.len = len def randomIntSampling(self): """:return...
the_stack_v2_python_sparse
林一夫2017012923/平时作业1/Factory.py
wanghan79/2020_Python
train
4
bdbb3e95204c2bd3f5ca28ae7fb38a2111782372
[ "self.pers = persistence\nself.logger = logging.getLogger('app')\nself.cfg = cfg", "try:\n self.logger.debug('Password Reset attempt %s', user_id)\n password_reset_token = ''\n nosqldb = self.pers.nosql_db\n db_user_record = nosqldb['users'].find_one({'$or': [{'username': user_id}, {'email': user_id}]...
<|body_start_0|> self.pers = persistence self.logger = logging.getLogger('app') self.cfg = cfg <|end_body_0|> <|body_start_1|> try: self.logger.debug('Password Reset attempt %s', user_id) password_reset_token = '' nosqldb = self.pers.nosql_db ...
Web user authentication database helper
PasswordResetDBHelper
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PasswordResetDBHelper: """Web user authentication database helper""" def __init__(self, persistence, cfg): """Class initialization""" <|body_0|> def create_password_reset_token(self, user_id): """Initiate a password reset with a complex token, multi step""" ...
stack_v2_sparse_classes_36k_train_015621
4,820
no_license
[ { "docstring": "Class initialization", "name": "__init__", "signature": "def __init__(self, persistence, cfg)" }, { "docstring": "Initiate a password reset with a complex token, multi step", "name": "create_password_reset_token", "signature": "def create_password_reset_token(self, user_i...
4
stack_v2_sparse_classes_30k_train_017612
Implement the Python class `PasswordResetDBHelper` described below. Class description: Web user authentication database helper Method signatures and docstrings: - def __init__(self, persistence, cfg): Class initialization - def create_password_reset_token(self, user_id): Initiate a password reset with a complex token...
Implement the Python class `PasswordResetDBHelper` described below. Class description: Web user authentication database helper Method signatures and docstrings: - def __init__(self, persistence, cfg): Class initialization - def create_password_reset_token(self, user_id): Initiate a password reset with a complex token...
3c774731b054c38a273371450a451c951d73b726
<|skeleton|> class PasswordResetDBHelper: """Web user authentication database helper""" def __init__(self, persistence, cfg): """Class initialization""" <|body_0|> def create_password_reset_token(self, user_id): """Initiate a password reset with a complex token, multi step""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PasswordResetDBHelper: """Web user authentication database helper""" def __init__(self, persistence, cfg): """Class initialization""" self.pers = persistence self.logger = logging.getLogger('app') self.cfg = cfg def create_password_reset_token(self, user_id): ...
the_stack_v2_python_sparse
genesis/passwordresetdbhelper.py
wbmartin/exodus-app
train
0
9355c3cf48d3f7f9873a805d4c1be3cc53f9ad92
[ "super(CustomerJourney, self).__init__(*args, **kwargs)\nself.endpoint = 'customer-journeys'\nself.journey_id = None\nself.step_id = None", "self.journey_id = journey_id\nself.step_id = step_id\nif 'email_address' not in data:\n raise KeyError('The automation email queue must have an email_address')\ncheck_ema...
<|body_start_0|> super(CustomerJourney, self).__init__(*args, **kwargs) self.endpoint = 'customer-journeys' self.journey_id = None self.step_id = None <|end_body_0|> <|body_start_1|> self.journey_id = journey_id self.step_id = step_id if 'email_address' not in da...
Manage specific customer journeys in your Mailchimp account.
CustomerJourney
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomerJourney: """Manage specific customer journeys in your Mailchimp account.""" def __init__(self, *args, **kwargs): """Initialize the endpoint""" <|body_0|> def trigger(self, journey_id, step_id, data): """Trigger a step in a customer journey. :param journey...
stack_v2_sparse_classes_36k_train_015622
1,605
permissive
[ { "docstring": "Initialize the endpoint", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Trigger a step in a customer journey. :param journey_id: The unique id for the Customer Journey :type journey_id: :py:class:`str` :param step_id: The unique id for ...
2
stack_v2_sparse_classes_30k_train_021465
Implement the Python class `CustomerJourney` described below. Class description: Manage specific customer journeys in your Mailchimp account. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Initialize the endpoint - def trigger(self, journey_id, step_id, data): Trigger a step in a customer jo...
Implement the Python class `CustomerJourney` described below. Class description: Manage specific customer journeys in your Mailchimp account. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Initialize the endpoint - def trigger(self, journey_id, step_id, data): Trigger a step in a customer jo...
bf61cd602dc44cbff32fbf6f6dcdd33cf6f782e8
<|skeleton|> class CustomerJourney: """Manage specific customer journeys in your Mailchimp account.""" def __init__(self, *args, **kwargs): """Initialize the endpoint""" <|body_0|> def trigger(self, journey_id, step_id, data): """Trigger a step in a customer journey. :param journey...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CustomerJourney: """Manage specific customer journeys in your Mailchimp account.""" def __init__(self, *args, **kwargs): """Initialize the endpoint""" super(CustomerJourney, self).__init__(*args, **kwargs) self.endpoint = 'customer-journeys' self.journey_id = None ...
the_stack_v2_python_sparse
mailchimp3/entities/customerjourney.py
VingtCinq/python-mailchimp
train
190
5ccd97a8343aaecf0788b2cbf98b097521d70ab4
[ "machine = machine_key.get()\nif not machine:\n raise endpoints.NotFoundException('CatalogMachineEntry not found')\nif not machine.instruction or machine.instruction.state == new_state:\n return\ntransition = (machine.instruction.state, new_state)\nif transition not in MachineEndpoints.ALLOWED_TRANSITIONS:\n ...
<|body_start_0|> machine = machine_key.get() if not machine: raise endpoints.NotFoundException('CatalogMachineEntry not found') if not machine.instruction or machine.instruction.state == new_state: return transition = (machine.instruction.state, new_state) ...
Implements cloud endpoints for Machine Provider's machines.
MachineEndpoints
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MachineEndpoints: """Implements cloud endpoints for Machine Provider's machines.""" def _update_instruction_state(machine_key, new_state): """Updates the state of the instruction for the given machine. The only updates allowed are: PENDING -> RECEIVED PENDING -> EXECUTED RECEIVED -> ...
stack_v2_sparse_classes_36k_train_015623
28,917
permissive
[ { "docstring": "Updates the state of the instruction for the given machine. The only updates allowed are: PENDING -> RECEIVED PENDING -> EXECUTED RECEIVED -> EXECUTED Args: machine_key: ndb.Key for a models.CatalogMachineEntry. new_state: One of models.InstructionStates, but not models.InstructionStates.PENDING...
3
stack_v2_sparse_classes_30k_train_004747
Implement the Python class `MachineEndpoints` described below. Class description: Implements cloud endpoints for Machine Provider's machines. Method signatures and docstrings: - def _update_instruction_state(machine_key, new_state): Updates the state of the instruction for the given machine. The only updates allowed ...
Implement the Python class `MachineEndpoints` described below. Class description: Implements cloud endpoints for Machine Provider's machines. Method signatures and docstrings: - def _update_instruction_state(machine_key, new_state): Updates the state of the instruction for the given machine. The only updates allowed ...
0a4fdfc25f89833026be6a8b29c0a27b8f3c5fc4
<|skeleton|> class MachineEndpoints: """Implements cloud endpoints for Machine Provider's machines.""" def _update_instruction_state(machine_key, new_state): """Updates the state of the instruction for the given machine. The only updates allowed are: PENDING -> RECEIVED PENDING -> EXECUTED RECEIVED -> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MachineEndpoints: """Implements cloud endpoints for Machine Provider's machines.""" def _update_instruction_state(machine_key, new_state): """Updates the state of the instruction for the given machine. The only updates allowed are: PENDING -> RECEIVED PENDING -> EXECUTED RECEIVED -> EXECUTED Args...
the_stack_v2_python_sparse
appengine/machine_provider/handlers_endpoints.py
Swift1313/luci-py
train
0
262e98326b7bed5d47ec3c5be15027ce3840b834
[ "Node.__init__(self, name)\nself.args = []\n'\\n The arguments of the executable.\\n\\n :type: list[str]\\n '\nself.path = ''\n'\\n The path of the executable that must be run by this job.\\n\\n :type: str\\n '", "command_job = SubElement(parent, 'CommandJob')\nself._gene...
<|body_start_0|> Node.__init__(self, name) self.args = [] '\n The arguments of the executable.\n\n :type: list[str]\n ' self.path = '' '\n The path of the executable that must be run by this job.\n\n :type: str\n ' <|end_body_0|> <|body_...
Class for generating XML messages for elements of type 'CommandJobType'.
CommandJobNode
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommandJobNode: """Class for generating XML messages for elements of type 'CommandJobType'.""" def __init__(self, name): """Object constructor. :param str name: The name of the node.""" <|body_0|> def generate_xml(self, parent): """Generates the XML element for t...
stack_v2_sparse_classes_36k_train_015624
2,354
permissive
[ { "docstring": "Object constructor. :param str name: The name of the node.", "name": "__init__", "signature": "def __init__(self, name)" }, { "docstring": "Generates the XML element for this node. :param xml.etree.ElementTree.Element parent: The parent XML element.", "name": "generate_xml", ...
3
stack_v2_sparse_classes_30k_train_018088
Implement the Python class `CommandJobNode` described below. Class description: Class for generating XML messages for elements of type 'CommandJobType'. Method signatures and docstrings: - def __init__(self, name): Object constructor. :param str name: The name of the node. - def generate_xml(self, parent): Generates ...
Implement the Python class `CommandJobNode` described below. Class description: Class for generating XML messages for elements of type 'CommandJobType'. Method signatures and docstrings: - def __init__(self, name): Object constructor. :param str name: The name of the node. - def generate_xml(self, parent): Generates ...
eafd332e383f5f97dce4e35f6cff5a9a48dd3141
<|skeleton|> class CommandJobNode: """Class for generating XML messages for elements of type 'CommandJobType'.""" def __init__(self, name): """Object constructor. :param str name: The name of the node.""" <|body_0|> def generate_xml(self, parent): """Generates the XML element for t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CommandJobNode: """Class for generating XML messages for elements of type 'CommandJobType'.""" def __init__(self, name): """Object constructor. :param str name: The name of the node.""" Node.__init__(self, name) self.args = [] '\n The arguments of the executable.\n\...
the_stack_v2_python_sparse
enarksh_lib/xml_generator/node/CommandJobNode.py
SetBased/py-enarksh-lib
train
2
f6ecc30932191511adb31a71cfe95a6ff0bf2ec1
[ "group_totals = dict()\nfor ocg in OffCycleCredits._offcycle_credit_groups:\n group_totals[ocg] = 0\ncost_cloud['cert_direct_offcycle_co2e_grams_per_mile'] = 0\ncost_cloud['cert_direct_offcycle_kwh_per_mile'] = 0\ncost_cloud['cert_indirect_offcycle_co2e_grams_per_mile'] = 0\nfor credit_column in OffCycleCredits....
<|body_start_0|> group_totals = dict() for ocg in OffCycleCredits._offcycle_credit_groups: group_totals[ocg] = 0 cost_cloud['cert_direct_offcycle_co2e_grams_per_mile'] = 0 cost_cloud['cert_direct_offcycle_kwh_per_mile'] = 0 cost_cloud['cert_indirect_offcycle_co2e_gram...
**Loads, stores and applies off-cycle credits to vehicle cost clouds**
OffCycleCredits
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OffCycleCredits: """**Loads, stores and applies off-cycle credits to vehicle cost clouds**""" def calc_off_cycle_credits(calendar_year, vehicle, cost_cloud): """Calculate vehicle off-cycle credits for the vehicle's cost cloud Args: calendar_year (int): the year to calculate credits f...
stack_v2_sparse_classes_36k_train_015625
11,371
no_license
[ { "docstring": "Calculate vehicle off-cycle credits for the vehicle's cost cloud Args: calendar_year (int): the year to calculate credits for, usually the vehicle model year vehicle (Vehicle): the vehicle to apply off-cycle credits to cost_cloud (DataFrame): destination data set for off-cycle credits Returns: c...
2
stack_v2_sparse_classes_30k_train_010255
Implement the Python class `OffCycleCredits` described below. Class description: **Loads, stores and applies off-cycle credits to vehicle cost clouds** Method signatures and docstrings: - def calc_off_cycle_credits(calendar_year, vehicle, cost_cloud): Calculate vehicle off-cycle credits for the vehicle's cost cloud A...
Implement the Python class `OffCycleCredits` described below. Class description: **Loads, stores and applies off-cycle credits to vehicle cost clouds** Method signatures and docstrings: - def calc_off_cycle_credits(calendar_year, vehicle, cost_cloud): Calculate vehicle off-cycle credits for the vehicle's cost cloud A...
afe912c57383b9de90ef30820f7977c3367a30c4
<|skeleton|> class OffCycleCredits: """**Loads, stores and applies off-cycle credits to vehicle cost clouds**""" def calc_off_cycle_credits(calendar_year, vehicle, cost_cloud): """Calculate vehicle off-cycle credits for the vehicle's cost cloud Args: calendar_year (int): the year to calculate credits f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OffCycleCredits: """**Loads, stores and applies off-cycle credits to vehicle cost clouds**""" def calc_off_cycle_credits(calendar_year, vehicle, cost_cloud): """Calculate vehicle off-cycle credits for the vehicle's cost cloud Args: calendar_year (int): the year to calculate credits for, usually t...
the_stack_v2_python_sparse
omega_model/policy/offcycle_credits.py
USEPA/EPA_OMEGA_Model
train
17
e0c9f7d012343611c3c322118427951536e8a57a
[ "super().__init__(model=pref_model)\nself.add_module('outcome_model', outcome_model)\nself.num_samples = num_samples\nself.std_noise = std_noise\nself.std_normal = Normal(0, 1)", "Y = X if self.outcome_model is None else self.outcome_model(X)\npref_posterior = self.model.posterior(Y)\npref_mean = pref_posterior.m...
<|body_start_0|> super().__init__(model=pref_model) self.add_module('outcome_model', outcome_model) self.num_samples = num_samples self.std_noise = std_noise self.std_normal = Normal(0, 1) <|end_body_0|> <|body_start_1|> Y = X if self.outcome_model is None else self.outc...
MC Bayesian Active Learning by Disagreement
PairwiseBayesianActiveLearningByDisagreement
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PairwiseBayesianActiveLearningByDisagreement: """MC Bayesian Active Learning by Disagreement""" def __init__(self, pref_model: Model, outcome_model: Optional[DeterministicModel]=None, num_samples: Optional[int]=1024, std_noise: Optional[float]=0.0, **kwargs: Any) -> None: """Monte Ca...
stack_v2_sparse_classes_36k_train_015626
7,676
permissive
[ { "docstring": "Monte Carlo implementation of Bayesian Active Learning by Disagreement (BALD) proposed in [Houlsby2011bald]_. Args: pref_model: The preference model that maps the outcomes (i.e., Y) to scalar-valued utility. outcome_model: A deterministic model that maps parameters (i.e., X) to outcomes (i.e., Y...
2
null
Implement the Python class `PairwiseBayesianActiveLearningByDisagreement` described below. Class description: MC Bayesian Active Learning by Disagreement Method signatures and docstrings: - def __init__(self, pref_model: Model, outcome_model: Optional[DeterministicModel]=None, num_samples: Optional[int]=1024, std_noi...
Implement the Python class `PairwiseBayesianActiveLearningByDisagreement` described below. Class description: MC Bayesian Active Learning by Disagreement Method signatures and docstrings: - def __init__(self, pref_model: Model, outcome_model: Optional[DeterministicModel]=None, num_samples: Optional[int]=1024, std_noi...
4cc5ed59b2e8a9c780f786830c548e05cc74d53c
<|skeleton|> class PairwiseBayesianActiveLearningByDisagreement: """MC Bayesian Active Learning by Disagreement""" def __init__(self, pref_model: Model, outcome_model: Optional[DeterministicModel]=None, num_samples: Optional[int]=1024, std_noise: Optional[float]=0.0, **kwargs: Any) -> None: """Monte Ca...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PairwiseBayesianActiveLearningByDisagreement: """MC Bayesian Active Learning by Disagreement""" def __init__(self, pref_model: Model, outcome_model: Optional[DeterministicModel]=None, num_samples: Optional[int]=1024, std_noise: Optional[float]=0.0, **kwargs: Any) -> None: """Monte Carlo implement...
the_stack_v2_python_sparse
botorch/acquisition/preference.py
pytorch/botorch
train
2,891
692f9333ad687865b45f0b70cad823afe9bc7f69
[ "with self.Session() as session:\n stmt = sa.select(Obj).where(Obj.healpix.is_(None))\n count_stmt = sa.select(func.count()).select_from(stmt.distinct())\n total_missing = session.execute(count_stmt).scalar()\n stmt = sa.select(Obj).where(Obj.healpix.isnot(None))\n count_stmt = sa.select(func.count()...
<|body_start_0|> with self.Session() as session: stmt = sa.select(Obj).where(Obj.healpix.is_(None)) count_stmt = sa.select(func.count()).select_from(stmt.distinct()) total_missing = session.execute(count_stmt).scalar() stmt = sa.select(Obj).where(Obj.healpix.isnot...
HealpixUpdateHandler
[ "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HealpixUpdateHandler: def get(self): """--- description: find the number of sources with and without a Healpix value tags: - source responses: 200: content: application/json: schema: allOf: - $ref: '#/components/schemas/Success' - type: object properties: data: type: object properties: t...
stack_v2_sparse_classes_36k_train_015627
4,688
permissive
[ { "docstring": "--- description: find the number of sources with and without a Healpix value tags: - source responses: 200: content: application/json: schema: allOf: - $ref: '#/components/schemas/Success' - type: object properties: data: type: object properties: totalWithoutHealpix: type: integer totalWithHealp...
2
null
Implement the Python class `HealpixUpdateHandler` described below. Class description: Implement the HealpixUpdateHandler class. Method signatures and docstrings: - def get(self): --- description: find the number of sources with and without a Healpix value tags: - source responses: 200: content: application/json: sche...
Implement the Python class `HealpixUpdateHandler` described below. Class description: Implement the HealpixUpdateHandler class. Method signatures and docstrings: - def get(self): --- description: find the number of sources with and without a Healpix value tags: - source responses: 200: content: application/json: sche...
161d3532ba3ba059446addcdac58ca96f39e9636
<|skeleton|> class HealpixUpdateHandler: def get(self): """--- description: find the number of sources with and without a Healpix value tags: - source responses: 200: content: application/json: schema: allOf: - $ref: '#/components/schemas/Success' - type: object properties: data: type: object properties: t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HealpixUpdateHandler: def get(self): """--- description: find the number of sources with and without a Healpix value tags: - source responses: 200: content: application/json: schema: allOf: - $ref: '#/components/schemas/Success' - type: object properties: data: type: object properties: totalWithoutHea...
the_stack_v2_python_sparse
skyportal/handlers/api/healpix.py
skyportal/skyportal
train
80
e48422203f5bef271bc67c84d63a9ba56b00ef1c
[ "steps = self.filter(sequence=sequence_id, number__gte=step_number).order_by('number')\nfor i in steps:\n i.number = i.number + 1\n i.save()\nnew_step = self.create(sequence=sequence_id, number=step_number)\nreturn new_step", "delete_step = self.filter(sequence=sequence_id, number=step_number).order_by('num...
<|body_start_0|> steps = self.filter(sequence=sequence_id, number__gte=step_number).order_by('number') for i in steps: i.number = i.number + 1 i.save() new_step = self.create(sequence=sequence_id, number=step_number) return new_step <|end_body_0|> <|body_start_1|...
StepManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StepManager: def insert(self, sequence_id, step_number): """Inserts a new step into a sequence at the given step number""" <|body_0|> def remove(self, sequence_id, step_number): """Removes a step at the current step number and moves the steps beyond the step number u...
stack_v2_sparse_classes_36k_train_015628
1,849
no_license
[ { "docstring": "Inserts a new step into a sequence at the given step number", "name": "insert", "signature": "def insert(self, sequence_id, step_number)" }, { "docstring": "Removes a step at the current step number and moves the steps beyond the step number up in the order", "name": "remove"...
2
stack_v2_sparse_classes_30k_val_000559
Implement the Python class `StepManager` described below. Class description: Implement the StepManager class. Method signatures and docstrings: - def insert(self, sequence_id, step_number): Inserts a new step into a sequence at the given step number - def remove(self, sequence_id, step_number): Removes a step at the ...
Implement the Python class `StepManager` described below. Class description: Implement the StepManager class. Method signatures and docstrings: - def insert(self, sequence_id, step_number): Inserts a new step into a sequence at the given step number - def remove(self, sequence_id, step_number): Removes a step at the ...
31f6e4181b964c1ee7bbe3754b5004b34f91bca3
<|skeleton|> class StepManager: def insert(self, sequence_id, step_number): """Inserts a new step into a sequence at the given step number""" <|body_0|> def remove(self, sequence_id, step_number): """Removes a step at the current step number and moves the steps beyond the step number u...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StepManager: def insert(self, sequence_id, step_number): """Inserts a new step into a sequence at the given step number""" steps = self.filter(sequence=sequence_id, number__gte=step_number).order_by('number') for i in steps: i.number = i.number + 1 i.save() ...
the_stack_v2_python_sparse
pinchart/managers.py
nunchuckBoP/systemmodel
train
0
b472bfead96051b3cba4d3d18f9122570dac3305
[ "self._table = {}\nfor p in breadth_first_traversal(self._tree):\n self._table[p.index()] = [p]\n l = 0\n while l < self._tree.depth(p):\n u = self._table[p.index()][l]\n w = self._tree.parent(u)\n self._table[p.index()].append(w)\n l += 1", "if isinstance(p, int):\n if k >...
<|body_start_0|> self._table = {} for p in breadth_first_traversal(self._tree): self._table[p.index()] = [p] l = 0 while l < self._tree.depth(p): u = self._table[p.index()][l] w = self._tree.parent(u) self._table[p.index...
Concrete class implementing table indexing strategy. Every possible query (p, k) is precomputed and the result is stored in a table. The size of the table is n^2. Computation of the level ancestor is performed using bottom-up dynamic programming in O(n^2) time. Querying is performed by a simple table look-up in O(1) ti...
LA_table
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LA_table: """Concrete class implementing table indexing strategy. Every possible query (p, k) is precomputed and the result is stored in a table. The size of the table is n^2. Computation of the level ancestor is performed using bottom-up dynamic programming in O(n^2) time. Querying is performed ...
stack_v2_sparse_classes_36k_train_015629
15,776
no_license
[ { "docstring": "Precompute all n^2 possible queries and store them in a table.", "name": "_preprocess", "signature": "def _preprocess(self)" }, { "docstring": "Perform simple table look-up.", "name": "_query", "signature": "def _query(self, p, k)" } ]
2
stack_v2_sparse_classes_30k_train_011975
Implement the Python class `LA_table` described below. Class description: Concrete class implementing table indexing strategy. Every possible query (p, k) is precomputed and the result is stored in a table. The size of the table is n^2. Computation of the level ancestor is performed using bottom-up dynamic programming...
Implement the Python class `LA_table` described below. Class description: Concrete class implementing table indexing strategy. Every possible query (p, k) is precomputed and the result is stored in a table. The size of the table is n^2. Computation of the level ancestor is performed using bottom-up dynamic programming...
341bdc7d144d18b49917453006461d670109e706
<|skeleton|> class LA_table: """Concrete class implementing table indexing strategy. Every possible query (p, k) is precomputed and the result is stored in a table. The size of the table is n^2. Computation of the level ancestor is performed using bottom-up dynamic programming in O(n^2) time. Querying is performed ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LA_table: """Concrete class implementing table indexing strategy. Every possible query (p, k) is precomputed and the result is stored in a table. The size of the table is n^2. Computation of the level ancestor is performed using bottom-up dynamic programming in O(n^2) time. Querying is performed by a simple t...
the_stack_v2_python_sparse
Level_Ancestor/la.py
pi-tau/fun-with-algorithms
train
0
d00355c451edba35b9798290b43d08f1cd5944e3
[ "self._metadata_file = preproc_dir / 'metadata.yml'\nprev_metadata_file = prev_preproc_dir / 'metadata.yml'\nwith prev_metadata_file.open('rb') as file:\n prev_metadata = yaml.safe_load(file)\nproducts = set()\nfor prov_filename, attributes in prev_metadata.items():\n filename = str(prev_preproc_dir / Path(pr...
<|body_start_0|> self._metadata_file = preproc_dir / 'metadata.yml' prev_metadata_file = prev_preproc_dir / 'metadata.yml' with prev_metadata_file.open('rb') as file: prev_metadata = yaml.safe_load(file) products = set() for prov_filename, attributes in prev_metadata....
Task for re-using preprocessor output files from a previous run.
ResumeTask
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResumeTask: """Task for re-using preprocessor output files from a previous run.""" def __init__(self, prev_preproc_dir, preproc_dir, name): """Create a resume task.""" <|body_0|> def _run(self, _): """Return the result of a previous run.""" <|body_1|> <|...
stack_v2_sparse_classes_36k_train_015630
29,602
permissive
[ { "docstring": "Create a resume task.", "name": "__init__", "signature": "def __init__(self, prev_preproc_dir, preproc_dir, name)" }, { "docstring": "Return the result of a previous run.", "name": "_run", "signature": "def _run(self, _)" } ]
2
null
Implement the Python class `ResumeTask` described below. Class description: Task for re-using preprocessor output files from a previous run. Method signatures and docstrings: - def __init__(self, prev_preproc_dir, preproc_dir, name): Create a resume task. - def _run(self, _): Return the result of a previous run.
Implement the Python class `ResumeTask` described below. Class description: Task for re-using preprocessor output files from a previous run. Method signatures and docstrings: - def __init__(self, prev_preproc_dir, preproc_dir, name): Create a resume task. - def _run(self, _): Return the result of a previous run. <|s...
d5187438fea2928644cb53ecb26c6adb1e4cc947
<|skeleton|> class ResumeTask: """Task for re-using preprocessor output files from a previous run.""" def __init__(self, prev_preproc_dir, preproc_dir, name): """Create a resume task.""" <|body_0|> def _run(self, _): """Return the result of a previous run.""" <|body_1|> <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResumeTask: """Task for re-using preprocessor output files from a previous run.""" def __init__(self, prev_preproc_dir, preproc_dir, name): """Create a resume task.""" self._metadata_file = preproc_dir / 'metadata.yml' prev_metadata_file = prev_preproc_dir / 'metadata.yml' ...
the_stack_v2_python_sparse
esmvalcore/_task.py
ESMValGroup/ESMValCore
train
41
3b05b105b8f442f3e07ed76b144ee24fb0d6ce5a
[ "res = super(DebugPanelMiddleware, self).process_request(request)\ntry:\n res = resolve(request.path, urlconf=debug_panel.urls)\nexcept Resolver404:\n return res\nreturn res.func(request, *res.args, **res.kwargs)", "toolbar = self.__class__.debug_toolbars.get(threading.current_thread().ident, None)\nrespons...
<|body_start_0|> res = super(DebugPanelMiddleware, self).process_request(request) try: res = resolve(request.path, urlconf=debug_panel.urls) except Resolver404: return res return res.func(request, *res.args, **res.kwargs) <|end_body_0|> <|body_start_1|> t...
Middleware to set up Debug Panel on incoming request and render toolbar on outgoing response.
DebugPanelMiddleware
[ "Apache-2.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DebugPanelMiddleware: """Middleware to set up Debug Panel on incoming request and render toolbar on outgoing response.""" def process_request(self, request): """Try to match the request with an URL from debug_panel application. If it matches, that means we are serving a view from deb...
stack_v2_sparse_classes_36k_train_015631
2,457
permissive
[ { "docstring": "Try to match the request with an URL from debug_panel application. If it matches, that means we are serving a view from debug_panel, and we can skip the debug_toolbar middleware. Otherwise we fallback to the default debug_toolbar middleware.", "name": "process_request", "signature": "def...
2
null
Implement the Python class `DebugPanelMiddleware` described below. Class description: Middleware to set up Debug Panel on incoming request and render toolbar on outgoing response. Method signatures and docstrings: - def process_request(self, request): Try to match the request with an URL from debug_panel application....
Implement the Python class `DebugPanelMiddleware` described below. Class description: Middleware to set up Debug Panel on incoming request and render toolbar on outgoing response. Method signatures and docstrings: - def process_request(self, request): Try to match the request with an URL from debug_panel application....
4082346ef8d5e6a8365b05752be41186840dc868
<|skeleton|> class DebugPanelMiddleware: """Middleware to set up Debug Panel on incoming request and render toolbar on outgoing response.""" def process_request(self, request): """Try to match the request with an URL from debug_panel application. If it matches, that means we are serving a view from deb...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DebugPanelMiddleware: """Middleware to set up Debug Panel on incoming request and render toolbar on outgoing response.""" def process_request(self, request): """Try to match the request with an URL from debug_panel application. If it matches, that means we are serving a view from debug_panel, and...
the_stack_v2_python_sparse
desktop/core/ext-py/django-debug-panel-0.8.3/debug_panel/middleware.py
oyorooms/hue
train
4
c9c20bac00aaa7aded58be2194a496c1dbe97725
[ "k = k % len(nums)\nfor i in range(k):\n last = nums[-1]\n for j in range(len(nums) - 1, 0, -1):\n nums[j] = nums[j - 1]\n nums[0] = last", "k = k % len(nums)\n\ndef reverse(nums, left, right):\n while left < right:\n nums[left], nums[right] = (nums[right], nums[left])\n left += 1...
<|body_start_0|> k = k % len(nums) for i in range(k): last = nums[-1] for j in range(len(nums) - 1, 0, -1): nums[j] = nums[j - 1] nums[0] = last <|end_body_0|> <|body_start_1|> k = k % len(nums) def reverse(nums, left, right): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rotate_1(self, nums: List[int], k: int) -> None: """Do not return anything, modify nums in-place instead.""" <|body_0|> def rotate_2(self, nums: List[int], k: int) -> None: """Do not return anything, modify nums in-place instead.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_015632
1,025
no_license
[ { "docstring": "Do not return anything, modify nums in-place instead.", "name": "rotate_1", "signature": "def rotate_1(self, nums: List[int], k: int) -> None" }, { "docstring": "Do not return anything, modify nums in-place instead.", "name": "rotate_2", "signature": "def rotate_2(self, n...
2
stack_v2_sparse_classes_30k_train_001368
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate_1(self, nums: List[int], k: int) -> None: Do not return anything, modify nums in-place instead. - def rotate_2(self, nums: List[int], k: int) -> None: Do not return an...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate_1(self, nums: List[int], k: int) -> None: Do not return anything, modify nums in-place instead. - def rotate_2(self, nums: List[int], k: int) -> None: Do not return an...
d3b6883bb8b5cef30369b606d6b3ea3029b798c7
<|skeleton|> class Solution: def rotate_1(self, nums: List[int], k: int) -> None: """Do not return anything, modify nums in-place instead.""" <|body_0|> def rotate_2(self, nums: List[int], k: int) -> None: """Do not return anything, modify nums in-place instead.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rotate_1(self, nums: List[int], k: int) -> None: """Do not return anything, modify nums in-place instead.""" k = k % len(nums) for i in range(k): last = nums[-1] for j in range(len(nums) - 1, 0, -1): nums[j] = nums[j - 1] ...
the_stack_v2_python_sparse
Week_01/189_rotate_array.py
slsefe/-algorithm015
train
0
4ef3ebb061767faf9fa84d80e6a3139e68532ea6
[ "if request.method in permissions.SAFE_METHODS:\n return True\nreturn request.user.is_authenticated", "if request.method in permissions.SAFE_METHODS:\n return True\nreturn obj.user == request.user" ]
<|body_start_0|> if request.method in permissions.SAFE_METHODS: return True return request.user.is_authenticated <|end_body_0|> <|body_start_1|> if request.method in permissions.SAFE_METHODS: return True return obj.user == request.user <|end_body_1|>
IsCreatorOrReadOnly
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IsCreatorOrReadOnly: def has_permission(self, request, view): """Authenticated allowed to create ingredients on List page.""" <|body_0|> def has_object_permission(self, request, view, obj): """Creator is allowed to Update/Delete. Others can only Retrieve.""" ...
stack_v2_sparse_classes_36k_train_015633
640
permissive
[ { "docstring": "Authenticated allowed to create ingredients on List page.", "name": "has_permission", "signature": "def has_permission(self, request, view)" }, { "docstring": "Creator is allowed to Update/Delete. Others can only Retrieve.", "name": "has_object_permission", "signature": "...
2
stack_v2_sparse_classes_30k_train_016984
Implement the Python class `IsCreatorOrReadOnly` described below. Class description: Implement the IsCreatorOrReadOnly class. Method signatures and docstrings: - def has_permission(self, request, view): Authenticated allowed to create ingredients on List page. - def has_object_permission(self, request, view, obj): Cr...
Implement the Python class `IsCreatorOrReadOnly` described below. Class description: Implement the IsCreatorOrReadOnly class. Method signatures and docstrings: - def has_permission(self, request, view): Authenticated allowed to create ingredients on List page. - def has_object_permission(self, request, view, obj): Cr...
755e4b4f10aa7b1918b260a5823900fb41bfff1b
<|skeleton|> class IsCreatorOrReadOnly: def has_permission(self, request, view): """Authenticated allowed to create ingredients on List page.""" <|body_0|> def has_object_permission(self, request, view, obj): """Creator is allowed to Update/Delete. Others can only Retrieve.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IsCreatorOrReadOnly: def has_permission(self, request, view): """Authenticated allowed to create ingredients on List page.""" if request.method in permissions.SAFE_METHODS: return True return request.user.is_authenticated def has_object_permission(self, request, view, ...
the_stack_v2_python_sparse
recipe_blog/ingredients/permissions.py
hossshakiba/recipe-blog-api
train
3
c933d66ac34d6796ab61d6495fdc343b87012891
[ "for i in range(len(nums)):\n for j in range(i + 1, len(nums)):\n if nums[i] + nums[j] == target:\n return [i, j]\nreturn 0", "for i in range(len(nums)):\n if target - nums[i] in nums:\n j = nums.index(target - nums[i])\n if i == j:\n continue\n return [i, j...
<|body_start_0|> for i in range(len(nums)): for j in range(i + 1, len(nums)): if nums[i] + nums[j] == target: return [i, j] return 0 <|end_body_0|> <|body_start_1|> for i in range(len(nums)): if target - nums[i] in nums: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def twoSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def twoSum1(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_1|> def twoSum2(self, nums, targe...
stack_v2_sparse_classes_36k_train_015634
1,437
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: List[int]", "name": "twoSum", "signature": "def twoSum(self, nums, target)" }, { "docstring": ":type nums: List[int] :type target: int :rtype: List[int]", "name": "twoSum1", "signature": "def twoSum1(self, nums, target)" }...
3
stack_v2_sparse_classes_30k_train_014703
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] - def twoSum1(self, nums, target): :type nums: List[int] :type target: int :rtype: List[...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] - def twoSum1(self, nums, target): :type nums: List[int] :type target: int :rtype: List[...
5b55e35f15c7bf098203a6aabbb7aad6b14579fa
<|skeleton|> class Solution: def twoSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def twoSum1(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_1|> def twoSum2(self, nums, targe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def twoSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" for i in range(len(nums)): for j in range(i + 1, len(nums)): if nums[i] + nums[j] == target: return [i, j] return 0 def twoSum1...
the_stack_v2_python_sparse
leetcode/1.py
queryor/algorithms
train
0
4f95c96f5cfdd09c25091d7b66879f06782999c2
[ "arr = self.linked_list_to_array(head)\nself.insertion_sort(arr)\nreturn self.array_to_linked_list(arr)", "arr = []\nwhile head is not None:\n arr.append(head.val)\n head = head.next\nreturn arr", "for i in range(1, len(arr)):\n j, tmp = (i, arr[i])\n while j and tmp < arr[j - 1]:\n arr[j] = ...
<|body_start_0|> arr = self.linked_list_to_array(head) self.insertion_sort(arr) return self.array_to_linked_list(arr) <|end_body_0|> <|body_start_1|> arr = [] while head is not None: arr.append(head.val) head = head.next return arr <|end_body_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def insertionSortList(self, head: ListNode) -> ListNode: """Time: O(n ** 2) Space: O(n)""" <|body_0|> def linked_list_to_array(self, head: ListNode) -> List[int]: """Time/Space: O(n)""" <|body_1|> def insertion_sort(self, arr: List[int]) -> Non...
stack_v2_sparse_classes_36k_train_015635
1,184
no_license
[ { "docstring": "Time: O(n ** 2) Space: O(n)", "name": "insertionSortList", "signature": "def insertionSortList(self, head: ListNode) -> ListNode" }, { "docstring": "Time/Space: O(n)", "name": "linked_list_to_array", "signature": "def linked_list_to_array(self, head: ListNode) -> List[int...
4
stack_v2_sparse_classes_30k_train_002401
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def insertionSortList(self, head: ListNode) -> ListNode: Time: O(n ** 2) Space: O(n) - def linked_list_to_array(self, head: ListNode) -> List[int]: Time/Space: O(n) - def inserti...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def insertionSortList(self, head: ListNode) -> ListNode: Time: O(n ** 2) Space: O(n) - def linked_list_to_array(self, head: ListNode) -> List[int]: Time/Space: O(n) - def inserti...
359f3b78da90c41c7e42e5c9e13d49b4fc67fe41
<|skeleton|> class Solution: def insertionSortList(self, head: ListNode) -> ListNode: """Time: O(n ** 2) Space: O(n)""" <|body_0|> def linked_list_to_array(self, head: ListNode) -> List[int]: """Time/Space: O(n)""" <|body_1|> def insertion_sort(self, arr: List[int]) -> Non...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def insertionSortList(self, head: ListNode) -> ListNode: """Time: O(n ** 2) Space: O(n)""" arr = self.linked_list_to_array(head) self.insertion_sort(arr) return self.array_to_linked_list(arr) def linked_list_to_array(self, head: ListNode) -> List[int]: ""...
the_stack_v2_python_sparse
problems/147. Insertion Sort List/1 - Back to Array.py
Vasilic-Maxim/LeetCode-Problems
train
0
76d7018000beb1395899c283c9337a14d1a6f293
[ "nums = str(N)\nfor num in nums:\n if num == '0' or N % int(num) != 0:\n return False\nreturn True", "sDN = []\nfor n in range(left, right + 1):\n if self.isselfDividingNumber(n):\n sDN.append(n)\nreturn sDN" ]
<|body_start_0|> nums = str(N) for num in nums: if num == '0' or N % int(num) != 0: return False return True <|end_body_0|> <|body_start_1|> sDN = [] for n in range(left, right + 1): if self.isselfDividingNumber(n): sDN.app...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isselfDividingNumber(self, N): """:type N: int :rtype: Bool""" <|body_0|> def selfDividingNumbers(self, left, right): """:type left: int :type right: int :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> nums = str(N) ...
stack_v2_sparse_classes_36k_train_015636
582
no_license
[ { "docstring": ":type N: int :rtype: Bool", "name": "isselfDividingNumber", "signature": "def isselfDividingNumber(self, N)" }, { "docstring": ":type left: int :type right: int :rtype: List[int]", "name": "selfDividingNumbers", "signature": "def selfDividingNumbers(self, left, right)" ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isselfDividingNumber(self, N): :type N: int :rtype: Bool - def selfDividingNumbers(self, left, right): :type left: int :type right: int :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isselfDividingNumber(self, N): :type N: int :rtype: Bool - def selfDividingNumbers(self, left, right): :type left: int :type right: int :rtype: List[int] <|skeleton|> class ...
9752533bc76ce5ecb881f61e33a3bc4b20dcf666
<|skeleton|> class Solution: def isselfDividingNumber(self, N): """:type N: int :rtype: Bool""" <|body_0|> def selfDividingNumbers(self, left, right): """:type left: int :type right: int :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isselfDividingNumber(self, N): """:type N: int :rtype: Bool""" nums = str(N) for num in nums: if num == '0' or N % int(num) != 0: return False return True def selfDividingNumbers(self, left, right): """:type left: int :type...
the_stack_v2_python_sparse
728. Self Dividing Numbers/728. Self Dividing Numbers.py
603lzy/LeetCode
train
3
67ae5c40dee00aed03cd47bea2f3706735148b56
[ "nodes = [root]\nres = []\nwhile any(nodes):\n nodes = [node for node in nodes if node]\n res.append(max([node.val for node in nodes]))\n nodes = [n for node in nodes for n in (node.left, node.right)]\nreturn res", "if not root:\n return []\nnodes = [(root, 0)]\nhigh_level = 0\ndict = {}\nwhile nodes:...
<|body_start_0|> nodes = [root] res = [] while any(nodes): nodes = [node for node in nodes if node] res.append(max([node.val for node in nodes])) nodes = [n for node in nodes for n in (node.left, node.right)] return res <|end_body_0|> <|body_start_1|>...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def largestValues(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_0|> def largestValues2(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> nodes = [root] res = [...
stack_v2_sparse_classes_36k_train_015637
1,901
no_license
[ { "docstring": ":type root: TreeNode :rtype: List[int]", "name": "largestValues", "signature": "def largestValues(self, root)" }, { "docstring": ":type root: TreeNode :rtype: List[int]", "name": "largestValues2", "signature": "def largestValues2(self, root)" } ]
2
stack_v2_sparse_classes_30k_train_007349
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestValues(self, root): :type root: TreeNode :rtype: List[int] - def largestValues2(self, root): :type root: TreeNode :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestValues(self, root): :type root: TreeNode :rtype: List[int] - def largestValues2(self, root): :type root: TreeNode :rtype: List[int] <|skeleton|> class Solution: ...
0fc4c7af59246e3064db41989a45d9db413a624b
<|skeleton|> class Solution: def largestValues(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_0|> def largestValues2(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def largestValues(self, root): """:type root: TreeNode :rtype: List[int]""" nodes = [root] res = [] while any(nodes): nodes = [node for node in nodes if node] res.append(max([node.val for node in nodes])) nodes = [n for node in node...
the_stack_v2_python_sparse
515. Find Largest Value in Each Tree Row/largest.py
Macielyoung/LeetCode
train
1
fc8c1de19640cb39897b96d5e16c10733dd75424
[ "probeTable = HTML().table(border='1', klass=TABLE_ENV)\nheading = probeTable.thead.tr\nheading.th('Probe #')\nheading.th('Probe')\nheading.th('SysName')\ntbody = probeTable.tbody\nfor i, probe in enumerate(probes):\n row = tbody.tr\n row.td('{:,}'.format(i + 1), klass=TD_KEY)\n row.td('{} '.format(probe.n...
<|body_start_0|> probeTable = HTML().table(border='1', klass=TABLE_ENV) heading = probeTable.thead.tr heading.th('Probe #') heading.th('Probe') heading.th('SysName') tbody = probeTable.tbody for i, probe in enumerate(probes): row = tbody.tr ...
Builds markup for rendering profile info
ProfileInfoReportBuilder
[ "MIT", "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProfileInfoReportBuilder: """Builds markup for rendering profile info""" def buildProbeTable(probes): """Builds a html table for the given list of probes""" <|body_0|> def buildPmcTable(pmcs): """Builds a html table for the given list of pmu events""" <|b...
stack_v2_sparse_classes_36k_train_015638
3,411
permissive
[ { "docstring": "Builds a html table for the given list of probes", "name": "buildProbeTable", "signature": "def buildProbeTable(probes)" }, { "docstring": "Builds a html table for the given list of pmu events", "name": "buildPmcTable", "signature": "def buildPmcTable(pmcs)" }, { ...
4
null
Implement the Python class `ProfileInfoReportBuilder` described below. Class description: Builds markup for rendering profile info Method signatures and docstrings: - def buildProbeTable(probes): Builds a html table for the given list of probes - def buildPmcTable(pmcs): Builds a html table for the given list of pmu ...
Implement the Python class `ProfileInfoReportBuilder` described below. Class description: Builds markup for rendering profile info Method signatures and docstrings: - def buildProbeTable(probes): Builds a html table for the given list of probes - def buildPmcTable(pmcs): Builds a html table for the given list of pmu ...
d6b67e98d4b640c98499a373425f1f009e5b9061
<|skeleton|> class ProfileInfoReportBuilder: """Builds markup for rendering profile info""" def buildProbeTable(probes): """Builds a html table for the given list of probes""" <|body_0|> def buildPmcTable(pmcs): """Builds a html table for the given list of pmu events""" <|b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProfileInfoReportBuilder: """Builds markup for rendering profile info""" def buildProbeTable(probes): """Builds a html table for the given list of probes""" probeTable = HTML().table(border='1', klass=TABLE_ENV) heading = probeTable.thead.tr heading.th('Probe #') h...
the_stack_v2_python_sparse
scripts/lib/xpedite/report/profileInfo.py
dendisuhubdy/Xpedite
train
1
a44ab891e1e458dae00ecd5dff141abbdc0d3465
[ "retflg, retstr = service.FileBusiness.upload_file_post(request)\nif retflg:\n return Response(retstr, status=status.HTTP_200_OK)\nelse:\n return Response(retstr, status=status.HTTP_500_INTERNAL_SERVER_ERROR)", "retflg, retstr = service.FileBusiness.ft_dir_list_get(request)\nif retflg:\n return Response(...
<|body_start_0|> retflg, retstr = service.FileBusiness.upload_file_post(request) if retflg: return Response(retstr, status=status.HTTP_200_OK) else: return Response(retstr, status=status.HTTP_500_INTERNAL_SERVER_ERROR) <|end_body_0|> <|body_start_1|> retflg, rets...
post:upload file get :get list for dir
FTList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FTList: """post:upload file get :get list for dir""" def post(self, request, format=None): """post:upload file""" <|body_0|> def get(self, request, format=None): """list for dir""" <|body_1|> <|end_skeleton|> <|body_start_0|> retflg, retstr = se...
stack_v2_sparse_classes_36k_train_015639
1,639
no_license
[ { "docstring": "post:upload file", "name": "post", "signature": "def post(self, request, format=None)" }, { "docstring": "list for dir", "name": "get", "signature": "def get(self, request, format=None)" } ]
2
stack_v2_sparse_classes_30k_train_012780
Implement the Python class `FTList` described below. Class description: post:upload file get :get list for dir Method signatures and docstrings: - def post(self, request, format=None): post:upload file - def get(self, request, format=None): list for dir
Implement the Python class `FTList` described below. Class description: post:upload file get :get list for dir Method signatures and docstrings: - def post(self, request, format=None): post:upload file - def get(self, request, format=None): list for dir <|skeleton|> class FTList: """post:upload file get :get lis...
7f801a569a396a27371d0831752595877c224a6b
<|skeleton|> class FTList: """post:upload file get :get list for dir""" def post(self, request, format=None): """post:upload file""" <|body_0|> def get(self, request, format=None): """list for dir""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FTList: """post:upload file get :get list for dir""" def post(self, request, format=None): """post:upload file""" retflg, retstr = service.FileBusiness.upload_file_post(request) if retflg: return Response(retstr, status=status.HTTP_200_OK) else: ret...
the_stack_v2_python_sparse
Python_projects/flask_projects/unicorn_project/ft/views.py
sdtimothy8/Coding
train
0
ada60b98e0477bc8ef082f0deec0d2d0ee02f451
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn BroadcastMeetingSettings()", "from .broadcast_meeting_audience import BroadcastMeetingAudience\nfrom .broadcast_meeting_caption_settings import BroadcastMeetingCaptionSettings\nfrom .broadcast_meeting_audience import BroadcastMeetingAu...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return BroadcastMeetingSettings() <|end_body_0|> <|body_start_1|> from .broadcast_meeting_audience import BroadcastMeetingAudience from .broadcast_meeting_caption_settings import BroadcastMeeti...
BroadcastMeetingSettings
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BroadcastMeetingSettings: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> BroadcastMeetingSettings: """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 cre...
stack_v2_sparse_classes_36k_train_015640
4,835
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: BroadcastMeetingSettings", "name": "create_from_discriminator_value", "signature": "def create_from_discrimi...
3
null
Implement the Python class `BroadcastMeetingSettings` described below. Class description: Implement the BroadcastMeetingSettings class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> BroadcastMeetingSettings: Creates a new instance of the appropriate c...
Implement the Python class `BroadcastMeetingSettings` described below. Class description: Implement the BroadcastMeetingSettings class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> BroadcastMeetingSettings: Creates a new instance of the appropriate c...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class BroadcastMeetingSettings: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> BroadcastMeetingSettings: """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 cre...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BroadcastMeetingSettings: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> BroadcastMeetingSettings: """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...
the_stack_v2_python_sparse
msgraph/generated/models/broadcast_meeting_settings.py
microsoftgraph/msgraph-sdk-python
train
135
cfdd8870b76449bc8100cb83d05fd6b05d279348
[ "content = '\\n {{ invite_host_name }},\\n\\n I\\'m so excited to lead your Vinely Party on <b>{{ party.event_date|date:\"F j, o\" }}</b> at <b>{{ party.event_date|date:\"g:i A\" }}</b>!\\n Your party has been scheduled in the system using the information you provided (see below).\\n You...
<|body_start_0|> content = '\n {{ invite_host_name }},\n\n I\'m so excited to lead your Vinely Party on <b>{{ party.event_date|date:"F j, o" }}</b> at <b>{{ party.event_date|date:"g:i A" }}</b>!\n Your party has been scheduled in the system using the information you provided (see below).\n ...
Migration
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Migration: def forwards(self, orm): """Write your forwards methods here.""" <|body_0|> def backwards(self, orm): """Write your backwards methods here.""" <|body_1|> <|end_skeleton|> <|body_start_0|> content = '\n {{ invite_host_name }},\n\n ...
stack_v2_sparse_classes_36k_train_015641
4,647
no_license
[ { "docstring": "Write your forwards methods here.", "name": "forwards", "signature": "def forwards(self, orm)" }, { "docstring": "Write your backwards methods here.", "name": "backwards", "signature": "def backwards(self, orm)" } ]
2
stack_v2_sparse_classes_30k_train_008265
Implement the Python class `Migration` described below. Class description: Implement the Migration class. Method signatures and docstrings: - def forwards(self, orm): Write your forwards methods here. - def backwards(self, orm): Write your backwards methods here.
Implement the Python class `Migration` described below. Class description: Implement the Migration class. Method signatures and docstrings: - def forwards(self, orm): Write your forwards methods here. - def backwards(self, orm): Write your backwards methods here. <|skeleton|> class Migration: def forwards(self,...
c5c7d8a0b1a297e07302870017d3fb03c5dbb009
<|skeleton|> class Migration: def forwards(self, orm): """Write your forwards methods here.""" <|body_0|> def backwards(self, orm): """Write your backwards methods here.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Migration: def forwards(self, orm): """Write your forwards methods here.""" content = '\n {{ invite_host_name }},\n\n I\'m so excited to lead your Vinely Party on <b>{{ party.event_date|date:"F j, o" }}</b> at <b>{{ party.event_date|date:"g:i A" }}</b>!\n Your party has be...
the_stack_v2_python_sparse
cms/migrations/0015_new_party_host_confirmation_email.py
RSV3/nuvine
train
0
49df805c8e708079a2b0568c16a39742c110c305
[ "red = [1.0, 0.0, 0.0, 1]\ngreen = [0.0, 1.0, 0.0, 1]\nblue = [0.0, 0.0, 1.0, 1]\nyellow = [1.0, 1.0, 0.0, 1]\nwhite = [1.0, 1.0, 1.0, 1]\nblack = [0.0, 0.0, 0.0, 0.0]\nscalingUnit = VPC.b / 6.0\nfuse_h = scalingUnit\nfuse_w = scalingUnit\nfuse_l1 = 2 * scalingUnit\nfuse_l2 = scalingUnit\nfuse_l3 = 4 * scalingUnit\...
<|body_start_0|> red = [1.0, 0.0, 0.0, 1] green = [0.0, 1.0, 0.0, 1] blue = [0.0, 0.0, 1.0, 1] yellow = [1.0, 1.0, 0.0, 1] white = [1.0, 1.0, 1.0, 1] black = [0.0, 0.0, 0.0, 0.0] scalingUnit = VPC.b / 6.0 fuse_h = scalingUnit fuse_w = scalingUnit ...
VehicleGeometry
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VehicleGeometry: def __init__(self): """defines the vehicle in NED coordinates around the local body frame origin. Rotations and translations will be around the [0,0,0] point of this local frame. Has to be in NED or the rotation matrices will not work. Vehicle is scaled to match the wing...
stack_v2_sparse_classes_36k_train_015642
5,465
no_license
[ { "docstring": "defines the vehicle in NED coordinates around the local body frame origin. Rotations and translations will be around the [0,0,0] point of this local frame. Has to be in NED or the rotation matrices will not work. Vehicle is scaled to match the wing span of the actual vehicle, this all the points...
2
stack_v2_sparse_classes_30k_train_009756
Implement the Python class `VehicleGeometry` described below. Class description: Implement the VehicleGeometry class. Method signatures and docstrings: - def __init__(self): defines the vehicle in NED coordinates around the local body frame origin. Rotations and translations will be around the [0,0,0] point of this l...
Implement the Python class `VehicleGeometry` described below. Class description: Implement the VehicleGeometry class. Method signatures and docstrings: - def __init__(self): defines the vehicle in NED coordinates around the local body frame origin. Rotations and translations will be around the [0,0,0] point of this l...
5a1429df7d035a34145ec2191ddd3268553b1a73
<|skeleton|> class VehicleGeometry: def __init__(self): """defines the vehicle in NED coordinates around the local body frame origin. Rotations and translations will be around the [0,0,0] point of this local frame. Has to be in NED or the rotation matrices will not work. Vehicle is scaled to match the wing...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VehicleGeometry: def __init__(self): """defines the vehicle in NED coordinates around the local body frame origin. Rotations and translations will be around the [0,0,0] point of this local frame. Has to be in NED or the rotation matrices will not work. Vehicle is scaled to match the wing span of the a...
the_stack_v2_python_sparse
UAV_Payload_Delivery/CodeBase/ece163/Modeling/VehicleGeometry.py
rpsison/Projects
train
2
e950332936e16fe0704720e81b300c1cdc57962f
[ "netdata = self.loaddata(mriscan, attrname)\nnet = netattr.Net(netdata, self.atlasobj, mriscan, attrname)\nreturn net", "ret = []\nfor mriscan in mriscans:\n ret.append(self.loadSingle(mriscan, attrname))\nreturn ret" ]
<|body_start_0|> netdata = self.loaddata(mriscan, attrname) net = netattr.Net(netdata, self.atlasobj, mriscan, attrname) return net <|end_body_0|> <|body_start_1|> ret = [] for mriscan in mriscans: ret.append(self.loadSingle(mriscan, attrname)) return ret <|e...
Net loader.
NetLoader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NetLoader: """Net loader.""" def loadSingle(self, mriscan, attrname='BOLD.net'): """Load the net object, with atlasobj.""" <|body_0|> def loadMulti(self, mriscans, attrname='BOLD.net'): """Load a list of nets""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_36k_train_015643
13,309
no_license
[ { "docstring": "Load the net object, with atlasobj.", "name": "loadSingle", "signature": "def loadSingle(self, mriscan, attrname='BOLD.net')" }, { "docstring": "Load a list of nets", "name": "loadMulti", "signature": "def loadMulti(self, mriscans, attrname='BOLD.net')" } ]
2
stack_v2_sparse_classes_30k_train_020015
Implement the Python class `NetLoader` described below. Class description: Net loader. Method signatures and docstrings: - def loadSingle(self, mriscan, attrname='BOLD.net'): Load the net object, with atlasobj. - def loadMulti(self, mriscans, attrname='BOLD.net'): Load a list of nets
Implement the Python class `NetLoader` described below. Class description: Net loader. Method signatures and docstrings: - def loadSingle(self, mriscan, attrname='BOLD.net'): Load the net object, with atlasobj. - def loadMulti(self, mriscans, attrname='BOLD.net'): Load a list of nets <|skeleton|> class NetLoader: ...
dabfabdeb2f922a3dcbdaf3fc46f0c4b40598279
<|skeleton|> class NetLoader: """Net loader.""" def loadSingle(self, mriscan, attrname='BOLD.net'): """Load the net object, with atlasobj.""" <|body_0|> def loadMulti(self, mriscans, attrname='BOLD.net'): """Load a list of nets""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NetLoader: """Net loader.""" def loadSingle(self, mriscan, attrname='BOLD.net'): """Load the net object, with atlasobj.""" netdata = self.loaddata(mriscan, attrname) net = netattr.Net(netdata, self.atlasobj, mriscan, attrname) return net def loadMulti(self, mriscans, ...
the_stack_v2_python_sparse
mmdps/proc/loader.py
geyunxiang/mmdps
train
5
2e75f3f70ab13799d3b163d4f2873035a0de5839
[ "Container.__init__(self, 'get_string_dialog', padding=5)\nself.callback = callback\nself.sub(Label('prompt', prompt, pygame.Rect((0, 0), (200, 30))))\ntextbox = TextBox('textbox', pygame.Rect((0, 0), (200, 30)), return_callback=self.return_key)\nself.sub(textbox)\ndisplay.key_sensitive(textbox)\nself.sub(Button('O...
<|body_start_0|> Container.__init__(self, 'get_string_dialog', padding=5) self.callback = callback self.sub(Label('prompt', prompt, pygame.Rect((0, 0), (200, 30)))) textbox = TextBox('textbox', pygame.Rect((0, 0), (200, 30)), return_callback=self.return_key) self.sub(textbox) ...
A combination of Container, Label, TextBox and Button that asks the user for a string. Additional attributes: GetStringDialog.callback The callback to be called callback(string) when the input is confirmed.
GetStringDialog
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetStringDialog: """A combination of Container, Label, TextBox and Button that asks the user for a string. Additional attributes: GetStringDialog.callback The callback to be called callback(string) when the input is confirmed.""" def __init__(self, prompt, callback, display): """Init...
stack_v2_sparse_classes_36k_train_015644
27,668
permissive
[ { "docstring": "Initialise. callback will be called callback(GetStringDialog.textbox.text) after the GetStringDialog is destroyed. It should call render() and flip the display to remove the GetStringDialog from the screen. display.key_sensitive() will be used to register the TextBox of this dialog.", "name"...
3
stack_v2_sparse_classes_30k_train_009364
Implement the Python class `GetStringDialog` described below. Class description: A combination of Container, Label, TextBox and Button that asks the user for a string. Additional attributes: GetStringDialog.callback The callback to be called callback(string) when the input is confirmed. Method signatures and docstrin...
Implement the Python class `GetStringDialog` described below. Class description: A combination of Container, Label, TextBox and Button that asks the user for a string. Additional attributes: GetStringDialog.callback The callback to be called callback(string) when the input is confirmed. Method signatures and docstrin...
c2fc3d4e9beedb8487cfa4bfa13bdf55ec36af97
<|skeleton|> class GetStringDialog: """A combination of Container, Label, TextBox and Button that asks the user for a string. Additional attributes: GetStringDialog.callback The callback to be called callback(string) when the input is confirmed.""" def __init__(self, prompt, callback, display): """Init...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GetStringDialog: """A combination of Container, Label, TextBox and Button that asks the user for a string. Additional attributes: GetStringDialog.callback The callback to be called callback(string) when the input is confirmed.""" def __init__(self, prompt, callback, display): """Initialise. callb...
the_stack_v2_python_sparse
reference_scripts/clickndrag-0.4.1/clickndrag/gui.py
stivosaurus/rpi-snippets
train
1
b39559e6583ac244ccf6b29f7eb6f4e899d379af
[ "article = get_object_or_404(Article, slug=slug)\nif Favourite.objects.filter(user=request.user, article=article).exists():\n raise serializers.ValidationError('You have already favourited ' + 'this article', 400)\nelse:\n request.data['user'] = request.user.id\n request.data['article'] = article\n seri...
<|body_start_0|> article = get_object_or_404(Article, slug=slug) if Favourite.objects.filter(user=request.user, article=article).exists(): raise serializers.ValidationError('You have already favourited ' + 'this article', 400) else: request.data['user'] = request.user.id ...
This class handles favourating and unfavourating articles
FavouriteView
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FavouriteView: """This class handles favourating and unfavourating articles""" def post(self, request, slug): """This method adds an article to favourites""" <|body_0|> def delete(self, request, slug): """This method deletes an article from favourites""" ...
stack_v2_sparse_classes_36k_train_015645
2,936
permissive
[ { "docstring": "This method adds an article to favourites", "name": "post", "signature": "def post(self, request, slug)" }, { "docstring": "This method deletes an article from favourites", "name": "delete", "signature": "def delete(self, request, slug)" } ]
2
stack_v2_sparse_classes_30k_train_010079
Implement the Python class `FavouriteView` described below. Class description: This class handles favourating and unfavourating articles Method signatures and docstrings: - def post(self, request, slug): This method adds an article to favourites - def delete(self, request, slug): This method deletes an article from f...
Implement the Python class `FavouriteView` described below. Class description: This class handles favourating and unfavourating articles Method signatures and docstrings: - def post(self, request, slug): This method adds an article to favourites - def delete(self, request, slug): This method deletes an article from f...
c38810e221f95567262034b860ee0512cf15f102
<|skeleton|> class FavouriteView: """This class handles favourating and unfavourating articles""" def post(self, request, slug): """This method adds an article to favourites""" <|body_0|> def delete(self, request, slug): """This method deletes an article from favourites""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FavouriteView: """This class handles favourating and unfavourating articles""" def post(self, request, slug): """This method adds an article to favourites""" article = get_object_or_404(Article, slug=slug) if Favourite.objects.filter(user=request.user, article=article).exists(): ...
the_stack_v2_python_sparse
authors/apps/articles/views_favourites.py
andela/ah-backend-stark
train
0
f5f9f58b9367a51e363dcd0b4dd2b63359ce6d1d
[ "self.ad_guid_pairs = ad_guid_pairs\nself.exclude_ldap_properties = exclude_ldap_properties\nself.ldap_properties = ldap_properties\nself.merge_multi_val_properties = merge_multi_val_properties", "if dictionary is None:\n return None\nad_guid_pairs = None\nif dictionary.get('adGuidPairs') != None:\n ad_guid...
<|body_start_0|> self.ad_guid_pairs = ad_guid_pairs self.exclude_ldap_properties = exclude_ldap_properties self.ldap_properties = ldap_properties self.merge_multi_val_properties = merge_multi_val_properties <|end_body_0|> <|body_start_1|> if dictionary is None: retur...
Implementation of the 'AdObjectAttributeParameters' model. AdObjectAttributeParameters are AD attribute recovery parameters for one or more AD objects Attributes: ad_guid_pairs (list of RestoreAdGuidPair): Specifies the array of source and destination object guid pairs to restore attributes. exclude_ldap_properties (li...
AdObjectAttributeParameters
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdObjectAttributeParameters: """Implementation of the 'AdObjectAttributeParameters' model. AdObjectAttributeParameters are AD attribute recovery parameters for one or more AD objects Attributes: ad_guid_pairs (list of RestoreAdGuidPair): Specifies the array of source and destination object guid p...
stack_v2_sparse_classes_36k_train_015646
4,187
permissive
[ { "docstring": "Constructor for the AdObjectAttributeParameters class", "name": "__init__", "signature": "def __init__(self, ad_guid_pairs=None, exclude_ldap_properties=None, ldap_properties=None, merge_multi_val_properties=None)" }, { "docstring": "Creates an instance of this model from a dicti...
2
stack_v2_sparse_classes_30k_train_012303
Implement the Python class `AdObjectAttributeParameters` described below. Class description: Implementation of the 'AdObjectAttributeParameters' model. AdObjectAttributeParameters are AD attribute recovery parameters for one or more AD objects Attributes: ad_guid_pairs (list of RestoreAdGuidPair): Specifies the array ...
Implement the Python class `AdObjectAttributeParameters` described below. Class description: Implementation of the 'AdObjectAttributeParameters' model. AdObjectAttributeParameters are AD attribute recovery parameters for one or more AD objects Attributes: ad_guid_pairs (list of RestoreAdGuidPair): Specifies the array ...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class AdObjectAttributeParameters: """Implementation of the 'AdObjectAttributeParameters' model. AdObjectAttributeParameters are AD attribute recovery parameters for one or more AD objects Attributes: ad_guid_pairs (list of RestoreAdGuidPair): Specifies the array of source and destination object guid p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdObjectAttributeParameters: """Implementation of the 'AdObjectAttributeParameters' model. AdObjectAttributeParameters are AD attribute recovery parameters for one or more AD objects Attributes: ad_guid_pairs (list of RestoreAdGuidPair): Specifies the array of source and destination object guid pairs to resto...
the_stack_v2_python_sparse
cohesity_management_sdk/models/ad_object_attribute_parameters.py
cohesity/management-sdk-python
train
24
685fd25e3f51e11e3e834eb4a3367c6abae58635
[ "if cut_baselines:\n fname_end = '-short' + str(lines[mol]['baseline_cutoff'])\nelse:\n fname_end = ''\nself.mol = mol\nself.path = './data/' + mol + '/' + mol + fname_end\nself.uvf = fits.open(self.path + '.uvf')\nself.fits = fits.open(self.path + '.fits')\nself.baseline_cutoff = 110\nself.rms = lines[mol]['...
<|body_start_0|> if cut_baselines: fname_end = '-short' + str(lines[mol]['baseline_cutoff']) else: fname_end = '' self.mol = mol self.path = './data/' + mol + '/' + mol + fname_end self.uvf = fits.open(self.path + '.uvf') self.fits = fits.open(self...
Make the whole observation/data processing shindig a Class. This incorporates everything from the path to the original data file to the final model. Running it will grab the appropriate data files and spit out a cleaned image and some other stuff. Only used in analysis.py/MCMC_Analysis I think? Probably doesn't do too ...
Observation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Observation: """Make the whole observation/data processing shindig a Class. This incorporates everything from the path to the original data file to the final model. Running it will grab the appropriate data files and spit out a cleaned image and some other stuff. Only used in analysis.py/MCMC_Ana...
stack_v2_sparse_classes_36k_train_015647
26,328
no_license
[ { "docstring": "Give some init values. Args: root (str): the name of the directory to source the data files from name (str): the name of the data files to grab from root rms (float): the rms noise of that particular observation", "name": "__init__", "signature": "def __init__(self, mol, cut_baselines=Tr...
2
stack_v2_sparse_classes_30k_train_011498
Implement the Python class `Observation` described below. Class description: Make the whole observation/data processing shindig a Class. This incorporates everything from the path to the original data file to the final model. Running it will grab the appropriate data files and spit out a cleaned image and some other s...
Implement the Python class `Observation` described below. Class description: Make the whole observation/data processing shindig a Class. This incorporates everything from the path to the original data file to the final model. Running it will grab the appropriate data files and spit out a cleaned image and some other s...
f333f97a3d6f913037fa94b4b17ad1f2e5621b05
<|skeleton|> class Observation: """Make the whole observation/data processing shindig a Class. This incorporates everything from the path to the original data file to the final model. Running it will grab the appropriate data files and spit out a cleaned image and some other stuff. Only used in analysis.py/MCMC_Ana...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Observation: """Make the whole observation/data processing shindig a Class. This incorporates everything from the path to the original data file to the final model. Running it will grab the appropriate data files and spit out a cleaned image and some other stuff. Only used in analysis.py/MCMC_Analysis I think...
the_stack_v2_python_sparse
utils.py
Jonasori/Proplyd-Modeling
train
2
ad722afc9686d54c1f309a94c6a2cc1b78803fbc
[ "assessment: Assessment = self.get_object()\npublished_only = get_published_only(assessment, request)\nqs = models.DataExtraction.objects.get_qs(assessment).published_only(published_only).complete()\nexporter = exports.EpiFlatComplete(qs, filename=f'{assessment}-epi')\nreturn Response(exporter.build_export())", "...
<|body_start_0|> assessment: Assessment = self.get_object() published_only = get_published_only(assessment, request) qs = models.DataExtraction.objects.get_qs(assessment).published_only(published_only).complete() exporter = exports.EpiFlatComplete(qs, filename=f'{assessment}-epi') ...
EpiAssessmentViewSet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EpiAssessmentViewSet: def export(self, request, pk): """Retrieve epidemiology complete export.""" <|body_0|> def study_export(self, request, pk): """Retrieve epidemiology at the study level for assessment.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_015648
6,710
permissive
[ { "docstring": "Retrieve epidemiology complete export.", "name": "export", "signature": "def export(self, request, pk)" }, { "docstring": "Retrieve epidemiology at the study level for assessment.", "name": "study_export", "signature": "def study_export(self, request, pk)" } ]
2
null
Implement the Python class `EpiAssessmentViewSet` described below. Class description: Implement the EpiAssessmentViewSet class. Method signatures and docstrings: - def export(self, request, pk): Retrieve epidemiology complete export. - def study_export(self, request, pk): Retrieve epidemiology at the study level for ...
Implement the Python class `EpiAssessmentViewSet` described below. Class description: Implement the EpiAssessmentViewSet class. Method signatures and docstrings: - def export(self, request, pk): Retrieve epidemiology complete export. - def study_export(self, request, pk): Retrieve epidemiology at the study level for ...
51177c6fb9354cd028f7099fc10d83b1051fd50d
<|skeleton|> class EpiAssessmentViewSet: def export(self, request, pk): """Retrieve epidemiology complete export.""" <|body_0|> def study_export(self, request, pk): """Retrieve epidemiology at the study level for assessment.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EpiAssessmentViewSet: def export(self, request, pk): """Retrieve epidemiology complete export.""" assessment: Assessment = self.get_object() published_only = get_published_only(assessment, request) qs = models.DataExtraction.objects.get_qs(assessment).published_only(published_o...
the_stack_v2_python_sparse
hawc/apps/epiv2/api.py
shapiromatron/hawc
train
25
dd31799998d2fc189857bfb2804420549033e4da
[ "data = request.GET\nsize = int(data.get('size', 10))\npage = int(data.get('page', 1))\nresults = Mock.objects.all()\nret = CalcUtils.page_data(results, page, size)\nret['list'] = [model_to_dict(i) for i in ret['list']]\nreturn response_success(ret)", "body = request.body\nif not body:\n return response_succes...
<|body_start_0|> data = request.GET size = int(data.get('size', 10)) page = int(data.get('page', 1)) results = Mock.objects.all() ret = CalcUtils.page_data(results, page, size) ret['list'] = [model_to_dict(i) for i in ret['list']] return response_success(ret) <|en...
MockListView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MockListView: def get(self, request, *args, **kwargs): """代表获取mock列表 :param request: :param args: :param kwargs: :return:""" <|body_0|> def post(self, request, *args, **kwargs): """代表的是创建mock :param request: :param args: :param kwargs: :return:""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_015649
1,740
no_license
[ { "docstring": "代表获取mock列表 :param request: :param args: :param kwargs: :return:", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "代表的是创建mock :param request: :param args: :param kwargs: :return:", "name": "post", "signature": "def post(self, reques...
2
stack_v2_sparse_classes_30k_train_006051
Implement the Python class `MockListView` described below. Class description: Implement the MockListView class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): 代表获取mock列表 :param request: :param args: :param kwargs: :return: - def post(self, request, *args, **kwargs): 代表的是创建mock :param req...
Implement the Python class `MockListView` described below. Class description: Implement the MockListView class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): 代表获取mock列表 :param request: :param args: :param kwargs: :return: - def post(self, request, *args, **kwargs): 代表的是创建mock :param req...
fa859efae69351ec79b3d8a56e9948797ab76b31
<|skeleton|> class MockListView: def get(self, request, *args, **kwargs): """代表获取mock列表 :param request: :param args: :param kwargs: :return:""" <|body_0|> def post(self, request, *args, **kwargs): """代表的是创建mock :param request: :param args: :param kwargs: :return:""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MockListView: def get(self, request, *args, **kwargs): """代表获取mock列表 :param request: :param args: :param kwargs: :return:""" data = request.GET size = int(data.get('size', 10)) page = int(data.get('page', 1)) results = Mock.objects.all() ret = CalcUtils.page_dat...
the_stack_v2_python_sparse
django_interface_project/interface_main/views/mock/mock_list_view.py
harter123/test-dev2
train
7
843997a3144c6987f63deabbe0e23cc852dc66aa
[ "self.name = 'ANNModel'\nsuper(ANNModel, self).__init__(self.name, use_logger)\nif self.use_logger:\n self.logger = ml.SciopeLogger().get_logger()\n self.logger.info('Artificial Neural Network regression model initialized')", "self.scale_training_data(inputs, targets)\nself.model = MLPRegressor(solver='lbfg...
<|body_start_0|> self.name = 'ANNModel' super(ANNModel, self).__init__(self.name, use_logger) if self.use_logger: self.logger = ml.SciopeLogger().get_logger() self.logger.info('Artificial Neural Network regression model initialized') <|end_body_0|> <|body_start_1|> ...
We use the sklearn MLP Regressor implementation here.
ANNModel
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ANNModel: """We use the sklearn MLP Regressor implementation here.""" def __init__(self, use_logger=False): """Initialize the model. Parameters ---------- use_logger : bool, optional Controls whether logging is enabled or disabled, by default False""" <|body_0|> def trai...
stack_v2_sparse_classes_36k_train_015650
2,694
permissive
[ { "docstring": "Initialize the model. Parameters ---------- use_logger : bool, optional Controls whether logging is enabled or disabled, by default False", "name": "__init__", "signature": "def __init__(self, use_logger=False)" }, { "docstring": "Train the ANN model given the data Parameters ---...
3
stack_v2_sparse_classes_30k_train_003853
Implement the Python class `ANNModel` described below. Class description: We use the sklearn MLP Regressor implementation here. Method signatures and docstrings: - def __init__(self, use_logger=False): Initialize the model. Parameters ---------- use_logger : bool, optional Controls whether logging is enabled or disab...
Implement the Python class `ANNModel` described below. Class description: We use the sklearn MLP Regressor implementation here. Method signatures and docstrings: - def __init__(self, use_logger=False): Initialize the model. Parameters ---------- use_logger : bool, optional Controls whether logging is enabled or disab...
5122107dedcee9c39458e83d853ec35f91268780
<|skeleton|> class ANNModel: """We use the sklearn MLP Regressor implementation here.""" def __init__(self, use_logger=False): """Initialize the model. Parameters ---------- use_logger : bool, optional Controls whether logging is enabled or disabled, by default False""" <|body_0|> def trai...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ANNModel: """We use the sklearn MLP Regressor implementation here.""" def __init__(self, use_logger=False): """Initialize the model. Parameters ---------- use_logger : bool, optional Controls whether logging is enabled or disabled, by default False""" self.name = 'ANNModel' super(...
the_stack_v2_python_sparse
sciope/models/ann_regressor.py
rmjiang7/sciope
train
0
582c5f0ae0c7d06b002cfcc00aafd37ea54ad910
[ "self._console = Console()\nself._status = self._console.status('Working on it ...', spinner='bouncingBall')\nself._stored_progress_reporter = RichConsoleProgressReporter(console=self._console, status=self._status, sections=[], created_entities=[], created_entities_stats=defaultdict(list), updated_entities=[], upda...
<|body_start_0|> self._console = Console() self._status = self._console.status('Working on it ...', spinner='bouncingBall') self._stored_progress_reporter = RichConsoleProgressReporter(console=self._console, status=self._status, sections=[], created_entities=[], created_entities_stats=defaultdic...
A progress reporter factory that builds Rich progress reporters.
RichConsoleProgressReporterFactory
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RichConsoleProgressReporterFactory: """A progress reporter factory that builds Rich progress reporters.""" def __init__(self) -> None: """Constructor.""" <|body_0|> def new_reporter(self, context: AppLoggedInUseCaseContext) -> ProgressReporter: """Create a new pr...
stack_v2_sparse_classes_36k_train_015651
19,842
permissive
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self) -> None" }, { "docstring": "Create a new progress reporter.", "name": "new_reporter", "signature": "def new_reporter(self, context: AppLoggedInUseCaseContext) -> ProgressReporter" }, { "docstring"...
3
null
Implement the Python class `RichConsoleProgressReporterFactory` described below. Class description: A progress reporter factory that builds Rich progress reporters. Method signatures and docstrings: - def __init__(self) -> None: Constructor. - def new_reporter(self, context: AppLoggedInUseCaseContext) -> ProgressRepo...
Implement the Python class `RichConsoleProgressReporterFactory` described below. Class description: A progress reporter factory that builds Rich progress reporters. Method signatures and docstrings: - def __init__(self) -> None: Constructor. - def new_reporter(self, context: AppLoggedInUseCaseContext) -> ProgressRepo...
911ecd560142a9b4e57498f2b090f9469a0718a1
<|skeleton|> class RichConsoleProgressReporterFactory: """A progress reporter factory that builds Rich progress reporters.""" def __init__(self) -> None: """Constructor.""" <|body_0|> def new_reporter(self, context: AppLoggedInUseCaseContext) -> ProgressReporter: """Create a new pr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RichConsoleProgressReporterFactory: """A progress reporter factory that builds Rich progress reporters.""" def __init__(self) -> None: """Constructor.""" self._console = Console() self._status = self._console.status('Working on it ...', spinner='bouncingBall') self._stored...
the_stack_v2_python_sparse
src/cli/jupiter/cli/command/rendering.py
horia141/jupiter
train
16
409220a3cf8b7ab8209f12d7ac382a7634617d34
[ "super(AttentionLayer, self).__init__()\nself.h = n_head\nself.n_qk = N_qk\nself.n_v = N_v\nself.dim = N_in\nif N_qk is None:\n self.K = nn.Identity(N_in, N_in * n_head)\n self.Q = nn.Identity(N_in, N_in * n_head)\nelse:\n self.K = nn.Linear(N_in, N_qk * n_head)\n if queries:\n self.Q = nn.Linear...
<|body_start_0|> super(AttentionLayer, self).__init__() self.h = n_head self.n_qk = N_qk self.n_v = N_v self.dim = N_in if N_qk is None: self.K = nn.Identity(N_in, N_in * n_head) self.Q = nn.Identity(N_in, N_in * n_head) else: s...
AttentionLayer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AttentionLayer: def __init__(self, N_in, n_head=1, N_qk=None, N_v=None, queries=False): """Scaled dot-product attention, optional key, query, and value maps""" <|body_0|> def weights(self, x, mask): """x is shape (num_tok, *, dim_inp) expects padded inputs to be nans...
stack_v2_sparse_classes_36k_train_015652
45,005
no_license
[ { "docstring": "Scaled dot-product attention, optional key, query, and value maps", "name": "__init__", "signature": "def __init__(self, N_in, n_head=1, N_qk=None, N_v=None, queries=False)" }, { "docstring": "x is shape (num_tok, *, dim_inp) expects padded inputs to be nans!", "name": "weigh...
3
stack_v2_sparse_classes_30k_train_013093
Implement the Python class `AttentionLayer` described below. Class description: Implement the AttentionLayer class. Method signatures and docstrings: - def __init__(self, N_in, n_head=1, N_qk=None, N_v=None, queries=False): Scaled dot-product attention, optional key, query, and value maps - def weights(self, x, mask)...
Implement the Python class `AttentionLayer` described below. Class description: Implement the AttentionLayer class. Method signatures and docstrings: - def __init__(self, N_in, n_head=1, N_qk=None, N_v=None, queries=False): Scaled dot-product attention, optional key, query, and value maps - def weights(self, x, mask)...
1d4c76920d50729680305a4e877c30e2b782d9d7
<|skeleton|> class AttentionLayer: def __init__(self, N_in, n_head=1, N_qk=None, N_v=None, queries=False): """Scaled dot-product attention, optional key, query, and value maps""" <|body_0|> def weights(self, x, mask): """x is shape (num_tok, *, dim_inp) expects padded inputs to be nans...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AttentionLayer: def __init__(self, N_in, n_head=1, N_qk=None, N_v=None, queries=False): """Scaled dot-product attention, optional key, query, and value maps""" super(AttentionLayer, self).__init__() self.h = n_head self.n_qk = N_qk self.n_v = N_v self.dim = N_in...
the_stack_v2_python_sparse
src/students.py
Kelarion/repler
train
0
d5f5e4f39c9167ab125aada9eb202f8e82365cf6
[ "assert isinstance(module, torch.nn.Module), 'Must provide an instance of a nn.Module'\nself.module = module\nself.name_to_node = {}\nself.module_to_name = {}\nself.current_input = None\nsubmodules = module.named_children() if not submodules else submodules\nif isinstance(submodules, dict):\n submodules = submod...
<|body_start_0|> assert isinstance(module, torch.nn.Module), 'Must provide an instance of a nn.Module' self.module = module self.name_to_node = {} self.module_to_name = {} self.current_input = None submodules = module.named_children() if not submodules else submodules ...
Automatically construct a `ComputationGraph` from a `torch.nn.Module`. Currently, the constructor will automatically treat the submodules of type `torch.nn.Module` of the provided module as nodes in the computation graph. The constructor only works if the outputs of every submodule directly feeds into another one, with...
CompGraphConstructor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CompGraphConstructor: """Automatically construct a `ComputationGraph` from a `torch.nn.Module`. Currently, the constructor will automatically treat the submodules of type `torch.nn.Module` of the provided module as nodes in the computation graph. The constructor only works if the outputs of every...
stack_v2_sparse_classes_36k_train_015653
6,065
permissive
[ { "docstring": "Initialize constructor from a pytorch module :param module: `torch.nn.Module` the module in question. :param submodules: see CompGraphConstructor.construct().", "name": "__init__", "signature": "def __init__(self, module, submodules=None)" }, { "docstring": "Construct a computati...
5
stack_v2_sparse_classes_30k_train_017670
Implement the Python class `CompGraphConstructor` described below. Class description: Automatically construct a `ComputationGraph` from a `torch.nn.Module`. Currently, the constructor will automatically treat the submodules of type `torch.nn.Module` of the provided module as nodes in the computation graph. The constru...
Implement the Python class `CompGraphConstructor` described below. Class description: Automatically construct a `ComputationGraph` from a `torch.nn.Module`. Currently, the constructor will automatically treat the submodules of type `torch.nn.Module` of the provided module as nodes in the computation graph. The constru...
860c12697211f4cb3c9ef7aa1c8dee247f2710f4
<|skeleton|> class CompGraphConstructor: """Automatically construct a `ComputationGraph` from a `torch.nn.Module`. Currently, the constructor will automatically treat the submodules of type `torch.nn.Module` of the provided module as nodes in the computation graph. The constructor only works if the outputs of every...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CompGraphConstructor: """Automatically construct a `ComputationGraph` from a `torch.nn.Module`. Currently, the constructor will automatically treat the submodules of type `torch.nn.Module` of the provided module as nodes in the computation graph. The constructor only works if the outputs of every submodule di...
the_stack_v2_python_sparse
antra/constructor.py
syyunn/antra
train
0
d2b84e6e32b38af7ac2cc785661e39b7e9aadd43
[ "def str_cmp(a, b):\n return int(a + b) - int(b + a)\nstrs = [str(i) for i in nums]\nstrs.sort(key=cmp_to_key(str_cmp), reverse=True)\nreturn str(int(''.join(strs)))", "if len(nums) == 1:\n return str(nums[0])\nnum_strs = [str(i) for i in nums]\nmaxlen = len(max(num_strs, key=lambda _s: len(_s)))\npairs = [...
<|body_start_0|> def str_cmp(a, b): return int(a + b) - int(b + a) strs = [str(i) for i in nums] strs.sort(key=cmp_to_key(str_cmp), reverse=True) return str(int(''.join(strs))) <|end_body_0|> <|body_start_1|> if len(nums) == 1: return str(nums[0]) ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def largestNumber(self, nums): """思路:直接定义比较规则就好""" <|body_0|> def largestNumber_2(self, nums): """思路:一开始的解法,比较 ugly,把所有的数字扩充成一样长度,之后再比较 :type nums: List[int] :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> def str_cmp(a, b): ...
stack_v2_sparse_classes_36k_train_015654
2,552
permissive
[ { "docstring": "思路:直接定义比较规则就好", "name": "largestNumber", "signature": "def largestNumber(self, nums)" }, { "docstring": "思路:一开始的解法,比较 ugly,把所有的数字扩充成一样长度,之后再比较 :type nums: List[int] :rtype: str", "name": "largestNumber_2", "signature": "def largestNumber_2(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_008941
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestNumber(self, nums): 思路:直接定义比较规则就好 - def largestNumber_2(self, nums): 思路:一开始的解法,比较 ugly,把所有的数字扩充成一样长度,之后再比较 :type nums: List[int] :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestNumber(self, nums): 思路:直接定义比较规则就好 - def largestNumber_2(self, nums): 思路:一开始的解法,比较 ugly,把所有的数字扩充成一样长度,之后再比较 :type nums: List[int] :rtype: str <|skeleton|> class Soluti...
3469a79c34b6c08ae52797c3974b49fbfa8cca51
<|skeleton|> class Solution: def largestNumber(self, nums): """思路:直接定义比较规则就好""" <|body_0|> def largestNumber_2(self, nums): """思路:一开始的解法,比较 ugly,把所有的数字扩充成一样长度,之后再比较 :type nums: List[int] :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def largestNumber(self, nums): """思路:直接定义比较规则就好""" def str_cmp(a, b): return int(a + b) - int(b + a) strs = [str(i) for i in nums] strs.sort(key=cmp_to_key(str_cmp), reverse=True) return str(int(''.join(strs))) def largestNumber_2(self, nums):...
the_stack_v2_python_sparse
剑指offer/33_SortArrayForMinNumber(把数组排成最小的数).py
Mark24Code/python_data_structures_and_algorithms
train
1
c5e0dad4cc0eed51beef649c18f3b2d6113f20b9
[ "self.n_kernels = n_kernels\nself.n_strides = n_strides\nself.norm_type = normalization\nself.activation_type = activation\nself.kernel_init = tf.random_normal_initializer(0.0, 0.02)", "activation = Conv2D(filters=n_filters, kernel_size=self.n_kernels, strides=self.n_strides, padding='same', kernel_initializer=se...
<|body_start_0|> self.n_kernels = n_kernels self.n_strides = n_strides self.norm_type = normalization self.activation_type = activation self.kernel_init = tf.random_normal_initializer(0.0, 0.02) <|end_body_0|> <|body_start_1|> activation = Conv2D(filters=n_filters, kerne...
Class for the Down Convolution block for Unet.
DownConvBlock
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DownConvBlock: """Class for the Down Convolution block for Unet.""" def __init__(self, n_kernels, n_strides, activation, normalization): """Initialize the Down Convolution Block. Args: n_kernels (int): Number of kernels for Conv2D. n_strides (int): Stride size. activation (str): Type...
stack_v2_sparse_classes_36k_train_015655
11,636
no_license
[ { "docstring": "Initialize the Down Convolution Block. Args: n_kernels (int): Number of kernels for Conv2D. n_strides (int): Stride size. activation (str): Type of activation layer to use. normalization (str): Type of normalization layer to use.", "name": "__init__", "signature": "def __init__(self, n_k...
2
stack_v2_sparse_classes_30k_train_015343
Implement the Python class `DownConvBlock` described below. Class description: Class for the Down Convolution block for Unet. Method signatures and docstrings: - def __init__(self, n_kernels, n_strides, activation, normalization): Initialize the Down Convolution Block. Args: n_kernels (int): Number of kernels for Con...
Implement the Python class `DownConvBlock` described below. Class description: Class for the Down Convolution block for Unet. Method signatures and docstrings: - def __init__(self, n_kernels, n_strides, activation, normalization): Initialize the Down Convolution Block. Args: n_kernels (int): Number of kernels for Con...
1b953d87968dac46ebbc9b1d5c254ea9493ee328
<|skeleton|> class DownConvBlock: """Class for the Down Convolution block for Unet.""" def __init__(self, n_kernels, n_strides, activation, normalization): """Initialize the Down Convolution Block. Args: n_kernels (int): Number of kernels for Conv2D. n_strides (int): Stride size. activation (str): Type...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DownConvBlock: """Class for the Down Convolution block for Unet.""" def __init__(self, n_kernels, n_strides, activation, normalization): """Initialize the Down Convolution Block. Args: n_kernels (int): Number of kernels for Conv2D. n_strides (int): Stride size. activation (str): Type of activatio...
the_stack_v2_python_sparse
fmlwright/trainer/neural_networks/blocks.py
rgresia-umd/fml-wright
train
0
1b9080a11beb1b3863b7e0dc95b160c886bc6207
[ "self.id = id\nself.generator = generators[0]()\nself.effect_1 = effects[0]()\nself.effect_2 = effects[0]()\nself.effect_3 = effects[0]()\nlogging.info('Channel ' + str(self.id) + ' initialised')", "self.generator = generators[int(settings[0])]()\nself.effect_1 = effects[int(settings[1])]()\nself.effect_2 = effec...
<|body_start_0|> self.id = id self.generator = generators[0]() self.effect_1 = effects[0]() self.effect_2 = effects[0]() self.effect_3 = effects[0]() logging.info('Channel ' + str(self.id) + ' initialised') <|end_body_0|> <|body_start_1|> self.generator = generat...
Class for a channel
class_channel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class class_channel: """Class for a channel""" def __init__(self, id=0): """initialises a channel by calling g_blank and e_blank""" <|body_0|> def set_settings(self, settings): """sets the settings of a channel""" <|body_1|> def render_frame(self, framecou...
stack_v2_sparse_classes_36k_train_015656
1,154
no_license
[ { "docstring": "initialises a channel by calling g_blank and e_blank", "name": "__init__", "signature": "def __init__(self, id=0)" }, { "docstring": "sets the settings of a channel", "name": "set_settings", "signature": "def set_settings(self, settings)" }, { "docstring": "render...
3
null
Implement the Python class `class_channel` described below. Class description: Class for a channel Method signatures and docstrings: - def __init__(self, id=0): initialises a channel by calling g_blank and e_blank - def set_settings(self, settings): sets the settings of a channel - def render_frame(self, framecounter...
Implement the Python class `class_channel` described below. Class description: Class for a channel Method signatures and docstrings: - def __init__(self, id=0): initialises a channel by calling g_blank and e_blank - def set_settings(self, settings): sets the settings of a channel - def render_frame(self, framecounter...
29c0a54f8c8306c3d8154146037dab221d4c9419
<|skeleton|> class class_channel: """Class for a channel""" def __init__(self, id=0): """initialises a channel by calling g_blank and e_blank""" <|body_0|> def set_settings(self, settings): """sets the settings of a channel""" <|body_1|> def render_frame(self, framecou...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class class_channel: """Class for a channel""" def __init__(self, id=0): """initialises a channel by calling g_blank and e_blank""" self.id = id self.generator = generators[0]() self.effect_1 = effects[0]() self.effect_2 = effects[0]() self.effect_3 = effects[0](...
the_stack_v2_python_sparse
channel.py
TillSchlemmermeier/l3d-controller-software
train
3
6c41c3664c97b94a9784bb3a8a818a6be334354b
[ "if not p and (not q):\n return True\nif p == None and q != None:\n return False\nif p != None and q == None:\n return False\nif p.val != q.val:\n return False\nreturn self.isSameTree(p.left, q.left) and self.isSameTree(p.right, q.right)", "def InOrder(root):\n if not root:\n return [None]\n...
<|body_start_0|> if not p and (not q): return True if p == None and q != None: return False if p != None and q == None: return False if p.val != q.val: return False return self.isSameTree(p.left, q.left) and self.isSameTree(p.right,...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isSameTree(self, p: TreeNode, q: TreeNode) -> bool: """递归法""" <|body_0|> def isSameTree_1(self, p: TreeNode, q: TreeNode) -> bool: """遍历法 颜色标记法会超时""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not p and (not q): return...
stack_v2_sparse_classes_36k_train_015657
1,054
no_license
[ { "docstring": "递归法", "name": "isSameTree", "signature": "def isSameTree(self, p: TreeNode, q: TreeNode) -> bool" }, { "docstring": "遍历法 颜色标记法会超时", "name": "isSameTree_1", "signature": "def isSameTree_1(self, p: TreeNode, q: TreeNode) -> bool" } ]
2
stack_v2_sparse_classes_30k_train_015251
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isSameTree(self, p: TreeNode, q: TreeNode) -> bool: 递归法 - def isSameTree_1(self, p: TreeNode, q: TreeNode) -> bool: 遍历法 颜色标记法会超时
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isSameTree(self, p: TreeNode, q: TreeNode) -> bool: 递归法 - def isSameTree_1(self, p: TreeNode, q: TreeNode) -> bool: 遍历法 颜色标记法会超时 <|skeleton|> class Solution: def isSame...
3508e1ce089131b19603c3206aab4cf43023bb19
<|skeleton|> class Solution: def isSameTree(self, p: TreeNode, q: TreeNode) -> bool: """递归法""" <|body_0|> def isSameTree_1(self, p: TreeNode, q: TreeNode) -> bool: """遍历法 颜色标记法会超时""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isSameTree(self, p: TreeNode, q: TreeNode) -> bool: """递归法""" if not p and (not q): return True if p == None and q != None: return False if p != None and q == None: return False if p.val != q.val: return Fals...
the_stack_v2_python_sparse
algorithm/leetcode/tree/11-相同的树.py
lxconfig/UbuntuCode_bak
train
0
7825bce2939e5497b80a55388ca1a44e6ff11b3c
[ "conn, cursor = get_db_cursor()\nbuild = 'toy_build'\ne_dict = init_refs.make_edge_dict(cursor, build)\nconn.close()\nassert len(e_dict.keys()) == 31", "conn, cursor = get_db_cursor()\nbuild = 'toy_build'\ne_dict = init_refs.make_edge_dict(cursor, build, chrom='chr1', start=1, end=1000)\nconn.close()\nassert len(...
<|body_start_0|> conn, cursor = get_db_cursor() build = 'toy_build' e_dict = init_refs.make_edge_dict(cursor, build) conn.close() assert len(e_dict.keys()) == 31 <|end_body_0|> <|body_start_1|> conn, cursor = get_db_cursor() build = 'toy_build' e_dict = i...
TestEdgeDict
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestEdgeDict: def test_all_edges(self): """Get all edges in the database""" <|body_0|> def test_interval_edges(self): """Get all edges in the database within the specified interval""" <|body_1|> <|end_skeleton|> <|body_start_0|> conn, cursor = get_d...
stack_v2_sparse_classes_36k_train_015658
1,153
permissive
[ { "docstring": "Get all edges in the database", "name": "test_all_edges", "signature": "def test_all_edges(self)" }, { "docstring": "Get all edges in the database within the specified interval", "name": "test_interval_edges", "signature": "def test_interval_edges(self)" } ]
2
stack_v2_sparse_classes_30k_test_000462
Implement the Python class `TestEdgeDict` described below. Class description: Implement the TestEdgeDict class. Method signatures and docstrings: - def test_all_edges(self): Get all edges in the database - def test_interval_edges(self): Get all edges in the database within the specified interval
Implement the Python class `TestEdgeDict` described below. Class description: Implement the TestEdgeDict class. Method signatures and docstrings: - def test_all_edges(self): Get all edges in the database - def test_interval_edges(self): Get all edges in the database within the specified interval <|skeleton|> class T...
8014faed5f982e5e106ec05239e47d65878e76c3
<|skeleton|> class TestEdgeDict: def test_all_edges(self): """Get all edges in the database""" <|body_0|> def test_interval_edges(self): """Get all edges in the database within the specified interval""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestEdgeDict: def test_all_edges(self): """Get all edges in the database""" conn, cursor = get_db_cursor() build = 'toy_build' e_dict = init_refs.make_edge_dict(cursor, build) conn.close() assert len(e_dict.keys()) == 31 def test_interval_edges(self): ...
the_stack_v2_python_sparse
testing_suite/test_make_edge_dict.py
kopardev/TALON
train
0
48b9789fb5808e7e8fe03e2b8c2c7fa1f47145ce
[ "response = requests.get(cls.search_url, params=query, allow_redirects=False)\n_response_error_handler(response.status_code, response.text)\nreturn response.json()", "res: [Dict] = []\nfor page_num in range(num_of_pages):\n query['page'] = page_num\n page = cls.execute_query(query)\n for dct in page['dat...
<|body_start_0|> response = requests.get(cls.search_url, params=query, allow_redirects=False) _response_error_handler(response.status_code, response.text) return response.json() <|end_body_0|> <|body_start_1|> res: [Dict] = [] for page_num in range(num_of_pages): que...
Rapid7 vulnerability database Search API ETL utilities.
Search
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Search: """Rapid7 vulnerability database Search API ETL utilities.""" def execute_query(cls, query: Dict) -> Dict: """Executes API query by sending a request to API and extracting the result as a python data structure :param query: free form text :return: Data as dictionary""" ...
stack_v2_sparse_classes_36k_train_015659
5,775
permissive
[ { "docstring": "Executes API query by sending a request to API and extracting the result as a python data structure :param query: free form text :return: Data as dictionary", "name": "execute_query", "signature": "def execute_query(cls, query: Dict) -> Dict" }, { "docstring": "Iterates over avai...
4
null
Implement the Python class `Search` described below. Class description: Rapid7 vulnerability database Search API ETL utilities. Method signatures and docstrings: - def execute_query(cls, query: Dict) -> Dict: Executes API query by sending a request to API and extracting the result as a python data structure :param qu...
Implement the Python class `Search` described below. Class description: Rapid7 vulnerability database Search API ETL utilities. Method signatures and docstrings: - def execute_query(cls, query: Dict) -> Dict: Executes API query by sending a request to API and extracting the result as a python data structure :param qu...
718d15ca36c57231bb89df0aebc53d0210db400c
<|skeleton|> class Search: """Rapid7 vulnerability database Search API ETL utilities.""" def execute_query(cls, query: Dict) -> Dict: """Executes API query by sending a request to API and extracting the result as a python data structure :param query: free form text :return: Data as dictionary""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Search: """Rapid7 vulnerability database Search API ETL utilities.""" def execute_query(cls, query: Dict) -> Dict: """Executes API query by sending a request to API and extracting the result as a python data structure :param query: free form text :return: Data as dictionary""" response = ...
the_stack_v2_python_sparse
plugins/rapid7_vulndb/komand_rapid7_vulndb/util/extract.py
rapid7/insightconnect-plugins
train
61
9f894e08ff4ef54a9b8346171a857b123e3e2b02
[ "max_1 = 0\nsets = set(nums)\nwhile sets:\n count = 1\n a = list(sets)[0]\n sets.remove(a)\n i = a - 1\n while sets and i in sets:\n sets.remove(i)\n count += 1\n i -= 1\n j = a + 1\n while sets and j in sets:\n sets.remove(j)\n count += 1\n j += 1\n ...
<|body_start_0|> max_1 = 0 sets = set(nums) while sets: count = 1 a = list(sets)[0] sets.remove(a) i = a - 1 while sets and i in sets: sets.remove(i) count += 1 i -= 1 j = a + ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestConsecutive(self, nums): """:type nums: List[int] :rtype: int 39ms""" <|body_0|> def longestConsecutive_1(self, nums): """:type nums: List[int] :rtype: int 35ms""" <|body_1|> def longestConsecutive_2(self, nums): """35ms :par...
stack_v2_sparse_classes_36k_train_015660
1,951
no_license
[ { "docstring": ":type nums: List[int] :rtype: int 39ms", "name": "longestConsecutive", "signature": "def longestConsecutive(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int 35ms", "name": "longestConsecutive_1", "signature": "def longestConsecutive_1(self, nums)" }, ...
3
stack_v2_sparse_classes_30k_train_016524
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestConsecutive(self, nums): :type nums: List[int] :rtype: int 39ms - def longestConsecutive_1(self, nums): :type nums: List[int] :rtype: int 35ms - def longestConsecutive...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestConsecutive(self, nums): :type nums: List[int] :rtype: int 39ms - def longestConsecutive_1(self, nums): :type nums: List[int] :rtype: int 35ms - def longestConsecutive...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def longestConsecutive(self, nums): """:type nums: List[int] :rtype: int 39ms""" <|body_0|> def longestConsecutive_1(self, nums): """:type nums: List[int] :rtype: int 35ms""" <|body_1|> def longestConsecutive_2(self, nums): """35ms :par...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestConsecutive(self, nums): """:type nums: List[int] :rtype: int 39ms""" max_1 = 0 sets = set(nums) while sets: count = 1 a = list(sets)[0] sets.remove(a) i = a - 1 while sets and i in sets: ...
the_stack_v2_python_sparse
LongestConsecutiveSequence_HARD_128.py
953250587/leetcode-python
train
2
bbb42a497b0e963b76753a2f3e3c564521062add
[ "res = ''\nif root is not None:\n queue = deque()\n queue.append((root, 1))\n index_to_el_dict = {}\n while queue:\n node, index = queue.popleft()\n if node:\n index_to_el_dict[index] = node.val\n queue.append((node.left, 2 * index))\n queue.append((node.ri...
<|body_start_0|> res = '' if root is not None: queue = deque() queue.append((root, 1)) index_to_el_dict = {} while queue: node, index = queue.popleft() if node: index_to_el_dict[index] = node.val ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_015661
3,532
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_010285
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:...
120ea2cd7a29e173d1a8a87eac85b2939c03c06d
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" res = '' if root is not None: queue = deque() queue.append((root, 1)) index_to_el_dict = {} while queue: node, ind...
the_stack_v2_python_sparse
tree/297_serialize_and_deserialize_binary_tree.py
tsimafeip/leetcode
train
0
3106cb9233ae0604f22467633ca8f556cb0207f5
[ "self._r1 = r1\nself._r2 = r2\nself._direction = direction", "delev, dazim = self._direction\nr1 = self._r1\nr2 = self._r2\nx1 = -r1 * np.cos(elev) * np.cos(azim)\ny1 = -r1 * np.cos(elev) * np.sin(azim)\nz1 = r1 * np.sin(elev)\ndx1 = -np.cos(delev) * np.cos(dazim)\ndy1 = -np.cos(delev) * np.sin(dazim)\ndz1 = np.s...
<|body_start_0|> self._r1 = r1 self._r2 = r2 self._direction = direction <|end_body_0|> <|body_start_1|> delev, dazim = self._direction r1 = self._r1 r2 = self._r2 x1 = -r1 * np.cos(elev) * np.cos(azim) y1 = -r1 * np.cos(elev) * np.sin(azim) z1 = ...
SphereToCylinderMap
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SphereToCylinderMap: def __init__(self, r1, r2, direction): """r1: sphere radius r2: cylinder radius direction: can be a tuple or a list of 2 elements elevation, azimuth""" <|body_0|> def map(self, elev, azim): """z = 0 corresponds to azimuth 0 or pi z = max at azimu...
stack_v2_sparse_classes_36k_train_015662
16,243
permissive
[ { "docstring": "r1: sphere radius r2: cylinder radius direction: can be a tuple or a list of 2 elements elevation, azimuth", "name": "__init__", "signature": "def __init__(self, r1, r2, direction)" }, { "docstring": "z = 0 corresponds to azimuth 0 or pi z = max at azimuth -pi/2 axes were chosen ...
3
stack_v2_sparse_classes_30k_train_010820
Implement the Python class `SphereToCylinderMap` described below. Class description: Implement the SphereToCylinderMap class. Method signatures and docstrings: - def __init__(self, r1, r2, direction): r1: sphere radius r2: cylinder radius direction: can be a tuple or a list of 2 elements elevation, azimuth - def map(...
Implement the Python class `SphereToCylinderMap` described below. Class description: Implement the SphereToCylinderMap class. Method signatures and docstrings: - def __init__(self, r1, r2, direction): r1: sphere radius r2: cylinder radius direction: can be a tuple or a list of 2 elements elevation, azimuth - def map(...
fdab351e6c5530c8f051193158856ba6ef11d715
<|skeleton|> class SphereToCylinderMap: def __init__(self, r1, r2, direction): """r1: sphere radius r2: cylinder radius direction: can be a tuple or a list of 2 elements elevation, azimuth""" <|body_0|> def map(self, elev, azim): """z = 0 corresponds to azimuth 0 or pi z = max at azimu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SphereToCylinderMap: def __init__(self, r1, r2, direction): """r1: sphere radius r2: cylinder radius direction: can be a tuple or a list of 2 elements elevation, azimuth""" self._r1 = r1 self._r2 = r2 self._direction = direction def map(self, elev, azim): """z = 0 ...
the_stack_v2_python_sparse
retina/screen/map/mapimpl.py
neurokernel/retina
train
5
40b1e63017e6d987de88ee28b1e8ad47c400bbef
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn PlannerTaskDetails()", "from .entity import Entity\nfrom .planner_checklist_items import PlannerChecklistItems\nfrom .planner_external_references import PlannerExternalReferences\nfrom .planner_preview_type import PlannerPreviewType\nf...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return PlannerTaskDetails() <|end_body_0|> <|body_start_1|> from .entity import Entity from .planner_checklist_items import PlannerChecklistItems from .planner_external_references impor...
PlannerTaskDetails
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PlannerTaskDetails: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> PlannerTaskDetails: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the obje...
stack_v2_sparse_classes_36k_train_015663
3,591
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: PlannerTaskDetails", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_...
3
null
Implement the Python class `PlannerTaskDetails` described below. Class description: Implement the PlannerTaskDetails class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> PlannerTaskDetails: Creates a new instance of the appropriate class based on disc...
Implement the Python class `PlannerTaskDetails` described below. Class description: Implement the PlannerTaskDetails class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> PlannerTaskDetails: Creates a new instance of the appropriate class based on disc...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class PlannerTaskDetails: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> PlannerTaskDetails: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the obje...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PlannerTaskDetails: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> PlannerTaskDetails: """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: Pl...
the_stack_v2_python_sparse
msgraph/generated/models/planner_task_details.py
microsoftgraph/msgraph-sdk-python
train
135
4cb1f4fc2217cad4fc531b53081abd7590cf9906
[ "self.capacity = capacity\nself.c_size = 0\nself.history = []\nself._data = {}", "if self._data.get(key, None) is None:\n return -1\nelse:\n self.history.remove(key)\n self.history.append(key)\nreturn self._data.get(key)", "if self._data.get(key, -1) == -1:\n if self.c_size == self.capacity:\n ...
<|body_start_0|> self.capacity = capacity self.c_size = 0 self.history = [] self._data = {} <|end_body_0|> <|body_start_1|> if self._data.get(key, None) is None: return -1 else: self.history.remove(key) self.history.append(key) ...
LRUCache_On_List_sol
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache_On_List_sol: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:rtype: int""" <|body_1|> def set(self, key, value): """:type key: int :type value: int :rtype: nothing""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k_train_015664
4,563
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: nothing", "name": "set", "sig...
3
stack_v2_sparse_classes_30k_train_010335
Implement the Python class `LRUCache_On_List_sol` described below. Class description: Implement the LRUCache_On_List_sol class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :rtype: int - def set(self, key, value): :type key: int :type value: int :rtype: n...
Implement the Python class `LRUCache_On_List_sol` described below. Class description: Implement the LRUCache_On_List_sol class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :rtype: int - def set(self, key, value): :type key: int :type value: int :rtype: n...
d308e0e41c288f23a846b8505e572943d30b1392
<|skeleton|> class LRUCache_On_List_sol: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:rtype: int""" <|body_1|> def set(self, key, value): """:type key: int :type value: int :rtype: nothing""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LRUCache_On_List_sol: def __init__(self, capacity): """:type capacity: int""" self.capacity = capacity self.c_size = 0 self.history = [] self._data = {} def get(self, key): """:rtype: int""" if self._data.get(key, None) is None: return -...
the_stack_v2_python_sparse
python/146_LRU_Cache.py
HankerZheng/LeetCode-Problems
train
2
8443889d7c9b25c593b4fdd14bbcb8cae5e2e6f8
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn DeviceComplianceActionItem()", "from .device_compliance_action_type import DeviceComplianceActionType\nfrom .entity import Entity\nfrom .device_compliance_action_type import DeviceComplianceActionType\nfrom .entity import Entity\nfield...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return DeviceComplianceActionItem() <|end_body_0|> <|body_start_1|> from .device_compliance_action_type import DeviceComplianceActionType from .entity import Entity from .device_complia...
Scheduled Action Configuration
DeviceComplianceActionItem
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeviceComplianceActionItem: """Scheduled Action Configuration""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DeviceComplianceActionItem: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node t...
stack_v2_sparse_classes_36k_train_015665
3,346
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: DeviceComplianceActionItem", "name": "create_from_discriminator_value", "signature": "def create_from_discri...
3
stack_v2_sparse_classes_30k_train_000449
Implement the Python class `DeviceComplianceActionItem` described below. Class description: Scheduled Action Configuration Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DeviceComplianceActionItem: Creates a new instance of the appropriate class based ...
Implement the Python class `DeviceComplianceActionItem` described below. Class description: Scheduled Action Configuration Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DeviceComplianceActionItem: Creates a new instance of the appropriate class based ...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class DeviceComplianceActionItem: """Scheduled Action Configuration""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DeviceComplianceActionItem: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DeviceComplianceActionItem: """Scheduled Action Configuration""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DeviceComplianceActionItem: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read...
the_stack_v2_python_sparse
msgraph/generated/models/device_compliance_action_item.py
microsoftgraph/msgraph-sdk-python
train
135
0c1b699d18933ca76dcc0358803abd2a50a8c082
[ "feats = self.hparams.compute_stft(wavs)\nfeats = self.hparams.spectral_magnitude(feats)\nreturn torch.log1p(feats)", "noisy = noisy.to(self.device)\nnoisy_features = self.compute_features(noisy)\nif lengths is not None:\n mask = self.modules.enhance_model(noisy_features, lengths=lengths)\nelse:\n mask = se...
<|body_start_0|> feats = self.hparams.compute_stft(wavs) feats = self.hparams.spectral_magnitude(feats) return torch.log1p(feats) <|end_body_0|> <|body_start_1|> noisy = noisy.to(self.device) noisy_features = self.compute_features(noisy) if lengths is not None: ...
A ready-to-use model for speech enhancement. Arguments --------- See ``Pretrained``. Example ------- >>> import torchaudio >>> from speechbrain.pretrained import SpectralMaskEnhancement >>> # Model is downloaded from the speechbrain HuggingFace repo >>> tmpdir = getfixture("tmpdir") >>> enhancer = SpectralMaskEnhanceme...
SpectralMaskEnhancement
[ "Apache-2.0", "BSD-2-Clause", "MIT", "BSD-3-Clause", "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-unknown-license-reference", "GPL-1.0-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpectralMaskEnhancement: """A ready-to-use model for speech enhancement. Arguments --------- See ``Pretrained``. Example ------- >>> import torchaudio >>> from speechbrain.pretrained import SpectralMaskEnhancement >>> # Model is downloaded from the speechbrain HuggingFace repo >>> tmpdir = getfix...
stack_v2_sparse_classes_36k_train_015666
35,100
permissive
[ { "docstring": "Compute the log spectral magnitude features for masking. Arguments --------- wavs : torch.tensor A batch of waveforms to convert to log spectral mags.", "name": "compute_features", "signature": "def compute_features(self, wavs)" }, { "docstring": "Enhance a batch of noisy wavefor...
3
stack_v2_sparse_classes_30k_train_010801
Implement the Python class `SpectralMaskEnhancement` described below. Class description: A ready-to-use model for speech enhancement. Arguments --------- See ``Pretrained``. Example ------- >>> import torchaudio >>> from speechbrain.pretrained import SpectralMaskEnhancement >>> # Model is downloaded from the speechbra...
Implement the Python class `SpectralMaskEnhancement` described below. Class description: A ready-to-use model for speech enhancement. Arguments --------- See ``Pretrained``. Example ------- >>> import torchaudio >>> from speechbrain.pretrained import SpectralMaskEnhancement >>> # Model is downloaded from the speechbra...
92acc188d3a0f634de58463b6676e70df83ef808
<|skeleton|> class SpectralMaskEnhancement: """A ready-to-use model for speech enhancement. Arguments --------- See ``Pretrained``. Example ------- >>> import torchaudio >>> from speechbrain.pretrained import SpectralMaskEnhancement >>> # Model is downloaded from the speechbrain HuggingFace repo >>> tmpdir = getfix...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SpectralMaskEnhancement: """A ready-to-use model for speech enhancement. Arguments --------- See ``Pretrained``. Example ------- >>> import torchaudio >>> from speechbrain.pretrained import SpectralMaskEnhancement >>> # Model is downloaded from the speechbrain HuggingFace repo >>> tmpdir = getfixture("tmpdir"...
the_stack_v2_python_sparse
ACL_PyTorch/contrib/audio/tdnn/interfaces.py
Ascend/ModelZoo-PyTorch
train
23
9ef58a2323237dd6cdbddb991ff2d0980acc14b8
[ "super(IperfSession, self).__init__()\nself.iperf_test = iperf_test\nself.nodes = nodes\nself.filename_base = filename_base\nself.tpc = tpc\nself._to_node_expression = None\nself._from_node_expression = None\nself.poll = None\nreturn", "if self._from_node_expression is None:\n self._from_node_expression = re.c...
<|body_start_0|> super(IperfSession, self).__init__() self.iperf_test = iperf_test self.nodes = nodes self.filename_base = filename_base self.tpc = tpc self._to_node_expression = None self._from_node_expression = None self.poll = None return <|end_...
A bundler of nodes and the iperftest
IperfSession
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IperfSession: """A bundler of nodes and the iperftest""" def __init__(self, iperf_test, nodes, tpc, filename_base=None): """IperfSession Constructor :param: - `iperf_test`: a bundle of parameters and storage - `nodes`: id:device pairs - `tpc`: traffic PC device - `filename_base`: An ...
stack_v2_sparse_classes_36k_train_015667
4,629
permissive
[ { "docstring": "IperfSession Constructor :param: - `iperf_test`: a bundle of parameters and storage - `nodes`: id:device pairs - `tpc`: traffic PC device - `filename_base`: An optional string to add to the filename", "name": "__init__", "signature": "def __init__(self, iperf_test, nodes, tpc, filename_b...
6
null
Implement the Python class `IperfSession` described below. Class description: A bundler of nodes and the iperftest Method signatures and docstrings: - def __init__(self, iperf_test, nodes, tpc, filename_base=None): IperfSession Constructor :param: - `iperf_test`: a bundle of parameters and storage - `nodes`: id:devic...
Implement the Python class `IperfSession` described below. Class description: A bundler of nodes and the iperftest Method signatures and docstrings: - def __init__(self, iperf_test, nodes, tpc, filename_base=None): IperfSession Constructor :param: - `iperf_test`: a bundle of parameters and storage - `nodes`: id:devic...
b4d1c77e1d611fe2b30768b42bdc7493afb0ea95
<|skeleton|> class IperfSession: """A bundler of nodes and the iperftest""" def __init__(self, iperf_test, nodes, tpc, filename_base=None): """IperfSession Constructor :param: - `iperf_test`: a bundle of parameters and storage - `nodes`: id:device pairs - `tpc`: traffic PC device - `filename_base`: An ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IperfSession: """A bundler of nodes and the iperftest""" def __init__(self, iperf_test, nodes, tpc, filename_base=None): """IperfSession Constructor :param: - `iperf_test`: a bundle of parameters and storage - `nodes`: id:device pairs - `tpc`: traffic PC device - `filename_base`: An optional stri...
the_stack_v2_python_sparse
apetools/tools/iperfsession.py
russell-n/oldape
train
0
54b887145ecf4fba69389346118b7358b4dc77cb
[ "super(FeaturePyramid, self).__init__()\nif levels is None:\n levels = [3, 4, 5, 6, 7]\nself.levels = levels\nif resnet == 18:\n self.backbone = resnet18(pretrained)\nelif resnet == 34:\n self.backbone = resnet34(pretrained)\nelif resnet == 50:\n self.backbone = resnet50(pretrained)\nelif resnet == 101:...
<|body_start_0|> super(FeaturePyramid, self).__init__() if levels is None: levels = [3, 4, 5, 6, 7] self.levels = levels if resnet == 18: self.backbone = resnet18(pretrained) elif resnet == 34: self.backbone = resnet34(pretrained) elif ...
Feature pyramid network. It takes the natural architecture of a convolutional network to generate a pyramid of features with little extra effort. It merges the outputs of each one of the ResNet layers with the previous one to give more semantically meaning (the deepest the layer the more semantic meaning it has) and th...
FeaturePyramid
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FeaturePyramid: """Feature pyramid network. It takes the natural architecture of a convolutional network to generate a pyramid of features with little extra effort. It merges the outputs of each one of the ResNet layers with the previous one to give more semantically meaning (the deepest the laye...
stack_v2_sparse_classes_36k_train_015668
27,489
no_license
[ { "docstring": "Initialize the network. It init a ResNet with the given depth and use 'features' as the number of channels for each feature map. Args: resnet (int): Indicates the depth of the resnet backbone. features (int): Indicates the depth (number of channels) of each feature map of the pyramid. levels (li...
2
null
Implement the Python class `FeaturePyramid` described below. Class description: Feature pyramid network. It takes the natural architecture of a convolutional network to generate a pyramid of features with little extra effort. It merges the outputs of each one of the ResNet layers with the previous one to give more sem...
Implement the Python class `FeaturePyramid` described below. Class description: Feature pyramid network. It takes the natural architecture of a convolutional network to generate a pyramid of features with little extra effort. It merges the outputs of each one of the ResNet layers with the previous one to give more sem...
a22aa5b00369c2692bf4fa537bce20144d14d5cb
<|skeleton|> class FeaturePyramid: """Feature pyramid network. It takes the natural architecture of a convolutional network to generate a pyramid of features with little extra effort. It merges the outputs of each one of the ResNet layers with the previous one to give more semantically meaning (the deepest the laye...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FeaturePyramid: """Feature pyramid network. It takes the natural architecture of a convolutional network to generate a pyramid of features with little extra effort. It merges the outputs of each one of the ResNet layers with the previous one to give more semantically meaning (the deepest the layer the more se...
the_stack_v2_python_sparse
torchsight/models/retinanet.py
SetaSouto/torchsight
train
2
beb0bec6f5df14be6ea91c0e06c3c2b13193bb36
[ "self._handshakeMD5 = hashlib.md5()\nself._handshakeSHA = hashlib.sha1()\nself._handshakeSHA224 = hashlib.sha224()\nself._handshakeSHA256 = hashlib.sha256()\nself._handshakeSHA384 = hashlib.sha384()\nself._handshakeSHA512 = hashlib.sha512()\nself._handshake_buffer = bytearray()", "text = compat26Str(data)\nself._...
<|body_start_0|> self._handshakeMD5 = hashlib.md5() self._handshakeSHA = hashlib.sha1() self._handshakeSHA224 = hashlib.sha224() self._handshakeSHA256 = hashlib.sha256() self._handshakeSHA384 = hashlib.sha384() self._handshakeSHA512 = hashlib.sha512() self._handsh...
Store and calculate necessary hashes for handshake protocol Calculates message digests of messages exchanged in handshake protocol of SSLv3 and TLS.
HandshakeHashes
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HandshakeHashes: """Store and calculate necessary hashes for handshake protocol Calculates message digests of messages exchanged in handshake protocol of SSLv3 and TLS.""" def __init__(self): """Create instance""" <|body_0|> def update(self, data): """Add `data` ...
stack_v2_sparse_classes_36k_train_015669
4,137
permissive
[ { "docstring": "Create instance", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Add `data` to hash input. :param bytearray data: serialized TLS handshake message", "name": "update", "signature": "def update(self, data)" }, { "docstring": "Calculate and ...
5
null
Implement the Python class `HandshakeHashes` described below. Class description: Store and calculate necessary hashes for handshake protocol Calculates message digests of messages exchanged in handshake protocol of SSLv3 and TLS. Method signatures and docstrings: - def __init__(self): Create instance - def update(sel...
Implement the Python class `HandshakeHashes` described below. Class description: Store and calculate necessary hashes for handshake protocol Calculates message digests of messages exchanged in handshake protocol of SSLv3 and TLS. Method signatures and docstrings: - def __init__(self): Create instance - def update(sel...
541f58da464296001109f9cfbb879256957b3819
<|skeleton|> class HandshakeHashes: """Store and calculate necessary hashes for handshake protocol Calculates message digests of messages exchanged in handshake protocol of SSLv3 and TLS.""" def __init__(self): """Create instance""" <|body_0|> def update(self, data): """Add `data` ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HandshakeHashes: """Store and calculate necessary hashes for handshake protocol Calculates message digests of messages exchanged in handshake protocol of SSLv3 and TLS.""" def __init__(self): """Create instance""" self._handshakeMD5 = hashlib.md5() self._handshakeSHA = hashlib.sha...
the_stack_v2_python_sparse
code/default/lib/noarch/tlslite/handshakehashes.py
XX-net/XX-Net
train
40,250
f8c75968f4903ed95adf9b87115d353d39277f83
[ "WAS_ZERO = 'zero'\n\ndef mark(val):\n return WAS_ZERO if val == 0 else 0\nfor row in range(len(matrix)):\n for value in matrix[row]:\n if value == 0:\n matrix[row] = [mark(v) for v in matrix[row]]\n break\nfor row in range(len(matrix)):\n for col, value in enumerate(matrix[row...
<|body_start_0|> WAS_ZERO = 'zero' def mark(val): return WAS_ZERO if val == 0 else 0 for row in range(len(matrix)): for value in matrix[row]: if value == 0: matrix[row] = [mark(v) for v in matrix[row]] break ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def setZeroes(self, matrix: List[List[int]]) -> None: """Do not return anything, modify matrix in-place instead.""" <|body_0|> def setZeroes2(self, matrix: List[List[int]]) -> None: """Do not return anything, modify matrix in-place instead.""" <|bod...
stack_v2_sparse_classes_36k_train_015670
3,470
no_license
[ { "docstring": "Do not return anything, modify matrix in-place instead.", "name": "setZeroes", "signature": "def setZeroes(self, matrix: List[List[int]]) -> None" }, { "docstring": "Do not return anything, modify matrix in-place instead.", "name": "setZeroes2", "signature": "def setZeroe...
3
stack_v2_sparse_classes_30k_test_000591
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def setZeroes(self, matrix: List[List[int]]) -> None: Do not return anything, modify matrix in-place instead. - def setZeroes2(self, matrix: List[List[int]]) -> None: Do not retu...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def setZeroes(self, matrix: List[List[int]]) -> None: Do not return anything, modify matrix in-place instead. - def setZeroes2(self, matrix: List[List[int]]) -> None: Do not retu...
77fcd5520b018bd96dd253300b66c6d5dc06fa05
<|skeleton|> class Solution: def setZeroes(self, matrix: List[List[int]]) -> None: """Do not return anything, modify matrix in-place instead.""" <|body_0|> def setZeroes2(self, matrix: List[List[int]]) -> None: """Do not return anything, modify matrix in-place instead.""" <|bod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def setZeroes(self, matrix: List[List[int]]) -> None: """Do not return anything, modify matrix in-place instead.""" WAS_ZERO = 'zero' def mark(val): return WAS_ZERO if val == 0 else 0 for row in range(len(matrix)): for value in matrix[row]: ...
the_stack_v2_python_sparse
leetcode/set-matrix-zeroes.py
murbar/code-challenges
train
0
9bea945aefe2568c360c83b43c0e59a3f5fafed0
[ "if not self.options.physical.user or not self.options.physical.password:\n raise CuckooCriticalError('Physical machine credentials are missing, please add it to the config file')\nfor machine in self.machines():\n if self._status(machine.label) != self.RUNNING:\n raise CuckooCriticalError('Physical ma...
<|body_start_0|> if not self.options.physical.user or not self.options.physical.password: raise CuckooCriticalError('Physical machine credentials are missing, please add it to the config file') for machine in self.machines(): if self._status(machine.label) != self.RUNNING: ...
Manage physical sandboxes.
Physical
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Physical: """Manage physical sandboxes.""" def _initialize_check(self): """Ensures that credentials have been entered into the config file. @raise CuckooCriticalError: if no credentials were provided or if one or more physical machines are offline.""" <|body_0|> def _get...
stack_v2_sparse_classes_36k_train_015671
5,469
no_license
[ { "docstring": "Ensures that credentials have been entered into the config file. @raise CuckooCriticalError: if no credentials were provided or if one or more physical machines are offline.", "name": "_initialize_check", "signature": "def _initialize_check(self)" }, { "docstring": "Retrieve all ...
6
stack_v2_sparse_classes_30k_train_000899
Implement the Python class `Physical` described below. Class description: Manage physical sandboxes. Method signatures and docstrings: - def _initialize_check(self): Ensures that credentials have been entered into the config file. @raise CuckooCriticalError: if no credentials were provided or if one or more physical ...
Implement the Python class `Physical` described below. Class description: Manage physical sandboxes. Method signatures and docstrings: - def _initialize_check(self): Ensures that credentials have been entered into the config file. @raise CuckooCriticalError: if no credentials were provided or if one or more physical ...
36434f6b8f80833b2328eb096ac239f7932a1eb3
<|skeleton|> class Physical: """Manage physical sandboxes.""" def _initialize_check(self): """Ensures that credentials have been entered into the config file. @raise CuckooCriticalError: if no credentials were provided or if one or more physical machines are offline.""" <|body_0|> def _get...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Physical: """Manage physical sandboxes.""" def _initialize_check(self): """Ensures that credentials have been entered into the config file. @raise CuckooCriticalError: if no credentials were provided or if one or more physical machines are offline.""" if not self.options.physical.user or ...
the_stack_v2_python_sparse
modules/machinery/physical.py
open-nsm/dockoo-cuckoo
train
5
35721b281e378d157b40921d19fa4301e55ff95d
[ "url = 'os-quota-sets/%s' % tenant_id\nif user_id:\n url += '?user_id=%s' % user_id\nresp, body = self.get(url)\nbody = json.loads(body)\nself.validate_response(schema.get_quota_set, resp, body)\nreturn rest_client.ResponseBody(resp, body)", "url = 'os-quota-sets/%s/defaults' % tenant_id\nresp, body = self.get...
<|body_start_0|> url = 'os-quota-sets/%s' % tenant_id if user_id: url += '?user_id=%s' % user_id resp, body = self.get(url) body = json.loads(body) self.validate_response(schema.get_quota_set, resp, body) return rest_client.ResponseBody(resp, body) <|end_body_...
QuotasClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuotasClient: def show_quota_set(self, tenant_id, user_id=None): """List the quota set for a tenant.""" <|body_0|> def show_default_quota_set(self, tenant_id): """List the default quota set for a tenant.""" <|body_1|> def update_quota_set(self, tenant_id...
stack_v2_sparse_classes_36k_train_015672
2,700
permissive
[ { "docstring": "List the quota set for a tenant.", "name": "show_quota_set", "signature": "def show_quota_set(self, tenant_id, user_id=None)" }, { "docstring": "List the default quota set for a tenant.", "name": "show_default_quota_set", "signature": "def show_default_quota_set(self, ten...
4
stack_v2_sparse_classes_30k_train_006729
Implement the Python class `QuotasClient` described below. Class description: Implement the QuotasClient class. Method signatures and docstrings: - def show_quota_set(self, tenant_id, user_id=None): List the quota set for a tenant. - def show_default_quota_set(self, tenant_id): List the default quota set for a tenant...
Implement the Python class `QuotasClient` described below. Class description: Implement the QuotasClient class. Method signatures and docstrings: - def show_quota_set(self, tenant_id, user_id=None): List the quota set for a tenant. - def show_default_quota_set(self, tenant_id): List the default quota set for a tenant...
78c71b3bc74144ee5d2a77707d7f195b96ad09b4
<|skeleton|> class QuotasClient: def show_quota_set(self, tenant_id, user_id=None): """List the quota set for a tenant.""" <|body_0|> def show_default_quota_set(self, tenant_id): """List the default quota set for a tenant.""" <|body_1|> def update_quota_set(self, tenant_id...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QuotasClient: def show_quota_set(self, tenant_id, user_id=None): """List the quota set for a tenant.""" url = 'os-quota-sets/%s' % tenant_id if user_id: url += '?user_id=%s' % user_id resp, body = self.get(url) body = json.loads(body) self.validate_r...
the_stack_v2_python_sparse
tempest/lib/services/compute/quotas_client.py
microsoft/LIS-Tempest
train
1
6f137be05acf7b2d58e24805acf1ad00abfe6b62
[ "super().__init__(entry, controller, poolObject, **kwargs)\nself._bodies = set(poolObject[BODY_ATTR].split(' '))\nself._attr_icon = 'mdi:fire-circle'", "for bodyObjnam in self._bodies:\n body = self._controller.model[bodyObjnam]\n if body[STATUS_ATTR] == 'ON' and body[HEATER_ATTR] == self._poolObject.objnam...
<|body_start_0|> super().__init__(entry, controller, poolObject, **kwargs) self._bodies = set(poolObject[BODY_ATTR].split(' ')) self._attr_icon = 'mdi:fire-circle' <|end_body_0|> <|body_start_1|> for bodyObjnam in self._bodies: body = self._controller.model[bodyObjnam] ...
Representation of a Heater binary sensor.
HeaterBinarySensor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HeaterBinarySensor: """Representation of a Heater binary sensor.""" def __init__(self, entry: ConfigEntry, controller: ModelController, poolObject: PoolObject, **kwargs): """Initialize.""" <|body_0|> def is_on(self) -> bool: """Return true if sensor is on.""" ...
stack_v2_sparse_classes_36k_train_015673
4,015
no_license
[ { "docstring": "Initialize.", "name": "__init__", "signature": "def __init__(self, entry: ConfigEntry, controller: ModelController, poolObject: PoolObject, **kwargs)" }, { "docstring": "Return true if sensor is on.", "name": "is_on", "signature": "def is_on(self) -> bool" }, { "d...
3
stack_v2_sparse_classes_30k_train_018079
Implement the Python class `HeaterBinarySensor` described below. Class description: Representation of a Heater binary sensor. Method signatures and docstrings: - def __init__(self, entry: ConfigEntry, controller: ModelController, poolObject: PoolObject, **kwargs): Initialize. - def is_on(self) -> bool: Return true if...
Implement the Python class `HeaterBinarySensor` described below. Class description: Representation of a Heater binary sensor. Method signatures and docstrings: - def __init__(self, entry: ConfigEntry, controller: ModelController, poolObject: PoolObject, **kwargs): Initialize. - def is_on(self) -> bool: Return true if...
625290c164c60611f501ee773583c06a85281300
<|skeleton|> class HeaterBinarySensor: """Representation of a Heater binary sensor.""" def __init__(self, entry: ConfigEntry, controller: ModelController, poolObject: PoolObject, **kwargs): """Initialize.""" <|body_0|> def is_on(self) -> bool: """Return true if sensor is on.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HeaterBinarySensor: """Representation of a Heater binary sensor.""" def __init__(self, entry: ConfigEntry, controller: ModelController, poolObject: PoolObject, **kwargs): """Initialize.""" super().__init__(entry, controller, poolObject, **kwargs) self._bodies = set(poolObject[BODY...
the_stack_v2_python_sparse
custom_components/intellicenter/binary_sensor.py
ntalekt/homeassistant
train
213
25b33e171a3d0eed61c12b13e6221e0e5a0ecd3e
[ "if not one_step:\n return\nnode_info = one_step.split(', ')\nnode_name, node_start, node_end, queue_size = ('', 0, 0, 0)\nif node_info:\n node_name = node_info[0].replace('Node:', '')\nif len(node_info) > 3:\n if 'queue' in node_info[1]:\n queue_size = node_info[1].replace('queue size:', '')\n ...
<|body_start_0|> if not one_step: return node_info = one_step.split(', ') node_name, node_start, node_end, queue_size = ('', 0, 0, 0) if node_info: node_name = node_info[0].replace('Node:', '') if len(node_info) > 3: if 'queue' in node_info[1]:...
Minddata Aicpu Parser.
MinddataParser
[ "Apache-2.0", "LicenseRef-scancode-proprietary-license", "MPL-1.0", "OpenSSL", "LGPL-3.0-only", "LicenseRef-scancode-warranty-disclaimer", "BSD-3-Clause-Open-MPI", "MIT", "MPL-2.0-no-copyleft-exception", "NTP", "BSD-3-Clause", "GPL-1.0-or-later", "0BSD", "MPL-2.0", "LicenseRef-scancode-f...
stack_v2_sparse_python_classes_v1
<|skeleton|> class MinddataParser: """Minddata Aicpu Parser.""" def parse_step_minddata_aicpu_data(one_step, result): """Parse step mind_data ai_cpu data. Args: one_step (str): The mind_data step info text, it is one of two structures. Type queue: node_name,queue_size,run_start,run_end Type run: node_n...
stack_v2_sparse_classes_36k_train_015674
5,228
permissive
[ { "docstring": "Parse step mind_data ai_cpu data. Args: one_step (str): The mind_data step info text, it is one of two structures. Type queue: node_name,queue_size,run_start,run_end Type run: node_name,run_start,run_end,queue_size result ([[node_name, node_start, node_end, queue_size]]): Step info list.", "...
3
null
Implement the Python class `MinddataParser` described below. Class description: Minddata Aicpu Parser. Method signatures and docstrings: - def parse_step_minddata_aicpu_data(one_step, result): Parse step mind_data ai_cpu data. Args: one_step (str): The mind_data step info text, it is one of two structures. Type queue...
Implement the Python class `MinddataParser` described below. Class description: Minddata Aicpu Parser. Method signatures and docstrings: - def parse_step_minddata_aicpu_data(one_step, result): Parse step mind_data ai_cpu data. Args: one_step (str): The mind_data step info text, it is one of two structures. Type queue...
54acb15d435533c815ee1bd9f6dc0b56b4d4cf83
<|skeleton|> class MinddataParser: """Minddata Aicpu Parser.""" def parse_step_minddata_aicpu_data(one_step, result): """Parse step mind_data ai_cpu data. Args: one_step (str): The mind_data step info text, it is one of two structures. Type queue: node_name,queue_size,run_start,run_end Type run: node_n...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MinddataParser: """Minddata Aicpu Parser.""" def parse_step_minddata_aicpu_data(one_step, result): """Parse step mind_data ai_cpu data. Args: one_step (str): The mind_data step info text, it is one of two structures. Type queue: node_name,queue_size,run_start,run_end Type run: node_name,run_start...
the_stack_v2_python_sparse
mindspore/python/mindspore/profiler/parser/minddata_parser.py
mindspore-ai/mindspore
train
4,178
22a8adaa22876d2062cd7afdba35ab59f7a23a67
[ "context = context or {}\nres = {}\nuom = context and context.get('uom', False) or False\nif 'uom' in fields:\n res.update({'uom': uom})\nif 'sign' in fields:\n res.update({'sign': '+'})\nif 'variation' in fields:\n res.update({'variation': 0.0})\nreturn res", "context = context or {}\norder_line_obj = s...
<|body_start_0|> context = context or {} res = {} uom = context and context.get('uom', False) or False if 'uom' in fields: res.update({'uom': uom}) if 'sign' in fields: res.update({'sign': '+'}) if 'variation' in fields: res.update({'va...
consignment_variation_po
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class consignment_variation_po: def default_get(self, cr, uid, fields, context=None): """-Process -To set default value""" <|body_0|> def to_update(self, cr, uid, ids, context=None): """- Process - update variation on lines, just for only information purpose""" <|b...
stack_v2_sparse_classes_36k_train_015675
2,646
no_license
[ { "docstring": "-Process -To set default value", "name": "default_get", "signature": "def default_get(self, cr, uid, fields, context=None)" }, { "docstring": "- Process - update variation on lines, just for only information purpose", "name": "to_update", "signature": "def to_update(self,...
2
stack_v2_sparse_classes_30k_train_002810
Implement the Python class `consignment_variation_po` described below. Class description: Implement the consignment_variation_po class. Method signatures and docstrings: - def default_get(self, cr, uid, fields, context=None): -Process -To set default value - def to_update(self, cr, uid, ids, context=None): - Process ...
Implement the Python class `consignment_variation_po` described below. Class description: Implement the consignment_variation_po class. Method signatures and docstrings: - def default_get(self, cr, uid, fields, context=None): -Process -To set default value - def to_update(self, cr, uid, ids, context=None): - Process ...
d3daac105636ac4e146816232c616298dc5bb742
<|skeleton|> class consignment_variation_po: def default_get(self, cr, uid, fields, context=None): """-Process -To set default value""" <|body_0|> def to_update(self, cr, uid, ids, context=None): """- Process - update variation on lines, just for only information purpose""" <|b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class consignment_variation_po: def default_get(self, cr, uid, fields, context=None): """-Process -To set default value""" context = context or {} res = {} uom = context and context.get('uom', False) or False if 'uom' in fields: res.update({'uom': uom}) if...
the_stack_v2_python_sparse
l10n_in_mrp_subcontract/wizard/consignment_variation_po.py
Odoo-India/odoo-india
train
10
3c81595b2388cde33c8b97271b8bfaaf153718d3
[ "self._init_attrs()\nself.data = data\nself.delimiter = delimiter\nself.indent = indent\nself.sep = sep", "data = self.data.strip()\nsections = data.split(self.sep)\nret_dict = {}\nfor section in sections:\n section_data = self._parse_as_dict(section)\n ret_dict.update(section_data)\nreturn ret_dict", "da...
<|body_start_0|> self._init_attrs() self.data = data self.delimiter = delimiter self.indent = indent self.sep = sep <|end_body_0|> <|body_start_1|> data = self.data.strip() sections = data.split(self.sep) ret_dict = {} for section in sections: ...
Class to parse cmd output Tailored to 'netsh {interface} show networks mode=bssid' Also works for showing interfaces
CmdSoup
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CmdSoup: """Class to parse cmd output Tailored to 'netsh {interface} show networks mode=bssid' Also works for showing interfaces""" def __init__(self, data, delimiter=':', indent=' ', sep='\n\n'): """Initialises self.""" <|body_0|> def as_dict(self): """Parses...
stack_v2_sparse_classes_36k_train_015676
2,802
no_license
[ { "docstring": "Initialises self.", "name": "__init__", "signature": "def __init__(self, data, delimiter=':', indent=' ', sep='\\n\\n')" }, { "docstring": "Parses self.data, returning a dictionary of its contents", "name": "as_dict", "signature": "def as_dict(self)" }, { "docs...
5
stack_v2_sparse_classes_30k_train_017489
Implement the Python class `CmdSoup` described below. Class description: Class to parse cmd output Tailored to 'netsh {interface} show networks mode=bssid' Also works for showing interfaces Method signatures and docstrings: - def __init__(self, data, delimiter=':', indent=' ', sep='\n\n'): Initialises self. - def ...
Implement the Python class `CmdSoup` described below. Class description: Class to parse cmd output Tailored to 'netsh {interface} show networks mode=bssid' Also works for showing interfaces Method signatures and docstrings: - def __init__(self, data, delimiter=':', indent=' ', sep='\n\n'): Initialises self. - def ...
7d370342f34e26e6e66718ae397eb1d81253cd8a
<|skeleton|> class CmdSoup: """Class to parse cmd output Tailored to 'netsh {interface} show networks mode=bssid' Also works for showing interfaces""" def __init__(self, data, delimiter=':', indent=' ', sep='\n\n'): """Initialises self.""" <|body_0|> def as_dict(self): """Parses...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CmdSoup: """Class to parse cmd output Tailored to 'netsh {interface} show networks mode=bssid' Also works for showing interfaces""" def __init__(self, data, delimiter=':', indent=' ', sep='\n\n'): """Initialises self.""" self._init_attrs() self.data = data self.delimite...
the_stack_v2_python_sparse
yatwin/onekeywifi/network/netsh/cmdsoup/CmdSoup.py
andre95d/python-yatwin
train
0
0c2c64f1f55803c137a85775fefc1ad648fb8969
[ "self.id_db_int_DBI = id_db_int_DBI\nself.designation_source = designation_source\nself.database_name = database_name", "listOfDomainsSources = []\nsqlObj = _DB_interaction_DDI_SQL(db_name=self.database_name)\nresults = sqlObj.select_all_sources_DDI_name()\nfor element in results:\n listOfDomainsSources.append...
<|body_start_0|> self.id_db_int_DBI = id_db_int_DBI self.designation_source = designation_source self.database_name = database_name <|end_body_0|> <|body_start_1|> listOfDomainsSources = [] sqlObj = _DB_interaction_DDI_SQL(db_name=self.database_name) results = sqlObj.sel...
This class treat the source that give the information about the DDI object has it exists in DB_interaction_DDI table database By default, all FK are in the lasts positions in the parameters declaration
DB_interaction_DDI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DB_interaction_DDI: """This class treat the source that give the information about the DDI object has it exists in DB_interaction_DDI table database By default, all FK are in the lasts positions in the parameters declaration""" def __init__(self, id_db_int_DBI=-1, designation_source='', data...
stack_v2_sparse_classes_36k_train_015677
2,715
permissive
[ { "docstring": "Constructor of the DDI source data object. All the parameters have a default value :param id_db_int_DBI: id of DDI interaction - -1 if unknown :param designation_source: id of the domain A :param database_name: name of the database. See Factory_databases_access :type id_db_int_DBI: int - not req...
4
stack_v2_sparse_classes_30k_train_020633
Implement the Python class `DB_interaction_DDI` described below. Class description: This class treat the source that give the information about the DDI object has it exists in DB_interaction_DDI table database By default, all FK are in the lasts positions in the parameters declaration Method signatures and docstrings...
Implement the Python class `DB_interaction_DDI` described below. Class description: This class treat the source that give the information about the DDI object has it exists in DB_interaction_DDI table database By default, all FK are in the lasts positions in the parameters declaration Method signatures and docstrings...
862eb85746e8a3a9bbc0d6aef9abbd5eebe9765f
<|skeleton|> class DB_interaction_DDI: """This class treat the source that give the information about the DDI object has it exists in DB_interaction_DDI table database By default, all FK are in the lasts positions in the parameters declaration""" def __init__(self, id_db_int_DBI=-1, designation_source='', data...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DB_interaction_DDI: """This class treat the source that give the information about the DDI object has it exists in DB_interaction_DDI table database By default, all FK are in the lasts positions in the parameters declaration""" def __init__(self, id_db_int_DBI=-1, designation_source='', database_name='IN...
the_stack_v2_python_sparse
objects_new/DB_interaction_DDI_new.py
diogo1790/inphinity
train
1
b07d1f7fa062e4a5ce29e994de29f7ff6e33facb
[ "_validate_epsilon_delta(total_epsilon, total_delta)\nself._total_epsilon = total_epsilon\nself._total_delta = total_delta\nself._mechanisms = []", "if count != 1 or noise_standard_deviation is not None:\n raise NotImplementedError('Count and noise standard deviation have not been implemented yet.')\nif mechan...
<|body_start_0|> _validate_epsilon_delta(total_epsilon, total_delta) self._total_epsilon = total_epsilon self._total_delta = total_delta self._mechanisms = [] <|end_body_0|> <|body_start_1|> if count != 1 or noise_standard_deviation is not None: raise NotImplementedE...
Manages the privacy budget.
NaiveBudgetAccountant
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NaiveBudgetAccountant: """Manages the privacy budget.""" def __init__(self, total_epsilon: float, total_delta: float): """Constructs a NaiveBudgetAccountant. Args: total_epsilon: epsilon for the entire pipeline. total_delta: delta for the entire pipeline. Raises: A ValueError if eith...
stack_v2_sparse_classes_36k_train_015678
14,723
permissive
[ { "docstring": "Constructs a NaiveBudgetAccountant. Args: total_epsilon: epsilon for the entire pipeline. total_delta: delta for the entire pipeline. Raises: A ValueError if either argument is out of range.", "name": "__init__", "signature": "def __init__(self, total_epsilon: float, total_delta: float)"...
3
stack_v2_sparse_classes_30k_train_014812
Implement the Python class `NaiveBudgetAccountant` described below. Class description: Manages the privacy budget. Method signatures and docstrings: - def __init__(self, total_epsilon: float, total_delta: float): Constructs a NaiveBudgetAccountant. Args: total_epsilon: epsilon for the entire pipeline. total_delta: de...
Implement the Python class `NaiveBudgetAccountant` described below. Class description: Manages the privacy budget. Method signatures and docstrings: - def __init__(self, total_epsilon: float, total_delta: float): Constructs a NaiveBudgetAccountant. Args: total_epsilon: epsilon for the entire pipeline. total_delta: de...
fdc64a80a35336ed9e6a0956b23c118c6012ca01
<|skeleton|> class NaiveBudgetAccountant: """Manages the privacy budget.""" def __init__(self, total_epsilon: float, total_delta: float): """Constructs a NaiveBudgetAccountant. Args: total_epsilon: epsilon for the entire pipeline. total_delta: delta for the entire pipeline. Raises: A ValueError if eith...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NaiveBudgetAccountant: """Manages the privacy budget.""" def __init__(self, total_epsilon: float, total_delta: float): """Constructs a NaiveBudgetAccountant. Args: total_epsilon: epsilon for the entire pipeline. total_delta: delta for the entire pipeline. Raises: A ValueError if either argument i...
the_stack_v2_python_sparse
pipeline_dp/budget_accounting.py
lovroprepolec/PipelineDP
train
0
305572fe9bd59dbccba654884516e2bf5b0421d3
[ "super().__init__()\nhypo_parameters = hypo_module.meta_named_parameters()\nself.names = []\nself.nets = nn.ModuleList()\nself.param_shapes = []\nfor name, param in hypo_parameters:\n self.names.append(name)\n self.param_shapes.append(param.size())\n hn = custom_layers.FCBlock(in_features=hyper_in_features...
<|body_start_0|> super().__init__() hypo_parameters = hypo_module.meta_named_parameters() self.names = [] self.nets = nn.ModuleList() self.param_shapes = [] for name, param in hypo_parameters: self.names.append(name) self.param_shapes.append(param....
HyperNetwork
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HyperNetwork: def __init__(self, hyper_in_features, hyper_hidden_layers, hyper_hidden_features, hypo_module, siren=False): """Args: hyper_in_features: In features of hypernetwork hyper_hidden_layers: Number of hidden layers in hypernetwork hyper_hidden_features: Number of hidden units in...
stack_v2_sparse_classes_36k_train_015679
7,605
no_license
[ { "docstring": "Args: hyper_in_features: In features of hypernetwork hyper_hidden_layers: Number of hidden layers in hypernetwork hyper_hidden_features: Number of hidden units in hypernetwork hypo_module: MetaModule. The module whose parameters are predicted.", "name": "__init__", "signature": "def __in...
2
stack_v2_sparse_classes_30k_train_013431
Implement the Python class `HyperNetwork` described below. Class description: Implement the HyperNetwork class. Method signatures and docstrings: - def __init__(self, hyper_in_features, hyper_hidden_layers, hyper_hidden_features, hypo_module, siren=False): Args: hyper_in_features: In features of hypernetwork hyper_hi...
Implement the Python class `HyperNetwork` described below. Class description: Implement the HyperNetwork class. Method signatures and docstrings: - def __init__(self, hyper_in_features, hyper_hidden_layers, hyper_hidden_features, hypo_module, siren=False): Args: hyper_in_features: In features of hypernetwork hyper_hi...
1c2ba87c6b2cf89f14ea43ec14b179579cbc9220
<|skeleton|> class HyperNetwork: def __init__(self, hyper_in_features, hyper_hidden_layers, hyper_hidden_features, hypo_module, siren=False): """Args: hyper_in_features: In features of hypernetwork hyper_hidden_layers: Number of hidden layers in hypernetwork hyper_hidden_features: Number of hidden units in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HyperNetwork: def __init__(self, hyper_in_features, hyper_hidden_layers, hyper_hidden_features, hypo_module, siren=False): """Args: hyper_in_features: In features of hypernetwork hyper_hidden_layers: Number of hidden layers in hypernetwork hyper_hidden_features: Number of hidden units in hypernetwork ...
the_stack_v2_python_sparse
colf/supplementary_colf/code/hyperlayers.py
cameronosmith/cameronosmith.github.io
train
0
1cc4658348411f1a556b9ab87261f4116b5edb15
[ "count = task_obj.find({'status': 1}).count()\nprint('queue status:1 count: {}'.format(count))\nwhile count >= max_enqueue_num:\n time.sleep(int(count) / 6)\n count = task_obj.find({'status': 1}).count()", "try:\n print('获取爬虫: {} 的同步数据'.format(obj.__class__.__name__))\n result = obj.get_result()\n ...
<|body_start_0|> count = task_obj.find({'status': 1}).count() print('queue status:1 count: {}'.format(count)) while count >= max_enqueue_num: time.sleep(int(count) / 6) count = task_obj.find({'status': 1}).count() <|end_body_0|> <|body_start_1|> try: ...
爬虫项目的工具类
CrawlerHelper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CrawlerHelper: """爬虫项目的工具类""" def delay_by_task_count(task_obj, max_enqueue_num=200): """根据task数量缓慢写入抓取任务 :param task_obj: 查询队列的task mongo实例 :param max_enqueue_num: 写入队列的队列最大值 :return:""" <|body_0|> def get_sync_result(cls, obj, retry=3, delay_time=20): """通用的获取同...
stack_v2_sparse_classes_36k_train_015680
1,942
permissive
[ { "docstring": "根据task数量缓慢写入抓取任务 :param task_obj: 查询队列的task mongo实例 :param max_enqueue_num: 写入队列的队列最大值 :return:", "name": "delay_by_task_count", "signature": "def delay_by_task_count(task_obj, max_enqueue_num=200)" }, { "docstring": "通用的获取同步爬虫请求的方法 :param obj: 同步爬虫的实例 :param retry: 重试次数,默认重试3次 :...
3
null
Implement the Python class `CrawlerHelper` described below. Class description: 爬虫项目的工具类 Method signatures and docstrings: - def delay_by_task_count(task_obj, max_enqueue_num=200): 根据task数量缓慢写入抓取任务 :param task_obj: 查询队列的task mongo实例 :param max_enqueue_num: 写入队列的队列最大值 :return: - def get_sync_result(cls, obj, retry=3, d...
Implement the Python class `CrawlerHelper` described below. Class description: 爬虫项目的工具类 Method signatures and docstrings: - def delay_by_task_count(task_obj, max_enqueue_num=200): 根据task数量缓慢写入抓取任务 :param task_obj: 查询队列的task mongo实例 :param max_enqueue_num: 写入队列的队列最大值 :return: - def get_sync_result(cls, obj, retry=3, d...
29ba13905c73081097df9ef646a5c8194eb024be
<|skeleton|> class CrawlerHelper: """爬虫项目的工具类""" def delay_by_task_count(task_obj, max_enqueue_num=200): """根据task数量缓慢写入抓取任务 :param task_obj: 查询队列的task mongo实例 :param max_enqueue_num: 写入队列的队列最大值 :return:""" <|body_0|> def get_sync_result(cls, obj, retry=3, delay_time=20): """通用的获取同...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CrawlerHelper: """爬虫项目的工具类""" def delay_by_task_count(task_obj, max_enqueue_num=200): """根据task数量缓慢写入抓取任务 :param task_obj: 查询队列的task mongo实例 :param max_enqueue_num: 写入队列的队列最大值 :return:""" count = task_obj.find({'status': 1}).count() print('queue status:1 count: {}'.format(count)) ...
the_stack_v2_python_sparse
pyspider/helper/crawler_utils.py
UoToGK/crawler-pyspider
train
0
439f37b9d5652347b1f8a2ced50d36ca0c819500
[ "super().__init__()\nself.cnn_layers = nn.Sequential()\nself.fc_layers = nn.Sequential()\nself.loss_criterion = None\nself.cnn_layers = nn.Sequential(nn.Conv2d(1, 10, 5), nn.MaxPool2d(3, 3), nn.ReLU(), nn.Conv2d(10, 20, 5), nn.MaxPool2d(3, 3), nn.ReLU(), nn.Flatten())\nself.fc_layers = nn.Sequential(nn.Dropout(0.1)...
<|body_start_0|> super().__init__() self.cnn_layers = nn.Sequential() self.fc_layers = nn.Sequential() self.loss_criterion = None self.cnn_layers = nn.Sequential(nn.Conv2d(1, 10, 5), nn.MaxPool2d(3, 3), nn.ReLU(), nn.Conv2d(10, 20, 5), nn.MaxPool2d(3, 3), nn.ReLU(), nn.Flatten())...
SimpleNetDropout
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimpleNetDropout: def __init__(self): """Init function to define the layers and loss function Note: Use 'sum' reduction in the loss_criterion. Read Pytorch documention to understand what it means""" <|body_0|> def forward(self, x: torch.tensor) -> torch.tensor: """Pe...
stack_v2_sparse_classes_36k_train_015681
1,913
no_license
[ { "docstring": "Init function to define the layers and loss function Note: Use 'sum' reduction in the loss_criterion. Read Pytorch documention to understand what it means", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Perform the forward pass with the net Note: do not...
2
stack_v2_sparse_classes_30k_train_008447
Implement the Python class `SimpleNetDropout` described below. Class description: Implement the SimpleNetDropout class. Method signatures and docstrings: - def __init__(self): Init function to define the layers and loss function Note: Use 'sum' reduction in the loss_criterion. Read Pytorch documention to understand w...
Implement the Python class `SimpleNetDropout` described below. Class description: Implement the SimpleNetDropout class. Method signatures and docstrings: - def __init__(self): Init function to define the layers and loss function Note: Use 'sum' reduction in the loss_criterion. Read Pytorch documention to understand w...
bc48e09844c70f28fc82cdbead405219a964f5aa
<|skeleton|> class SimpleNetDropout: def __init__(self): """Init function to define the layers and loss function Note: Use 'sum' reduction in the loss_criterion. Read Pytorch documention to understand what it means""" <|body_0|> def forward(self, x: torch.tensor) -> torch.tensor: """Pe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SimpleNetDropout: def __init__(self): """Init function to define the layers and loss function Note: Use 'sum' reduction in the loss_criterion. Read Pytorch documention to understand what it means""" super().__init__() self.cnn_layers = nn.Sequential() self.fc_layers = nn.Sequen...
the_stack_v2_python_sparse
Computer Vision/proj2_part2_release/proj2_code/simple_net_dropout.py
karan-sarkar/GT
train
1
5b85be2512696f7634a2fb349bbeaaa342cf6875
[ "crypto_meta_json = self._response_header_value(header_name)\nif crypto_meta_json is None:\n return None\ncrypto_meta = load_crypto_meta(crypto_meta_json)\nif check:\n self.crypto.check_crypto_meta(crypto_meta)\nreturn crypto_meta", "try:\n return self.crypto.unwrap_key(wrapping_key, crypto_meta['body_ke...
<|body_start_0|> crypto_meta_json = self._response_header_value(header_name) if crypto_meta_json is None: return None crypto_meta = load_crypto_meta(crypto_meta_json) if check: self.crypto.check_crypto_meta(crypto_meta) return crypto_meta <|end_body_0|> <...
BaseDecrypterContext
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseDecrypterContext: def get_crypto_meta(self, header_name, check=True): """Extract a crypto_meta dict from a header. :param header_name: name of header that may have crypto_meta :param check: if True validate the crypto meta :return: A dict containing crypto_meta items :raises Encrypti...
stack_v2_sparse_classes_36k_train_015682
20,452
permissive
[ { "docstring": "Extract a crypto_meta dict from a header. :param header_name: name of header that may have crypto_meta :param check: if True validate the crypto meta :return: A dict containing crypto_meta items :raises EncryptionException: if an error occurs while parsing the crypto meta", "name": "get_cryp...
5
stack_v2_sparse_classes_30k_train_016988
Implement the Python class `BaseDecrypterContext` described below. Class description: Implement the BaseDecrypterContext class. Method signatures and docstrings: - def get_crypto_meta(self, header_name, check=True): Extract a crypto_meta dict from a header. :param header_name: name of header that may have crypto_meta...
Implement the Python class `BaseDecrypterContext` described below. Class description: Implement the BaseDecrypterContext class. Method signatures and docstrings: - def get_crypto_meta(self, header_name, check=True): Extract a crypto_meta dict from a header. :param header_name: name of header that may have crypto_meta...
f06e5369579599648cc78e4b556887bc6d978c2b
<|skeleton|> class BaseDecrypterContext: def get_crypto_meta(self, header_name, check=True): """Extract a crypto_meta dict from a header. :param header_name: name of header that may have crypto_meta :param check: if True validate the crypto meta :return: A dict containing crypto_meta items :raises Encrypti...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseDecrypterContext: def get_crypto_meta(self, header_name, check=True): """Extract a crypto_meta dict from a header. :param header_name: name of header that may have crypto_meta :param check: if True validate the crypto meta :return: A dict containing crypto_meta items :raises EncryptionException: i...
the_stack_v2_python_sparse
swift/common/middleware/crypto/decrypter.py
openstack/swift
train
2,370
2cae8616761bbb55d187f020fa1593b431af4d99
[ "self.benchmark_op = benchmark_op\nself.iterations_warmup = iterations_warmup\nself.iterations_benchmark = iterations_benchmark\nself.iterations_timeline = iterations_timeline\nself.graph = graph\nself.config = tf.ConfigProto(graph_options=tf.GraphOptions(optimizer_options=tf.OptimizerOptions(opt_level=tf.Optimizer...
<|body_start_0|> self.benchmark_op = benchmark_op self.iterations_warmup = iterations_warmup self.iterations_benchmark = iterations_benchmark self.iterations_timeline = iterations_timeline self.graph = graph self.config = tf.ConfigProto(graph_options=tf.GraphOptions(optim...
Class for running the benchmarks
benchmark
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class benchmark: """Class for running the benchmarks""" def __init__(self, benchmark_op, iterations_warmup, iterations_benchmark, iterations_timeline, graph): """Initialize benchmark Args: benchmark_op: tf tensor, operation to be executed in benchmark iterations_warmup: Number of iteration...
stack_v2_sparse_classes_36k_train_015683
3,384
permissive
[ { "docstring": "Initialize benchmark Args: benchmark_op: tf tensor, operation to be executed in benchmark iterations_warmup: Number of iterations for warm-up iterations_benchmark: Number of iterations for benchmark iterations_timeline: Number of iterations for generation of timeline graph: tf graph", "name"...
4
stack_v2_sparse_classes_30k_train_007655
Implement the Python class `benchmark` described below. Class description: Class for running the benchmarks Method signatures and docstrings: - def __init__(self, benchmark_op, iterations_warmup, iterations_benchmark, iterations_timeline, graph): Initialize benchmark Args: benchmark_op: tf tensor, operation to be exe...
Implement the Python class `benchmark` described below. Class description: Class for running the benchmarks Method signatures and docstrings: - def __init__(self, benchmark_op, iterations_warmup, iterations_benchmark, iterations_timeline, graph): Initialize benchmark Args: benchmark_op: tf tensor, operation to be exe...
c177ed3b01b3849de2d0266a3dd673c47bd754f8
<|skeleton|> class benchmark: """Class for running the benchmarks""" def __init__(self, benchmark_op, iterations_warmup, iterations_benchmark, iterations_timeline, graph): """Initialize benchmark Args: benchmark_op: tf tensor, operation to be executed in benchmark iterations_warmup: Number of iteration...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class benchmark: """Class for running the benchmarks""" def __init__(self, benchmark_op, iterations_warmup, iterations_benchmark, iterations_timeline, graph): """Initialize benchmark Args: benchmark_op: tf tensor, operation to be executed in benchmark iterations_warmup: Number of iterations for warm-up...
the_stack_v2_python_sparse
benchmark/utils_tf/run_benchmark.py
profnote/ml-performance-prediction
train
0
b7ae12437727c5f89d006f643674c018db505e04
[ "audio = np.empty((1,))\nsecs_loaded = 0\nfiles_loaded = 0\nfiles = glob.glob(path + '*.wav')\nfor file in files:\n sr, samples = wavfile.read(file)\n audio = np.concatenate((audio, samples))\n dur = len(samples) / sr\n secs_loaded = secs_loaded + dur\n files_loaded = files_loaded + 1\n if secs_lo...
<|body_start_0|> audio = np.empty((1,)) secs_loaded = 0 files_loaded = 0 files = glob.glob(path + '*.wav') for file in files: sr, samples = wavfile.read(file) audio = np.concatenate((audio, samples)) dur = len(samples) / sr secs_loa...
Spectrogram data from the Vox Celeb Dataset.
VoxCeleb
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VoxCeleb: """Spectrogram data from the Vox Celeb Dataset.""" def __init__(self, secs, path, concat=True): """Create a VoxCeleb dataset object. Parameters ---------- secs : int Number of seconds of the dataset to be generated. Multiple .wav files will be combined if necessary. path : ...
stack_v2_sparse_classes_36k_train_015684
3,492
no_license
[ { "docstring": "Create a VoxCeleb dataset object. Parameters ---------- secs : int Number of seconds of the dataset to be generated. Multiple .wav files will be combined if necessary. path : string Path to folder containing .wav file(s) concat : bool Whether or not to concatenate multiple files. If false, only ...
2
stack_v2_sparse_classes_30k_test_000909
Implement the Python class `VoxCeleb` described below. Class description: Spectrogram data from the Vox Celeb Dataset. Method signatures and docstrings: - def __init__(self, secs, path, concat=True): Create a VoxCeleb dataset object. Parameters ---------- secs : int Number of seconds of the dataset to be generated. M...
Implement the Python class `VoxCeleb` described below. Class description: Spectrogram data from the Vox Celeb Dataset. Method signatures and docstrings: - def __init__(self, secs, path, concat=True): Create a VoxCeleb dataset object. Parameters ---------- secs : int Number of seconds of the dataset to be generated. M...
eabdb6ca44cb8f44f0cfb2d94561c9d4de9bb413
<|skeleton|> class VoxCeleb: """Spectrogram data from the Vox Celeb Dataset.""" def __init__(self, secs, path, concat=True): """Create a VoxCeleb dataset object. Parameters ---------- secs : int Number of seconds of the dataset to be generated. Multiple .wav files will be combined if necessary. path : ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VoxCeleb: """Spectrogram data from the Vox Celeb Dataset.""" def __init__(self, secs, path, concat=True): """Create a VoxCeleb dataset object. Parameters ---------- secs : int Number of seconds of the dataset to be generated. Multiple .wav files will be combined if necessary. path : string Path t...
the_stack_v2_python_sparse
cmfpy/datasets/vox_celeb.py
degleris1/cmfpy
train
1
c5ae46f540fcd83f656bdecc2373f998a1158310
[ "self.epsilon = epsilon\nself.epsilon_decay = epsilon_decay\nself.epsilon_min = epsilon_min\nself.possible_actions = possible_actions\nself.continuous = continuous", "if self.epsilon < self.epsilon_min:\n self.epsilon = self.epsilon_min\nif random.random() < self.epsilon:\n return True\nreturn False", "se...
<|body_start_0|> self.epsilon = epsilon self.epsilon_decay = epsilon_decay self.epsilon_min = epsilon_min self.possible_actions = possible_actions self.continuous = continuous <|end_body_0|> <|body_start_1|> if self.epsilon < self.epsilon_min: self.epsilon = ...
An implementation of epsilon greedy exploration. Epsilon greedy exploration selects an explorative action with probability epsilon at each step. The value of epsilon decays at a rate 'epsilon_decay', until it hits the minimum value of 'epsilon_min'
EpsilonGreedyExplorer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EpsilonGreedyExplorer: """An implementation of epsilon greedy exploration. Epsilon greedy exploration selects an explorative action with probability epsilon at each step. The value of epsilon decays at a rate 'epsilon_decay', until it hits the minimum value of 'epsilon_min'""" def __init__(s...
stack_v2_sparse_classes_36k_train_015685
1,590
no_license
[ { "docstring": "Initialises the parameters for the explorer", "name": "__init__", "signature": "def __init__(self, possible_actions, continuous=False, epsilon=0.1, epsilon_decay=0, epsilon_min=0.1)" }, { "docstring": "Determines whether or not to explore in the current time step by comparing eps...
3
stack_v2_sparse_classes_30k_train_000431
Implement the Python class `EpsilonGreedyExplorer` described below. Class description: An implementation of epsilon greedy exploration. Epsilon greedy exploration selects an explorative action with probability epsilon at each step. The value of epsilon decays at a rate 'epsilon_decay', until it hits the minimum value ...
Implement the Python class `EpsilonGreedyExplorer` described below. Class description: An implementation of epsilon greedy exploration. Epsilon greedy exploration selects an explorative action with probability epsilon at each step. The value of epsilon decays at a rate 'epsilon_decay', until it hits the minimum value ...
6dfb342efda4c5ae0dff72bb132a6ce12fbfd8b8
<|skeleton|> class EpsilonGreedyExplorer: """An implementation of epsilon greedy exploration. Epsilon greedy exploration selects an explorative action with probability epsilon at each step. The value of epsilon decays at a rate 'epsilon_decay', until it hits the minimum value of 'epsilon_min'""" def __init__(s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EpsilonGreedyExplorer: """An implementation of epsilon greedy exploration. Epsilon greedy exploration selects an explorative action with probability epsilon at each step. The value of epsilon decays at a rate 'epsilon_decay', until it hits the minimum value of 'epsilon_min'""" def __init__(self, possible...
the_stack_v2_python_sparse
Software/Agents/Policies/Explorers/EpsilonGreedyExplorer.py
meelement/ArtificialIntelligence
train
0
8c8168740babbb789e1e46bca079cc88686e178d
[ "self.metrics = {}\nqueries = {'visits': PiwikQueryReportEventMetricVisits(**self.params), 'unique_visits': PiwikQueryReportEventMetricUniqueVisits(**self.params), 'visit_duration': PiwikQueryReportEventMetricVisitDuration(**self.params), 'referrers': PiwikQueryReportEventMetricReferrers(**self.params), 'peak': Piw...
<|body_start_0|> self.metrics = {} queries = {'visits': PiwikQueryReportEventMetricVisits(**self.params), 'unique_visits': PiwikQueryReportEventMetricUniqueVisits(**self.params), 'visit_duration': PiwikQueryReportEventMetricVisitDuration(**self.params), 'referrers': PiwikQueryReportEventMetricReferrers(...
ReportGeneral
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReportGeneral: def _build_report(self): """Build the report by performing queries to Piwik""" <|body_0|> def _fetch_contribution_info(self): """Build the list of information entries for contributions of the event""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_36k_train_015686
5,751
permissive
[ { "docstring": "Build the report by performing queries to Piwik", "name": "_build_report", "signature": "def _build_report(self)" }, { "docstring": "Build the list of information entries for contributions of the event", "name": "_fetch_contribution_info", "signature": "def _fetch_contrib...
2
stack_v2_sparse_classes_30k_train_002286
Implement the Python class `ReportGeneral` described below. Class description: Implement the ReportGeneral class. Method signatures and docstrings: - def _build_report(self): Build the report by performing queries to Piwik - def _fetch_contribution_info(self): Build the list of information entries for contributions o...
Implement the Python class `ReportGeneral` described below. Class description: Implement the ReportGeneral class. Method signatures and docstrings: - def _build_report(self): Build the report by performing queries to Piwik - def _fetch_contribution_info(self): Build the list of information entries for contributions o...
2d7ca9489e1e9b6c66005384528b5fe51e2ed9e3
<|skeleton|> class ReportGeneral: def _build_report(self): """Build the report by performing queries to Piwik""" <|body_0|> def _fetch_contribution_info(self): """Build the list of information entries for contributions of the event""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReportGeneral: def _build_report(self): """Build the report by performing queries to Piwik""" self.metrics = {} queries = {'visits': PiwikQueryReportEventMetricVisits(**self.params), 'unique_visits': PiwikQueryReportEventMetricUniqueVisits(**self.params), 'visit_duration': PiwikQueryRe...
the_stack_v2_python_sparse
piwik/indico_piwik/reports.py
indico/indico-plugins
train
26
84850fa004c26d22771f16c787d44dadf1cfbfd5
[ "parser.add_argument('BUCKET_ID', help='ID of the bucket to create.')\nparser.add_argument('--display-name', help='A textual name to display for the bucket.')\nparser.add_argument('--description', help='A textual description for the bucket.')\nparser.add_argument('--retention-days', type=int, help='The period logs ...
<|body_start_0|> parser.add_argument('BUCKET_ID', help='ID of the bucket to create.') parser.add_argument('--display-name', help='A textual name to display for the bucket.') parser.add_argument('--description', help='A textual description for the bucket.') parser.add_argument('--retentio...
Creates a bucket.
Create
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Create: """Creates a bucket.""" def Args(parser): """Register flags for this command.""" <|body_0|> def Run(self, args): """This is what gets called when the user runs this command. Args: args: an argparse namespace. All the arguments that were provided to this c...
stack_v2_sparse_classes_36k_train_015687
2,655
permissive
[ { "docstring": "Register flags for this command.", "name": "Args", "signature": "def Args(parser)" }, { "docstring": "This is what gets called when the user runs this command. Args: args: an argparse namespace. All the arguments that were provided to this command invocation. Returns: The created...
2
null
Implement the Python class `Create` described below. Class description: Creates a bucket. Method signatures and docstrings: - def Args(parser): Register flags for this command. - def Run(self, args): This is what gets called when the user runs this command. Args: args: an argparse namespace. All the arguments that we...
Implement the Python class `Create` described below. Class description: Creates a bucket. Method signatures and docstrings: - def Args(parser): Register flags for this command. - def Run(self, args): This is what gets called when the user runs this command. Args: args: an argparse namespace. All the arguments that we...
85bb264e273568b5a0408f733b403c56373e2508
<|skeleton|> class Create: """Creates a bucket.""" def Args(parser): """Register flags for this command.""" <|body_0|> def Run(self, args): """This is what gets called when the user runs this command. Args: args: an argparse namespace. All the arguments that were provided to this c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Create: """Creates a bucket.""" def Args(parser): """Register flags for this command.""" parser.add_argument('BUCKET_ID', help='ID of the bucket to create.') parser.add_argument('--display-name', help='A textual name to display for the bucket.') parser.add_argument('--desc...
the_stack_v2_python_sparse
google-cloud-sdk/lib/surface/logging/buckets/create.py
bopopescu/socialliteapp
train
0
aa3da683a2b93dcec2afbefb352ff374eebfd878
[ "super(RLConfiguration, self).__init__(**kwargs)\nself.device = 'cpu'\nself.save_model_config = None\nself.save_result_config = None\nself.encoding_config = None\nself.monitor_dir = './logs'\nself.model_load_path = ''\nself.buffer_load_path = ''\nself.encoding_load_path = ''\nself.extra_load_path = ''\nself.log_int...
<|body_start_0|> super(RLConfiguration, self).__init__(**kwargs) self.device = 'cpu' self.save_model_config = None self.save_result_config = None self.encoding_config = None self.monitor_dir = './logs' self.model_load_path = '' self.buffer_load_path = '' ...
class stores the rl experiment configuration
RLConfiguration
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RLConfiguration: """class stores the rl experiment configuration""" def __init__(self, **kwargs): """initialize settings""" <|body_0|> def set_necessary_configs(self, **kwargs): """set rl configs that necessarily provided by user""" <|body_1|> def se...
stack_v2_sparse_classes_36k_train_015688
5,332
no_license
[ { "docstring": "initialize settings", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "set rl configs that necessarily provided by user", "name": "set_necessary_configs", "signature": "def set_necessary_configs(self, **kwargs)" }, { "docstring": ...
3
null
Implement the Python class `RLConfiguration` described below. Class description: class stores the rl experiment configuration Method signatures and docstrings: - def __init__(self, **kwargs): initialize settings - def set_necessary_configs(self, **kwargs): set rl configs that necessarily provided by user - def set_un...
Implement the Python class `RLConfiguration` described below. Class description: class stores the rl experiment configuration Method signatures and docstrings: - def __init__(self, **kwargs): initialize settings - def set_necessary_configs(self, **kwargs): set rl configs that necessarily provided by user - def set_un...
b0e8f66b3ade742445a41d3d5667032a931d94d2
<|skeleton|> class RLConfiguration: """class stores the rl experiment configuration""" def __init__(self, **kwargs): """initialize settings""" <|body_0|> def set_necessary_configs(self, **kwargs): """set rl configs that necessarily provided by user""" <|body_1|> def se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RLConfiguration: """class stores the rl experiment configuration""" def __init__(self, **kwargs): """initialize settings""" super(RLConfiguration, self).__init__(**kwargs) self.device = 'cpu' self.save_model_config = None self.save_result_config = None self...
the_stack_v2_python_sparse
config/rl_config.py
wz139704646/MBRL_on_VAEs
train
1
942f7e2ac06f33815a91e6f04e0527deb23a6d66
[ "x, y = RecursiveFilter()._validate_coefficients(self.cube, self.smoothing_coefficients)\nself.assertEqual(x.name(), self.x_name)\nself.assertEqual(y.name(), self.y_name)\nx, y = RecursiveFilter()._validate_coefficients(self.cube, self.smoothing_coefficients[::-1])\nself.assertEqual(x.name(), self.x_name)\nself.ass...
<|body_start_0|> x, y = RecursiveFilter()._validate_coefficients(self.cube, self.smoothing_coefficients) self.assertEqual(x.name(), self.x_name) self.assertEqual(y.name(), self.y_name) x, y = RecursiveFilter()._validate_coefficients(self.cube, self.smoothing_coefficients[::-1]) s...
Test the _validate_coefficients method
Test__validate_coefficients
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test__validate_coefficients: """Test the _validate_coefficients method""" def test_return_order(self): """Test that the coefficients cubes are returned in x, y order.""" <|body_0|> def test_smoothing_coefficients_wrong_name(self): """Test that an error is raised ...
stack_v2_sparse_classes_36k_train_015689
22,857
permissive
[ { "docstring": "Test that the coefficients cubes are returned in x, y order.", "name": "test_return_order", "signature": "def test_return_order(self)" }, { "docstring": "Test that an error is raised if the smoothing_coefficients_cube has an incorrect name", "name": "test_smoothing_coefficien...
5
null
Implement the Python class `Test__validate_coefficients` described below. Class description: Test the _validate_coefficients method Method signatures and docstrings: - def test_return_order(self): Test that the coefficients cubes are returned in x, y order. - def test_smoothing_coefficients_wrong_name(self): Test tha...
Implement the Python class `Test__validate_coefficients` described below. Class description: Test the _validate_coefficients method Method signatures and docstrings: - def test_return_order(self): Test that the coefficients cubes are returned in x, y order. - def test_smoothing_coefficients_wrong_name(self): Test tha...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test__validate_coefficients: """Test the _validate_coefficients method""" def test_return_order(self): """Test that the coefficients cubes are returned in x, y order.""" <|body_0|> def test_smoothing_coefficients_wrong_name(self): """Test that an error is raised ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test__validate_coefficients: """Test the _validate_coefficients method""" def test_return_order(self): """Test that the coefficients cubes are returned in x, y order.""" x, y = RecursiveFilter()._validate_coefficients(self.cube, self.smoothing_coefficients) self.assertEqual(x.name...
the_stack_v2_python_sparse
improver_tests/nbhood/recursive_filter/test_RecursiveFilter.py
metoppv/improver
train
101
0d2788a3d6283dcb7879f0d7cac3aee0add23639
[ "super(Highway, self).__init__()\nself.embedded_char_size = embedded_char_size\nself.proj_projection = nn.Linear(in_features=embedded_char_size, out_features=embedded_char_size)\nself.gate_projection = nn.Linear(in_features=embedded_char_size, out_features=embedded_char_size)\nself.relu = nn.ReLU()\nself.sigmoid = ...
<|body_start_0|> super(Highway, self).__init__() self.embedded_char_size = embedded_char_size self.proj_projection = nn.Linear(in_features=embedded_char_size, out_features=embedded_char_size) self.gate_projection = nn.Linear(in_features=embedded_char_size, out_features=embedded_char_size...
HighWay Layer, i.e. a layer of highway network that takes the output of convolutional network as input
Highway
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Highway: """HighWay Layer, i.e. a layer of highway network that takes the output of convolutional network as input""" def __init__(self, embedded_char_size): """Init HighWay Instance. @param embedded_char_size: int""" <|body_0|> def forward(self, x_conv_out): """...
stack_v2_sparse_classes_36k_train_015690
2,058
no_license
[ { "docstring": "Init HighWay Instance. @param embedded_char_size: int", "name": "__init__", "signature": "def __init__(self, embedded_char_size)" }, { "docstring": "Run a forward step that map a batch of x_conv_out to x_high_way @param x_conv_out: tensor of (max_sentence_length * batch_size, emb...
2
stack_v2_sparse_classes_30k_train_007058
Implement the Python class `Highway` described below. Class description: HighWay Layer, i.e. a layer of highway network that takes the output of convolutional network as input Method signatures and docstrings: - def __init__(self, embedded_char_size): Init HighWay Instance. @param embedded_char_size: int - def forwar...
Implement the Python class `Highway` described below. Class description: HighWay Layer, i.e. a layer of highway network that takes the output of convolutional network as input Method signatures and docstrings: - def __init__(self, embedded_char_size): Init HighWay Instance. @param embedded_char_size: int - def forwar...
a883935d779dca3a3cc443c3fa6d6a455f21e87a
<|skeleton|> class Highway: """HighWay Layer, i.e. a layer of highway network that takes the output of convolutional network as input""" def __init__(self, embedded_char_size): """Init HighWay Instance. @param embedded_char_size: int""" <|body_0|> def forward(self, x_conv_out): """...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Highway: """HighWay Layer, i.e. a layer of highway network that takes the output of convolutional network as input""" def __init__(self, embedded_char_size): """Init HighWay Instance. @param embedded_char_size: int""" super(Highway, self).__init__() self.embedded_char_size = embed...
the_stack_v2_python_sparse
stanford_nlp/a5/highway.py
guocongyun/ml-projects
train
0
1977e5bc5f765b35a9cfaf773ad9cf978bd40b22
[ "self.datum = data\nself.left = None\nself.right = None", "if self:\n if value < self.datum:\n if self.left is None:\n self.left = Node(value)\n else:\n self.left + value\n elif value > self.datum:\n if self.right is None:\n self.right = Node(value)\n ...
<|body_start_0|> self.datum = data self.left = None self.right = None <|end_body_0|> <|body_start_1|> if self: if value < self.datum: if self.left is None: self.left = Node(value) else: self.left + value...
Node
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Node: def __init__(self, data): """This constructor initializes the instance variable datum to the data and the instance variable left anf right to None.""" <|body_0|> def __add__(self, value): """This magic method inserts a new item with self as a root, if the item ...
stack_v2_sparse_classes_36k_train_015691
4,969
no_license
[ { "docstring": "This constructor initializes the instance variable datum to the data and the instance variable left anf right to None.", "name": "__init__", "signature": "def __init__(self, data)" }, { "docstring": "This magic method inserts a new item with self as a root, if the item is not alr...
5
stack_v2_sparse_classes_30k_train_014474
Implement the Python class `Node` described below. Class description: Implement the Node class. Method signatures and docstrings: - def __init__(self, data): This constructor initializes the instance variable datum to the data and the instance variable left anf right to None. - def __add__(self, value): This magic me...
Implement the Python class `Node` described below. Class description: Implement the Node class. Method signatures and docstrings: - def __init__(self, data): This constructor initializes the instance variable datum to the data and the instance variable left anf right to None. - def __add__(self, value): This magic me...
e773e87668af057c8adb1e012aa5d81f42c70f2a
<|skeleton|> class Node: def __init__(self, data): """This constructor initializes the instance variable datum to the data and the instance variable left anf right to None.""" <|body_0|> def __add__(self, value): """This magic method inserts a new item with self as a root, if the item ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Node: def __init__(self, data): """This constructor initializes the instance variable datum to the data and the instance variable left anf right to None.""" self.datum = data self.left = None self.right = None def __add__(self, value): """This magic method inserts ...
the_stack_v2_python_sparse
HW/HW5/hw5.py
SiddhantBhardwaj2018/ISTA-350
train
0
9491a39cf700a2c335c03197b903861e6eaca755
[ "head = ListNode(0)\nl3 = head\naddon = 0\nwhile l1 is not None or l2 is not None:\n if l1 is None:\n tmp = l2.val + addon * 1\n elif l2 is None:\n tmp = l1.val + addon * 1\n else:\n tmp = l1.val + l2.val + addon * 1\n addon = 0\n if tmp >= 10:\n l3.val = tmp - 10\n ...
<|body_start_0|> head = ListNode(0) l3 = head addon = 0 while l1 is not None or l2 is not None: if l1 is None: tmp = l2.val + addon * 1 elif l2 is None: tmp = l1.val + addon * 1 else: tmp = l1.val + l2.va...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def addTwoNumbers(self, l1, l2) -> ListNode: """最直接的方法:遍历两个链表到最后,执行加操作 Q:l1,l2为空之后,继续执行增加一个节点,导致最后多一位0 A:加一个判断,都为空直接结束 Q:其中一个链表对应的数位数多一位 1 8 + 2 A:有一个不为空则继续加,只不过不加为空的那个链表的值,None.val报错, 遍历的时候也忽略为空的那个 Q:还有最后可能也有进位 5 + 5 A: 判断都为空的时候再判断进位标志位是否为1,是的话一个节点值为1""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_015692
3,769
no_license
[ { "docstring": "最直接的方法:遍历两个链表到最后,执行加操作 Q:l1,l2为空之后,继续执行增加一个节点,导致最后多一位0 A:加一个判断,都为空直接结束 Q:其中一个链表对应的数位数多一位 1 8 + 2 A:有一个不为空则继续加,只不过不加为空的那个链表的值,None.val报错, 遍历的时候也忽略为空的那个 Q:还有最后可能也有进位 5 + 5 A: 判断都为空的时候再判断进位标志位是否为1,是的话一个节点值为1", "name": "addTwoNumbers", "signature": "def addTwoNumbers(self, l1, l2) -> ListNod...
3
stack_v2_sparse_classes_30k_train_002705
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addTwoNumbers(self, l1, l2) -> ListNode: 最直接的方法:遍历两个链表到最后,执行加操作 Q:l1,l2为空之后,继续执行增加一个节点,导致最后多一位0 A:加一个判断,都为空直接结束 Q:其中一个链表对应的数位数多一位 1 8 + 2 A:有一个不为空则继续加,只不过不加为空的那个链表的值,None.val...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addTwoNumbers(self, l1, l2) -> ListNode: 最直接的方法:遍历两个链表到最后,执行加操作 Q:l1,l2为空之后,继续执行增加一个节点,导致最后多一位0 A:加一个判断,都为空直接结束 Q:其中一个链表对应的数位数多一位 1 8 + 2 A:有一个不为空则继续加,只不过不加为空的那个链表的值,None.val...
95dddb78bccd169d9d219a473627361fe739ab5e
<|skeleton|> class Solution: def addTwoNumbers(self, l1, l2) -> ListNode: """最直接的方法:遍历两个链表到最后,执行加操作 Q:l1,l2为空之后,继续执行增加一个节点,导致最后多一位0 A:加一个判断,都为空直接结束 Q:其中一个链表对应的数位数多一位 1 8 + 2 A:有一个不为空则继续加,只不过不加为空的那个链表的值,None.val报错, 遍历的时候也忽略为空的那个 Q:还有最后可能也有进位 5 + 5 A: 判断都为空的时候再判断进位标志位是否为1,是的话一个节点值为1""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def addTwoNumbers(self, l1, l2) -> ListNode: """最直接的方法:遍历两个链表到最后,执行加操作 Q:l1,l2为空之后,继续执行增加一个节点,导致最后多一位0 A:加一个判断,都为空直接结束 Q:其中一个链表对应的数位数多一位 1 8 + 2 A:有一个不为空则继续加,只不过不加为空的那个链表的值,None.val报错, 遍历的时候也忽略为空的那个 Q:还有最后可能也有进位 5 + 5 A: 判断都为空的时候再判断进位标志位是否为1,是的话一个节点值为1""" head = ListNode(0) l...
the_stack_v2_python_sparse
LinkListOperation/addTwoNumbers.py
Philex5/codingPractice
train
0
cffaf3e28c1eb069a6d6feba625891bf4363bc36
[ "super().__init__(freq=freq, context_length=context_length, prediction_length=prediction_length, num_feat_dynamic_real=num_feat_dynamic_real, num_feat_static_real=num_feat_static_real, num_feat_static_cat=num_feat_static_cat, cardinality=cardinality, embedding_dimension=embedding_dimension, num_layers=num_layers, h...
<|body_start_0|> super().__init__(freq=freq, context_length=context_length, prediction_length=prediction_length, num_feat_dynamic_real=num_feat_dynamic_real, num_feat_static_real=num_feat_static_real, num_feat_static_cat=num_feat_static_cat, cardinality=cardinality, embedding_dimension=embedding_dimension, num_...
MQF2MultiHorizonModel
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MQF2MultiHorizonModel: def __init__(self, freq: str, context_length: int, prediction_length: int, num_feat_dynamic_real: int, num_feat_static_real: int, num_feat_static_cat: int, cardinality: List[int], distr_output: Optional[DistributionOutput]=None, embedding_dimension: Optional[List[int]]=Non...
stack_v2_sparse_classes_36k_train_015693
6,947
permissive
[ { "docstring": "Model class for the model MQF2 proposed in the paper ``Multivariate Quantile Function Forecaster`` by Kan, Aubet, Januschowski, Park, Benidis, Ruthotto, Gasthaus This is the multi-horizon (multivariate in time step) variant of MQF2 This class is based on gluonts.torch.model.deepar.module.DeepARM...
3
stack_v2_sparse_classes_30k_train_004327
Implement the Python class `MQF2MultiHorizonModel` described below. Class description: Implement the MQF2MultiHorizonModel class. Method signatures and docstrings: - def __init__(self, freq: str, context_length: int, prediction_length: int, num_feat_dynamic_real: int, num_feat_static_real: int, num_feat_static_cat: i...
Implement the Python class `MQF2MultiHorizonModel` described below. Class description: Implement the MQF2MultiHorizonModel class. Method signatures and docstrings: - def __init__(self, freq: str, context_length: int, prediction_length: int, num_feat_dynamic_real: int, num_feat_static_real: int, num_feat_static_cat: i...
a818f69dc049c1c1d57e09d2ccb8b5f7a0cff656
<|skeleton|> class MQF2MultiHorizonModel: def __init__(self, freq: str, context_length: int, prediction_length: int, num_feat_dynamic_real: int, num_feat_static_real: int, num_feat_static_cat: int, cardinality: List[int], distr_output: Optional[DistributionOutput]=None, embedding_dimension: Optional[List[int]]=Non...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MQF2MultiHorizonModel: def __init__(self, freq: str, context_length: int, prediction_length: int, num_feat_dynamic_real: int, num_feat_static_real: int, num_feat_static_cat: int, cardinality: List[int], distr_output: Optional[DistributionOutput]=None, embedding_dimension: Optional[List[int]]=None, num_layers:...
the_stack_v2_python_sparse
src/gluonts/torch/model/mqf2/module.py
kashif/gluon-ts
train
5
909682b53f3183c561aa0ced34e09240014b39fb
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn Task()", "from ..entity import Entity\nfrom ..key_value_pair import KeyValuePair\nfrom .lifecycle_task_category import LifecycleTaskCategory\nfrom .task_processing_result import TaskProcessingResult\nfrom ..entity import Entity\nfrom ....
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return Task() <|end_body_0|> <|body_start_1|> from ..entity import Entity from ..key_value_pair import KeyValuePair from .lifecycle_task_category import LifecycleTaskCategory fr...
Task
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Task: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Task: """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: Task""" ...
stack_v2_sparse_classes_36k_train_015694
5,225
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: Task", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value(parse_no...
3
stack_v2_sparse_classes_30k_train_014926
Implement the Python class `Task` described below. Class description: Implement the Task class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Task: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The pars...
Implement the Python class `Task` described below. Class description: Implement the Task class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Task: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The pars...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class Task: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Task: """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: Task""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Task: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Task: """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: Task""" if not parse_n...
the_stack_v2_python_sparse
msgraph/generated/models/identity_governance/task.py
microsoftgraph/msgraph-sdk-python
train
135
ff8739d3bf20714b39dbbb763c9b52194206ca2a
[ "self.layers = ModuleList([ConditionalDetrTransformerDecoderLayer(**self.layer_cfg) for _ in range(self.num_layers)])\nself.embed_dims = self.layers[0].embed_dims\nself.post_norm = build_norm_layer(self.post_norm_cfg, self.embed_dims)[1]\nself.query_scale = MLP(self.embed_dims, self.embed_dims, self.embed_dims, 2)\...
<|body_start_0|> self.layers = ModuleList([ConditionalDetrTransformerDecoderLayer(**self.layer_cfg) for _ in range(self.num_layers)]) self.embed_dims = self.layers[0].embed_dims self.post_norm = build_norm_layer(self.post_norm_cfg, self.embed_dims)[1] self.query_scale = MLP(self.embed_di...
Decoder of Conditional DETR.
ConditionalDetrTransformerDecoder
[ "Apache-2.0", "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConditionalDetrTransformerDecoder: """Decoder of Conditional DETR.""" def _init_layers(self) -> None: """Initialize decoder layers and other layers.""" <|body_0|> def forward(self, query: Tensor, key: Tensor=None, query_pos: Tensor=None, key_pos: Tensor=None, key_padding...
stack_v2_sparse_classes_36k_train_015695
7,563
permissive
[ { "docstring": "Initialize decoder layers and other layers.", "name": "_init_layers", "signature": "def _init_layers(self) -> None" }, { "docstring": "Forward function of decoder. Args: query (Tensor): The input query with shape (bs, num_queries, dim). key (Tensor): The input key with shape (bs,...
2
null
Implement the Python class `ConditionalDetrTransformerDecoder` described below. Class description: Decoder of Conditional DETR. Method signatures and docstrings: - def _init_layers(self) -> None: Initialize decoder layers and other layers. - def forward(self, query: Tensor, key: Tensor=None, query_pos: Tensor=None, k...
Implement the Python class `ConditionalDetrTransformerDecoder` described below. Class description: Decoder of Conditional DETR. Method signatures and docstrings: - def _init_layers(self) -> None: Initialize decoder layers and other layers. - def forward(self, query: Tensor, key: Tensor=None, query_pos: Tensor=None, k...
8d5f9a2d49ab8f9e85ccf058cb02c2fda287afc6
<|skeleton|> class ConditionalDetrTransformerDecoder: """Decoder of Conditional DETR.""" def _init_layers(self) -> None: """Initialize decoder layers and other layers.""" <|body_0|> def forward(self, query: Tensor, key: Tensor=None, query_pos: Tensor=None, key_pos: Tensor=None, key_padding...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConditionalDetrTransformerDecoder: """Decoder of Conditional DETR.""" def _init_layers(self) -> None: """Initialize decoder layers and other layers.""" self.layers = ModuleList([ConditionalDetrTransformerDecoderLayer(**self.layer_cfg) for _ in range(self.num_layers)]) self.embed_d...
the_stack_v2_python_sparse
ai/mmdetection/mmdet/models/layers/transformer/conditional_detr_layers.py
alldatacenter/alldata
train
774
bf2cb6ce763e0e859c5699c57c1a5b7a28b81ecb
[ "model_params = {'architecture': 'ResNet101', 'pooling': 'gem', 'whitening': False, 'pretrained': True}\nmodel = global_model.GlobalFeatureNet(**model_params)\nexpected_meta = {'architecture': 'ResNet101', 'pooling': 'gem', 'whitening': False, 'outputdim': 2048}\nself.assertEqual(expected_meta, model.meta)", "mod...
<|body_start_0|> model_params = {'architecture': 'ResNet101', 'pooling': 'gem', 'whitening': False, 'pretrained': True} model = global_model.GlobalFeatureNet(**model_params) expected_meta = {'architecture': 'ResNet101', 'pooling': 'gem', 'whitening': False, 'outputdim': 2048} self.assert...
Tests for the GlobalFeatureNet backbone.
GlobalFeatureNetTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GlobalFeatureNetTest: """Tests for the GlobalFeatureNet backbone.""" def testInitModel(self): """Testing GlobalFeatureNet initialization.""" <|body_0|> def testExtractVectors(self): """Tests extraction of global descriptors from list.""" <|body_1|> d...
stack_v2_sparse_classes_36k_train_015696
3,230
permissive
[ { "docstring": "Testing GlobalFeatureNet initialization.", "name": "testInitModel", "signature": "def testInitModel(self)" }, { "docstring": "Tests extraction of global descriptors from list.", "name": "testExtractVectors", "signature": "def testExtractVectors(self)" }, { "docstr...
3
null
Implement the Python class `GlobalFeatureNetTest` described below. Class description: Tests for the GlobalFeatureNet backbone. Method signatures and docstrings: - def testInitModel(self): Testing GlobalFeatureNet initialization. - def testExtractVectors(self): Tests extraction of global descriptors from list. - def t...
Implement the Python class `GlobalFeatureNetTest` described below. Class description: Tests for the GlobalFeatureNet backbone. Method signatures and docstrings: - def testInitModel(self): Testing GlobalFeatureNet initialization. - def testExtractVectors(self): Tests extraction of global descriptors from list. - def t...
d3507b550a3ade40cade60a79eb5b8978b56c7ae
<|skeleton|> class GlobalFeatureNetTest: """Tests for the GlobalFeatureNet backbone.""" def testInitModel(self): """Testing GlobalFeatureNet initialization.""" <|body_0|> def testExtractVectors(self): """Tests extraction of global descriptors from list.""" <|body_1|> d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GlobalFeatureNetTest: """Tests for the GlobalFeatureNet backbone.""" def testInitModel(self): """Testing GlobalFeatureNet initialization.""" model_params = {'architecture': 'ResNet101', 'pooling': 'gem', 'whitening': False, 'pretrained': True} model = global_model.GlobalFeatureNet...
the_stack_v2_python_sparse
research/delf/delf/python/training/model/global_model_test.py
jianzhnie/models
train
2
8fdae510c84f4cc1e84b670792eb671cd0bb5021
[ "class ExampleDataset(Dataset):\n\n def __init__(self, size):\n self.size = size\n self.data = torch.arange(size) + 100\n\n def __getitem__(self, index):\n if torch.is_tensor(index):\n index = index.tolist()\n return self.data[index]\n\n def __len__(self):\n re...
<|body_start_0|> class ExampleDataset(Dataset): def __init__(self, size): self.size = size self.data = torch.arange(size) + 100 def __getitem__(self, index): if torch.is_tensor(index): index = index.tolist() ...
two types of Dataset: map-style, iterable-style map-style: 基类是Dataset,代表kv类型的数据集 iterable-style: 基类是IterableDataset, 代表list类型的数据集
DatasetTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DatasetTest: """two types of Dataset: map-style, iterable-style map-style: 基类是Dataset,代表kv类型的数据集 iterable-style: 基类是IterableDataset, 代表list类型的数据集""" def test_dataset(self): """Dataset: map-style抽象基类; 提供方法ds[key], len(ds) 子类必须实现 def __getitem__(self, index) def __len__(self)""" ...
stack_v2_sparse_classes_36k_train_015697
2,805
no_license
[ { "docstring": "Dataset: map-style抽象基类; 提供方法ds[key], len(ds) 子类必须实现 def __getitem__(self, index) def __len__(self)", "name": "test_dataset", "signature": "def test_dataset(self)" }, { "docstring": "IterableDataset: iterable-style抽象类, 提供iter方法 子类必须实现: __iter__() Note: 一般在Dataloader进行多进程加载时, ds会被复...
2
stack_v2_sparse_classes_30k_train_001097
Implement the Python class `DatasetTest` described below. Class description: two types of Dataset: map-style, iterable-style map-style: 基类是Dataset,代表kv类型的数据集 iterable-style: 基类是IterableDataset, 代表list类型的数据集 Method signatures and docstrings: - def test_dataset(self): Dataset: map-style抽象基类; 提供方法ds[key], len(ds) 子类必须实现...
Implement the Python class `DatasetTest` described below. Class description: two types of Dataset: map-style, iterable-style map-style: 基类是Dataset,代表kv类型的数据集 iterable-style: 基类是IterableDataset, 代表list类型的数据集 Method signatures and docstrings: - def test_dataset(self): Dataset: map-style抽象基类; 提供方法ds[key], len(ds) 子类必须实现...
4f4bd55d7f0502c188976dda2f95fd25614283f3
<|skeleton|> class DatasetTest: """two types of Dataset: map-style, iterable-style map-style: 基类是Dataset,代表kv类型的数据集 iterable-style: 基类是IterableDataset, 代表list类型的数据集""" def test_dataset(self): """Dataset: map-style抽象基类; 提供方法ds[key], len(ds) 子类必须实现 def __getitem__(self, index) def __len__(self)""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DatasetTest: """two types of Dataset: map-style, iterable-style map-style: 基类是Dataset,代表kv类型的数据集 iterable-style: 基类是IterableDataset, 代表list类型的数据集""" def test_dataset(self): """Dataset: map-style抽象基类; 提供方法ds[key], len(ds) 子类必须实现 def __getitem__(self, index) def __len__(self)""" class Examp...
the_stack_v2_python_sparse
com.xulf.learn.ml.pytorch/th_data/dataset_test.py
sankoudai/py-knowledge-center
train
0
098488790d31900f44208d9cd2279a4afd2423c9
[ "self.seg = WordSegmentation(stop_words_file=stop_words_file, allow_speech_tags=allow_speech_tags)\nself.wc_background = get_default_wc_background()\nif type(wc_background) is str:\n self.wc_background = wc_background\nself.font_path = get_default_font_path()\nif type(font_path) is str:\n self.font_path = fon...
<|body_start_0|> self.seg = WordSegmentation(stop_words_file=stop_words_file, allow_speech_tags=allow_speech_tags) self.wc_background = get_default_wc_background() if type(wc_background) is str: self.wc_background = wc_background self.font_path = get_default_font_path() ...
WordCloud
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WordCloud: def __init__(self, stop_words_file=None, allow_speech_tags=conf.allow_speech_tags, wc_background=None, font_path=None, max_words=200, max_font_size=100, save_path=None, wc_name=None, topK=10): """:param stop_words_file: -- str,停用词文件路径,若不是str则使用默认停用词文件 :param allow_speech_tags:...
stack_v2_sparse_classes_36k_train_015698
4,561
no_license
[ { "docstring": ":param stop_words_file: -- str,停用词文件路径,若不是str则使用默认停用词文件 :param allow_speech_tags: -- 词性列表 :param wc_background: 词云图背景图片 :param max_words: 最多显示词数,默认200 :param max_font_size: 字体最大值,默认100 :param save_path: 词云图保存地址,默认当前文件夹", "name": "__init__", "signature": "def __init__(self, stop_words_fil...
4
stack_v2_sparse_classes_30k_train_019268
Implement the Python class `WordCloud` described below. Class description: Implement the WordCloud class. Method signatures and docstrings: - def __init__(self, stop_words_file=None, allow_speech_tags=conf.allow_speech_tags, wc_background=None, font_path=None, max_words=200, max_font_size=100, save_path=None, wc_name...
Implement the Python class `WordCloud` described below. Class description: Implement the WordCloud class. Method signatures and docstrings: - def __init__(self, stop_words_file=None, allow_speech_tags=conf.allow_speech_tags, wc_background=None, font_path=None, max_words=200, max_font_size=100, save_path=None, wc_name...
a477c2926e97c86135623a2c7c844812be3be696
<|skeleton|> class WordCloud: def __init__(self, stop_words_file=None, allow_speech_tags=conf.allow_speech_tags, wc_background=None, font_path=None, max_words=200, max_font_size=100, save_path=None, wc_name=None, topK=10): """:param stop_words_file: -- str,停用词文件路径,若不是str则使用默认停用词文件 :param allow_speech_tags:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WordCloud: def __init__(self, stop_words_file=None, allow_speech_tags=conf.allow_speech_tags, wc_background=None, font_path=None, max_words=200, max_font_size=100, save_path=None, wc_name=None, topK=10): """:param stop_words_file: -- str,停用词文件路径,若不是str则使用默认停用词文件 :param allow_speech_tags: -- 词性列表 :para...
the_stack_v2_python_sparse
WordCloud/word_cloud/word_cloud.py
FredZhao04/chinese-nlp
train
5
53ea4d4d18cd81e6cd5cda7d78ab6f7cd27dc050
[ "if (len(nums1) + len(nums2)) % 2 == 1:\n return self.findKth(nums1, nums2, (len(nums1) + len(nums2) + 1) // 2)\nelse:\n median1 = self.findKth(nums1, nums2, (len(nums1) + len(nums2)) // 2)\n median2 = self.findKth(nums1, nums2, (len(nums1) + len(nums2)) // 2 + 1)\n return (median1 + median2) / 2.0", ...
<|body_start_0|> if (len(nums1) + len(nums2)) % 2 == 1: return self.findKth(nums1, nums2, (len(nums1) + len(nums2) + 1) // 2) else: median1 = self.findKth(nums1, nums2, (len(nums1) + len(nums2)) // 2) median2 = self.findKth(nums1, nums2, (len(nums1) + len(nums2)) // 2...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMedianSortedArrays(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: float""" <|body_0|> def findKth(self, nums1, nums2, k): """Find the k th largest number in the union of `nums1` and `nums2`""" <|body_1|> <|end...
stack_v2_sparse_classes_36k_train_015699
3,611
no_license
[ { "docstring": ":type nums1: List[int] :type nums2: List[int] :rtype: float", "name": "findMedianSortedArrays", "signature": "def findMedianSortedArrays(self, nums1, nums2)" }, { "docstring": "Find the k th largest number in the union of `nums1` and `nums2`", "name": "findKth", "signatur...
2
stack_v2_sparse_classes_30k_train_013222
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMedianSortedArrays(self, nums1, nums2): :type nums1: List[int] :type nums2: List[int] :rtype: float - def findKth(self, nums1, nums2, k): Find the k th largest number in ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMedianSortedArrays(self, nums1, nums2): :type nums1: List[int] :type nums2: List[int] :rtype: float - def findKth(self, nums1, nums2, k): Find the k th largest number in ...
69a960dd8f39e9c8435a3678852071e1085fcb72
<|skeleton|> class Solution: def findMedianSortedArrays(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: float""" <|body_0|> def findKth(self, nums1, nums2, k): """Find the k th largest number in the union of `nums1` and `nums2`""" <|body_1|> <|end...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findMedianSortedArrays(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: float""" if (len(nums1) + len(nums2)) % 2 == 1: return self.findKth(nums1, nums2, (len(nums1) + len(nums2) + 1) // 2) else: median1 = self.findKth(...
the_stack_v2_python_sparse
python/binary_search/lc4.py
chao-ji/LeetCode
train
1