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
8fc37e7d94ee6be04d8679cf32a5c470c31fe52e
[ "self.steps = int(math.log10(n) / math.log10(2))\nA = {i: x for i, x in enumerate(parent)}\nself.jump = [A]\nfor _ in xrange(self.steps):\n B = {}\n for i in A:\n if A[i] in A:\n B[i] = A[A[i]]\n self.jump += (B,)\n A = B", "steps = self.steps\nwhile k and node != -1:\n if k >= 1 ...
<|body_start_0|> self.steps = int(math.log10(n) / math.log10(2)) A = {i: x for i, x in enumerate(parent)} self.jump = [A] for _ in xrange(self.steps): B = {} for i in A: if A[i] in A: B[i] = A[A[i]] self.jump += (B,)...
TreeAncestor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TreeAncestor: def __init__(self, n, parent): """:type n: int :type parent: List[int]""" <|body_0|> def getKthAncestor(self, node, k): """:type node: int :type k: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.steps = int(math.l...
stack_v2_sparse_classes_36k_train_004300
1,889
no_license
[ { "docstring": ":type n: int :type parent: List[int]", "name": "__init__", "signature": "def __init__(self, n, parent)" }, { "docstring": ":type node: int :type k: int :rtype: int", "name": "getKthAncestor", "signature": "def getKthAncestor(self, node, k)" } ]
2
null
Implement the Python class `TreeAncestor` described below. Class description: Implement the TreeAncestor class. Method signatures and docstrings: - def __init__(self, n, parent): :type n: int :type parent: List[int] - def getKthAncestor(self, node, k): :type node: int :type k: int :rtype: int
Implement the Python class `TreeAncestor` described below. Class description: Implement the TreeAncestor class. Method signatures and docstrings: - def __init__(self, n, parent): :type n: int :type parent: List[int] - def getKthAncestor(self, node, k): :type node: int :type k: int :rtype: int <|skeleton|> class Tree...
edff905f63ab95cdd40447b27a9c449c9cefec37
<|skeleton|> class TreeAncestor: def __init__(self, n, parent): """:type n: int :type parent: List[int]""" <|body_0|> def getKthAncestor(self, node, k): """:type node: int :type k: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TreeAncestor: def __init__(self, n, parent): """:type n: int :type parent: List[int]""" self.steps = int(math.log10(n) / math.log10(2)) A = {i: x for i, x in enumerate(parent)} self.jump = [A] for _ in xrange(self.steps): B = {} for i in A: ...
the_stack_v2_python_sparse
_1483_Kth_Ancestor_of_a_Tree_Node.py
mingweihe/leetcode
train
3
701af51cbd6221f3aaf62a315e4e3b4b57fa6ccc
[ "logits = tf.constant([[0.1, 0.2, 0.7], [0.5, 0.2, 0.3], [0.2, 0.2, 0.6]])\nlabels = tf.constant([2, 0, 1])\noutput = tf_metrics.accuracy(logits, labels)\nself.assertAllClose(output, 0.6666667)", "logits = tf.constant([[0.1, 0.2, 0.7], [0.5, 0.2, 0.3], [0.6, 0.1, 0.3], [0.2, 0.3, 0.5], [0.2, 0.5, 0.3], [0.2, 0.2,...
<|body_start_0|> logits = tf.constant([[0.1, 0.2, 0.7], [0.5, 0.2, 0.3], [0.2, 0.2, 0.6]]) labels = tf.constant([2, 0, 1]) output = tf_metrics.accuracy(logits, labels) self.assertAllClose(output, 0.6666667) <|end_body_0|> <|body_start_1|> logits = tf.constant([[0.1, 0.2, 0.7], [...
tf metrics utils unittest
TFMetricUtilsTest
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TFMetricUtilsTest: """tf metrics utils unittest""" def test_accuracy(self): """test accuracy""" <|body_0|> def test_confusion_matrix(self): """test confusion matrix""" <|body_1|> <|end_skeleton|> <|body_start_0|> logits = tf.constant([[0.1, 0.2,...
stack_v2_sparse_classes_36k_train_004301
1,680
permissive
[ { "docstring": "test accuracy", "name": "test_accuracy", "signature": "def test_accuracy(self)" }, { "docstring": "test confusion matrix", "name": "test_confusion_matrix", "signature": "def test_confusion_matrix(self)" } ]
2
null
Implement the Python class `TFMetricUtilsTest` described below. Class description: tf metrics utils unittest Method signatures and docstrings: - def test_accuracy(self): test accuracy - def test_confusion_matrix(self): test confusion matrix
Implement the Python class `TFMetricUtilsTest` described below. Class description: tf metrics utils unittest Method signatures and docstrings: - def test_accuracy(self): test accuracy - def test_confusion_matrix(self): test confusion matrix <|skeleton|> class TFMetricUtilsTest: """tf metrics utils unittest""" ...
7eb4e3be578a680737616efff6858d280595ff48
<|skeleton|> class TFMetricUtilsTest: """tf metrics utils unittest""" def test_accuracy(self): """test accuracy""" <|body_0|> def test_confusion_matrix(self): """test confusion matrix""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TFMetricUtilsTest: """tf metrics utils unittest""" def test_accuracy(self): """test accuracy""" logits = tf.constant([[0.1, 0.2, 0.7], [0.5, 0.2, 0.3], [0.2, 0.2, 0.6]]) labels = tf.constant([2, 0, 1]) output = tf_metrics.accuracy(logits, labels) self.assertAllClos...
the_stack_v2_python_sparse
delta/utils/metrics/tf_metrics_test.py
luffywalf/delta
train
1
52de90c9239df0a5c356aa3a10c15529dbf13a8f
[ "self.address = address\nself.is_alert_auditing_enabled = is_alert_auditing_enabled\nself.is_cluster_auditing_enabled = is_cluster_auditing_enabled\nself.is_data_protection_enabled = is_data_protection_enabled\nself.is_filer_auditing_enabled = is_filer_auditing_enabled\nself.is_ssh_log_enabled = is_ssh_log_enabled\...
<|body_start_0|> self.address = address self.is_alert_auditing_enabled = is_alert_auditing_enabled self.is_cluster_auditing_enabled = is_cluster_auditing_enabled self.is_data_protection_enabled = is_data_protection_enabled self.is_filer_auditing_enabled = is_filer_auditing_enable...
Implementation of the 'OldSyslogServer' model. Specifies the syslog servers configuration to upload Cluster audit logs and filer audit logs. Attributes: address (string, required): Specifies the IP address or hostname of the syslog server. is_alert_auditing_enabled (bool): Specifies if cohesity alert should be sent to ...
OldSyslogServer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OldSyslogServer: """Implementation of the 'OldSyslogServer' model. Specifies the syslog servers configuration to upload Cluster audit logs and filer audit logs. Attributes: address (string, required): Specifies the IP address or hostname of the syslog server. is_alert_auditing_enabled (bool): Spe...
stack_v2_sparse_classes_36k_train_004302
5,035
permissive
[ { "docstring": "Constructor for the OldSyslogServer class", "name": "__init__", "signature": "def __init__(self, address=None, is_alert_auditing_enabled=None, is_cluster_auditing_enabled=None, is_data_protection_enabled=None, is_filer_auditing_enabled=None, is_ssh_log_enabled=None, name=None, port=None,...
2
stack_v2_sparse_classes_30k_train_001353
Implement the Python class `OldSyslogServer` described below. Class description: Implementation of the 'OldSyslogServer' model. Specifies the syslog servers configuration to upload Cluster audit logs and filer audit logs. Attributes: address (string, required): Specifies the IP address or hostname of the syslog server...
Implement the Python class `OldSyslogServer` described below. Class description: Implementation of the 'OldSyslogServer' model. Specifies the syslog servers configuration to upload Cluster audit logs and filer audit logs. Attributes: address (string, required): Specifies the IP address or hostname of the syslog server...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class OldSyslogServer: """Implementation of the 'OldSyslogServer' model. Specifies the syslog servers configuration to upload Cluster audit logs and filer audit logs. Attributes: address (string, required): Specifies the IP address or hostname of the syslog server. is_alert_auditing_enabled (bool): Spe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OldSyslogServer: """Implementation of the 'OldSyslogServer' model. Specifies the syslog servers configuration to upload Cluster audit logs and filer audit logs. Attributes: address (string, required): Specifies the IP address or hostname of the syslog server. is_alert_auditing_enabled (bool): Specifies if coh...
the_stack_v2_python_sparse
cohesity_management_sdk/models/old_syslog_server.py
cohesity/management-sdk-python
train
24
f00defa699fd87c608a01f9856165bda5e4a0fc3
[ "TrainerMixin.__init__(self)\nself.estimator = estimator\nself.file_path = file_path\nself.k = k", "mask_kgb = y != -1\nX_kgb, y_kgb = (X[mask_kgb], y[mask_kgb])\nself.estimator.fit(X_kgb, y_kgb)\npred_cut = pd.qcut(self.estimator.predict_proba(X)[:, 1], self.k, labels=False)\nfor i in range(self.k):\n mask = ...
<|body_start_0|> TrainerMixin.__init__(self) self.estimator = estimator self.file_path = file_path self.k = k <|end_body_0|> <|body_start_1|> mask_kgb = y != -1 X_kgb, y_kgb = (X[mask_kgb], y[mask_kgb]) self.estimator.fit(X_kgb, y_kgb) pred_cut = pd.qcut(...
重新加权法 step 1. 构建KGB模型,并对全量样本打分,得到P(bad)。 step 2. 将全量样本按P(bad)升序排列,分箱统计每箱中的放贷和拒绝样本数。 step 3. 计算每个分箱中放贷好坏样本的权重,weight = (reject + accept) / accept。 step 4. 引入样本权重,利用放贷好坏样本构建KGB模型。
ReWeighting
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReWeighting: """重新加权法 step 1. 构建KGB模型,并对全量样本打分,得到P(bad)。 step 2. 将全量样本按P(bad)升序排列,分箱统计每箱中的放贷和拒绝样本数。 step 3. 计算每个分箱中放贷好坏样本的权重,weight = (reject + accept) / accept。 step 4. 引入样本权重,利用放贷好坏样本构建KGB模型。""" def __init__(self, estimator, file_path: str=None, k: int=10): """初始化函数 :param estimato...
stack_v2_sparse_classes_36k_train_004303
17,175
no_license
[ { "docstring": "初始化函数 :param estimator: 学习器 :param file_path: 最终建模使用样本输出路径 :param k: 分箱数量", "name": "__init__", "signature": "def __init__(self, estimator, file_path: str=None, k: int=10)" }, { "docstring": "拟合学习器 :param X: 包括通过样本和拒绝样本 :param y: -1代表拒绝样本,0,1代表通过样本 :return:", "name": "fit", ...
2
stack_v2_sparse_classes_30k_train_018035
Implement the Python class `ReWeighting` described below. Class description: 重新加权法 step 1. 构建KGB模型,并对全量样本打分,得到P(bad)。 step 2. 将全量样本按P(bad)升序排列,分箱统计每箱中的放贷和拒绝样本数。 step 3. 计算每个分箱中放贷好坏样本的权重,weight = (reject + accept) / accept。 step 4. 引入样本权重,利用放贷好坏样本构建KGB模型。 Method signatures and docstrings: - def __init__(self, estimato...
Implement the Python class `ReWeighting` described below. Class description: 重新加权法 step 1. 构建KGB模型,并对全量样本打分,得到P(bad)。 step 2. 将全量样本按P(bad)升序排列,分箱统计每箱中的放贷和拒绝样本数。 step 3. 计算每个分箱中放贷好坏样本的权重,weight = (reject + accept) / accept。 step 4. 引入样本权重,利用放贷好坏样本构建KGB模型。 Method signatures and docstrings: - def __init__(self, estimato...
1634ac69e8616f85c4233039e2d40246149a1617
<|skeleton|> class ReWeighting: """重新加权法 step 1. 构建KGB模型,并对全量样本打分,得到P(bad)。 step 2. 将全量样本按P(bad)升序排列,分箱统计每箱中的放贷和拒绝样本数。 step 3. 计算每个分箱中放贷好坏样本的权重,weight = (reject + accept) / accept。 step 4. 引入样本权重,利用放贷好坏样本构建KGB模型。""" def __init__(self, estimator, file_path: str=None, k: int=10): """初始化函数 :param estimato...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReWeighting: """重新加权法 step 1. 构建KGB模型,并对全量样本打分,得到P(bad)。 step 2. 将全量样本按P(bad)升序排列,分箱统计每箱中的放贷和拒绝样本数。 step 3. 计算每个分箱中放贷好坏样本的权重,weight = (reject + accept) / accept。 step 4. 引入样本权重,利用放贷好坏样本构建KGB模型。""" def __init__(self, estimator, file_path: str=None, k: int=10): """初始化函数 :param estimator: 学习器 :param...
the_stack_v2_python_sparse
model_training/RITrainer.py
pengliang1226/model_procedure
train
0
338efbda77c256534607e00a3fd209eef6d62c93
[ "kwargs = self.filter_sk_params(Model.predict, kwargs)\nprobas = self.model.predict(x, **kwargs)\nreturn probas", "kwargs = self.filter_sk_params(Model.predict, kwargs)\nprobas = self.model.predict(x, **kwargs)\nreturn np.argmax(probas, axis=1)" ]
<|body_start_0|> kwargs = self.filter_sk_params(Model.predict, kwargs) probas = self.model.predict(x, **kwargs) return probas <|end_body_0|> <|body_start_1|> kwargs = self.filter_sk_params(Model.predict, kwargs) probas = self.model.predict(x, **kwargs) return np.argmax(p...
Helper scikit-learn wrapper for a Keras model. The default KerasClassifier's predict() method does not work for functional Keras models (https://github.com/fchollet/keras/issues/2524); this breaks using this wrapper with the scikit-learn framework (e.g., search methods).
FunctionalKerasClassifier
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FunctionalKerasClassifier: """Helper scikit-learn wrapper for a Keras model. The default KerasClassifier's predict() method does not work for functional Keras models (https://github.com/fchollet/keras/issues/2524); this breaks using this wrapper with the scikit-learn framework (e.g., search metho...
stack_v2_sparse_classes_36k_train_004304
7,877
permissive
[ { "docstring": "Predict classes from features. Args: x: np.array or scipy.sparse.*matrix array of features **kwargs: additional keyword arguments Returns: y_pred: np.array 2-D array of class predicted probabilities", "name": "predict_proba", "signature": "def predict_proba(self, x, **kwargs)" }, { ...
2
null
Implement the Python class `FunctionalKerasClassifier` described below. Class description: Helper scikit-learn wrapper for a Keras model. The default KerasClassifier's predict() method does not work for functional Keras models (https://github.com/fchollet/keras/issues/2524); this breaks using this wrapper with the sci...
Implement the Python class `FunctionalKerasClassifier` described below. Class description: Helper scikit-learn wrapper for a Keras model. The default KerasClassifier's predict() method does not work for functional Keras models (https://github.com/fchollet/keras/issues/2524); this breaks using this wrapper with the sci...
dea327aa9e7ef7f7bca5a6c225dbdca1077a06e9
<|skeleton|> class FunctionalKerasClassifier: """Helper scikit-learn wrapper for a Keras model. The default KerasClassifier's predict() method does not work for functional Keras models (https://github.com/fchollet/keras/issues/2524); this breaks using this wrapper with the scikit-learn framework (e.g., search metho...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FunctionalKerasClassifier: """Helper scikit-learn wrapper for a Keras model. The default KerasClassifier's predict() method does not work for functional Keras models (https://github.com/fchollet/keras/issues/2524); this breaks using this wrapper with the scikit-learn framework (e.g., search methods).""" ...
the_stack_v2_python_sparse
sparse_data/exp_framework/dnn.py
Tarkiyah/googleResearch
train
11
620e6244d1969215d76512ea24d19e9492a8e3c3
[ "\"\"\"\n case 1: Only two points influence each other\n\n (0,1)*\n (0,0)* * (10,0)\n\n \"\"\"\nvertices1 = np.array([[0, 1], [10, 0], [0, 0]])\nd1 = 10\ngradients1 = np.array([[0, 18], [0, 0], [0, -18]])\nenergy1 = 81\n'\\n case 2: Triangle with 45 a deg. angle...
<|body_start_0|> """ case 1: Only two points influence each other (0,1)* (0,0)* * (10,0) """ vertices1 = np.array([[0, 1], [10, 0], [0, 0]]) d1 = 10 gradients1 = np.array([[0, 18], [0, 0], [0, -18]]) ...
TestVertexConstraint
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestVertexConstraint: def setUp(self): """:return:""" <|body_0|> def test_vertex_constraint_grad(self): """Tests whether the vertex_constraint_grad function works.""" <|body_1|> def test_vertex_constraint(self): """Tests whether the vertex_constr...
stack_v2_sparse_classes_36k_train_004305
19,054
no_license
[ { "docstring": ":return:", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Tests whether the vertex_constraint_grad function works.", "name": "test_vertex_constraint_grad", "signature": "def test_vertex_constraint_grad(self)" }, { "docstring": "Tests whether th...
3
stack_v2_sparse_classes_30k_train_007438
Implement the Python class `TestVertexConstraint` described below. Class description: Implement the TestVertexConstraint class. Method signatures and docstrings: - def setUp(self): :return: - def test_vertex_constraint_grad(self): Tests whether the vertex_constraint_grad function works. - def test_vertex_constraint(s...
Implement the Python class `TestVertexConstraint` described below. Class description: Implement the TestVertexConstraint class. Method signatures and docstrings: - def setUp(self): :return: - def test_vertex_constraint_grad(self): Tests whether the vertex_constraint_grad function works. - def test_vertex_constraint(s...
63cbf87823d772c9db18d285f7ff211d18551472
<|skeleton|> class TestVertexConstraint: def setUp(self): """:return:""" <|body_0|> def test_vertex_constraint_grad(self): """Tests whether the vertex_constraint_grad function works.""" <|body_1|> def test_vertex_constraint(self): """Tests whether the vertex_constr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestVertexConstraint: def setUp(self): """:return:""" """ case 1: Only two points influence each other (0,1)* (0,0)* * (10,0) """ vertices1 = np.array([[0, 1], [10, 0], [0, 0]]) d1 = 10 ...
the_stack_v2_python_sparse
main_directory/test_energies.py
Jeronics/cac-segmenter
train
3
7a390cd85462a5e04ac2661a37eb5505404792fa
[ "order = []\nvowels = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']\nans = list(s)\nleft, right = (0, len(ans) - 1)\nwhile left <= right:\n if ans[left] in vowels and ans[right] in vowels:\n ans[left], ans[right] = (ans[right], ans[left])\n left += 1\n right -= 1\n continue\n ...
<|body_start_0|> order = [] vowels = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'] ans = list(s) left, right = (0, len(ans) - 1) while left <= right: if ans[left] in vowels and ans[right] in vowels: ans[left], ans[right] = (ans[right], ans[left]) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseVowels(self, s): """:type s: str :rtype: str""" <|body_0|> def reverseVowels(self, s): """:type s: str :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> order = [] vowels = ['a', 'e', 'i', 'o', 'u', 'A', 'E', '...
stack_v2_sparse_classes_36k_train_004306
1,572
no_license
[ { "docstring": ":type s: str :rtype: str", "name": "reverseVowels", "signature": "def reverseVowels(self, s)" }, { "docstring": ":type s: str :rtype: str", "name": "reverseVowels", "signature": "def reverseVowels(self, s)" } ]
2
stack_v2_sparse_classes_30k_test_000166
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseVowels(self, s): :type s: str :rtype: str - def reverseVowels(self, s): :type s: str :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseVowels(self, s): :type s: str :rtype: str - def reverseVowels(self, s): :type s: str :rtype: str <|skeleton|> class Solution: def reverseVowels(self, s): ...
dda63f5b196bfcdc4062bdad8d47076f36a9d89a
<|skeleton|> class Solution: def reverseVowels(self, s): """:type s: str :rtype: str""" <|body_0|> def reverseVowels(self, s): """:type s: str :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reverseVowels(self, s): """:type s: str :rtype: str""" order = [] vowels = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'] ans = list(s) left, right = (0, len(ans) - 1) while left <= right: if ans[left] in vowels and ans[right] in vo...
the_stack_v2_python_sparse
Google/345_Reverse_Vowels_of_a_String.py
bwang8482/LeetCode
train
1
c60b5913ef4ddf2664966045fbe0baed96323909
[ "result = ''\ntext = wikiText\nwhile True:\n startIdx = text.find('{{')\n if startIdx >= 0:\n result += text[:startIdx]\n endIdx = text.find('}}', startIdx)\n if endIdx >= 0:\n handled = False\n templateText = text[startIdx + 2:endIdx]\n if handler is not ...
<|body_start_0|> result = '' text = wikiText while True: startIdx = text.find('{{') if startIdx >= 0: result += text[:startIdx] endIdx = text.find('}}', startIdx) if endIdx >= 0: handled = False ...
Static helper class for parsing wiki markup text that contains templates. The template parser identifies templates in the given wiki text and replaces them as specified by a :@link ITemplateHandler.
TemplateParser
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TemplateParser: """Static helper class for parsing wiki markup text that contains templates. The template parser identifies templates in the given wiki text and replaces them as specified by a :@link ITemplateHandler.""" def parse(cls, wikiText, handler): """Parse the given wiki text...
stack_v2_sparse_classes_36k_train_004307
6,755
no_license
[ { "docstring": "Parse the given wiki text and substitute each template in the text using the specified template handler.", "name": "parse", "signature": "def parse(cls, wikiText, handler)" }, { "docstring": "Creates a :@link Template from the given text. That is, the template's name and paramete...
2
stack_v2_sparse_classes_30k_train_005505
Implement the Python class `TemplateParser` described below. Class description: Static helper class for parsing wiki markup text that contains templates. The template parser identifies templates in the given wiki text and replaces them as specified by a :@link ITemplateHandler. Method signatures and docstrings: - def...
Implement the Python class `TemplateParser` described below. Class description: Static helper class for parsing wiki markup text that contains templates. The template parser identifies templates in the given wiki text and replaces them as specified by a :@link ITemplateHandler. Method signatures and docstrings: - def...
58e12957dee8b4b18127df9daeb8825d8ada7923
<|skeleton|> class TemplateParser: """Static helper class for parsing wiki markup text that contains templates. The template parser identifies templates in the given wiki text and replaces them as specified by a :@link ITemplateHandler.""" def parse(cls, wikiText, handler): """Parse the given wiki text...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TemplateParser: """Static helper class for parsing wiki markup text that contains templates. The template parser identifies templates in the given wiki text and replaces them as specified by a :@link ITemplateHandler.""" def parse(cls, wikiText, handler): """Parse the given wiki text and substitu...
the_stack_v2_python_sparse
api/util/TemplateParser.py
oldeucryptoboi/wiktionary-parser
train
0
6a3d2f51687307b98ce071de0da9a4952066a91b
[ "result = []\nif not root:\n return result\nqueue = collections.deque()\nqueue.append(root)\nwhile queue:\n node = queue.popleft()\n if node:\n result.append(node.val)\n else:\n result.append('null')\n if node:\n queue.append(node.left)\n queue.append(node.right)\nreturn r...
<|body_start_0|> result = [] if not root: return result queue = collections.deque() queue.append(root) while queue: node = queue.popleft() if node: result.append(node.val) else: result.append('null') ...
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_004308
1,470
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
d8f96b0ec1a85abeef1ce8c0cc409ed501ce088b
<|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""" result = [] if not root: return result queue = collections.deque() queue.append(root) while queue: node = queue.popleft() ...
the_stack_v2_python_sparse
Python/SerializeDeserializeBT.py
miaojiang1987/LeetCode
train
1
c373807f10c6a72c295cb702e3a50002a71bb8fc
[ "if self is EdgeApproach.GRAD_CHOICE or self is EdgeApproach.MULTI_GRAD_CHOICE:\n return True\nreturn False", "if self is EdgeApproach.MULTI or self is EdgeApproach.MULTI_GRAD_CHOICE:\n return True\nreturn False", "if self is EdgeApproach.RANDOM:\n return 'random'\nelif self is EdgeApproach.SINGLE:\n ...
<|body_start_0|> if self is EdgeApproach.GRAD_CHOICE or self is EdgeApproach.MULTI_GRAD_CHOICE: return True return False <|end_body_0|> <|body_start_1|> if self is EdgeApproach.MULTI or self is EdgeApproach.MULTI_GRAD_CHOICE: return True return False <|end_body_1...
an object for the different edge-based-attack approaches
EdgeApproach
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EdgeApproach: """an object for the different edge-based-attack approaches""" def isGlobal(self) -> bool: """whether or not the selected approach is a GLOBAL approach Returns ------- is_global: bool""" <|body_0|> def isMulti(self) -> bool: """whether or not the se...
stack_v2_sparse_classes_36k_train_004309
6,766
no_license
[ { "docstring": "whether or not the selected approach is a GLOBAL approach Returns ------- is_global: bool", "name": "isGlobal", "signature": "def isGlobal(self) -> bool" }, { "docstring": "whether or not the selected approach is a MUTLI approach Returns ------- is_multi: bool", "name": "isMu...
3
stack_v2_sparse_classes_30k_train_014648
Implement the Python class `EdgeApproach` described below. Class description: an object for the different edge-based-attack approaches Method signatures and docstrings: - def isGlobal(self) -> bool: whether or not the selected approach is a GLOBAL approach Returns ------- is_global: bool - def isMulti(self) -> bool: ...
Implement the Python class `EdgeApproach` described below. Class description: an object for the different edge-based-attack approaches Method signatures and docstrings: - def isGlobal(self) -> bool: whether or not the selected approach is a GLOBAL approach Returns ------- is_global: bool - def isMulti(self) -> bool: ...
96ef03959e188c8f12bd47cd190034602fc93b38
<|skeleton|> class EdgeApproach: """an object for the different edge-based-attack approaches""" def isGlobal(self) -> bool: """whether or not the selected approach is a GLOBAL approach Returns ------- is_global: bool""" <|body_0|> def isMulti(self) -> bool: """whether or not the se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EdgeApproach: """an object for the different edge-based-attack approaches""" def isGlobal(self) -> bool: """whether or not the selected approach is a GLOBAL approach Returns ------- is_global: bool""" if self is EdgeApproach.GRAD_CHOICE or self is EdgeApproach.MULTI_GRAD_CHOICE: ...
the_stack_v2_python_sparse
implementation/classes/approach_classes.py
benfinkelshtein/SINGLE
train
8
bbaa932d3795fc8ea56d31e4152e4357673646c8
[ "m = len(findNums)\nn = len(nums)\nif not nums:\n return []\nres = [-1] * m\nloc = {}\nj = 0\nloc[nums[0]] = 0\nfor i in range(m):\n a = findNums[i]\n if a not in loc:\n while nums[j] != a:\n j += 1\n loc[nums[j]] = j\n for k in range(loc[a] + 1, n):\n if nums[k] > a:...
<|body_start_0|> m = len(findNums) n = len(nums) if not nums: return [] res = [-1] * m loc = {} j = 0 loc[nums[0]] = 0 for i in range(m): a = findNums[i] if a not in loc: while nums[j] != a: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def nextGreaterElement(self, findNums, nums): """:type findNums: List[int] :type nums: List[int] :rtype: List[int]""" <|body_0|> def nextGreaterElementsII(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> def findRelativeRan...
stack_v2_sparse_classes_36k_train_004310
2,863
no_license
[ { "docstring": ":type findNums: List[int] :type nums: List[int] :rtype: List[int]", "name": "nextGreaterElement", "signature": "def nextGreaterElement(self, findNums, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "nextGreaterElementsII", "signature": "def ne...
4
stack_v2_sparse_classes_30k_train_018463
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nextGreaterElement(self, findNums, nums): :type findNums: List[int] :type nums: List[int] :rtype: List[int] - def nextGreaterElementsII(self, nums): :type nums: List[int] :rt...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nextGreaterElement(self, findNums, nums): :type findNums: List[int] :type nums: List[int] :rtype: List[int] - def nextGreaterElementsII(self, nums): :type nums: List[int] :rt...
a2841fdb624548fdc6ef430e23ca46f3300e0558
<|skeleton|> class Solution: def nextGreaterElement(self, findNums, nums): """:type findNums: List[int] :type nums: List[int] :rtype: List[int]""" <|body_0|> def nextGreaterElementsII(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> def findRelativeRan...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def nextGreaterElement(self, findNums, nums): """:type findNums: List[int] :type nums: List[int] :rtype: List[int]""" m = len(findNums) n = len(nums) if not nums: return [] res = [-1] * m loc = {} j = 0 loc[nums[0]] = 0 ...
the_stack_v2_python_sparse
weeklyContest18B.py
sfeng77/myleetcode
train
1
b27962bce96f542c1bf887f25951b3caced3a98d
[ "self.api_version = api_version\nself.kind = kind\nself.metadata = metadata\nself.spec = spec", "if dictionary is None:\n return None\napi_version = dictionary.get('apiVersion')\nkind = dictionary.get('kind')\nmetadata = cohesity_management_sdk.models.object_meta.ObjectMeta.from_dictionary(dictionary.get('meta...
<|body_start_0|> self.api_version = api_version self.kind = kind self.metadata = metadata self.spec = spec <|end_body_0|> <|body_start_1|> if dictionary is None: return None api_version = dictionary.get('apiVersion') kind = dictionary.get('kind') ...
Implementation of the 'PVCInfo' model. Message that encapsulates information about a PVC. We only extract relevant information from a larger response sent by Kubernetes. Attributes: api_version (string): APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schem...
PVCInfo
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PVCInfo: """Implementation of the 'PVCInfo' model. Message that encapsulates information about a PVC. We only extract relevant information from a larger response sent by Kubernetes. Attributes: api_version (string): APIVersion defines the versioned schema of this representation of an object. Serv...
stack_v2_sparse_classes_36k_train_004311
2,667
permissive
[ { "docstring": "Constructor for the PVCInfo class", "name": "__init__", "signature": "def __init__(self, api_version=None, kind=None, metadata=None, spec=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation of th...
2
null
Implement the Python class `PVCInfo` described below. Class description: Implementation of the 'PVCInfo' model. Message that encapsulates information about a PVC. We only extract relevant information from a larger response sent by Kubernetes. Attributes: api_version (string): APIVersion defines the versioned schema of...
Implement the Python class `PVCInfo` described below. Class description: Implementation of the 'PVCInfo' model. Message that encapsulates information about a PVC. We only extract relevant information from a larger response sent by Kubernetes. Attributes: api_version (string): APIVersion defines the versioned schema of...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class PVCInfo: """Implementation of the 'PVCInfo' model. Message that encapsulates information about a PVC. We only extract relevant information from a larger response sent by Kubernetes. Attributes: api_version (string): APIVersion defines the versioned schema of this representation of an object. Serv...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PVCInfo: """Implementation of the 'PVCInfo' model. Message that encapsulates information about a PVC. We only extract relevant information from a larger response sent by Kubernetes. Attributes: api_version (string): APIVersion defines the versioned schema of this representation of an object. Servers should co...
the_stack_v2_python_sparse
cohesity_management_sdk/models/pvc_info.py
cohesity/management-sdk-python
train
24
939c8f3e13c277b866ccc25d6381950b72c5b446
[ "if not height:\n return 0\nres = 0\nprev, local_sum = (0, 0)\nindex = height.index(max(height))\nfor h in height[0:index + 1]:\n if h < prev:\n local_sum += prev - h\n else:\n res += local_sum\n local_sum, prev = (0, h)\nprev, local_sum = (0, 0)\nfor i in range(len(height) - 1, index ...
<|body_start_0|> if not height: return 0 res = 0 prev, local_sum = (0, 0) index = height.index(max(height)) for h in height[0:index + 1]: if h < prev: local_sum += prev - h else: res += local_sum ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def trap(self, height): """:type height: List[int] :rtype: int""" <|body_0|> def trap2(self, A): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not height: return 0 res = 0 ...
stack_v2_sparse_classes_36k_train_004312
1,274
no_license
[ { "docstring": ":type height: List[int] :rtype: int", "name": "trap", "signature": "def trap(self, height)" }, { "docstring": ":type height: List[int] :rtype: int", "name": "trap2", "signature": "def trap2(self, A)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def trap(self, height): :type height: List[int] :rtype: int - def trap2(self, A): :type height: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def trap(self, height): :type height: List[int] :rtype: int - def trap2(self, A): :type height: List[int] :rtype: int <|skeleton|> class Solution: def trap(self, height): ...
4aa3a3a0da8b911e140446352debb9b567b6d78b
<|skeleton|> class Solution: def trap(self, height): """:type height: List[int] :rtype: int""" <|body_0|> def trap2(self, A): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def trap(self, height): """:type height: List[int] :rtype: int""" if not height: return 0 res = 0 prev, local_sum = (0, 0) index = height.index(max(height)) for h in height[0:index + 1]: if h < prev: local_sum +=...
the_stack_v2_python_sparse
trapping_rain_water_42.py
adiggo/leetcode_py
train
0
672cdab38bcbc5817b8d16904c9db78e1612bb42
[ "diagonal = {}\nfor i, lst in enumerate(nums):\n for j, num in enumerate(lst):\n if i + j not in diagonal:\n diagonal[i + j] = []\n diagonal[i + j].append(num)\nrst = []\nfor i in range(len(diagonal)):\n rst.extend(list(reversed(diagonal[i])))\nreturn rst", "rst = []\nfor i, lst in ...
<|body_start_0|> diagonal = {} for i, lst in enumerate(nums): for j, num in enumerate(lst): if i + j not in diagonal: diagonal[i + j] = [] diagonal[i + j].append(num) rst = [] for i in range(len(diagonal)): rst.e...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findDiagonalOrder(self, nums: List[List[int]]) -> List[int]: """使用dict存储""" <|body_0|> def findDiagonalOrder_2(self, nums: List[List[int]]) -> List[int]: """使用list存储""" <|body_1|> <|end_skeleton|> <|body_start_0|> diagonal = {} ...
stack_v2_sparse_classes_36k_train_004313
1,309
no_license
[ { "docstring": "使用dict存储", "name": "findDiagonalOrder", "signature": "def findDiagonalOrder(self, nums: List[List[int]]) -> List[int]" }, { "docstring": "使用list存储", "name": "findDiagonalOrder_2", "signature": "def findDiagonalOrder_2(self, nums: List[List[int]]) -> List[int]" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findDiagonalOrder(self, nums: List[List[int]]) -> List[int]: 使用dict存储 - def findDiagonalOrder_2(self, nums: List[List[int]]) -> List[int]: 使用list存储
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findDiagonalOrder(self, nums: List[List[int]]) -> List[int]: 使用dict存储 - def findDiagonalOrder_2(self, nums: List[List[int]]) -> List[int]: 使用list存储 <|skeleton|> class Soluti...
e420eb456086db32d1d6b9576c8dcd73e041cbef
<|skeleton|> class Solution: def findDiagonalOrder(self, nums: List[List[int]]) -> List[int]: """使用dict存储""" <|body_0|> def findDiagonalOrder_2(self, nums: List[List[int]]) -> List[int]: """使用list存储""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findDiagonalOrder(self, nums: List[List[int]]) -> List[int]: """使用dict存储""" diagonal = {} for i, lst in enumerate(nums): for j, num in enumerate(lst): if i + j not in diagonal: diagonal[i + j] = [] diagonal[i...
the_stack_v2_python_sparse
TrainFor1024/others/1424.py
yangwei-nlp/LeetCode-Python
train
0
d3780d70e5a147f2bb59781c3b19ccfac1c3c115
[ "self.base_name = name\nself.cmd = cmd\nself.params = list(param_generator)\nself.env_vars = env_vars", "num_experiments = 1 if len(self.params) == 0 else len(self.params)\nfor experiment_idx in range(num_experiments):\n cmd_tokens = [self.cmd]\n experiment_name_tokens = [self.base_name]\n param_shorthan...
<|body_start_0|> self.base_name = name self.cmd = cmd self.params = list(param_generator) self.env_vars = env_vars <|end_body_0|> <|body_start_1|> num_experiments = 1 if len(self.params) == 0 else len(self.params) for experiment_idx in range(num_experiments): ...
Experiment
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Experiment: def __init__(self, name, cmd, param_generator=(), env_vars=None): """:param cmd: base command to append the parameters to :param param_generator: iterable of parameter dicts""" <|body_0|> def generate_experiments(self, experiment_arg_name, customize_experiment_na...
stack_v2_sparse_classes_36k_train_004314
7,490
permissive
[ { "docstring": ":param cmd: base command to append the parameters to :param param_generator: iterable of parameter dicts", "name": "__init__", "signature": "def __init__(self, name, cmd, param_generator=(), env_vars=None)" }, { "docstring": "Yields tuples of (cmd, experiment_name)", "name": ...
2
stack_v2_sparse_classes_30k_train_000259
Implement the Python class `Experiment` described below. Class description: Implement the Experiment class. Method signatures and docstrings: - def __init__(self, name, cmd, param_generator=(), env_vars=None): :param cmd: base command to append the parameters to :param param_generator: iterable of parameter dicts - d...
Implement the Python class `Experiment` described below. Class description: Implement the Experiment class. Method signatures and docstrings: - def __init__(self, name, cmd, param_generator=(), env_vars=None): :param cmd: base command to append the parameters to :param param_generator: iterable of parameter dicts - d...
7e1e69550f4de4cdc003d8db5bb39e186803aee9
<|skeleton|> class Experiment: def __init__(self, name, cmd, param_generator=(), env_vars=None): """:param cmd: base command to append the parameters to :param param_generator: iterable of parameter dicts""" <|body_0|> def generate_experiments(self, experiment_arg_name, customize_experiment_na...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Experiment: def __init__(self, name, cmd, param_generator=(), env_vars=None): """:param cmd: base command to append the parameters to :param param_generator: iterable of parameter dicts""" self.base_name = name self.cmd = cmd self.params = list(param_generator) self.env...
the_stack_v2_python_sparse
sample_factory/launcher/run_description.py
alex-petrenko/sample-factory
train
644
7b68256b40c277ef2e6d3eb26675c4a8d7bf005d
[ "super(SelfAttention, self).__init__()\nset_seed()\nself._hidden_size = kwargs.get('hidden_size', 128)\nself._expansion_size = kwargs.get('expansion_size', 1024)\nself._attention_layers = kwargs.get('attention_layers', 512)\nself._activation_fn = kwargs.get('activation_fn', 'leaky ReLU')\nself._seqlen = kwargs.get(...
<|body_start_0|> super(SelfAttention, self).__init__() set_seed() self._hidden_size = kwargs.get('hidden_size', 128) self._expansion_size = kwargs.get('expansion_size', 1024) self._attention_layers = kwargs.get('attention_layers', 512) self._activation_fn = kwargs.get('ac...
SelfAttention
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SelfAttention: def __init__(self, **kwargs): """Initialiser. : expansion_size (int): adjustable hyperparameter. Intermediate dimension to yield attention weights : hidden_size (int): hidden units after concatenating the hidden units for both directions : attention_layers (int): : seqlen ...
stack_v2_sparse_classes_36k_train_004315
28,550
permissive
[ { "docstring": "Initialiser. : expansion_size (int): adjustable hyperparameter. Intermediate dimension to yield attention weights : hidden_size (int): hidden units after concatenating the hidden units for both directions : attention_layers (int): : seqlen (int): length of the padded SMILES string", "name": ...
4
stack_v2_sparse_classes_30k_train_002762
Implement the Python class `SelfAttention` described below. Class description: Implement the SelfAttention class. Method signatures and docstrings: - def __init__(self, **kwargs): Initialiser. : expansion_size (int): adjustable hyperparameter. Intermediate dimension to yield attention weights : hidden_size (int): hid...
Implement the Python class `SelfAttention` described below. Class description: Implement the SelfAttention class. Method signatures and docstrings: - def __init__(self, **kwargs): Initialiser. : expansion_size (int): adjustable hyperparameter. Intermediate dimension to yield attention weights : hidden_size (int): hid...
a730e02153709b9c0e7f83deb0042ae9f9c1ce15
<|skeleton|> class SelfAttention: def __init__(self, **kwargs): """Initialiser. : expansion_size (int): adjustable hyperparameter. Intermediate dimension to yield attention weights : hidden_size (int): hidden units after concatenating the hidden units for both directions : attention_layers (int): : seqlen ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SelfAttention: def __init__(self, **kwargs): """Initialiser. : expansion_size (int): adjustable hyperparameter. Intermediate dimension to yield attention weights : hidden_size (int): hidden units after concatenating the hidden units for both directions : attention_layers (int): : seqlen (int): length ...
the_stack_v2_python_sparse
model/snn.py
licj1/Siamese-RNN-Self-Attention
train
0
536fce87c6c80651254a716fdf6c5268173018ab
[ "driver = self.driver\nexpanded = test.element_exists(driver, self.MENU_CONTAINER_LOCATOR) and self.find_element(self.MENU_CONTAINER_LOCATOR).is_displayed()\nreturn expanded", "button = self.find_element(self.EXPAND_BUTTON_LOCATOR)\nif not self.fixed:\n actions.scroll.into_view(self.driver, button)\nbutton.cli...
<|body_start_0|> driver = self.driver expanded = test.element_exists(driver, self.MENU_CONTAINER_LOCATOR) and self.find_element(self.MENU_CONTAINER_LOCATOR).is_displayed() return expanded <|end_body_0|> <|body_start_1|> button = self.find_element(self.EXPAND_BUTTON_LOCATOR) if n...
Subclass of :class:`NavObject` with additional methods for collapsible nav menus In addition to the variables for :class:`NavObject`, the following variables need to be defined for collapsible navs :var EXPAND_BUTTON_LOCATOR: Locator for the button that expands the nav menu :var COLLAPSE_BUTTON_LOCATOR: Locator for the...
CollapsibleNavObject
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CollapsibleNavObject: """Subclass of :class:`NavObject` with additional methods for collapsible nav menus In addition to the variables for :class:`NavObject`, the following variables need to be defined for collapsible navs :var EXPAND_BUTTON_LOCATOR: Locator for the button that expands the nav me...
stack_v2_sparse_classes_36k_train_004316
4,428
permissive
[ { "docstring": "Check if the nav menu is expanded This method checks if the element located by :attr:`MENU_CONTAINER_LOCATOR` exists and is visible. This should be sufficient for many common implementations of collapsible navs, but can be overridden if this isn't a reliable detection method for an implementatio...
3
null
Implement the Python class `CollapsibleNavObject` described below. Class description: Subclass of :class:`NavObject` with additional methods for collapsible nav menus In addition to the variables for :class:`NavObject`, the following variables need to be defined for collapsible navs :var EXPAND_BUTTON_LOCATOR: Locator...
Implement the Python class `CollapsibleNavObject` described below. Class description: Subclass of :class:`NavObject` with additional methods for collapsible nav menus In addition to the variables for :class:`NavObject`, the following variables need to be defined for collapsible navs :var EXPAND_BUTTON_LOCATOR: Locator...
31c91905611dee9cc13dbf37e7c0cfbf9ca0173f
<|skeleton|> class CollapsibleNavObject: """Subclass of :class:`NavObject` with additional methods for collapsible nav menus In addition to the variables for :class:`NavObject`, the following variables need to be defined for collapsible navs :var EXPAND_BUTTON_LOCATOR: Locator for the button that expands the nav me...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CollapsibleNavObject: """Subclass of :class:`NavObject` with additional methods for collapsible nav menus In addition to the variables for :class:`NavObject`, the following variables need to be defined for collapsible navs :var EXPAND_BUTTON_LOCATOR: Locator for the button that expands the nav menu :var COLLA...
the_stack_v2_python_sparse
venv/lib/python3.5/site-packages/webdriver_test_tools/pageobject/nav.py
alexmudra/python_experiments
train
0
63713407184a93986c403a48e68e687c41b2b73f
[ "def count(inv_idx, m, left, right):\n return bisect.bisect_right(inv_idx[m], right) - bisect.bisect_left(inv_idx[m], left)\nself.__arr = arr\nself.__inv_idx = collections.defaultdict(list)\nfor i, x in enumerate(self.__arr):\n self.__inv_idx[x].append(i)\nself.__segment_tree = SegmentTreeRecu(arr, functools....
<|body_start_0|> def count(inv_idx, m, left, right): return bisect.bisect_right(inv_idx[m], right) - bisect.bisect_left(inv_idx[m], left) self.__arr = arr self.__inv_idx = collections.defaultdict(list) for i, x in enumerate(self.__arr): self.__inv_idx[x].append(i)...
MajorityChecker1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MajorityChecker1: def __init__(self, arr): """:type arr: List[int]""" <|body_0|> def query(self, left, right, threshold): """:type left: int :type right: int :type threshold: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> def count(...
stack_v2_sparse_classes_36k_train_004317
6,042
no_license
[ { "docstring": ":type arr: List[int]", "name": "__init__", "signature": "def __init__(self, arr)" }, { "docstring": ":type left: int :type right: int :type threshold: int :rtype: int", "name": "query", "signature": "def query(self, left, right, threshold)" } ]
2
stack_v2_sparse_classes_30k_train_018599
Implement the Python class `MajorityChecker1` described below. Class description: Implement the MajorityChecker1 class. Method signatures and docstrings: - def __init__(self, arr): :type arr: List[int] - def query(self, left, right, threshold): :type left: int :type right: int :type threshold: int :rtype: int
Implement the Python class `MajorityChecker1` described below. Class description: Implement the MajorityChecker1 class. Method signatures and docstrings: - def __init__(self, arr): :type arr: List[int] - def query(self, left, right, threshold): :type left: int :type right: int :type threshold: int :rtype: int <|skel...
44765a7d89423b7ec2c159f70b1a6f6e446523c2
<|skeleton|> class MajorityChecker1: def __init__(self, arr): """:type arr: List[int]""" <|body_0|> def query(self, left, right, threshold): """:type left: int :type right: int :type threshold: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MajorityChecker1: def __init__(self, arr): """:type arr: List[int]""" def count(inv_idx, m, left, right): return bisect.bisect_right(inv_idx[m], right) - bisect.bisect_left(inv_idx[m], left) self.__arr = arr self.__inv_idx = collections.defaultdict(list) for...
the_stack_v2_python_sparse
python/_1001_1500/1157_online-majority-element-in-subarray.py
Wang-Yann/LeetCodeMe
train
0
7d9960d2ae1e01f4f501629c5177b1dc6692b1ca
[ "if subarray_beam_ids is None:\n subarray_beam_ids = []\nif station_ids is None:\n station_ids = []\nif channel_blocks is None:\n channel_blocks = []\nself.interface = interface\nself.subarray_beam_ids = list(subarray_beam_ids)\nself.station_ids = list(station_ids)\nself.channel_blocks = list(channel_block...
<|body_start_0|> if subarray_beam_ids is None: subarray_beam_ids = [] if station_ids is None: station_ids = [] if channel_blocks is None: channel_blocks = [] self.interface = interface self.subarray_beam_ids = list(subarray_beam_ids) se...
AssignedResources is the object representation of the JSON returned by the MCCSSubarray.assigned_resources attribute.
AssignedResources
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AssignedResources: """AssignedResources is the object representation of the JSON returned by the MCCSSubarray.assigned_resources attribute.""" def __init__(self, *, interface: Optional[str]=SCHEMA, subarray_beam_ids: List[int]=None, station_ids: List[List[int]]=None, channel_blocks: List[int...
stack_v2_sparse_classes_36k_train_004318
2,045
permissive
[ { "docstring": "Create a new object for an MCCSSubarray.assigned_resources response. :param subarray_beam_ids: subarray beam IDs to allocate to the subarray :param station_ids: IDs of stations to allocate :param channel_blocks: channels to allocate :param interface: the JSON schema this object claims to be comp...
2
stack_v2_sparse_classes_30k_train_018029
Implement the Python class `AssignedResources` described below. Class description: AssignedResources is the object representation of the JSON returned by the MCCSSubarray.assigned_resources attribute. Method signatures and docstrings: - def __init__(self, *, interface: Optional[str]=SCHEMA, subarray_beam_ids: List[in...
Implement the Python class `AssignedResources` described below. Class description: AssignedResources is the object representation of the JSON returned by the MCCSSubarray.assigned_resources attribute. Method signatures and docstrings: - def __init__(self, *, interface: Optional[str]=SCHEMA, subarray_beam_ids: List[in...
87083655aca8f8f53a26dba253a0189d8519714b
<|skeleton|> class AssignedResources: """AssignedResources is the object representation of the JSON returned by the MCCSSubarray.assigned_resources attribute.""" def __init__(self, *, interface: Optional[str]=SCHEMA, subarray_beam_ids: List[int]=None, station_ids: List[List[int]]=None, channel_blocks: List[int...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AssignedResources: """AssignedResources is the object representation of the JSON returned by the MCCSSubarray.assigned_resources attribute.""" def __init__(self, *, interface: Optional[str]=SCHEMA, subarray_beam_ids: List[int]=None, station_ids: List[List[int]]=None, channel_blocks: List[int]=None): ...
the_stack_v2_python_sparse
src/ska_tmc_cdm/messages/mccssubarray/assigned_resources.py
ska-telescope/cdm-shared-library
train
0
8e5d0a34919d67fa0b258a7135ff62540a52a347
[ "pos = 0\nfound = False\nwhile pos < len(alist) and (not found):\n if alist[pos] == item:\n found = True\n else:\n pos = pos + 1\nreturn found", "pos = 0\nfound = False\nstop = False\nwhile pos < len(alist) and (not found) and (not stop):\n if alist[pos] == item:\n found = True\n ...
<|body_start_0|> pos = 0 found = False while pos < len(alist) and (not found): if alist[pos] == item: found = True else: pos = pos + 1 return found <|end_body_0|> <|body_start_1|> pos = 0 found = False stop ...
Class that performs searching techniques on given data.
SearchingAlgs
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SearchingAlgs: """Class that performs searching techniques on given data.""" def unorderedSequentialSearch(self, alist, item): """Search an item using sequential/linear search technique .""" <|body_0|> def orderedSequentialSearch(self, alist, item): """Search an ...
stack_v2_sparse_classes_36k_train_004319
1,545
no_license
[ { "docstring": "Search an item using sequential/linear search technique .", "name": "unorderedSequentialSearch", "signature": "def unorderedSequentialSearch(self, alist, item)" }, { "docstring": "Search an item in an ordered list using sequential search technique.", "name": "orderedSequentia...
2
null
Implement the Python class `SearchingAlgs` described below. Class description: Class that performs searching techniques on given data. Method signatures and docstrings: - def unorderedSequentialSearch(self, alist, item): Search an item using sequential/linear search technique . - def orderedSequentialSearch(self, ali...
Implement the Python class `SearchingAlgs` described below. Class description: Class that performs searching techniques on given data. Method signatures and docstrings: - def unorderedSequentialSearch(self, alist, item): Search an item using sequential/linear search technique . - def orderedSequentialSearch(self, ali...
7235f5d37d76d696037a1ad66885a76742ff3b18
<|skeleton|> class SearchingAlgs: """Class that performs searching techniques on given data.""" def unorderedSequentialSearch(self, alist, item): """Search an item using sequential/linear search technique .""" <|body_0|> def orderedSequentialSearch(self, alist, item): """Search an ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SearchingAlgs: """Class that performs searching techniques on given data.""" def unorderedSequentialSearch(self, alist, item): """Search an item using sequential/linear search technique .""" pos = 0 found = False while pos < len(alist) and (not found): if alist...
the_stack_v2_python_sparse
algorithms/searching/searching_algs.py
dhanraju/python
train
0
77a3b5ae2e761b991f9a0655ec958169e3368494
[ "sample_params = self.param_kwargs.copy()\nfor param_name in self.EXTRA_PARAMS:\n del sample_params[param_name]\nreturn sample_params", "cohort_params = self.sample_params()\ndel cohort_params['sample']\nreturn cohort_params" ]
<|body_start_0|> sample_params = self.param_kwargs.copy() for param_name in self.EXTRA_PARAMS: del sample_params[param_name] return sample_params <|end_body_0|> <|body_start_1|> cohort_params = self.sample_params() del cohort_params['sample'] return cohort_pa...
Abstract class to provide common parameters to GenerateReports and GenerateReportsCohort. See the former class for a full explanation of each parameter.
ReportsTask
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReportsTask: """Abstract class to provide common parameters to GenerateReports and GenerateReportsCohort. See the former class for a full explanation of each parameter.""" def sample_params(self): """Remove the extra parameters that the report generation needs, but that are not neede...
stack_v2_sparse_classes_36k_train_004320
1,387
no_license
[ { "docstring": "Remove the extra parameters that the report generation needs, but that are not needed or expected by the tasks upstream:", "name": "sample_params", "signature": "def sample_params(self)" }, { "docstring": "Remove all the extra parameters of the report generation and also remove t...
2
stack_v2_sparse_classes_30k_train_006393
Implement the Python class `ReportsTask` described below. Class description: Abstract class to provide common parameters to GenerateReports and GenerateReportsCohort. See the former class for a full explanation of each parameter. Method signatures and docstrings: - def sample_params(self): Remove the extra parameters...
Implement the Python class `ReportsTask` described below. Class description: Abstract class to provide common parameters to GenerateReports and GenerateReportsCohort. See the former class for a full explanation of each parameter. Method signatures and docstrings: - def sample_params(self): Remove the extra parameters...
040a62c11e5bae306e2de4cc3e0a78772ee580b3
<|skeleton|> class ReportsTask: """Abstract class to provide common parameters to GenerateReports and GenerateReportsCohort. See the former class for a full explanation of each parameter.""" def sample_params(self): """Remove the extra parameters that the report generation needs, but that are not neede...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReportsTask: """Abstract class to provide common parameters to GenerateReports and GenerateReportsCohort. See the former class for a full explanation of each parameter.""" def sample_params(self): """Remove the extra parameters that the report generation needs, but that are not needed or expected...
the_stack_v2_python_sparse
paip/task_types/reports_task.py
biocodices/paip
train
1
981207fc1e8b1b076d16b04652d745c16a15ffba
[ "try:\n challenge = doc.attrib['challenge']\nexcept KeyError:\n challenge = None\npairiter = doc.iter('pair')\nreturn [RTEPair(pair, challenge=challenge) for pair in pairiter]", "if isinstance(fileids, str):\n fileids = [fileids]\nreturn concat([self._read_etree(self.xml(fileid)) for fileid in fileids])"...
<|body_start_0|> try: challenge = doc.attrib['challenge'] except KeyError: challenge = None pairiter = doc.iter('pair') return [RTEPair(pair, challenge=challenge) for pair in pairiter] <|end_body_0|> <|body_start_1|> if isinstance(fileids, str): ...
Corpus reader for corpora in RTE challenges. This is just a wrapper around the XMLCorpusReader. See module docstring above for the expected structure of input documents.
RTECorpusReader
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "CC-BY-NC-ND-3.0", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RTECorpusReader: """Corpus reader for corpora in RTE challenges. This is just a wrapper around the XMLCorpusReader. See module docstring above for the expected structure of input documents.""" def _read_etree(self, doc): """Map the XML input into an RTEPair. This uses the ``getiterat...
stack_v2_sparse_classes_36k_train_004321
4,639
permissive
[ { "docstring": "Map the XML input into an RTEPair. This uses the ``getiterator()`` method from the ElementTree package to find all the ``<pair>`` elements. :param doc: a parsed XML document :rtype: list(RTEPair)", "name": "_read_etree", "signature": "def _read_etree(self, doc)" }, { "docstring":...
2
stack_v2_sparse_classes_30k_train_003346
Implement the Python class `RTECorpusReader` described below. Class description: Corpus reader for corpora in RTE challenges. This is just a wrapper around the XMLCorpusReader. See module docstring above for the expected structure of input documents. Method signatures and docstrings: - def _read_etree(self, doc): Map...
Implement the Python class `RTECorpusReader` described below. Class description: Corpus reader for corpora in RTE challenges. This is just a wrapper around the XMLCorpusReader. See module docstring above for the expected structure of input documents. Method signatures and docstrings: - def _read_etree(self, doc): Map...
582e6e35f0e6c984b44ec49dcb8846d9c011d0a8
<|skeleton|> class RTECorpusReader: """Corpus reader for corpora in RTE challenges. This is just a wrapper around the XMLCorpusReader. See module docstring above for the expected structure of input documents.""" def _read_etree(self, doc): """Map the XML input into an RTEPair. This uses the ``getiterat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RTECorpusReader: """Corpus reader for corpora in RTE challenges. This is just a wrapper around the XMLCorpusReader. See module docstring above for the expected structure of input documents.""" def _read_etree(self, doc): """Map the XML input into an RTEPair. This uses the ``getiterator()`` method...
the_stack_v2_python_sparse
nltk/corpus/reader/rte.py
nltk/nltk
train
11,860
181461c35702ffb5572d06c50837d6edc3d9982a
[ "rows = len(grid)\nif rows == 0:\n return 0\ncols = len(grid[0])\ndirs = [(-1, 0), (1, 0), (0, -1), (0, 1)]\nself.marks = [[False] * cols for _ in range(rows)]\nans = 0\n\ndef dfs(i, j):\n self.marks[i][j] = True\n for d in dirs:\n x, y = (d[0] + i, d[1] + j)\n if 0 <= x < rows and 0 <= y < c...
<|body_start_0|> rows = len(grid) if rows == 0: return 0 cols = len(grid[0]) dirs = [(-1, 0), (1, 0), (0, -1), (0, 1)] self.marks = [[False] * cols for _ in range(rows)] ans = 0 def dfs(i, j): self.marks[i][j] = True for d in d...
给定一个由 '1'(陆地)和 '0'(水)组成的的二维网格,计算岛屿的数量。一个岛被水包围, 并且它是通过水平方向或垂直方向上相邻的陆地连接而成的。你可以假设网格的四个边均被水包围。
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """给定一个由 '1'(陆地)和 '0'(水)组成的的二维网格,计算岛屿的数量。一个岛被水包围, 并且它是通过水平方向或垂直方向上相邻的陆地连接而成的。你可以假设网格的四个边均被水包围。""" def numIslands_dfs(self, grid) -> int: """遍历岛屿, self.marks[i][j]标记已经查找过的网格 深度优先, 回溯法""" <|body_0|> def numIslands_bfs(self, grid) -> int: """广度优先, 数组存储单个岛屿...
stack_v2_sparse_classes_36k_train_004322
3,903
permissive
[ { "docstring": "遍历岛屿, self.marks[i][j]标记已经查找过的网格 深度优先, 回溯法", "name": "numIslands_dfs", "signature": "def numIslands_dfs(self, grid) -> int" }, { "docstring": "广度优先, 数组存储单个岛屿所有的网格", "name": "numIslands_bfs", "signature": "def numIslands_bfs(self, grid) -> int" }, { "docstring": "并...
3
stack_v2_sparse_classes_30k_train_011721
Implement the Python class `Solution` described below. Class description: 给定一个由 '1'(陆地)和 '0'(水)组成的的二维网格,计算岛屿的数量。一个岛被水包围, 并且它是通过水平方向或垂直方向上相邻的陆地连接而成的。你可以假设网格的四个边均被水包围。 Method signatures and docstrings: - def numIslands_dfs(self, grid) -> int: 遍历岛屿, self.marks[i][j]标记已经查找过的网格 深度优先, 回溯法 - def numIslands_bfs(self, grid) -...
Implement the Python class `Solution` described below. Class description: 给定一个由 '1'(陆地)和 '0'(水)组成的的二维网格,计算岛屿的数量。一个岛被水包围, 并且它是通过水平方向或垂直方向上相邻的陆地连接而成的。你可以假设网格的四个边均被水包围。 Method signatures and docstrings: - def numIslands_dfs(self, grid) -> int: 遍历岛屿, self.marks[i][j]标记已经查找过的网格 深度优先, 回溯法 - def numIslands_bfs(self, grid) -...
9f49766a2b375a6c65f7bfa96df513875ddd772d
<|skeleton|> class Solution: """给定一个由 '1'(陆地)和 '0'(水)组成的的二维网格,计算岛屿的数量。一个岛被水包围, 并且它是通过水平方向或垂直方向上相邻的陆地连接而成的。你可以假设网格的四个边均被水包围。""" def numIslands_dfs(self, grid) -> int: """遍历岛屿, self.marks[i][j]标记已经查找过的网格 深度优先, 回溯法""" <|body_0|> def numIslands_bfs(self, grid) -> int: """广度优先, 数组存储单个岛屿...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """给定一个由 '1'(陆地)和 '0'(水)组成的的二维网格,计算岛屿的数量。一个岛被水包围, 并且它是通过水平方向或垂直方向上相邻的陆地连接而成的。你可以假设网格的四个边均被水包围。""" def numIslands_dfs(self, grid) -> int: """遍历岛屿, self.marks[i][j]标记已经查找过的网格 深度优先, 回溯法""" rows = len(grid) if rows == 0: return 0 cols = len(grid[0]) ...
the_stack_v2_python_sparse
Leetcode/200.numIslands.py
Song2017/Leetcode_python
train
1
8db25d8068975d54c140c65ee9a58d80caac5a8b
[ "if isinstance(key, int):\n return HomeAddressReply(key)\nif key not in HomeAddressReply._member_map_:\n return extend_enum(HomeAddressReply, key, default)\nreturn HomeAddressReply[key]", "if not (isinstance(value, int) and 0 <= value <= 255):\n raise ValueError('%r is not a valid %s' % (value, cls.__nam...
<|body_start_0|> if isinstance(key, int): return HomeAddressReply(key) if key not in HomeAddressReply._member_map_: return extend_enum(HomeAddressReply, key, default) return HomeAddressReply[key] <|end_body_0|> <|body_start_1|> if not (isinstance(value, int) and ...
[HomeAddressReply] IPv4 Home Address Reply Status Codes
HomeAddressReply
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HomeAddressReply: """[HomeAddressReply] IPv4 Home Address Reply Status Codes""" def get(key: 'int | str', default: 'int'=-1) -> 'HomeAddressReply': """Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:""" ...
stack_v2_sparse_classes_36k_train_004323
2,296
permissive
[ { "docstring": "Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:", "name": "get", "signature": "def get(key: 'int | str', default: 'int'=-1) -> 'HomeAddressReply'" }, { "docstring": "Lookup function used when value is not f...
2
null
Implement the Python class `HomeAddressReply` described below. Class description: [HomeAddressReply] IPv4 Home Address Reply Status Codes Method signatures and docstrings: - def get(key: 'int | str', default: 'int'=-1) -> 'HomeAddressReply': Backport support for original codes. Args: key: Key to get enum item. defaul...
Implement the Python class `HomeAddressReply` described below. Class description: [HomeAddressReply] IPv4 Home Address Reply Status Codes Method signatures and docstrings: - def get(key: 'int | str', default: 'int'=-1) -> 'HomeAddressReply': Backport support for original codes. Args: key: Key to get enum item. defaul...
a6fe49ec58f09e105bec5a00fb66d9b3f22730d9
<|skeleton|> class HomeAddressReply: """[HomeAddressReply] IPv4 Home Address Reply Status Codes""" def get(key: 'int | str', default: 'int'=-1) -> 'HomeAddressReply': """Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HomeAddressReply: """[HomeAddressReply] IPv4 Home Address Reply Status Codes""" def get(key: 'int | str', default: 'int'=-1) -> 'HomeAddressReply': """Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:""" if isinstance...
the_stack_v2_python_sparse
pcapkit/const/mh/home_address_reply.py
JarryShaw/PyPCAPKit
train
204
545fed3f1a27a00c8da8f7b56d5a0ab5ff200dce
[ "self.headers = headers or {}\nself.cookies = cookies or {}\nif request:\n token = request.QUERY.get(settings.SESSION_COOKIE_NAME) or request.META.get('HTTP_TBKT_TOKEN') or request.COOKIES.get('tbkt_token')\n self.cookies['tbkt_token'] = token", "assert alias in settings.API_URLROOT, alias\nurlroot = settin...
<|body_start_0|> self.headers = headers or {} self.cookies = cookies or {} if request: token = request.QUERY.get(settings.SESSION_COOKIE_NAME) or request.META.get('HTTP_TBKT_TOKEN') or request.COOKIES.get('tbkt_token') self.cookies['tbkt_token'] = token <|end_body_0|> <|...
Hub
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Hub: def __init__(self, request=None, headers=None, cookies=None): """:param request: django.http.HttpRequest对象 如果request不为空, 意味着每次调用都携带登录状态 :param headers: 自定义公共头部字典 :param cookies: 自定义公共cookie字典""" <|body_0|> def __getattr__(self, alias): """:param alias: 接口服务器别名 公...
stack_v2_sparse_classes_36k_train_004324
4,472
no_license
[ { "docstring": ":param request: django.http.HttpRequest对象 如果request不为空, 意味着每次调用都携带登录状态 :param headers: 自定义公共头部字典 :param cookies: 自定义公共cookie字典", "name": "__init__", "signature": "def __init__(self, request=None, headers=None, cookies=None)" }, { "docstring": ":param alias: 接口服务器别名 公共接口: com 银行接口...
2
stack_v2_sparse_classes_30k_train_017156
Implement the Python class `Hub` described below. Class description: Implement the Hub class. Method signatures and docstrings: - def __init__(self, request=None, headers=None, cookies=None): :param request: django.http.HttpRequest对象 如果request不为空, 意味着每次调用都携带登录状态 :param headers: 自定义公共头部字典 :param cookies: 自定义公共cookie字典...
Implement the Python class `Hub` described below. Class description: Implement the Hub class. Method signatures and docstrings: - def __init__(self, request=None, headers=None, cookies=None): :param request: django.http.HttpRequest对象 如果request不为空, 意味着每次调用都携带登录状态 :param headers: 自定义公共头部字典 :param cookies: 自定义公共cookie字典...
1f08cbfccc1ae2123d92670c0afed9b59ae645b8
<|skeleton|> class Hub: def __init__(self, request=None, headers=None, cookies=None): """:param request: django.http.HttpRequest对象 如果request不为空, 意味着每次调用都携带登录状态 :param headers: 自定义公共头部字典 :param cookies: 自定义公共cookie字典""" <|body_0|> def __getattr__(self, alias): """:param alias: 接口服务器别名 公...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Hub: def __init__(self, request=None, headers=None, cookies=None): """:param request: django.http.HttpRequest对象 如果request不为空, 意味着每次调用都携带登录状态 :param headers: 自定义公共头部字典 :param cookies: 自定义公共cookie字典""" self.headers = headers or {} self.cookies = cookies or {} if request: ...
the_stack_v2_python_sparse
tbkt/libs/utils/tbktapi.py
GUAN-YE/hd_api_djs
train
1
4aab9a9cbcee3e6c40fff168ed9e4b53f3bb4e9e
[ "if not matrix:\n return\nm, n = (len(matrix), len(matrix[0]))\ndp = [[matrix[0][0] for j in range(n)] for i in range(m)]\nfor i in range(1, m):\n dp[i][0] = matrix[i][0] + dp[i - 1][0]\nfor j in range(1, n):\n dp[0][j] = matrix[0][j] + dp[0][j - 1]\nfor i in range(1, m):\n for j in range(1, n):\n ...
<|body_start_0|> if not matrix: return m, n = (len(matrix), len(matrix[0])) dp = [[matrix[0][0] for j in range(n)] for i in range(m)] for i in range(1, m): dp[i][0] = matrix[i][0] + dp[i - 1][0] for j in range(1, n): dp[0][j] = matrix[0][j] + d...
NumMatrix
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """:type row1: int :type col1: int :type row2: int :type col2: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_36k_train_004325
1,337
no_license
[ { "docstring": ":type matrix: List[List[int]]", "name": "__init__", "signature": "def __init__(self, matrix)" }, { "docstring": ":type row1: int :type col1: int :type row2: int :type col2: int :rtype: int", "name": "sumRegion", "signature": "def sumRegion(self, row1, col1, row2, col2)" ...
2
stack_v2_sparse_classes_30k_test_000747
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:...
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:...
7ff4d8ed1b8897385da046ba7f4afc0796d6ddc1
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """:type row1: int :type col1: int :type row2: int :type col2: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" if not matrix: return m, n = (len(matrix), len(matrix[0])) dp = [[matrix[0][0] for j in range(n)] for i in range(m)] for i in range(1, m): dp[i][0] = matrix[i][0] + dp[i -...
the_stack_v2_python_sparse
304_Range_Sum_Query_2D_Immutable.py
gzk2018/leetcode
train
0
2c3a09aba7e43d32e82027bb4b3530cbc5b65d88
[ "h = [(row[0], row, 1) for row in matrix]\nprint(h)\nfor _ in range(k - 1):\n v, r, i = h[0]\n if i < len(r):\n heapreplace(h, (r[i], r, i + 1))\n else:\n heappop(h)\n print(h)\nreturn h[0][0]", "min_heap = [(matrix[0][0], 0, 0)]\nwhile min_heap and k:\n k -= 1\n res, i, j = he...
<|body_start_0|> h = [(row[0], row, 1) for row in matrix] print(h) for _ in range(k - 1): v, r, i = h[0] if i < len(r): heapreplace(h, (r[i], r, i + 1)) else: heappop(h) print(h) return h[0][0] <|end_body...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def kthSmallest(self, matrix, k): """:type matrix: List[List[int]] :rtype: int binary search first locate row then column use heap to store sorted elements till kth, heapify function""" <|body_0|> def kthSmallest(self, matrix, k): """:type matrix: List[List...
stack_v2_sparse_classes_36k_train_004326
2,203
no_license
[ { "docstring": ":type matrix: List[List[int]] :rtype: int binary search first locate row then column use heap to store sorted elements till kth, heapify function", "name": "kthSmallest", "signature": "def kthSmallest(self, matrix, k)" }, { "docstring": ":type matrix: List[List[int]] :rtype: int ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def kthSmallest(self, matrix, k): :type matrix: List[List[int]] :rtype: int binary search first locate row then column use heap to store sorted elements till kth, heapify functio...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def kthSmallest(self, matrix, k): :type matrix: List[List[int]] :rtype: int binary search first locate row then column use heap to store sorted elements till kth, heapify functio...
f3fc71f344cd758cfce77f16ab72992c99ab288e
<|skeleton|> class Solution: def kthSmallest(self, matrix, k): """:type matrix: List[List[int]] :rtype: int binary search first locate row then column use heap to store sorted elements till kth, heapify function""" <|body_0|> def kthSmallest(self, matrix, k): """:type matrix: List[List...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def kthSmallest(self, matrix, k): """:type matrix: List[List[int]] :rtype: int binary search first locate row then column use heap to store sorted elements till kth, heapify function""" h = [(row[0], row, 1) for row in matrix] print(h) for _ in range(k - 1): ...
the_stack_v2_python_sparse
378_kthSmallestInSortedMatrix.py
jennyChing/leetCode
train
2
60f460d3550fe6c7fb2b6ede0d4ada8e8bb210db
[ "IO_files = {}\nfile_names = set()\nfor fl in in_dir.files:\n if self.name not in fl.users:\n if utils.splitext(fl.name)[-1] in self.input_types:\n IO_files['-!i'] = os.path.join(in_dir.path, fl.name)\n command_ids = [utils.infer_path_id(IO_files['-!i'])]\n in_dir.use_file...
<|body_start_0|> IO_files = {} file_names = set() for fl in in_dir.files: if self.name not in fl.users: if utils.splitext(fl.name)[-1] in self.input_types: IO_files['-!i'] = os.path.join(in_dir.path, fl.name) command_ids = [util...
Class for indexing .vcf files with bgzip & tabix. Parameters: in_cmd: String containing a command line in_dir: Directory object containing input files out_dir: Directory object containing output files NOTICE! Keep the directory objects up to date about file edits! Attributes: name: Name of the function. input_type: Inp...
tabix
[ "BSD-3-Clause", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class tabix: """Class for indexing .vcf files with bgzip & tabix. Parameters: in_cmd: String containing a command line in_dir: Directory object containing input files out_dir: Directory object containing output files NOTICE! Keep the directory objects up to date about file edits! Attributes: name: Name...
stack_v2_sparse_classes_36k_train_004327
10,695
permissive
[ { "docstring": "Infers the input and output file paths. This method must keep the directory objects up to date of the file edits! Parameters: in_cmd: A dict containing the command line. in_dir: Input directory (instance of filetypes.Directory). out_dir: Output directory (instance of filetypes.Directory). Return...
2
stack_v2_sparse_classes_30k_train_005718
Implement the Python class `tabix` described below. Class description: Class for indexing .vcf files with bgzip & tabix. Parameters: in_cmd: String containing a command line in_dir: Directory object containing input files out_dir: Directory object containing output files NOTICE! Keep the directory objects up to date a...
Implement the Python class `tabix` described below. Class description: Class for indexing .vcf files with bgzip & tabix. Parameters: in_cmd: String containing a command line in_dir: Directory object containing input files out_dir: Directory object containing output files NOTICE! Keep the directory objects up to date a...
fd83eee4be0bb78c67a111fd1c1c1dff4c16aefe
<|skeleton|> class tabix: """Class for indexing .vcf files with bgzip & tabix. Parameters: in_cmd: String containing a command line in_dir: Directory object containing input files out_dir: Directory object containing output files NOTICE! Keep the directory objects up to date about file edits! Attributes: name: Name...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class tabix: """Class for indexing .vcf files with bgzip & tabix. Parameters: in_cmd: String containing a command line in_dir: Directory object containing input files out_dir: Directory object containing output files NOTICE! Keep the directory objects up to date about file edits! Attributes: name: Name of the funct...
the_stack_v2_python_sparse
modules/tabix.py
tyrmi/STAPLER
train
4
eeffcc318b757bd95445d3f5a767835f6efe4f2a
[ "super(MovingAverage, self).__init__()\nself.window_size = window_size\nself.dimension = dimension", "ret = torch.cumsum(input_tensor, dim=self.dimension)\nret[:, self.window_size:] = ret[:, self.window_size:] - ret[:, :-self.window_size]\nreturn ret[:, self.window_size - 1:] / self.window_size" ]
<|body_start_0|> super(MovingAverage, self).__init__() self.window_size = window_size self.dimension = dimension <|end_body_0|> <|body_start_1|> ret = torch.cumsum(input_tensor, dim=self.dimension) ret[:, self.window_size:] = ret[:, self.window_size:] - ret[:, :-self.window_size...
MovingAverage
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MovingAverage: def __init__(self, window_size: int, dimension: int): """Parameters ---------- window_size: sliding windows size dimension: dimension we want to apply sliding window""" <|body_0|> def forward(self, input_tensor: torch.Tensor): """Parameters ---------- ...
stack_v2_sparse_classes_36k_train_004328
1,792
permissive
[ { "docstring": "Parameters ---------- window_size: sliding windows size dimension: dimension we want to apply sliding window", "name": "__init__", "signature": "def __init__(self, window_size: int, dimension: int)" }, { "docstring": "Parameters ---------- input_tensor: torch.Tensor of shape (B, ...
2
stack_v2_sparse_classes_30k_test_000382
Implement the Python class `MovingAverage` described below. Class description: Implement the MovingAverage class. Method signatures and docstrings: - def __init__(self, window_size: int, dimension: int): Parameters ---------- window_size: sliding windows size dimension: dimension we want to apply sliding window - def...
Implement the Python class `MovingAverage` described below. Class description: Implement the MovingAverage class. Method signatures and docstrings: - def __init__(self, window_size: int, dimension: int): Parameters ---------- window_size: sliding windows size dimension: dimension we want to apply sliding window - def...
8ac7ccb17de4aaeb40325deda952652b0fc107ef
<|skeleton|> class MovingAverage: def __init__(self, window_size: int, dimension: int): """Parameters ---------- window_size: sliding windows size dimension: dimension we want to apply sliding window""" <|body_0|> def forward(self, input_tensor: torch.Tensor): """Parameters ---------- ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MovingAverage: def __init__(self, window_size: int, dimension: int): """Parameters ---------- window_size: sliding windows size dimension: dimension we want to apply sliding window""" super(MovingAverage, self).__init__() self.window_size = window_size self.dimension = dimensio...
the_stack_v2_python_sparse
layers.py
Stress-Puppy/EMNLP2020
train
0
bbe542760a5fab2b6860dfa2cfd2b2daf83330ba
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\ntry:\n mapping_value = parse_node.get_child_node('@odata.type').get_str_value()\nexcept AttributeError:\n mapping_value = None\nif mapping_value and mapping_value.casefold() == '#microsoft.graph.taskFileAttachment'.casefold():\n from ....
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') try: mapping_value = parse_node.get_child_node('@odata.type').get_str_value() except AttributeError: mapping_value = None if mapping_value and mapping_value.casefold() ==...
AttachmentBase
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AttachmentBase: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AttachmentBase: """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 Retur...
stack_v2_sparse_classes_36k_train_004329
3,410
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: AttachmentBase", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_valu...
3
stack_v2_sparse_classes_30k_train_002989
Implement the Python class `AttachmentBase` described below. Class description: Implement the AttachmentBase class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AttachmentBase: Creates a new instance of the appropriate class based on discriminator va...
Implement the Python class `AttachmentBase` described below. Class description: Implement the AttachmentBase class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AttachmentBase: Creates a new instance of the appropriate class based on discriminator va...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class AttachmentBase: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AttachmentBase: """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 Retur...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AttachmentBase: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AttachmentBase: """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: Attachment...
the_stack_v2_python_sparse
msgraph/generated/models/attachment_base.py
microsoftgraph/msgraph-sdk-python
train
135
8924fed3b9ab9869866483c7ef4c2e83991a016b
[ "lines = open_model(file_path)\nparser = self.instantiate(lines)\nbuilt = parser.build(lines)\nreturn built", "subtrees = [list(g) for k, g in groupby(lines, key=lambda x: x != '') if k]\njoint = self.build_mpt_from_subtrees(subtrees)\nreturn joint", "mpts = []\nleaf_step = 0\nfor subtree in subtrees:\n bmpt...
<|body_start_0|> lines = open_model(file_path) parser = self.instantiate(lines) built = parser.build(lines) return built <|end_body_0|> <|body_start_1|> subtrees = [list(g) for k, g in groupby(lines, key=lambda x: x != '') if k] joint = self.build_mpt_from_subtrees(subtr...
Parsing for easy format
Parser
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Parser: """Parsing for easy format""" def parse(self, file_path): """Parse the mpt from the file Parameters ---------- file_path : str path to the model file Returns -------""" <|body_0|> def build(self, lines): """Build MPT from lines. Can have multiple subtrees...
stack_v2_sparse_classes_36k_train_004330
5,711
permissive
[ { "docstring": "Parse the mpt from the file Parameters ---------- file_path : str path to the model file Returns -------", "name": "parse", "signature": "def parse(self, file_path)" }, { "docstring": "Build MPT from lines. Can have multiple subtrees.", "name": "build", "signature": "def ...
4
stack_v2_sparse_classes_30k_train_008409
Implement the Python class `Parser` described below. Class description: Parsing for easy format Method signatures and docstrings: - def parse(self, file_path): Parse the mpt from the file Parameters ---------- file_path : str path to the model file Returns ------- - def build(self, lines): Build MPT from lines. Can h...
Implement the Python class `Parser` described below. Class description: Parsing for easy format Method signatures and docstrings: - def parse(self, file_path): Parse the mpt from the file Parameters ---------- file_path : str path to the model file Returns ------- - def build(self, lines): Build MPT from lines. Can h...
820fb6c9019623bc98f14c894ced9ed5d70eb96b
<|skeleton|> class Parser: """Parsing for easy format""" def parse(self, file_path): """Parse the mpt from the file Parameters ---------- file_path : str path to the model file Returns -------""" <|body_0|> def build(self, lines): """Build MPT from lines. Can have multiple subtrees...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Parser: """Parsing for easy format""" def parse(self, file_path): """Parse the mpt from the file Parameters ---------- file_path : str path to the model file Returns -------""" lines = open_model(file_path) parser = self.instantiate(lines) built = parser.build(lines) ...
the_stack_v2_python_sparse
mptpy/tools/parsing.py
saurabhr/mptpy
train
0
3f57a3105668df5a1e4d8dc2a23ba80f3223ebb7
[ "self.size = size\nself.que_list = [None] * self.size\nself.count = 0", "i = self.count\nself.que_list[i] = enqueue_data\nself.count += 1", "dequeued_value = self.que_list[0]\nfor i in range(0, len(self.que_list) - 1):\n self.que_list[i] = self.que_list[i + 1]\nself.que_list[len(self.que_list) - 1] = None\ns...
<|body_start_0|> self.size = size self.que_list = [None] * self.size self.count = 0 <|end_body_0|> <|body_start_1|> i = self.count self.que_list[i] = enqueue_data self.count += 1 <|end_body_1|> <|body_start_2|> dequeued_value = self.que_list[0] for i in ...
queクラス 引数:リストのサイズ
que
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class que: """queクラス 引数:リストのサイズ""" def __init__(self, size): """引数:リストのサイズ""" <|body_0|> def enqueue(self, enqueue_data): """引数:エンキューしたい数値""" <|body_1|> def dequeue(self): """デキューした値を返す""" <|body_2|> def is_empty(self): """空ならT...
stack_v2_sparse_classes_36k_train_004331
2,175
no_license
[ { "docstring": "引数:リストのサイズ", "name": "__init__", "signature": "def __init__(self, size)" }, { "docstring": "引数:エンキューしたい数値", "name": "enqueue", "signature": "def enqueue(self, enqueue_data)" }, { "docstring": "デキューした値を返す", "name": "dequeue", "signature": "def dequeue(self)...
4
stack_v2_sparse_classes_30k_test_000855
Implement the Python class `que` described below. Class description: queクラス 引数:リストのサイズ Method signatures and docstrings: - def __init__(self, size): 引数:リストのサイズ - def enqueue(self, enqueue_data): 引数:エンキューしたい数値 - def dequeue(self): デキューした値を返す - def is_empty(self): 空ならTrue, 空でないならFalseを返す
Implement the Python class `que` described below. Class description: queクラス 引数:リストのサイズ Method signatures and docstrings: - def __init__(self, size): 引数:リストのサイズ - def enqueue(self, enqueue_data): 引数:エンキューしたい数値 - def dequeue(self): デキューした値を返す - def is_empty(self): 空ならTrue, 空でないならFalseを返す <|skeleton|> class que: ""...
c594461944316b6655ddaf7e877dd6b293649f53
<|skeleton|> class que: """queクラス 引数:リストのサイズ""" def __init__(self, size): """引数:リストのサイズ""" <|body_0|> def enqueue(self, enqueue_data): """引数:エンキューしたい数値""" <|body_1|> def dequeue(self): """デキューした値を返す""" <|body_2|> def is_empty(self): """空ならT...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class que: """queクラス 引数:リストのサイズ""" def __init__(self, size): """引数:リストのサイズ""" self.size = size self.que_list = [None] * self.size self.count = 0 def enqueue(self, enqueue_data): """引数:エンキューしたい数値""" i = self.count self.que_list[i] = enqueue_data ...
the_stack_v2_python_sparse
a0303_stack_que.py
j-d-0630/python
train
0
fec16c9a90fdd5bdfa66b122f2004dbbaeeccb07
[ "while True:\n r = rand7()\n c = rand7()\n n = c + (r - 1) * 7\n if n <= 40:\n break\nreturn 1 + (n - 1) % 10", "while True:\n r = rand7()\n c = rand7()\n n = c + (r - 1) * 7\n if n <= 40:\n return 1 + (n - 1) % 10\n r = n - 40\n c = rand7()\n n = c + (r - 1) * 7\n ...
<|body_start_0|> while True: r = rand7() c = rand7() n = c + (r - 1) * 7 if n <= 40: break return 1 + (n - 1) % 10 <|end_body_0|> <|body_start_1|> while True: r = rand7() c = rand7() n = c + (r -...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rand10(self): """:rtype: int""" <|body_0|> def rand10_1(self): """:rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> while True: r = rand7() c = rand7() n = c + (r - 1) * 7 if n ...
stack_v2_sparse_classes_36k_train_004332
996
no_license
[ { "docstring": ":rtype: int", "name": "rand10", "signature": "def rand10(self)" }, { "docstring": ":rtype: int", "name": "rand10_1", "signature": "def rand10_1(self)" } ]
2
stack_v2_sparse_classes_30k_train_004467
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rand10(self): :rtype: int - def rand10_1(self): :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rand10(self): :rtype: int - def rand10_1(self): :rtype: int <|skeleton|> class Solution: def rand10(self): """:rtype: int""" <|body_0|> def rand10_...
394e89fd1881f4aa32e2fd81abc72dbc9eeec7bf
<|skeleton|> class Solution: def rand10(self): """:rtype: int""" <|body_0|> def rand10_1(self): """:rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rand10(self): """:rtype: int""" while True: r = rand7() c = rand7() n = c + (r - 1) * 7 if n <= 40: break return 1 + (n - 1) % 10 def rand10_1(self): """:rtype: int""" while True: ...
the_stack_v2_python_sparse
Random/rand10.py
Miracle-cl/Algorithms
train
1
79642d78bdfc4b8895089edb0cd6edcda84ff165
[ "key = a2b_p('2b7e151628aed2a6abf7158809cf4f3c')\npt = 'This is a test case'\nalg1 = CBC(Rijndael(key, blockSize=32))\nalg2 = CBC(Rijndael(key, blockSize=32))\nct1 = alg1.encrypt(pt)\nct2 = alg2.encrypt(pt)\nself.assertNotEqual(ct1, ct2)", "key = a2b_p('2b7e151628aed2a6abf7158809cf4f3c')\npt = 'This is yet anothe...
<|body_start_0|> key = a2b_p('2b7e151628aed2a6abf7158809cf4f3c') pt = 'This is a test case' alg1 = CBC(Rijndael(key, blockSize=32)) alg2 = CBC(Rijndael(key, blockSize=32)) ct1 = alg1.encrypt(pt) ct2 = alg2.encrypt(pt) self.assertNotEqual(ct1, ct2) <|end_body_0|> ...
CBC IV tests
CBC_Auto_IV_Test
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CBC_Auto_IV_Test: """CBC IV tests""" def testIVuniqueness(self): """Test that two different instances have different IVs""" <|body_0|> def testIVmultencryptUnique(self): """Test that two different encrypts have different IVs""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k_train_004333
5,430
permissive
[ { "docstring": "Test that two different instances have different IVs", "name": "testIVuniqueness", "signature": "def testIVuniqueness(self)" }, { "docstring": "Test that two different encrypts have different IVs", "name": "testIVmultencryptUnique", "signature": "def testIVmultencryptUniq...
2
stack_v2_sparse_classes_30k_train_001263
Implement the Python class `CBC_Auto_IV_Test` described below. Class description: CBC IV tests Method signatures and docstrings: - def testIVuniqueness(self): Test that two different instances have different IVs - def testIVmultencryptUnique(self): Test that two different encrypts have different IVs
Implement the Python class `CBC_Auto_IV_Test` described below. Class description: CBC IV tests Method signatures and docstrings: - def testIVuniqueness(self): Test that two different instances have different IVs - def testIVmultencryptUnique(self): Test that two different encrypts have different IVs <|skeleton|> cla...
ed4d80d1e6f09634c12c0c3096e39667c6642b95
<|skeleton|> class CBC_Auto_IV_Test: """CBC IV tests""" def testIVuniqueness(self): """Test that two different instances have different IVs""" <|body_0|> def testIVmultencryptUnique(self): """Test that two different encrypts have different IVs""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CBC_Auto_IV_Test: """CBC IV tests""" def testIVuniqueness(self): """Test that two different instances have different IVs""" key = a2b_p('2b7e151628aed2a6abf7158809cf4f3c') pt = 'This is a test case' alg1 = CBC(Rijndael(key, blockSize=32)) alg2 = CBC(Rijndael(key, b...
the_stack_v2_python_sparse
script.module.cryptolib/lib/cryptopy/cipher/cbc_test.py
gacj22/WizardGacj22
train
4
8088bc5b2311607af3c9946eb29481f6881a7730
[ "self._ctor_args = ctor_args\nself._ctor_kwargs = ctor_kwargs\nself._init_method = init_method\nif isinstance(instance_cls, str):\n instance_cls = DeferLoad(instance_cls)\nself._instance_cls = instance_cls", "args = []\nfor arg in self._ctor_args:\n if isinstance(arg, ClassProvider.Inject):\n arg = i...
<|body_start_0|> self._ctor_args = ctor_args self._ctor_kwargs = ctor_kwargs self._init_method = init_method if isinstance(instance_cls, str): instance_cls = DeferLoad(instance_cls) self._instance_cls = instance_cls <|end_body_0|> <|body_start_1|> args = [] ...
Provider for a particular class.
ClassProvider
[ "LicenseRef-scancode-dco-1.1", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClassProvider: """Provider for a particular class.""" def __init__(self, instance_cls: Union[str, type], *ctor_args, init_method: str=None, **ctor_kwargs): """Initialize the class provider.""" <|body_0|> def provide(self, config: BaseSettings, injector: BaseInjector): ...
stack_v2_sparse_classes_36k_train_004334
4,857
permissive
[ { "docstring": "Initialize the class provider.", "name": "__init__", "signature": "def __init__(self, instance_cls: Union[str, type], *ctor_args, init_method: str=None, **ctor_kwargs)" }, { "docstring": "Provide the object instance given a config and injector.", "name": "provide", "signa...
2
stack_v2_sparse_classes_30k_val_000303
Implement the Python class `ClassProvider` described below. Class description: Provider for a particular class. Method signatures and docstrings: - def __init__(self, instance_cls: Union[str, type], *ctor_args, init_method: str=None, **ctor_kwargs): Initialize the class provider. - def provide(self, config: BaseSetti...
Implement the Python class `ClassProvider` described below. Class description: Provider for a particular class. Method signatures and docstrings: - def __init__(self, instance_cls: Union[str, type], *ctor_args, init_method: str=None, **ctor_kwargs): Initialize the class provider. - def provide(self, config: BaseSetti...
39cac36d8937ce84a9307ce100aaefb8bc05ec04
<|skeleton|> class ClassProvider: """Provider for a particular class.""" def __init__(self, instance_cls: Union[str, type], *ctor_args, init_method: str=None, **ctor_kwargs): """Initialize the class provider.""" <|body_0|> def provide(self, config: BaseSettings, injector: BaseInjector): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClassProvider: """Provider for a particular class.""" def __init__(self, instance_cls: Union[str, type], *ctor_args, init_method: str=None, **ctor_kwargs): """Initialize the class provider.""" self._ctor_args = ctor_args self._ctor_kwargs = ctor_kwargs self._init_method = ...
the_stack_v2_python_sparse
aries_cloudagent/config/provider.py
hyperledger/aries-cloudagent-python
train
370
96748a3bc73d3ec479c89c274e543ead6c08b71d
[ "self._embed_fn = get_embed_fn(model=model, checkpoint_dir=checkpoint_dir, domain=domain, output_head=output_head, reduce_fn=reduce_fn)\nself._batch_size = batch_size\nself._domain = domain\nself._length = length", "if isinstance(sequences[0], str):\n sequences = _encode_string_sequences(sequences, domain=self...
<|body_start_0|> self._embed_fn = get_embed_fn(model=model, checkpoint_dir=checkpoint_dir, domain=domain, output_head=output_head, reduce_fn=reduce_fn) self._batch_size = batch_size self._domain = domain self._length = length <|end_body_0|> <|body_start_1|> if isinstance(sequenc...
Embeddings from a pretrained language model. Stateful wrapper around get_embed_fn that calls the embed_fn on batches.
ProteinLMEmbedder
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProteinLMEmbedder: """Embeddings from a pretrained language model. Stateful wrapper around get_embed_fn that calls the embed_fn on batches.""" def __init__(self, model=None, checkpoint_dir=None, domain=None, output_head='output_emb', reduce_fn=None, length=None, batch_size=64): """Cr...
stack_v2_sparse_classes_36k_train_004335
8,676
permissive
[ { "docstring": "Creates an instance of this class.", "name": "__init__", "signature": "def __init__(self, model=None, checkpoint_dir=None, domain=None, output_head='output_emb', reduce_fn=None, length=None, batch_size=64)" }, { "docstring": "Embeds int or string sequences.", "name": "__call_...
2
stack_v2_sparse_classes_30k_train_010411
Implement the Python class `ProteinLMEmbedder` described below. Class description: Embeddings from a pretrained language model. Stateful wrapper around get_embed_fn that calls the embed_fn on batches. Method signatures and docstrings: - def __init__(self, model=None, checkpoint_dir=None, domain=None, output_head='out...
Implement the Python class `ProteinLMEmbedder` described below. Class description: Embeddings from a pretrained language model. Stateful wrapper around get_embed_fn that calls the embed_fn on batches. Method signatures and docstrings: - def __init__(self, model=None, checkpoint_dir=None, domain=None, output_head='out...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class ProteinLMEmbedder: """Embeddings from a pretrained language model. Stateful wrapper around get_embed_fn that calls the embed_fn on batches.""" def __init__(self, model=None, checkpoint_dir=None, domain=None, output_head='output_emb', reduce_fn=None, length=None, batch_size=64): """Cr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProteinLMEmbedder: """Embeddings from a pretrained language model. Stateful wrapper around get_embed_fn that calls the embed_fn on batches.""" def __init__(self, model=None, checkpoint_dir=None, domain=None, output_head='output_emb', reduce_fn=None, length=None, batch_size=64): """Creates an inst...
the_stack_v2_python_sparse
protein_lm/embed.py
Jimmy-INL/google-research
train
1
1101252e4a0da3f106ed0c7355b191d927e73fc7
[ "self.api = EnrollmentApi(self.locust.host, self.client)\nself.auto_auth()\nfor course_id in settings.data['COURSE_ID_LIST']:\n self.api.enroll(course_id)", "course_id = random.choice(settings.data['COURSE_ID_LIST'])\ntry:\n self.api.get_user_enrollment_status(self.username, course_id)\nexcept NotAuthorized...
<|body_start_0|> self.api = EnrollmentApi(self.locust.host, self.client) self.auto_auth() for course_id in settings.data['COURSE_ID_LIST']: self.api.enroll(course_id) <|end_body_0|> <|body_start_1|> course_id = random.choice(settings.data['COURSE_ID_LIST']) try: ...
User scripts in which the user is already authenticated and enrolled.
AuthenticatedAndEnrolledTasks
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuthenticatedAndEnrolledTasks: """User scripts in which the user is already authenticated and enrolled.""" def on_start(self): """Ensure the user is logged in and enrolled.""" <|body_0|> def user_enrollment_status(self): """Check a user's enrollment status in a c...
stack_v2_sparse_classes_36k_train_004336
8,385
permissive
[ { "docstring": "Ensure the user is logged in and enrolled.", "name": "on_start", "signature": "def on_start(self)" }, { "docstring": "Check a user's enrollment status in a course.", "name": "user_enrollment_status", "signature": "def user_enrollment_status(self)" }, { "docstring"...
3
stack_v2_sparse_classes_30k_val_000297
Implement the Python class `AuthenticatedAndEnrolledTasks` described below. Class description: User scripts in which the user is already authenticated and enrolled. Method signatures and docstrings: - def on_start(self): Ensure the user is logged in and enrolled. - def user_enrollment_status(self): Check a user's enr...
Implement the Python class `AuthenticatedAndEnrolledTasks` described below. Class description: User scripts in which the user is already authenticated and enrolled. Method signatures and docstrings: - def on_start(self): Ensure the user is logged in and enrolled. - def user_enrollment_status(self): Check a user's enr...
1a6dc891d2fb72575f354521988a531489f30032
<|skeleton|> class AuthenticatedAndEnrolledTasks: """User scripts in which the user is already authenticated and enrolled.""" def on_start(self): """Ensure the user is logged in and enrolled.""" <|body_0|> def user_enrollment_status(self): """Check a user's enrollment status in a c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AuthenticatedAndEnrolledTasks: """User scripts in which the user is already authenticated and enrolled.""" def on_start(self): """Ensure the user is logged in and enrolled.""" self.api = EnrollmentApi(self.locust.host, self.client) self.auto_auth() for course_id in setting...
the_stack_v2_python_sparse
loadtests/enrollment/locustfile.py
kavithachandra/edx-load-tests
train
0
dfc1a267b98c05c9155135be2b98fd70c9bc08d2
[ "n = len(s)\ndp = [[False for _ in range(n)] for _ in range(n)]\nmax_len, left, right = (0, 0, 0)\nfor j in range(n):\n for i in range(j + 1):\n if s[i] != s[j]:\n continue\n dp[i][j] = j - i < 2 or dp[i + 1][j - 1]\n if dp[i][j] and j - i + 1 > max_len:\n max_len = j -...
<|body_start_0|> n = len(s) dp = [[False for _ in range(n)] for _ in range(n)] max_len, left, right = (0, 0, 0) for j in range(n): for i in range(j + 1): if s[i] != s[j]: continue dp[i][j] = j - i < 2 or dp[i + 1][j - 1] ...
Solution
[ "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestPalindromeDP(self, s: str) -> str: """动态规划,可用滚动数组进行空间优化""" <|body_0|> def longestPalindrome(self, s: str) -> str: """中心扩展""" <|body_1|> def longestPalindromeManacher(self, s: str) -> str: """Manacher 算法""" <|body_2|> ...
stack_v2_sparse_classes_36k_train_004337
4,053
permissive
[ { "docstring": "动态规划,可用滚动数组进行空间优化", "name": "longestPalindromeDP", "signature": "def longestPalindromeDP(self, s: str) -> str" }, { "docstring": "中心扩展", "name": "longestPalindrome", "signature": "def longestPalindrome(self, s: str) -> str" }, { "docstring": "Manacher 算法", "na...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindromeDP(self, s: str) -> str: 动态规划,可用滚动数组进行空间优化 - def longestPalindrome(self, s: str) -> str: 中心扩展 - def longestPalindromeManacher(self, s: str) -> str: Manacher ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindromeDP(self, s: str) -> str: 动态规划,可用滚动数组进行空间优化 - def longestPalindrome(self, s: str) -> str: 中心扩展 - def longestPalindromeManacher(self, s: str) -> str: Manacher ...
52756b30e9d51794591aca030bc918e707f473f1
<|skeleton|> class Solution: def longestPalindromeDP(self, s: str) -> str: """动态规划,可用滚动数组进行空间优化""" <|body_0|> def longestPalindrome(self, s: str) -> str: """中心扩展""" <|body_1|> def longestPalindromeManacher(self, s: str) -> str: """Manacher 算法""" <|body_2|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestPalindromeDP(self, s: str) -> str: """动态规划,可用滚动数组进行空间优化""" n = len(s) dp = [[False for _ in range(n)] for _ in range(n)] max_len, left, right = (0, 0, 0) for j in range(n): for i in range(j + 1): if s[i] != s[j]: ...
the_stack_v2_python_sparse
5.最长回文子串/solution.py
QtTao/daily_leetcode
train
0
a0d60c61b5522d1ef0d920f801b5aff443519660
[ "super(FeatureExtractor, self).__init__()\nself.submodule = submodule\nself.extracted_layers = extracted_layers", "outputs = []\nfor index, (name, module) in enumerate(self.submodule._modules.items()):\n if name is 'fc':\n x = x.view(x.size(0), -1)\n x = module(x)\n print(index, name)\n if name...
<|body_start_0|> super(FeatureExtractor, self).__init__() self.submodule = submodule self.extracted_layers = extracted_layers <|end_body_0|> <|body_start_1|> outputs = [] for index, (name, module) in enumerate(self.submodule._modules.items()): if name is 'fc': ...
中间特征提取
FeatureExtractor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FeatureExtractor: """中间特征提取""" def __init__(self, submodule, extracted_layers): """:param submodule: :param extracted_layers: extracted layer name or layer index list""" <|body_0|> def forward(self, x): """add fc layer adapter :param x: :return:""" <|body...
stack_v2_sparse_classes_36k_train_004338
2,376
no_license
[ { "docstring": ":param submodule: :param extracted_layers: extracted layer name or layer index list", "name": "__init__", "signature": "def __init__(self, submodule, extracted_layers)" }, { "docstring": "add fc layer adapter :param x: :return:", "name": "forward", "signature": "def forwa...
2
null
Implement the Python class `FeatureExtractor` described below. Class description: 中间特征提取 Method signatures and docstrings: - def __init__(self, submodule, extracted_layers): :param submodule: :param extracted_layers: extracted layer name or layer index list - def forward(self, x): add fc layer adapter :param x: :retu...
Implement the Python class `FeatureExtractor` described below. Class description: 中间特征提取 Method signatures and docstrings: - def __init__(self, submodule, extracted_layers): :param submodule: :param extracted_layers: extracted layer name or layer index list - def forward(self, x): add fc layer adapter :param x: :retu...
d3e44fad42809f23762c9028d8b1d478acf42ab2
<|skeleton|> class FeatureExtractor: """中间特征提取""" def __init__(self, submodule, extracted_layers): """:param submodule: :param extracted_layers: extracted layer name or layer index list""" <|body_0|> def forward(self, x): """add fc layer adapter :param x: :return:""" <|body...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FeatureExtractor: """中间特征提取""" def __init__(self, submodule, extracted_layers): """:param submodule: :param extracted_layers: extracted layer name or layer index list""" super(FeatureExtractor, self).__init__() self.submodule = submodule self.extracted_layers = extracted_l...
the_stack_v2_python_sparse
modules/featuremap/feature_extractor.py
CaravanPassenger/pytorch-learning-notes
train
0
1c79e15ea360e66ac3deee6041a1a4408c861313
[ "patch_data = {}\nfor f in self.editable_fields:\n patch_data[f] = f\ncourse_instance_id = self.test_settings['test_course_SB_ILE']['cid']\nself.api.patch_course_instance_details(course_instance_id, patch_data)\nself._load_test_course('test_course_SB_ILE')\nself.assertTrue(self.detail_page.is_loaded())\noriginal...
<|body_start_0|> patch_data = {} for f in self.editable_fields: patch_data[f] = f course_instance_id = self.test_settings['test_course_SB_ILE']['cid'] self.api.patch_course_instance_details(course_instance_id, patch_data) self._load_test_course('test_course_SB_ILE') ...
CourseInfoDetailsEditTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CourseInfoDetailsEditTests: def test_edit_fields(self): """TLT-2523 (AC 2-11) verify editing fields in SB/ILE courses (capture original fields, edit, save, reload, verify against original)""" <|body_0|> def test_reset_form(self): """TLT-2524 (AC 1, 2) TLT-2525 (AC 22...
stack_v2_sparse_classes_36k_train_004339
3,030
no_license
[ { "docstring": "TLT-2523 (AC 2-11) verify editing fields in SB/ILE courses (capture original fields, edit, save, reload, verify against original)", "name": "test_edit_fields", "signature": "def test_edit_fields(self)" }, { "docstring": "TLT-2524 (AC 1, 2) TLT-2525 (AC 22) verify edit form reset ...
2
null
Implement the Python class `CourseInfoDetailsEditTests` described below. Class description: Implement the CourseInfoDetailsEditTests class. Method signatures and docstrings: - def test_edit_fields(self): TLT-2523 (AC 2-11) verify editing fields in SB/ILE courses (capture original fields, edit, save, reload, verify ag...
Implement the Python class `CourseInfoDetailsEditTests` described below. Class description: Implement the CourseInfoDetailsEditTests class. Method signatures and docstrings: - def test_edit_fields(self): TLT-2523 (AC 2-11) verify editing fields in SB/ILE courses (capture original fields, edit, save, reload, verify ag...
c00f9af5bbe344d0cbf71bcdfe2c3af85ae4be4a
<|skeleton|> class CourseInfoDetailsEditTests: def test_edit_fields(self): """TLT-2523 (AC 2-11) verify editing fields in SB/ILE courses (capture original fields, edit, save, reload, verify against original)""" <|body_0|> def test_reset_form(self): """TLT-2524 (AC 1, 2) TLT-2525 (AC 22...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CourseInfoDetailsEditTests: def test_edit_fields(self): """TLT-2523 (AC 2-11) verify editing fields in SB/ILE courses (capture original fields, edit, save, reload, verify against original)""" patch_data = {} for f in self.editable_fields: patch_data[f] = f course_in...
the_stack_v2_python_sparse
selenium_tests/course_info/course_info_details_edit_tests.py
Harvard-University-iCommons/canvas_account_admin_tools
train
4
33ec09ba13f6846d5027bb4199082f3bab99bd67
[ "if not l or not r or r < l:\n return list()\nt = list()\nfor i in range(l, r + 1, 1):\n if self.is_self_dividing(i):\n t.append(i)\nreturn t", "if not i:\n return False\np = i\nwhile p > 0:\n p, d = divmod(p, 10)\n if d == 0 or i % d != 0:\n return False\nreturn True" ]
<|body_start_0|> if not l or not r or r < l: return list() t = list() for i in range(l, r + 1, 1): if self.is_self_dividing(i): t.append(i) return t <|end_body_0|> <|body_start_1|> if not i: return False p = i w...
Iteration over all integers in range. Time complexity: O(n ** m) - Amortized iterate over all integers and contained digits Space complexity: O(n) - Amortized store all integers in range
Solution2
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution2: """Iteration over all integers in range. Time complexity: O(n ** m) - Amortized iterate over all integers and contained digits Space complexity: O(n) - Amortized store all integers in range""" def find_self_dividing_nums(self, l, r): """Determines all self-dividing numbers...
stack_v2_sparse_classes_36k_train_004340
3,918
permissive
[ { "docstring": "Determines all self-dividing numbers within target limits (inclusive). :param int l: lower limit of target range :param int r: upper limit of target range :return: array of all self-dividing numbers in range :rtype: list[int]", "name": "find_self_dividing_nums", "signature": "def find_se...
2
stack_v2_sparse_classes_30k_train_018486
Implement the Python class `Solution2` described below. Class description: Iteration over all integers in range. Time complexity: O(n ** m) - Amortized iterate over all integers and contained digits Space complexity: O(n) - Amortized store all integers in range Method signatures and docstrings: - def find_self_dividi...
Implement the Python class `Solution2` described below. Class description: Iteration over all integers in range. Time complexity: O(n ** m) - Amortized iterate over all integers and contained digits Space complexity: O(n) - Amortized store all integers in range Method signatures and docstrings: - def find_self_dividi...
69f90877c5466927e8b081c4268cbcda074813ec
<|skeleton|> class Solution2: """Iteration over all integers in range. Time complexity: O(n ** m) - Amortized iterate over all integers and contained digits Space complexity: O(n) - Amortized store all integers in range""" def find_self_dividing_nums(self, l, r): """Determines all self-dividing numbers...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution2: """Iteration over all integers in range. Time complexity: O(n ** m) - Amortized iterate over all integers and contained digits Space complexity: O(n) - Amortized store all integers in range""" def find_self_dividing_nums(self, l, r): """Determines all self-dividing numbers within targe...
the_stack_v2_python_sparse
0728_self_dividing_numbers/python_source.py
arthurdysart/LeetCode
train
0
26790fe126a31a8310887306caaa4a3a8a218b1b
[ "self.lang = 'he'\nself.cache = {}\nself.tokenizer = Hebrew().tokenizer", "if profession not in self.cache:\n self.cache[profession] = self._get_gender(profession)\nreturn self.cache[profession]", "if not profession.strip():\n return GENDER.unknown\ntoks = [w.text for w in self.tokenizer(profession) if w....
<|body_start_0|> self.lang = 'he' self.cache = {} self.tokenizer = Hebrew().tokenizer <|end_body_0|> <|body_start_1|> if profession not in self.cache: self.cache[profession] = self._get_gender(profession) return self.cache[profession] <|end_body_1|> <|body_start_2|>...
Hebrew morphology heurstics.
HebrewPredictor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HebrewPredictor: """Hebrew morphology heurstics.""" def __init__(self): """Init tokenizer for Hebrew.""" <|body_0|> def get_gender(self, profession: str, translated_sent=None, entity_index=None, ds_entry=None) -> GENDER: """Predict gender of an input profession."...
stack_v2_sparse_classes_36k_train_004341
3,035
permissive
[ { "docstring": "Init tokenizer for Hebrew.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Predict gender of an input profession.", "name": "get_gender", "signature": "def get_gender(self, profession: str, translated_sent=None, entity_index=None, ds_entry=None)...
3
stack_v2_sparse_classes_30k_train_019907
Implement the Python class `HebrewPredictor` described below. Class description: Hebrew morphology heurstics. Method signatures and docstrings: - def __init__(self): Init tokenizer for Hebrew. - def get_gender(self, profession: str, translated_sent=None, entity_index=None, ds_entry=None) -> GENDER: Predict gender of ...
Implement the Python class `HebrewPredictor` described below. Class description: Hebrew morphology heurstics. Method signatures and docstrings: - def __init__(self): Init tokenizer for Hebrew. - def get_gender(self, profession: str, translated_sent=None, entity_index=None, ds_entry=None) -> GENDER: Predict gender of ...
586292861cf2efdda2dec03c69c3408995a8b293
<|skeleton|> class HebrewPredictor: """Hebrew morphology heurstics.""" def __init__(self): """Init tokenizer for Hebrew.""" <|body_0|> def get_gender(self, profession: str, translated_sent=None, entity_index=None, ds_entry=None) -> GENDER: """Predict gender of an input profession."...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HebrewPredictor: """Hebrew morphology heurstics.""" def __init__(self): """Init tokenizer for Hebrew.""" self.lang = 'he' self.cache = {} self.tokenizer = Hebrew().tokenizer def get_gender(self, profession: str, translated_sent=None, entity_index=None, ds_entry=None) ...
the_stack_v2_python_sparse
src/languages/semitic_languages.py
gabrielStanovsky/mt_gender
train
42
19397c86fc47d3b7898c6c19774b885bbc921971
[ "self.surface = pygame.Surface(dim)\nself.particles = []\nfor counter in range(count):\n pos = pygame.Vector2(random.randint(0, self.surface.get_width()), random.randint(0, self.surface.get_height()))\n direction = pygame.Vector2(10 * (random.random() - 0.5), 10 * (random.random() - 0.5))\n color = pygame....
<|body_start_0|> self.surface = pygame.Surface(dim) self.particles = [] for counter in range(count): pos = pygame.Vector2(random.randint(0, self.surface.get_width()), random.randint(0, self.surface.get_height())) direction = pygame.Vector2(10 * (random.random() - 0.5), 10...
Particles
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Particles: def __init__(self, dim: tuple, count: int): """clas to draw some particles :param surface: surface to draw on :param count: number of particles""" <|body_0|> def update(self): """update every frame""" <|body_1|> def collide(self, p1, p2): ...
stack_v2_sparse_classes_36k_train_004342
5,061
no_license
[ { "docstring": "clas to draw some particles :param surface: surface to draw on :param count: number of particles", "name": "__init__", "signature": "def __init__(self, dim: tuple, count: int)" }, { "docstring": "update every frame", "name": "update", "signature": "def update(self)" }, ...
3
stack_v2_sparse_classes_30k_train_017804
Implement the Python class `Particles` described below. Class description: Implement the Particles class. Method signatures and docstrings: - def __init__(self, dim: tuple, count: int): clas to draw some particles :param surface: surface to draw on :param count: number of particles - def update(self): update every fr...
Implement the Python class `Particles` described below. Class description: Implement the Particles class. Method signatures and docstrings: - def __init__(self, dim: tuple, count: int): clas to draw some particles :param surface: surface to draw on :param count: number of particles - def update(self): update every fr...
1fd421195a2888c0588a49f5a043a1110eedcdbf
<|skeleton|> class Particles: def __init__(self, dim: tuple, count: int): """clas to draw some particles :param surface: surface to draw on :param count: number of particles""" <|body_0|> def update(self): """update every frame""" <|body_1|> def collide(self, p1, p2): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Particles: def __init__(self, dim: tuple, count: int): """clas to draw some particles :param surface: surface to draw on :param count: number of particles""" self.surface = pygame.Surface(dim) self.particles = [] for counter in range(count): pos = pygame.Vector2(ran...
the_stack_v2_python_sparse
effects/Particle.py
gunny26/pygame
train
5
62ba9181469bc68587bdf01abb40b86854fc38a4
[ "rdd_rows = spark.sparkContext.parallelize([data])\nresult_df = DataWriter.df_from_rdd(rdd_rows, data, spark)\nresult_df.write.json(target_file, mode=write_mode)", "if isinstance(rec, dict):\n return pst.StructType([pst.StructField(key, DataWriter.infer_schema(value), True) for key, value in sorted(rec.items()...
<|body_start_0|> rdd_rows = spark.sparkContext.parallelize([data]) result_df = DataWriter.df_from_rdd(rdd_rows, data, spark) result_df.write.json(target_file, mode=write_mode) <|end_body_0|> <|body_start_1|> if isinstance(rec, dict): return pst.StructType([pst.StructField(ke...
DataWriter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataWriter: def write_dict_as_json(spark, data, target_file, write_mode=WriteMode.OVERWRITE): """TODO: 1) failing on dict with non-string keys TODO: 2) failing on list with elements of different data type""" <|body_0|> def infer_schema(rec): """infers dataframe schem...
stack_v2_sparse_classes_36k_train_004343
4,336
no_license
[ { "docstring": "TODO: 1) failing on dict with non-string keys TODO: 2) failing on list with elements of different data type", "name": "write_dict_as_json", "signature": "def write_dict_as_json(spark, data, target_file, write_mode=WriteMode.OVERWRITE)" }, { "docstring": "infers dataframe schema f...
4
stack_v2_sparse_classes_30k_train_001310
Implement the Python class `DataWriter` described below. Class description: Implement the DataWriter class. Method signatures and docstrings: - def write_dict_as_json(spark, data, target_file, write_mode=WriteMode.OVERWRITE): TODO: 1) failing on dict with non-string keys TODO: 2) failing on list with elements of diff...
Implement the Python class `DataWriter` described below. Class description: Implement the DataWriter class. Method signatures and docstrings: - def write_dict_as_json(spark, data, target_file, write_mode=WriteMode.OVERWRITE): TODO: 1) failing on dict with non-string keys TODO: 2) failing on list with elements of diff...
7d5d2faafcd0b2e5d35fa0e486bc3617f8e30a9e
<|skeleton|> class DataWriter: def write_dict_as_json(spark, data, target_file, write_mode=WriteMode.OVERWRITE): """TODO: 1) failing on dict with non-string keys TODO: 2) failing on list with elements of different data type""" <|body_0|> def infer_schema(rec): """infers dataframe schem...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DataWriter: def write_dict_as_json(spark, data, target_file, write_mode=WriteMode.OVERWRITE): """TODO: 1) failing on dict with non-string keys TODO: 2) failing on list with elements of different data type""" rdd_rows = spark.sparkContext.parallelize([data]) result_df = DataWriter.df_fr...
the_stack_v2_python_sparse
bi/common/datawriter.py
Srinidhi-SA/mAdvisorProdML
train
0
972ef33f847a79b3b0f854d478ca1b1621895249
[ "self.key = self._randomKeyOrIV()\nself.iv = self._randomKeyOrIV()\nself.org_msg = msg\nself.mode = self._randomMode()\nprependmsg = bytearray()\nappendmsg = bytearray()\nfor i in range(randint(5, 10)):\n prependmsg.append(randint(0, 255))\nfor i in range(randint(5, 10)):\n appendmsg.append(randint(0, 255))\n...
<|body_start_0|> self.key = self._randomKeyOrIV() self.iv = self._randomKeyOrIV() self.org_msg = msg self.mode = self._randomMode() prependmsg = bytearray() appendmsg = bytearray() for i in range(randint(5, 10)): prependmsg.append(randint(0, 255)) ...
This is a object that generates a random msg encrypted under AES 128 eBC or CBC. (Do I want to leave this as an object? Or just as a large funciton.) In msg (in bytes/bytearray) Out prepended and random. Where is the key and iv it used? In order to check, need that info (for debug). That's why I will use an object with...
Encryption_Oracle
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Encryption_Oracle: """This is a object that generates a random msg encrypted under AES 128 eBC or CBC. (Do I want to leave this as an object? Or just as a large funciton.) In msg (in bytes/bytearray) Out prepended and random. Where is the key and iv it used? In order to check, need that info (for...
stack_v2_sparse_classes_36k_train_004344
3,525
permissive
[ { "docstring": "Takes msg in bytes or bytearray to create randomly encrypted msg with a prepend of 5-10 bytes and a append of 5-10 bytes (both random). Standard is size 128.", "name": "__init__", "signature": "def __init__(self, msg, makeblock=128)" }, { "docstring": "Picks a random number for w...
3
stack_v2_sparse_classes_30k_train_011794
Implement the Python class `Encryption_Oracle` described below. Class description: This is a object that generates a random msg encrypted under AES 128 eBC or CBC. (Do I want to leave this as an object? Or just as a large funciton.) In msg (in bytes/bytearray) Out prepended and random. Where is the key and iv it used?...
Implement the Python class `Encryption_Oracle` described below. Class description: This is a object that generates a random msg encrypted under AES 128 eBC or CBC. (Do I want to leave this as an object? Or just as a large funciton.) In msg (in bytes/bytearray) Out prepended and random. Where is the key and iv it used?...
7da9d5b615183b9479ec4375c0c7b89bb2161b1d
<|skeleton|> class Encryption_Oracle: """This is a object that generates a random msg encrypted under AES 128 eBC or CBC. (Do I want to leave this as an object? Or just as a large funciton.) In msg (in bytes/bytearray) Out prepended and random. Where is the key and iv it used? In order to check, need that info (for...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Encryption_Oracle: """This is a object that generates a random msg encrypted under AES 128 eBC or CBC. (Do I want to leave this as an object? Or just as a large funciton.) In msg (in bytes/bytearray) Out prepended and random. Where is the key and iv it used? In order to check, need that info (for debug). That...
the_stack_v2_python_sparse
Set2/Code/11-ECB-CBC-Oracle.py~
Jason429/CryptoPalsChallenge
train
0
0c80cbe1f913b936bb780d6c8ae9b16d2419b8f3
[ "colors = [0, 255, 100]\nheight = 28\nsize = height * height\nrecords = bytes(bytearray([1] * 16 + [colors[0]] * size + [colors[1]] * size + [colors[2]] * size))\nexpecteds = [np.zeros((height, height)) + colors[0], np.zeros((height, height)) + colors[1], np.zeros((height, height)) + colors[2]]\nimage_filename = os...
<|body_start_0|> colors = [0, 255, 100] height = 28 size = height * height records = bytes(bytearray([1] * 16 + [colors[0]] * size + [colors[1]] * size + [colors[2]] * size)) expecteds = [np.zeros((height, height)) + colors[0], np.zeros((height, height)) + colors[1], np.zeros((he...
MnistShiftTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MnistShiftTest: def testReadImage(self): """Tests if the records are read in the expected order and value. Writes 3 images of size 28*28 into a temporary file. Calls the read_file function with the temporary file. Checks whether the order and value of pixels are correct for all 3 images....
stack_v2_sparse_classes_36k_train_004345
4,763
permissive
[ { "docstring": "Tests if the records are read in the expected order and value. Writes 3 images of size 28*28 into a temporary file. Calls the read_file function with the temporary file. Checks whether the order and value of pixels are correct for all 3 images.", "name": "testReadImage", "signature": "de...
4
stack_v2_sparse_classes_30k_train_002893
Implement the Python class `MnistShiftTest` described below. Class description: Implement the MnistShiftTest class. Method signatures and docstrings: - def testReadImage(self): Tests if the records are read in the expected order and value. Writes 3 images of size 28*28 into a temporary file. Calls the read_file funct...
Implement the Python class `MnistShiftTest` described below. Class description: Implement the MnistShiftTest class. Method signatures and docstrings: - def testReadImage(self): Tests if the records are read in the expected order and value. Writes 3 images of size 28*28 into a temporary file. Calls the read_file funct...
5b98fbb84408d566ae4ef0878008931a65832386
<|skeleton|> class MnistShiftTest: def testReadImage(self): """Tests if the records are read in the expected order and value. Writes 3 images of size 28*28 into a temporary file. Calls the read_file function with the temporary file. Checks whether the order and value of pixels are correct for all 3 images....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MnistShiftTest: def testReadImage(self): """Tests if the records are read in the expected order and value. Writes 3 images of size 28*28 into a temporary file. Calls the read_file function with the temporary file. Checks whether the order and value of pixels are correct for all 3 images.""" co...
the_stack_v2_python_sparse
input_data/mnist/mnist_shift_test.py
Cerenaut/sparse-unsupervised-capsules
train
5
f43563b7f9b406c875811917b9f207132a84795e
[ "argv = splitargs(line)\nif len(argv) != 3:\n return self.do_help('memcpy')\ndst = self.parseExpression(argv[0])\nsrc = self.parseExpression(argv[1])\nsiz = self.parseExpression(argv[2])\nmem = self.memobj.readMemory(src, siz)\nself.memobj.writeMemory(dst, mem)", "if len(line) == 0:\n return self.do_help('m...
<|body_start_0|> argv = splitargs(line) if len(argv) != 3: return self.do_help('memcpy') dst = self.parseExpression(argv[0]) src = self.parseExpression(argv[1]) siz = self.parseExpression(argv[2]) mem = self.memobj.readMemory(src, siz) self.memobj.writ...
Cli extensions which require a mutable memory object (emulator/trace) rather than a static one (viv workspace)
EnviMutableCli
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EnviMutableCli: """Cli extensions which require a mutable memory object (emulator/trace) rather than a static one (viv workspace)""" def do_memcpy(self, line): """Copy memory from one location to another... Usage: memcpy <dest_expr> <src_expr> <size_expr>""" <|body_0|> d...
stack_v2_sparse_classes_36k_train_004346
29,731
permissive
[ { "docstring": "Copy memory from one location to another... Usage: memcpy <dest_expr> <src_expr> <size_expr>", "name": "do_memcpy", "signature": "def do_memcpy(self, line)" }, { "docstring": "Change the memory permissions of a given page/map. Usage: memprotect [options] <addr_expr> <perms> -S <s...
3
null
Implement the Python class `EnviMutableCli` described below. Class description: Cli extensions which require a mutable memory object (emulator/trace) rather than a static one (viv workspace) Method signatures and docstrings: - def do_memcpy(self, line): Copy memory from one location to another... Usage: memcpy <dest_...
Implement the Python class `EnviMutableCli` described below. Class description: Cli extensions which require a mutable memory object (emulator/trace) rather than a static one (viv workspace) Method signatures and docstrings: - def do_memcpy(self, line): Copy memory from one location to another... Usage: memcpy <dest_...
b07e161cc28b19fdda0d047eefafed22c5b00f15
<|skeleton|> class EnviMutableCli: """Cli extensions which require a mutable memory object (emulator/trace) rather than a static one (viv workspace)""" def do_memcpy(self, line): """Copy memory from one location to another... Usage: memcpy <dest_expr> <src_expr> <size_expr>""" <|body_0|> d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EnviMutableCli: """Cli extensions which require a mutable memory object (emulator/trace) rather than a static one (viv workspace)""" def do_memcpy(self, line): """Copy memory from one location to another... Usage: memcpy <dest_expr> <src_expr> <size_expr>""" argv = splitargs(line) ...
the_stack_v2_python_sparse
envi/cli.py
vivisect/vivisect
train
833
578f25cf0f64c96b315aba529fc3c20b577734b6
[ "if len(np.shape(x_t)) > 1 and np.shape(x_t)[1] > 1:\n x_next_mean = x_t.dot(self.parameters.A.T)\n x_next = np.linalg.solve(self.parameters.LQinv.T, np.random.normal(size=x_t.shape).T).T + x_next_mean\n return x_next\nelse:\n x_next_mean = x_t * self.parameters.A\n x_next = self.parameters.LQinv ** ...
<|body_start_0|> if len(np.shape(x_t)) > 1 and np.shape(x_t)[1] > 1: x_next_mean = x_t.dot(self.parameters.A.T) x_next = np.linalg.solve(self.parameters.LQinv.T, np.random.normal(size=x_t.shape).T).T + x_next_mean return x_next else: x_next_mean = x_t * se...
Prior Kernel for LGSSM K(x_{t+1} | x_t) = Pr(x_{t+1} | x_t, parameters)
LGSSMPriorKernel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LGSSMPriorKernel: """Prior Kernel for LGSSM K(x_{t+1} | x_t) = Pr(x_{t+1} | x_t, parameters)""" def rv(self, x_t, **kwargs): """Prior Kernel for LGSSM Sample x_{t+1} ~ Pr(x_{t+1} | x_t, parameters) Args: x_t (ndarray): N by n, x_t Return: x_next (ndarray): N by n, x_{t+1}""" ...
stack_v2_sparse_classes_36k_train_004347
7,345
permissive
[ { "docstring": "Prior Kernel for LGSSM Sample x_{t+1} ~ Pr(x_{t+1} | x_t, parameters) Args: x_t (ndarray): N by n, x_t Return: x_next (ndarray): N by n, x_{t+1}", "name": "rv", "signature": "def rv(self, x_t, **kwargs)" }, { "docstring": "Reweight function for Prior Kernel for LGSSM weight_t = P...
2
stack_v2_sparse_classes_30k_train_020962
Implement the Python class `LGSSMPriorKernel` described below. Class description: Prior Kernel for LGSSM K(x_{t+1} | x_t) = Pr(x_{t+1} | x_t, parameters) Method signatures and docstrings: - def rv(self, x_t, **kwargs): Prior Kernel for LGSSM Sample x_{t+1} ~ Pr(x_{t+1} | x_t, parameters) Args: x_t (ndarray): N by n, ...
Implement the Python class `LGSSMPriorKernel` described below. Class description: Prior Kernel for LGSSM K(x_{t+1} | x_t) = Pr(x_{t+1} | x_t, parameters) Method signatures and docstrings: - def rv(self, x_t, **kwargs): Prior Kernel for LGSSM Sample x_{t+1} ~ Pr(x_{t+1} | x_t, parameters) Args: x_t (ndarray): N by n, ...
b4f04637165c13fd7b3e042b36ad9b77d2528733
<|skeleton|> class LGSSMPriorKernel: """Prior Kernel for LGSSM K(x_{t+1} | x_t) = Pr(x_{t+1} | x_t, parameters)""" def rv(self, x_t, **kwargs): """Prior Kernel for LGSSM Sample x_{t+1} ~ Pr(x_{t+1} | x_t, parameters) Args: x_t (ndarray): N by n, x_t Return: x_next (ndarray): N by n, x_{t+1}""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LGSSMPriorKernel: """Prior Kernel for LGSSM K(x_{t+1} | x_t) = Pr(x_{t+1} | x_t, parameters)""" def rv(self, x_t, **kwargs): """Prior Kernel for LGSSM Sample x_{t+1} ~ Pr(x_{t+1} | x_t, parameters) Args: x_t (ndarray): N by n, x_t Return: x_next (ndarray): N by n, x_{t+1}""" if len(np.sha...
the_stack_v2_python_sparse
sgmcmc_ssm/models/lgssm/kernels.py
PeiKaLunCi/sgmcmc_ssm_code
train
0
1dee58ad853b27fa553e17ac68436433645def6b
[ "stack = []\npreorder = ''\ncur = root\nstack.append(root)\nwhile cur or stack:\n cur = stack.pop()\n if cur:\n preorder += str(cur.val) + ','\n else:\n preorder += 'null' + ','\n if cur:\n stack.append(cur.right)\n stack.append(cur.left)\nreturn preorder", "preorder_list =...
<|body_start_0|> stack = [] preorder = '' cur = root stack.append(root) while cur or stack: cur = stack.pop() if cur: preorder += str(cur.val) + ',' else: preorder += 'null' + ',' if cur: ...
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_004348
2,047
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_009310
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:...
6e18c5d257840489cc3fb1079ae3804c743982a4
<|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""" stack = [] preorder = '' cur = root stack.append(root) while cur or stack: cur = stack.pop() if cur: preorder += s...
the_stack_v2_python_sparse
剑指 Offer 37. 序列化二叉树.py
yangyuxiang1996/leetcode
train
0
3cdfdf40f3c526c20256a645b08f0a15b337929e
[ "self.enter_mtz()\nself.swipe_to_up(1)\nself.enter_collect()\nself.myClick(self.find_element('第一个商品', *self.by_first_collected_goods_id))\nself.assertTrue(self.is_collected('普通团'))\nself.myClick(self.find_element('收藏', *self.by_collect_id))\nself.assertTrue(not self.is_collected('普通团'))", "self.enter_mtz()\nself....
<|body_start_0|> self.enter_mtz() self.swipe_to_up(1) self.enter_collect() self.myClick(self.find_element('第一个商品', *self.by_first_collected_goods_id)) self.assertTrue(self.is_collected('普通团')) self.myClick(self.find_element('收藏', *self.by_collect_id)) self.assertT...
MyCollect
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyCollect: def test_buy_collect(self): """萌团长_购买商品_收藏切换""" <|body_0|> def test_distribution_collect(self): """萌团长_分销商品_收藏切换""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.enter_mtz() self.swipe_to_up(1) self.enter_collect() ...
stack_v2_sparse_classes_36k_train_004349
1,433
no_license
[ { "docstring": "萌团长_购买商品_收藏切换", "name": "test_buy_collect", "signature": "def test_buy_collect(self)" }, { "docstring": "萌团长_分销商品_收藏切换", "name": "test_distribution_collect", "signature": "def test_distribution_collect(self)" } ]
2
stack_v2_sparse_classes_30k_train_013164
Implement the Python class `MyCollect` described below. Class description: Implement the MyCollect class. Method signatures and docstrings: - def test_buy_collect(self): 萌团长_购买商品_收藏切换 - def test_distribution_collect(self): 萌团长_分销商品_收藏切换
Implement the Python class `MyCollect` described below. Class description: Implement the MyCollect class. Method signatures and docstrings: - def test_buy_collect(self): 萌团长_购买商品_收藏切换 - def test_distribution_collect(self): 萌团长_分销商品_收藏切换 <|skeleton|> class MyCollect: def test_buy_collect(self): """萌团长_购买...
b2066139eb0723eff69d971589b283b4b776c84c
<|skeleton|> class MyCollect: def test_buy_collect(self): """萌团长_购买商品_收藏切换""" <|body_0|> def test_distribution_collect(self): """萌团长_分销商品_收藏切换""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MyCollect: def test_buy_collect(self): """萌团长_购买商品_收藏切换""" self.enter_mtz() self.swipe_to_up(1) self.enter_collect() self.myClick(self.find_element('第一个商品', *self.by_first_collected_goods_id)) self.assertTrue(self.is_collected('普通团')) self.myClick(self.f...
the_stack_v2_python_sparse
TestCase/4_5/TC_Meng_TZ/test_collect_goods.py
testerSunshine/auto_md
train
4
83c0b70fcf56401f49bfb8cc4801d338245a861e
[ "parser = reqparse.RequestParser()\nparser.add_argument('name', type=str, required=True, help='This field cannot be left blank!')\nparser.add_argument('organization_ids', type=int, required=True, action='append')\nparser.add_argument('encrypted', type=int, required=False)\ndata = parser.parse_args()\nname = data['n...
<|body_start_0|> parser = reqparse.RequestParser() parser.add_argument('name', type=str, required=True, help='This field cannot be left blank!') parser.add_argument('organization_ids', type=int, required=True, action='append') parser.add_argument('encrypted', type=int, required=False) ...
Collaboration
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Collaboration: def post(self): """create a new collaboration""" <|body_0|> def get(self, id=None): """collaboration or list of collaborations in case no id is provided""" <|body_1|> def patch(self, id): """update a collaboration""" <|body...
stack_v2_sparse_classes_36k_train_004350
14,133
permissive
[ { "docstring": "create a new collaboration", "name": "post", "signature": "def post(self)" }, { "docstring": "collaboration or list of collaborations in case no id is provided", "name": "get", "signature": "def get(self, id=None)" }, { "docstring": "update a collaboration", "...
4
stack_v2_sparse_classes_30k_train_012563
Implement the Python class `Collaboration` described below. Class description: Implement the Collaboration class. Method signatures and docstrings: - def post(self): create a new collaboration - def get(self, id=None): collaboration or list of collaborations in case no id is provided - def patch(self, id): update a c...
Implement the Python class `Collaboration` described below. Class description: Implement the Collaboration class. Method signatures and docstrings: - def post(self): create a new collaboration - def get(self, id=None): collaboration or list of collaborations in case no id is provided - def patch(self, id): update a c...
a64827981db26b34dd1dcea1cb2282d03dd4545d
<|skeleton|> class Collaboration: def post(self): """create a new collaboration""" <|body_0|> def get(self, id=None): """collaboration or list of collaborations in case no id is provided""" <|body_1|> def patch(self, id): """update a collaboration""" <|body...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Collaboration: def post(self): """create a new collaboration""" parser = reqparse.RequestParser() parser.add_argument('name', type=str, required=True, help='This field cannot be left blank!') parser.add_argument('organization_ids', type=int, required=True, action='append') ...
the_stack_v2_python_sparse
vantage6/server/resource/collaboration.py
mindrenee/vantage6-server
train
0
b02426f09e4c9a8b9fb5962d3e4dec3601109fda
[ "i, j = (0, num)\nwhile i <= j:\n mid = (i + j) // 2\n s = mid ** 2\n if s == num:\n return True\n elif s < num:\n i = mid + 1\n else:\n j = mid - 1\nreturn False", "if num < 0:\n return False\nelif num == 1:\n return True\ni, j, last = (0, num, -1)\nwhile i <= j:\n mi...
<|body_start_0|> i, j = (0, num) while i <= j: mid = (i + j) // 2 s = mid ** 2 if s == num: return True elif s < num: i = mid + 1 else: j = mid - 1 return False <|end_body_0|> <|body_star...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isPerfectSquare(self, num): """:type num: int :rtype: bool""" <|body_0|> def isPerfectSquare2(self, num): """:type num: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> i, j = (0, num) while i <= j: ...
stack_v2_sparse_classes_36k_train_004351
1,736
no_license
[ { "docstring": ":type num: int :rtype: bool", "name": "isPerfectSquare", "signature": "def isPerfectSquare(self, num)" }, { "docstring": ":type num: int :rtype: bool", "name": "isPerfectSquare2", "signature": "def isPerfectSquare2(self, num)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPerfectSquare(self, num): :type num: int :rtype: bool - def isPerfectSquare2(self, num): :type num: int :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPerfectSquare(self, num): :type num: int :rtype: bool - def isPerfectSquare2(self, num): :type num: int :rtype: bool <|skeleton|> class Solution: def isPerfectSquare(...
635af6e22aa8eef8e7920a585d43a45a891a8157
<|skeleton|> class Solution: def isPerfectSquare(self, num): """:type num: int :rtype: bool""" <|body_0|> def isPerfectSquare2(self, num): """:type num: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isPerfectSquare(self, num): """:type num: int :rtype: bool""" i, j = (0, num) while i <= j: mid = (i + j) // 2 s = mid ** 2 if s == num: return True elif s < num: i = mid + 1 else:...
the_stack_v2_python_sparse
code367ValidPerfectSquare.py
cybelewang/leetcode-python
train
0
85e7427e530ede4a43da2a2ee54dd9a962d3faef
[ "if await self.check_user_guild(guild_id, user.id):\n return\nasync with aiosqlite.connect(self.resolved_db_path) as db:\n if not await self.check_global_user(user.id):\n await db.execute('INSERT INTO Users (id, name) VALUES (?, ?)', (user.id, user.name))\n await db.execute('INSERT INTO Users_Guilds...
<|body_start_0|> if await self.check_user_guild(guild_id, user.id): return async with aiosqlite.connect(self.resolved_db_path) as db: if not await self.check_global_user(user.id): await db.execute('INSERT INTO Users (id, name) VALUES (?, ?)', (user.id, user.name))...
UserRepository
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserRepository: async def add_user(self, user: discord.Member, guild_id: int) -> None: """Adds a User to the global users table and/or to the guild specific user tables Args: user (discord.Member) guild_id (int)""" <|body_0|> async def check_global_user(self, user_id: int) -...
stack_v2_sparse_classes_36k_train_004352
1,912
permissive
[ { "docstring": "Adds a User to the global users table and/or to the guild specific user tables Args: user (discord.Member) guild_id (int)", "name": "add_user", "signature": "async def add_user(self, user: discord.Member, guild_id: int) -> None" }, { "docstring": "Checks if the user is in the glo...
3
stack_v2_sparse_classes_30k_val_000045
Implement the Python class `UserRepository` described below. Class description: Implement the UserRepository class. Method signatures and docstrings: - async def add_user(self, user: discord.Member, guild_id: int) -> None: Adds a User to the global users table and/or to the guild specific user tables Args: user (disc...
Implement the Python class `UserRepository` described below. Class description: Implement the UserRepository class. Method signatures and docstrings: - async def add_user(self, user: discord.Member, guild_id: int) -> None: Adds a User to the global users table and/or to the guild specific user tables Args: user (disc...
2f8b45f06abb510029f3461ab5e39535a5eb3385
<|skeleton|> class UserRepository: async def add_user(self, user: discord.Member, guild_id: int) -> None: """Adds a User to the global users table and/or to the guild specific user tables Args: user (discord.Member) guild_id (int)""" <|body_0|> async def check_global_user(self, user_id: int) -...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserRepository: async def add_user(self, user: discord.Member, guild_id: int) -> None: """Adds a User to the global users table and/or to the guild specific user tables Args: user (discord.Member) guild_id (int)""" if await self.check_user_guild(guild_id, user.id): return a...
the_stack_v2_python_sparse
bot/data/user_repository.py
new-zelind/ClemBot
train
1
a0b85a31c6090a584bf576bf678c06cd442c297c
[ "self.screen_width = 1200\nself.screen_height = 600\nself.bg_color = (230, 230, 230)\nself.ship_limit = 3\nself.bullet_width = 3\nself.bullet_height = 15\nself.bullet_color = (60, 60, 60)\nself.bullets_allowed = 3\nself.fleet_drop_speed = 10\nself.speedup_scale = 1.1\nself.score_scale = 1.5\nself.initialize_dynamic...
<|body_start_0|> self.screen_width = 1200 self.screen_height = 600 self.bg_color = (230, 230, 230) self.ship_limit = 3 self.bullet_width = 3 self.bullet_height = 15 self.bullet_color = (60, 60, 60) self.bullets_allowed = 3 self.fleet_drop_speed = 1...
存储《外星人入侵》的所有设置的类
Settings
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Settings: """存储《外星人入侵》的所有设置的类""" def __init__(self): """初始化游戏的设置""" <|body_0|> def initialize_dynamic_settings(self): """初始化随游戏进行而变化的设置""" <|body_1|> def increase_speed(self): """提高速度设置和外星人点数""" <|body_2|> <|end_skeleton|> <|body_st...
stack_v2_sparse_classes_36k_train_004353
1,940
no_license
[ { "docstring": "初始化游戏的设置", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "初始化随游戏进行而变化的设置", "name": "initialize_dynamic_settings", "signature": "def initialize_dynamic_settings(self)" }, { "docstring": "提高速度设置和外星人点数", "name": "increase_speed", "si...
3
stack_v2_sparse_classes_30k_train_006134
Implement the Python class `Settings` described below. Class description: 存储《外星人入侵》的所有设置的类 Method signatures and docstrings: - def __init__(self): 初始化游戏的设置 - def initialize_dynamic_settings(self): 初始化随游戏进行而变化的设置 - def increase_speed(self): 提高速度设置和外星人点数
Implement the Python class `Settings` described below. Class description: 存储《外星人入侵》的所有设置的类 Method signatures and docstrings: - def __init__(self): 初始化游戏的设置 - def initialize_dynamic_settings(self): 初始化随游戏进行而变化的设置 - def increase_speed(self): 提高速度设置和外星人点数 <|skeleton|> class Settings: """存储《外星人入侵》的所有设置的类""" def...
0971e5f21a3d3ae9c2e22c87cf1f654be779abef
<|skeleton|> class Settings: """存储《外星人入侵》的所有设置的类""" def __init__(self): """初始化游戏的设置""" <|body_0|> def initialize_dynamic_settings(self): """初始化随游戏进行而变化的设置""" <|body_1|> def increase_speed(self): """提高速度设置和外星人点数""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Settings: """存储《外星人入侵》的所有设置的类""" def __init__(self): """初始化游戏的设置""" self.screen_width = 1200 self.screen_height = 600 self.bg_color = (230, 230, 230) self.ship_limit = 3 self.bullet_width = 3 self.bullet_height = 15 self.bullet_color = (60, ...
the_stack_v2_python_sparse
chapter_12-14_项目_外星人入侵/chapter_14_记分/settings.py
wenyoufu/Python-Programming
train
0
42a06c332639e08a0dc6af1f9dfa9fb90babbd21
[ "form_classes = self.get_form_classes()\nforms = self.get_forms(form_classes)\nkwargs = forms\nkwargs['forms'] = [form_class for form_class in forms.itervalues() if isinstance(form_class, BaseForm)]\nreturn self.render_to_response(self.get_context_data(**kwargs))", "kwargs = forms\nkwargs['forms'] = [form_class f...
<|body_start_0|> form_classes = self.get_form_classes() forms = self.get_forms(form_classes) kwargs = forms kwargs['forms'] = [form_class for form_class in forms.itervalues() if isinstance(form_class, BaseForm)] return self.render_to_response(self.get_context_data(**kwargs)) <|en...
A mixin that processes forms on POST.
ProcessMultipleFormsView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProcessMultipleFormsView: """A mixin that processes forms on POST.""" def get(self, request, *args, **kwargs): """Process a get request.""" <|body_0|> def render_invalid_response(self, forms): """Renders a response if forms don't validate.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_004354
6,333
permissive
[ { "docstring": "Process a get request.", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "Renders a response if forms don't validate.", "name": "render_invalid_response", "signature": "def render_invalid_response(self, forms)" }, { "docstri...
3
null
Implement the Python class `ProcessMultipleFormsView` described below. Class description: A mixin that processes forms on POST. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Process a get request. - def render_invalid_response(self, forms): Renders a response if forms don't validate. - ...
Implement the Python class `ProcessMultipleFormsView` described below. Class description: A mixin that processes forms on POST. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Process a get request. - def render_invalid_response(self, forms): Renders a response if forms don't validate. - ...
a56c0f89df82694bf5db32a04d8b092974791972
<|skeleton|> class ProcessMultipleFormsView: """A mixin that processes forms on POST.""" def get(self, request, *args, **kwargs): """Process a get request.""" <|body_0|> def render_invalid_response(self, forms): """Renders a response if forms don't validate.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProcessMultipleFormsView: """A mixin that processes forms on POST.""" def get(self, request, *args, **kwargs): """Process a get request.""" form_classes = self.get_form_classes() forms = self.get_forms(form_classes) kwargs = forms kwargs['forms'] = [form_class for ...
the_stack_v2_python_sparse
open_connect/connect_core/utils/views.py
ofa/connect
train
66
1d71985dc140a6123aeba97fdd3fd395b24fd851
[ "dummy = ListNode(-1)\nl3 = dummy\nwhile l1 and l2:\n if l1.val <= l2.val:\n l3.next = ListNode(l1.val)\n l1 = l1.next\n else:\n l3.next = ListNode(l2.val)\n l2 = l2.next\n l3 = l3.next\nif l1:\n l3.next = l1\nelif l2:\n l3.next = l2\nreturn dummy.next", "if not l1:\n ...
<|body_start_0|> dummy = ListNode(-1) l3 = dummy while l1 and l2: if l1.val <= l2.val: l3.next = ListNode(l1.val) l1 = l1.next else: l3.next = ListNode(l2.val) l2 = l2.next l3 = l3.next if...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mergeTwoLists_v1(self, l1: ListNode, l2: ListNode) -> ListNode: """迭代遍历""" <|body_0|> def mergeTwoLists_v2(self, l1: ListNode, l2: ListNode) -> ListNode: """递归""" <|body_1|> <|end_skeleton|> <|body_start_0|> dummy = ListNode(-1) ...
stack_v2_sparse_classes_36k_train_004355
2,584
no_license
[ { "docstring": "迭代遍历", "name": "mergeTwoLists_v1", "signature": "def mergeTwoLists_v1(self, l1: ListNode, l2: ListNode) -> ListNode" }, { "docstring": "递归", "name": "mergeTwoLists_v2", "signature": "def mergeTwoLists_v2(self, l1: ListNode, l2: ListNode) -> ListNode" } ]
2
stack_v2_sparse_classes_30k_train_011170
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists_v1(self, l1: ListNode, l2: ListNode) -> ListNode: 迭代遍历 - def mergeTwoLists_v2(self, l1: ListNode, l2: ListNode) -> ListNode: 递归
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists_v1(self, l1: ListNode, l2: ListNode) -> ListNode: 迭代遍历 - def mergeTwoLists_v2(self, l1: ListNode, l2: ListNode) -> ListNode: 递归 <|skeleton|> class Solution: ...
7bf9b992acb5c3db22b52f1ee70816296a41af9d
<|skeleton|> class Solution: def mergeTwoLists_v1(self, l1: ListNode, l2: ListNode) -> ListNode: """迭代遍历""" <|body_0|> def mergeTwoLists_v2(self, l1: ListNode, l2: ListNode) -> ListNode: """递归""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def mergeTwoLists_v1(self, l1: ListNode, l2: ListNode) -> ListNode: """迭代遍历""" dummy = ListNode(-1) l3 = dummy while l1 and l2: if l1.val <= l2.val: l3.next = ListNode(l1.val) l1 = l1.next else: l...
the_stack_v2_python_sparse
021mergeTwoSortedLists.py
slsefe/leetcode
train
0
3077088e5e3a6ce5ab65a0e1aaa97dc97975f27a
[ "super(DynamicNet, self).__init__()\nself.input_linear = torch.nn.Linear(D_in, H)\nself.middle_linear = torch.nn.Linear(H, H)\nself.output_linear = torch.nn.Linear(H, D_out)", "h_relu = self.input_linear(x).clamp(min=0)\nfor _ in range(random.randint(0, 3)):\n h_relu = self.middle_linear(h_relu).clamp(min=0)\n...
<|body_start_0|> super(DynamicNet, self).__init__() self.input_linear = torch.nn.Linear(D_in, H) self.middle_linear = torch.nn.Linear(H, H) self.output_linear = torch.nn.Linear(H, D_out) <|end_body_0|> <|body_start_1|> h_relu = self.input_linear(x).clamp(min=0) for _ in ...
DynamicNet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DynamicNet: def __init__(self, D_in, H, D_out): """在构造函数中,我们构造了三个nn.Linear实例,它们将在前向传播时被使用。""" <|body_0|> def forward(self, x): """对于模型的前向传播,我们随机选择0、1、2、3, 并重用了多次计算隐藏层的middle_linear模块。 由于每个前向传播构建一个动态计算图, 我们可以在定义模型的前向传播时使用常规Python控制流运算符,如循环或条件语句。 在这里,我们还看到,在定义计算图形时多次重用...
stack_v2_sparse_classes_36k_train_004356
16,194
no_license
[ { "docstring": "在构造函数中,我们构造了三个nn.Linear实例,它们将在前向传播时被使用。", "name": "__init__", "signature": "def __init__(self, D_in, H, D_out)" }, { "docstring": "对于模型的前向传播,我们随机选择0、1、2、3, 并重用了多次计算隐藏层的middle_linear模块。 由于每个前向传播构建一个动态计算图, 我们可以在定义模型的前向传播时使用常规Python控制流运算符,如循环或条件语句。 在这里,我们还看到,在定义计算图形时多次重用同一个模块是完全安全的。...
2
stack_v2_sparse_classes_30k_train_003119
Implement the Python class `DynamicNet` described below. Class description: Implement the DynamicNet class. Method signatures and docstrings: - def __init__(self, D_in, H, D_out): 在构造函数中,我们构造了三个nn.Linear实例,它们将在前向传播时被使用。 - def forward(self, x): 对于模型的前向传播,我们随机选择0、1、2、3, 并重用了多次计算隐藏层的middle_linear模块。 由于每个前向传播构建一个动态计算图, 我...
Implement the Python class `DynamicNet` described below. Class description: Implement the DynamicNet class. Method signatures and docstrings: - def __init__(self, D_in, H, D_out): 在构造函数中,我们构造了三个nn.Linear实例,它们将在前向传播时被使用。 - def forward(self, x): 对于模型的前向传播,我们随机选择0、1、2、3, 并重用了多次计算隐藏层的middle_linear模块。 由于每个前向传播构建一个动态计算图, 我...
272e0b674f2d8ebdca9eea0a35909d2c420212ae
<|skeleton|> class DynamicNet: def __init__(self, D_in, H, D_out): """在构造函数中,我们构造了三个nn.Linear实例,它们将在前向传播时被使用。""" <|body_0|> def forward(self, x): """对于模型的前向传播,我们随机选择0、1、2、3, 并重用了多次计算隐藏层的middle_linear模块。 由于每个前向传播构建一个动态计算图, 我们可以在定义模型的前向传播时使用常规Python控制流运算符,如循环或条件语句。 在这里,我们还看到,在定义计算图形时多次重用...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DynamicNet: def __init__(self, D_in, H, D_out): """在构造函数中,我们构造了三个nn.Linear实例,它们将在前向传播时被使用。""" super(DynamicNet, self).__init__() self.input_linear = torch.nn.Linear(D_in, H) self.middle_linear = torch.nn.Linear(H, H) self.output_linear = torch.nn.Linear(H, D_out) d...
the_stack_v2_python_sparse
PyTorch/quick_start_2/function_try.py
StarkTan/Python
train
0
fc6bd61e293ec0c389a6b1539fe2afc611cf4f9f
[ "super(ExternalMadSpin, self).__init__('MadSpin', os.environ['MADPATH'], 'MadSpin', 'madspin')\nself.add_keyword('alphaem_inv')\nself.add_keyword('alphaqcd')\nself.add_keyword('BR_t_to_Wb')\nself.add_keyword('BR_t_to_Wd')\nself.add_keyword('BR_t_to_Ws')\nself.add_keyword('BR_W_to_hadrons')\nself.add_keyword('BR_W_t...
<|body_start_0|> super(ExternalMadSpin, self).__init__('MadSpin', os.environ['MADPATH'], 'MadSpin', 'madspin') self.add_keyword('alphaem_inv') self.add_keyword('alphaqcd') self.add_keyword('BR_t_to_Wb') self.add_keyword('BR_t_to_Wd') self.add_keyword('BR_t_to_Ws') ...
! Class for running external MadSpin process. @author James Robinson <james.robinson@cern.ch>
ExternalMadSpin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExternalMadSpin: """! Class for running external MadSpin process. @author James Robinson <james.robinson@cern.ch>""" def __init__(self, process): """! Constructor. @param process MadSpin process description string.""" <|body_0|> def needs_scheduling(self, process): ...
stack_v2_sparse_classes_36k_train_004357
3,129
no_license
[ { "docstring": "! Constructor. @param process MadSpin process description string.", "name": "__init__", "signature": "def __init__(self, process)" }, { "docstring": "! Report whether the MadSpin process should be scheduled. @param process PowhegBox process.", "name": "needs_scheduling", ...
2
stack_v2_sparse_classes_30k_train_002299
Implement the Python class `ExternalMadSpin` described below. Class description: ! Class for running external MadSpin process. @author James Robinson <james.robinson@cern.ch> Method signatures and docstrings: - def __init__(self, process): ! Constructor. @param process MadSpin process description string. - def needs_...
Implement the Python class `ExternalMadSpin` described below. Class description: ! Class for running external MadSpin process. @author James Robinson <james.robinson@cern.ch> Method signatures and docstrings: - def __init__(self, process): ! Constructor. @param process MadSpin process description string. - def needs_...
22df23187ef85e9c3120122c8375ea0e7d8ea440
<|skeleton|> class ExternalMadSpin: """! Class for running external MadSpin process. @author James Robinson <james.robinson@cern.ch>""" def __init__(self, process): """! Constructor. @param process MadSpin process description string.""" <|body_0|> def needs_scheduling(self, process): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExternalMadSpin: """! Class for running external MadSpin process. @author James Robinson <james.robinson@cern.ch>""" def __init__(self, process): """! Constructor. @param process MadSpin process description string.""" super(ExternalMadSpin, self).__init__('MadSpin', os.environ['MADPATH'],...
the_stack_v2_python_sparse
athena/Generators/PowhegControl/python/processes/external/external_madspin.py
rushioda/PIXELVALID_athena
train
1
eae3d8e1993c82cc8cf603ccbc3134aadaafc779
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn OAuth2PermissionGrant()", "from .entity import Entity\nfrom .entity import Entity\nfields: Dict[str, Callable[[Any], None]] = {'clientId': lambda n: setattr(self, 'client_id', n.get_str_value()), 'consentType': lambda n: setattr(self, ...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return OAuth2PermissionGrant() <|end_body_0|> <|body_start_1|> from .entity import Entity from .entity import Entity fields: Dict[str, Callable[[Any], None]] = {'clientId': lambda n: se...
OAuth2PermissionGrant
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OAuth2PermissionGrant: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> OAuth2PermissionGrant: """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 th...
stack_v2_sparse_classes_36k_train_004358
4,239
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: OAuth2PermissionGrant", "name": "create_from_discriminator_value", "signature": "def create_from_discriminat...
3
null
Implement the Python class `OAuth2PermissionGrant` described below. Class description: Implement the OAuth2PermissionGrant class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> OAuth2PermissionGrant: Creates a new instance of the appropriate class base...
Implement the Python class `OAuth2PermissionGrant` described below. Class description: Implement the OAuth2PermissionGrant class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> OAuth2PermissionGrant: Creates a new instance of the appropriate class base...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class OAuth2PermissionGrant: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> OAuth2PermissionGrant: """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 th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OAuth2PermissionGrant: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> OAuth2PermissionGrant: """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 Retur...
the_stack_v2_python_sparse
msgraph/generated/models/o_auth2_permission_grant.py
microsoftgraph/msgraph-sdk-python
train
135
75df55ae946f3f3a6382acb0eac52c4e99b17abe
[ "inputs = tf.keras.Input(shape=(128,) * rank + (32,), batch_size=1)\nblock = conv_blocks.ConvBlock(filters=filters, kernel_size=kernel_size)\nfeatures = block(inputs)\nself.assertAllEqual(features.shape, [1] + [128] * rank + [filters])", "config = dict(filters=[32], kernel_size=3, strides=1, rank=2, activation='t...
<|body_start_0|> inputs = tf.keras.Input(shape=(128,) * rank + (32,), batch_size=1) block = conv_blocks.ConvBlock(filters=filters, kernel_size=kernel_size) features = block(inputs) self.assertAllEqual(features.shape, [1] + [128] * rank + [filters]) <|end_body_0|> <|body_start_1|> ...
Tests for `ConvBlock`.
ConvBlockTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConvBlockTest: """Tests for `ConvBlock`.""" def test_conv_block_creation(self, filters, kernel_size, rank): """Test object creation.""" <|body_0|> def test_serialize_deserialize(self): """Test de/serialization.""" <|body_1|> <|end_skeleton|> <|body_star...
stack_v2_sparse_classes_36k_train_004359
2,425
permissive
[ { "docstring": "Test object creation.", "name": "test_conv_block_creation", "signature": "def test_conv_block_creation(self, filters, kernel_size, rank)" }, { "docstring": "Test de/serialization.", "name": "test_serialize_deserialize", "signature": "def test_serialize_deserialize(self)" ...
2
stack_v2_sparse_classes_30k_train_019442
Implement the Python class `ConvBlockTest` described below. Class description: Tests for `ConvBlock`. Method signatures and docstrings: - def test_conv_block_creation(self, filters, kernel_size, rank): Test object creation. - def test_serialize_deserialize(self): Test de/serialization.
Implement the Python class `ConvBlockTest` described below. Class description: Tests for `ConvBlock`. Method signatures and docstrings: - def test_conv_block_creation(self, filters, kernel_size, rank): Test object creation. - def test_serialize_deserialize(self): Test de/serialization. <|skeleton|> class ConvBlockTe...
cfd8930ee5281e7f6dceb17c4a5acaf625fd3243
<|skeleton|> class ConvBlockTest: """Tests for `ConvBlock`.""" def test_conv_block_creation(self, filters, kernel_size, rank): """Test object creation.""" <|body_0|> def test_serialize_deserialize(self): """Test de/serialization.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConvBlockTest: """Tests for `ConvBlock`.""" def test_conv_block_creation(self, filters, kernel_size, rank): """Test object creation.""" inputs = tf.keras.Input(shape=(128,) * rank + (32,), batch_size=1) block = conv_blocks.ConvBlock(filters=filters, kernel_size=kernel_size) ...
the_stack_v2_python_sparse
tensorflow_mri/python/layers/conv_blocks_test.py
mrphys/tensorflow-mri
train
29
199980693b32280f54661faa947f35ab5b3c02dd
[ "super().__init__()\nself.conv1 = torch.nn.Sequential(torch.nn.Conv2d(in_channels, 64, kernel_size=9, stride=1, padding=4), torch.nn.PReLU())\nres_blocks = []\nfor _ in range(n_residual_blocks):\n res_blocks.append(ResidualBlock(64))\nself.res_blocks = torch.nn.Sequential(*res_blocks)\nself.conv2 = torch.nn.Sequ...
<|body_start_0|> super().__init__() self.conv1 = torch.nn.Sequential(torch.nn.Conv2d(in_channels, 64, kernel_size=9, stride=1, padding=4), torch.nn.PReLU()) res_blocks = [] for _ in range(n_residual_blocks): res_blocks.append(ResidualBlock(64)) self.res_blocks = torch...
Residual Generator Network
GeneratorResNet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GeneratorResNet: """Residual Generator Network""" def __init__(self, in_channels=3, out_channels=3, n_residual_blocks=16): """Parameters ---------- in_channels : int number of input channels out_channels : int number of output channels n_residual_blocks : int number of residual block...
stack_v2_sparse_classes_36k_train_004360
6,183
permissive
[ { "docstring": "Parameters ---------- in_channels : int number of input channels out_channels : int number of output channels n_residual_blocks : int number of residual blocks inside this generator", "name": "__init__", "signature": "def __init__(self, in_channels=3, out_channels=3, n_residual_blocks=16...
2
null
Implement the Python class `GeneratorResNet` described below. Class description: Residual Generator Network Method signatures and docstrings: - def __init__(self, in_channels=3, out_channels=3, n_residual_blocks=16): Parameters ---------- in_channels : int number of input channels out_channels : int number of output ...
Implement the Python class `GeneratorResNet` described below. Class description: Residual Generator Network Method signatures and docstrings: - def __init__(self, in_channels=3, out_channels=3, n_residual_blocks=16): Parameters ---------- in_channels : int number of input channels out_channels : int number of output ...
1078f5030b8aac2bf022daf5fa14d66f74c3c893
<|skeleton|> class GeneratorResNet: """Residual Generator Network""" def __init__(self, in_channels=3, out_channels=3, n_residual_blocks=16): """Parameters ---------- in_channels : int number of input channels out_channels : int number of output channels n_residual_blocks : int number of residual block...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GeneratorResNet: """Residual Generator Network""" def __init__(self, in_channels=3, out_channels=3, n_residual_blocks=16): """Parameters ---------- in_channels : int number of input channels out_channels : int number of output channels n_residual_blocks : int number of residual blocks inside this...
the_stack_v2_python_sparse
dlutils/models/gans/super_resolution/models.py
justusschock/dl-utils
train
15
549db5b6fa5f9904e3e95f8d1199386e6f8a64ee
[ "self.__dict__['FILEORHASH'] = {'value': FILEORHASH, 'required': True, 'description': 'File to verify'}\nself.__dict__['APIKEY'] = {'value': APIKEY, 'required': True, 'description': 'VT API key'}\nself.__dict__['REPORT'] = {'value': REPORT, 'required': False, 'description': 'Return report for File or MD5'}\nself.__...
<|body_start_0|> self.__dict__['FILEORHASH'] = {'value': FILEORHASH, 'required': True, 'description': 'File to verify'} self.__dict__['APIKEY'] = {'value': APIKEY, 'required': True, 'description': 'VT API key'} self.__dict__['REPORT'] = {'value': REPORT, 'required': False, 'description': 'Return...
Module Class
Module
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Module: """Module Class""" def __init__(self, FILEORHASH=None, REPORT=False, JSON=False, DOWNLOAD=False, PCAP=False, VERBOSE=False, RESCAN=False, APIKEY=None): """__init__(self, FILEORHASH=None, REPORT=False, JSON=False, DOWNLOAD=False, PCAP=False, VERBOSE=False, RESCAN=False,APIKEY=...
stack_v2_sparse_classes_36k_train_004361
7,816
no_license
[ { "docstring": "__init__(self, FILEORHASH=None, REPORT=False, JSON=False, DOWNLOAD=False, PCAP=False, VERBOSE=False, RESCAN=False,APIKEY=None) :param FILEORHASH: :param REPORT: :param JSON: :param DOWNLOAD: :param PCAP: :param VERBOSE: :param RESCAN: :param APIKEY: Initialize the module with the module's desire...
2
stack_v2_sparse_classes_30k_train_013496
Implement the Python class `Module` described below. Class description: Module Class Method signatures and docstrings: - def __init__(self, FILEORHASH=None, REPORT=False, JSON=False, DOWNLOAD=False, PCAP=False, VERBOSE=False, RESCAN=False, APIKEY=None): __init__(self, FILEORHASH=None, REPORT=False, JSON=False, DOWNLO...
Implement the Python class `Module` described below. Class description: Module Class Method signatures and docstrings: - def __init__(self, FILEORHASH=None, REPORT=False, JSON=False, DOWNLOAD=False, PCAP=False, VERBOSE=False, RESCAN=False, APIKEY=None): __init__(self, FILEORHASH=None, REPORT=False, JSON=False, DOWNLO...
99e1d75b3d1af2e44740584be6c2ef1c1601c43c
<|skeleton|> class Module: """Module Class""" def __init__(self, FILEORHASH=None, REPORT=False, JSON=False, DOWNLOAD=False, PCAP=False, VERBOSE=False, RESCAN=False, APIKEY=None): """__init__(self, FILEORHASH=None, REPORT=False, JSON=False, DOWNLOAD=False, PCAP=False, VERBOSE=False, RESCAN=False,APIKEY=...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Module: """Module Class""" def __init__(self, FILEORHASH=None, REPORT=False, JSON=False, DOWNLOAD=False, PCAP=False, VERBOSE=False, RESCAN=False, APIKEY=None): """__init__(self, FILEORHASH=None, REPORT=False, JSON=False, DOWNLOAD=False, PCAP=False, VERBOSE=False, RESCAN=False,APIKEY=None) :param ...
the_stack_v2_python_sparse
modules/intel/virus_total.py
h4cklife/intrukit
train
3
2442b353ebb9395c5db7855d5cec451e8d0b957f
[ "total_len = len(nums1) + len(nums2)\nk = total_len // 2\nif total_len % 2 == 0:\n return (self.findKth(nums1, nums2, k) + self.findKth(nums1, nums2, k + 1)) / 2.0\nreturn self.findKth(nums1, nums2, k + 1) * 1.0", "if kth > len(nums1) + len(nums2):\n raise ValueError('kth should be lower than the total leng...
<|body_start_0|> total_len = len(nums1) + len(nums2) k = total_len // 2 if total_len % 2 == 0: return (self.findKth(nums1, nums2, k) + self.findKth(nums1, nums2, k + 1)) / 2.0 return self.findKth(nums1, nums2, k + 1) * 1.0 <|end_body_0|> <|body_start_1|> if kth > len...
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, kth): """find kth element of two sorted list""" <|body_1|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_36k_train_004362
1,741
no_license
[ { "docstring": ":type nums1: List[int] :type nums2: List[int] :rtype: float", "name": "findMedianSortedArrays", "signature": "def findMedianSortedArrays(self, nums1, nums2)" }, { "docstring": "find kth element of two sorted list", "name": "findKth", "signature": "def findKth(self, nums1,...
2
stack_v2_sparse_classes_30k_train_013224
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, kth): find kth element of two sorted...
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, kth): find kth element of two sorted...
7e3929a4b5bd0344f93373979c9d1acc4ae192a7
<|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, kth): """find kth element of two sorted list""" <|body_1|> <|end_skeleton|>
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""" total_len = len(nums1) + len(nums2) k = total_len // 2 if total_len % 2 == 0: return (self.findKth(nums1, nums2, k) + self.findKth(nums1, nums...
the_stack_v2_python_sparse
median_of_two_sorted_arrays.py
xartisan/leetcode-solutions-in-python
train
1
92a023b85d6e7609e1d68e60476b0b0696823790
[ "if 'price' in data and 'end_time' not in data:\n raise ValidationError('If the price is included, you must also include the end time.')\nelif 'price' not in data and 'end_time' in data:\n raise ValidationError('If the end time is included, you must also include the price.')\nif 'price' in data and 'estimated...
<|body_start_0|> if 'price' in data and 'end_time' not in data: raise ValidationError('If the price is included, you must also include the end time.') elif 'price' not in data and 'end_time' in data: raise ValidationError('If the end time is included, you must also include the pr...
RentalSchema
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RentalSchema: def assert_end_time_with_price(self, data, **kwargs): """Asserts that when a rental is complete both the price and end time are included.""" <|body_0|> def assert_url_included_with_foreign_key(self, data, **kwargs): """Asserts that when a user_id or bik...
stack_v2_sparse_classes_36k_train_004363
6,177
permissive
[ { "docstring": "Asserts that when a rental is complete both the price and end time are included.", "name": "assert_end_time_with_price", "signature": "def assert_end_time_with_price(self, data, **kwargs)" }, { "docstring": "Asserts that when a user_id or bike_id is sent that a user_url or bike_u...
2
stack_v2_sparse_classes_30k_train_012926
Implement the Python class `RentalSchema` described below. Class description: Implement the RentalSchema class. Method signatures and docstrings: - def assert_end_time_with_price(self, data, **kwargs): Asserts that when a rental is complete both the price and end time are included. - def assert_url_included_with_fore...
Implement the Python class `RentalSchema` described below. Class description: Implement the RentalSchema class. Method signatures and docstrings: - def assert_end_time_with_price(self, data, **kwargs): Asserts that when a rental is complete both the price and end time are included. - def assert_url_included_with_fore...
fc6f9230e4701cbddcb16d7257fddb9ff08bddb9
<|skeleton|> class RentalSchema: def assert_end_time_with_price(self, data, **kwargs): """Asserts that when a rental is complete both the price and end time are included.""" <|body_0|> def assert_url_included_with_foreign_key(self, data, **kwargs): """Asserts that when a user_id or bik...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RentalSchema: def assert_end_time_with_price(self, data, **kwargs): """Asserts that when a rental is complete both the price and end time are included.""" if 'price' in data and 'end_time' not in data: raise ValidationError('If the price is included, you must also include the end t...
the_stack_v2_python_sparse
server/serializer/models.py
dragorhast/server
train
6
695cee99cf12c7c750bdd02cbb215e58afb2e2f2
[ "super().__init__()\nout_channels = channels * self.expansion\nif cardinality == 1:\n rc = channels\nelse:\n width_ratio = channels * (width / self.start_filts)\n rc = cardinality * math.floor(width_ratio)\nself.conv_reduce = ConvNdTorch(n_dim, in_channels, rc, kernel_size=1, stride=1, padding=0, bias=Fals...
<|body_start_0|> super().__init__() out_channels = channels * self.expansion if cardinality == 1: rc = channels else: width_ratio = channels * (width / self.start_filts) rc = cardinality * math.floor(width_ratio) self.conv_reduce = ConvNdTorch(...
SEBottleneckXTorch
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SEBottleneckXTorch: def __init__(self, in_channels, channels, stride, cardinality, width, n_dim, norm_layer, avg_down, reduction=16): """Squeeze and Excitation ResNeXt Block Parameters ---------- in_channels : int number of input channels stride : int stride of 3x3 convolution layer card...
stack_v2_sparse_classes_36k_train_004364
8,979
permissive
[ { "docstring": "Squeeze and Excitation ResNeXt Block Parameters ---------- in_channels : int number of input channels stride : int stride of 3x3 convolution layer cardinality : int number of convolution groups width : int width of resnext block n_dim : int dimensionality of convolutions norm_layer : str type of...
2
stack_v2_sparse_classes_30k_train_002489
Implement the Python class `SEBottleneckXTorch` described below. Class description: Implement the SEBottleneckXTorch class. Method signatures and docstrings: - def __init__(self, in_channels, channels, stride, cardinality, width, n_dim, norm_layer, avg_down, reduction=16): Squeeze and Excitation ResNeXt Block Paramet...
Implement the Python class `SEBottleneckXTorch` described below. Class description: Implement the SEBottleneckXTorch class. Method signatures and docstrings: - def __init__(self, in_channels, channels, stride, cardinality, width, n_dim, norm_layer, avg_down, reduction=16): Squeeze and Excitation ResNeXt Block Paramet...
d944aa67d319bd63a2add5cb89e8308413943de6
<|skeleton|> class SEBottleneckXTorch: def __init__(self, in_channels, channels, stride, cardinality, width, n_dim, norm_layer, avg_down, reduction=16): """Squeeze and Excitation ResNeXt Block Parameters ---------- in_channels : int number of input channels stride : int stride of 3x3 convolution layer card...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SEBottleneckXTorch: def __init__(self, in_channels, channels, stride, cardinality, width, n_dim, norm_layer, avg_down, reduction=16): """Squeeze and Excitation ResNeXt Block Parameters ---------- in_channels : int number of input channels stride : int stride of 3x3 convolution layer cardinality : int ...
the_stack_v2_python_sparse
deliravision/torch/models/backbones/seblocks.py
delira-dev/vision_torch
train
5
fe04e5a34d94e13c95efc112b9006f018639fa9c
[ "tmp = head\nwhile head:\n if head.next:\n if head.val == head.next.val:\n head.next = head.next.next\n continue\n head = head.next\nreturn tmp", "ohead = head\nwhile head:\n if head.next and head.val == head.next.val:\n head.next = head.next.next\n else:\n h...
<|body_start_0|> tmp = head while head: if head.next: if head.val == head.next.val: head.next = head.next.next continue head = head.next return tmp <|end_body_0|> <|body_start_1|> ohead = head while ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def deleteDuplicates(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def rewrite(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> tmp = head while head: ...
stack_v2_sparse_classes_36k_train_004365
1,698
no_license
[ { "docstring": ":type head: ListNode :rtype: ListNode", "name": "deleteDuplicates", "signature": "def deleteDuplicates(self, head)" }, { "docstring": ":type head: ListNode :rtype: ListNode", "name": "rewrite", "signature": "def rewrite(self, head)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def deleteDuplicates(self, head): :type head: ListNode :rtype: ListNode - def rewrite(self, head): :type head: ListNode :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def deleteDuplicates(self, head): :type head: ListNode :rtype: ListNode - def rewrite(self, head): :type head: ListNode :rtype: ListNode <|skeleton|> class Solution: def de...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class Solution: def deleteDuplicates(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def rewrite(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def deleteDuplicates(self, head): """:type head: ListNode :rtype: ListNode""" tmp = head while head: if head.next: if head.val == head.next.val: head.next = head.next.next continue head = head.nex...
the_stack_v2_python_sparse
linked/83_Remove_Duplicates_from_Sorted_List.py
vsdrun/lc_public
train
6
b24c2b30e3327ab3831f87abf15dd7b691b3a8b3
[ "APIAdminCommon.verifySecurityOfAdminAPICall(appObj, request, tenant)\n\ndef dbfn(storeConnection):\n ticketTypeObj = appObj.TicketManager.getTicketType(tenantName=tenantName, tickettypeID=tickettypeID, storeConnection=storeConnection)\n if ticketTypeObj is None:\n return (NotFound, 404)\n return (t...
<|body_start_0|> APIAdminCommon.verifySecurityOfAdminAPICall(appObj, request, tenant) def dbfn(storeConnection): ticketTypeObj = appObj.TicketManager.getTicketType(tenantName=tenantName, tickettypeID=tickettypeID, storeConnection=storeConnection) if ticketTypeObj is None: ...
Ticket Type
tickettypeInfo
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class tickettypeInfo: """Ticket Type""" def get(self, tenant, tenantName, tickettypeID): """Get Ticket Type""" <|body_0|> def post(self, tenant, tenantName, tickettypeID): """Update Ticket Type""" <|body_1|> def delete(self, tenant, tenantName, tickettypeI...
stack_v2_sparse_classes_36k_train_004366
12,942
permissive
[ { "docstring": "Get Ticket Type", "name": "get", "signature": "def get(self, tenant, tenantName, tickettypeID)" }, { "docstring": "Update Ticket Type", "name": "post", "signature": "def post(self, tenant, tenantName, tickettypeID)" }, { "docstring": "Delete Ticket Type", "nam...
3
null
Implement the Python class `tickettypeInfo` described below. Class description: Ticket Type Method signatures and docstrings: - def get(self, tenant, tenantName, tickettypeID): Get Ticket Type - def post(self, tenant, tenantName, tickettypeID): Update Ticket Type - def delete(self, tenant, tenantName, tickettypeID): ...
Implement the Python class `tickettypeInfo` described below. Class description: Ticket Type Method signatures and docstrings: - def get(self, tenant, tenantName, tickettypeID): Get Ticket Type - def post(self, tenant, tenantName, tickettypeID): Update Ticket Type - def delete(self, tenant, tenantName, tickettypeID): ...
d3908c46614fb1b638553282cd72ba3634277495
<|skeleton|> class tickettypeInfo: """Ticket Type""" def get(self, tenant, tenantName, tickettypeID): """Get Ticket Type""" <|body_0|> def post(self, tenant, tenantName, tickettypeID): """Update Ticket Type""" <|body_1|> def delete(self, tenant, tenantName, tickettypeI...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class tickettypeInfo: """Ticket Type""" def get(self, tenant, tenantName, tickettypeID): """Get Ticket Type""" APIAdminCommon.verifySecurityOfAdminAPICall(appObj, request, tenant) def dbfn(storeConnection): ticketTypeObj = appObj.TicketManager.getTicketType(tenantName=tenan...
the_stack_v2_python_sparse
services/src/APIadmin_Tickets.py
rmetcalf9/saas_user_management_system
train
1
5235f84ded4237e6116e78dbea05af5a5e122150
[ "self.open(base_url)\nself.login_test_user()\nself.open(base_url + '/logout')\nassert self.get_current_url() == base_url + '/login'\nmessage = self.driver.find_element_by_id('login_message')\nassert 'Please Login' in message.text", "self.login_test_user()\nself.open(base_url + '/logout')\nassert self.get_current_...
<|body_start_0|> self.open(base_url) self.login_test_user() self.open(base_url + '/logout') assert self.get_current_url() == base_url + '/login' message = self.driver.find_element_by_id('login_message') assert 'Please Login' in message.text <|end_body_0|> <|body_start_1|...
Contains test cases specific to R7. Test only test the frontend portion, and will patch the backend specific values
R7Test
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class R7Test: """Contains test cases specific to R7. Test only test the frontend portion, and will patch the backend specific values""" def test_logout_redirect(self, *_): """see r7.1""" <|body_0|> def test_logout_restricted(self, *_): """see r7.2""" <|body_1|>...
stack_v2_sparse_classes_36k_train_004367
1,272
permissive
[ { "docstring": "see r7.1", "name": "test_logout_redirect", "signature": "def test_logout_redirect(self, *_)" }, { "docstring": "see r7.2", "name": "test_logout_restricted", "signature": "def test_logout_restricted(self, *_)" } ]
2
stack_v2_sparse_classes_30k_test_000484
Implement the Python class `R7Test` described below. Class description: Contains test cases specific to R7. Test only test the frontend portion, and will patch the backend specific values Method signatures and docstrings: - def test_logout_redirect(self, *_): see r7.1 - def test_logout_restricted(self, *_): see r7.2
Implement the Python class `R7Test` described below. Class description: Contains test cases specific to R7. Test only test the frontend portion, and will patch the backend specific values Method signatures and docstrings: - def test_logout_redirect(self, *_): see r7.1 - def test_logout_restricted(self, *_): see r7.2 ...
73f6bdcbd2f382a54dfec3e0e79120bd60c9513f
<|skeleton|> class R7Test: """Contains test cases specific to R7. Test only test the frontend portion, and will patch the backend specific values""" def test_logout_redirect(self, *_): """see r7.1""" <|body_0|> def test_logout_restricted(self, *_): """see r7.2""" <|body_1|>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class R7Test: """Contains test cases specific to R7. Test only test the frontend portion, and will patch the backend specific values""" def test_logout_redirect(self, *_): """see r7.1""" self.open(base_url) self.login_test_user() self.open(base_url + '/logout') assert se...
the_stack_v2_python_sparse
qa327_test/frontend/test_r7.py
nicoleooi/cmpe327
train
0
02e02be3dfcd20175687236b47ceb2865eca6f2f
[ "x_data, y_data, vectorizer, clf = load_all(model, language=language, preprocessing=preprocessing, categories=categories, encoding=encoding, vectorizer=vectorizer, vectorizer_method=vectorizer_method, clf=clf, clf_method=clf_method, x_data=x_data, y_data=y_data)\nTrainer._train(vectorizer, clf, x_data, y_data)\nwri...
<|body_start_0|> x_data, y_data, vectorizer, clf = load_all(model, language=language, preprocessing=preprocessing, categories=categories, encoding=encoding, vectorizer=vectorizer, vectorizer_method=vectorizer_method, clf=clf, clf_method=clf_method, x_data=x_data, y_data=y_data) Trainer._train(vectorizer...
Trainer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Trainer: def __init__(self, model, language=None, preprocessing=None, categories=None, encoding=None, vectorizer=None, vectorizer_method=None, clf=None, clf_method=None, x_data=None, y_data=None): """Data should be stored in a two levels folder structure like this: datasets/ model_name/ ...
stack_v2_sparse_classes_36k_train_004368
1,972
permissive
[ { "docstring": "Data should be stored in a two levels folder structure like this: datasets/ model_name/ category1/ file_1.txt file_2.txt file_42.txt category2/ file_43.txt file_44.txt", "name": "__init__", "signature": "def __init__(self, model, language=None, preprocessing=None, categories=None, encodi...
2
stack_v2_sparse_classes_30k_test_001050
Implement the Python class `Trainer` described below. Class description: Implement the Trainer class. Method signatures and docstrings: - def __init__(self, model, language=None, preprocessing=None, categories=None, encoding=None, vectorizer=None, vectorizer_method=None, clf=None, clf_method=None, x_data=None, y_data...
Implement the Python class `Trainer` described below. Class description: Implement the Trainer class. Method signatures and docstrings: - def __init__(self, model, language=None, preprocessing=None, categories=None, encoding=None, vectorizer=None, vectorizer_method=None, clf=None, clf_method=None, x_data=None, y_data...
8246824e7b50b84be6697bb4cc2a6381ddcd0ca9
<|skeleton|> class Trainer: def __init__(self, model, language=None, preprocessing=None, categories=None, encoding=None, vectorizer=None, vectorizer_method=None, clf=None, clf_method=None, x_data=None, y_data=None): """Data should be stored in a two levels folder structure like this: datasets/ model_name/ ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Trainer: def __init__(self, model, language=None, preprocessing=None, categories=None, encoding=None, vectorizer=None, vectorizer_method=None, clf=None, clf_method=None, x_data=None, y_data=None): """Data should be stored in a two levels folder structure like this: datasets/ model_name/ category1/ fil...
the_stack_v2_python_sparse
cherry/trainer.py
Windsooon/cherry
train
444
2524af858811a275b69a2020ec697402f7ef06bc
[ "super(Cycle, self).__init__(name=name, **kwargs)\nself.add_module('f', f)\nself.add_module('g', g)", "y = self.f(x, s)\nx_inv = self.g(y if not detach else y.detach(), s)\nreturn (y, x_inv)" ]
<|body_start_0|> super(Cycle, self).__init__(name=name, **kwargs) self.add_module('f', f) self.add_module('g', g) <|end_body_0|> <|body_start_1|> y = self.f(x, s) x_inv = self.g(y if not detach else y.detach(), s) return (y, x_inv) <|end_body_1|>
A class representing the cycle model from: "Preventing self-intersection with cycle regularization in neural networks for mesh reconstruction from a single RGB image" Attributes ---------- f : torch.nn.Module the decoder architecture g : torch.nn.Module the inverse decoder architecture Methods ------- forward(x, s) ret...
Cycle
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cycle: """A class representing the cycle model from: "Preventing self-intersection with cycle regularization in neural networks for mesh reconstruction from a single RGB image" Attributes ---------- f : torch.nn.Module the decoder architecture g : torch.nn.Module the inverse decoder architecture ...
stack_v2_sparse_classes_36k_train_004369
1,885
permissive
[ { "docstring": "Parameters ---------- f : torch.nn.Module the decoder architecture g : torch.nn.Module the inverse decoder architecture name : str (optional) the name of the model", "name": "__init__", "signature": "def __init__(self, f, g, name='Cycle', **kwargs)" }, { "docstring": "Returns the...
2
null
Implement the Python class `Cycle` described below. Class description: A class representing the cycle model from: "Preventing self-intersection with cycle regularization in neural networks for mesh reconstruction from a single RGB image" Attributes ---------- f : torch.nn.Module the decoder architecture g : torch.nn.M...
Implement the Python class `Cycle` described below. Class description: A class representing the cycle model from: "Preventing self-intersection with cycle regularization in neural networks for mesh reconstruction from a single RGB image" Attributes ---------- f : torch.nn.Module the decoder architecture g : torch.nn.M...
2615b66dd4addfd5c03d9d91a24c7da414294308
<|skeleton|> class Cycle: """A class representing the cycle model from: "Preventing self-intersection with cycle regularization in neural networks for mesh reconstruction from a single RGB image" Attributes ---------- f : torch.nn.Module the decoder architecture g : torch.nn.Module the inverse decoder architecture ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Cycle: """A class representing the cycle model from: "Preventing self-intersection with cycle regularization in neural networks for mesh reconstruction from a single RGB image" Attributes ---------- f : torch.nn.Module the decoder architecture g : torch.nn.Module the inverse decoder architecture Methods -----...
the_stack_v2_python_sparse
ACME/model/cycle.py
mauriziokovacic/ACME
train
3
26160abe03ea6b85ae3fd7a74cd3f013f77ea640
[ "dataDtypes = dataForPreprocess.dtypes.reset_index(level=0)\ndataDtypes.rename(columns={'index': '变量名称', 0: '数据类型'}, inplace=True)\ndata_describe = dataForPreprocess.describe().T.reset_index(level=0)\ndata_describe.rename(columns={'index': '变量名称'}, inplace=True)\ndataTypes = pd.merge(dataDtypes, data_describe, on='...
<|body_start_0|> dataDtypes = dataForPreprocess.dtypes.reset_index(level=0) dataDtypes.rename(columns={'index': '变量名称', 0: '数据类型'}, inplace=True) data_describe = dataForPreprocess.describe().T.reset_index(level=0) data_describe.rename(columns={'index': '变量名称'}, inplace=True) data...
功能描述:字符型变量向数值型变量转换 输入: dataForPreprocess:预处理前的数据集 DataFrame listObject: 需要数据类型转换的字符型变量 list ylabel: 坏样本率对应的特征名称 (如:'y') 输出: 函数transform_object_dict: 主要用于字符型变量转换为数值型变量,依照坏样本率排序,形成映射字典 函数transform_object_type:将数据集众的字符型变量转换为数值型变量 管理记录: 1. edited by 王文丹 2021/07/02
TransformValueClass
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransformValueClass: """功能描述:字符型变量向数值型变量转换 输入: dataForPreprocess:预处理前的数据集 DataFrame listObject: 需要数据类型转换的字符型变量 list ylabel: 坏样本率对应的特征名称 (如:'y') 输出: 函数transform_object_dict: 主要用于字符型变量转换为数值型变量,依照坏样本率排序,形成映射字典 函数transform_object_type:将数据集众的字符型变量转换为数值型变量 管理记录: 1. edited by 王文丹 2021/07/02""" def ...
stack_v2_sparse_classes_36k_train_004370
4,082
no_license
[ { "docstring": "功能描述:主要功能识别字符型变量", "name": "output_var_type", "signature": "def output_var_type(self, dataForPreprocess)" }, { "docstring": "功能描述:主要用于字符型变量转换为数值型变量,依照坏样本率排序,形成映射字典 输入: dataForPreprocess:预处理前的数据集 DataFrame listNeedTransform: 需要数据类型转换的字符型变量 list ylabel: 坏样本率对应的特征名称 (如:'y') 输出: dict...
3
stack_v2_sparse_classes_30k_train_019451
Implement the Python class `TransformValueClass` described below. Class description: 功能描述:字符型变量向数值型变量转换 输入: dataForPreprocess:预处理前的数据集 DataFrame listObject: 需要数据类型转换的字符型变量 list ylabel: 坏样本率对应的特征名称 (如:'y') 输出: 函数transform_object_dict: 主要用于字符型变量转换为数值型变量,依照坏样本率排序,形成映射字典 函数transform_object_type:将数据集众的字符型变量转换为数值型变量 管理记录: 1...
Implement the Python class `TransformValueClass` described below. Class description: 功能描述:字符型变量向数值型变量转换 输入: dataForPreprocess:预处理前的数据集 DataFrame listObject: 需要数据类型转换的字符型变量 list ylabel: 坏样本率对应的特征名称 (如:'y') 输出: 函数transform_object_dict: 主要用于字符型变量转换为数值型变量,依照坏样本率排序,形成映射字典 函数transform_object_type:将数据集众的字符型变量转换为数值型变量 管理记录: 1...
e1f7d1229ee82fb5cf7e5f969f24f8c61568c2c9
<|skeleton|> class TransformValueClass: """功能描述:字符型变量向数值型变量转换 输入: dataForPreprocess:预处理前的数据集 DataFrame listObject: 需要数据类型转换的字符型变量 list ylabel: 坏样本率对应的特征名称 (如:'y') 输出: 函数transform_object_dict: 主要用于字符型变量转换为数值型变量,依照坏样本率排序,形成映射字典 函数transform_object_type:将数据集众的字符型变量转换为数值型变量 管理记录: 1. edited by 王文丹 2021/07/02""" def ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TransformValueClass: """功能描述:字符型变量向数值型变量转换 输入: dataForPreprocess:预处理前的数据集 DataFrame listObject: 需要数据类型转换的字符型变量 list ylabel: 坏样本率对应的特征名称 (如:'y') 输出: 函数transform_object_dict: 主要用于字符型变量转换为数值型变量,依照坏样本率排序,形成映射字典 函数transform_object_type:将数据集众的字符型变量转换为数值型变量 管理记录: 1. edited by 王文丹 2021/07/02""" def output_var_ty...
the_stack_v2_python_sparse
C_PreprocessData/TransformValueModule/TransformValueHandle.py
wenhui0331/Basic_Model_V1
train
0
493261cde245759e7df2fbb5f272975759c5b730
[ "self.name = 'static'\nself.options = {'hue': 'hue', 'brightness': 'brightness', 'saturation': 'saturation', 'start': 'start', 'end': 'start', 'blend': 'blend'}\nself.start = kwargs.get('start', 0)\nself.end = kwargs.get('end', -1)\nself.hue = kwargs.get('hue', True)\nself.saturation = kwargs.get('saturation', None...
<|body_start_0|> self.name = 'static' self.options = {'hue': 'hue', 'brightness': 'brightness', 'saturation': 'saturation', 'start': 'start', 'end': 'start', 'blend': 'blend'} self.start = kwargs.get('start', 0) self.end = kwargs.get('end', -1) self.hue = kwargs.get('hue', True) ...
DocString
StaticEffect
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StaticEffect: """DocString""" def __init__(self, **kwargs): """DocString""" <|body_0|> def iterate(self): """DocString""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.name = 'static' self.options = {'hue': 'hue', 'brightness': 'brig...
stack_v2_sparse_classes_36k_train_004371
1,154
permissive
[ { "docstring": "DocString", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "DocString", "name": "iterate", "signature": "def iterate(self)" } ]
2
stack_v2_sparse_classes_30k_train_021416
Implement the Python class `StaticEffect` described below. Class description: DocString Method signatures and docstrings: - def __init__(self, **kwargs): DocString - def iterate(self): DocString
Implement the Python class `StaticEffect` described below. Class description: DocString Method signatures and docstrings: - def __init__(self, **kwargs): DocString - def iterate(self): DocString <|skeleton|> class StaticEffect: """DocString""" def __init__(self, **kwargs): """DocString""" <|...
b5cc2fb036d283b4ebd975ed6ba0df98bb6b5169
<|skeleton|> class StaticEffect: """DocString""" def __init__(self, **kwargs): """DocString""" <|body_0|> def iterate(self): """DocString""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StaticEffect: """DocString""" def __init__(self, **kwargs): """DocString""" self.name = 'static' self.options = {'hue': 'hue', 'brightness': 'brightness', 'saturation': 'saturation', 'start': 'start', 'end': 'start', 'blend': 'blend'} self.start = kwargs.get('start', 0) ...
the_stack_v2_python_sparse
effects/static.py
fernandoeng/OmegaLed
train
0
139f77e12fa08bf14b8abc77dfcd26eeb2e248cb
[ "dic = dict()\nfor num in nums:\n if num in dic:\n return [num, dic[num]]\n dic[target - num] = num\nreturn []", "res, n = ([], len(nums))\nif n < 3:\n return res\nnums.sort()\nfor p1 in range(n):\n if p1 > 0 and nums[p1] == nums[p1 - 1]:\n continue\n p3 = n - 1\n t = target - nums...
<|body_start_0|> dic = dict() for num in nums: if num in dic: return [num, dic[num]] dic[target - num] = num return [] <|end_body_0|> <|body_start_1|> res, n = ([], len(nums)) if n < 3: return res nums.sort() fo...
N-Sum问题系统来一遍 问题分类为找一个和找不重复的所有。
NSum
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NSum: """N-Sum问题系统来一遍 问题分类为找一个和找不重复的所有。""" def twoSum1(self, nums, target) -> List[int]: """无序的数组找一个直接用哈希表""" <|body_0|> def threeSum(self, nums: List[int], target: int) -> List[List[int]]: """三数之和,返回所有可能的不重复的结果""" <|body_1|> def fourSum(self, nums: ...
stack_v2_sparse_classes_36k_train_004372
4,219
no_license
[ { "docstring": "无序的数组找一个直接用哈希表", "name": "twoSum1", "signature": "def twoSum1(self, nums, target) -> List[int]" }, { "docstring": "三数之和,返回所有可能的不重复的结果", "name": "threeSum", "signature": "def threeSum(self, nums: List[int], target: int) -> List[List[int]]" }, { "docstring": "四数之和,返...
3
stack_v2_sparse_classes_30k_train_006817
Implement the Python class `NSum` described below. Class description: N-Sum问题系统来一遍 问题分类为找一个和找不重复的所有。 Method signatures and docstrings: - def twoSum1(self, nums, target) -> List[int]: 无序的数组找一个直接用哈希表 - def threeSum(self, nums: List[int], target: int) -> List[List[int]]: 三数之和,返回所有可能的不重复的结果 - def fourSum(self, nums: List...
Implement the Python class `NSum` described below. Class description: N-Sum问题系统来一遍 问题分类为找一个和找不重复的所有。 Method signatures and docstrings: - def twoSum1(self, nums, target) -> List[int]: 无序的数组找一个直接用哈希表 - def threeSum(self, nums: List[int], target: int) -> List[List[int]]: 三数之和,返回所有可能的不重复的结果 - def fourSum(self, nums: List...
330330ef6bc42eeb17f4dea53c30d230506b4e8f
<|skeleton|> class NSum: """N-Sum问题系统来一遍 问题分类为找一个和找不重复的所有。""" def twoSum1(self, nums, target) -> List[int]: """无序的数组找一个直接用哈希表""" <|body_0|> def threeSum(self, nums: List[int], target: int) -> List[List[int]]: """三数之和,返回所有可能的不重复的结果""" <|body_1|> def fourSum(self, nums: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NSum: """N-Sum问题系统来一遍 问题分类为找一个和找不重复的所有。""" def twoSum1(self, nums, target) -> List[int]: """无序的数组找一个直接用哈希表""" dic = dict() for num in nums: if num in dic: return [num, dic[num]] dic[target - num] = num return [] def threeSum(sel...
the_stack_v2_python_sparse
Code/leetcode_everyday/0313.py
NiceToMeeetU/ToGetReady
train
0
fa03eb978f72ad075abdc2637a5dca7e5bff5ef8
[ "self.minheap = []\nself.maxheap = []\nself.len_min = self.len_max = 0", "if self.len_max == 0:\n heapq.heappush(self.maxheap, num)\n self.len_max += 1\n return\nif self.len_max == self.len_min:\n if num >= self.maxheap[0]:\n heapq.heappush(self.maxheap, num)\n else:\n heapq.heappush(...
<|body_start_0|> self.minheap = [] self.maxheap = [] self.len_min = self.len_max = 0 <|end_body_0|> <|body_start_1|> if self.len_max == 0: heapq.heappush(self.maxheap, num) self.len_max += 1 return if self.len_max == self.len_min: ...
MedianFinder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MedianFinder: def __init__(self): """initialize your data structure here.""" <|body_0|> def addNum(self, num): """:type num: int :rtype: None""" <|body_1|> def findMedian(self): """:rtype: float""" <|body_2|> <|end_skeleton|> <|body_sta...
stack_v2_sparse_classes_36k_train_004373
1,807
permissive
[ { "docstring": "initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": ":type num: int :rtype: None", "name": "addNum", "signature": "def addNum(self, num)" }, { "docstring": ":rtype: float", "name": "findMedian", "s...
3
stack_v2_sparse_classes_30k_train_020712
Implement the Python class `MedianFinder` described below. Class description: Implement the MedianFinder class. Method signatures and docstrings: - def __init__(self): initialize your data structure here. - def addNum(self, num): :type num: int :rtype: None - def findMedian(self): :rtype: float
Implement the Python class `MedianFinder` described below. Class description: Implement the MedianFinder class. Method signatures and docstrings: - def __init__(self): initialize your data structure here. - def addNum(self, num): :type num: int :rtype: None - def findMedian(self): :rtype: float <|skeleton|> class Me...
c5e7777e6a5b691bb410c25f29ae0f51a6598a12
<|skeleton|> class MedianFinder: def __init__(self): """initialize your data structure here.""" <|body_0|> def addNum(self, num): """:type num: int :rtype: None""" <|body_1|> def findMedian(self): """:rtype: float""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MedianFinder: def __init__(self): """initialize your data structure here.""" self.minheap = [] self.maxheap = [] self.len_min = self.len_max = 0 def addNum(self, num): """:type num: int :rtype: None""" if self.len_max == 0: heapq.heappush(self.m...
the_stack_v2_python_sparse
剑指offer/41-Stream-Median.py
xizhang77/CodingInterview
train
1
1c4e2fd34033973c51d13e82d5ea3f5609ce3716
[ "try:\n return AccountInformation.objects.get(pk=pk)\nexcept AccountInformation.DoesNotExist:\n raise Http404", "account_info = self.get_object(pk)\nserializer = AccountInformationSerializer(account_info)\nreturn Response(serializer.data)", "account_info = self.get_object(pk)\nserializer = AccountInformat...
<|body_start_0|> try: return AccountInformation.objects.get(pk=pk) except AccountInformation.DoesNotExist: raise Http404 <|end_body_0|> <|body_start_1|> account_info = self.get_object(pk) serializer = AccountInformationSerializer(account_info) return Resp...
Retrieve, update or delete a AccountInformation instance.
AccountInformationDetails
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccountInformationDetails: """Retrieve, update or delete a AccountInformation instance.""" def get_object(self, pk): """Get the particular row from the table.""" <|body_0|> def get(self, request, pk, format=None): """We are going to add the account info content a...
stack_v2_sparse_classes_36k_train_004374
15,222
permissive
[ { "docstring": "Get the particular row from the table.", "name": "get_object", "signature": "def get_object(self, pk)" }, { "docstring": "We are going to add the account info content along with this pull request", "name": "get", "signature": "def get(self, request, pk, format=None)" },...
4
stack_v2_sparse_classes_30k_train_012117
Implement the Python class `AccountInformationDetails` described below. Class description: Retrieve, update or delete a AccountInformation instance. Method signatures and docstrings: - def get_object(self, pk): Get the particular row from the table. - def get(self, request, pk, format=None): We are going to add the a...
Implement the Python class `AccountInformationDetails` described below. Class description: Retrieve, update or delete a AccountInformation instance. Method signatures and docstrings: - def get_object(self, pk): Get the particular row from the table. - def get(self, request, pk, format=None): We are going to add the a...
b0635e72338e14dad24f1ee0329212cd60a3e83a
<|skeleton|> class AccountInformationDetails: """Retrieve, update or delete a AccountInformation instance.""" def get_object(self, pk): """Get the particular row from the table.""" <|body_0|> def get(self, request, pk, format=None): """We are going to add the account info content a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AccountInformationDetails: """Retrieve, update or delete a AccountInformation instance.""" def get_object(self, pk): """Get the particular row from the table.""" try: return AccountInformation.objects.get(pk=pk) except AccountInformation.DoesNotExist: raise...
the_stack_v2_python_sparse
environment/views.py
faisaltheparttimecoder/carelogBackend
train
1
b70b7ca56edcd4b3307aafcf50c12b0e0c1de26d
[ "if entry['population'] and entry['population'] != 0:\n return 1000000.0 * entry['weekly_avg_cases'] / entry['population']\nreturn 0", "if entry['population'] and entry['population'] != 0:\n return 1000000.0 * entry['summed_avg_cases'] / entry['population']\nreturn 0" ]
<|body_start_0|> if entry['population'] and entry['population'] != 0: return 1000000.0 * entry['weekly_avg_cases'] / entry['population'] return 0 <|end_body_0|> <|body_start_1|> if entry['population'] and entry['population'] != 0: return 1000000.0 * entry['summed_avg_cas...
Serializer for counterfactual daily normalised cases
CasesCounterfactualDailyNormalisedSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CasesCounterfactualDailyNormalisedSerializer: """Serializer for counterfactual daily normalised cases""" def get_weekly_avg_cases_per_million(self, entry): """Getter for weekly_avg_cases_per_million field""" <|body_0|> def get_summed_avg_cases_per_million(self, entry): ...
stack_v2_sparse_classes_36k_train_004375
2,322
no_license
[ { "docstring": "Getter for weekly_avg_cases_per_million field", "name": "get_weekly_avg_cases_per_million", "signature": "def get_weekly_avg_cases_per_million(self, entry)" }, { "docstring": "Getter for summed_avg_cases_per_million field", "name": "get_summed_avg_cases_per_million", "sig...
2
stack_v2_sparse_classes_30k_train_018081
Implement the Python class `CasesCounterfactualDailyNormalisedSerializer` described below. Class description: Serializer for counterfactual daily normalised cases Method signatures and docstrings: - def get_weekly_avg_cases_per_million(self, entry): Getter for weekly_avg_cases_per_million field - def get_summed_avg_c...
Implement the Python class `CasesCounterfactualDailyNormalisedSerializer` described below. Class description: Serializer for counterfactual daily normalised cases Method signatures and docstrings: - def get_weekly_avg_cases_per_million(self, entry): Getter for weekly_avg_cases_per_million field - def get_summed_avg_c...
af8d6e351a1890403d8d41dca530ddb6ba601dc3
<|skeleton|> class CasesCounterfactualDailyNormalisedSerializer: """Serializer for counterfactual daily normalised cases""" def get_weekly_avg_cases_per_million(self, entry): """Getter for weekly_avg_cases_per_million field""" <|body_0|> def get_summed_avg_cases_per_million(self, entry): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CasesCounterfactualDailyNormalisedSerializer: """Serializer for counterfactual daily normalised cases""" def get_weekly_avg_cases_per_million(self, entry): """Getter for weekly_avg_cases_per_million field""" if entry['population'] and entry['population'] != 0: return 1000000.0...
the_stack_v2_python_sparse
backend/cases/serializers/ephemeral.py
alan-turing-institute/CounterfactualCovid19
train
3
c42e3c3ba0683603dd404141af21a351782a3690
[ "ordered_uuids = [(k, v) for k, v in value.items()]\nordered_uuids.sort(key=lambda x: x[1]['order'])\nreturn '\\r\\n'.join([i[0] for i in ordered_uuids])", "if not len(value) or not isinstance(value, dict):\n return self.field.missing_value\nreturn value" ]
<|body_start_0|> ordered_uuids = [(k, v) for k, v in value.items()] ordered_uuids.sort(key=lambda x: x[1]['order']) return '\r\n'.join([i[0] for i in ordered_uuids]) <|end_body_0|> <|body_start_1|> if not len(value) or not isinstance(value, dict): return self.field.missing_v...
A data converter using the field's ``fromUnicode()`` method.
UUIDSFieldDataConverter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UUIDSFieldDataConverter: """A data converter using the field's ``fromUnicode()`` method.""" def toWidgetValue(self, value): """Converts the internal stored value into something that a z3c.form widget understands :param value: [required] The internally stored value :type value: Dict :...
stack_v2_sparse_classes_36k_train_004376
4,915
no_license
[ { "docstring": "Converts the internal stored value into something that a z3c.form widget understands :param value: [required] The internally stored value :type value: Dict :returns: A string with UUIDs separated by", "name": "toWidgetValue", "signature": "def toWidgetValue(self, value)" }, { "do...
2
stack_v2_sparse_classes_30k_val_000825
Implement the Python class `UUIDSFieldDataConverter` described below. Class description: A data converter using the field's ``fromUnicode()`` method. Method signatures and docstrings: - def toWidgetValue(self, value): Converts the internal stored value into something that a z3c.form widget understands :param value: [...
Implement the Python class `UUIDSFieldDataConverter` described below. Class description: A data converter using the field's ``fromUnicode()`` method. Method signatures and docstrings: - def toWidgetValue(self, value): Converts the internal stored value into something that a z3c.form widget understands :param value: [...
55e273528cd5db4bbd1929a23ef74c3d873ec690
<|skeleton|> class UUIDSFieldDataConverter: """A data converter using the field's ``fromUnicode()`` method.""" def toWidgetValue(self, value): """Converts the internal stored value into something that a z3c.form widget understands :param value: [required] The internally stored value :type value: Dict :...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UUIDSFieldDataConverter: """A data converter using the field's ``fromUnicode()`` method.""" def toWidgetValue(self, value): """Converts the internal stored value into something that a z3c.form widget understands :param value: [required] The internally stored value :type value: Dict :returns: A st...
the_stack_v2_python_sparse
buildout-cache/eggs/collective.cover-1.0a10-py2.7.egg/collective/cover/tiles/carousel.py
Vinsurya/Plone
train
0
600fb6e7f7b30b17903933e01785f6081a15ae99
[ "message = f'{level}: No {resource} has been specified.'\nLog.msg(msg=message, print_msg=True)\nreturn message", "if additional_notes is None:\n notes = ''\nelse:\n notes = additional_notes\nmessage = f\"Support for {resource_name} is now in the '{feature_state}' stage. Please use with caution. {notes}\"\nL...
<|body_start_0|> message = f'{level}: No {resource} has been specified.' Log.msg(msg=message, print_msg=True) return message <|end_body_0|> <|body_start_1|> if additional_notes is None: notes = '' else: notes = additional_notes message = f"Support...
Errors
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Errors: def not_specified(resource=None, level='Warning'): """Throw an error warning the user that a specified resource has not been specified. Args: resource (str): name of resource to use in error message. (default None) level (str): string with desired warning level (default 'Warning'...
stack_v2_sparse_classes_36k_train_004377
2,667
permissive
[ { "docstring": "Throw an error warning the user that a specified resource has not been specified. Args: resource (str): name of resource to use in error message. (default None) level (str): string with desired warning level (default 'Warning')", "name": "not_specified", "signature": "def not_specified(r...
2
stack_v2_sparse_classes_30k_train_020419
Implement the Python class `Errors` described below. Class description: Implement the Errors class. Method signatures and docstrings: - def not_specified(resource=None, level='Warning'): Throw an error warning the user that a specified resource has not been specified. Args: resource (str): name of resource to use in ...
Implement the Python class `Errors` described below. Class description: Implement the Errors class. Method signatures and docstrings: - def not_specified(resource=None, level='Warning'): Throw an error warning the user that a specified resource has not been specified. Args: resource (str): name of resource to use in ...
53a5dc2d1006ada20911f672daf2e3827296a4fd
<|skeleton|> class Errors: def not_specified(resource=None, level='Warning'): """Throw an error warning the user that a specified resource has not been specified. Args: resource (str): name of resource to use in error message. (default None) level (str): string with desired warning level (default 'Warning'...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Errors: def not_specified(resource=None, level='Warning'): """Throw an error warning the user that a specified resource has not been specified. Args: resource (str): name of resource to use in error message. (default None) level (str): string with desired warning level (default 'Warning')""" m...
the_stack_v2_python_sparse
qbitkit/error/error.py
qbitkit/qbitkit
train
5
9082c4db34b78862d8fe310fdc52ab21b705f106
[ "super().__init__(*args, **kwargs)\nif log_level is not None:\n self.log_level = log_level\nelse:\n self.log_level = logging.INFO\nself.log = self.setup_logger()", "formatter = ColoredFormatter('%(log_color)s[%(asctime)s.%(msecs)03d][%(levelname)-8s] %(name)-20s: %(reset)s%(white)s%(message)s', datefmt='%d-...
<|body_start_0|> super().__init__(*args, **kwargs) if log_level is not None: self.log_level = log_level else: self.log_level = logging.INFO self.log = self.setup_logger() <|end_body_0|> <|body_start_1|> formatter = ColoredFormatter('%(log_color)s[%(asctim...
Log class
Logger
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Logger: """Log class""" def __init__(self, *args, log_level=None, **kwargs): """Initialisation method""" <|body_0|> def setup_logger(self): """Return a logger with a default ColoredFormatter.""" <|body_1|> <|end_skeleton|> <|body_start_0|> super...
stack_v2_sparse_classes_36k_train_004378
1,672
permissive
[ { "docstring": "Initialisation method", "name": "__init__", "signature": "def __init__(self, *args, log_level=None, **kwargs)" }, { "docstring": "Return a logger with a default ColoredFormatter.", "name": "setup_logger", "signature": "def setup_logger(self)" } ]
2
null
Implement the Python class `Logger` described below. Class description: Log class Method signatures and docstrings: - def __init__(self, *args, log_level=None, **kwargs): Initialisation method - def setup_logger(self): Return a logger with a default ColoredFormatter.
Implement the Python class `Logger` described below. Class description: Log class Method signatures and docstrings: - def __init__(self, *args, log_level=None, **kwargs): Initialisation method - def setup_logger(self): Return a logger with a default ColoredFormatter. <|skeleton|> class Logger: """Log class""" ...
836498b210d2f921e76292df8046cd79006b458a
<|skeleton|> class Logger: """Log class""" def __init__(self, *args, log_level=None, **kwargs): """Initialisation method""" <|body_0|> def setup_logger(self): """Return a logger with a default ColoredFormatter.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Logger: """Log class""" def __init__(self, *args, log_level=None, **kwargs): """Initialisation method""" super().__init__(*args, **kwargs) if log_level is not None: self.log_level = log_level else: self.log_level = logging.INFO self.log = se...
the_stack_v2_python_sparse
src/pyndf/logbook.py
Guillaume-Guardia/ndf-python
train
0
531bb58ffebad8281adbfe949894424581114e1c
[ "super().__init__(name=name, id=id, classes=classes, disabled=disabled)\nself.data = data\nif summary_function is not None:\n self.summary_function = summary_function", "if not self.data:\n return '<empty sparkline>'\n_, base = self.background_colors\nreturn SparklineRenderable(self.data, width=self.size.wi...
<|body_start_0|> super().__init__(name=name, id=id, classes=classes, disabled=disabled) self.data = data if summary_function is not None: self.summary_function = summary_function <|end_body_0|> <|body_start_1|> if not self.data: return '<empty sparkline>' ...
A sparkline widget to display numerical data.
Sparkline
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Sparkline: """A sparkline widget to display numerical data.""" def __init__(self, data: Sequence[float] | None=None, *, summary_function: Callable[[Sequence[float]], float] | None=None, name: str | None=None, id: str | None=None, classes: str | None=None, disabled: bool=False) -> None: ...
stack_v2_sparse_classes_36k_train_004379
3,229
permissive
[ { "docstring": "Initialize a sparkline widget. Args: data: The initial data to populate the sparkline with. summary_function: Summarises bar values into a single value used to represent each bar. name: The name of the widget. id: The ID of the widget in the DOM. classes: The CSS classes for the widget. disabled...
2
stack_v2_sparse_classes_30k_train_002675
Implement the Python class `Sparkline` described below. Class description: A sparkline widget to display numerical data. Method signatures and docstrings: - def __init__(self, data: Sequence[float] | None=None, *, summary_function: Callable[[Sequence[float]], float] | None=None, name: str | None=None, id: str | None=...
Implement the Python class `Sparkline` described below. Class description: A sparkline widget to display numerical data. Method signatures and docstrings: - def __init__(self, data: Sequence[float] | None=None, *, summary_function: Callable[[Sequence[float]], float] | None=None, name: str | None=None, id: str | None=...
b74ac1e47fdd16133ca567390c99ea19de278c5a
<|skeleton|> class Sparkline: """A sparkline widget to display numerical data.""" def __init__(self, data: Sequence[float] | None=None, *, summary_function: Callable[[Sequence[float]], float] | None=None, name: str | None=None, id: str | None=None, classes: str | None=None, disabled: bool=False) -> None: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Sparkline: """A sparkline widget to display numerical data.""" def __init__(self, data: Sequence[float] | None=None, *, summary_function: Callable[[Sequence[float]], float] | None=None, name: str | None=None, id: str | None=None, classes: str | None=None, disabled: bool=False) -> None: """Initial...
the_stack_v2_python_sparse
src/textual/widgets/_sparkline.py
Textualize/textual
train
14,818
9bddf3dc21aed011de2bf79da434b0ade00c3668
[ "words = re.split('\\\\W+', self.name)\nwords = list(filter(lambda word: len(word) > 3, words))\nreturn ' '.join(words).lower()", "if not self.tags:\n tags = self._create_tags()\n if tags:\n self.tags = self._create_tags()\n'If no set meta-parameters html - title or description then\\n generat...
<|body_start_0|> words = re.split('\\W+', self.name) words = list(filter(lambda word: len(word) > 3, words)) return ' '.join(words).lower() <|end_body_0|> <|body_start_1|> if not self.tags: tags = self._create_tags() if tags: self.tags = self._cre...
Article
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Article: def _create_tags(self): """Create tags from name of article""" <|body_0|> def save(self, *args, **kwargs): """If tags not determinated then generating their""" <|body_1|> <|end_skeleton|> <|body_start_0|> words = re.split('\\W+', self.name)...
stack_v2_sparse_classes_36k_train_004380
5,531
no_license
[ { "docstring": "Create tags from name of article", "name": "_create_tags", "signature": "def _create_tags(self)" }, { "docstring": "If tags not determinated then generating their", "name": "save", "signature": "def save(self, *args, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_010543
Implement the Python class `Article` described below. Class description: Implement the Article class. Method signatures and docstrings: - def _create_tags(self): Create tags from name of article - def save(self, *args, **kwargs): If tags not determinated then generating their
Implement the Python class `Article` described below. Class description: Implement the Article class. Method signatures and docstrings: - def _create_tags(self): Create tags from name of article - def save(self, *args, **kwargs): If tags not determinated then generating their <|skeleton|> class Article: def _cr...
c4bb84cd3f3addf40cc27f0a8ee22fb77eff5456
<|skeleton|> class Article: def _create_tags(self): """Create tags from name of article""" <|body_0|> def save(self, *args, **kwargs): """If tags not determinated then generating their""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Article: def _create_tags(self): """Create tags from name of article""" words = re.split('\\W+', self.name) words = list(filter(lambda word: len(word) > 3, words)) return ' '.join(words).lower() def save(self, *args, **kwargs): """If tags not determinated then gene...
the_stack_v2_python_sparse
src/apps/posts/models.py
artempy/tourism_django
train
3
fcbc4a2489d6549fee91091cbb90edd04ae1cd33
[ "if not isinstance(condition, PassPredicate):\n raise TypeError('Expected PassPredicate, got %s.' % type(condition))\nif not is_sequence(loop_body) and (not isinstance(loop_body, BasePass)):\n raise TypeError('Expected Pass or sequence of Passes, got %s.' % type(loop_body))\nif is_sequence(loop_body):\n tr...
<|body_start_0|> if not isinstance(condition, PassPredicate): raise TypeError('Expected PassPredicate, got %s.' % type(condition)) if not is_sequence(loop_body) and (not isinstance(loop_body, BasePass)): raise TypeError('Expected Pass or sequence of Passes, got %s.' % type(loop_b...
The DoWhileLoopPass class. This is a control pass that executes a pass and then conditionally executes it again in a loop.
DoWhileLoopPass
[ "LicenseRef-scancode-unknown-license-reference", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DoWhileLoopPass: """The DoWhileLoopPass class. This is a control pass that executes a pass and then conditionally executes it again in a loop.""" def __init__(self, condition: PassPredicate, loop_body: BasePass | Sequence[BasePass]) -> None: """Construct a DoWhileLoopPass. Args: cond...
stack_v2_sparse_classes_36k_train_004381
2,452
permissive
[ { "docstring": "Construct a DoWhileLoopPass. Args: condition (PassPredicate): The condition checked. loop_body (BasePass | Sequence[BasePass]): The pass or passes to execute while `condition` is true. Raises: ValueError: If a Sequence[BasePass] is given, but it is empty.", "name": "__init__", "signature...
2
null
Implement the Python class `DoWhileLoopPass` described below. Class description: The DoWhileLoopPass class. This is a control pass that executes a pass and then conditionally executes it again in a loop. Method signatures and docstrings: - def __init__(self, condition: PassPredicate, loop_body: BasePass | Sequence[Ba...
Implement the Python class `DoWhileLoopPass` described below. Class description: The DoWhileLoopPass class. This is a control pass that executes a pass and then conditionally executes it again in a loop. Method signatures and docstrings: - def __init__(self, condition: PassPredicate, loop_body: BasePass | Sequence[Ba...
3083218c2f4e3c3ce4ba027d12caa30c384d7665
<|skeleton|> class DoWhileLoopPass: """The DoWhileLoopPass class. This is a control pass that executes a pass and then conditionally executes it again in a loop.""" def __init__(self, condition: PassPredicate, loop_body: BasePass | Sequence[BasePass]) -> None: """Construct a DoWhileLoopPass. Args: cond...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DoWhileLoopPass: """The DoWhileLoopPass class. This is a control pass that executes a pass and then conditionally executes it again in a loop.""" def __init__(self, condition: PassPredicate, loop_body: BasePass | Sequence[BasePass]) -> None: """Construct a DoWhileLoopPass. Args: condition (PassPr...
the_stack_v2_python_sparse
bqskit/compiler/passes/control/dowhileloop.py
mtreinish/bqskit
train
0
c90787940a19bfc132b6bbaa5e64204c2b4a20a2
[ "env = {}\nif node_env is not None:\n env = node_env\nlegacy_dirpath = ccmlib.repository.directory_name(legacy_version)\nenv['CASSANDRA_HOME'] = legacy_dirpath\nbinpaths = [legacy_dirpath, os.path.join(legacy_dirpath, 'build', 'classes', 'main'), os.path.join(legacy_dirpath, 'build', 'classes', 'thrift')]\nenv['...
<|body_start_0|> env = {} if node_env is not None: env = node_env legacy_dirpath = ccmlib.repository.directory_name(legacy_version) env['CASSANDRA_HOME'] = legacy_dirpath binpaths = [legacy_dirpath, os.path.join(legacy_dirpath, 'build', 'classes', 'main'), os.path.joi...
* @jira_ticket CASSANDRA-13121 * Test if legacy JMX detects failures in repair jobs launched with the deprecated API. * Affects cassandra-3.x clusters when users run JMX from cassandra-2.1 and older to submit repair jobs.
TestDeprecatedRepairNotifications
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestDeprecatedRepairNotifications: """* @jira_ticket CASSANDRA-13121 * Test if legacy JMX detects failures in repair jobs launched with the deprecated API. * Affects cassandra-3.x clusters when users run JMX from cassandra-2.1 and older to submit repair jobs.""" def get_legacy_environment(se...
stack_v2_sparse_classes_36k_train_004382
14,147
permissive
[ { "docstring": "* Set up an environment to run nodetool from cassandra-2.1.", "name": "get_legacy_environment", "signature": "def get_legacy_environment(self, legacy_version, node_env=None)" }, { "docstring": "* Check whether a legacy JMX nodetool understands the * notification for a failed repa...
2
stack_v2_sparse_classes_30k_train_021454
Implement the Python class `TestDeprecatedRepairNotifications` described below. Class description: * @jira_ticket CASSANDRA-13121 * Test if legacy JMX detects failures in repair jobs launched with the deprecated API. * Affects cassandra-3.x clusters when users run JMX from cassandra-2.1 and older to submit repair jobs...
Implement the Python class `TestDeprecatedRepairNotifications` described below. Class description: * @jira_ticket CASSANDRA-13121 * Test if legacy JMX detects failures in repair jobs launched with the deprecated API. * Affects cassandra-3.x clusters when users run JMX from cassandra-2.1 and older to submit repair jobs...
738d5de93def153338003a26e304a77463a7fd2a
<|skeleton|> class TestDeprecatedRepairNotifications: """* @jira_ticket CASSANDRA-13121 * Test if legacy JMX detects failures in repair jobs launched with the deprecated API. * Affects cassandra-3.x clusters when users run JMX from cassandra-2.1 and older to submit repair jobs.""" def get_legacy_environment(se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestDeprecatedRepairNotifications: """* @jira_ticket CASSANDRA-13121 * Test if legacy JMX detects failures in repair jobs launched with the deprecated API. * Affects cassandra-3.x clusters when users run JMX from cassandra-2.1 and older to submit repair jobs.""" def get_legacy_environment(self, legacy_ve...
the_stack_v2_python_sparse
repair_tests/deprecated_repair_test.py
apache/cassandra-dtest
train
52
46fd1e9eb7847f29b8e19ff7989d01e36dcb535a
[ "patient = Patient.objects.get_patient_by_id(domain_id, patient_id)\nif patient is not None:\n serializer = self.get_serializer(patient)\n patient_data = serializer.data\n return Response(patient_data, status=status.HTTP_200_OK)", "data = request.data\ndata['cohort'] = domain_id\ndata['updated_by'] = req...
<|body_start_0|> patient = Patient.objects.get_patient_by_id(domain_id, patient_id) if patient is not None: serializer = self.get_serializer(patient) patient_data = serializer.data return Response(patient_data, status=status.HTTP_200_OK) <|end_body_0|> <|body_start_1...
CohortPatientsDetailView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CohortPatientsDetailView: def get(self, request, domain_id, patient_id): """Get information about a patient in the domain""" <|body_0|> def put(self, request, domain_id, patient_id): """Update a patient in a domain""" <|body_1|> def delete(self, request,...
stack_v2_sparse_classes_36k_train_004383
3,780
no_license
[ { "docstring": "Get information about a patient in the domain", "name": "get", "signature": "def get(self, request, domain_id, patient_id)" }, { "docstring": "Update a patient in a domain", "name": "put", "signature": "def put(self, request, domain_id, patient_id)" }, { "docstrin...
3
stack_v2_sparse_classes_30k_train_021039
Implement the Python class `CohortPatientsDetailView` described below. Class description: Implement the CohortPatientsDetailView class. Method signatures and docstrings: - def get(self, request, domain_id, patient_id): Get information about a patient in the domain - def put(self, request, domain_id, patient_id): Upda...
Implement the Python class `CohortPatientsDetailView` described below. Class description: Implement the CohortPatientsDetailView class. Method signatures and docstrings: - def get(self, request, domain_id, patient_id): Get information about a patient in the domain - def put(self, request, domain_id, patient_id): Upda...
5d5bc4c1eecbf627d38260e4d314d8451d67a4f5
<|skeleton|> class CohortPatientsDetailView: def get(self, request, domain_id, patient_id): """Get information about a patient in the domain""" <|body_0|> def put(self, request, domain_id, patient_id): """Update a patient in a domain""" <|body_1|> def delete(self, request,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CohortPatientsDetailView: def get(self, request, domain_id, patient_id): """Get information about a patient in the domain""" patient = Patient.objects.get_patient_by_id(domain_id, patient_id) if patient is not None: serializer = self.get_serializer(patient) pati...
the_stack_v2_python_sparse
curation-api/src/patients/views/cohort_patient.py
mohanj1919/django_app_test
train
0
1f2d00683ef59323cd6789f61f922229dabd7576
[ "if isinstance(request.auth, ProjectKey):\n return self.respond(status=401)\nif organization_slug:\n if project.organization.slug != organization_slug:\n return self.respond_invalid()\nqueryset = MonitorCheckIn.objects.filter(monitor_id=monitor.id)\nreturn self.paginate(request=request, queryset=querys...
<|body_start_0|> if isinstance(request.auth, ProjectKey): return self.respond(status=401) if organization_slug: if project.organization.slug != organization_slug: return self.respond_invalid() queryset = MonitorCheckIn.objects.filter(monitor_id=monitor.id)...
MonitorCheckInsEndpoint
[ "Apache-2.0", "BUSL-1.1" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MonitorCheckInsEndpoint: def get(self, request: Request, project, monitor, organization_slug: str | None=None) -> Response: """Retrieve a list of check-ins for a monitor""" <|body_0|> def post(self, request: Request, project, monitor, organization_slug: str | None=None) -> R...
stack_v2_sparse_classes_36k_train_004384
6,229
permissive
[ { "docstring": "Retrieve a list of check-ins for a monitor", "name": "get", "signature": "def get(self, request: Request, project, monitor, organization_slug: str | None=None) -> Response" }, { "docstring": "Creates a new check-in for a monitor. If `status` is not present, it will be assumed tha...
2
stack_v2_sparse_classes_30k_train_010757
Implement the Python class `MonitorCheckInsEndpoint` described below. Class description: Implement the MonitorCheckInsEndpoint class. Method signatures and docstrings: - def get(self, request: Request, project, monitor, organization_slug: str | None=None) -> Response: Retrieve a list of check-ins for a monitor - def ...
Implement the Python class `MonitorCheckInsEndpoint` described below. Class description: Implement the MonitorCheckInsEndpoint class. Method signatures and docstrings: - def get(self, request: Request, project, monitor, organization_slug: str | None=None) -> Response: Retrieve a list of check-ins for a monitor - def ...
d9dd4f382f96b5c4576b64cbf015db651556c18b
<|skeleton|> class MonitorCheckInsEndpoint: def get(self, request: Request, project, monitor, organization_slug: str | None=None) -> Response: """Retrieve a list of check-ins for a monitor""" <|body_0|> def post(self, request: Request, project, monitor, organization_slug: str | None=None) -> R...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MonitorCheckInsEndpoint: def get(self, request: Request, project, monitor, organization_slug: str | None=None) -> Response: """Retrieve a list of check-ins for a monitor""" if isinstance(request.auth, ProjectKey): return self.respond(status=401) if organization_slug: ...
the_stack_v2_python_sparse
src/sentry/api/endpoints/monitor_checkins.py
nagyist/sentry
train
0
f36f2395d5a4882c06dd2891e7c7d5faf9df7e8d
[ "res = []\ni, j = (1, n)\nwhile i <= j:\n if k > 1:\n if k & 1:\n res.append(i)\n i += 1\n else:\n res.append(j)\n j -= 1\n k -= 1\n else:\n res.append(i)\n i += 1\nreturn res", "i, j = (1, n)\nres = []\nflag = 1\nfor _ in range(...
<|body_start_0|> res = [] i, j = (1, n) while i <= j: if k > 1: if k & 1: res.append(i) i += 1 else: res.append(j) j -= 1 k -= 1 else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def constructArray(self, n, k): """:type n: int :type k: int :rtype: List[int]""" <|body_0|> def constructArray_WRONG(self, n, k): """:type n: int :type k: int :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> res = [] ...
stack_v2_sparse_classes_36k_train_004385
2,757
no_license
[ { "docstring": ":type n: int :type k: int :rtype: List[int]", "name": "constructArray", "signature": "def constructArray(self, n, k)" }, { "docstring": ":type n: int :type k: int :rtype: List[int]", "name": "constructArray_WRONG", "signature": "def constructArray_WRONG(self, n, k)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def constructArray(self, n, k): :type n: int :type k: int :rtype: List[int] - def constructArray_WRONG(self, n, k): :type n: int :type k: int :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def constructArray(self, n, k): :type n: int :type k: int :rtype: List[int] - def constructArray_WRONG(self, n, k): :type n: int :type k: int :rtype: List[int] <|skeleton|> clas...
635af6e22aa8eef8e7920a585d43a45a891a8157
<|skeleton|> class Solution: def constructArray(self, n, k): """:type n: int :type k: int :rtype: List[int]""" <|body_0|> def constructArray_WRONG(self, n, k): """:type n: int :type k: int :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def constructArray(self, n, k): """:type n: int :type k: int :rtype: List[int]""" res = [] i, j = (1, n) while i <= j: if k > 1: if k & 1: res.append(i) i += 1 else: ...
the_stack_v2_python_sparse
code667BeautifulArrangementII.py
cybelewang/leetcode-python
train
0
736a9fde6c084d8c7280cdfff2befa90245772da
[ "self.privilege_id = privilege_id\nself.additional_categories = additional_categories\nself.category = category\nself.description = description\nself.is_available_on_helios = is_available_on_helios\nself.is_custom_role_default = is_custom_role_default\nself.is_saa_s_only = is_saa_s_only\nself.is_special = is_specia...
<|body_start_0|> self.privilege_id = privilege_id self.additional_categories = additional_categories self.category = category self.description = description self.is_available_on_helios = is_available_on_helios self.is_custom_role_default = is_custom_role_default s...
Implementation of the 'PrivilegeInfo' model. Specifies details about a privilege such as the category, description, name, etc. Attributes: privilege_id (PrivilegeIdEnum): Specifies unique id for a privilege. This number must be unique when creating a new privilege. Type for unique privilege Id values. All below enum va...
PrivilegeInfo
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrivilegeInfo: """Implementation of the 'PrivilegeInfo' model. Specifies details about a privilege such as the category, description, name, etc. Attributes: privilege_id (PrivilegeIdEnum): Specifies unique id for a privilege. This number must be unique when creating a new privilege. Type for uniq...
stack_v2_sparse_classes_36k_train_004386
5,145
permissive
[ { "docstring": "Constructor for the PrivilegeInfo class", "name": "__init__", "signature": "def __init__(self, privilege_id=None, additional_categories=None, category=None, description=None, is_available_on_helios=None, is_custom_role_default=None, is_saa_s_only=None, is_special=None, is_view_only=None,...
2
stack_v2_sparse_classes_30k_test_001156
Implement the Python class `PrivilegeInfo` described below. Class description: Implementation of the 'PrivilegeInfo' model. Specifies details about a privilege such as the category, description, name, etc. Attributes: privilege_id (PrivilegeIdEnum): Specifies unique id for a privilege. This number must be unique when ...
Implement the Python class `PrivilegeInfo` described below. Class description: Implementation of the 'PrivilegeInfo' model. Specifies details about a privilege such as the category, description, name, etc. Attributes: privilege_id (PrivilegeIdEnum): Specifies unique id for a privilege. This number must be unique when ...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class PrivilegeInfo: """Implementation of the 'PrivilegeInfo' model. Specifies details about a privilege such as the category, description, name, etc. Attributes: privilege_id (PrivilegeIdEnum): Specifies unique id for a privilege. This number must be unique when creating a new privilege. Type for uniq...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PrivilegeInfo: """Implementation of the 'PrivilegeInfo' model. Specifies details about a privilege such as the category, description, name, etc. Attributes: privilege_id (PrivilegeIdEnum): Specifies unique id for a privilege. This number must be unique when creating a new privilege. Type for unique privilege ...
the_stack_v2_python_sparse
cohesity_management_sdk/models/privilege_info.py
cohesity/management-sdk-python
train
24
21790df1a4bc34589c2f8b438ac17a548ce5ff2b
[ "node = TestNode(names=[('logging', None)], lineno=15)\nself.checker.visit_import(node)\nself.assertEqual(self.results, [('R9301', '', 15, None)])", "node = TestNode(names=[('myModule', None)], lineno=15)\nself.checker.visit_import(node)\nself.assertEqual(self.results, [])" ]
<|body_start_0|> node = TestNode(names=[('logging', None)], lineno=15) self.checker.visit_import(node) self.assertEqual(self.results, [('R9301', '', 15, None)]) <|end_body_0|> <|body_start_1|> node = TestNode(names=[('myModule', None)], lineno=15) self.checker.visit_import(node)...
Tests for ChromiteLoggingChecker module
ChromiteLoggingCheckerTest
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference", "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChromiteLoggingCheckerTest: """Tests for ChromiteLoggingChecker module""" def testLoggingImported(self): """Test that import logging is flagged.""" <|body_0|> def testLoggingNotImported(self): """Test that importing something else (not logging) is not flagged."""...
stack_v2_sparse_classes_36k_train_004387
11,497
permissive
[ { "docstring": "Test that import logging is flagged.", "name": "testLoggingImported", "signature": "def testLoggingImported(self)" }, { "docstring": "Test that importing something else (not logging) is not flagged.", "name": "testLoggingNotImported", "signature": "def testLoggingNotImpor...
2
null
Implement the Python class `ChromiteLoggingCheckerTest` described below. Class description: Tests for ChromiteLoggingChecker module Method signatures and docstrings: - def testLoggingImported(self): Test that import logging is flagged. - def testLoggingNotImported(self): Test that importing something else (not loggin...
Implement the Python class `ChromiteLoggingCheckerTest` described below. Class description: Tests for ChromiteLoggingChecker module Method signatures and docstrings: - def testLoggingImported(self): Test that import logging is flagged. - def testLoggingNotImported(self): Test that importing something else (not loggin...
72a05af97787001756bae2511b7985e61498c965
<|skeleton|> class ChromiteLoggingCheckerTest: """Tests for ChromiteLoggingChecker module""" def testLoggingImported(self): """Test that import logging is flagged.""" <|body_0|> def testLoggingNotImported(self): """Test that importing something else (not logging) is not flagged."""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ChromiteLoggingCheckerTest: """Tests for ChromiteLoggingChecker module""" def testLoggingImported(self): """Test that import logging is flagged.""" node = TestNode(names=[('logging', None)], lineno=15) self.checker.visit_import(node) self.assertEqual(self.results, [('R9301...
the_stack_v2_python_sparse
third_party/chromite/cli/cros/lint_unittest.py
metux/chromium-suckless
train
5
150889e01da1f226bdc2e47e8d0f9ffe126531c4
[ "this_object = self.model_object\nif hasattr(this_object, self.group_required_field):\n if hasattr(getattr(this_object, self.group_required_field), 'name'):\n return [getattr(this_object, self.group_required_field).name]\nreturn ['']", "if not groups or groups == ['']:\n return True\nif self.request....
<|body_start_0|> this_object = self.model_object if hasattr(this_object, self.group_required_field): if hasattr(getattr(this_object, self.group_required_field), 'name'): return [getattr(this_object, self.group_required_field).name] return [''] <|end_body_0|> <|body_s...
This subclass of the GroupRequiredMixin checks if a specified model field identifies a group that is required. If so, then require this group. If not, then no permissions are required. This can be used for thing like survey responses that are optionally restricted.
GroupRequiredByFieldMixin
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GroupRequiredByFieldMixin: """This subclass of the GroupRequiredMixin checks if a specified model field identifies a group that is required. If so, then require this group. If not, then no permissions are required. This can be used for thing like survey responses that are optionally restricted.""...
stack_v2_sparse_classes_36k_train_004388
30,664
permissive
[ { "docstring": "Get the group_required value from the object", "name": "get_group_required", "signature": "def get_group_required(self)" }, { "docstring": "Allows for objects with no required groups", "name": "check_membership", "signature": "def check_membership(self, groups)" }, { ...
3
null
Implement the Python class `GroupRequiredByFieldMixin` described below. Class description: This subclass of the GroupRequiredMixin checks if a specified model field identifies a group that is required. If so, then require this group. If not, then no permissions are required. This can be used for thing like survey resp...
Implement the Python class `GroupRequiredByFieldMixin` described below. Class description: This subclass of the GroupRequiredMixin checks if a specified model field identifies a group that is required. If so, then require this group. If not, then no permissions are required. This can be used for thing like survey resp...
19db3e83e76ea2002ee841989410d12d1e601023
<|skeleton|> class GroupRequiredByFieldMixin: """This subclass of the GroupRequiredMixin checks if a specified model field identifies a group that is required. If so, then require this group. If not, then no permissions are required. This can be used for thing like survey responses that are optionally restricted.""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GroupRequiredByFieldMixin: """This subclass of the GroupRequiredMixin checks if a specified model field identifies a group that is required. If so, then require this group. If not, then no permissions are required. This can be used for thing like survey responses that are optionally restricted.""" def ge...
the_stack_v2_python_sparse
danceschool/core/mixins.py
django-danceschool/django-danceschool
train
40
e3cdd6449c6652fe070a5e258973c4cf68ef85e5
[ "testcases: List[TestCase] = TestCase.query.all()\nres = [{'id': testcase.id, 'name': testcase.name, 'description': testcase.description, 'steps': json.loads(testcase.steps)} for testcase in testcases]\nreturn {'body': res}", "testcase = TestCase(name=request.json.get('name'), description=request.json.get('descri...
<|body_start_0|> testcases: List[TestCase] = TestCase.query.all() res = [{'id': testcase.id, 'name': testcase.name, 'description': testcase.description, 'steps': json.loads(testcase.steps)} for testcase in testcases] return {'body': res} <|end_body_0|> <|body_start_1|> testcase = TestCa...
TestCaseService
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCaseService: def get(self): """测试用例的浏览获取 /testcase.json /testcase.json?id=1""" <|body_0|> def post(self): """上传用例, 更新用例 /testcase.json {'name': 'xx', 'description': 'xxx', 'steps': []}""" <|body_1|> <|end_skeleton|> <|body_start_0|> testcases: L...
stack_v2_sparse_classes_36k_train_004389
4,613
no_license
[ { "docstring": "测试用例的浏览获取 /testcase.json /testcase.json?id=1", "name": "get", "signature": "def get(self)" }, { "docstring": "上传用例, 更新用例 /testcase.json {'name': 'xx', 'description': 'xxx', 'steps': []}", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_004972
Implement the Python class `TestCaseService` described below. Class description: Implement the TestCaseService class. Method signatures and docstrings: - def get(self): 测试用例的浏览获取 /testcase.json /testcase.json?id=1 - def post(self): 上传用例, 更新用例 /testcase.json {'name': 'xx', 'description': 'xxx', 'steps': []}
Implement the Python class `TestCaseService` described below. Class description: Implement the TestCaseService class. Method signatures and docstrings: - def get(self): 测试用例的浏览获取 /testcase.json /testcase.json?id=1 - def post(self): 上传用例, 更新用例 /testcase.json {'name': 'xx', 'description': 'xxx', 'steps': []} <|skeleto...
bd8bce8160c458bf49970dbf94dadb3c822fdd53
<|skeleton|> class TestCaseService: def get(self): """测试用例的浏览获取 /testcase.json /testcase.json?id=1""" <|body_0|> def post(self): """上传用例, 更新用例 /testcase.json {'name': 'xx', 'description': 'xxx', 'steps': []}""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestCaseService: def get(self): """测试用例的浏览获取 /testcase.json /testcase.json?id=1""" testcases: List[TestCase] = TestCase.query.all() res = [{'id': testcase.id, 'name': testcase.name, 'description': testcase.description, 'steps': json.loads(testcase.steps)} for testcase in testcases] ...
the_stack_v2_python_sparse
platform/src/backend.py
baihongliang/HogwartsLG4
train
0
4f63c3fac3e53319b2fe3e8ca84e76be02d7d6bd
[ "self.perms = perms\nself.event_param = event_param\nself.require_all = require_all", "def wrapped_f(*args, **kwargs):\n from ezreg.models import Event\n event = Event.objects.get(id=kwargs[self.event_param])\n kwargs[self.event_param] = event\n request = args[0]\n if not request.user.is_authentica...
<|body_start_0|> self.perms = perms self.event_param = event_param self.require_all = require_all <|end_body_0|> <|body_start_1|> def wrapped_f(*args, **kwargs): from ezreg.models import Event event = Event.objects.get(id=kwargs[self.event_param]) kwa...
event_access_decorator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class event_access_decorator: def __init__(self, perms, event_param='event', require_all=True): """If there are decorator arguments, the function to be decorated is not passed to the constructor!""" <|body_0|> def __call__(self, f): """If there are decorator arguments, __c...
stack_v2_sparse_classes_36k_train_004390
5,101
no_license
[ { "docstring": "If there are decorator arguments, the function to be decorated is not passed to the constructor!", "name": "__init__", "signature": "def __init__(self, perms, event_param='event', require_all=True)" }, { "docstring": "If there are decorator arguments, __call__() is only called on...
2
stack_v2_sparse_classes_30k_train_001415
Implement the Python class `event_access_decorator` described below. Class description: Implement the event_access_decorator class. Method signatures and docstrings: - def __init__(self, perms, event_param='event', require_all=True): If there are decorator arguments, the function to be decorated is not passed to the ...
Implement the Python class `event_access_decorator` described below. Class description: Implement the event_access_decorator class. Method signatures and docstrings: - def __init__(self, perms, event_param='event', require_all=True): If there are decorator arguments, the function to be decorated is not passed to the ...
3862986f908e3d2dd4c4b9a485cd9ebfdcafcd1b
<|skeleton|> class event_access_decorator: def __init__(self, perms, event_param='event', require_all=True): """If there are decorator arguments, the function to be decorated is not passed to the constructor!""" <|body_0|> def __call__(self, f): """If there are decorator arguments, __c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class event_access_decorator: def __init__(self, perms, event_param='event', require_all=True): """If there are decorator arguments, the function to be decorated is not passed to the constructor!""" self.perms = perms self.event_param = event_param self.require_all = require_all ...
the_stack_v2_python_sparse
ezreg/decorators.py
amschaal/django-ezreg
train
5
90440a115a89573161e2cb6b70aaed035a785c0c
[ "if not self.ssh_accessible:\n logger.info('You do not have SSH access to the Archivematica server')\n return None\nfilename = os.path.basename(server_file_path)\nlocal_path = os.path.join(self.tmp_path, filename)\nif self.server_user and self.ssh_identity_file:\n cmd = 'scp -o StrictHostKeyChecking=no -i ...
<|body_start_0|> if not self.ssh_accessible: logger.info('You do not have SSH access to the Archivematica server') return None filename = os.path.basename(server_file_path) local_path = os.path.join(self.tmp_path, filename) if self.server_user and self.ssh_identit...
Archivematica SSH Ability: the ability of an Archivematica user to use SSH and scp to interact with Archivematica.
ArchivematicaSSHAbility
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArchivematicaSSHAbility: """Archivematica SSH Ability: the ability of an Archivematica user to use SSH and scp to interact with Archivematica.""" def scp_server_file_to_local(self, server_file_path, retries=5): """Use scp to copy a file from the server to our local tmp directory.""" ...
stack_v2_sparse_classes_36k_train_004391
7,018
no_license
[ { "docstring": "Use scp to copy a file from the server to our local tmp directory.", "name": "scp_server_file_to_local", "signature": "def scp_server_file_to_local(self, server_file_path, retries=5)" }, { "docstring": "Use scp to copy a directory from the server to our local tmp directory.", ...
3
stack_v2_sparse_classes_30k_train_009103
Implement the Python class `ArchivematicaSSHAbility` described below. Class description: Archivematica SSH Ability: the ability of an Archivematica user to use SSH and scp to interact with Archivematica. Method signatures and docstrings: - def scp_server_file_to_local(self, server_file_path, retries=5): Use scp to co...
Implement the Python class `ArchivematicaSSHAbility` described below. Class description: Archivematica SSH Ability: the ability of an Archivematica user to use SSH and scp to interact with Archivematica. Method signatures and docstrings: - def scp_server_file_to_local(self, server_file_path, retries=5): Use scp to co...
96fe940a9e18f97aae5868fe4c7c6d0b389814d0
<|skeleton|> class ArchivematicaSSHAbility: """Archivematica SSH Ability: the ability of an Archivematica user to use SSH and scp to interact with Archivematica.""" def scp_server_file_to_local(self, server_file_path, retries=5): """Use scp to copy a file from the server to our local tmp directory.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ArchivematicaSSHAbility: """Archivematica SSH Ability: the ability of an Archivematica user to use SSH and scp to interact with Archivematica.""" def scp_server_file_to_local(self, server_file_path, retries=5): """Use scp to copy a file from the server to our local tmp directory.""" if no...
the_stack_v2_python_sparse
amuser/am_ssh_ability.py
artefactual-labs/archivematica-acceptance-tests
train
3
2c9bf243b9a9bc8da42d91357547c36be57ce25b
[ "db_name = 'Brain'\ndb_table = 'Targets'\nquery_plugin_names = rtdb.db(db_name).table(db_table).pluck('PluginName', 'Location').run(connect())\nfor plugin_item in query_plugin_names:\n assert isinstance(plugin_item, dict)", "home_url = '/'\nif check_dev_env() is not None:\n request = rf.get(home_url)\n r...
<|body_start_0|> db_name = 'Brain' db_table = 'Targets' query_plugin_names = rtdb.db(db_name).table(db_table).pluck('PluginName', 'Location').run(connect()) for plugin_item in query_plugin_names: assert isinstance(plugin_item, dict) <|end_body_0|> <|body_start_1|> ho...
TestIndex
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestIndex: def test_target_list(self): """This test queries all the targets in Brain.Targets to be displayed in W1.""" <|body_0|> def test_home_page(self, rf): """This test checks if the web server displays the home page. :param rf: RequestFactory""" <|body_1...
stack_v2_sparse_classes_36k_train_004392
966
permissive
[ { "docstring": "This test queries all the targets in Brain.Targets to be displayed in W1.", "name": "test_target_list", "signature": "def test_target_list(self)" }, { "docstring": "This test checks if the web server displays the home page. :param rf: RequestFactory", "name": "test_home_page"...
2
stack_v2_sparse_classes_30k_train_001114
Implement the Python class `TestIndex` described below. Class description: Implement the TestIndex class. Method signatures and docstrings: - def test_target_list(self): This test queries all the targets in Brain.Targets to be displayed in W1. - def test_home_page(self, rf): This test checks if the web server display...
Implement the Python class `TestIndex` described below. Class description: Implement the TestIndex class. Method signatures and docstrings: - def test_target_list(self): This test queries all the targets in Brain.Targets to be displayed in W1. - def test_home_page(self, rf): This test checks if the web server display...
f9cb9d358777f8cdf396264cc9cd759ce010472b
<|skeleton|> class TestIndex: def test_target_list(self): """This test queries all the targets in Brain.Targets to be displayed in W1.""" <|body_0|> def test_home_page(self, rf): """This test checks if the web server displays the home page. :param rf: RequestFactory""" <|body_1...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestIndex: def test_target_list(self): """This test queries all the targets in Brain.Targets to be displayed in W1.""" db_name = 'Brain' db_table = 'Targets' query_plugin_names = rtdb.db(db_name).table(db_table).pluck('PluginName', 'Location').run(connect()) for plugin_...
the_stack_v2_python_sparse
pcp_alpha/Backend/index_app/tests.py
ramrod-project/frontend-ui
train
0
35f62cef9101337ed9ba64411ad848447a7b3c3e
[ "self.field_config = field_config\nself.tokenizer = None\nself.token_embedding = None\nif field_config.vocab_path and field_config.need_convert:\n self.tokenizer = CustomTokenizer(vocab_file=self.field_config.vocab_path)", "src_ids = []\nfor text in batch_text:\n src_id = text.split(' ')\n if self.tokeni...
<|body_start_0|> self.field_config = field_config self.tokenizer = None self.token_embedding = None if field_config.vocab_path and field_config.need_convert: self.tokenizer = CustomTokenizer(vocab_file=self.field_config.vocab_path) <|end_body_0|> <|body_start_1|> src...
return shape= [batch_size,1]
ScalarFieldReader
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScalarFieldReader: """return shape= [batch_size,1]""" def __init__(self, field_config): """:param field_config:""" <|body_0|> def convert_texts_to_ids(self, batch_text): """:param batch_text: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_004393
2,055
permissive
[ { "docstring": ":param field_config:", "name": "__init__", "signature": "def __init__(self, field_config)" }, { "docstring": ":param batch_text: :return:", "name": "convert_texts_to_ids", "signature": "def convert_texts_to_ids(self, batch_text)" } ]
2
stack_v2_sparse_classes_30k_train_013169
Implement the Python class `ScalarFieldReader` described below. Class description: return shape= [batch_size,1] Method signatures and docstrings: - def __init__(self, field_config): :param field_config: - def convert_texts_to_ids(self, batch_text): :param batch_text: :return:
Implement the Python class `ScalarFieldReader` described below. Class description: return shape= [batch_size,1] Method signatures and docstrings: - def __init__(self, field_config): :param field_config: - def convert_texts_to_ids(self, batch_text): :param batch_text: :return: <|skeleton|> class ScalarFieldReader: ...
eab643f51336dbf7d711f02d27e6516e5affee59
<|skeleton|> class ScalarFieldReader: """return shape= [batch_size,1]""" def __init__(self, field_config): """:param field_config:""" <|body_0|> def convert_texts_to_ids(self, batch_text): """:param batch_text: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ScalarFieldReader: """return shape= [batch_size,1]""" def __init__(self, field_config): """:param field_config:""" self.field_config = field_config self.tokenizer = None self.token_embedding = None if field_config.vocab_path and field_config.need_convert: ...
the_stack_v2_python_sparse
research/nlp/senta/src/data/field_reader/scalar_field_reader.py
mindspore-ai/models
train
301
08a8d852fa8879dd900fabc2b1046c391d078784
[ "capture_output = []\nif interface is None:\n raise Exception('Please provide the interface used.')\nelse:\n capture = pyshark.LiveCapture(interface=interface, bpf_filter=bpf_filter, tshark_path=tshark_path, output_file=output_file)\n capture.sniff(timeout=timeout)\n length = len(capture)\n return (c...
<|body_start_0|> capture_output = [] if interface is None: raise Exception('Please provide the interface used.') else: capture = pyshark.LiveCapture(interface=interface, bpf_filter=bpf_filter, tshark_path=tshark_path, output_file=output_file) capture.sniff(tim...
Provides utility for the monitoring of network traffic, measuring the packets sent through specific filters as passed by user.
NetworkMonitor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NetworkMonitor: """Provides utility for the monitoring of network traffic, measuring the packets sent through specific filters as passed by user.""" def get_packets(timeout=50, interface=None, bpf_filter=None, display_filter='tcp.port == 80', tshark_path=None, output_file=None): """R...
stack_v2_sparse_classes_36k_train_004394
3,625
permissive
[ { "docstring": "Returns the captured packets of the transmitted data using Wireshark. Args: timeout: An integer. Set for sniffing with tshark. Default to 50 seconds in this setup. interface: A string. Name of the interface to sniff on. bpf_filter: A string. The capture filter in bpf syntax 'tcp port 80'. Needs ...
2
null
Implement the Python class `NetworkMonitor` described below. Class description: Provides utility for the monitoring of network traffic, measuring the packets sent through specific filters as passed by user. Method signatures and docstrings: - def get_packets(timeout=50, interface=None, bpf_filter=None, display_filter...
Implement the Python class `NetworkMonitor` described below. Class description: Provides utility for the monitoring of network traffic, measuring the packets sent through specific filters as passed by user. Method signatures and docstrings: - def get_packets(timeout=50, interface=None, bpf_filter=None, display_filter...
cc4765bed880ad38a02505834f63df39e0815328
<|skeleton|> class NetworkMonitor: """Provides utility for the monitoring of network traffic, measuring the packets sent through specific filters as passed by user.""" def get_packets(timeout=50, interface=None, bpf_filter=None, display_filter='tcp.port == 80', tshark_path=None, output_file=None): """R...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NetworkMonitor: """Provides utility for the monitoring of network traffic, measuring the packets sent through specific filters as passed by user.""" def get_packets(timeout=50, interface=None, bpf_filter=None, display_filter='tcp.port == 80', tshark_path=None, output_file=None): """Returns the ca...
the_stack_v2_python_sparse
syft/generic/metrics.py
tudorcebere/PySyft
train
2
655c2580b2659820a0b3813b92e4706bbc4fad80
[ "try:\n event.data = _event_mappings[event_type].deserialize(event.data)\nexcept KeyError:\n event.data = None", "if isinstance(event, six.binary_type):\n event = json.loads(event.decode(encode))\nelif isinstance(event, six.string_types):\n event = json.loads(event)\nreturn event" ]
<|body_start_0|> try: event.data = _event_mappings[event_type].deserialize(event.data) except KeyError: event.data = None <|end_body_0|> <|body_start_1|> if isinstance(event, six.binary_type): event = json.loads(event.decode(encode)) elif isinstance(e...
Mixin for the event models comprising of some helper methods.
EventMixin
[ "LicenseRef-scancode-generic-cla", "LGPL-2.1-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EventMixin: """Mixin for the event models comprising of some helper methods.""" def _deserialize_data(event, event_type): """Sets the data of the desrialized event to strongly typed event object if event type exists in _event_mappings. Otherwise, sets it to None. :param str event_typ...
stack_v2_sparse_classes_36k_train_004395
7,532
permissive
[ { "docstring": "Sets the data of the desrialized event to strongly typed event object if event type exists in _event_mappings. Otherwise, sets it to None. :param str event_type: The event_type of the EventGridEvent object or the type of the CloudEvent object.", "name": "_deserialize_data", "signature": ...
2
null
Implement the Python class `EventMixin` described below. Class description: Mixin for the event models comprising of some helper methods. Method signatures and docstrings: - def _deserialize_data(event, event_type): Sets the data of the desrialized event to strongly typed event object if event type exists in _event_m...
Implement the Python class `EventMixin` described below. Class description: Mixin for the event models comprising of some helper methods. Method signatures and docstrings: - def _deserialize_data(event, event_type): Sets the data of the desrialized event to strongly typed event object if event type exists in _event_m...
f779de8e53dbec033f98f976284e6d9491fd60b3
<|skeleton|> class EventMixin: """Mixin for the event models comprising of some helper methods.""" def _deserialize_data(event, event_type): """Sets the data of the desrialized event to strongly typed event object if event type exists in _event_mappings. Otherwise, sets it to None. :param str event_typ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EventMixin: """Mixin for the event models comprising of some helper methods.""" def _deserialize_data(event, event_type): """Sets the data of the desrialized event to strongly typed event object if event type exists in _event_mappings. Otherwise, sets it to None. :param str event_type: The event_...
the_stack_v2_python_sparse
sdk/eventgrid/azure-eventgrid/azure/eventgrid/_models.py
YijunXieMS/azure-sdk-for-python
train
1
c255ec6f58a666e9ed62024a798ec158a6ea10ca
[ "self.decimal_places = decimal_places\nself.decimal_separator = decimal_separator\nself.thousands_separator = thousands_separator\nself.dynamic_decimals = dynamic_decimals", "log.debug('DYNAMIC_DECIMALS: %s', ('off', 'on')[self.dynamic_decimals])\nif not self.dynamic_decimals or n == 0.0:\n return self.decimal...
<|body_start_0|> self.decimal_places = decimal_places self.decimal_separator = decimal_separator self.thousands_separator = thousands_separator self.dynamic_decimals = dynamic_decimals <|end_body_0|> <|body_start_1|> log.debug('DYNAMIC_DECIMALS: %s', ('off', 'on')[self.dynamic_d...
Format a number. Attributes: decimal_places (int): Number of decimal places in formatted numbers decimal_separator (str): Character to use as decimal separator thousands_separator (str): Character to use as thousands separator
Formatter
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Formatter: """Format a number. Attributes: decimal_places (int): Number of decimal places in formatted numbers decimal_separator (str): Character to use as decimal separator thousands_separator (str): Character to use as thousands separator""" def __init__(self, decimal_places=2, decimal_sep...
stack_v2_sparse_classes_36k_train_004396
20,753
permissive
[ { "docstring": "Create a new `Formatter`.", "name": "__init__", "signature": "def __init__(self, decimal_places=2, decimal_separator='.', thousands_separator='', dynamic_decimals=True)" }, { "docstring": "Calculate the number of decimal places the result should have. If :attr:`dynamic_decimals` ...
4
stack_v2_sparse_classes_30k_train_000111
Implement the Python class `Formatter` described below. Class description: Format a number. Attributes: decimal_places (int): Number of decimal places in formatted numbers decimal_separator (str): Character to use as decimal separator thousands_separator (str): Character to use as thousands separator Method signature...
Implement the Python class `Formatter` described below. Class description: Format a number. Attributes: decimal_places (int): Number of decimal places in formatted numbers decimal_separator (str): Character to use as decimal separator thousands_separator (str): Character to use as thousands separator Method signature...
97407f4ec8dbca5abbc6952b2b56cf3918624177
<|skeleton|> class Formatter: """Format a number. Attributes: decimal_places (int): Number of decimal places in formatted numbers decimal_separator (str): Character to use as decimal separator thousands_separator (str): Character to use as thousands separator""" def __init__(self, decimal_places=2, decimal_sep...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Formatter: """Format a number. Attributes: decimal_places (int): Number of decimal places in formatted numbers decimal_separator (str): Character to use as decimal separator thousands_separator (str): Character to use as thousands separator""" def __init__(self, decimal_places=2, decimal_separator='.', t...
the_stack_v2_python_sparse
src/convert.py
deanishe/alfred-convert
train
781
9e4d85dac196005cbda81b25c1baff7073a87e25
[ "if not hasattr(request, 'user'):\n raise ImproperlyConfigured(\"The Django Bluestem auth middleware requires the authentication middleware to be installed. Edit your MIDDLEWARE_CLASSES setting to insert 'django.contrib.auth.middleware.AuthenticationMiddleware' before the BluestemMiddleware class. Also, you must...
<|body_start_0|> if not hasattr(request, 'user'): raise ImproperlyConfigured("The Django Bluestem auth middleware requires the authentication middleware to be installed. Edit your MIDDLEWARE_CLASSES setting to insert 'django.contrib.auth.middleware.AuthenticationMiddleware' before the BluestemMiddle...
Middleware class for utilizing the Bluestem authentication backend in a Django application. If the request.user object is not already authenticated to Django, this middleware component uses the SDG Bluestem authentication backend, and attempts to authenticate the user via the BLUESTEM_ID_USER, BLUESTEM_ID_DOMAIN, and B...
BluestemMiddleware
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BluestemMiddleware: """Middleware class for utilizing the Bluestem authentication backend in a Django application. If the request.user object is not already authenticated to Django, this middleware component uses the SDG Bluestem authentication backend, and attempts to authenticate the user via t...
stack_v2_sparse_classes_36k_train_004397
13,103
no_license
[ { "docstring": "Perform Bluestem authentication on request object.", "name": "_bluestem_authenticate", "signature": "def _bluestem_authenticate(self, request)" }, { "docstring": "Manage a cached object consisting of a set of object references to view functions that are excluded from Bluestem aut...
5
stack_v2_sparse_classes_30k_val_000278
Implement the Python class `BluestemMiddleware` described below. Class description: Middleware class for utilizing the Bluestem authentication backend in a Django application. If the request.user object is not already authenticated to Django, this middleware component uses the SDG Bluestem authentication backend, and ...
Implement the Python class `BluestemMiddleware` described below. Class description: Middleware class for utilizing the Bluestem authentication backend in a Django application. If the request.user object is not already authenticated to Django, this middleware component uses the SDG Bluestem authentication backend, and ...
c453759c1b89ae269339fb8fb89dde370af590f3
<|skeleton|> class BluestemMiddleware: """Middleware class for utilizing the Bluestem authentication backend in a Django application. If the request.user object is not already authenticated to Django, this middleware component uses the SDG Bluestem authentication backend, and attempts to authenticate the user via t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BluestemMiddleware: """Middleware class for utilizing the Bluestem authentication backend in a Django application. If the request.user object is not already authenticated to Django, this middleware component uses the SDG Bluestem authentication backend, and attempts to authenticate the user via the BLUESTEM_I...
the_stack_v2_python_sparse
server_proj/sdg/django/auth/middleware.py
sbutler/spacescout_builds
train
0
75976c5818ff223290bbf4e157ee1b3a66672853
[ "self.directory = directory\nself.config_file = os.path.join(self.directory, TRIAL_YAML)\nif not os.path.isdir(directory):\n logging.fatal(f'trial directory {self.directory} not found')\n exit(1)\nif not os.path.isfile(self.config_file):\n logging.fatal(f'config file {self.config_file} not found')\n exi...
<|body_start_0|> self.directory = directory self.config_file = os.path.join(self.directory, TRIAL_YAML) if not os.path.isdir(directory): logging.fatal(f'trial directory {self.directory} not found') exit(1) if not os.path.isfile(self.config_file): loggi...
Data structure to hold the trial config and its experiment objects
Trial
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Trial: """Data structure to hold the trial config and its experiment objects""" def __init__(self, directory): """Construct the trial and its experiment objects :param directory: for the trial :param config_file: name of the config file expected in the directory""" <|body_0|>...
stack_v2_sparse_classes_36k_train_004398
2,211
no_license
[ { "docstring": "Construct the trial and its experiment objects :param directory: for the trial :param config_file: name of the config file expected in the directory", "name": "__init__", "signature": "def __init__(self, directory)" }, { "docstring": "Will compare output files against a regressio...
2
stack_v2_sparse_classes_30k_train_021371
Implement the Python class `Trial` described below. Class description: Data structure to hold the trial config and its experiment objects Method signatures and docstrings: - def __init__(self, directory): Construct the trial and its experiment objects :param directory: for the trial :param config_file: name of the co...
Implement the Python class `Trial` described below. Class description: Data structure to hold the trial config and its experiment objects Method signatures and docstrings: - def __init__(self, directory): Construct the trial and its experiment objects :param directory: for the trial :param config_file: name of the co...
f8fde00f69a4e3d8d4cf113dbb8f3f8db5e498d5
<|skeleton|> class Trial: """Data structure to hold the trial config and its experiment objects""" def __init__(self, directory): """Construct the trial and its experiment objects :param directory: for the trial :param config_file: name of the config file expected in the directory""" <|body_0|>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Trial: """Data structure to hold the trial config and its experiment objects""" def __init__(self, directory): """Construct the trial and its experiment objects :param directory: for the trial :param config_file: name of the config file expected in the directory""" self.directory = direct...
the_stack_v2_python_sparse
src/trial.py
trubens71/verde
train
0
f4cc49a6153b9d5fda25a7386ea34942d3d96557
[ "sql = \"\\n SELECT name, SUM(scount) FROM\\n (SELECT sf.name, COUNT(si.server_id) scount FROM\\n cmdb.cmdb_installedsoftlist si, cmdb.cmdb_basesofttype st, cmdb.cmdb_basesoft sf\\n WHERE si.soft_id = sf.id AND sf.type_id = st.id AND st.name in ('操作系统','OS')\\n...
<|body_start_0|> sql = "\n SELECT name, SUM(scount) FROM\n (SELECT sf.name, COUNT(si.server_id) scount FROM\n cmdb.cmdb_installedsoftlist si, cmdb.cmdb_basesofttype st, cmdb.cmdb_basesoft sf\n WHERE si.soft_id = sf.id AND sf.type_id = st.id AND st.name in (...
HostManage
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HostManage: def os_group_count(self, custid=None): """获取主机的报表数据,通过操作系统进行分类 :param custid: 客户id :return:""" <|body_0|> def month_group_count(self, month_value_dict, custid=None): """获取当前月份以及之前12月内所有设备数量统计 :param custid:客户id :param month_value_dict: 要显示的所有月记录初始列表[{'201...
stack_v2_sparse_classes_36k_train_004399
7,277
permissive
[ { "docstring": "获取主机的报表数据,通过操作系统进行分类 :param custid: 客户id :return:", "name": "os_group_count", "signature": "def os_group_count(self, custid=None)" }, { "docstring": "获取当前月份以及之前12月内所有设备数量统计 :param custid:客户id :param month_value_dict: 要显示的所有月记录初始列表[{'2016-12':0},{'2016-11':0},.....] :return:", ...
2
stack_v2_sparse_classes_30k_train_010551
Implement the Python class `HostManage` described below. Class description: Implement the HostManage class. Method signatures and docstrings: - def os_group_count(self, custid=None): 获取主机的报表数据,通过操作系统进行分类 :param custid: 客户id :return: - def month_group_count(self, month_value_dict, custid=None): 获取当前月份以及之前12月内所有设备数量统计 ...
Implement the Python class `HostManage` described below. Class description: Implement the HostManage class. Method signatures and docstrings: - def os_group_count(self, custid=None): 获取主机的报表数据,通过操作系统进行分类 :param custid: 客户id :return: - def month_group_count(self, month_value_dict, custid=None): 获取当前月份以及之前12月内所有设备数量统计 ...
002f80dcc07e3502610b0a0be1e91fe61bcfc42c
<|skeleton|> class HostManage: def os_group_count(self, custid=None): """获取主机的报表数据,通过操作系统进行分类 :param custid: 客户id :return:""" <|body_0|> def month_group_count(self, month_value_dict, custid=None): """获取当前月份以及之前12月内所有设备数量统计 :param custid:客户id :param month_value_dict: 要显示的所有月记录初始列表[{'201...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HostManage: def os_group_count(self, custid=None): """获取主机的报表数据,通过操作系统进行分类 :param custid: 客户id :return:""" sql = "\n SELECT name, SUM(scount) FROM\n (SELECT sf.name, COUNT(si.server_id) scount FROM\n cmdb.cmdb_installedsoftlist si, cmdb.cmdb_basesofttype...
the_stack_v2_python_sparse
cmdb/afcat/cmdb/custmanage.py
tonglinge/MyProjects
train
4