blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
378
8.64k
id
stringlengths
44
44
length_bytes
int64
505
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.88k
prompted_full_text
stringlengths
565
12.5k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
5.05k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
snapshot_total_rows
int64
75.8k
75.8k
solution
stringlengths
242
8.3k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
1b516fd1f764b25e83edf869f06c39e327824270
[ "self.model = MultinomialNB\nself.active_model = None\nself.param_grid = {'alpha': [0, 0.25, 0.5, 0.75, 1], 'fit_prior': [True, False]}", "classifier = GridSearchCV(self.model(), self.param_grid)\nclassifier.fit(training_data, training_labels)\nself.active_model = self.model(**classifier.best_params_)\nself.activ...
<|body_start_0|> self.model = MultinomialNB self.active_model = None self.param_grid = {'alpha': [0, 0.25, 0.5, 0.75, 1], 'fit_prior': [True, False]} <|end_body_0|> <|body_start_1|> classifier = GridSearchCV(self.model(), self.param_grid) classifier.fit(training_data, training_l...
Basic implementation of a grid-search optimized Logistic Regression.
NaiveMultinomialBayes
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NaiveMultinomialBayes: """Basic implementation of a grid-search optimized Logistic Regression.""" def __init__(self): """Initialize internal classifier.""" <|body_0|> def train(self, training_data, training_labels): """Run grid search to optimize hyper-parameters...
stack_v2_sparse_classes_75kplus_train_000200
3,287
no_license
[ { "docstring": "Initialize internal classifier.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Run grid search to optimize hyper-parameters, then trains the final model.", "name": "train", "signature": "def train(self, training_data, training_labels)" }, {...
3
stack_v2_sparse_classes_30k_train_029118
Implement the Python class `NaiveMultinomialBayes` described below. Class description: Basic implementation of a grid-search optimized Logistic Regression. Method signatures and docstrings: - def __init__(self): Initialize internal classifier. - def train(self, training_data, training_labels): Run grid search to opti...
Implement the Python class `NaiveMultinomialBayes` described below. Class description: Basic implementation of a grid-search optimized Logistic Regression. Method signatures and docstrings: - def __init__(self): Initialize internal classifier. - def train(self, training_data, training_labels): Run grid search to opti...
edffa89740e5cef810344a7bbf8a157241f46d02
<|skeleton|> class NaiveMultinomialBayes: """Basic implementation of a grid-search optimized Logistic Regression.""" def __init__(self): """Initialize internal classifier.""" <|body_0|> def train(self, training_data, training_labels): """Run grid search to optimize hyper-parameters...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NaiveMultinomialBayes: """Basic implementation of a grid-search optimized Logistic Regression.""" def __init__(self): """Initialize internal classifier.""" self.model = MultinomialNB self.active_model = None self.param_grid = {'alpha': [0, 0.25, 0.5, 0.75, 1], 'fit_prior':...
the_stack_v2_python_sparse
enso/experiment/NB.py
RichGit101/Enso
train
0
e53f24a25e23b16d3c2b2106851dfa4fa87c34dd
[ "client = RequestsClient()\nself.user = User.objects.create_user(username='testuser', password='12345')\nparams = {'username': 'testuser', 'password': '12345'}\nresponse = client.post('http://127.0.0.1:8000/api/token/', params)\njson_string = response.content.decode('utf8').replace(\"'\", '\"')\nassert response.sta...
<|body_start_0|> client = RequestsClient() self.user = User.objects.create_user(username='testuser', password='12345') params = {'username': 'testuser', 'password': '12345'} response = client.post('http://127.0.0.1:8000/api/token/', params) json_string = response.content.decode('...
Cass that tests if the authentification and protection of the API endpoints
Authentification_Tests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Authentification_Tests: """Cass that tests if the authentification and protection of the API endpoints""" def test_token_ok(self): """Test if the token is sent for a successfull authentification Note : it first creates a user then request the login endpoint of the app finally checks ...
stack_v2_sparse_classes_75kplus_train_000201
14,812
no_license
[ { "docstring": "Test if the token is sent for a successfull authentification Note : it first creates a user then request the login endpoint of the app finally checks if the response's code and if the token is in the response", "name": "test_token_ok", "signature": "def test_token_ok(self)" }, { ...
4
stack_v2_sparse_classes_30k_train_034361
Implement the Python class `Authentification_Tests` described below. Class description: Cass that tests if the authentification and protection of the API endpoints Method signatures and docstrings: - def test_token_ok(self): Test if the token is sent for a successfull authentification Note : it first creates a user t...
Implement the Python class `Authentification_Tests` described below. Class description: Cass that tests if the authentification and protection of the API endpoints Method signatures and docstrings: - def test_token_ok(self): Test if the token is sent for a successfull authentification Note : it first creates a user t...
c3f5bac6594c6fc927f568d8a5c8ad944ca1ee4f
<|skeleton|> class Authentification_Tests: """Cass that tests if the authentification and protection of the API endpoints""" def test_token_ok(self): """Test if the token is sent for a successfull authentification Note : it first creates a user then request the login endpoint of the app finally checks ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Authentification_Tests: """Cass that tests if the authentification and protection of the API endpoints""" def test_token_ok(self): """Test if the token is sent for a successfull authentification Note : it first creates a user then request the login endpoint of the app finally checks if the respon...
the_stack_v2_python_sparse
RouleMaPoule/input/tests.py
CLacaile/RouleMaPouleSansNidDePoule
train
0
11aee0589b214c887b539555ae18971ba84cea24
[ "vals = []\n\ndef pre_order(root):\n if root:\n vals.append(root.val)\n pre_order(root.left)\n pre_order(root.right)\npre_order(root)\nreturn ' '.join(map(str, vals))", "vals = collections.deque((int(val) for val in data.split()))\n\ndef build(min_val, max_val):\n if vals and min_val < ...
<|body_start_0|> vals = [] def pre_order(root): if root: vals.append(root.val) pre_order(root.left) pre_order(root.right) pre_order(root) return ' '.join(map(str, vals)) <|end_body_0|> <|body_start_1|> vals = collectio...
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_75kplus_train_000202
1,345
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_053918
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:...
74550d68cd3fd2cfcc92e1bf6579ac3b8f31aa75
<|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_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" vals = [] def pre_order(root): if root: vals.append(root.val) pre_order(root.left) pre_order(root.right) pre_...
the_stack_v2_python_sparse
tree/449_serialize_and_deserialize_bst.py
lawtech0902/py_imooc_algorithm
train
0
e4cf0a2245e99be04fbb11df284718d561888b18
[ "test_front_end = storage_media_frontend.StorageMediaFrontend()\ntest_front_end.ScanSource(source_path)\npath_spec = test_front_end.GetSourcePathSpec()\nself.assertNotEqual(path_spec, None)\nself.assertEqual(path_spec.location, os.path.abspath(source_path))\nself.assertEqual(path_spec.type_indicator, dfvfs_definiti...
<|body_start_0|> test_front_end = storage_media_frontend.StorageMediaFrontend() test_front_end.ScanSource(source_path) path_spec = test_front_end.GetSourcePathSpec() self.assertNotEqual(path_spec, None) self.assertEqual(path_spec.location, os.path.abspath(source_path)) se...
Tests for the storage media front-end object.
StorageMediaFrontendTests
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StorageMediaFrontendTests: """Tests for the storage media front-end object.""" def _TestScanSourceDirectory(self, source_path): """Tests the ScanSource function on a directory. Args: source_path: the path of the source device, directory or file.""" <|body_0|> def _TestSc...
stack_v2_sparse_classes_75kplus_train_000203
5,022
permissive
[ { "docstring": "Tests the ScanSource function on a directory. Args: source_path: the path of the source device, directory or file.", "name": "_TestScanSourceDirectory", "signature": "def _TestScanSourceDirectory(self, source_path)" }, { "docstring": "Tests the ScanSource function on the test ima...
5
stack_v2_sparse_classes_30k_test_001684
Implement the Python class `StorageMediaFrontendTests` described below. Class description: Tests for the storage media front-end object. Method signatures and docstrings: - def _TestScanSourceDirectory(self, source_path): Tests the ScanSource function on a directory. Args: source_path: the path of the source device, ...
Implement the Python class `StorageMediaFrontendTests` described below. Class description: Tests for the storage media front-end object. Method signatures and docstrings: - def _TestScanSourceDirectory(self, source_path): Tests the ScanSource function on a directory. Args: source_path: the path of the source device, ...
f525298bb1dd8f0fecd16d28acc443785ffe88c3
<|skeleton|> class StorageMediaFrontendTests: """Tests for the storage media front-end object.""" def _TestScanSourceDirectory(self, source_path): """Tests the ScanSource function on a directory. Args: source_path: the path of the source device, directory or file.""" <|body_0|> def _TestSc...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StorageMediaFrontendTests: """Tests for the storage media front-end object.""" def _TestScanSourceDirectory(self, source_path): """Tests the ScanSource function on a directory. Args: source_path: the path of the source device, directory or file.""" test_front_end = storage_media_frontend....
the_stack_v2_python_sparse
plaso/frontend/storage_media_frontend_test.py
cnbird1999/plaso
train
0
3cac6faab86ac028c607954858d0807cba960036
[ "shadow = self.ETP - self.slant_x / self.slant_x.dot(self.ETP)\nshadow_prime = shadow - shadow.dot(self.normal_vector) / self.slant_z.dot(self.normal_vector) * self.slant_z\ntheta_shadow = numpy.rad2deg(numpy.arctan2(self.row_vector.dot(shadow_prime), self.col_vector.dot(shadow_prime)))\nif theta_shadow < 0:\n t...
<|body_start_0|> shadow = self.ETP - self.slant_x / self.slant_x.dot(self.ETP) shadow_prime = shadow - shadow.dot(self.normal_vector) / self.slant_z.dot(self.normal_vector) * self.slant_z theta_shadow = numpy.rad2deg(numpy.arctan2(self.row_vector.dot(shadow_prime), self.col_vector.dot(shadow_pri...
ExploitationCalculator
[ "MIT", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExploitationCalculator: def Shadow(self): """AngleMagnitudeType: The shadow angle and magnitude.""" <|body_0|> def Layover(self): """AngleMagnitudeType: The layover angle and magnitude.""" <|body_1|> def North(self): """Describes the clockwise an...
stack_v2_sparse_classes_75kplus_train_000204
30,331
permissive
[ { "docstring": "AngleMagnitudeType: The shadow angle and magnitude.", "name": "Shadow", "signature": "def Shadow(self)" }, { "docstring": "AngleMagnitudeType: The layover angle and magnitude.", "name": "Layover", "signature": "def Layover(self)" }, { "docstring": "Describes the c...
5
stack_v2_sparse_classes_30k_train_030461
Implement the Python class `ExploitationCalculator` described below. Class description: Implement the ExploitationCalculator class. Method signatures and docstrings: - def Shadow(self): AngleMagnitudeType: The shadow angle and magnitude. - def Layover(self): AngleMagnitudeType: The layover angle and magnitude. - def ...
Implement the Python class `ExploitationCalculator` described below. Class description: Implement the ExploitationCalculator class. Method signatures and docstrings: - def Shadow(self): AngleMagnitudeType: The shadow angle and magnitude. - def Layover(self): AngleMagnitudeType: The layover angle and magnitude. - def ...
de1b1886f161a83b6c89aadc7a2c7cfc4892ef81
<|skeleton|> class ExploitationCalculator: def Shadow(self): """AngleMagnitudeType: The shadow angle and magnitude.""" <|body_0|> def Layover(self): """AngleMagnitudeType: The layover angle and magnitude.""" <|body_1|> def North(self): """Describes the clockwise an...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ExploitationCalculator: def Shadow(self): """AngleMagnitudeType: The shadow angle and magnitude.""" shadow = self.ETP - self.slant_x / self.slant_x.dot(self.ETP) shadow_prime = shadow - shadow.dot(self.normal_vector) / self.slant_z.dot(self.normal_vector) * self.slant_z theta_s...
the_stack_v2_python_sparse
sarpy/io/product/sidd3_elements/ExploitationFeatures.py
ngageoint/sarpy
train
192
d7fe8f87a3edd6a2d0fcc2e80fc3b09a01e265c7
[ "if context is None:\n context = {}\nres = super(purchase_requisition_group, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False)\nif context.get('active_model', '') == 'purchase.requisition' and len(context['active_ids']) < 2:\n raise osv.excep...
<|body_start_0|> if context is None: context = {} res = super(purchase_requisition_group, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False) if context.get('active_model', '') == 'purchase.requisition' and len(context...
purchase_requisition_group
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class purchase_requisition_group: def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): """Changes the view dynamically @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ...
stack_v2_sparse_classes_75kplus_train_000205
3,810
no_license
[ { "docstring": "Changes the view dynamically @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param context: A standard dictionary @return: New arch of view.", "name": "fields_view_get", "signature": "def fields_view_get(self, cr, uid, view_id...
2
stack_v2_sparse_classes_30k_train_006928
Implement the Python class `purchase_requisition_group` described below. Class description: Implement the purchase_requisition_group class. Method signatures and docstrings: - def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): Changes the view dynamically @...
Implement the Python class `purchase_requisition_group` described below. Class description: Implement the purchase_requisition_group class. Method signatures and docstrings: - def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): Changes the view dynamically @...
0b997095c260d58b026440967fea3a202bef7efb
<|skeleton|> class purchase_requisition_group: def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): """Changes the view dynamically @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class purchase_requisition_group: def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): """Changes the view dynamically @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param context: A sta...
the_stack_v2_python_sparse
v_7/Dongola/wafi/purchase_wafi/wizard/purchase_requisition_group.py
musabahmed/baba
train
0
e75b64e0f5a9d4d18b1f7b12223838ccb4488b81
[ "global ID\nencoded = hex(ID).lstrip('0xX')\nurl_map[ID] = longUrl\nID += 1\nreturn 'http://shorturl.com/' + encoded", "encoded = shortUrl.split('/')[-1]\ndecoded = int(encoded, 16)\nif decoded in url_map:\n return url_map[decoded]" ]
<|body_start_0|> global ID encoded = hex(ID).lstrip('0xX') url_map[ID] = longUrl ID += 1 return 'http://shorturl.com/' + encoded <|end_body_0|> <|body_start_1|> encoded = shortUrl.split('/')[-1] decoded = int(encoded, 16) if decoded in url_map: ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def encode(self, longUrl): """Encodes a URL to a shortened URL. :type longUrl: str :rtype: str""" <|body_0|> def decode(self, shortUrl): """Decodes a shortened URL to its original URL. :type shortUrl: str :rtype: str""" <|body_1|> <|end_skeleton|> <|...
stack_v2_sparse_classes_75kplus_train_000206
887
no_license
[ { "docstring": "Encodes a URL to a shortened URL. :type longUrl: str :rtype: str", "name": "encode", "signature": "def encode(self, longUrl)" }, { "docstring": "Decodes a shortened URL to its original URL. :type shortUrl: str :rtype: str", "name": "decode", "signature": "def decode(self,...
2
stack_v2_sparse_classes_30k_train_011757
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, longUrl): Encodes a URL to a shortened URL. :type longUrl: str :rtype: str - def decode(self, shortUrl): Decodes a shortened URL to its original URL. :type shortUrl: s...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, longUrl): Encodes a URL to a shortened URL. :type longUrl: str :rtype: str - def decode(self, shortUrl): Decodes a shortened URL to its original URL. :type shortUrl: s...
c393347cbee68f5d976049685baa962990647d3a
<|skeleton|> class Codec: def encode(self, longUrl): """Encodes a URL to a shortened URL. :type longUrl: str :rtype: str""" <|body_0|> def decode(self, shortUrl): """Decodes a shortened URL to its original URL. :type shortUrl: str :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def encode(self, longUrl): """Encodes a URL to a shortened URL. :type longUrl: str :rtype: str""" global ID encoded = hex(ID).lstrip('0xX') url_map[ID] = longUrl ID += 1 return 'http://shorturl.com/' + encoded def decode(self, shortUrl): """D...
the_stack_v2_python_sparse
code/python/535-encode-and-decode-tinyurl.py
forrestchang/leetcode
train
0
bd6053f0f6d05ae03b1c9c007ac9b811ca9b19a2
[ "inf = float('inf')\na = [-inf] + arr + [-inf]\nstack = []\nret = 0\nmod = 10 ** 9 + 7\nfor i in range(len(a)):\n while stack and a[stack[-1]] > a[i]:\n j = stack.pop()\n pre_j = stack[-1]\n ret += a[j] * (i - j) * (j - pre_j)\n stack.append(i)\nreturn ret % mod", "lt = [0]\na = [0] + a...
<|body_start_0|> inf = float('inf') a = [-inf] + arr + [-inf] stack = [] ret = 0 mod = 10 ** 9 + 7 for i in range(len(a)): while stack and a[stack[-1]] > a[i]: j = stack.pop() pre_j = stack[-1] ret += a[j] * (i -...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def sumSubarrayMins(self, arr): """:type arr: List[int] :rtype: int formula is (i - j) * (j - k) * a[j]. simulate process: add -inf to both end of a -inf, 3, 1, 2, 5, 4, -inf index 0, 1, 2, 3, 4, 5, 6 stack = [0,2,3,5,6] # store index and value of its index are increasing index...
stack_v2_sparse_classes_75kplus_train_000207
4,605
no_license
[ { "docstring": ":type arr: List[int] :rtype: int formula is (i - j) * (j - k) * a[j]. simulate process: add -inf to both end of a -inf, 3, 1, 2, 5, 4, -inf index 0, 1, 2, 3, 4, 5, 6 stack = [0,2,3,5,6] # store index and value of its index are increasing index 0, val -inf stack: [0] ------- index 1, val 3 stack:...
2
stack_v2_sparse_classes_30k_train_037159
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sumSubarrayMins(self, arr): :type arr: List[int] :rtype: int formula is (i - j) * (j - k) * a[j]. simulate process: add -inf to both end of a -inf, 3, 1, 2, 5, 4, -inf index ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sumSubarrayMins(self, arr): :type arr: List[int] :rtype: int formula is (i - j) * (j - k) * a[j]. simulate process: add -inf to both end of a -inf, 3, 1, 2, 5, 4, -inf index ...
02726da394971ef02616a038dadc126c6ff260de
<|skeleton|> class Solution: def sumSubarrayMins(self, arr): """:type arr: List[int] :rtype: int formula is (i - j) * (j - k) * a[j]. simulate process: add -inf to both end of a -inf, 3, 1, 2, 5, 4, -inf index 0, 1, 2, 3, 4, 5, 6 stack = [0,2,3,5,6] # store index and value of its index are increasing index...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def sumSubarrayMins(self, arr): """:type arr: List[int] :rtype: int formula is (i - j) * (j - k) * a[j]. simulate process: add -inf to both end of a -inf, 3, 1, 2, 5, 4, -inf index 0, 1, 2, 3, 4, 5, 6 stack = [0,2,3,5,6] # store index and value of its index are increasing index 0, val -inf s...
the_stack_v2_python_sparse
subarray/N907_SumofSubarrayMinimums.py
zerghua/leetcode-python
train
2
04580bf3a31bc845ca990fb88bb7ca404cf6566f
[ "_input_table = DataFrame({'ID': [0, 1, 1, 2], 'a': [float64('nan'), float64('nan'), float64('nan'), float64('nan')], 'b': [2, 3, 4, 5]})\n_groupings = [{'operator': 'count', 'columns': ['a', 'b']}]\n_expected = DataFrame({'ID': [0, 1, 1, 2], 'countab': [1, 1, 1, 1]})\n_ca = aggregate_columns.ColumnAggregator(_inpu...
<|body_start_0|> _input_table = DataFrame({'ID': [0, 1, 1, 2], 'a': [float64('nan'), float64('nan'), float64('nan'), float64('nan')], 'b': [2, 3, 4, 5]}) _groupings = [{'operator': 'count', 'columns': ['a', 'b']}] _expected = DataFrame({'ID': [0, 1, 1, 2], 'countab': [1, 1, 1, 1]}) _ca =...
Tests for the ``aggregate_columns.ColumnAggregator._count`` module. Assert final data frames match expectations.
PreprocessCountTests
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PreprocessCountTests: """Tests for the ``aggregate_columns.ColumnAggregator._count`` module. Assert final data frames match expectations.""" def test_aggregate_count_columns_1(): """Test aggregating with the "last" operation on an example DataFrame.""" <|body_0|> def tes...
stack_v2_sparse_classes_75kplus_train_000208
4,168
permissive
[ { "docstring": "Test aggregating with the \"last\" operation on an example DataFrame.", "name": "test_aggregate_count_columns_1", "signature": "def test_aggregate_count_columns_1()" }, { "docstring": "Test counting columns of strings when there are no missing values.", "name": "test_aggregat...
4
stack_v2_sparse_classes_30k_test_000820
Implement the Python class `PreprocessCountTests` described below. Class description: Tests for the ``aggregate_columns.ColumnAggregator._count`` module. Assert final data frames match expectations. Method signatures and docstrings: - def test_aggregate_count_columns_1(): Test aggregating with the "last" operation on...
Implement the Python class `PreprocessCountTests` described below. Class description: Tests for the ``aggregate_columns.ColumnAggregator._count`` module. Assert final data frames match expectations. Method signatures and docstrings: - def test_aggregate_count_columns_1(): Test aggregating with the "last" operation on...
2e89bc55a61ce2a4ce77646bb427f5b3040f672c
<|skeleton|> class PreprocessCountTests: """Tests for the ``aggregate_columns.ColumnAggregator._count`` module. Assert final data frames match expectations.""" def test_aggregate_count_columns_1(): """Test aggregating with the "last" operation on an example DataFrame.""" <|body_0|> def tes...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PreprocessCountTests: """Tests for the ``aggregate_columns.ColumnAggregator._count`` module. Assert final data frames match expectations.""" def test_aggregate_count_columns_1(): """Test aggregating with the "last" operation on an example DataFrame.""" _input_table = DataFrame({'ID': [0, ...
the_stack_v2_python_sparse
numom2b_preprocessing/unittests/column_aggregate_tests/test_aggregate_count.py
hayesall/nuMoM2b_preprocessing
train
2
2851915afaf3896c156727592241ffb41e214621
[ "pygame.init()\nself.screen = pygame.display.set_mode((1000, 600))\npygame.display.set_caption('Blue Sky')\nself.bg_color = (0, 204, 204)", "while True:\n for event in pygame.event.get():\n if event.type == pygame.QUIT:\n sys.exit()\n self.screen.fill(self.bg_color)\n pygame.display.fli...
<|body_start_0|> pygame.init() self.screen = pygame.display.set_mode((1000, 600)) pygame.display.set_caption('Blue Sky') self.bg_color = (0, 204, 204) <|end_body_0|> <|body_start_1|> while True: for event in pygame.event.get(): if event.type == pygame...
Class to make blue pygame background
BlueSky
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BlueSky: """Class to make blue pygame background""" def __init__(self): """Inits pygame with bg""" <|body_0|> def create_window(self): """Create pygame window""" <|body_1|> <|end_skeleton|> <|body_start_0|> pygame.init() self.screen = py...
stack_v2_sparse_classes_75kplus_train_000209
702
no_license
[ { "docstring": "Inits pygame with bg", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Create pygame window", "name": "create_window", "signature": "def create_window(self)" } ]
2
null
Implement the Python class `BlueSky` described below. Class description: Class to make blue pygame background Method signatures and docstrings: - def __init__(self): Inits pygame with bg - def create_window(self): Create pygame window
Implement the Python class `BlueSky` described below. Class description: Class to make blue pygame background Method signatures and docstrings: - def __init__(self): Inits pygame with bg - def create_window(self): Create pygame window <|skeleton|> class BlueSky: """Class to make blue pygame background""" de...
7c49f8f05afa58c99979bf490f7bc4ff85a87167
<|skeleton|> class BlueSky: """Class to make blue pygame background""" def __init__(self): """Inits pygame with bg""" <|body_0|> def create_window(self): """Create pygame window""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BlueSky: """Class to make blue pygame background""" def __init__(self): """Inits pygame with bg""" pygame.init() self.screen = pygame.display.set_mode((1000, 600)) pygame.display.set_caption('Blue Sky') self.bg_color = (0, 204, 204) def create_window(self): ...
the_stack_v2_python_sparse
chapter_12/TIY_12-1.py
kelvDp/CC_python_cc_projects
train
0
bd99975a2e10405a5a980d0e8d460aed4ebe8fd0
[ "DriverClient.__init__(self)\nself.host = host\nself.cmd_port = cmd_port\nself.event_port = event_port\nself.cmd_host_string = 'tcp://%s:%i' % (self.host, self.cmd_port)\nself.event_host_string = 'tcp://%s:%i' % (self.host, self.event_port)\nself.zmq_context = None\nself.zmq_cmd_socket = None\nself.event_thread = N...
<|body_start_0|> DriverClient.__init__(self) self.host = host self.cmd_port = cmd_port self.event_port = event_port self.cmd_host_string = 'tcp://%s:%i' % (self.host, self.cmd_port) self.event_host_string = 'tcp://%s:%i' % (self.host, self.event_port) self.zmq_con...
A class for communicating with a ZMQ-based driver process using python thread for catching asynchronous driver events.
ZmqDriverClient
[ "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZmqDriverClient: """A class for communicating with a ZMQ-based driver process using python thread for catching asynchronous driver events.""" def __init__(self, host, cmd_port, event_port): """Initialize members. @param host Host string address of the driver process. @param cmd_port ...
stack_v2_sparse_classes_75kplus_train_000210
6,238
permissive
[ { "docstring": "Initialize members. @param host Host string address of the driver process. @param cmd_port Port number for the driver process command port. @param event_port Port number for the driver process event port.", "name": "__init__", "signature": "def __init__(self, host, cmd_port, event_port)"...
4
stack_v2_sparse_classes_30k_train_006946
Implement the Python class `ZmqDriverClient` described below. Class description: A class for communicating with a ZMQ-based driver process using python thread for catching asynchronous driver events. Method signatures and docstrings: - def __init__(self, host, cmd_port, event_port): Initialize members. @param host Ho...
Implement the Python class `ZmqDriverClient` described below. Class description: A class for communicating with a ZMQ-based driver process using python thread for catching asynchronous driver events. Method signatures and docstrings: - def __init__(self, host, cmd_port, event_port): Initialize members. @param host Ho...
bdbf01f5614e7188ce19596704794466e5683b30
<|skeleton|> class ZmqDriverClient: """A class for communicating with a ZMQ-based driver process using python thread for catching asynchronous driver events.""" def __init__(self, host, cmd_port, event_port): """Initialize members. @param host Host string address of the driver process. @param cmd_port ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ZmqDriverClient: """A class for communicating with a ZMQ-based driver process using python thread for catching asynchronous driver events.""" def __init__(self, host, cmd_port, event_port): """Initialize members. @param host Host string address of the driver process. @param cmd_port Port number f...
the_stack_v2_python_sparse
mi/core/instrument/zmq_driver_client.py
oceanobservatories/mi-instrument
train
1
a5238ec8617ce7bd5c520e006463ea750e4c147a
[ "log.debug('GET request from user %s for lesson %s' % (request.user, lesson_id))\nproj = Project.objects.get(project_number=project_number)\nlesson = LessonLearnt.objects.get(id=lesson_id)\nif not check_project_read_acl(proj, request.user):\n log.debug('Refusing GET request for project %s from user %s' % (projec...
<|body_start_0|> log.debug('GET request from user %s for lesson %s' % (request.user, lesson_id)) proj = Project.objects.get(project_number=project_number) lesson = LessonLearnt.objects.get(id=lesson_id) if not check_project_read_acl(proj, request.user): log.debug('Refusing GE...
URI: /api/lessons/%project_number%/%lesson_id%/ VERBS: GET, PUT, DELETE Handles a single instance of Lesson
LessonResourceHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LessonResourceHandler: """URI: /api/lessons/%project_number%/%lesson_id%/ VERBS: GET, PUT, DELETE Handles a single instance of Lesson""" def read(self, request, project_number, lesson_id): """View a lesson""" <|body_0|> def update(self, request, project_number, lesson_id...
stack_v2_sparse_classes_75kplus_train_000211
4,301
no_license
[ { "docstring": "View a lesson", "name": "read", "signature": "def read(self, request, project_number, lesson_id)" }, { "docstring": "Update the lesson", "name": "update", "signature": "def update(self, request, project_number, lesson_id)" }, { "docstring": "Disassociate the lesso...
3
stack_v2_sparse_classes_30k_train_007974
Implement the Python class `LessonResourceHandler` described below. Class description: URI: /api/lessons/%project_number%/%lesson_id%/ VERBS: GET, PUT, DELETE Handles a single instance of Lesson Method signatures and docstrings: - def read(self, request, project_number, lesson_id): View a lesson - def update(self, re...
Implement the Python class `LessonResourceHandler` described below. Class description: URI: /api/lessons/%project_number%/%lesson_id%/ VERBS: GET, PUT, DELETE Handles a single instance of Lesson Method signatures and docstrings: - def read(self, request, project_number, lesson_id): View a lesson - def update(self, re...
106a96307612318fb66246486e7226069e5508ac
<|skeleton|> class LessonResourceHandler: """URI: /api/lessons/%project_number%/%lesson_id%/ VERBS: GET, PUT, DELETE Handles a single instance of Lesson""" def read(self, request, project_number, lesson_id): """View a lesson""" <|body_0|> def update(self, request, project_number, lesson_id...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LessonResourceHandler: """URI: /api/lessons/%project_number%/%lesson_id%/ VERBS: GET, PUT, DELETE Handles a single instance of Lesson""" def read(self, request, project_number, lesson_id): """View a lesson""" log.debug('GET request from user %s for lesson %s' % (request.user, lesson_id)) ...
the_stack_v2_python_sparse
api-example/lessons/api_views.py
NhaTrang/django-project-management
train
0
a4455ec84136a4cb858c39da7c7bc3bc1dc2e02a
[ "self._release_repos = ['product-configs', 'MediaSDK', 'media-driver']\nself._root_dir = pathlib.Path(root_dir)\nself._repo = repo\nself._branch = branch\nself._revision = revision\nself._target_branch = target_branch\nself._build_event = build_event\nself._commit_time = datetime.strptime(commit_time, '%Y-%m-%d %H:...
<|body_start_0|> self._release_repos = ['product-configs', 'MediaSDK', 'media-driver'] self._root_dir = pathlib.Path(root_dir) self._repo = repo self._branch = branch self._revision = revision self._target_branch = target_branch self._build_event = build_event ...
Prepare manifest
ManifestRunner
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ManifestRunner: """Prepare manifest""" def __init__(self, root_dir, repo, branch, revision, target_branch, build_event, commit_time): """:param root_dir: Directory where repositories will be extracted :type root_dir: String :param repo: Repository name :type repo: Repository name :pa...
stack_v2_sparse_classes_75kplus_train_000212
9,449
permissive
[ { "docstring": ":param root_dir: Directory where repositories will be extracted :type root_dir: String :param repo: Repository name :type repo: Repository name :param branch: Branch name :type branch: Branch name :param revision: Revision of a commit :type revision: Revision of a commit :param target_branch: Ta...
6
stack_v2_sparse_classes_30k_train_008096
Implement the Python class `ManifestRunner` described below. Class description: Prepare manifest Method signatures and docstrings: - def __init__(self, root_dir, repo, branch, revision, target_branch, build_event, commit_time): :param root_dir: Directory where repositories will be extracted :type root_dir: String :pa...
Implement the Python class `ManifestRunner` described below. Class description: Prepare manifest Method signatures and docstrings: - def __init__(self, root_dir, repo, branch, revision, target_branch, build_event, commit_time): :param root_dir: Directory where repositories will be extracted :type root_dir: String :pa...
0753703482ef61e9202ec8814836dc03112dea3e
<|skeleton|> class ManifestRunner: """Prepare manifest""" def __init__(self, root_dir, repo, branch, revision, target_branch, build_event, commit_time): """:param root_dir: Directory where repositories will be extracted :type root_dir: String :param repo: Repository name :type repo: Repository name :pa...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ManifestRunner: """Prepare manifest""" def __init__(self, root_dir, repo, branch, revision, target_branch, build_event, commit_time): """:param root_dir: Directory where repositories will be extracted :type root_dir: String :param repo: Repository name :type repo: Repository name :param branch: B...
the_stack_v2_python_sparse
build_scripts/manifest_runner.py
Intel-Media-SDK/infrastructure
train
9
d5954522ae915b0620271f9f75260fc561af4864
[ "customer = CustomerHelper.parse_from_body_request(req)\nCustomerHelper.save(customer)\nreq.context['result'] = {'status': {'code': 200, 'message': 'success'}}\nres.status = falcon.HTTP_200", "customer = CustomerHelper.parse_from_query_string_request(req)\nlist_customer = CustomerHelper.find(customer)\nreq.contex...
<|body_start_0|> customer = CustomerHelper.parse_from_body_request(req) CustomerHelper.save(customer) req.context['result'] = {'status': {'code': 200, 'message': 'success'}} res.status = falcon.HTTP_200 <|end_body_0|> <|body_start_1|> customer = CustomerHelper.parse_from_query_s...
ListCustomerListener
ListCustomerListener
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ListCustomerListener: """ListCustomerListener""" def on_post(self, req, res): """handle POST requests""" <|body_0|> def on_get(self, req, res): """handle GET requests""" <|body_1|> <|end_skeleton|> <|body_start_0|> customer = CustomerHelper.pars...
stack_v2_sparse_classes_75kplus_train_000213
1,846
no_license
[ { "docstring": "handle POST requests", "name": "on_post", "signature": "def on_post(self, req, res)" }, { "docstring": "handle GET requests", "name": "on_get", "signature": "def on_get(self, req, res)" } ]
2
stack_v2_sparse_classes_30k_train_018598
Implement the Python class `ListCustomerListener` described below. Class description: ListCustomerListener Method signatures and docstrings: - def on_post(self, req, res): handle POST requests - def on_get(self, req, res): handle GET requests
Implement the Python class `ListCustomerListener` described below. Class description: ListCustomerListener Method signatures and docstrings: - def on_post(self, req, res): handle POST requests - def on_get(self, req, res): handle GET requests <|skeleton|> class ListCustomerListener: """ListCustomerListener""" ...
11b885c11fe3b506f092c9aa1c22e1062f5f1e70
<|skeleton|> class ListCustomerListener: """ListCustomerListener""" def on_post(self, req, res): """handle POST requests""" <|body_0|> def on_get(self, req, res): """handle GET requests""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ListCustomerListener: """ListCustomerListener""" def on_post(self, req, res): """handle POST requests""" customer = CustomerHelper.parse_from_body_request(req) CustomerHelper.save(customer) req.context['result'] = {'status': {'code': 200, 'message': 'success'}} res...
the_stack_v2_python_sparse
lib/listener/customer.py
arsystem/warehouse.api
train
0
982de57a1d9a2327f8f2caf5c5383ae05163bdd7
[ "nlu_namespaces_to_check = [nlu.Spellbook.pretrained_pipe_references, nlu.Spellbook.pretrained_models_references, nlu.Spellbook.pretrained_healthcare_model_references, nlu.Spellbook.licensed_storage_ref_2_nlu_ref, nlu.Spellbook.storage_ref_2_nlu_ref]\nfor dict_ in nlu_namespaces_to_check:\n if lang:\n if ...
<|body_start_0|> nlu_namespaces_to_check = [nlu.Spellbook.pretrained_pipe_references, nlu.Spellbook.pretrained_models_references, nlu.Spellbook.pretrained_healthcare_model_references, nlu.Spellbook.licensed_storage_ref_2_nlu_ref, nlu.Spellbook.storage_ref_2_nlu_ref] for dict_ in nlu_namespaces_to_check:...
ModelHubUtils
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModelHubUtils: def NLU_ref_to_NLP_ref(nlu_ref: str, lang: str=None) -> str: """Resolve a Spark NLU reference to a NLP reference. Args : NLU_ref : which nlu model's nlp refrence to return. lang : what language is the model in.""" <|body_0|> def get_url_by_nlu_refrence(nlu_ref...
stack_v2_sparse_classes_75kplus_train_000214
2,567
permissive
[ { "docstring": "Resolve a Spark NLU reference to a NLP reference. Args : NLU_ref : which nlu model's nlp refrence to return. lang : what language is the model in.", "name": "NLU_ref_to_NLP_ref", "signature": "def NLU_ref_to_NLP_ref(nlu_ref: str, lang: str=None) -> str" }, { "docstring": "Rsolves...
3
stack_v2_sparse_classes_30k_train_037258
Implement the Python class `ModelHubUtils` described below. Class description: Implement the ModelHubUtils class. Method signatures and docstrings: - def NLU_ref_to_NLP_ref(nlu_ref: str, lang: str=None) -> str: Resolve a Spark NLU reference to a NLP reference. Args : NLU_ref : which nlu model's nlp refrence to return...
Implement the Python class `ModelHubUtils` described below. Class description: Implement the ModelHubUtils class. Method signatures and docstrings: - def NLU_ref_to_NLP_ref(nlu_ref: str, lang: str=None) -> str: Resolve a Spark NLU reference to a NLP reference. Args : NLU_ref : which nlu model's nlp refrence to return...
fd7e73bc3e331b49361fca93cf8d07cccd934adc
<|skeleton|> class ModelHubUtils: def NLU_ref_to_NLP_ref(nlu_ref: str, lang: str=None) -> str: """Resolve a Spark NLU reference to a NLP reference. Args : NLU_ref : which nlu model's nlp refrence to return. lang : what language is the model in.""" <|body_0|> def get_url_by_nlu_refrence(nlu_ref...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ModelHubUtils: def NLU_ref_to_NLP_ref(nlu_ref: str, lang: str=None) -> str: """Resolve a Spark NLU reference to a NLP reference. Args : NLU_ref : which nlu model's nlp refrence to return. lang : what language is the model in.""" nlu_namespaces_to_check = [nlu.Spellbook.pretrained_pipe_referenc...
the_stack_v2_python_sparse
nlu/pipe/utils/modelhub_utils.py
prakashcinna/nlu
train
0
188b97916fbf0683da95246b9ac89f6f860e6580
[ "self.learning_rate = learning_rate\nself.weight_decay_rate = weight_decay_rate\nself.beta_1 = beta_1\nself.beta_2 = beta_2\nself.epsilon = epsilon\nself.exclude_from_weight_decay = exclude_from_weight_decay", "if grad is None:\n tf.logging.warning('Gradient is None for variable %s', var.name)\n return []\n...
<|body_start_0|> self.learning_rate = learning_rate self.weight_decay_rate = weight_decay_rate self.beta_1 = beta_1 self.beta_2 = beta_2 self.epsilon = epsilon self.exclude_from_weight_decay = exclude_from_weight_decay <|end_body_0|> <|body_start_1|> if grad is N...
A basic Adam optimizer that includes "correct" L2 weight decay.
AdamWeightDecayOptimizer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdamWeightDecayOptimizer: """A basic Adam optimizer that includes "correct" L2 weight decay.""" def __init__(self, learning_rate, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=None): """Constructs a AdamWeightDecayOptimizer.""" <|bo...
stack_v2_sparse_classes_75kplus_train_000215
20,772
permissive
[ { "docstring": "Constructs a AdamWeightDecayOptimizer.", "name": "__init__", "signature": "def __init__(self, learning_rate, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=None)" }, { "docstring": "See base class.", "name": "apply_grad", "signat...
3
stack_v2_sparse_classes_30k_train_015564
Implement the Python class `AdamWeightDecayOptimizer` described below. Class description: A basic Adam optimizer that includes "correct" L2 weight decay. Method signatures and docstrings: - def __init__(self, learning_rate, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=None...
Implement the Python class `AdamWeightDecayOptimizer` described below. Class description: A basic Adam optimizer that includes "correct" L2 weight decay. Method signatures and docstrings: - def __init__(self, learning_rate, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=None...
fbf7b1e547e8b8cb134e81e1cd350c312c0b5a16
<|skeleton|> class AdamWeightDecayOptimizer: """A basic Adam optimizer that includes "correct" L2 weight decay.""" def __init__(self, learning_rate, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=None): """Constructs a AdamWeightDecayOptimizer.""" <|bo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AdamWeightDecayOptimizer: """A basic Adam optimizer that includes "correct" L2 weight decay.""" def __init__(self, learning_rate, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=None): """Constructs a AdamWeightDecayOptimizer.""" self.learning_rat...
the_stack_v2_python_sparse
mesh_tensorflow/optimize.py
tensorflow/mesh
train
1,508
dcd8d65ff873bedee1a4836b846545edb78fe588
[ "image1 = np.random.randn(256, 256, 3).astype('float32')\nimage2 = np.random.randn(256, 256, 3).astype('float32')\nsmurf_model = smurf_net.SMURFNet()\nflow = smurf_model.infer(image1, image2)\ncorrect_shape = np.equal(flow.shape, [256, 256, 2]).all()\nself.assertTrue(correct_shape)", "ds = tf.data.Dataset.from_te...
<|body_start_0|> image1 = np.random.randn(256, 256, 3).astype('float32') image2 = np.random.randn(256, 256, 3).astype('float32') smurf_model = smurf_net.SMURFNet() flow = smurf_model.infer(image1, image2) correct_shape = np.equal(flow.shape, [256, 256, 2]).all() self.asse...
Run some checks to see if loading pretrained weights works correctly.
SMURFNetTest
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SMURFNetTest: """Run some checks to see if loading pretrained weights works correctly.""" def test_inference(self): """Test that inference runs and produces output of the right size.""" <|body_0|> def test_train_step(self): """Test a single training step.""" ...
stack_v2_sparse_classes_75kplus_train_000216
4,035
permissive
[ { "docstring": "Test that inference runs and produces output of the right size.", "name": "test_inference", "signature": "def test_inference(self)" }, { "docstring": "Test a single training step.", "name": "test_train_step", "signature": "def test_train_step(self)" }, { "docstrin...
5
stack_v2_sparse_classes_30k_train_034543
Implement the Python class `SMURFNetTest` described below. Class description: Run some checks to see if loading pretrained weights works correctly. Method signatures and docstrings: - def test_inference(self): Test that inference runs and produces output of the right size. - def test_train_step(self): Test a single t...
Implement the Python class `SMURFNetTest` described below. Class description: Run some checks to see if loading pretrained weights works correctly. Method signatures and docstrings: - def test_inference(self): Test that inference runs and produces output of the right size. - def test_train_step(self): Test a single t...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class SMURFNetTest: """Run some checks to see if loading pretrained weights works correctly.""" def test_inference(self): """Test that inference runs and produces output of the right size.""" <|body_0|> def test_train_step(self): """Test a single training step.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SMURFNetTest: """Run some checks to see if loading pretrained weights works correctly.""" def test_inference(self): """Test that inference runs and produces output of the right size.""" image1 = np.random.randn(256, 256, 3).astype('float32') image2 = np.random.randn(256, 256, 3).a...
the_stack_v2_python_sparse
smurf/smurf_net_test.py
Jimmy-INL/google-research
train
1
a8ed9d8b69a7474ccdbaa941680cdfcd1ad48d01
[ "if not root:\n return ''\narr = []\nqueue = [[root, 0]]\nn = 1\nwhile queue:\n node, ind = queue.pop(0)\n arr.append([node.val])\n if node.left:\n queue.append([node.left, len(queue)])\n arr[-1].append(n)\n n += 1\n elif node.right:\n arr[-1].append(None)\n if node.rig...
<|body_start_0|> if not root: return '' arr = [] queue = [[root, 0]] n = 1 while queue: node, ind = queue.pop(0) arr.append([node.val]) if node.left: queue.append([node.left, len(queue)]) arr[-1].appe...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_75kplus_train_000217
1,563
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_000896
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:...
4bf1a7814b5c76e11242e7933e09c59ede3284a3
<|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_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return '' arr = [] queue = [[root, 0]] n = 1 while queue: node, ind = queue.pop(0) arr.append([node.val])...
the_stack_v2_python_sparse
Explore/Binary Tree/Conclusions/0297_Serialize_and_Deserialize_Binary_Tree.py
actcheng/leetcode-solutions
train
2
b11cf34f3e206bac1c28092c0e8508e7997fa092
[ "super(HostActionsAdminTest, cls).setUpClass()\ncls.hosts = cls.admin_hosts_client.list_hosts().entity\ncls.compute_host_name = next((host.host_name for host in cls.hosts if host.service == HostServiceTypes.COMPUTE))", "host_response = self.admin_hosts_client.update_host(self.compute_host_name, status='disable')....
<|body_start_0|> super(HostActionsAdminTest, cls).setUpClass() cls.hosts = cls.admin_hosts_client.list_hosts().entity cls.compute_host_name = next((host.host_name for host in cls.hosts if host.service == HostServiceTypes.COMPUTE)) <|end_body_0|> <|body_start_1|> host_response = self.adm...
HostActionsAdminTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HostActionsAdminTest: def setUpClass(cls): """Perform actions that setup the necessary resources for testing The following data is generated during this setup: - A list of hosts - The host name of a compute host""" <|body_0|> def test_disable_host(self): """Test that...
stack_v2_sparse_classes_75kplus_train_000218
2,488
permissive
[ { "docstring": "Perform actions that setup the necessary resources for testing The following data is generated during this setup: - A list of hosts - The host name of a compute host", "name": "setUpClass", "signature": "def setUpClass(cls)" }, { "docstring": "Test that an admin user can disable ...
2
stack_v2_sparse_classes_30k_train_052020
Implement the Python class `HostActionsAdminTest` described below. Class description: Implement the HostActionsAdminTest class. Method signatures and docstrings: - def setUpClass(cls): Perform actions that setup the necessary resources for testing The following data is generated during this setup: - A list of hosts -...
Implement the Python class `HostActionsAdminTest` described below. Class description: Implement the HostActionsAdminTest class. Method signatures and docstrings: - def setUpClass(cls): Perform actions that setup the necessary resources for testing The following data is generated during this setup: - A list of hosts -...
30f0e64672676c3f90b4a582fe90fac6621475b3
<|skeleton|> class HostActionsAdminTest: def setUpClass(cls): """Perform actions that setup the necessary resources for testing The following data is generated during this setup: - A list of hosts - The host name of a compute host""" <|body_0|> def test_disable_host(self): """Test that...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HostActionsAdminTest: def setUpClass(cls): """Perform actions that setup the necessary resources for testing The following data is generated during this setup: - A list of hosts - The host name of a compute host""" super(HostActionsAdminTest, cls).setUpClass() cls.hosts = cls.admin_hos...
the_stack_v2_python_sparse
cloudroast/compute/admin_api/hosts/test_host_actions.py
RULCSoft/cloudroast
train
1
5b34fb0f9c7ab3340df6ab0619bf230c5dcc91d3
[ "srpm_name = self._project_definition.srpm_name or project_name\nif srpm_name.startswith('python-') or srpm_name.startswith('python2-') or srpm_name.startswith('python3-'):\n _, _, srpm_name = srpm_name.partition('-')\nfilenames_glob = '{0:s}-*{1!s}-1.src.rpm'.format(srpm_name, project_version)\nfilenames_glob =...
<|body_start_0|> srpm_name = self._project_definition.srpm_name or project_name if srpm_name.startswith('python-') or srpm_name.startswith('python2-') or srpm_name.startswith('python3-'): _, _, srpm_name = srpm_name.partition('-') filenames_glob = '{0:s}-*{1!s}-1.src.rpm'.format(srpm...
Helper to build source RPM packages (.src.rpm).
SRPMBuildHelper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SRPMBuildHelper: """Helper to build source RPM packages (.src.rpm).""" def _MoveRPMs(self, project_name, project_version): """Moves the rpms from the rpmbuild directory into the current directory. Args: project_name (str): name of the project. project_version (str): version of the pr...
stack_v2_sparse_classes_75kplus_train_000219
27,125
permissive
[ { "docstring": "Moves the rpms from the rpmbuild directory into the current directory. Args: project_name (str): name of the project. project_version (str): version of the project.", "name": "_MoveRPMs", "signature": "def _MoveRPMs(self, project_name, project_version)" }, { "docstring": "Removes...
4
null
Implement the Python class `SRPMBuildHelper` described below. Class description: Helper to build source RPM packages (.src.rpm). Method signatures and docstrings: - def _MoveRPMs(self, project_name, project_version): Moves the rpms from the rpmbuild directory into the current directory. Args: project_name (str): name...
Implement the Python class `SRPMBuildHelper` described below. Class description: Helper to build source RPM packages (.src.rpm). Method signatures and docstrings: - def _MoveRPMs(self, project_name, project_version): Moves the rpms from the rpmbuild directory into the current directory. Args: project_name (str): name...
34709706cc3bee84db45883043b9dfc1811ba65b
<|skeleton|> class SRPMBuildHelper: """Helper to build source RPM packages (.src.rpm).""" def _MoveRPMs(self, project_name, project_version): """Moves the rpms from the rpmbuild directory into the current directory. Args: project_name (str): name of the project. project_version (str): version of the pr...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SRPMBuildHelper: """Helper to build source RPM packages (.src.rpm).""" def _MoveRPMs(self, project_name, project_version): """Moves the rpms from the rpmbuild directory into the current directory. Args: project_name (str): name of the project. project_version (str): version of the project.""" ...
the_stack_v2_python_sparse
l2tdevtools/build_helpers/rpm.py
log2timeline/l2tdevtools
train
7
69dc2a79424eeff834d1ab01797bba91455f5304
[ "super().__init__(parent)\nself.parent = parent\nself.setViewMode(QListView.ViewMode.IconMode)\nself.setTextElideMode(Qt.TextElideMode.ElideMiddle)\nself.setResizeMode(QListView.ResizeMode.Adjust)\nself.setGridSize(QSize(110, 110))\nself.setLayoutMode(QListView.LayoutMode.Batched)\nself.setBatchSize(20)\nself.setSe...
<|body_start_0|> super().__init__(parent) self.parent = parent self.setViewMode(QListView.ViewMode.IconMode) self.setTextElideMode(Qt.TextElideMode.ElideMiddle) self.setResizeMode(QListView.ResizeMode.Adjust) self.setGridSize(QSize(110, 110)) self.setLayoutMode(QL...
ImageViewerListWidget
[ "GPL-3.0-only", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageViewerListWidget: def __init__(self, parent): """Subclassed QListWidget that displays images""" <|body_0|> def contextMenuEvent(self, event): """A simple context menu for managing images.""" <|body_1|> <|end_skeleton|> <|body_start_0|> super()....
stack_v2_sparse_classes_75kplus_train_000220
1,542
permissive
[ { "docstring": "Subclassed QListWidget that displays images", "name": "__init__", "signature": "def __init__(self, parent)" }, { "docstring": "A simple context menu for managing images.", "name": "contextMenuEvent", "signature": "def contextMenuEvent(self, event)" } ]
2
stack_v2_sparse_classes_30k_train_034725
Implement the Python class `ImageViewerListWidget` described below. Class description: Implement the ImageViewerListWidget class. Method signatures and docstrings: - def __init__(self, parent): Subclassed QListWidget that displays images - def contextMenuEvent(self, event): A simple context menu for managing images.
Implement the Python class `ImageViewerListWidget` described below. Class description: Implement the ImageViewerListWidget class. Method signatures and docstrings: - def __init__(self, parent): Subclassed QListWidget that displays images - def contextMenuEvent(self, event): A simple context menu for managing images. ...
6edbecdb422b10881216c310e70796c5cc3c9d04
<|skeleton|> class ImageViewerListWidget: def __init__(self, parent): """Subclassed QListWidget that displays images""" <|body_0|> def contextMenuEvent(self, event): """A simple context menu for managing images.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ImageViewerListWidget: def __init__(self, parent): """Subclassed QListWidget that displays images""" super().__init__(parent) self.parent = parent self.setViewMode(QListView.ViewMode.IconMode) self.setTextElideMode(Qt.TextElideMode.ElideMiddle) self.setResizeMod...
the_stack_v2_python_sparse
Chapter02/ImageManager/image_manager/widgets/image_viewer.py
ralex1975/Building-Custom-UIs-with-PyQt
train
1
956370ddb088fde14ea6fc37df3274196b3ae7c1
[ "if model._meta.app_label == 'auth':\n return 'default'\nreturn None", "if model._meta.app_label == 'auth':\n return 'default'\nreturn None", "if obj1._meta.app_label == 'auth' or obj2._meta.app_label == 'auth':\n return True\nreturn None", "if app_label == 'auth':\n return db == 'default'\nreturn...
<|body_start_0|> if model._meta.app_label == 'auth': return 'default' return None <|end_body_0|> <|body_start_1|> if model._meta.app_label == 'auth': return 'default' return None <|end_body_1|> <|body_start_2|> if obj1._meta.app_label == 'auth' or obj2._...
A router to control all database operations on models in the auth application.
AuthRouter
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuthRouter: """A router to control all database operations on models in the auth application.""" def db_for_read(self, model, **hints): """Attempts to read auth models go to default.""" <|body_0|> def db_for_write(self, model, **hints): """Attempts to write auth ...
stack_v2_sparse_classes_75kplus_train_000221
5,114
permissive
[ { "docstring": "Attempts to read auth models go to default.", "name": "db_for_read", "signature": "def db_for_read(self, model, **hints)" }, { "docstring": "Attempts to write auth models go to default.", "name": "db_for_write", "signature": "def db_for_write(self, model, **hints)" }, ...
4
stack_v2_sparse_classes_30k_train_007481
Implement the Python class `AuthRouter` described below. Class description: A router to control all database operations on models in the auth application. Method signatures and docstrings: - def db_for_read(self, model, **hints): Attempts to read auth models go to default. - def db_for_write(self, model, **hints): At...
Implement the Python class `AuthRouter` described below. Class description: A router to control all database operations on models in the auth application. Method signatures and docstrings: - def db_for_read(self, model, **hints): Attempts to read auth models go to default. - def db_for_write(self, model, **hints): At...
0d6fdfffb91fb37f40ddcf76f86259bc948694ab
<|skeleton|> class AuthRouter: """A router to control all database operations on models in the auth application.""" def db_for_read(self, model, **hints): """Attempts to read auth models go to default.""" <|body_0|> def db_for_write(self, model, **hints): """Attempts to write auth ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AuthRouter: """A router to control all database operations on models in the auth application.""" def db_for_read(self, model, **hints): """Attempts to read auth models go to default.""" if model._meta.app_label == 'auth': return 'default' return None def db_for_wr...
the_stack_v2_python_sparse
home/resources.py
ahoazure/aho-stage-nopenid
train
0
b78a2a6a71fee8702b26c263ecfe24105e8d4f4a
[ "for i in range(9):\n nums = [0] * 10\n for j in range(9):\n if board[i][j] != '.':\n a = int(board[i][j])\n nums[a] += 1\n if nums[a] > 1:\n return False\nfor j in range(9):\n nums = [0] * 10\n for i in range(9):\n if board[i][j] != '.':\n ...
<|body_start_0|> for i in range(9): nums = [0] * 10 for j in range(9): if board[i][j] != '.': a = int(board[i][j]) nums[a] += 1 if nums[a] > 1: return False for j in range(9): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isValidSudoku(self, board): """:type board: List[List[str]] :rtype: bool""" <|body_0|> def isValidSudoku2(self, board): """:type board: List[List[str]] :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> for i in range(9): ...
stack_v2_sparse_classes_75kplus_train_000222
1,878
no_license
[ { "docstring": ":type board: List[List[str]] :rtype: bool", "name": "isValidSudoku", "signature": "def isValidSudoku(self, board)" }, { "docstring": ":type board: List[List[str]] :rtype: bool", "name": "isValidSudoku2", "signature": "def isValidSudoku2(self, board)" } ]
2
stack_v2_sparse_classes_30k_train_049085
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValidSudoku(self, board): :type board: List[List[str]] :rtype: bool - def isValidSudoku2(self, board): :type board: List[List[str]] :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValidSudoku(self, board): :type board: List[List[str]] :rtype: bool - def isValidSudoku2(self, board): :type board: List[List[str]] :rtype: bool <|skeleton|> class Solutio...
0fc972e5cd2baf1b5ddf8b192962629f40bc3bf4
<|skeleton|> class Solution: def isValidSudoku(self, board): """:type board: List[List[str]] :rtype: bool""" <|body_0|> def isValidSudoku2(self, board): """:type board: List[List[str]] :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def isValidSudoku(self, board): """:type board: List[List[str]] :rtype: bool""" for i in range(9): nums = [0] * 10 for j in range(9): if board[i][j] != '.': a = int(board[i][j]) nums[a] += 1 ...
the_stack_v2_python_sparse
problems/36. Valid Sudoku.py
yukiii-zhong/Leetcode
train
2
53c915539e58e2e50d7efc0cec9cb7e7344b37b2
[ "self.fds = fds\nself.polling = select.poll()\nfor fd in fds:\n self.polling.register(fd, select.POLLIN)", "for fd in fds:\n self.polling.unregister(fd)\n self.fds.remove(fd)", "changed = self.polling.poll(timeout * 1000)\nfor fd, event in changed:\n log.debug('event on fd %i is %#o', fd, event)\n ...
<|body_start_0|> self.fds = fds self.polling = select.poll() for fd in fds: self.polling.register(fd, select.POLLIN) <|end_body_0|> <|body_start_1|> for fd in fds: self.polling.unregister(fd) self.fds.remove(fd) <|end_body_1|> <|body_start_2|> ...
Read from file descriptors with timeout.
PollingReader
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PollingReader: """Read from file descriptors with timeout.""" def __init__(self, fds): """Initialize.""" <|body_0|> def unregister(self, fds): """Unregister descriptors.""" <|body_1|> def read(self, timeout=-1): """Read with an optional timeo...
stack_v2_sparse_classes_75kplus_train_000223
8,473
permissive
[ { "docstring": "Initialize.", "name": "__init__", "signature": "def __init__(self, fds)" }, { "docstring": "Unregister descriptors.", "name": "unregister", "signature": "def unregister(self, fds)" }, { "docstring": "Read with an optional timeout.", "name": "read", "signat...
3
stack_v2_sparse_classes_30k_train_005550
Implement the Python class `PollingReader` described below. Class description: Read from file descriptors with timeout. Method signatures and docstrings: - def __init__(self, fds): Initialize. - def unregister(self, fds): Unregister descriptors. - def read(self, timeout=-1): Read with an optional timeout.
Implement the Python class `PollingReader` described below. Class description: Read from file descriptors with timeout. Method signatures and docstrings: - def __init__(self, fds): Initialize. - def unregister(self, fds): Unregister descriptors. - def read(self, timeout=-1): Read with an optional timeout. <|skeleton...
79e5ac3a6f267dcdc2179fc1a7c49504bafb6e0f
<|skeleton|> class PollingReader: """Read from file descriptors with timeout.""" def __init__(self, fds): """Initialize.""" <|body_0|> def unregister(self, fds): """Unregister descriptors.""" <|body_1|> def read(self, timeout=-1): """Read with an optional timeo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PollingReader: """Read from file descriptors with timeout.""" def __init__(self, fds): """Initialize.""" self.fds = fds self.polling = select.poll() for fd in fds: self.polling.register(fd, select.POLLIN) def unregister(self, fds): """Unregister de...
the_stack_v2_python_sparse
src/python/cargo/unix/accounting.py
borg-project/cargo
train
1
941e98ff07461e22740d71915559cf01b78e7686
[ "self.enter_mtz()\nself.myClick(self.find_element('累计奖金', *self.TOTAL_MONEY_ID))\nself.check_bill()", "self.enter_mtz()\nself.myClick(self.find_element('累计奖金', *self.TOTAL_MONEY_ID))\nself.check_mtz_rhz()", "self.enter_mtz()\nself.myClick(self.find_element('累计奖金', *self.TOTAL_MONEY_ID))\nself.myClick(self.swipe...
<|body_start_0|> self.enter_mtz() self.myClick(self.find_element('累计奖金', *self.TOTAL_MONEY_ID)) self.check_bill() <|end_body_0|> <|body_start_1|> self.enter_mtz() self.myClick(self.find_element('累计奖金', *self.TOTAL_MONEY_ID)) self.check_mtz_rhz() <|end_body_1|> <|body_st...
TotalMoney
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TotalMoney: def test_mtz_bill(self): """萌团长_累计奖金_账单""" <|body_0|> def test_mtz_rhz(self): """萌团长_累计奖金_萌团长如何赚""" <|body_1|> def test_tx_buy_gift(self): """萌团长_累计奖金_购买礼包可提现_立即购买""" <|body_2|> def test_kd_income(self): """萌团长_[总...
stack_v2_sparse_classes_75kplus_train_000224
3,050
no_license
[ { "docstring": "萌团长_累计奖金_账单", "name": "test_mtz_bill", "signature": "def test_mtz_bill(self)" }, { "docstring": "萌团长_累计奖金_萌团长如何赚", "name": "test_mtz_rhz", "signature": "def test_mtz_rhz(self)" }, { "docstring": "萌团长_累计奖金_购买礼包可提现_立即购买", "name": "test_tx_buy_gift", "signatu...
4
stack_v2_sparse_classes_30k_val_000787
Implement the Python class `TotalMoney` described below. Class description: Implement the TotalMoney class. Method signatures and docstrings: - def test_mtz_bill(self): 萌团长_累计奖金_账单 - def test_mtz_rhz(self): 萌团长_累计奖金_萌团长如何赚 - def test_tx_buy_gift(self): 萌团长_累计奖金_购买礼包可提现_立即购买 - def test_kd_income(self): 萌团长_[总收入|开店收入|萌...
Implement the Python class `TotalMoney` described below. Class description: Implement the TotalMoney class. Method signatures and docstrings: - def test_mtz_bill(self): 萌团长_累计奖金_账单 - def test_mtz_rhz(self): 萌团长_累计奖金_萌团长如何赚 - def test_tx_buy_gift(self): 萌团长_累计奖金_购买礼包可提现_立即购买 - def test_kd_income(self): 萌团长_[总收入|开店收入|萌...
b2066139eb0723eff69d971589b283b4b776c84c
<|skeleton|> class TotalMoney: def test_mtz_bill(self): """萌团长_累计奖金_账单""" <|body_0|> def test_mtz_rhz(self): """萌团长_累计奖金_萌团长如何赚""" <|body_1|> def test_tx_buy_gift(self): """萌团长_累计奖金_购买礼包可提现_立即购买""" <|body_2|> def test_kd_income(self): """萌团长_[总...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TotalMoney: def test_mtz_bill(self): """萌团长_累计奖金_账单""" self.enter_mtz() self.myClick(self.find_element('累计奖金', *self.TOTAL_MONEY_ID)) self.check_bill() def test_mtz_rhz(self): """萌团长_累计奖金_萌团长如何赚""" self.enter_mtz() self.myClick(self.find_element('累计...
the_stack_v2_python_sparse
TestCase/4_5/TC_Meng_TZ/test_total_money.py
testerSunshine/auto_md
train
4
ac0b4069aaddb2b98353d623801f7800b2545b9f
[ "index = (y * framebuf.stride + x) // 8\noffset = 7 - x & 7\nframebuf.buf[index] = framebuf.buf[index] & ~(1 << offset) | (color != 0) << offset", "index = (y * framebuf.stride + x) // 8\noffset = 7 - x & 7\nreturn framebuf.buf[index] >> offset & 1", "for _x in range(x, x + width):\n offset = 7 - _x & 7\n ...
<|body_start_0|> index = (y * framebuf.stride + x) // 8 offset = 7 - x & 7 framebuf.buf[index] = framebuf.buf[index] & ~(1 << offset) | (color != 0) << offset <|end_body_0|> <|body_start_1|> index = (y * framebuf.stride + x) // 8 offset = 7 - x & 7 return framebuf.buf[in...
MHMSBFormat
MHMSBFormat
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MHMSBFormat: """MHMSBFormat""" def set_pixel(framebuf, x, y, color): """Set a given pixel to a color.""" <|body_0|> def get_pixel(framebuf, x, y): """Get the color of a given pixel""" <|body_1|> def fill_rect(framebuf, x, y, width, height, color): ...
stack_v2_sparse_classes_75kplus_train_000225
10,632
no_license
[ { "docstring": "Set a given pixel to a color.", "name": "set_pixel", "signature": "def set_pixel(framebuf, x, y, color)" }, { "docstring": "Get the color of a given pixel", "name": "get_pixel", "signature": "def get_pixel(framebuf, x, y)" }, { "docstring": "Draw a rectangle at th...
3
stack_v2_sparse_classes_30k_val_001668
Implement the Python class `MHMSBFormat` described below. Class description: MHMSBFormat Method signatures and docstrings: - def set_pixel(framebuf, x, y, color): Set a given pixel to a color. - def get_pixel(framebuf, x, y): Get the color of a given pixel - def fill_rect(framebuf, x, y, width, height, color): Draw a...
Implement the Python class `MHMSBFormat` described below. Class description: MHMSBFormat Method signatures and docstrings: - def set_pixel(framebuf, x, y, color): Set a given pixel to a color. - def get_pixel(framebuf, x, y): Get the color of a given pixel - def fill_rect(framebuf, x, y, width, height, color): Draw a...
78cdde343961ba4a2f1b9e0833540f1b20b18bfc
<|skeleton|> class MHMSBFormat: """MHMSBFormat""" def set_pixel(framebuf, x, y, color): """Set a given pixel to a color.""" <|body_0|> def get_pixel(framebuf, x, y): """Get the color of a given pixel""" <|body_1|> def fill_rect(framebuf, x, y, width, height, color): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MHMSBFormat: """MHMSBFormat""" def set_pixel(framebuf, x, y, color): """Set a given pixel to a color.""" index = (y * framebuf.stride + x) // 8 offset = 7 - x & 7 framebuf.buf[index] = framebuf.buf[index] & ~(1 << offset) | (color != 0) << offset def get_pixel(framebu...
the_stack_v2_python_sparse
led_matrix/framebuf.py
ben-64/led_matrix
train
0
91fca4b71a037cdf4a0718254f7d6ce3947e93a9
[ "aliases = []\ntry:\n aliases = sr.translate_alias(seqid)\nexcept KeyError as e:\n logger.warning(f'SeqRepo raised KeyError: {e}')\nreturn aliases", "location = dict()\naliases = self.get_aliases(sr, seqid)\nif not aliases:\n return location\nsequence_id = [a for a in aliases if a.startswith('ga4gh')][0]...
<|body_start_0|> aliases = [] try: aliases = sr.translate_alias(seqid) except KeyError as e: logger.warning(f'SeqRepo raised KeyError: {e}') return aliases <|end_body_0|> <|body_start_1|> location = dict() aliases = self.get_aliases(sr, seqid) ...
The class for GA4GH Sequence Location.
SequenceLocation
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SequenceLocation: """The class for GA4GH Sequence Location.""" def get_aliases(self, sr: SeqRepo, seqid: str) -> List[str]: """Get aliases for a sequence id :param sr: seqrepo instance :param seqid: Sequence ID accession :return: List of aliases for seqid""" <|body_0|> d...
stack_v2_sparse_classes_75kplus_train_000226
1,994
permissive
[ { "docstring": "Get aliases for a sequence id :param sr: seqrepo instance :param seqid: Sequence ID accession :return: List of aliases for seqid", "name": "get_aliases", "signature": "def get_aliases(self, sr: SeqRepo, seqid: str) -> List[str]" }, { "docstring": "Get a gene's Sequence Location. ...
2
stack_v2_sparse_classes_30k_train_052388
Implement the Python class `SequenceLocation` described below. Class description: The class for GA4GH Sequence Location. Method signatures and docstrings: - def get_aliases(self, sr: SeqRepo, seqid: str) -> List[str]: Get aliases for a sequence id :param sr: seqrepo instance :param seqid: Sequence ID accession :retur...
Implement the Python class `SequenceLocation` described below. Class description: The class for GA4GH Sequence Location. Method signatures and docstrings: - def get_aliases(self, sr: SeqRepo, seqid: str) -> List[str]: Get aliases for a sequence id :param sr: seqrepo instance :param seqid: Sequence ID accession :retur...
bd9fcf391b8cc165054966ecec75083299afa5a6
<|skeleton|> class SequenceLocation: """The class for GA4GH Sequence Location.""" def get_aliases(self, sr: SeqRepo, seqid: str) -> List[str]: """Get aliases for a sequence id :param sr: seqrepo instance :param seqid: Sequence ID accession :return: List of aliases for seqid""" <|body_0|> d...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SequenceLocation: """The class for GA4GH Sequence Location.""" def get_aliases(self, sr: SeqRepo, seqid: str) -> List[str]: """Get aliases for a sequence id :param sr: seqrepo instance :param seqid: Sequence ID accession :return: List of aliases for seqid""" aliases = [] try: ...
the_stack_v2_python_sparse
gene/etl/vrs_locations/sequence_location.py
cancervariants/gene-normalization
train
1
3a8b2f25b2ede5a50ac79f6478866acedd225294
[ "self.content_type = content_type\nself.s3_uri = s3_uri\nself.content_digest = content_digest", "file_source_request = {'S3Uri': self.s3_uri}\nif self.content_digest is not None:\n file_source_request['ContentDigest'] = self.content_digest\nif self.content_type is not None:\n file_source_request['ContentTyp...
<|body_start_0|> self.content_type = content_type self.s3_uri = s3_uri self.content_digest = content_digest <|end_body_0|> <|body_start_1|> file_source_request = {'S3Uri': self.s3_uri} if self.content_digest is not None: file_source_request['ContentDigest'] = self.co...
Accepts file source parameters for conversion to request dict.
FileSource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileSource: """Accepts file source parameters for conversion to request dict.""" def __init__(self, s3_uri: Union[str, PipelineVariable], content_digest: Optional[Union[str, PipelineVariable]]=None, content_type: Optional[Union[str, PipelineVariable]]=None): """Initialize a ``FileSou...
stack_v2_sparse_classes_75kplus_train_000227
7,143
permissive
[ { "docstring": "Initialize a ``FileSource`` instance and turn parameters into dict. Args: s3_uri (str or PipelineVariable): The S3 URI of the metric content_digest (str or PipelineVariable): The digest of the metric (default: None) content_type (str or PipelineVariable): Specifies the type of content in S3 URI ...
2
stack_v2_sparse_classes_30k_train_000950
Implement the Python class `FileSource` described below. Class description: Accepts file source parameters for conversion to request dict. Method signatures and docstrings: - def __init__(self, s3_uri: Union[str, PipelineVariable], content_digest: Optional[Union[str, PipelineVariable]]=None, content_type: Optional[Un...
Implement the Python class `FileSource` described below. Class description: Accepts file source parameters for conversion to request dict. Method signatures and docstrings: - def __init__(self, s3_uri: Union[str, PipelineVariable], content_digest: Optional[Union[str, PipelineVariable]]=None, content_type: Optional[Un...
8d5d7fd8ae1a917ed3e2b988d5e533bce244fd85
<|skeleton|> class FileSource: """Accepts file source parameters for conversion to request dict.""" def __init__(self, s3_uri: Union[str, PipelineVariable], content_digest: Optional[Union[str, PipelineVariable]]=None, content_type: Optional[Union[str, PipelineVariable]]=None): """Initialize a ``FileSou...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FileSource: """Accepts file source parameters for conversion to request dict.""" def __init__(self, s3_uri: Union[str, PipelineVariable], content_digest: Optional[Union[str, PipelineVariable]]=None, content_type: Optional[Union[str, PipelineVariable]]=None): """Initialize a ``FileSource`` instanc...
the_stack_v2_python_sparse
src/sagemaker/model_metrics.py
aws/sagemaker-python-sdk
train
2,050
eaa3e55250c0373bdc3608a67fc7cd22ad178c92
[ "payload = json.dumps(kwargs)\nheaders = {'Content-Type': 'application/json'}\nresponse = requests.post(url=SUBMIT_SOURCE, data=payload, headers=headers)\nreturn response", "if 'query' in kwargs.keys():\n payload = json.dumps(kwargs['query'])\nelse:\n payload = []\nheaders = {'Content-Type': 'application/js...
<|body_start_0|> payload = json.dumps(kwargs) headers = {'Content-Type': 'application/json'} response = requests.post(url=SUBMIT_SOURCE, data=payload, headers=headers) return response <|end_body_0|> <|body_start_1|> if 'query' in kwargs.keys(): payload = json.dumps(k...
This Python Object is used to call AnalEyeZer APIs
AnalEyeZerClient
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnalEyeZerClient: """This Python Object is used to call AnalEyeZer APIs""" def commit_data_source(**kwargs): """This function is used to commit data sources to AnalEyeZer :param kwargs: provided kwargs :return: None""" <|body_0|> def ask_analeyezer(**kwargs): """...
stack_v2_sparse_classes_75kplus_train_000228
2,904
permissive
[ { "docstring": "This function is used to commit data sources to AnalEyeZer :param kwargs: provided kwargs :return: None", "name": "commit_data_source", "signature": "def commit_data_source(**kwargs)" }, { "docstring": "This function is used to match courses data :param kwargs: provided kwargs :r...
3
null
Implement the Python class `AnalEyeZerClient` described below. Class description: This Python Object is used to call AnalEyeZer APIs Method signatures and docstrings: - def commit_data_source(**kwargs): This function is used to commit data sources to AnalEyeZer :param kwargs: provided kwargs :return: None - def ask_a...
Implement the Python class `AnalEyeZerClient` described below. Class description: This Python Object is used to call AnalEyeZer APIs Method signatures and docstrings: - def commit_data_source(**kwargs): This function is used to commit data sources to AnalEyeZer :param kwargs: provided kwargs :return: None - def ask_a...
c9e2f39aa1e433b4aa73bdba62b0c67489ce015e
<|skeleton|> class AnalEyeZerClient: """This Python Object is used to call AnalEyeZer APIs""" def commit_data_source(**kwargs): """This function is used to commit data sources to AnalEyeZer :param kwargs: provided kwargs :return: None""" <|body_0|> def ask_analeyezer(**kwargs): """...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AnalEyeZerClient: """This Python Object is used to call AnalEyeZer APIs""" def commit_data_source(**kwargs): """This function is used to commit data sources to AnalEyeZer :param kwargs: provided kwargs :return: None""" payload = json.dumps(kwargs) headers = {'Content-Type': 'appli...
the_stack_v2_python_sparse
app/clients/analeyezer.py
kapsali29/course-recommender
train
0
3aa288bcb6ff8ca58a13eb63fec9961fb2fe910e
[ "prog = sf.Program(1)\nG = G(A)\nwith prog.context:\n G | 0\n G.H | 0\nprog.optimize()\nassert len(prog) == 0", "prog = sf.Program(1)\nG1 = G(A)\nG2 = G(-A)\nwith prog.context:\n G1 | 0\n G2 | 0\nprog.optimize()\nassert len(prog) == 0", "prog = sf.Program(3)\nwith prog.context:\n for G in permute...
<|body_start_0|> prog = sf.Program(1) G = G(A) with prog.context: G | 0 G.H | 0 prog.optimize() assert len(prog) == 0 <|end_body_0|> <|body_start_1|> prog = sf.Program(1) G1 = G(A) G2 = G(-A) with prog.context: ...
Tests for the Program optimizer
TestOptimizer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestOptimizer: """Tests for the Program optimizer""" def test_merge_dagger(self, G): """Optimizer merging single-mode gates with their daggered versions.""" <|body_0|> def test_merge_negated(self, G): """Optimizer merging single-mode gates with their negated vers...
stack_v2_sparse_classes_75kplus_train_000229
19,472
permissive
[ { "docstring": "Optimizer merging single-mode gates with their daggered versions.", "name": "test_merge_dagger", "signature": "def test_merge_dagger(self, G)" }, { "docstring": "Optimizer merging single-mode gates with their negated versions.", "name": "test_merge_negated", "signature": ...
6
stack_v2_sparse_classes_30k_train_054197
Implement the Python class `TestOptimizer` described below. Class description: Tests for the Program optimizer Method signatures and docstrings: - def test_merge_dagger(self, G): Optimizer merging single-mode gates with their daggered versions. - def test_merge_negated(self, G): Optimizer merging single-mode gates wi...
Implement the Python class `TestOptimizer` described below. Class description: Tests for the Program optimizer Method signatures and docstrings: - def test_merge_dagger(self, G): Optimizer merging single-mode gates with their daggered versions. - def test_merge_negated(self, G): Optimizer merging single-mode gates wi...
0c1c805fd5dfce465a8955ee3faf81037023a23e
<|skeleton|> class TestOptimizer: """Tests for the Program optimizer""" def test_merge_dagger(self, G): """Optimizer merging single-mode gates with their daggered versions.""" <|body_0|> def test_merge_negated(self, G): """Optimizer merging single-mode gates with their negated vers...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestOptimizer: """Tests for the Program optimizer""" def test_merge_dagger(self, G): """Optimizer merging single-mode gates with their daggered versions.""" prog = sf.Program(1) G = G(A) with prog.context: G | 0 G.H | 0 prog.optimize() ...
the_stack_v2_python_sparse
artifacts/old_dataset_versions/original_commits_backup/strawberryfields/strawberryfields#90/after/test_program.py
MattePalte/Bugs-Quantum-Computing-Platforms
train
4
023002a811f4459b41e46faa569f97465bc22d32
[ "ones = 0\ntwos = 0\nfor i in nums:\n ones = (ones ^ i) & ~twos\n twos = (twos ^ i) & ~ones\nreturn ones", "ans = 0\nfor bit in range(32):\n sum = 0\n for i in nums:\n if i >> bit & 1:\n sum += 1\n if sum % 3:\n ans |= sum << bit\nreturn ans" ]
<|body_start_0|> ones = 0 twos = 0 for i in nums: ones = (ones ^ i) & ~twos twos = (twos ^ i) & ~ones return ones <|end_body_0|> <|body_start_1|> ans = 0 for bit in range(32): sum = 0 for i in nums: if i >> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def singleNumber(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def singleNumberByCountingBits(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> ones = 0 twos = 0 ...
stack_v2_sparse_classes_75kplus_train_000230
626
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "singleNumber", "signature": "def singleNumber(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "singleNumberByCountingBits", "signature": "def singleNumberByCountingBits(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def singleNumber(self, nums): :type nums: List[int] :rtype: int - def singleNumberByCountingBits(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def singleNumber(self, nums): :type nums: List[int] :rtype: int - def singleNumberByCountingBits(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: ...
964777d8906248e83096b83499c5cee6382182d1
<|skeleton|> class Solution: def singleNumber(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def singleNumberByCountingBits(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def singleNumber(self, nums): """:type nums: List[int] :rtype: int""" ones = 0 twos = 0 for i in nums: ones = (ones ^ i) & ~twos twos = (twos ^ i) & ~ones return ones def singleNumberByCountingBits(self, nums): """:type num...
the_stack_v2_python_sparse
SingleNumber2/solution.py
Fischer-L/Puzzles
train
1
820a1c1b0746a268b76e0c30e3f0af9576919055
[ "super(LoadDatasetConfiguration, self).__init__(**kwargs)\nself.division = None\nself.shuffle = True\nself.set_necessary_configs(**kwargs)\nself.set_unnecessary_configs(**kwargs)", "try:\n self.batch_size = kwargs['batch_size']\nexcept Exception as e:\n raise Exception('necessary configs error in load confi...
<|body_start_0|> super(LoadDatasetConfiguration, self).__init__(**kwargs) self.division = None self.shuffle = True self.set_necessary_configs(**kwargs) self.set_unnecessary_configs(**kwargs) <|end_body_0|> <|body_start_1|> try: self.batch_size = kwargs['batch...
class that stores dataset loading related configuration
LoadDatasetConfiguration
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoadDatasetConfiguration: """class that stores dataset loading related configuration""" def __init__(self, **kwargs): """initialize settings""" <|body_0|> def set_necessary_configs(self, **kwargs): """set load configs that necessarily provided by user""" ...
stack_v2_sparse_classes_75kplus_train_000231
3,847
no_license
[ { "docstring": "initialize settings", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "set load configs that necessarily provided by user", "name": "set_necessary_configs", "signature": "def set_necessary_configs(self, **kwargs)" }, { "docstring"...
3
stack_v2_sparse_classes_30k_train_054431
Implement the Python class `LoadDatasetConfiguration` described below. Class description: class that stores dataset loading related configuration Method signatures and docstrings: - def __init__(self, **kwargs): initialize settings - def set_necessary_configs(self, **kwargs): set load configs that necessarily provide...
Implement the Python class `LoadDatasetConfiguration` described below. Class description: class that stores dataset loading related configuration Method signatures and docstrings: - def __init__(self, **kwargs): initialize settings - def set_necessary_configs(self, **kwargs): set load configs that necessarily provide...
b0e8f66b3ade742445a41d3d5667032a931d94d2
<|skeleton|> class LoadDatasetConfiguration: """class that stores dataset loading related configuration""" def __init__(self, **kwargs): """initialize settings""" <|body_0|> def set_necessary_configs(self, **kwargs): """set load configs that necessarily provided by user""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LoadDatasetConfiguration: """class that stores dataset loading related configuration""" def __init__(self, **kwargs): """initialize settings""" super(LoadDatasetConfiguration, self).__init__(**kwargs) self.division = None self.shuffle = True self.set_necessary_conf...
the_stack_v2_python_sparse
config/dataset_config.py
wz139704646/MBRL_on_VAEs
train
1
edc068beb70574c17a8d78a610725f5d927cd693
[ "from readthedocs.organizations.models import Organization\nfrom readthedocs.projects.models import Project\nif isinstance(obj, Project):\n organization = obj.organizations.first()\nelif isinstance(obj, Organization):\n organization = obj\nelse:\n raise TypeError\nfeature = self.filter(feature_type=type, p...
<|body_start_0|> from readthedocs.organizations.models import Organization from readthedocs.projects.models import Project if isinstance(obj, Project): organization = obj.organizations.first() elif isinstance(obj, Organization): organization = obj else: ...
Model manager for PlanFeature.
PlanFeatureManager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PlanFeatureManager: """Model manager for PlanFeature.""" def get_feature(self, obj, type): """Get feature `type` for `obj`. :param obj: An organization or project instance. :param type: The type of the feature (readthedocs.subscriptions.constants.TYPE_*). :returns: A PlanFeature obje...
stack_v2_sparse_classes_75kplus_train_000232
9,120
permissive
[ { "docstring": "Get feature `type` for `obj`. :param obj: An organization or project instance. :param type: The type of the feature (readthedocs.subscriptions.constants.TYPE_*). :returns: A PlanFeature object or None.", "name": "get_feature", "signature": "def get_feature(self, obj, type)" }, { ...
3
stack_v2_sparse_classes_30k_train_025873
Implement the Python class `PlanFeatureManager` described below. Class description: Model manager for PlanFeature. Method signatures and docstrings: - def get_feature(self, obj, type): Get feature `type` for `obj`. :param obj: An organization or project instance. :param type: The type of the feature (readthedocs.subs...
Implement the Python class `PlanFeatureManager` described below. Class description: Model manager for PlanFeature. Method signatures and docstrings: - def get_feature(self, obj, type): Get feature `type` for `obj`. :param obj: An organization or project instance. :param type: The type of the feature (readthedocs.subs...
9b968ab2ed84bfe569a4063bd538710c6f91e64b
<|skeleton|> class PlanFeatureManager: """Model manager for PlanFeature.""" def get_feature(self, obj, type): """Get feature `type` for `obj`. :param obj: An organization or project instance. :param type: The type of the feature (readthedocs.subscriptions.constants.TYPE_*). :returns: A PlanFeature obje...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PlanFeatureManager: """Model manager for PlanFeature.""" def get_feature(self, obj, type): """Get feature `type` for `obj`. :param obj: An organization or project instance. :param type: The type of the feature (readthedocs.subscriptions.constants.TYPE_*). :returns: A PlanFeature object or None.""...
the_stack_v2_python_sparse
readthedocs/subscriptions/managers.py
manhhomienbienthuy/readthedocs.org
train
0
e41166b3c962e369f1d4b50be2637ef4e63bb4e9
[ "files_l = []\nfor path, dirs, files in os.walk(startPath, topdown=True):\n level = path.replace(startPath, '').count(os.sep)\n indent = ' ' * 2 * level\n subindent = ' ' * 2 * (level + 1)\n for f in files:\n files_l.append(f)\n if not bSubTree:\n break\nreturn files_l", "lines_l = []...
<|body_start_0|> files_l = [] for path, dirs, files in os.walk(startPath, topdown=True): level = path.replace(startPath, '').count(os.sep) indent = ' ' * 2 * level subindent = ' ' * 2 * (level + 1) for f in files: files_l.append(f) ...
walkTrees
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class walkTrees: def listFiles(self, startPath, bSubTree=True): """Ref: https://stackoverflow.com/questions/9727673/list-directory-tree-structure-in-python :param startPath: :return:""" <|body_0|> def readLocalFile(self, filename): """Read a file in local FileSystem and re...
stack_v2_sparse_classes_75kplus_train_000233
5,258
no_license
[ { "docstring": "Ref: https://stackoverflow.com/questions/9727673/list-directory-tree-structure-in-python :param startPath: :return:", "name": "listFiles", "signature": "def listFiles(self, startPath, bSubTree=True)" }, { "docstring": "Read a file in local FileSystem and return its content as a l...
2
stack_v2_sparse_classes_30k_train_042999
Implement the Python class `walkTrees` described below. Class description: Implement the walkTrees class. Method signatures and docstrings: - def listFiles(self, startPath, bSubTree=True): Ref: https://stackoverflow.com/questions/9727673/list-directory-tree-structure-in-python :param startPath: :return: - def readLoc...
Implement the Python class `walkTrees` described below. Class description: Implement the walkTrees class. Method signatures and docstrings: - def listFiles(self, startPath, bSubTree=True): Ref: https://stackoverflow.com/questions/9727673/list-directory-tree-structure-in-python :param startPath: :return: - def readLoc...
77a568d90b23923c61956465b3e87771d31e70e7
<|skeleton|> class walkTrees: def listFiles(self, startPath, bSubTree=True): """Ref: https://stackoverflow.com/questions/9727673/list-directory-tree-structure-in-python :param startPath: :return:""" <|body_0|> def readLocalFile(self, filename): """Read a file in local FileSystem and re...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class walkTrees: def listFiles(self, startPath, bSubTree=True): """Ref: https://stackoverflow.com/questions/9727673/list-directory-tree-structure-in-python :param startPath: :return:""" files_l = [] for path, dirs, files in os.walk(startPath, topdown=True): level = path.replace(s...
the_stack_v2_python_sparse
python/libs_dev/Utils.py
Jeremy-Sung-Dev/staging
train
1
bf80e2d7b4a4bfcd0989639680bfa662157c1dfc
[ "n = len(nums)\nif n * k == 0:\n return []\nif k == 1:\n return nums\nleft, right = ([0] * n, [0] * n)\nleft[0], right[n - 1] = (nums[0], nums[n - 1])\nfor i in range(1, n):\n if i % k == 0:\n left[i] = nums[i]\n else:\n left[i] = max(left[i - 1], nums[i])\n j = n - i - 1\n if (j + 1...
<|body_start_0|> n = len(nums) if n * k == 0: return [] if k == 1: return nums left, right = ([0] * n, [0] * n) left[0], right[n - 1] = (nums[0], nums[n - 1]) for i in range(1, n): if i % k == 0: left[i] = nums[i] ...
SlidingWindow
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SlidingWindow: def get_max_from_window(self, nums: List[int], k: int) -> List[int]: """Approach: DP Time Complexity: O(N) Space Complexity: O(N) :param nums: :param k: :return:""" <|body_0|> def get_max_from_window_(self, nums: List[int], k: int) -> List[int]: """App...
stack_v2_sparse_classes_75kplus_train_000234
2,691
no_license
[ { "docstring": "Approach: DP Time Complexity: O(N) Space Complexity: O(N) :param nums: :param k: :return:", "name": "get_max_from_window", "signature": "def get_max_from_window(self, nums: List[int], k: int) -> List[int]" }, { "docstring": "Approach: Using DS Deque. Time Complexity: O(N) Space C...
2
stack_v2_sparse_classes_30k_train_016771
Implement the Python class `SlidingWindow` described below. Class description: Implement the SlidingWindow class. Method signatures and docstrings: - def get_max_from_window(self, nums: List[int], k: int) -> List[int]: Approach: DP Time Complexity: O(N) Space Complexity: O(N) :param nums: :param k: :return: - def get...
Implement the Python class `SlidingWindow` described below. Class description: Implement the SlidingWindow class. Method signatures and docstrings: - def get_max_from_window(self, nums: List[int], k: int) -> List[int]: Approach: DP Time Complexity: O(N) Space Complexity: O(N) :param nums: :param k: :return: - def get...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class SlidingWindow: def get_max_from_window(self, nums: List[int], k: int) -> List[int]: """Approach: DP Time Complexity: O(N) Space Complexity: O(N) :param nums: :param k: :return:""" <|body_0|> def get_max_from_window_(self, nums: List[int], k: int) -> List[int]: """App...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SlidingWindow: def get_max_from_window(self, nums: List[int], k: int) -> List[int]: """Approach: DP Time Complexity: O(N) Space Complexity: O(N) :param nums: :param k: :return:""" n = len(nums) if n * k == 0: return [] if k == 1: return nums left...
the_stack_v2_python_sparse
data_structures/recurrsion_dp/sliding_window.py
Shiv2157k/leet_code
train
1
85ee089229a6fc0e6b9a33338fa4c97f07653ab0
[ "params = {}\nparams['weight'] = np.random.normal(0, 0.01, (in_features, out_features))\nparams['bias'] = np.zeros(out_features)\nself.params = params\nself.grads = {}\nself.x = None\nself.out = None", "W, b = (self.params['weight'], self.params['bias'])\nself.out = np.dot(x, W) + b\nself.x = x\nreturn self.out",...
<|body_start_0|> params = {} params['weight'] = np.random.normal(0, 0.01, (in_features, out_features)) params['bias'] = np.zeros(out_features) self.params = params self.grads = {} self.x = None self.out = None <|end_body_0|> <|body_start_1|> W, b = (self....
Linear
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Linear: def __init__(self, in_features, out_features): """Module initialisation. Args: in_features: input dimension out_features: output dimension TODO 1) Initialize weights self.params['weight'] using normal distribution with mean = 0 and std = 0.0001. 2) Initialize biases self.params['...
stack_v2_sparse_classes_75kplus_train_000235
5,704
no_license
[ { "docstring": "Module initialisation. Args: in_features: input dimension out_features: output dimension TODO 1) Initialize weights self.params['weight'] using normal distribution with mean = 0 and std = 0.0001. 2) Initialize biases self.params['bias'] with 0. 3) Initialize gradients with zeros.", "name": "...
3
stack_v2_sparse_classes_30k_train_037645
Implement the Python class `Linear` described below. Class description: Implement the Linear class. Method signatures and docstrings: - def __init__(self, in_features, out_features): Module initialisation. Args: in_features: input dimension out_features: output dimension TODO 1) Initialize weights self.params['weight...
Implement the Python class `Linear` described below. Class description: Implement the Linear class. Method signatures and docstrings: - def __init__(self, in_features, out_features): Module initialisation. Args: in_features: input dimension out_features: output dimension TODO 1) Initialize weights self.params['weight...
8667f6d102ec0080a8dae6e1fbf1aff4711a616e
<|skeleton|> class Linear: def __init__(self, in_features, out_features): """Module initialisation. Args: in_features: input dimension out_features: output dimension TODO 1) Initialize weights self.params['weight'] using normal distribution with mean = 0 and std = 0.0001. 2) Initialize biases self.params['...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Linear: def __init__(self, in_features, out_features): """Module initialisation. Args: in_features: input dimension out_features: output dimension TODO 1) Initialize weights self.params['weight'] using normal distribution with mean = 0 and std = 0.0001. 2) Initialize biases self.params['bias'] with 0....
the_stack_v2_python_sparse
MLP_np/modules.py
YijinHuang/CS324-Deep-Learning
train
0
8a20b7fd1fc7b25814aeaa25dbc8d04a69b7f754
[ "clipper = self._prepare_clipper(poly)\nif not clipper:\n return []\ndifferences = clipper.Execute(pc.CT_DIFFERENCE, pc.PFT_NONZERO, pc.PFT_NONZERO)\nreturn self._process(differences)", "clipper = self._prepare_clipper(poly)\nif not clipper:\n return []\nintersections = clipper.Execute(pc.CT_INTERSECTION, p...
<|body_start_0|> clipper = self._prepare_clipper(poly) if not clipper: return [] differences = clipper.Execute(pc.CT_DIFFERENCE, pc.PFT_NONZERO, pc.PFT_NONZERO) return self._process(differences) <|end_body_0|> <|body_start_1|> clipper = self._prepare_clipper(poly) ...
This class is used to add clipping functionality to the Polygon2D class.
Clipper2D
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Clipper2D: """This class is used to add clipping functionality to the Polygon2D class.""" def difference(self, poly): """Difference from another polygon. :param poly: The clip polygon. :returns: A list of Polygons representing the difference.""" <|body_0|> def intersect(...
stack_v2_sparse_classes_75kplus_train_000236
4,612
permissive
[ { "docstring": "Difference from another polygon. :param poly: The clip polygon. :returns: A list of Polygons representing the difference.", "name": "difference", "signature": "def difference(self, poly)" }, { "docstring": "Intersect with another polygon. :param poly: The clip polygon. :returns: ...
5
stack_v2_sparse_classes_30k_train_054147
Implement the Python class `Clipper2D` described below. Class description: This class is used to add clipping functionality to the Polygon2D class. Method signatures and docstrings: - def difference(self, poly): Difference from another polygon. :param poly: The clip polygon. :returns: A list of Polygons representing ...
Implement the Python class `Clipper2D` described below. Class description: This class is used to add clipping functionality to the Polygon2D class. Method signatures and docstrings: - def difference(self, poly): Difference from another polygon. :param poly: The clip polygon. :returns: A list of Polygons representing ...
265d0b5c8a1407808568274fd2962ffdcae51858
<|skeleton|> class Clipper2D: """This class is used to add clipping functionality to the Polygon2D class.""" def difference(self, poly): """Difference from another polygon. :param poly: The clip polygon. :returns: A list of Polygons representing the difference.""" <|body_0|> def intersect(...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Clipper2D: """This class is used to add clipping functionality to the Polygon2D class.""" def difference(self, poly): """Difference from another polygon. :param poly: The clip polygon. :returns: A list of Polygons representing the difference.""" clipper = self._prepare_clipper(poly) ...
the_stack_v2_python_sparse
geomeppy/geom/clippers.py
jamiebull1/geomeppy
train
38
ad4410bc547c6d96397c6b2ba724c9e107ca6759
[ "if channel_id not in ('for_you', 'chrono_following', 'popular', 'continue_watching') and (not re.match(USER_CHANNEL_ID_RE, channel_id)):\n raise ValueError('Invalid channel_id: {}'.format(channel_id))\nendpoint = 'igtv/channel/'\nparams = {'id': channel_id}\nparams.update(self.authenticated_params)\nif kwargs:\...
<|body_start_0|> if channel_id not in ('for_you', 'chrono_following', 'popular', 'continue_watching') and (not re.match(USER_CHANNEL_ID_RE, channel_id)): raise ValueError('Invalid channel_id: {}'.format(channel_id)) endpoint = 'igtv/channel/' params = {'id': channel_id} param...
For endpoints in ``/igtv/``.
IGTVEndpointsMixin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IGTVEndpointsMixin: """For endpoints in ``/igtv/``.""" def tvchannel(self, channel_id, **kwargs): """Get channel :param channel_id: One of 'for_you', 'chrono_following', 'popular', 'continue_watching' (as returned by :meth:`tvguide`) or for a user 'user_12345' where user_id = '12345'...
stack_v2_sparse_classes_75kplus_train_000237
2,289
permissive
[ { "docstring": "Get channel :param channel_id: One of 'for_you', 'chrono_following', 'popular', 'continue_watching' (as returned by :meth:`tvguide`) or for a user 'user_12345' where user_id = '12345'", "name": "tvchannel", "signature": "def tvchannel(self, channel_id, **kwargs)" }, { "docstring"...
3
stack_v2_sparse_classes_30k_train_004253
Implement the Python class `IGTVEndpointsMixin` described below. Class description: For endpoints in ``/igtv/``. Method signatures and docstrings: - def tvchannel(self, channel_id, **kwargs): Get channel :param channel_id: One of 'for_you', 'chrono_following', 'popular', 'continue_watching' (as returned by :meth:`tvg...
Implement the Python class `IGTVEndpointsMixin` described below. Class description: For endpoints in ``/igtv/``. Method signatures and docstrings: - def tvchannel(self, channel_id, **kwargs): Get channel :param channel_id: One of 'for_you', 'chrono_following', 'popular', 'continue_watching' (as returned by :meth:`tvg...
7474bf00d2e97c73630713f3f0cec20a1b56b021
<|skeleton|> class IGTVEndpointsMixin: """For endpoints in ``/igtv/``.""" def tvchannel(self, channel_id, **kwargs): """Get channel :param channel_id: One of 'for_you', 'chrono_following', 'popular', 'continue_watching' (as returned by :meth:`tvguide`) or for a user 'user_12345' where user_id = '12345'...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IGTVEndpointsMixin: """For endpoints in ``/igtv/``.""" def tvchannel(self, channel_id, **kwargs): """Get channel :param channel_id: One of 'for_you', 'chrono_following', 'popular', 'continue_watching' (as returned by :meth:`tvguide`) or for a user 'user_12345' where user_id = '12345'""" i...
the_stack_v2_python_sparse
instabotnet/api/instagram_private_api/endpoints/igtv.py
remorses/instagram-botnet
train
7
bb2b40d2b6e6540cda00d857627556f14c2f109e
[ "self.callback_url = callback_url\nself.date_received = APIHelper.RFC3339DateTime(date_received) if date_received else None\nself.delay = delay\nself.delivery_report_id = delivery_report_id\nself.message_id = message_id\nself.metadata = metadata\nself.original_text = original_text\nself.source_number = source_numbe...
<|body_start_0|> self.callback_url = callback_url self.date_received = APIHelper.RFC3339DateTime(date_received) if date_received else None self.delay = delay self.delivery_report_id = delivery_report_id self.message_id = message_id self.metadata = metadata self.or...
Implementation of the 'DeliveryReport' model. TODO: type model description here. Attributes: callback_url (string): The URL specified as the callback URL in the original submit message request date_received (datetime): The date and time at which this delivery report was generated in UTC. delay (int): Deprecated, no lon...
DeliveryReport
[ "Apache-2.0", "curl", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeliveryReport: """Implementation of the 'DeliveryReport' model. TODO: type model description here. Attributes: callback_url (string): The URL specified as the callback URL in the original submit message request date_received (datetime): The date and time at which this delivery report was generat...
stack_v2_sparse_classes_75kplus_train_000238
4,978
permissive
[ { "docstring": "Constructor for the DeliveryReport class", "name": "__init__", "signature": "def __init__(self, callback_url=None, date_received=None, delay=None, delivery_report_id=None, message_id=None, metadata=None, original_text=None, source_number=None, status=None, submitted_date=None, vendor_acc...
2
stack_v2_sparse_classes_30k_train_028071
Implement the Python class `DeliveryReport` described below. Class description: Implementation of the 'DeliveryReport' model. TODO: type model description here. Attributes: callback_url (string): The URL specified as the callback URL in the original submit message request date_received (datetime): The date and time at...
Implement the Python class `DeliveryReport` described below. Class description: Implementation of the 'DeliveryReport' model. TODO: type model description here. Attributes: callback_url (string): The URL specified as the callback URL in the original submit message request date_received (datetime): The date and time at...
7963f5725c5feff7cbc74cc62fe889575f3a83f9
<|skeleton|> class DeliveryReport: """Implementation of the 'DeliveryReport' model. TODO: type model description here. Attributes: callback_url (string): The URL specified as the callback URL in the original submit message request date_received (datetime): The date and time at which this delivery report was generat...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DeliveryReport: """Implementation of the 'DeliveryReport' model. TODO: type model description here. Attributes: callback_url (string): The URL specified as the callback URL in the original submit message request date_received (datetime): The date and time at which this delivery report was generated in UTC. de...
the_stack_v2_python_sparse
message_media_messages/models/delivery_report.py
messagemedia/messages-python-sdk
train
6
b8d5765d46a18678ee452cfbe92f741afc3626c2
[ "def helper(n, seen):\n if n in seen:\n return seen[n]\n ans = 0\n for i in range(1, n + 1):\n left = helper(i - 1, seen)\n seen[i - 1] = left\n right = helper(n - i, seen)\n seen[n - i] = right\n if left == 0 or right == 0:\n temp = left + right\n ...
<|body_start_0|> def helper(n, seen): if n in seen: return seen[n] ans = 0 for i in range(1, n + 1): left = helper(i - 1, seen) seen[i - 1] = left right = helper(n - i, seen) seen[n - i] = right ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numTrees(self, n): """:type n: int :rtype: int""" <|body_0|> def numTrees2(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> def helper(n, seen): if n in seen: return seen...
stack_v2_sparse_classes_75kplus_train_000239
1,099
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "numTrees", "signature": "def numTrees(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "numTrees2", "signature": "def numTrees2(self, n)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numTrees(self, n): :type n: int :rtype: int - def numTrees2(self, n): :type n: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numTrees(self, n): :type n: int :rtype: int - def numTrees2(self, n): :type n: int :rtype: int <|skeleton|> class Solution: def numTrees(self, n): """:type n: i...
0fc972e5cd2baf1b5ddf8b192962629f40bc3bf4
<|skeleton|> class Solution: def numTrees(self, n): """:type n: int :rtype: int""" <|body_0|> def numTrees2(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def numTrees(self, n): """:type n: int :rtype: int""" def helper(n, seen): if n in seen: return seen[n] ans = 0 for i in range(1, n + 1): left = helper(i - 1, seen) seen[i - 1] = left ...
the_stack_v2_python_sparse
problems/96. Unique Binary Search Trees.py
yukiii-zhong/Leetcode
train
2
923a7b134fe05c4a55ba5487c8f6f3f3da4a04be
[ "humanized = humanize_key(test_keys.rsa_key)\nself.assertIsInstance(humanized, str)\nself.assertEqual(humanized, '76:ec:40:bd:69:9e:b1:e4:47:a9:e3:74:82:ec:0c:0f')", "humanized = humanize_key(test_keys.dsa_key)\nself.assertIsInstance(humanized, str)\nself.assertEqual(humanized, '62:4b:7f:b0:94:57:e2:bb:e7:d8:a4:8...
<|body_start_0|> humanized = humanize_key(test_keys.rsa_key) self.assertIsInstance(humanized, str) self.assertEqual(humanized, '76:ec:40:bd:69:9e:b1:e4:47:a9:e3:74:82:ec:0c:0f') <|end_body_0|> <|body_start_1|> humanized = humanize_key(test_keys.dsa_key) self.assertIsInstance(hum...
Unit tests for reviewboard.ssh.utils.
UtilsTests
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UtilsTests: """Unit tests for reviewboard.ssh.utils.""" def test_humanize_key_with_rsa_key(self): """Testing humanize_key with RSA key""" <|body_0|> def test_humanize_key_with_dsa_key(self): """Testing humanize_key with DSA key""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_75kplus_train_000240
13,294
permissive
[ { "docstring": "Testing humanize_key with RSA key", "name": "test_humanize_key_with_rsa_key", "signature": "def test_humanize_key_with_rsa_key(self)" }, { "docstring": "Testing humanize_key with DSA key", "name": "test_humanize_key_with_dsa_key", "signature": "def test_humanize_key_with_...
2
stack_v2_sparse_classes_30k_train_034503
Implement the Python class `UtilsTests` described below. Class description: Unit tests for reviewboard.ssh.utils. Method signatures and docstrings: - def test_humanize_key_with_rsa_key(self): Testing humanize_key with RSA key - def test_humanize_key_with_dsa_key(self): Testing humanize_key with DSA key
Implement the Python class `UtilsTests` described below. Class description: Unit tests for reviewboard.ssh.utils. Method signatures and docstrings: - def test_humanize_key_with_rsa_key(self): Testing humanize_key with RSA key - def test_humanize_key_with_dsa_key(self): Testing humanize_key with DSA key <|skeleton|> ...
c3a991f1e9d7682239a1ab0e8661cee6da01d537
<|skeleton|> class UtilsTests: """Unit tests for reviewboard.ssh.utils.""" def test_humanize_key_with_rsa_key(self): """Testing humanize_key with RSA key""" <|body_0|> def test_humanize_key_with_dsa_key(self): """Testing humanize_key with DSA key""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UtilsTests: """Unit tests for reviewboard.ssh.utils.""" def test_humanize_key_with_rsa_key(self): """Testing humanize_key with RSA key""" humanized = humanize_key(test_keys.rsa_key) self.assertIsInstance(humanized, str) self.assertEqual(humanized, '76:ec:40:bd:69:9e:b1:e4:...
the_stack_v2_python_sparse
reviewboard/ssh/tests.py
reviewboard/reviewboard
train
1,141
a2e3734f40c1a0bccfc2a6e37fd007e6c4d918bf
[ "schema = event_type.get_schema()\ntry:\n jsonschema.validate(data, schema)\nexcept (jsonschema.exceptions.ValidationError, jsonschema.exceptions.SchemaError) as e:\n raise DeserializationError(f'Failed jsonschema validation of {event_type!s} data {data}. Error was {e!s}') from e\nreturn NamedJson(event_type=...
<|body_start_0|> schema = event_type.get_schema() try: jsonschema.validate(data, schema) except (jsonschema.exceptions.ValidationError, jsonschema.exceptions.SchemaError) as e: raise DeserializationError(f'Failed jsonschema validation of {event_type!s} data {data}. Error ...
NamedJson
[ "AGPL-3.0-only", "AGPL-3.0-or-later", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NamedJson: def deserialize(cls, event_type: SchemaEventType, data: dict[str, Any]) -> 'NamedJson': """Turns an event type and a data dict to a NamedJson object May raise: - a DeserializationError if something is wrong with given data or json validation fails.""" <|body_0|> d...
stack_v2_sparse_classes_75kplus_train_000241
4,040
permissive
[ { "docstring": "Turns an event type and a data dict to a NamedJson object May raise: - a DeserializationError if something is wrong with given data or json validation fails.", "name": "deserialize", "signature": "def deserialize(cls, event_type: SchemaEventType, data: dict[str, Any]) -> 'NamedJson'" }...
3
null
Implement the Python class `NamedJson` described below. Class description: Implement the NamedJson class. Method signatures and docstrings: - def deserialize(cls, event_type: SchemaEventType, data: dict[str, Any]) -> 'NamedJson': Turns an event type and a data dict to a NamedJson object May raise: - a Deserialization...
Implement the Python class `NamedJson` described below. Class description: Implement the NamedJson class. Method signatures and docstrings: - def deserialize(cls, event_type: SchemaEventType, data: dict[str, Any]) -> 'NamedJson': Turns an event type and a data dict to a NamedJson object May raise: - a Deserialization...
496948458b89afc41458f19d1cba0e971ab67c8b
<|skeleton|> class NamedJson: def deserialize(cls, event_type: SchemaEventType, data: dict[str, Any]) -> 'NamedJson': """Turns an event type and a data dict to a NamedJson object May raise: - a DeserializationError if something is wrong with given data or json validation fails.""" <|body_0|> d...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NamedJson: def deserialize(cls, event_type: SchemaEventType, data: dict[str, Any]) -> 'NamedJson': """Turns an event type and a data dict to a NamedJson object May raise: - a DeserializationError if something is wrong with given data or json validation fails.""" schema = event_type.get_schema(...
the_stack_v2_python_sparse
rotkehlchen/accounting/types.py
LefterisJP/rotkehlchen
train
0
d7cb0186b42ee8e9d8f7ce06bc2b376b7c3cb4c1
[ "self.set_counts = set_counts\nself.max_set = max(set_counts)\nnum_sets = len(set_counts)\nself.ranks = [1] * num_sets\nself.parents = list(range(num_sets))", "src_parent = self.get_parent(src)\ndst_parent = self.get_parent(dst)\nif src_parent == dst_parent:\n return False\nif self.ranks[dst_parent] >= self.ra...
<|body_start_0|> self.set_counts = set_counts self.max_set = max(set_counts) num_sets = len(set_counts) self.ranks = [1] * num_sets self.parents = list(range(num_sets)) <|end_body_0|> <|body_start_1|> src_parent = self.get_parent(src) dst_parent = self.get_parent...
DisjointSet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DisjointSet: def __init__(self, set_counts: list) -> None: """Initialize with a list of the number of items in each set and with rank = 1 for each set""" <|body_0|> def merge(self, src: int, dst: int) -> bool: """Merge two sets together using Union by rank heuristic ...
stack_v2_sparse_classes_75kplus_train_000242
2,192
permissive
[ { "docstring": "Initialize with a list of the number of items in each set and with rank = 1 for each set", "name": "__init__", "signature": "def __init__(self, set_counts: list) -> None" }, { "docstring": "Merge two sets together using Union by rank heuristic Return True if successful Merge two ...
3
stack_v2_sparse_classes_30k_train_026701
Implement the Python class `DisjointSet` described below. Class description: Implement the DisjointSet class. Method signatures and docstrings: - def __init__(self, set_counts: list) -> None: Initialize with a list of the number of items in each set and with rank = 1 for each set - def merge(self, src: int, dst: int)...
Implement the Python class `DisjointSet` described below. Class description: Implement the DisjointSet class. Method signatures and docstrings: - def __init__(self, set_counts: list) -> None: Initialize with a list of the number of items in each set and with rank = 1 for each set - def merge(self, src: int, dst: int)...
421ace81edb0d9af3a173f4ca7e66cc900078c1d
<|skeleton|> class DisjointSet: def __init__(self, set_counts: list) -> None: """Initialize with a list of the number of items in each set and with rank = 1 for each set""" <|body_0|> def merge(self, src: int, dst: int) -> bool: """Merge two sets together using Union by rank heuristic ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DisjointSet: def __init__(self, set_counts: list) -> None: """Initialize with a list of the number of items in each set and with rank = 1 for each set""" self.set_counts = set_counts self.max_set = max(set_counts) num_sets = len(set_counts) self.ranks = [1] * num_sets ...
the_stack_v2_python_sparse
data_structures/disjoint_set/alternate_disjoint_set.py
TheAlgorithms/Python
train
184,217
7f391a99f1ea4548114aa463c62c70c7f7cce375
[ "lfdo = tree_string_to_LFDO(g_tree_string)\nfor N in (1, 5, 10):\n lfdn_a = LFDO_to_LFDN(lfdo, N)\n lfdm = LFDO_to_LFDM(lfdo, N)\n lfdn_b = LFDM_to_LFDN(lfdm)\n self.assertTrue(np.allclose(lfdn_a.M, lfdn_b.M))", "lfdo = tree_string_to_LFDO(g_tree_string)\nN = 1\nlfdn = LFDO_to_LFDN(lfdo, N)\nHDH = Mat...
<|body_start_0|> lfdo = tree_string_to_LFDO(g_tree_string) for N in (1, 5, 10): lfdn_a = LFDO_to_LFDN(lfdo, N) lfdm = LFDO_to_LFDM(lfdo, N) lfdn_b = LFDM_to_LFDN(lfdm) self.assertTrue(np.allclose(lfdn_a.M, lfdn_b.M)) <|end_body_0|> <|body_start_1|> ...
ProofDecorationTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProofDecorationTest: def test_lfdn_shortcut(self): """Check two ways of constructing blocks of a matrix. The matrix in question is the centered finitely extended matrix. One way is to construct the whole matrix and then take blocks. The other way is to construct the blocks more directly....
stack_v2_sparse_classes_75kplus_train_000243
7,534
no_license
[ { "docstring": "Check two ways of constructing blocks of a matrix. The matrix in question is the centered finitely extended matrix. One way is to construct the whole matrix and then take blocks. The other way is to construct the blocks more directly.", "name": "test_lfdn_shortcut", "signature": "def tes...
4
stack_v2_sparse_classes_30k_train_045171
Implement the Python class `ProofDecorationTest` described below. Class description: Implement the ProofDecorationTest class. Method signatures and docstrings: - def test_lfdn_shortcut(self): Check two ways of constructing blocks of a matrix. The matrix in question is the centered finitely extended matrix. One way is...
Implement the Python class `ProofDecorationTest` described below. Class description: Implement the ProofDecorationTest class. Method signatures and docstrings: - def test_lfdn_shortcut(self): Check two ways of constructing blocks of a matrix. The matrix in question is the centered finitely extended matrix. One way is...
91c6f8331f18c914eb3dfc51bc166915998c5081
<|skeleton|> class ProofDecorationTest: def test_lfdn_shortcut(self): """Check two ways of constructing blocks of a matrix. The matrix in question is the centered finitely extended matrix. One way is to construct the whole matrix and then take blocks. The other way is to construct the blocks more directly....
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProofDecorationTest: def test_lfdn_shortcut(self): """Check two ways of constructing blocks of a matrix. The matrix in question is the centered finitely extended matrix. One way is to construct the whole matrix and then take blocks. The other way is to construct the blocks more directly.""" lf...
the_stack_v2_python_sparse
ProofDecoration.py
argriffing/xgcode
train
1
765e942119ad5c735ba49c67ca98f3ce40a55ace
[ "node_list = response.xpath(\"//tr[@class='even'] | //tr[@class='odd']\")\nfor node in node_list:\n item = TencentItem()\n item['position_name'] = node.xpath('./td[1]/a/text()').extract_first()\n item['position_link'] = 'https://hr.tencent.com/' + node.xpath('./td[1]/a/@href').extract_first()\n item['po...
<|body_start_0|> node_list = response.xpath("//tr[@class='even'] | //tr[@class='odd']") for node in node_list: item = TencentItem() item['position_name'] = node.xpath('./td[1]/a/text()').extract_first() item['position_link'] = 'https://hr.tencent.com/' + node.xpath('....
TencentSpider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TencentSpider: def parse(self, response): """默认列表页的解析方法""" <|body_0|> def parse_detail(self, response): """解析详情页的响应内容""" <|body_1|> <|end_skeleton|> <|body_start_0|> node_list = response.xpath("//tr[@class='even'] | //tr[@class='odd']") for ...
stack_v2_sparse_classes_75kplus_train_000244
2,985
no_license
[ { "docstring": "默认列表页的解析方法", "name": "parse", "signature": "def parse(self, response)" }, { "docstring": "解析详情页的响应内容", "name": "parse_detail", "signature": "def parse_detail(self, response)" } ]
2
stack_v2_sparse_classes_30k_train_045274
Implement the Python class `TencentSpider` described below. Class description: Implement the TencentSpider class. Method signatures and docstrings: - def parse(self, response): 默认列表页的解析方法 - def parse_detail(self, response): 解析详情页的响应内容
Implement the Python class `TencentSpider` described below. Class description: Implement the TencentSpider class. Method signatures and docstrings: - def parse(self, response): 默认列表页的解析方法 - def parse_detail(self, response): 解析详情页的响应内容 <|skeleton|> class TencentSpider: def parse(self, response): """默认列表页...
a51e31acff41292e568ac22b0e213e6cb48218fa
<|skeleton|> class TencentSpider: def parse(self, response): """默认列表页的解析方法""" <|body_0|> def parse_detail(self, response): """解析详情页的响应内容""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TencentSpider: def parse(self, response): """默认列表页的解析方法""" node_list = response.xpath("//tr[@class='even'] | //tr[@class='odd']") for node in node_list: item = TencentItem() item['position_name'] = node.xpath('./td[1]/a/text()').extract_first() item[...
the_stack_v2_python_sparse
爬虫项目/code10/2.Spider类多级页面数据采集/Tencent2/Tencent2/spiders/tencent2.py
byst4nder/his_spider
train
1
379e4798b4020f8fd65a74e9db00b9b07edf231a
[ "self.signature = d['Signature']\nself.timestamp = d['Timestamp']\nself.version = d['Version']\nassert d['method'] == NotificationMessage.OPERATION_NAME, \"Method should be '%s'\" % NotificationMessage.OPERATION_NAME\nself.events = []\nevents_dict = {}\nif 'Event' in d:\n events_dict = d['Event']\nelse:\n for...
<|body_start_0|> self.signature = d['Signature'] self.timestamp = d['Timestamp'] self.version = d['Version'] assert d['method'] == NotificationMessage.OPERATION_NAME, "Method should be '%s'" % NotificationMessage.OPERATION_NAME self.events = [] events_dict = {} if...
NotificationMessage
[ "CC-BY-3.0", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-unknown-license-reference", "ZPL-2.0", "Unlicense", "LGPL-3.0-only", "CC0-1.0", "LicenseRef-scancode-other-permissive", "CNRI-Python", "LicenseRef-scancode-warranty-disclaimer", "GPL-2.0-or-later", "Python-2.0", "GPL-3.0...
stack_v2_sparse_python_classes_v1
<|skeleton|> class NotificationMessage: def __init__(self, d): """Constructor; expects parameter d to be a dict of string parameters from a REST transport notification message""" <|body_0|> def verify(self, secret_key): """Verifies the authenticity of a notification message. TODO: This...
stack_v2_sparse_classes_75kplus_train_000245
4,194
permissive
[ { "docstring": "Constructor; expects parameter d to be a dict of string parameters from a REST transport notification message", "name": "__init__", "signature": "def __init__(self, d)" }, { "docstring": "Verifies the authenticity of a notification message. TODO: This is doing a form of authentic...
2
stack_v2_sparse_classes_30k_train_046302
Implement the Python class `NotificationMessage` described below. Class description: Implement the NotificationMessage class. Method signatures and docstrings: - def __init__(self, d): Constructor; expects parameter d to be a dict of string parameters from a REST transport notification message - def verify(self, secr...
Implement the Python class `NotificationMessage` described below. Class description: Implement the NotificationMessage class. Method signatures and docstrings: - def __init__(self, d): Constructor; expects parameter d to be a dict of string parameters from a REST transport notification message - def verify(self, secr...
dccb9467675c67b9c3399fc76c5de6d31bfb8255
<|skeleton|> class NotificationMessage: def __init__(self, d): """Constructor; expects parameter d to be a dict of string parameters from a REST transport notification message""" <|body_0|> def verify(self, secret_key): """Verifies the authenticity of a notification message. TODO: This...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NotificationMessage: def __init__(self, d): """Constructor; expects parameter d to be a dict of string parameters from a REST transport notification message""" self.signature = d['Signature'] self.timestamp = d['Timestamp'] self.version = d['Version'] assert d['method']...
the_stack_v2_python_sparse
desktop/core/ext-py3/boto-2.49.0/boto/mturk/notification.py
cloudera/hue
train
5,655
bd9b63ac9c6e5868d247f8e088d91c7f31fe7e8a
[ "self.path_entry = path_entry\nif path_entry.index('http://') != 0:\n raise ImportError()\nreturn", "if is_package(self.path_entry, fullname):\n return HttpImportLoader(self.path_entry)\ntarget = _create_full_path(self.path_entry, fullname)\nif _exist_url(target):\n return HttpImportLoader(self.path_entr...
<|body_start_0|> self.path_entry = path_entry if path_entry.index('http://') != 0: raise ImportError() return <|end_body_0|> <|body_start_1|> if is_package(self.path_entry, fullname): return HttpImportLoader(self.path_entry) target = _create_full_path(sel...
ファインダのサンプルクラス
HttpImportFinder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HttpImportFinder: """ファインダのサンプルクラス""" def __init__(self, path_entry): """sys.path_hooks に設定された場合、sys.pathの各エントリがpath_entryに入って呼び出されます""" <|body_0|> def find_module(self, fullname, path=None): """fullname のパッケージやモジュールを見つけたらローダーを返すメソッド""" <|body_1|> <|end_...
stack_v2_sparse_classes_75kplus_train_000246
6,586
no_license
[ { "docstring": "sys.path_hooks に設定された場合、sys.pathの各エントリがpath_entryに入って呼び出されます", "name": "__init__", "signature": "def __init__(self, path_entry)" }, { "docstring": "fullname のパッケージやモジュールを見つけたらローダーを返すメソッド", "name": "find_module", "signature": "def find_module(self, fullname, path=None)" ...
2
stack_v2_sparse_classes_30k_val_001733
Implement the Python class `HttpImportFinder` described below. Class description: ファインダのサンプルクラス Method signatures and docstrings: - def __init__(self, path_entry): sys.path_hooks に設定された場合、sys.pathの各エントリがpath_entryに入って呼び出されます - def find_module(self, fullname, path=None): fullname のパッケージやモジュールを見つけたらローダーを返すメソッド
Implement the Python class `HttpImportFinder` described below. Class description: ファインダのサンプルクラス Method signatures and docstrings: - def __init__(self, path_entry): sys.path_hooks に設定された場合、sys.pathの各エントリがpath_entryに入って呼び出されます - def find_module(self, fullname, path=None): fullname のパッケージやモジュールを見つけたらローダーを返すメソッド <|skele...
4abd1a1339387d4d234b57f2e4f3f274b2a1ab0f
<|skeleton|> class HttpImportFinder: """ファインダのサンプルクラス""" def __init__(self, path_entry): """sys.path_hooks に設定された場合、sys.pathの各エントリがpath_entryに入って呼び出されます""" <|body_0|> def find_module(self, fullname, path=None): """fullname のパッケージやモジュールを見つけたらローダーを返すメソッド""" <|body_1|> <|end_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HttpImportFinder: """ファインダのサンプルクラス""" def __init__(self, path_entry): """sys.path_hooks に設定された場合、sys.pathの各エントリがpath_entryに入って呼び出されます""" self.path_entry = path_entry if path_entry.index('http://') != 0: raise ImportError() return def find_module(self, full...
the_stack_v2_python_sparse
perfect_python/Part2/09/http_loader1.py
Machi427/python
train
1
01a883a37cc5faa3c886a0edfef78b578aeb14a3
[ "self._check_params()\nself._warn_for_unused_params()\nif any((isinstance(el, list) for el in raw_documents)):\n self._tfidf.n_sent_per_doc = []\n for i in range(len(raw_documents)):\n self._tfidf.n_sent_per_doc.append(len(raw_documents[i]))\n self._tfidf.n_doc = len(raw_documents)\n raw_document...
<|body_start_0|> self._check_params() self._warn_for_unused_params() if any((isinstance(el, list) for el in raw_documents)): self._tfidf.n_sent_per_doc = [] for i in range(len(raw_documents)): self._tfidf.n_sent_per_doc.append(len(raw_documents[i])) ...
NewTfidfVectorizer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NewTfidfVectorizer: def fit(self, raw_documents, y=None): """Learn vocabulary and idf from training set. Parameters ---------- raw_documents : iterable An iterable which yields either str, unicode or file objects. y : None This parameter is not needed to compute tfidf. Returns ------- se...
stack_v2_sparse_classes_75kplus_train_000247
6,911
permissive
[ { "docstring": "Learn vocabulary and idf from training set. Parameters ---------- raw_documents : iterable An iterable which yields either str, unicode or file objects. y : None This parameter is not needed to compute tfidf. Returns ------- self : object Fitted vectorizer.", "name": "fit", "signature": ...
3
stack_v2_sparse_classes_30k_val_002725
Implement the Python class `NewTfidfVectorizer` described below. Class description: Implement the NewTfidfVectorizer class. Method signatures and docstrings: - def fit(self, raw_documents, y=None): Learn vocabulary and idf from training set. Parameters ---------- raw_documents : iterable An iterable which yields eith...
Implement the Python class `NewTfidfVectorizer` described below. Class description: Implement the NewTfidfVectorizer class. Method signatures and docstrings: - def fit(self, raw_documents, y=None): Learn vocabulary and idf from training set. Parameters ---------- raw_documents : iterable An iterable which yields eith...
ca748a227acd446cd9259056c6a9d6ae261aeaea
<|skeleton|> class NewTfidfVectorizer: def fit(self, raw_documents, y=None): """Learn vocabulary and idf from training set. Parameters ---------- raw_documents : iterable An iterable which yields either str, unicode or file objects. y : None This parameter is not needed to compute tfidf. Returns ------- se...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NewTfidfVectorizer: def fit(self, raw_documents, y=None): """Learn vocabulary and idf from training set. Parameters ---------- raw_documents : iterable An iterable which yields either str, unicode or file objects. y : None This parameter is not needed to compute tfidf. Returns ------- self : object Fi...
the_stack_v2_python_sparse
tfidf_test.py
filiparente/Predtweet
train
3
3979e7236a2560c99b09f91a9097478c850e43d4
[ "global result\nif len(s) < 4 or len(s) > 12:\n return result\nself.search_helper(s, 0, 0)\nreturn result", "global COUNT\nglobal segment\nglobal result\nif seg_id == COUNT:\n if start == len(s):\n result.append('.'.join(segment))\n return\nif start == len(s):\n return\nif s[start] == '0':\n ...
<|body_start_0|> global result if len(s) < 4 or len(s) > 12: return result self.search_helper(s, 0, 0) return result <|end_body_0|> <|body_start_1|> global COUNT global segment global result if seg_id == COUNT: if start == len(s): ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def restore_ip_addresses(self, s: str) -> List[str]: """修复ip Args: s: 字符串 Returns: ip的list""" <|body_0|> def search_helper(self, s: str, seg_id: int, start: int) -> None: """查找帮助类 Args: s: 字符串 seg_id: 区域id start: 开始位置 Returns: None""" <|body_1|> <|...
stack_v2_sparse_classes_75kplus_train_000248
2,850
permissive
[ { "docstring": "修复ip Args: s: 字符串 Returns: ip的list", "name": "restore_ip_addresses", "signature": "def restore_ip_addresses(self, s: str) -> List[str]" }, { "docstring": "查找帮助类 Args: s: 字符串 seg_id: 区域id start: 开始位置 Returns: None", "name": "search_helper", "signature": "def search_helper(...
2
stack_v2_sparse_classes_30k_train_031766
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def restore_ip_addresses(self, s: str) -> List[str]: 修复ip Args: s: 字符串 Returns: ip的list - def search_helper(self, s: str, seg_id: int, start: int) -> None: 查找帮助类 Args: s: 字符串 seg...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def restore_ip_addresses(self, s: str) -> List[str]: 修复ip Args: s: 字符串 Returns: ip的list - def search_helper(self, s: str, seg_id: int, start: int) -> None: 查找帮助类 Args: s: 字符串 seg...
50f35eef6a0ad63173efed10df3c835b1dceaa3f
<|skeleton|> class Solution: def restore_ip_addresses(self, s: str) -> List[str]: """修复ip Args: s: 字符串 Returns: ip的list""" <|body_0|> def search_helper(self, s: str, seg_id: int, start: int) -> None: """查找帮助类 Args: s: 字符串 seg_id: 区域id start: 开始位置 Returns: None""" <|body_1|> <|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def restore_ip_addresses(self, s: str) -> List[str]: """修复ip Args: s: 字符串 Returns: ip的list""" global result if len(s) < 4 or len(s) > 12: return result self.search_helper(s, 0, 0) return result def search_helper(self, s: str, seg_id: int, star...
the_stack_v2_python_sparse
src/leetcodepython/string/restore_ip_addresses_93.py
zhangyu345293721/leetcode
train
101
fcb791a29cbcb33432bc81b180acdb00490be9cb
[ "associated_class = super(Factory, cls)._load_target_class(class_definition)\nif isinstance(associated_class, string_types) and '.' in associated_class:\n if cls._associated_model is None:\n cls._associated_model = import_string(associated_class)\n cls._associated_model.FACTORY_CLASS = cls\n ret...
<|body_start_0|> associated_class = super(Factory, cls)._load_target_class(class_definition) if isinstance(associated_class, string_types) and '.' in associated_class: if cls._associated_model is None: cls._associated_model = import_string(associated_class) cl...
Factory for Mogwai models.
Factory
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Factory: """Factory for Mogwai models.""" def _load_target_class(cls, class_definition): """So we can support potential circular import problems, by using normal import_string import specification.""" <|body_0|> def _create(cls, target_class, *args, **kwargs): ""...
stack_v2_sparse_classes_75kplus_train_000249
12,835
permissive
[ { "docstring": "So we can support potential circular import problems, by using normal import_string import specification.", "name": "_load_target_class", "signature": "def _load_target_class(cls, class_definition)" }, { "docstring": "Create an instance of the model, and save it to the database."...
2
stack_v2_sparse_classes_30k_train_046264
Implement the Python class `Factory` described below. Class description: Factory for Mogwai models. Method signatures and docstrings: - def _load_target_class(cls, class_definition): So we can support potential circular import problems, by using normal import_string import specification. - def _create(cls, target_cla...
Implement the Python class `Factory` described below. Class description: Factory for Mogwai models. Method signatures and docstrings: - def _load_target_class(cls, class_definition): So we can support potential circular import problems, by using normal import_string import specification. - def _create(cls, target_cla...
337aecccda1dcd160bb080a01946ac9edbd449d0
<|skeleton|> class Factory: """Factory for Mogwai models.""" def _load_target_class(cls, class_definition): """So we can support potential circular import problems, by using normal import_string import specification.""" <|body_0|> def _create(cls, target_class, *args, **kwargs): ""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Factory: """Factory for Mogwai models.""" def _load_target_class(cls, class_definition): """So we can support potential circular import problems, by using normal import_string import specification.""" associated_class = super(Factory, cls)._load_target_class(class_definition) if i...
the_stack_v2_python_sparse
mogwai/tools.py
ZEROFAIL/mogwai
train
10
97bed0a92898ca88d9982218300e7215210a1029
[ "log.debug('%s::__init__(%s)', self.__class__, protocolAlias)\nself._protocolHandlerClass = protocolHandlerClass\nself._protocolAlias = protocolAlias\nself._thread = Thread(target=self.threadHandler)\nself._thread.start()", "commandRoutingKey = conf.environment + '.mon.device.command.' + self._protocolAlias\ncomm...
<|body_start_0|> log.debug('%s::__init__(%s)', self.__class__, protocolAlias) self._protocolHandlerClass = protocolHandlerClass self._protocolAlias = protocolAlias self._thread = Thread(target=self.threadHandler) self._thread.start() <|end_body_0|> <|body_start_1|> comma...
Message broker thread for receiving AMQP commands for a protocol
MessageBrokerThread
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MessageBrokerThread: """Message broker thread for receiving AMQP commands for a protocol""" def __init__(self, protocolHandlerClass, protocolAlias): """Creates broker thread for listening AMQP commands sent to the specified protocol (usually for sms transport) @param protocolHandlerC...
stack_v2_sparse_classes_75kplus_train_000250
12,960
no_license
[ { "docstring": "Creates broker thread for listening AMQP commands sent to the specified protocol (usually for sms transport) @param protocolHandlerClass: protocol handler class @param protocolAlias: protocol alias", "name": "__init__", "signature": "def __init__(self, protocolHandlerClass, protocolAlias...
3
stack_v2_sparse_classes_30k_train_020607
Implement the Python class `MessageBrokerThread` described below. Class description: Message broker thread for receiving AMQP commands for a protocol Method signatures and docstrings: - def __init__(self, protocolHandlerClass, protocolAlias): Creates broker thread for listening AMQP commands sent to the specified pro...
Implement the Python class `MessageBrokerThread` described below. Class description: Message broker thread for receiving AMQP commands for a protocol Method signatures and docstrings: - def __init__(self, protocolHandlerClass, protocolAlias): Creates broker thread for listening AMQP commands sent to the specified pro...
4a4bc730252ece695b2773388812e2d59d4947ce
<|skeleton|> class MessageBrokerThread: """Message broker thread for receiving AMQP commands for a protocol""" def __init__(self, protocolHandlerClass, protocolAlias): """Creates broker thread for listening AMQP commands sent to the specified protocol (usually for sms transport) @param protocolHandlerC...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MessageBrokerThread: """Message broker thread for receiving AMQP commands for a protocol""" def __init__(self, protocolHandlerClass, protocolAlias): """Creates broker thread for listening AMQP commands sent to the specified protocol (usually for sms transport) @param protocolHandlerClass: protoco...
the_stack_v2_python_sparse
lib/broker.py
maprox/pipe
train
4
b2888ecd409ee44ba655ceb382eb850f96b135f4
[ "super().__init__()\nset_attributes(self, locals())\nassert self.proj is not None", "if self.pool is not None:\n x = self.pool(x)\nif self.roi_layer is not None:\n temporal_dim = x.shape[-3]\n if temporal_dim != 1:\n raise Exception('Temporal dimension should be 1. Consider modifying the pool laye...
<|body_start_0|> super().__init__() set_attributes(self, locals()) assert self.proj is not None <|end_body_0|> <|body_start_1|> if self.pool is not None: x = self.pool(x) if self.roi_layer is not None: temporal_dim = x.shape[-3] if temporal_di...
ResNet RoI head. This layer performs an optional pooling operation followed by an RoI projection, an optional 2D spatial pool, an optional dropout, a fully-connected projection, an activation layer and a global spatiotemporal averaging. Pool3d ↓ RoI Align ↓ Pool2d ↓ Dropout ↓ Projection ↓ Activation ↓ Averaging The bui...
ResNetRoIHead
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResNetRoIHead: """ResNet RoI head. This layer performs an optional pooling operation followed by an RoI projection, an optional 2D spatial pool, an optional dropout, a fully-connected projection, an activation layer and a global spatiotemporal averaging. Pool3d ↓ RoI Align ↓ Pool2d ↓ Dropout ↓ Pr...
stack_v2_sparse_classes_75kplus_train_000251
18,730
permissive
[ { "docstring": "Args: pool (torch.nn.modules): pooling module. pool_spatial (torch.nn.modules): pooling module. roi_spatial (torch.nn.modules): RoI (Ex: Align, pool) module. dropout(torch.nn.modules): dropout module. proj (torch.nn.modules): project module. activation (torch.nn.modules): activation module. outp...
2
stack_v2_sparse_classes_30k_train_040527
Implement the Python class `ResNetRoIHead` described below. Class description: ResNet RoI head. This layer performs an optional pooling operation followed by an RoI projection, an optional 2D spatial pool, an optional dropout, a fully-connected projection, an activation layer and a global spatiotemporal averaging. Poo...
Implement the Python class `ResNetRoIHead` described below. Class description: ResNet RoI head. This layer performs an optional pooling operation followed by an RoI projection, an optional 2D spatial pool, an optional dropout, a fully-connected projection, an activation layer and a global spatiotemporal averaging. Poo...
16f2abf2f8aa174915316007622bbb260215dee8
<|skeleton|> class ResNetRoIHead: """ResNet RoI head. This layer performs an optional pooling operation followed by an RoI projection, an optional 2D spatial pool, an optional dropout, a fully-connected projection, an activation layer and a global spatiotemporal averaging. Pool3d ↓ RoI Align ↓ Pool2d ↓ Dropout ↓ Pr...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ResNetRoIHead: """ResNet RoI head. This layer performs an optional pooling operation followed by an RoI projection, an optional 2D spatial pool, an optional dropout, a fully-connected projection, an activation layer and a global spatiotemporal averaging. Pool3d ↓ RoI Align ↓ Pool2d ↓ Dropout ↓ Projection ↓ Ac...
the_stack_v2_python_sparse
pytorchvideo/models/head.py
xchani/pytorchvideo
train
0
6bd90472be148cfc0c778be61b91178e43a602fb
[ "while path and path[-1] == u'\\\\':\n path = path[:-1]\nif path:\n _, _, path = path.rpartition(u'\\\\')\nreturn path", "users = []\nfor subkey in registry_key.GetSubkeys():\n if not subkey.name:\n continue\n user_account_artifact = artifacts.UserAccountArtifact(identifier=subkey.name)\n re...
<|body_start_0|> while path and path[-1] == u'\\': path = path[:-1] if path: _, _, path = path.rpartition(u'\\') return path <|end_body_0|> <|body_start_1|> users = [] for subkey in registry_key.GetSubkeys(): if not subkey.name: ...
Fetch information about user profiles.
WindowsUsers
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WindowsUsers: """Fetch information about user profiles.""" def _GetUsernameFromPath(self, path): """Retrieves the username from a Windows profile path. Trailing path path segment are igored. Args: path (str): a Windows path with '\\' as path segment separator. Returns: str: basename ...
stack_v2_sparse_classes_75kplus_train_000252
12,742
permissive
[ { "docstring": "Retrieves the username from a Windows profile path. Trailing path path segment are igored. Args: path (str): a Windows path with '\\\\' as path segment separator. Returns: str: basename which is the last path segment.", "name": "_GetUsernameFromPath", "signature": "def _GetUsernameFromPa...
2
null
Implement the Python class `WindowsUsers` described below. Class description: Fetch information about user profiles. Method signatures and docstrings: - def _GetUsernameFromPath(self, path): Retrieves the username from a Windows profile path. Trailing path path segment are igored. Args: path (str): a Windows path wit...
Implement the Python class `WindowsUsers` described below. Class description: Fetch information about user profiles. Method signatures and docstrings: - def _GetUsernameFromPath(self, path): Retrieves the username from a Windows profile path. Trailing path path segment are igored. Args: path (str): a Windows path wit...
0ee446ebf03d17c515f76a666bd3795e91a2dd17
<|skeleton|> class WindowsUsers: """Fetch information about user profiles.""" def _GetUsernameFromPath(self, path): """Retrieves the username from a Windows profile path. Trailing path path segment are igored. Args: path (str): a Windows path with '\\' as path segment separator. Returns: str: basename ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WindowsUsers: """Fetch information about user profiles.""" def _GetUsernameFromPath(self, path): """Retrieves the username from a Windows profile path. Trailing path path segment are igored. Args: path (str): a Windows path with '\\' as path segment separator. Returns: str: basename which is the ...
the_stack_v2_python_sparse
plaso/preprocessors/windows.py
aarontp/plaso
train
1
4f73ddc4a327ee297ac6251c1c1f85ff8c7adc93
[ "super(CSSInlineFilter, self).__init__(builder)\nself._collecting = False\nself._buffer = []\nself._starttag = None\nself._modify = modifier\nself._normalize = self.builder.decoder.normalize\nif standalone:\n self._attribute = None\nelse:\n self._attribute = self._normalize(self.builder.analyze.attribute)\nse...
<|body_start_0|> super(CSSInlineFilter, self).__init__(builder) self._collecting = False self._buffer = [] self._starttag = None self._modify = modifier self._normalize = self.builder.decoder.normalize if standalone: self._attribute = None else...
TDI filter for modifying inline css :IVariables: `_collecting` : ``bool`` Currently collecting CSS text? `_buffer` : ``list`` Collection buffer `_starttag` : ``tuple`` or ``None`` Original style starttag parameters `_modify` : callable Modifier function `_attribute` : ``str`` ``tdi`` attribute name or ``None`` (if stan...
CSSInlineFilter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CSSInlineFilter: """TDI filter for modifying inline css :IVariables: `_collecting` : ``bool`` Currently collecting CSS text? `_buffer` : ``list`` Collection buffer `_starttag` : ``tuple`` or ``None`` Original style starttag parameters `_modify` : callable Modifier function `_attribute` : ``str`` ...
stack_v2_sparse_classes_75kplus_train_000253
9,413
permissive
[ { "docstring": "Initialization :Parameters: `builder` : `tdi.interfaces.BuildingListenerInterface` Builder `modifier` : callable Modifier function. Takes a style and returns the (possibly) modified result. `strip_empty` : ``bool`` Strip empty style elements? `standalone` : ``bool`` Standalone context? In this c...
4
null
Implement the Python class `CSSInlineFilter` described below. Class description: TDI filter for modifying inline css :IVariables: `_collecting` : ``bool`` Currently collecting CSS text? `_buffer` : ``list`` Collection buffer `_starttag` : ``tuple`` or ``None`` Original style starttag parameters `_modify` : callable Mo...
Implement the Python class `CSSInlineFilter` described below. Class description: TDI filter for modifying inline css :IVariables: `_collecting` : ``bool`` Currently collecting CSS text? `_buffer` : ``list`` Collection buffer `_starttag` : ``tuple`` or ``None`` Original style starttag parameters `_modify` : callable Mo...
65a93080281f9ce5c0379e9dbb111f14965a8613
<|skeleton|> class CSSInlineFilter: """TDI filter for modifying inline css :IVariables: `_collecting` : ``bool`` Currently collecting CSS text? `_buffer` : ``list`` Collection buffer `_starttag` : ``tuple`` or ``None`` Original style starttag parameters `_modify` : callable Modifier function `_attribute` : ``str`` ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CSSInlineFilter: """TDI filter for modifying inline css :IVariables: `_collecting` : ``bool`` Currently collecting CSS text? `_buffer` : ``list`` Collection buffer `_starttag` : ``tuple`` or ``None`` Original style starttag parameters `_modify` : callable Modifier function `_attribute` : ``str`` ``tdi`` attri...
the_stack_v2_python_sparse
tdi/tools/css.py
ndparker/tdi
train
4
af5ad149227910843683baf3d7fd4ac86f5778b3
[ "super().__init__(name)\nself.default = default\nif type(required) != bool:\n raise TypeError(\"Invalid type for 'required'\")\nself.required = required\nself.ofType = of_type\nif type(value_set) == set or type(value_set) == list or type(value_set) == range:\n self.valueSet = set(value_set)\nelif value_set is...
<|body_start_0|> super().__init__(name) self.default = default if type(required) != bool: raise TypeError("Invalid type for 'required'") self.required = required self.ofType = of_type if type(value_set) == set or type(value_set) == list or type(value_set) == r...
FillableProperty
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FillableProperty: def __init__(self, name=None, default=None, required=False, of_type=None, value_set=None, custom=None): """Defines the fillable property with the parameters that the property should take Args: name (str): The internal name of the property default (any): A default value ...
stack_v2_sparse_classes_75kplus_train_000254
6,428
permissive
[ { "docstring": "Defines the fillable property with the parameters that the property should take Args: name (str): The internal name of the property default (any): A default value required (bool): Whether this property is required of_type (type, [type]): A type or a set of types that the property can be value_se...
2
stack_v2_sparse_classes_30k_test_002514
Implement the Python class `FillableProperty` described below. Class description: Implement the FillableProperty class. Method signatures and docstrings: - def __init__(self, name=None, default=None, required=False, of_type=None, value_set=None, custom=None): Defines the fillable property with the parameters that the...
Implement the Python class `FillableProperty` described below. Class description: Implement the FillableProperty class. Method signatures and docstrings: - def __init__(self, name=None, default=None, required=False, of_type=None, value_set=None, custom=None): Defines the fillable property with the parameters that the...
9c29fcf3462475e339f95d3e9766ed3a652ee6c0
<|skeleton|> class FillableProperty: def __init__(self, name=None, default=None, required=False, of_type=None, value_set=None, custom=None): """Defines the fillable property with the parameters that the property should take Args: name (str): The internal name of the property default (any): A default value ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FillableProperty: def __init__(self, name=None, default=None, required=False, of_type=None, value_set=None, custom=None): """Defines the fillable property with the parameters that the property should take Args: name (str): The internal name of the property default (any): A default value required (bool...
the_stack_v2_python_sparse
SeeThru_Feeds/Model/Properties/Properties.py
SeeThru-Networks/Python-Feeds
train
3
590818b9021b8044953baffcdb23423b10962eb0
[ "super().__init__()\nself.k_list = k_list\nself.data = data\nself.d = data.shape[-1]\nself.init_centroids = init_centroids\nself.frozen_centroids = frozen_centroids\nself.logger = logging.getLogger('Kmeans')\nself.debug = False\nself.epoch = epoch + 1", "data = self.data\nlabels = []\ncentroids = []\ntqdm_batch =...
<|body_start_0|> super().__init__() self.k_list = k_list self.data = data self.d = data.shape[-1] self.init_centroids = init_centroids self.frozen_centroids = frozen_centroids self.logger = logging.getLogger('Kmeans') self.debug = False self.epoch ...
Kmeans
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Kmeans: def __init__(self, k_list, data, epoch=0, init_centroids=None, frozen_centroids=False): """Performs many k-means clustering. Args: data (np.array N * dim): data to cluster""" <|body_0|> def compute_clusters(self): """compute cluster Returns: torch.tensor, lis...
stack_v2_sparse_classes_75kplus_train_000255
3,988
no_license
[ { "docstring": "Performs many k-means clustering. Args: data (np.array N * dim): data to cluster", "name": "__init__", "signature": "def __init__(self, k_list, data, epoch=0, init_centroids=None, frozen_centroids=False)" }, { "docstring": "compute cluster Returns: torch.tensor, list: clus_labels...
2
stack_v2_sparse_classes_30k_train_038208
Implement the Python class `Kmeans` described below. Class description: Implement the Kmeans class. Method signatures and docstrings: - def __init__(self, k_list, data, epoch=0, init_centroids=None, frozen_centroids=False): Performs many k-means clustering. Args: data (np.array N * dim): data to cluster - def compute...
Implement the Python class `Kmeans` described below. Class description: Implement the Kmeans class. Method signatures and docstrings: - def __init__(self, k_list, data, epoch=0, init_centroids=None, frozen_centroids=False): Performs many k-means clustering. Args: data (np.array N * dim): data to cluster - def compute...
1b82dd088e5475b45688bec44830f3e96ae65d32
<|skeleton|> class Kmeans: def __init__(self, k_list, data, epoch=0, init_centroids=None, frozen_centroids=False): """Performs many k-means clustering. Args: data (np.array N * dim): data to cluster""" <|body_0|> def compute_clusters(self): """compute cluster Returns: torch.tensor, lis...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Kmeans: def __init__(self, k_list, data, epoch=0, init_centroids=None, frozen_centroids=False): """Performs many k-means clustering. Args: data (np.array N * dim): data to cluster""" super().__init__() self.k_list = k_list self.data = data self.d = data.shape[-1] ...
the_stack_v2_python_sparse
pcs/models/clustering.py
andyincode2/PCS-FUDA
train
0
4e3189e7410be6706674bdd5571c398606ea23d1
[ "if head is None or head.next is None:\n return head\nnew_head = self.reverseList(head.next)\nhead.next.next = head\nhead.next = None\nreturn new_head", "if head is None:\n return head\ncur = head\nprev = None\nwhile cur:\n nxt = cur.next\n cur.next = prev\n prev = cur\n cur = nxt\nreturn prev" ...
<|body_start_0|> if head is None or head.next is None: return head new_head = self.reverseList(head.next) head.next.next = head head.next = None return new_head <|end_body_0|> <|body_start_1|> if head is None: return head cur = head ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseList(self, head: ListNode) -> ListNode: """Recursive, Time: O(n), Space: O(n) for recursive stack""" <|body_0|> def reverseList(self, head: ListNode) -> ListNode: """Iterative, Time: O(n), Space: O(1)""" <|body_1|> <|end_skeleton|> <|bo...
stack_v2_sparse_classes_75kplus_train_000256
1,597
no_license
[ { "docstring": "Recursive, Time: O(n), Space: O(n) for recursive stack", "name": "reverseList", "signature": "def reverseList(self, head: ListNode) -> ListNode" }, { "docstring": "Iterative, Time: O(n), Space: O(1)", "name": "reverseList", "signature": "def reverseList(self, head: ListNo...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head: ListNode) -> ListNode: Recursive, Time: O(n), Space: O(n) for recursive stack - def reverseList(self, head: ListNode) -> ListNode: Iterative, Time: O(...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head: ListNode) -> ListNode: Recursive, Time: O(n), Space: O(n) for recursive stack - def reverseList(self, head: ListNode) -> ListNode: Iterative, Time: O(...
72136e3487d239f5b37e2d6393e034262a6bf599
<|skeleton|> class Solution: def reverseList(self, head: ListNode) -> ListNode: """Recursive, Time: O(n), Space: O(n) for recursive stack""" <|body_0|> def reverseList(self, head: ListNode) -> ListNode: """Iterative, Time: O(n), Space: O(1)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def reverseList(self, head: ListNode) -> ListNode: """Recursive, Time: O(n), Space: O(n) for recursive stack""" if head is None or head.next is None: return head new_head = self.reverseList(head.next) head.next.next = head head.next = None ...
the_stack_v2_python_sparse
python/206-reversed-linked-list.py
cwza/leetcode
train
0
649143f88d61d04528c416f1c4aa7e2166f94f4b
[ "self.caffe = Caffe.objects.create(name='kafo', city='Gliwice', street='Wieczorka', house_number='14', postal_code='44-100')\nfirst_cat = Category.objects.create(name='first', caffe=self.caffe)\nsecond_cat = Category.objects.create(name='second', caffe=self.caffe)\ngram = Unit.objects.create(name='gram', caffe=self...
<|body_start_0|> self.caffe = Caffe.objects.create(name='kafo', city='Gliwice', street='Wieczorka', house_number='14', postal_code='44-100') first_cat = Category.objects.create(name='first', caffe=self.caffe) second_cat = Category.objects.create(name='second', caffe=self.caffe) gram = Un...
FullProductForm tests.
FullProductFormTest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FullProductFormTest: """FullProductForm tests.""" def setUp(self): """Initialize data for further FullProductForm tests.""" <|body_0|> def test_full_product(self): """Check validation and adding/deleting products.""" <|body_1|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_75kplus_train_000257
12,667
permissive
[ { "docstring": "Initialize data for further FullProductForm tests.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Check validation and adding/deleting products.", "name": "test_full_product", "signature": "def test_full_product(self)" } ]
2
stack_v2_sparse_classes_30k_train_031880
Implement the Python class `FullProductFormTest` described below. Class description: FullProductForm tests. Method signatures and docstrings: - def setUp(self): Initialize data for further FullProductForm tests. - def test_full_product(self): Check validation and adding/deleting products.
Implement the Python class `FullProductFormTest` described below. Class description: FullProductForm tests. Method signatures and docstrings: - def setUp(self): Initialize data for further FullProductForm tests. - def test_full_product(self): Check validation and adding/deleting products. <|skeleton|> class FullProd...
cdb7f5edb29255c7e874eaa6231621063210a8b0
<|skeleton|> class FullProductFormTest: """FullProductForm tests.""" def setUp(self): """Initialize data for further FullProductForm tests.""" <|body_0|> def test_full_product(self): """Check validation and adding/deleting products.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FullProductFormTest: """FullProductForm tests.""" def setUp(self): """Initialize data for further FullProductForm tests.""" self.caffe = Caffe.objects.create(name='kafo', city='Gliwice', street='Wieczorka', house_number='14', postal_code='44-100') first_cat = Category.objects.crea...
the_stack_v2_python_sparse
caffe/reports/test_forms.py
VirrageS/io-kawiarnie
train
3
cf2db139925db92d4d81bd9553cccc669a7d12c8
[ "self.access_token = access_token\nself.api_limit = api_limit\nself.auth_token = auth_token\nself.concurrent_req_limit = concurrent_req_limit\nself.consumer_key = consumer_key\nself.consumer_secret = consumer_secret\nself.credentials = credentials\nself.endpoint = endpoint\nself.endpoint_type = endpoint_type\nself....
<|body_start_0|> self.access_token = access_token self.api_limit = api_limit self.auth_token = auth_token self.concurrent_req_limit = concurrent_req_limit self.consumer_key = consumer_key self.consumer_secret = consumer_secret self.credentials = credentials ...
Implementation of the 'RegisteredEntitySfdcParams' model. Contains all params specified by the user while registering a Sfdc source. Attributes: access_token (string): Token that will be used in subsequent api requests. api_limit (long|int): Maximum daily api limit auth_token (string): Token that will be used for fetch...
RegisteredEntitySfdcParams
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegisteredEntitySfdcParams: """Implementation of the 'RegisteredEntitySfdcParams' model. Contains all params specified by the user while registering a Sfdc source. Attributes: access_token (string): Token that will be used in subsequent api requests. api_limit (long|int): Maximum daily api limit ...
stack_v2_sparse_classes_75kplus_train_000258
5,115
permissive
[ { "docstring": "Constructor for the RegisteredEntitySfdcParams class", "name": "__init__", "signature": "def __init__(self, access_token=None, api_limit=None, auth_token=None, concurrent_req_limit=None, consumer_key=None, consumer_secret=None, credentials=None, endpoint=None, endpoint_type=None, metadat...
2
null
Implement the Python class `RegisteredEntitySfdcParams` described below. Class description: Implementation of the 'RegisteredEntitySfdcParams' model. Contains all params specified by the user while registering a Sfdc source. Attributes: access_token (string): Token that will be used in subsequent api requests. api_lim...
Implement the Python class `RegisteredEntitySfdcParams` described below. Class description: Implementation of the 'RegisteredEntitySfdcParams' model. Contains all params specified by the user while registering a Sfdc source. Attributes: access_token (string): Token that will be used in subsequent api requests. api_lim...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class RegisteredEntitySfdcParams: """Implementation of the 'RegisteredEntitySfdcParams' model. Contains all params specified by the user while registering a Sfdc source. Attributes: access_token (string): Token that will be used in subsequent api requests. api_limit (long|int): Maximum daily api limit ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RegisteredEntitySfdcParams: """Implementation of the 'RegisteredEntitySfdcParams' model. Contains all params specified by the user while registering a Sfdc source. Attributes: access_token (string): Token that will be used in subsequent api requests. api_limit (long|int): Maximum daily api limit auth_token (s...
the_stack_v2_python_sparse
cohesity_management_sdk/models/registered_entity_sfdc_params.py
cohesity/management-sdk-python
train
24
a0d3266531b4e12162b1fb022db91d320782e36c
[ "self.grid_size = grid_size\nself.num_vertices = grid_size ** 2\nself.minority_proportion = minority_proportion\nself.num_minority_vertices = math.floor(self.num_vertices * minority_proportion)\nif energy_type == 'hamiltonian':\n self.energy_calculator = HamiltonianEnergyCalculator(self)\nelif energy_type == 'ga...
<|body_start_0|> self.grid_size = grid_size self.num_vertices = grid_size ** 2 self.minority_proportion = minority_proportion self.num_minority_vertices = math.floor(self.num_vertices * minority_proportion) if energy_type == 'hamiltonian': self.energy_calculator = Ham...
Stores Ising configuration and updates it via Metropolis-Hastings. Attributes ---------- grid_size : int width/height of grid graph underlying simulation num_vertices : int # of vertices in grid graph minority_proportion : float proportion of spin -1 vertices which represent minority group num_minority_vertices : int #...
IsingSimulation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IsingSimulation: """Stores Ising configuration and updates it via Metropolis-Hastings. Attributes ---------- grid_size : int width/height of grid graph underlying simulation num_vertices : int # of vertices in grid graph minority_proportion : float proportion of spin -1 vertices which represent m...
stack_v2_sparse_classes_75kplus_train_000259
7,680
no_license
[ { "docstring": "Initialize simulation. Parameters ---------- energy_type : 'hamiltonian' | 'gamma' | 'normalized-gamma' type of energy to use for simulation See class docstring for other details.", "name": "__init__", "signature": "def __init__(self, grid_size, minority_proportion, energy_type='normaliz...
5
stack_v2_sparse_classes_30k_train_037867
Implement the Python class `IsingSimulation` described below. Class description: Stores Ising configuration and updates it via Metropolis-Hastings. Attributes ---------- grid_size : int width/height of grid graph underlying simulation num_vertices : int # of vertices in grid graph minority_proportion : float proportio...
Implement the Python class `IsingSimulation` described below. Class description: Stores Ising configuration and updates it via Metropolis-Hastings. Attributes ---------- grid_size : int width/height of grid graph underlying simulation num_vertices : int # of vertices in grid graph minority_proportion : float proportio...
ff249af83634b9081aa4b513457ca37a6c7686c9
<|skeleton|> class IsingSimulation: """Stores Ising configuration and updates it via Metropolis-Hastings. Attributes ---------- grid_size : int width/height of grid graph underlying simulation num_vertices : int # of vertices in grid graph minority_proportion : float proportion of spin -1 vertices which represent m...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IsingSimulation: """Stores Ising configuration and updates it via Metropolis-Hastings. Attributes ---------- grid_size : int width/height of grid graph underlying simulation num_vertices : int # of vertices in grid graph minority_proportion : float proportion of spin -1 vertices which represent minority group...
the_stack_v2_python_sparse
simulation_and_measurement/ising_simulation.py
gerrymandr/Ising
train
1
08f7987c8a871467a20665ffb0ddceeb54afe1d4
[ "if payoff_list is None:\n payoff_list = [_DEFAULT_PAYOFF]\nself.payoff_model = payoff_model\nsuper().__init__(payment_date_list, payoff_list, origin=origin)", "if isinstance(item, (tuple, list)):\n return list((self[i] for i in item))\nelse:\n payoff = self._flows.get(item, 0.0)\n if isinstance(payof...
<|body_start_0|> if payoff_list is None: payoff_list = [_DEFAULT_PAYOFF] self.payoff_model = payoff_model super().__init__(payment_date_list, payoff_list, origin=origin) <|end_body_0|> <|body_start_1|> if isinstance(item, (tuple, list)): return list((self[i] for ...
list of contingent cashflows
ContingentCashFlowList
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ContingentCashFlowList: """list of contingent cashflows""" def __init__(self, payment_date_list, payoff_list=None, origin=None, payoff_model=None): """generic cashflow list of expected contingent cashflows i.e. non-deterministc cashflows like option payoffs. :param payment_date_list:...
stack_v2_sparse_classes_75kplus_train_000260
12,032
permissive
[ { "docstring": "generic cashflow list of expected contingent cashflows i.e. non-deterministc cashflows like option payoffs. :param payment_date_list: pay dates, assuming that pay dates agree with end dates of interest accrued period :param payoff_list: list of payoffs :param origin: start date of first interest...
2
stack_v2_sparse_classes_30k_train_004751
Implement the Python class `ContingentCashFlowList` described below. Class description: list of contingent cashflows Method signatures and docstrings: - def __init__(self, payment_date_list, payoff_list=None, origin=None, payoff_model=None): generic cashflow list of expected contingent cashflows i.e. non-deterministc...
Implement the Python class `ContingentCashFlowList` described below. Class description: list of contingent cashflows Method signatures and docstrings: - def __init__(self, payment_date_list, payoff_list=None, origin=None, payoff_model=None): generic cashflow list of expected contingent cashflows i.e. non-deterministc...
c585e173e5ea3b529be7463787ddcd5cb93fffd3
<|skeleton|> class ContingentCashFlowList: """list of contingent cashflows""" def __init__(self, payment_date_list, payoff_list=None, origin=None, payoff_model=None): """generic cashflow list of expected contingent cashflows i.e. non-deterministc cashflows like option payoffs. :param payment_date_list:...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ContingentCashFlowList: """list of contingent cashflows""" def __init__(self, payment_date_list, payoff_list=None, origin=None, payoff_model=None): """generic cashflow list of expected contingent cashflows i.e. non-deterministc cashflows like option payoffs. :param payment_date_list: pay dates, a...
the_stack_v2_python_sparse
dcf/cashflows/contingent.py
sonntagsgesicht/dcf
train
19
37664aaa7c464c34f2d3cd1a3bcba84ee1450d32
[ "n = len(matrix)\nnums = []\nfor i in range(n):\n nums += matrix[i]\nnums.sort()\nreturn nums[k - 1]", "m, n = (len(matrix), len(matrix[0]))\nheap = [(matrix[0][0], 0, 0)]\nvisited = set((0, 0))\nres = None\nwhile k > 0:\n res = heapq.heappop(heap)\n r, c = (res[1], res[2])\n if r + 1 < m and (r + 1, ...
<|body_start_0|> n = len(matrix) nums = [] for i in range(n): nums += matrix[i] nums.sort() return nums[k - 1] <|end_body_0|> <|body_start_1|> m, n = (len(matrix), len(matrix[0])) heap = [(matrix[0][0], 0, 0)] visited = set((0, 0)) res...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def kthSmallest(self, matrix, k): """:type matrix: List[List[int]] :type k: int :rtype: int""" <|body_0|> def kthSmallest2(self, matrix, k): """:type matrix: List[List[int]] :type k: int :rtype: int""" <|body_1|> def kthSmallest3(self, matrix, ...
stack_v2_sparse_classes_75kplus_train_000261
1,905
no_license
[ { "docstring": ":type matrix: List[List[int]] :type k: int :rtype: int", "name": "kthSmallest", "signature": "def kthSmallest(self, matrix, k)" }, { "docstring": ":type matrix: List[List[int]] :type k: int :rtype: int", "name": "kthSmallest2", "signature": "def kthSmallest2(self, matrix,...
3
stack_v2_sparse_classes_30k_train_036460
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]] :type k: int :rtype: int - def kthSmallest2(self, matrix, k): :type matrix: List[List[int]] :type k: int :rtype: i...
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]] :type k: int :rtype: int - def kthSmallest2(self, matrix, k): :type matrix: List[List[int]] :type k: int :rtype: i...
0fc4c7af59246e3064db41989a45d9db413a624b
<|skeleton|> class Solution: def kthSmallest(self, matrix, k): """:type matrix: List[List[int]] :type k: int :rtype: int""" <|body_0|> def kthSmallest2(self, matrix, k): """:type matrix: List[List[int]] :type k: int :rtype: int""" <|body_1|> def kthSmallest3(self, matrix, ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def kthSmallest(self, matrix, k): """:type matrix: List[List[int]] :type k: int :rtype: int""" n = len(matrix) nums = [] for i in range(n): nums += matrix[i] nums.sort() return nums[k - 1] def kthSmallest2(self, matrix, k): """...
the_stack_v2_python_sparse
378. Kth Smallest Element in a Sorted Matrix/ksmall.py
Macielyoung/LeetCode
train
1
d2261c6f89cbb4fb6445fc11f66e8a3a03826ed5
[ "Flux.__init__(self, fl_ty, fl_file)\nDetector.__init__(self, det_ty)\nself.expo = exposure\nself.nbins = nbins\nself.ctype = coherence_type\nif not bins:\n self.bins = np.linspace(self.er_min, self.er_max, nbins + 1)\nelse:\n self.bins = bins\nerl = np.linspace(self.bins[0], self.bins[self.bins.shape[0] - 1]...
<|body_start_0|> Flux.__init__(self, fl_ty, fl_file) Detector.__init__(self, det_ty) self.expo = exposure self.nbins = nbins self.ctype = coherence_type if not bins: self.bins = np.linspace(self.er_min, self.er_max, nbins + 1) else: self.bi...
class for certain type of experiment privide methods to calculate number of events in this experiment support faster calculation for events
Experiment
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Experiment: """class for certain type of experiment privide methods to calculate number of events in this experiment support faster calculation for events""" def __init__(self, fl_ty, det_ty, coherence_type, exposure, nbins=1, bins=None, fl_file=None): """initailize experiment :param...
stack_v2_sparse_classes_75kplus_train_000262
2,956
no_license
[ { "docstring": "initailize experiment :param fl_ty: flux type :param det_ty: detector type :param coherence_type: nucleus or electron :param exposure: exposure in kg*days :param nbins: number of bins, this will devide the default energy range of detector into nbins evenly :param bins: program will use this bins...
2
stack_v2_sparse_classes_30k_train_054606
Implement the Python class `Experiment` described below. Class description: class for certain type of experiment privide methods to calculate number of events in this experiment support faster calculation for events Method signatures and docstrings: - def __init__(self, fl_ty, det_ty, coherence_type, exposure, nbins=...
Implement the Python class `Experiment` described below. Class description: class for certain type of experiment privide methods to calculate number of events in this experiment support faster calculation for events Method signatures and docstrings: - def __init__(self, fl_ty, det_ty, coherence_type, exposure, nbins=...
c05ba95363b3da0b9172b2623bc7b91f0c12b6dd
<|skeleton|> class Experiment: """class for certain type of experiment privide methods to calculate number of events in this experiment support faster calculation for events""" def __init__(self, fl_ty, det_ty, coherence_type, exposure, nbins=1, bins=None, fl_file=None): """initailize experiment :param...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Experiment: """class for certain type of experiment privide methods to calculate number of events in this experiment support faster calculation for events""" def __init__(self, fl_ty, det_ty, coherence_type, exposure, nbins=1, bins=None, fl_file=None): """initailize experiment :param fl_ty: flux ...
the_stack_v2_python_sparse
pyCEvNS/experiments.py
aimer1016/pyCEvNS
train
0
0be92b83f773b5e47bd6f15cc2b76789be1c47a9
[ "if len(nums) <= 1:\n return False\ntable = {}\nfor i in range(len(nums)):\n val_required = target - nums[i]\n if val_required in table:\n return [table[val_required], i]\n else:\n table[nums[i]] = i", "if len(nums) <= 1:\n return False\nbag = set()\nfor i in range(len(nums)):\n va...
<|body_start_0|> if len(nums) <= 1: return False table = {} for i in range(len(nums)): val_required = target - nums[i] if val_required in table: return [table[val_required], i] else: table[nums[i]] = i <|end_body_0|>...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def twoSum(self, nums, target): """Return indices""" <|body_0|> def twoSum_return_values(self, nums, target): """Return values""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(nums) <= 1: return False table = {} ...
stack_v2_sparse_classes_75kplus_train_000263
892
no_license
[ { "docstring": "Return indices", "name": "twoSum", "signature": "def twoSum(self, nums, target)" }, { "docstring": "Return values", "name": "twoSum_return_values", "signature": "def twoSum_return_values(self, nums, target)" } ]
2
stack_v2_sparse_classes_30k_train_011384
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, nums, target): Return indices - def twoSum_return_values(self, nums, target): Return values
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, nums, target): Return indices - def twoSum_return_values(self, nums, target): Return values <|skeleton|> class Solution: def twoSum(self, nums, target): ...
5714fdb2d8a89a68d68d07f7ffd3f6bcff5b2ccf
<|skeleton|> class Solution: def twoSum(self, nums, target): """Return indices""" <|body_0|> def twoSum_return_values(self, nums, target): """Return values""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def twoSum(self, nums, target): """Return indices""" if len(nums) <= 1: return False table = {} for i in range(len(nums)): val_required = target - nums[i] if val_required in table: return [table[val_required], i] ...
the_stack_v2_python_sparse
Python/array/1_two_sum.py
01-Jacky/PracticeProblems
train
0
f71f00d6b9b71e1b44b2db7337cc945c2ea8f02e
[ "super().__init__(name)\nself.name = name\nself.storage_uri = storage_uri\nself.ready = False\nself.model: Optional[Data] = model", "model_folder = download_model(self.storage_uri)\nself.model: Data = load_detector(model_folder)\nself.ready = True" ]
<|body_start_0|> super().__init__(name) self.name = name self.storage_uri = storage_uri self.ready = False self.model: Optional[Data] = model <|end_body_0|> <|body_start_1|> model_folder = download_model(self.storage_uri) self.model: Data = load_detector(model_fo...
AlibiDetectModel
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlibiDetectModel: def __init__(self, name: str, storage_uri: str, model: Optional[Data]=None): """Outlier Detection Model Parameters ---------- name The name of the model storage_uri The URI location of the model""" <|body_0|> def load(self): """Load the model from s...
stack_v2_sparse_classes_75kplus_train_000264
1,031
permissive
[ { "docstring": "Outlier Detection Model Parameters ---------- name The name of the model storage_uri The URI location of the model", "name": "__init__", "signature": "def __init__(self, name: str, storage_uri: str, model: Optional[Data]=None)" }, { "docstring": "Load the model from storage", ...
2
stack_v2_sparse_classes_30k_train_019767
Implement the Python class `AlibiDetectModel` described below. Class description: Implement the AlibiDetectModel class. Method signatures and docstrings: - def __init__(self, name: str, storage_uri: str, model: Optional[Data]=None): Outlier Detection Model Parameters ---------- name The name of the model storage_uri ...
Implement the Python class `AlibiDetectModel` described below. Class description: Implement the AlibiDetectModel class. Method signatures and docstrings: - def __init__(self, name: str, storage_uri: str, model: Optional[Data]=None): Outlier Detection Model Parameters ---------- name The name of the model storage_uri ...
6652d080ea10cfca082be7090d12b9e776d96d7a
<|skeleton|> class AlibiDetectModel: def __init__(self, name: str, storage_uri: str, model: Optional[Data]=None): """Outlier Detection Model Parameters ---------- name The name of the model storage_uri The URI location of the model""" <|body_0|> def load(self): """Load the model from s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AlibiDetectModel: def __init__(self, name: str, storage_uri: str, model: Optional[Data]=None): """Outlier Detection Model Parameters ---------- name The name of the model storage_uri The URI location of the model""" super().__init__(name) self.name = name self.storage_uri = sto...
the_stack_v2_python_sparse
components/alibi-detect-server/adserver/base/alibi_model.py
SeldonIO/seldon-core
train
3,947
2b053f0c8b8c670d9f9f2a7891e795366367997b
[ "super(NameCell, self).__init__()\nself.mainEngine = mainEngine\nself.data = None\nif text:\n self.setContent(text)", "if self.mainEngine:\n contract = self.mainEngine.getContract(text)\n if contract:\n self.setText(contract.name)" ]
<|body_start_0|> super(NameCell, self).__init__() self.mainEngine = mainEngine self.data = None if text: self.setContent(text) <|end_body_0|> <|body_start_1|> if self.mainEngine: contract = self.mainEngine.getContract(text) if contract: ...
用来显示中文的单元格
NameCell
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NameCell: """用来显示中文的单元格""" def __init__(self, text=None, mainEngine=None): """Constructor""" <|body_0|> def setContent(self, text): """设置内容""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(NameCell, self).__init__() self.mainEngine ...
stack_v2_sparse_classes_75kplus_train_000265
10,286
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, text=None, mainEngine=None)" }, { "docstring": "设置内容", "name": "setContent", "signature": "def setContent(self, text)" } ]
2
stack_v2_sparse_classes_30k_train_017739
Implement the Python class `NameCell` described below. Class description: 用来显示中文的单元格 Method signatures and docstrings: - def __init__(self, text=None, mainEngine=None): Constructor - def setContent(self, text): 设置内容
Implement the Python class `NameCell` described below. Class description: 用来显示中文的单元格 Method signatures and docstrings: - def __init__(self, text=None, mainEngine=None): Constructor - def setContent(self, text): 设置内容 <|skeleton|> class NameCell: """用来显示中文的单元格""" def __init__(self, text=None, mainEngine=None)...
ef4a0f07d291fff2b71f67ade37f1aa56bf44af8
<|skeleton|> class NameCell: """用来显示中文的单元格""" def __init__(self, text=None, mainEngine=None): """Constructor""" <|body_0|> def setContent(self, text): """设置内容""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NameCell: """用来显示中文的单元格""" def __init__(self, text=None, mainEngine=None): """Constructor""" super(NameCell, self).__init__() self.mainEngine = mainEngine self.data = None if text: self.setContent(text) def setContent(self, text): """设置内容""...
the_stack_v2_python_sparse
fhBase.py
jiajielin/FATS
train
0
756f0e44b9617e1f4949bf55f8ff00207b2aba13
[ "self.model_dir = os.path.join(self.directory, 'novel')\nself.conf_file = 'lda.conf'\nself.__engine = InferenceEngine(self.model_dir, self.conf_file)\nself.vocab_path = os.path.join(self.model_dir, 'vocab_info.txt')\nlac = hub.Module(name='lac')\nself.__tokenizer = LACTokenizer(self.vocab_path, lac)\nself.vocabular...
<|body_start_0|> self.model_dir = os.path.join(self.directory, 'novel') self.conf_file = 'lda.conf' self.__engine = InferenceEngine(self.model_dir, self.conf_file) self.vocab_path = os.path.join(self.model_dir, 'vocab_info.txt') lac = hub.Module(name='lac') self.__tokeniz...
TopicModel
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TopicModel: def _initialize(self): """Initialize with the necessary elements.""" <|body_0|> def cal_doc_distance(self, doc_text1, doc_text2): """This interface calculates the distance between documents. Args: doc_text1(str): the input document text 1. doc_text2(str):...
stack_v2_sparse_classes_75kplus_train_000266
6,780
permissive
[ { "docstring": "Initialize with the necessary elements.", "name": "_initialize", "signature": "def _initialize(self)" }, { "docstring": "This interface calculates the distance between documents. Args: doc_text1(str): the input document text 1. doc_text2(str): the input document text 2. Returns: ...
6
stack_v2_sparse_classes_30k_train_015939
Implement the Python class `TopicModel` described below. Class description: Implement the TopicModel class. Method signatures and docstrings: - def _initialize(self): Initialize with the necessary elements. - def cal_doc_distance(self, doc_text1, doc_text2): This interface calculates the distance between documents. A...
Implement the Python class `TopicModel` described below. Class description: Implement the TopicModel class. Method signatures and docstrings: - def _initialize(self): Initialize with the necessary elements. - def cal_doc_distance(self, doc_text1, doc_text2): This interface calculates the distance between documents. A...
b402610a6f0b382a978e82473b541ea1fc6cf09a
<|skeleton|> class TopicModel: def _initialize(self): """Initialize with the necessary elements.""" <|body_0|> def cal_doc_distance(self, doc_text1, doc_text2): """This interface calculates the distance between documents. Args: doc_text1(str): the input document text 1. doc_text2(str):...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TopicModel: def _initialize(self): """Initialize with the necessary elements.""" self.model_dir = os.path.join(self.directory, 'novel') self.conf_file = 'lda.conf' self.__engine = InferenceEngine(self.model_dir, self.conf_file) self.vocab_path = os.path.join(self.model_...
the_stack_v2_python_sparse
modules/text/language_model/lda_novel/module.py
PaddlePaddle/PaddleHub
train
12,914
714b519b3a3fdd456aaaddfedb503a50d8a175ef
[ "super().__init__(name, priority, **options)\nfilters = options.get('filters')\nfilter_map = options.get('filter_map')\nif filters is not None and (not isinstance(filters, list)):\n raise FiltersMustBeListError('The provided value for \"filters\" must be a list.')\nif filter_map is not None and (not isinstance(f...
<|body_start_0|> super().__init__(name, priority, **options) filters = options.get('filters') filter_map = options.get('filter_map') if filters is not None and (not isinstance(filters, list)): raise FiltersMustBeListError('The provided value for "filters" must be a list.') ...
filter normalizer base class. this normalizer will filter provided values from string.
FilterNormalizerBase
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FilterNormalizerBase: """filter normalizer base class. this normalizer will filter provided values from string.""" def __init__(self, name, priority, **options): """initializes an instance of FilterNormalizerBase. :param str name: name of this normalizer. the normalizer will be regis...
stack_v2_sparse_classes_75kplus_train_000267
10,275
permissive
[ { "docstring": "initializes an instance of FilterNormalizerBase. :param str name: name of this normalizer. the normalizer will be registered by this name into available normalizers. it must be unique. :param int priority: priority of this normalizer. normalizers with higher priority will be executed sooner. :ke...
4
stack_v2_sparse_classes_30k_train_016132
Implement the Python class `FilterNormalizerBase` described below. Class description: filter normalizer base class. this normalizer will filter provided values from string. Method signatures and docstrings: - def __init__(self, name, priority, **options): initializes an instance of FilterNormalizerBase. :param str na...
Implement the Python class `FilterNormalizerBase` described below. Class description: filter normalizer base class. this normalizer will filter provided values from string. Method signatures and docstrings: - def __init__(self, name, priority, **options): initializes an instance of FilterNormalizerBase. :param str na...
9d4776498225de4f3d16a4600b5b19212abe8562
<|skeleton|> class FilterNormalizerBase: """filter normalizer base class. this normalizer will filter provided values from string.""" def __init__(self, name, priority, **options): """initializes an instance of FilterNormalizerBase. :param str name: name of this normalizer. the normalizer will be regis...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FilterNormalizerBase: """filter normalizer base class. this normalizer will filter provided values from string.""" def __init__(self, name, priority, **options): """initializes an instance of FilterNormalizerBase. :param str name: name of this normalizer. the normalizer will be registered by this...
the_stack_v2_python_sparse
src/pyrin/utilities/string/normalizer/handlers/base.py
mononobi/pyrin
train
20
1220683cc9a5a9726513555ee4854f134530c651
[ "body_model, response_model = rest_model('service_queue', 'post')\nbody = self.parse_bodymodel(body_model)\nnew_services = []\nfor service_input in body.data:\n if isinstance(service_input.initial_molecule, list):\n molecules = self.storage.get_add_molecules_mixed(service_input.initial_molecule)['data']\n...
<|body_start_0|> body_model, response_model = rest_model('service_queue', 'post') body = self.parse_bodymodel(body_model) new_services = [] for service_input in body.data: if isinstance(service_input.initial_molecule, list): molecules = self.storage.get_add_mo...
Handles service management (querying/add/modifying)
ServiceQueueHandler
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ServiceQueueHandler: """Handles service management (querying/add/modifying)""" def post(self): """Posts new services to the service queue.""" <|body_0|> def get(self): """Gets information about services from the service queue.""" <|body_1|> def put(s...
stack_v2_sparse_classes_75kplus_train_000268
16,609
permissive
[ { "docstring": "Posts new services to the service queue.", "name": "post", "signature": "def post(self)" }, { "docstring": "Gets information about services from the service queue.", "name": "get", "signature": "def get(self)" }, { "docstring": "Modifies services in the service qu...
3
stack_v2_sparse_classes_30k_train_014072
Implement the Python class `ServiceQueueHandler` described below. Class description: Handles service management (querying/add/modifying) Method signatures and docstrings: - def post(self): Posts new services to the service queue. - def get(self): Gets information about services from the service queue. - def put(self)...
Implement the Python class `ServiceQueueHandler` described below. Class description: Handles service management (querying/add/modifying) Method signatures and docstrings: - def post(self): Posts new services to the service queue. - def get(self): Gets information about services from the service queue. - def put(self)...
e48ac2fd5e0bfde56ada9520db64bcc2cb8d8c0d
<|skeleton|> class ServiceQueueHandler: """Handles service management (querying/add/modifying)""" def post(self): """Posts new services to the service queue.""" <|body_0|> def get(self): """Gets information about services from the service queue.""" <|body_1|> def put(s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ServiceQueueHandler: """Handles service management (querying/add/modifying)""" def post(self): """Posts new services to the service queue.""" body_model, response_model = rest_model('service_queue', 'post') body = self.parse_bodymodel(body_model) new_services = [] ...
the_stack_v2_python_sparse
qcfractal/queue/handlers.py
ahurta92/QCFractal
train
0
ea8c39bc97a8e417a50e5e3755f7ac3f1c4180d4
[ "self._logger = logging.getLogger('stone.compiler')\nself.api = api\nself.backend_module = backend_module\nself.backend_args = backend_args\nself.build_path = build_path\nif clean_build and os.path.exists(self.build_path):\n logging.info('Cleaning existing build directory %s...', self.build_path)\n shutil.rmt...
<|body_start_0|> self._logger = logging.getLogger('stone.compiler') self.api = api self.backend_module = backend_module self.backend_args = backend_args self.build_path = build_path if clean_build and os.path.exists(self.build_path): logging.info('Cleaning exi...
Applies a collection of backends found in a single backend module to an API specification.
Compiler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Compiler: """Applies a collection of backends found in a single backend module to an API specification.""" def __init__(self, api, backend_module, backend_args, build_path, clean_build=False): """Creates a Compiler. :param stone.ir.Api api: A Stone description of the API. :param back...
stack_v2_sparse_classes_75kplus_train_000269
4,380
permissive
[ { "docstring": "Creates a Compiler. :param stone.ir.Api api: A Stone description of the API. :param backend_module: Python module that contains at least one top-level class definition that descends from a :class:`stone.backend.Backend`. :param list(str) backend_args: A list of command-line arguments to pass to ...
5
stack_v2_sparse_classes_30k_train_000148
Implement the Python class `Compiler` described below. Class description: Applies a collection of backends found in a single backend module to an API specification. Method signatures and docstrings: - def __init__(self, api, backend_module, backend_args, build_path, clean_build=False): Creates a Compiler. :param ston...
Implement the Python class `Compiler` described below. Class description: Applies a collection of backends found in a single backend module to an API specification. Method signatures and docstrings: - def __init__(self, api, backend_module, backend_args, build_path, clean_build=False): Creates a Compiler. :param ston...
0c9ceb748ac4dcdea5ff69c97704daccdcb7e60e
<|skeleton|> class Compiler: """Applies a collection of backends found in a single backend module to an API specification.""" def __init__(self, api, backend_module, backend_args, build_path, clean_build=False): """Creates a Compiler. :param stone.ir.Api api: A Stone description of the API. :param back...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Compiler: """Applies a collection of backends found in a single backend module to an API specification.""" def __init__(self, api, backend_module, backend_args, build_path, clean_build=False): """Creates a Compiler. :param stone.ir.Api api: A Stone description of the API. :param backend_module: P...
the_stack_v2_python_sparse
stone/compiler.py
dropbox/stone
train
440
f4b0941698832cfc6d37aa6fe89a0a6ff3d8fe92
[ "if not local_filename:\n try:\n os.makedirs(os.path.join(target_bucket_name, bucket_folder))\n except OSError:\n pass\n filename = os.path.join(target_bucket_name, bucket_folder, BqWriter.FILENAME)\n dataframe.to_csv(filename, index=False)\n logging.info('data written to %s', filename)...
<|body_start_0|> if not local_filename: try: os.makedirs(os.path.join(target_bucket_name, bucket_folder)) except OSError: pass filename = os.path.join(target_bucket_name, bucket_folder, BqWriter.FILENAME) dataframe.to_csv(filename, ...
Write data to BigQuery via GCS.
BqWriter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BqWriter: """Write data to BigQuery via GCS.""" def _write_to_csv(self, dataframe, target_bucket_name, bucket_folder, local_filename=None): """write dataframe to CSV (unless written already and specified in local_filename) Args: dataframe (pandas dataframe): data to be written, None ...
stack_v2_sparse_classes_75kplus_train_000270
5,070
permissive
[ { "docstring": "write dataframe to CSV (unless written already and specified in local_filename) Args: dataframe (pandas dataframe): data to be written, None if local_filename is supplied target_bucket_name (str): name of GCS bucket bucket_folder (str): name of GCS folder local_filename (str): optional, filename...
5
null
Implement the Python class `BqWriter` described below. Class description: Write data to BigQuery via GCS. Method signatures and docstrings: - def _write_to_csv(self, dataframe, target_bucket_name, bucket_folder, local_filename=None): write dataframe to CSV (unless written already and specified in local_filename) Args...
Implement the Python class `BqWriter` described below. Class description: Write data to BigQuery via GCS. Method signatures and docstrings: - def _write_to_csv(self, dataframe, target_bucket_name, bucket_folder, local_filename=None): write dataframe to CSV (unless written already and specified in local_filename) Args...
cded1fd6a916cedebfd4a5b21993ce117a4a1a11
<|skeleton|> class BqWriter: """Write data to BigQuery via GCS.""" def _write_to_csv(self, dataframe, target_bucket_name, bucket_folder, local_filename=None): """write dataframe to CSV (unless written already and specified in local_filename) Args: dataframe (pandas dataframe): data to be written, None ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BqWriter: """Write data to BigQuery via GCS.""" def _write_to_csv(self, dataframe, target_bucket_name, bucket_folder, local_filename=None): """write dataframe to CSV (unless written already and specified in local_filename) Args: dataframe (pandas dataframe): data to be written, None if local_file...
the_stack_v2_python_sparse
lkmltools/bq_writer.py
mborukhava/lookml-tools
train
1
6c3813c56df3525f2046f4581b4145b41071e048
[ "self.board = board\nself.id = data['id']\nself.name = data['name']\nself.health = data['health']\nself.head = Point(data['body'][0]['x'], data['body'][0]['y'])\nself.tail = Point(data['body'][-1]['x'], data['body'][-1]['y'])\nself.body = []\nfor b in data['body'][1:]:\n self.body.append(Point(b['x'], b['y']))\n...
<|body_start_0|> self.board = board self.id = data['id'] self.name = data['name'] self.health = data['health'] self.head = Point(data['body'][0]['x'], data['body'][0]['y']) self.tail = Point(data['body'][-1]['x'], data['body'][-1]['y']) self.body = [] for ...
Simple class to represent a snake
Snake
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Snake: """Simple class to represent a snake""" def __init__(self, board, data): """Sets up the snake's information""" <|body_0|> def valid_moves(self): """Returns a list of moves that will not immediately kill the snake""" <|body_1|> <|end_skeleton|> <|...
stack_v2_sparse_classes_75kplus_train_000271
12,450
permissive
[ { "docstring": "Sets up the snake's information", "name": "__init__", "signature": "def __init__(self, board, data)" }, { "docstring": "Returns a list of moves that will not immediately kill the snake", "name": "valid_moves", "signature": "def valid_moves(self)" } ]
2
stack_v2_sparse_classes_30k_train_021804
Implement the Python class `Snake` described below. Class description: Simple class to represent a snake Method signatures and docstrings: - def __init__(self, board, data): Sets up the snake's information - def valid_moves(self): Returns a list of moves that will not immediately kill the snake
Implement the Python class `Snake` described below. Class description: Simple class to represent a snake Method signatures and docstrings: - def __init__(self, board, data): Sets up the snake's information - def valid_moves(self): Returns a list of moves that will not immediately kill the snake <|skeleton|> class Sn...
79495dcb5f84fca1d67b563380f3b9a1e961db02
<|skeleton|> class Snake: """Simple class to represent a snake""" def __init__(self, board, data): """Sets up the snake's information""" <|body_0|> def valid_moves(self): """Returns a list of moves that will not immediately kill the snake""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Snake: """Simple class to represent a snake""" def __init__(self, board, data): """Sets up the snake's information""" self.board = board self.id = data['id'] self.name = data['name'] self.health = data['health'] self.head = Point(data['body'][0]['x'], data[...
the_stack_v2_python_sparse
app/main.py
CallumBrown743/starter-snake-python
train
0
3eef77dfa14cb04fdf76c18e289dbd1d703a422d
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
RemoteIdentities assign a resource directly to an account, giving the account the permission to connect to that resource.
RemoteIdentitiesServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RemoteIdentitiesServicer: """RemoteIdentities assign a resource directly to an account, giving the account the permission to connect to that resource.""" def Create(self, request, context): """Create registers a new RemoteIdentity.""" <|body_0|> def Get(self, request, co...
stack_v2_sparse_classes_75kplus_train_000272
9,790
permissive
[ { "docstring": "Create registers a new RemoteIdentity.", "name": "Create", "signature": "def Create(self, request, context)" }, { "docstring": "Get reads one RemoteIdentity by ID.", "name": "Get", "signature": "def Get(self, request, context)" }, { "docstring": "Update replaces a...
5
stack_v2_sparse_classes_30k_train_000405
Implement the Python class `RemoteIdentitiesServicer` described below. Class description: RemoteIdentities assign a resource directly to an account, giving the account the permission to connect to that resource. Method signatures and docstrings: - def Create(self, request, context): Create registers a new RemoteIdent...
Implement the Python class `RemoteIdentitiesServicer` described below. Class description: RemoteIdentities assign a resource directly to an account, giving the account the permission to connect to that resource. Method signatures and docstrings: - def Create(self, request, context): Create registers a new RemoteIdent...
1f3a53ef8c404e64d9324f9fd13f5c39c71eaca5
<|skeleton|> class RemoteIdentitiesServicer: """RemoteIdentities assign a resource directly to an account, giving the account the permission to connect to that resource.""" def Create(self, request, context): """Create registers a new RemoteIdentity.""" <|body_0|> def Get(self, request, co...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RemoteIdentitiesServicer: """RemoteIdentities assign a resource directly to an account, giving the account the permission to connect to that resource.""" def Create(self, request, context): """Create registers a new RemoteIdentity.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) ...
the_stack_v2_python_sparse
strongdm/remote_identities_pb2_grpc.py
strongdm/strongdm-sdk-python
train
9
7b72dec0151c5291965009141a83f687bc58b48f
[ "self.ans = ans\nself.cont = cont\nself.name = name", "part: Part = mkr.parent\ntime = np.array(self.ans.results['TIME'].values)\nI_or_J = 'I' if i_part else 'J'\ntrack_gcs = CS(np.array([Adams.evaluate_exp(f'{self.name}.{I_or_J}_Point.{d}.values') for d in ('X', 'Y', 'Z')]).T)\nmkr_gcs = MarkerCS(mkr, self.ans)\...
<|body_start_0|> self.ans = ans self.cont = cont self.name = name <|end_body_0|> <|body_start_1|> part: Part = mkr.parent time = np.array(self.ans.results['TIME'].values) I_or_J = 'I' if i_part else 'J' track_gcs = CS(np.array([Adams.evaluate_exp(f'{self.name}.{I...
Class for managing contact track data
Track
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Track: """Class for managing contact track data""" def __init__(self, ans: Analysis, cont: Contact, name: str) -> None: """Class for managing contact track data Parameters ---------- ans : Analysis Adams analysis cont : Contact Parent Adams `Contact` object name : str Full name of co...
stack_v2_sparse_classes_75kplus_train_000273
10,716
permissive
[ { "docstring": "Class for managing contact track data Parameters ---------- ans : Analysis Adams analysis cont : Contact Parent Adams `Contact` object name : str Full name of contact track", "name": "__init__", "signature": "def __init__(self, ans: Analysis, cont: Contact, name: str) -> None" }, { ...
2
stack_v2_sparse_classes_30k_test_000214
Implement the Python class `Track` described below. Class description: Class for managing contact track data Method signatures and docstrings: - def __init__(self, ans: Analysis, cont: Contact, name: str) -> None: Class for managing contact track data Parameters ---------- ans : Analysis Adams analysis cont : Contact...
Implement the Python class `Track` described below. Class description: Class for managing contact track data Method signatures and docstrings: - def __init__(self, ans: Analysis, cont: Contact, name: str) -> None: Class for managing contact track data Parameters ---------- ans : Analysis Adams analysis cont : Contact...
ca147da3201b3e083f59aa438d4b9c541db162d9
<|skeleton|> class Track: """Class for managing contact track data""" def __init__(self, ans: Analysis, cont: Contact, name: str) -> None: """Class for managing contact track data Parameters ---------- ans : Analysis Adams analysis cont : Contact Parent Adams `Contact` object name : str Full name of co...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Track: """Class for managing contact track data""" def __init__(self, ans: Analysis, cont: Contact, name: str) -> None: """Class for managing contact track data Parameters ---------- ans : Analysis Adams analysis cont : Contact Parent Adams `Contact` object name : str Full name of contact track""...
the_stack_v2_python_sparse
aviewpy/contact.py
bthornton191/aviewpy
train
0
ca3e6c50ee6c12dfed3588318923f3633bf9dc9a
[ "try:\n verify_token(request.headers)\nexcept Exception as err:\n ns.abort(401, message=err)\ntry:\n obs = observaciones_ires_cytg.read(id)\nexcept psycopg2.Error as err:\n ns.abort(400, message=get_msg_pgerror(err))\nexcept EmptySetError:\n ns.abort(404, message=ObservacionCyTG.obs_not_found)\nexcep...
<|body_start_0|> try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) try: obs = observaciones_ires_cytg.read(id) except psycopg2.Error as err: ns.abort(400, message=get_msg_pgerror(err)) except Emp...
ObservacionCyTG
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObservacionCyTG: def get(self, id): """To fetch an observation (CyTG (resultados))""" <|body_0|> def put(self, id): """To update an observation (CyTG (resultados))""" <|body_1|> def delete(self, id): """To delete an observation (CyTG (resultados)...
stack_v2_sparse_classes_75kplus_train_000274
18,120
no_license
[ { "docstring": "To fetch an observation (CyTG (resultados))", "name": "get", "signature": "def get(self, id)" }, { "docstring": "To update an observation (CyTG (resultados))", "name": "put", "signature": "def put(self, id)" }, { "docstring": "To delete an observation (CyTG (resul...
3
stack_v2_sparse_classes_30k_train_041790
Implement the Python class `ObservacionCyTG` described below. Class description: Implement the ObservacionCyTG class. Method signatures and docstrings: - def get(self, id): To fetch an observation (CyTG (resultados)) - def put(self, id): To update an observation (CyTG (resultados)) - def delete(self, id): To delete a...
Implement the Python class `ObservacionCyTG` described below. Class description: Implement the ObservacionCyTG class. Method signatures and docstrings: - def get(self, id): To fetch an observation (CyTG (resultados)) - def put(self, id): To update an observation (CyTG (resultados)) - def delete(self, id): To delete a...
e00610fac26ef3ca078fd037c0649b70fa0e9a09
<|skeleton|> class ObservacionCyTG: def get(self, id): """To fetch an observation (CyTG (resultados))""" <|body_0|> def put(self, id): """To update an observation (CyTG (resultados))""" <|body_1|> def delete(self, id): """To delete an observation (CyTG (resultados)...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ObservacionCyTG: def get(self, id): """To fetch an observation (CyTG (resultados))""" try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) try: obs = observaciones_ires_cytg.read(id) except psycopg2.E...
the_stack_v2_python_sparse
DOS/soa/service/genl/endpoints/observaciones_ires_cytg.py
Telematica/knight-rider
train
1
f17675f40d03e21acb517b6ae8fcdbe11b0c8865
[ "image_id = 'invalid'\nwith self.assertRaises(ItemNotFound):\n self.images_client.list_members(image_id)", "image_id = ''\nwith self.assertRaises(ItemNotFound):\n self.images_client.list_members(image_id)", "member_id = self.alt_tenant_id\nimage = self.images_behavior.create_image_via_task()\nresponse = s...
<|body_start_0|> image_id = 'invalid' with self.assertRaises(ItemNotFound): self.images_client.list_members(image_id) <|end_body_0|> <|body_start_1|> image_id = '' with self.assertRaises(ItemNotFound): self.images_client.list_members(image_id) <|end_body_1|> <|b...
TestGetImageMembersNegative
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestGetImageMembersNegative: def test_get_image_members_using_invalid_image_id(self): """@summary: Get image members using invalid image id 1) Get image members using invalid image id 2) Verify that the response code is 404""" <|body_0|> def test_get_image_members_using_blan...
stack_v2_sparse_classes_75kplus_train_000275
2,950
permissive
[ { "docstring": "@summary: Get image members using invalid image id 1) Get image members using invalid image id 2) Verify that the response code is 404", "name": "test_get_image_members_using_invalid_image_id", "signature": "def test_get_image_members_using_invalid_image_id(self)" }, { "docstring...
4
stack_v2_sparse_classes_30k_test_000688
Implement the Python class `TestGetImageMembersNegative` described below. Class description: Implement the TestGetImageMembersNegative class. Method signatures and docstrings: - def test_get_image_members_using_invalid_image_id(self): @summary: Get image members using invalid image id 1) Get image members using inval...
Implement the Python class `TestGetImageMembersNegative` described below. Class description: Implement the TestGetImageMembersNegative class. Method signatures and docstrings: - def test_get_image_members_using_invalid_image_id(self): @summary: Get image members using invalid image id 1) Get image members using inval...
30f0e64672676c3f90b4a582fe90fac6621475b3
<|skeleton|> class TestGetImageMembersNegative: def test_get_image_members_using_invalid_image_id(self): """@summary: Get image members using invalid image id 1) Get image members using invalid image id 2) Verify that the response code is 404""" <|body_0|> def test_get_image_members_using_blan...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestGetImageMembersNegative: def test_get_image_members_using_invalid_image_id(self): """@summary: Get image members using invalid image id 1) Get image members using invalid image id 2) Verify that the response code is 404""" image_id = 'invalid' with self.assertRaises(ItemNotFound): ...
the_stack_v2_python_sparse
cloudroast/images/v2/functional/test_get_image_members_negative.py
RULCSoft/cloudroast
train
1
0652061822a47326b20649f38e1742d132e97956
[ "super(CopyAndPublishTwoVersionsRepoTestCase, cls).setUpClass()\ncls.rpm_dict = {key: value for key, value in _get_rpm_names_versions(cls.cfg, _REPO_ID).items() if len(value) > 1}\nassert len(cls.rpm_dict) > 0\ncls.rpm_name = cls.rpm_dict.keys()[0]\ncls.rpm_dict.get(cls.rpm_name).sort()", "rpm_version = self.rpm_...
<|body_start_0|> super(CopyAndPublishTwoVersionsRepoTestCase, cls).setUpClass() cls.rpm_dict = {key: value for key, value in _get_rpm_names_versions(cls.cfg, _REPO_ID).items() if len(value) > 1} assert len(cls.rpm_dict) > 0 cls.rpm_name = cls.rpm_dict.keys()[0] cls.rpm_dict.get(c...
Test whether a repo can copy two versions of RPMs and publish itself. This test targets `Pulp Smash #311`_. The test steps are as follow: 1. Create a repo1 and sync from upstream. 2. Find a RPM that has two different versions in this repo. 3. Create a new repo2 and copy the older of the RPM version into it. 4. Publish ...
CopyAndPublishTwoVersionsRepoTestCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CopyAndPublishTwoVersionsRepoTestCase: """Test whether a repo can copy two versions of RPMs and publish itself. This test targets `Pulp Smash #311`_. The test steps are as follow: 1. Create a repo1 and sync from upstream. 2. Find a RPM that has two different versions in this repo. 3. Create a new...
stack_v2_sparse_classes_75kplus_train_000276
16,862
no_license
[ { "docstring": "Create two repositories and synchronize the 1st repo only.", "name": "setUpClass", "signature": "def setUpClass(cls)" }, { "docstring": "Copy a RPM with older version into repo2 and publish repo2.", "name": "test_01_copy_older_publish", "signature": "def test_01_copy_olde...
6
stack_v2_sparse_classes_30k_test_002275
Implement the Python class `CopyAndPublishTwoVersionsRepoTestCase` described below. Class description: Test whether a repo can copy two versions of RPMs and publish itself. This test targets `Pulp Smash #311`_. The test steps are as follow: 1. Create a repo1 and sync from upstream. 2. Find a RPM that has two different...
Implement the Python class `CopyAndPublishTwoVersionsRepoTestCase` described below. Class description: Test whether a repo can copy two versions of RPMs and publish itself. This test targets `Pulp Smash #311`_. The test steps are as follow: 1. Create a repo1 and sync from upstream. 2. Find a RPM that has two different...
539c3c8965e749410f22d686eed1a20b65339821
<|skeleton|> class CopyAndPublishTwoVersionsRepoTestCase: """Test whether a repo can copy two versions of RPMs and publish itself. This test targets `Pulp Smash #311`_. The test steps are as follow: 1. Create a repo1 and sync from upstream. 2. Find a RPM that has two different versions in this repo. 3. Create a new...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CopyAndPublishTwoVersionsRepoTestCase: """Test whether a repo can copy two versions of RPMs and publish itself. This test targets `Pulp Smash #311`_. The test steps are as follow: 1. Create a repo1 and sync from upstream. 2. Find a RPM that has two different versions in this repo. 3. Create a new repo2 and co...
the_stack_v2_python_sparse
summer2016/test_copy_units.py
danuzclaudes/redhat-summer-internship
train
2
553aa3e8e2e8bf366ec80caf2dfa415dc5e4c5e0
[ "super(SpatialAttention, self).__init__()\nassert kernel_size in (3, 7), 'kernel size must be 3 or 7'\npadding = 3 if kernel_size == 7 else 1\nself.conv1 = nn.Conv2d(2, 1, kernel_size, padding=padding, bias=False)\nself.sigmoid = nn.Sigmoid()", "avg_out = torch.mean(x, dim=1, keepdim=True)\nmax_out, _ = torch.max...
<|body_start_0|> super(SpatialAttention, self).__init__() assert kernel_size in (3, 7), 'kernel size must be 3 or 7' padding = 3 if kernel_size == 7 else 1 self.conv1 = nn.Conv2d(2, 1, kernel_size, padding=padding, bias=False) self.sigmoid = nn.Sigmoid() <|end_body_0|> <|body_st...
SpatialAttention
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpatialAttention: def __init__(self, kernel_size=7): """spatial_attention""" <|body_0|> def forward(self, x): """前向传播 :param: x 特征变量 return out: 注意力系数""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(SpatialAttention, self).__init__() a...
stack_v2_sparse_classes_75kplus_train_000277
36,979
no_license
[ { "docstring": "spatial_attention", "name": "__init__", "signature": "def __init__(self, kernel_size=7)" }, { "docstring": "前向传播 :param: x 特征变量 return out: 注意力系数", "name": "forward", "signature": "def forward(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_054071
Implement the Python class `SpatialAttention` described below. Class description: Implement the SpatialAttention class. Method signatures and docstrings: - def __init__(self, kernel_size=7): spatial_attention - def forward(self, x): 前向传播 :param: x 特征变量 return out: 注意力系数
Implement the Python class `SpatialAttention` described below. Class description: Implement the SpatialAttention class. Method signatures and docstrings: - def __init__(self, kernel_size=7): spatial_attention - def forward(self, x): 前向传播 :param: x 特征变量 return out: 注意力系数 <|skeleton|> class SpatialAttention: def ...
2a68fd854bc5b1806319dfc40e36e084f9c4c5d0
<|skeleton|> class SpatialAttention: def __init__(self, kernel_size=7): """spatial_attention""" <|body_0|> def forward(self, x): """前向传播 :param: x 特征变量 return out: 注意力系数""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SpatialAttention: def __init__(self, kernel_size=7): """spatial_attention""" super(SpatialAttention, self).__init__() assert kernel_size in (3, 7), 'kernel size must be 3 or 7' padding = 3 if kernel_size == 7 else 1 self.conv1 = nn.Conv2d(2, 1, kernel_size, padding=padd...
the_stack_v2_python_sparse
code_keh/2d/Pytorch_nets_channel1.py
ruichen9/3DCTLungDiseaseDiagnosis
train
0
246941445c039af139c35c487f9b116e8ab9483e
[ "if transitions is not None:\n logging._info('Running model with %s transitions' % transitions)\nif minutes is not None:\n logging._info('Running model for %s minutes' % minutes)\nlogging._info('Running %s model' % type)\nmbt = StateChartMBT(model, debug, skip_keyword_validation)\nmbt.run_random_path(type=typ...
<|body_start_0|> if transitions is not None: logging._info('Running model with %s transitions' % transitions) if minutes is not None: logging._info('Running model for %s minutes' % minutes) logging._info('Running %s model' % type) mbt = StateChartMBT(model, debug,...
MBTKeywords
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MBTKeywords: def run_random_model(self, model, type='online', file=None, transitions=None, minutes=None, debug=0, skip_keyword_validation=0): """Executes a Model based test in a random sequence constrained by time or number of transitions. Example: | Run Random Model | model=model1.xml |...
stack_v2_sparse_classes_75kplus_train_000278
3,648
no_license
[ { "docstring": "Executes a Model based test in a random sequence constrained by time or number of transitions. Example: | Run Random Model | model=model1.xml | minutes=30 | Run Random Model | model=model1.xml | transitions=10", "name": "run_random_model", "signature": "def run_random_model(self, model, ...
3
stack_v2_sparse_classes_30k_train_007011
Implement the Python class `MBTKeywords` described below. Class description: Implement the MBTKeywords class. Method signatures and docstrings: - def run_random_model(self, model, type='online', file=None, transitions=None, minutes=None, debug=0, skip_keyword_validation=0): Executes a Model based test in a random seq...
Implement the Python class `MBTKeywords` described below. Class description: Implement the MBTKeywords class. Method signatures and docstrings: - def run_random_model(self, model, type='online', file=None, transitions=None, minutes=None, debug=0, skip_keyword_validation=0): Executes a Model based test in a random seq...
24a74926170cbdfafa47e972644e2fe5b627d8ff
<|skeleton|> class MBTKeywords: def run_random_model(self, model, type='online', file=None, transitions=None, minutes=None, debug=0, skip_keyword_validation=0): """Executes a Model based test in a random sequence constrained by time or number of transitions. Example: | Run Random Model | model=model1.xml |...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MBTKeywords: def run_random_model(self, model, type='online', file=None, transitions=None, minutes=None, debug=0, skip_keyword_validation=0): """Executes a Model based test in a random sequence constrained by time or number of transitions. Example: | Run Random Model | model=model1.xml | minutes=30 | ...
the_stack_v2_python_sparse
robo4.2/4.2/lib/python2.7/site-packages/RoboGalaxyLibrary/mbt/mbt.py
richa92/Jenkin_Regression_Testing
train
0
9bcc5deee41ad19ffd33eac2fbe0436e468d69f3
[ "if Setting.objects.filter(is_active=True).count() > 0:\n return False\nreturn True", "if not obj:\n return True\nelse:\n if Setting.objects.filter(is_active=True).exclude(pk=obj.pk).count() == 0:\n return False\n return True" ]
<|body_start_0|> if Setting.objects.filter(is_active=True).count() > 0: return False return True <|end_body_0|> <|body_start_1|> if not obj: return True else: if Setting.objects.filter(is_active=True).exclude(pk=obj.pk).count() == 0: r...
SettingAdmin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SettingAdmin: def has_add_permission(self, request): """Prohibits adding a new row of settings if there is already an active group of settings.""" <|body_0|> def has_delete_permission(self, request, obj=None): """Disallows deleting the last active settings row.""" ...
stack_v2_sparse_classes_75kplus_train_000279
2,083
no_license
[ { "docstring": "Prohibits adding a new row of settings if there is already an active group of settings.", "name": "has_add_permission", "signature": "def has_add_permission(self, request)" }, { "docstring": "Disallows deleting the last active settings row.", "name": "has_delete_permission", ...
2
stack_v2_sparse_classes_30k_train_016500
Implement the Python class `SettingAdmin` described below. Class description: Implement the SettingAdmin class. Method signatures and docstrings: - def has_add_permission(self, request): Prohibits adding a new row of settings if there is already an active group of settings. - def has_delete_permission(self, request, ...
Implement the Python class `SettingAdmin` described below. Class description: Implement the SettingAdmin class. Method signatures and docstrings: - def has_add_permission(self, request): Prohibits adding a new row of settings if there is already an active group of settings. - def has_delete_permission(self, request, ...
27ab37b5e488335db128d8774752b6f9a404fac4
<|skeleton|> class SettingAdmin: def has_add_permission(self, request): """Prohibits adding a new row of settings if there is already an active group of settings.""" <|body_0|> def has_delete_permission(self, request, obj=None): """Disallows deleting the last active settings row.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SettingAdmin: def has_add_permission(self, request): """Prohibits adding a new row of settings if there is already an active group of settings.""" if Setting.objects.filter(is_active=True).count() > 0: return False return True def has_delete_permission(self, request, o...
the_stack_v2_python_sparse
apps/site_settings/admin.py
cheetos007/owantsbeta_git
train
0
8b085fff21261152e2cd43b3d0704ed56eb23550
[ "parkDict = self.getDictBykey(Index(self.Session).getParkingBaseDataTree().json(), 'name', parkName)\nself.url = '/mgr/park/park_redlist/add.do'\ndata = {'redlistParam': carNum, 'parkIds': parkDict['value']}\nre = self.post(self.api, data=data, headers=form_headers)\nreturn re.json()", "WhilelistDict = self.getDi...
<|body_start_0|> parkDict = self.getDictBykey(Index(self.Session).getParkingBaseDataTree().json(), 'name', parkName) self.url = '/mgr/park/park_redlist/add.do' data = {'redlistParam': carNum, 'parkIds': parkDict['value']} re = self.post(self.api, data=data, headers=form_headers) ...
白名单
ParkWhitelist
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ParkWhitelist: """白名单""" def addWhitelist(self, parkName, carNum): """录入白名单""" <|body_0|> def delWhilelist(self, carNum): """删除白名单规则""" <|body_1|> def getWhilelistRuleList(self): """获取白名单规则列表""" <|body_2|> <|end_skeleton|> <|body_st...
stack_v2_sparse_classes_75kplus_train_000280
13,467
no_license
[ { "docstring": "录入白名单", "name": "addWhitelist", "signature": "def addWhitelist(self, parkName, carNum)" }, { "docstring": "删除白名单规则", "name": "delWhilelist", "signature": "def delWhilelist(self, carNum)" }, { "docstring": "获取白名单规则列表", "name": "getWhilelistRuleList", "signa...
3
stack_v2_sparse_classes_30k_train_011702
Implement the Python class `ParkWhitelist` described below. Class description: 白名单 Method signatures and docstrings: - def addWhitelist(self, parkName, carNum): 录入白名单 - def delWhilelist(self, carNum): 删除白名单规则 - def getWhilelistRuleList(self): 获取白名单规则列表
Implement the Python class `ParkWhitelist` described below. Class description: 白名单 Method signatures and docstrings: - def addWhitelist(self, parkName, carNum): 录入白名单 - def delWhilelist(self, carNum): 删除白名单规则 - def getWhilelistRuleList(self): 获取白名单规则列表 <|skeleton|> class ParkWhitelist: """白名单""" def addWhit...
34c368c109867da26d9256bca85f872b0fac2ea7
<|skeleton|> class ParkWhitelist: """白名单""" def addWhitelist(self, parkName, carNum): """录入白名单""" <|body_0|> def delWhilelist(self, carNum): """删除白名单规则""" <|body_1|> def getWhilelistRuleList(self): """获取白名单规则列表""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ParkWhitelist: """白名单""" def addWhitelist(self, parkName, carNum): """录入白名单""" parkDict = self.getDictBykey(Index(self.Session).getParkingBaseDataTree().json(), 'name', parkName) self.url = '/mgr/park/park_redlist/add.do' data = {'redlistParam': carNum, 'parkIds': parkDict...
the_stack_v2_python_sparse
Api/parkingManage_service/carTypeManage_service/carTypeConfig.py
oyebino/pomp_api
train
1
18f32e2252a26b1e73345ef621ed073d28fd329a
[ "self._dsets_info_file = dsets_info_filename\nself._root = ET.parse(self._dsets_info_file).getroot()\nself._hps = self._root.findall('hard_process')", "for hp in self._hps:\n for dset in hp.findall('dset'):\n if dset.get('dtag') in filename:\n return (hp, dset.get('dtag'))\nreturn None" ]
<|body_start_0|> self._dsets_info_file = dsets_info_filename self._root = ET.parse(self._dsets_info_file).getroot() self._hps = self._root.findall('hard_process') <|end_body_0|> <|body_start_1|> for hp in self._hps: for dset in hp.findall('dset'): if dset.get...
DsetsInfo handles the access to the dsets_info.xml file from Python
DsetsInfo
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DsetsInfo: """DsetsInfo handles the access to the dsets_info.xml file from Python""" def __init__(self, dsets_info_filename='dsets_info_3.xml'): """__init__(self, dsets_info_filename='dsets_info_3.xml') dsets_info_filename -- the path to the XML file""" <|body_0|> def ma...
stack_v2_sparse_classes_75kplus_train_000281
2,676
no_license
[ { "docstring": "__init__(self, dsets_info_filename='dsets_info_3.xml') dsets_info_filename -- the path to the XML file", "name": "__init__", "signature": "def __init__(self, dsets_info_filename='dsets_info_3.xml')" }, { "docstring": "match_hp_by_dtag(self, filename) filename is a string that con...
2
stack_v2_sparse_classes_30k_train_015261
Implement the Python class `DsetsInfo` described below. Class description: DsetsInfo handles the access to the dsets_info.xml file from Python Method signatures and docstrings: - def __init__(self, dsets_info_filename='dsets_info_3.xml'): __init__(self, dsets_info_filename='dsets_info_3.xml') dsets_info_filename -- t...
Implement the Python class `DsetsInfo` described below. Class description: DsetsInfo handles the access to the dsets_info.xml file from Python Method signatures and docstrings: - def __init__(self, dsets_info_filename='dsets_info_3.xml'): __init__(self, dsets_info_filename='dsets_info_3.xml') dsets_info_filename -- t...
5d410679b6db48df664737a7f613d9434f8434f2
<|skeleton|> class DsetsInfo: """DsetsInfo handles the access to the dsets_info.xml file from Python""" def __init__(self, dsets_info_filename='dsets_info_3.xml'): """__init__(self, dsets_info_filename='dsets_info_3.xml') dsets_info_filename -- the path to the XML file""" <|body_0|> def ma...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DsetsInfo: """DsetsInfo handles the access to the dsets_info.xml file from Python""" def __init__(self, dsets_info_filename='dsets_info_3.xml'): """__init__(self, dsets_info_filename='dsets_info_3.xml') dsets_info_filename -- the path to the XML file""" self._dsets_info_file = dsets_info_...
the_stack_v2_python_sparse
get_xsec_for_file.py
xealits/processing_ntuples
train
0
97976139dc89d5f5d252b29d61638a65e5722867
[ "self.address = self._get_conf('Ec_rest_server_address')\nself.port = self._get_conf('Ec_port_number')\nself.controller_type = 'em'\nself.api_url = 'v1/internal/ec_ctrl/logstatusnotify'\nself.url_format = 'http://{address}:{port}/{api_url}'", "if self.address and self.port:\n thread = threading.Thread(target=s...
<|body_start_0|> self.address = self._get_conf('Ec_rest_server_address') self.port = self._get_conf('Ec_port_number') self.controller_type = 'em' self.api_url = 'v1/internal/ec_ctrl/logstatusnotify' self.url_format = 'http://{address}:{port}/{api_url}' <|end_body_0|> <|body_star...
Controller log notification class
ControllerLogNotify
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ControllerLogNotify: """Controller log notification class""" def __init__(self): """Constructor""" <|body_0|> def notify_logs(self, msg, log_level): """Log is notified. Argument: msg : log data (str) log_level : log level (int)""" <|body_1|> def send...
stack_v2_sparse_classes_75kplus_train_000282
3,494
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Log is notified. Argument: msg : log data (str) log_level : log level (int)", "name": "notify_logs", "signature": "def notify_logs(self, msg, log_level)" }, { "docstring": "Requ...
5
stack_v2_sparse_classes_30k_train_012201
Implement the Python class `ControllerLogNotify` described below. Class description: Controller log notification class Method signatures and docstrings: - def __init__(self): Constructor - def notify_logs(self, msg, log_level): Log is notified. Argument: msg : log data (str) log_level : log level (int) - def send_not...
Implement the Python class `ControllerLogNotify` described below. Class description: Controller log notification class Method signatures and docstrings: - def __init__(self): Constructor - def notify_logs(self, msg, log_level): Log is notified. Argument: msg : log data (str) log_level : log level (int) - def send_not...
e550d1b5ec9419f1fb3eb6e058ce46b57c92ee2f
<|skeleton|> class ControllerLogNotify: """Controller log notification class""" def __init__(self): """Constructor""" <|body_0|> def notify_logs(self, msg, log_level): """Log is notified. Argument: msg : log data (str) log_level : log level (int)""" <|body_1|> def send...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ControllerLogNotify: """Controller log notification class""" def __init__(self): """Constructor""" self.address = self._get_conf('Ec_rest_server_address') self.port = self._get_conf('Ec_port_number') self.controller_type = 'em' self.api_url = 'v1/internal/ec_ctrl/l...
the_stack_v2_python_sparse
lib/ControllerLogNotify/ControllerLogNotify.py
lixiaochun/element-manager
train
0
2dae81bcf566854f83f628ec4fa76a168fb940b1
[ "Leg.__init__(self, scene_, config_)\nself.orien = orien_\nself.muscles = []\nself.brain_sig = []\nif self.orien == 'L':\n for muscle_config in self.config.front_leg_L_muscles:\n self.muscles.append(eval(self.muscle_type))\n self.brain_sig.append(muscle_config['brain_sig'])\nelse:\n for muscle_c...
<|body_start_0|> Leg.__init__(self, scene_, config_) self.orien = orien_ self.muscles = [] self.brain_sig = [] if self.orien == 'L': for muscle_config in self.config.front_leg_L_muscles: self.muscles.append(eval(self.muscle_type)) self....
This class represents a generic foreleg and its current behaviour in the control process
Foreleg
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Foreleg: """This class represents a generic foreleg and its current behaviour in the control process""" def __init__(self, scene_, config_, orien_): """Class initialization""" <|body_0|> def update(self, ctrl_sig_): """Update control signals and forces""" ...
stack_v2_sparse_classes_75kplus_train_000283
7,801
no_license
[ { "docstring": "Class initialization", "name": "__init__", "signature": "def __init__(self, scene_, config_, orien_)" }, { "docstring": "Update control signals and forces", "name": "update", "signature": "def update(self, ctrl_sig_)" } ]
2
stack_v2_sparse_classes_30k_train_051942
Implement the Python class `Foreleg` described below. Class description: This class represents a generic foreleg and its current behaviour in the control process Method signatures and docstrings: - def __init__(self, scene_, config_, orien_): Class initialization - def update(self, ctrl_sig_): Update control signals ...
Implement the Python class `Foreleg` described below. Class description: This class represents a generic foreleg and its current behaviour in the control process Method signatures and docstrings: - def __init__(self, scene_, config_, orien_): Class initialization - def update(self, ctrl_sig_): Update control signals ...
060f30c1628ba001fc007bfec296182c0732bdc6
<|skeleton|> class Foreleg: """This class represents a generic foreleg and its current behaviour in the control process""" def __init__(self, scene_, config_, orien_): """Class initialization""" <|body_0|> def update(self, ctrl_sig_): """Update control signals and forces""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Foreleg: """This class represents a generic foreleg and its current behaviour in the control process""" def __init__(self, scene_, config_, orien_): """Class initialization""" Leg.__init__(self, scene_, config_) self.orien = orien_ self.muscles = [] self.brain_sig ...
the_stack_v2_python_sparse
src/body.py
gurbain/mouse_locomotion
train
3
ddd674a2949a18620c22f63ed1cf34bf921ef3e1
[ "super(PaintingGenreBot, self).__init__()\nself.use_from_page = False\nself.genres = {'Q1400853': 'Q134307', 'Q2414609': 'Q2864737', 'Q214127': 'Q1047337', 'Q107425': 'Q191163', 'Q29969011': 'Q1935974', 'Q333357': 'Q128115', 'Q162150': 'Q128115', 'Q18535': 'Q2839016', 'Q11766730': 'Q2839016', 'Q11766734': 'Q158607'...
<|body_start_0|> super(PaintingGenreBot, self).__init__() self.use_from_page = False self.genres = {'Q1400853': 'Q134307', 'Q2414609': 'Q2864737', 'Q214127': 'Q1047337', 'Q107425': 'Q191163', 'Q29969011': 'Q1935974', 'Q333357': 'Q128115', 'Q162150': 'Q128115', 'Q18535': 'Q2839016', 'Q11766730': ...
A bot to normalize painting genre. Uses the WikidataBot for the basics.
PaintingGenreBot
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PaintingGenreBot: """A bot to normalize painting genre. Uses the WikidataBot for the basics.""" def __init__(self): """No arguments, bot makes it's own generator based on the genres""" <|body_0|> def getGenerator(self): """Get a generator of paintings that have o...
stack_v2_sparse_classes_75kplus_train_000284
3,923
no_license
[ { "docstring": "No arguments, bot makes it's own generator based on the genres", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Get a generator of paintings that have one of the replacable genres :return: A generator that yields ItemPages", "name": "getGenerator", ...
3
stack_v2_sparse_classes_30k_train_028116
Implement the Python class `PaintingGenreBot` described below. Class description: A bot to normalize painting genre. Uses the WikidataBot for the basics. Method signatures and docstrings: - def __init__(self): No arguments, bot makes it's own generator based on the genres - def getGenerator(self): Get a generator of ...
Implement the Python class `PaintingGenreBot` described below. Class description: A bot to normalize painting genre. Uses the WikidataBot for the basics. Method signatures and docstrings: - def __init__(self): No arguments, bot makes it's own generator based on the genres - def getGenerator(self): Get a generator of ...
99a96e49cfe6b2d3151da7ad5469792d80171be3
<|skeleton|> class PaintingGenreBot: """A bot to normalize painting genre. Uses the WikidataBot for the basics.""" def __init__(self): """No arguments, bot makes it's own generator based on the genres""" <|body_0|> def getGenerator(self): """Get a generator of paintings that have o...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PaintingGenreBot: """A bot to normalize painting genre. Uses the WikidataBot for the basics.""" def __init__(self): """No arguments, bot makes it's own generator based on the genres""" super(PaintingGenreBot, self).__init__() self.use_from_page = False self.genres = {'Q140...
the_stack_v2_python_sparse
bot/wikidata/painting_genre_normalization.py
multichill/toollabs
train
18
ba3826cebb15465fefb1f749380922db914404ee
[ "super().__init__(**kwargs)\nself.token = validate_regex(token)\nif not self.token:\n msg = 'An invalid Misskey Access Token was specified.'\n self.logger.warning(msg)\n raise TypeError(msg)\nif visibility:\n vis = 'invalid' if not isinstance(visibility, str) else visibility.lower().strip()\n self.vi...
<|body_start_0|> super().__init__(**kwargs) self.token = validate_regex(token) if not self.token: msg = 'An invalid Misskey Access Token was specified.' self.logger.warning(msg) raise TypeError(msg) if visibility: vis = 'invalid' if not isi...
A wrapper for Misskey Notifications
NotifyMisskey
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NotifyMisskey: """A wrapper for Misskey Notifications""" def __init__(self, token=None, visibility=None, **kwargs): """Initialize Misskey Object""" <|body_0|> def url(self, privacy=False, *args, **kwargs): """Returns the URL built dynamically based on specified a...
stack_v2_sparse_classes_75kplus_train_000285
9,804
permissive
[ { "docstring": "Initialize Misskey Object", "name": "__init__", "signature": "def __init__(self, token=None, visibility=None, **kwargs)" }, { "docstring": "Returns the URL built dynamically based on specified arguments.", "name": "url", "signature": "def url(self, privacy=False, *args, *...
4
null
Implement the Python class `NotifyMisskey` described below. Class description: A wrapper for Misskey Notifications Method signatures and docstrings: - def __init__(self, token=None, visibility=None, **kwargs): Initialize Misskey Object - def url(self, privacy=False, *args, **kwargs): Returns the URL built dynamically...
Implement the Python class `NotifyMisskey` described below. Class description: A wrapper for Misskey Notifications Method signatures and docstrings: - def __init__(self, token=None, visibility=None, **kwargs): Initialize Misskey Object - def url(self, privacy=False, *args, **kwargs): Returns the URL built dynamically...
be3baed7e3d33bae973f1714df4ebbf65aa33f85
<|skeleton|> class NotifyMisskey: """A wrapper for Misskey Notifications""" def __init__(self, token=None, visibility=None, **kwargs): """Initialize Misskey Object""" <|body_0|> def url(self, privacy=False, *args, **kwargs): """Returns the URL built dynamically based on specified a...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NotifyMisskey: """A wrapper for Misskey Notifications""" def __init__(self, token=None, visibility=None, **kwargs): """Initialize Misskey Object""" super().__init__(**kwargs) self.token = validate_regex(token) if not self.token: msg = 'An invalid Misskey Access...
the_stack_v2_python_sparse
apprise/plugins/NotifyMisskey.py
caronc/apprise
train
8,426
2a9498ee61aef7e05d13ba8ff8ef989ad3c603ac
[ "basket = Inventory()\ndrsim = SouthAsian()\nhadji = MiddleEastern()\njonny = American()\nfor n in range(2):\n basket.add_coconut(drsim)\nfor n in range(1):\n basket.add_coconut(hadji)\nfor n in range(3):\n basket.add_coconut(jonny)\nexpected = 19.0\nresult = basket.total_weight()\nself.assertEqual(result,...
<|body_start_0|> basket = Inventory() drsim = SouthAsian() hadji = MiddleEastern() jonny = American() for n in range(2): basket.add_coconut(drsim) for n in range(1): basket.add_coconut(hadji) for n in range(3): basket.add_coconu...
Tests add_coconut(), total_weight() methods and tests that weights for each coconut type are different
TestCocoNuts
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCocoNuts: """Tests add_coconut(), total_weight() methods and tests that weights for each coconut type are different""" def test_weight(self): """Ensures that given defined weights, the total_weight() method returns the correct total weight. Add following coconut numbers: South As...
stack_v2_sparse_classes_75kplus_train_000286
1,940
no_license
[ { "docstring": "Ensures that given defined weights, the total_weight() method returns the correct total weight. Add following coconut numbers: South Asian=2, Middle Eastern=1, American=3", "name": "test_weight", "signature": "def test_weight(self)" }, { "docstring": "Ensure that add_coconut() th...
3
stack_v2_sparse_classes_30k_train_036928
Implement the Python class `TestCocoNuts` described below. Class description: Tests add_coconut(), total_weight() methods and tests that weights for each coconut type are different Method signatures and docstrings: - def test_weight(self): Ensures that given defined weights, the total_weight() method returns the corr...
Implement the Python class `TestCocoNuts` described below. Class description: Tests add_coconut(), total_weight() methods and tests that weights for each coconut type are different Method signatures and docstrings: - def test_weight(self): Ensures that given defined weights, the total_weight() method returns the corr...
b32f83aa1b705a5ad384b73c618f04f7d2622753
<|skeleton|> class TestCocoNuts: """Tests add_coconut(), total_weight() methods and tests that weights for each coconut type are different""" def test_weight(self): """Ensures that given defined weights, the total_weight() method returns the correct total weight. Add following coconut numbers: South As...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestCocoNuts: """Tests add_coconut(), total_weight() methods and tests that weights for each coconut type are different""" def test_weight(self): """Ensures that given defined weights, the total_weight() method returns the correct total weight. Add following coconut numbers: South Asian=2, Middle...
the_stack_v2_python_sparse
ostPython3/test_coconuts.py
deepbsd/OST_Python
train
1
cdc578138d2b4d7413dcd6cdffb9d7717708b746
[ "r = [str(len(strs))]\nfor s in strs:\n r.append(str(len(s)))\n r.append(s)\nreturn ' '.join(r)", "q = 0\np = s.find(' ')\np = p if p > 0 else len(s)\nlistlen = int(s[q:p])\nstrs = []\nfor _ in xrange(listlen):\n q = p + 1\n p = s.find(' ', q)\n strlen = int(s[q:p])\n q = p + 1\n p = q + strl...
<|body_start_0|> r = [str(len(strs))] for s in strs: r.append(str(len(s))) r.append(s) return ' '.join(r) <|end_body_0|> <|body_start_1|> q = 0 p = s.find(' ') p = p if p > 0 else len(s) listlen = int(s[q:p]) strs = [] for ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def encode(self, strs): """Encodes a list of strings to a single string. :type strs: List[str] :rtype: str""" <|body_0|> def decode(self, s): """Decodes a single string to a list of strings. :type s: str :rtype: List[str]""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_75kplus_train_000287
877
no_license
[ { "docstring": "Encodes a list of strings to a single string. :type strs: List[str] :rtype: str", "name": "encode", "signature": "def encode(self, strs)" }, { "docstring": "Decodes a single string to a list of strings. :type s: str :rtype: List[str]", "name": "decode", "signature": "def ...
2
stack_v2_sparse_classes_30k_train_053868
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, strs): Encodes a list of strings to a single string. :type strs: List[str] :rtype: str - def decode(self, s): Decodes a single string to a list of strings. :type s: st...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, strs): Encodes a list of strings to a single string. :type strs: List[str] :rtype: str - def decode(self, s): Decodes a single string to a list of strings. :type s: st...
20580185c6f72f3c09a725168af48893156161f5
<|skeleton|> class Codec: def encode(self, strs): """Encodes a list of strings to a single string. :type strs: List[str] :rtype: str""" <|body_0|> def decode(self, s): """Decodes a single string to a list of strings. :type s: str :rtype: List[str]""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def encode(self, strs): """Encodes a list of strings to a single string. :type strs: List[str] :rtype: str""" r = [str(len(strs))] for s in strs: r.append(str(len(s))) r.append(s) return ' '.join(r) def decode(self, s): """Decodes a s...
the_stack_v2_python_sparse
coding/00271-encode-decode-str/solution.py
misaka-10032/leetcode
train
3
b973f7bf6c3e559bda63e1e7ccd02b8350b21eb3
[ "self.ex = ex\nself.lc = lightcurve\nif self.lc is not None:\n for p1 in self.lc:\n for p2 in self.lc:\n if p1.index == p2.index and p1 is not p2:\n raise ValueError('Two lightcurve points supplied for sameimage index.')", "if self.lc is None:\n return self.ex\nelse:\n fo...
<|body_start_0|> self.ex = ex self.lc = lightcurve if self.lc is not None: for p1 in self.lc: for p2 in self.lc: if p1.index == p2.index and p1 is not p2: raise ValueError('Two lightcurve points supplied for sameimage index....
Defines a MockSource for generating mock source lists. (These can be used to test the database routines.) When initialised with a transient lightcurve (a list of MockLCPoint tuples), the source lists can be populated with non-detections (zero measurements) at the images for which the lightcurve is not defined. When the...
MockSource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MockSource: """Defines a MockSource for generating mock source lists. (These can be used to test the database routines.) When initialised with a transient lightcurve (a list of MockLCPoint tuples), the source lists can be populated with non-detections (zero measurements) at the images for which t...
stack_v2_sparse_classes_75kplus_train_000288
15,221
no_license
[ { "docstring": "*Args* `ex`: template `extractedsource`, Defines the position, etc. If no lightcurve is supplied, then these details are used to model a fixed source. `lightcurve`: A list of `MockLightcurvePoint`s, defining a transient lightcurve.", "name": "__init__", "signature": "def __init__(self, e...
3
stack_v2_sparse_classes_30k_train_012177
Implement the Python class `MockSource` described below. Class description: Defines a MockSource for generating mock source lists. (These can be used to test the database routines.) When initialised with a transient lightcurve (a list of MockLCPoint tuples), the source lists can be populated with non-detections (zero ...
Implement the Python class `MockSource` described below. Class description: Defines a MockSource for generating mock source lists. (These can be used to test the database routines.) When initialised with a transient lightcurve (a list of MockLCPoint tuples), the source lists can be populated with non-detections (zero ...
8c3a91c9dd2338bf88c1e13b7c8332223aaec508
<|skeleton|> class MockSource: """Defines a MockSource for generating mock source lists. (These can be used to test the database routines.) When initialised with a transient lightcurve (a list of MockLCPoint tuples), the source lists can be populated with non-detections (zero measurements) at the images for which t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MockSource: """Defines a MockSource for generating mock source lists. (These can be used to test the database routines.) When initialised with a transient lightcurve (a list of MockLCPoint tuples), the source lists can be populated with non-detections (zero measurements) at the images for which the lightcurve...
the_stack_v2_python_sparse
tkp/testutil/db_subs.py
hughbg/tkp
train
2
08c10a8467f8798cf6787a78f50a1f608a55969c
[ "if segment_ids.size == 0:\n return []\nK = max(segment_ids) + 1\noutputs = [np.zeros((np.count_nonzero(segment_ids == seg_id),) + data.shape[1:], dtype=data.dtype) for seg_id in range(0, K)]\ncounts = np.zeros(K, dtype=int)\nfor i, seg_id in enumerate(segment_ids):\n data_idx = i if indices is None else indi...
<|body_start_0|> if segment_ids.size == 0: return [] K = max(segment_ids) + 1 outputs = [np.zeros((np.count_nonzero(segment_ids == seg_id),) + data.shape[1:], dtype=data.dtype) for seg_id in range(0, K)] counts = np.zeros(K, dtype=int) for i, seg_id in enumerate(segme...
SegmentsTester
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SegmentsTester: def split(self, data, segment_ids, indices=None): """Given: data[M1 x M2 x ... x Md] the input data indices[N] the index of each entry of segment_ids into data, where 0 <= index[i] < M1, with default indices=[0,1,...N] segment_ids[N] the segment_id for each entry of indic...
stack_v2_sparse_classes_75kplus_train_000289
23,854
permissive
[ { "docstring": "Given: data[M1 x M2 x ... x Md] the input data indices[N] the index of each entry of segment_ids into data, where 0 <= index[i] < M1, with default indices=[0,1,...N] segment_ids[N] the segment_id for each entry of indices, returns K outputs, each one containing data entries corresponding to one ...
2
stack_v2_sparse_classes_30k_train_024958
Implement the Python class `SegmentsTester` described below. Class description: Implement the SegmentsTester class. Method signatures and docstrings: - def split(self, data, segment_ids, indices=None): Given: data[M1 x M2 x ... x Md] the input data indices[N] the index of each entry of segment_ids into data, where 0 ...
Implement the Python class `SegmentsTester` described below. Class description: Implement the SegmentsTester class. Method signatures and docstrings: - def split(self, data, segment_ids, indices=None): Given: data[M1 x M2 x ... x Md] the input data indices[N] the index of each entry of segment_ids into data, where 0 ...
cabf6e4f1970dc14302f87414f170de19944bac2
<|skeleton|> class SegmentsTester: def split(self, data, segment_ids, indices=None): """Given: data[M1 x M2 x ... x Md] the input data indices[N] the index of each entry of segment_ids into data, where 0 <= index[i] < M1, with default indices=[0,1,...N] segment_ids[N] the segment_id for each entry of indic...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SegmentsTester: def split(self, data, segment_ids, indices=None): """Given: data[M1 x M2 x ... x Md] the input data indices[N] the index of each entry of segment_ids into data, where 0 <= index[i] < M1, with default indices=[0,1,...N] segment_ids[N] the segment_id for each entry of indices, returns K ...
the_stack_v2_python_sparse
pytorch/source/caffe2/python/operator_test/segment_ops_test.py
ryfeus/lambda-packs
train
1,283
8d7c7f966399395ab9bf970050ac002ab63ba6f3
[ "gain = [g - c for g, c in zip(gas, cost)]\nacc = [gain[0]]\nfor i, g in enumerate(gain[1:]):\n acc.append(acc[i] + g)\nfor i, g in enumerate(gain):\n acc.append(acc[len(gain) - 1 + i] + g)\nmins = []\nm = float('inf')\nfor a in reversed(acc):\n if a < m:\n mins.append(a)\n m = a\n else:\n...
<|body_start_0|> gain = [g - c for g, c in zip(gas, cost)] acc = [gain[0]] for i, g in enumerate(gain[1:]): acc.append(acc[i] + g) for i, g in enumerate(gain): acc.append(acc[len(gain) - 1 + i] + g) mins = [] m = float('inf') for a in rever...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canCompleteCircuit(self, gas, cost): """07/08/2018 06:25""" <|body_0|> def canCompleteCircuit(self, gas: List[int], cost: List[int]) -> int: """Feb 01, 2022 10:30""" <|body_1|> def canCompleteCircuit(self, gas: List[int], cost: List[int]) -...
stack_v2_sparse_classes_75kplus_train_000290
3,978
no_license
[ { "docstring": "07/08/2018 06:25", "name": "canCompleteCircuit", "signature": "def canCompleteCircuit(self, gas, cost)" }, { "docstring": "Feb 01, 2022 10:30", "name": "canCompleteCircuit", "signature": "def canCompleteCircuit(self, gas: List[int], cost: List[int]) -> int" }, { "...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canCompleteCircuit(self, gas, cost): 07/08/2018 06:25 - def canCompleteCircuit(self, gas: List[int], cost: List[int]) -> int: Feb 01, 2022 10:30 - def canCompleteCircuit(self...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canCompleteCircuit(self, gas, cost): 07/08/2018 06:25 - def canCompleteCircuit(self, gas: List[int], cost: List[int]) -> int: Feb 01, 2022 10:30 - def canCompleteCircuit(self...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def canCompleteCircuit(self, gas, cost): """07/08/2018 06:25""" <|body_0|> def canCompleteCircuit(self, gas: List[int], cost: List[int]) -> int: """Feb 01, 2022 10:30""" <|body_1|> def canCompleteCircuit(self, gas: List[int], cost: List[int]) -...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def canCompleteCircuit(self, gas, cost): """07/08/2018 06:25""" gain = [g - c for g, c in zip(gas, cost)] acc = [gain[0]] for i, g in enumerate(gain[1:]): acc.append(acc[i] + g) for i, g in enumerate(gain): acc.append(acc[len(gain) - 1 ...
the_stack_v2_python_sparse
leetcode/solved/134_Gas_Station/solution.py
sungminoh/algorithms
train
0
fdf55cd227fb358c37e18c97d4cab1b69ca87593
[ "if chainlen > 10 or chainlen < 1:\n print('Chain length must be between 1 and 10, inclusive')\n sys.exit(0)\nself.mcd = Mdict()\noldnames = []\nself.chainlen = chainlen\nfor l in source:\n l = l.strip()\n oldnames.append(l)\n s = ' ' * chainlen + l\n for n in range(0, len(l)):\n self.mcd.a...
<|body_start_0|> if chainlen > 10 or chainlen < 1: print('Chain length must be between 1 and 10, inclusive') sys.exit(0) self.mcd = Mdict() oldnames = [] self.chainlen = chainlen for l in source: l = l.strip() oldnames.append(l) ...
A name from a Markov chain
MName
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MName: """A name from a Markov chain""" def __init__(self, source, chainlen=2): """Building the dictionary""" <|body_0|> def New(self): """New name from the Markov chain""" <|body_1|> <|end_skeleton|> <|body_start_0|> if chainlen > 10 or chainle...
stack_v2_sparse_classes_75kplus_train_000291
8,017
permissive
[ { "docstring": "Building the dictionary", "name": "__init__", "signature": "def __init__(self, source, chainlen=2)" }, { "docstring": "New name from the Markov chain", "name": "New", "signature": "def New(self)" } ]
2
stack_v2_sparse_classes_30k_train_045413
Implement the Python class `MName` described below. Class description: A name from a Markov chain Method signatures and docstrings: - def __init__(self, source, chainlen=2): Building the dictionary - def New(self): New name from the Markov chain
Implement the Python class `MName` described below. Class description: A name from a Markov chain Method signatures and docstrings: - def __init__(self, source, chainlen=2): Building the dictionary - def New(self): New name from the Markov chain <|skeleton|> class MName: """A name from a Markov chain""" def...
525aeb53217166d2ce83e4e91a3b8c1b102f0dcb
<|skeleton|> class MName: """A name from a Markov chain""" def __init__(self, source, chainlen=2): """Building the dictionary""" <|body_0|> def New(self): """New name from the Markov chain""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MName: """A name from a Markov chain""" def __init__(self, source, chainlen=2): """Building the dictionary""" if chainlen > 10 or chainlen < 1: print('Chain length must be between 1 and 10, inclusive') sys.exit(0) self.mcd = Mdict() oldnames = [] ...
the_stack_v2_python_sparse
plot_gen.py
TheNicGard/DungeonStar
train
3
75a74c87b3f7630b9a1f2137815a4e406cf8ff70
[ "super(ServiceForm, self).__init__(*args, **kwargs)\nif self.initial.get('protected'):\n self.fields['description'].disabled = True\n self.fields['category'].disabled = True\n self.fields['measurement'].disabled = True\n self.fields['protected'].disabled = True", "cleaned_data = super(ServiceForm, sel...
<|body_start_0|> super(ServiceForm, self).__init__(*args, **kwargs) if self.initial.get('protected'): self.fields['description'].disabled = True self.fields['category'].disabled = True self.fields['measurement'].disabled = True self.fields['protected'].dis...
ServiceForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ServiceForm: def __init__(self, *args, **kwargs): """If the service.protected value in the db is set to True, change all fields but cost to read-only This is done to make sure hardcoded queries don't break if someone modifies the service""" <|body_0|> def clean(self): ...
stack_v2_sparse_classes_75kplus_train_000292
2,344
no_license
[ { "docstring": "If the service.protected value in the db is set to True, change all fields but cost to read-only This is done to make sure hardcoded queries don't break if someone modifies the service", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "If ...
2
stack_v2_sparse_classes_30k_train_005421
Implement the Python class `ServiceForm` described below. Class description: Implement the ServiceForm class. Method signatures and docstrings: - def __init__(self, *args, **kwargs): If the service.protected value in the db is set to True, change all fields but cost to read-only This is done to make sure hardcoded qu...
Implement the Python class `ServiceForm` described below. Class description: Implement the ServiceForm class. Method signatures and docstrings: - def __init__(self, *args, **kwargs): If the service.protected value in the db is set to True, change all fields but cost to read-only This is done to make sure hardcoded qu...
fc9c3a12697edeb4fac4693c8bd3b9f5391d5b5b
<|skeleton|> class ServiceForm: def __init__(self, *args, **kwargs): """If the service.protected value in the db is set to True, change all fields but cost to read-only This is done to make sure hardcoded queries don't break if someone modifies the service""" <|body_0|> def clean(self): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ServiceForm: def __init__(self, *args, **kwargs): """If the service.protected value in the db is set to True, change all fields but cost to read-only This is done to make sure hardcoded queries don't break if someone modifies the service""" super(ServiceForm, self).__init__(*args, **kwargs) ...
the_stack_v2_python_sparse
src/service/forms.py
ande0581/concrete
train
3
056225fae8253466fcbe8820d96d20941a6e3aa0
[ "super().__init__(hass=hass, logger=_LOGGER, name=NAME, update_interval=INTERVAL_SLOW)\nself.device = device\nself.unique_id = format_mac(device.mac)", "try:\n state = await self.device.get_state()\nexcept JvcProjectorConnectError as err:\n raise UpdateFailed(f'Unable to connect to {self.device.host}') from...
<|body_start_0|> super().__init__(hass=hass, logger=_LOGGER, name=NAME, update_interval=INTERVAL_SLOW) self.device = device self.unique_id = format_mac(device.mac) <|end_body_0|> <|body_start_1|> try: state = await self.device.get_state() except JvcProjectorConnectEr...
Data update coordinator for the JVC Projector integration.
JvcProjectorDataUpdateCoordinator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JvcProjectorDataUpdateCoordinator: """Data update coordinator for the JVC Projector integration.""" def __init__(self, hass: HomeAssistant, device: JvcProjector) -> None: """Initialize the coordinator.""" <|body_0|> async def _async_update_data(self) -> dict[str, str]: ...
stack_v2_sparse_classes_75kplus_train_000293
1,941
permissive
[ { "docstring": "Initialize the coordinator.", "name": "__init__", "signature": "def __init__(self, hass: HomeAssistant, device: JvcProjector) -> None" }, { "docstring": "Get the latest state data.", "name": "_async_update_data", "signature": "async def _async_update_data(self) -> dict[st...
2
stack_v2_sparse_classes_30k_val_000117
Implement the Python class `JvcProjectorDataUpdateCoordinator` described below. Class description: Data update coordinator for the JVC Projector integration. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, device: JvcProjector) -> None: Initialize the coordinator. - async def _async_update...
Implement the Python class `JvcProjectorDataUpdateCoordinator` described below. Class description: Data update coordinator for the JVC Projector integration. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, device: JvcProjector) -> None: Initialize the coordinator. - async def _async_update...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class JvcProjectorDataUpdateCoordinator: """Data update coordinator for the JVC Projector integration.""" def __init__(self, hass: HomeAssistant, device: JvcProjector) -> None: """Initialize the coordinator.""" <|body_0|> async def _async_update_data(self) -> dict[str, str]: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class JvcProjectorDataUpdateCoordinator: """Data update coordinator for the JVC Projector integration.""" def __init__(self, hass: HomeAssistant, device: JvcProjector) -> None: """Initialize the coordinator.""" super().__init__(hass=hass, logger=_LOGGER, name=NAME, update_interval=INTERVAL_SLOW...
the_stack_v2_python_sparse
homeassistant/components/jvc_projector/coordinator.py
home-assistant/core
train
35,501
0a7c6edea366ce4eede6fdc6fe29412c2539ba76
[ "QtGui.QItemDelegate.__init__(self)\nself._collectionDelegate = collectionDelegate\nself.actionController = None", "data = index.model().data(index, QtCore.Qt.DisplayRole).toString()\neditor.setText(data)\nself._collectionDelegate.ignoreOpenAction = True", "try:\n if editor.isModified():\n newName = u...
<|body_start_0|> QtGui.QItemDelegate.__init__(self) self._collectionDelegate = collectionDelegate self.actionController = None <|end_body_0|> <|body_start_1|> data = index.model().data(index, QtCore.Qt.DisplayRole).toString() editor.setText(data) self._collectionDelegate...
Controls the editing process of an item.
_CollectionItemDelegate
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _CollectionItemDelegate: """Controls the editing process of an item.""" def __init__(self, collectionDelegate=None): """Constructor.""" <|body_0|> def setEditorData(self, editor, index): """@see: L{setEditorData<PyQt4.QtGui.QItemDelegate.setEditorData>}""" ...
stack_v2_sparse_classes_75kplus_train_000294
16,049
no_license
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self, collectionDelegate=None)" }, { "docstring": "@see: L{setEditorData<PyQt4.QtGui.QItemDelegate.setEditorData>}", "name": "setEditorData", "signature": "def setEditorData(self, editor, index)" }, { "...
3
null
Implement the Python class `_CollectionItemDelegate` described below. Class description: Controls the editing process of an item. Method signatures and docstrings: - def __init__(self, collectionDelegate=None): Constructor. - def setEditorData(self, editor, index): @see: L{setEditorData<PyQt4.QtGui.QItemDelegate.setE...
Implement the Python class `_CollectionItemDelegate` described below. Class description: Controls the editing process of an item. Method signatures and docstrings: - def __init__(self, collectionDelegate=None): Constructor. - def setEditorData(self, editor, index): @see: L{setEditorData<PyQt4.QtGui.QItemDelegate.setE...
958fda4f3064f9f6b2034da396a20ac9d9abd52f
<|skeleton|> class _CollectionItemDelegate: """Controls the editing process of an item.""" def __init__(self, collectionDelegate=None): """Constructor.""" <|body_0|> def setEditorData(self, editor, index): """@see: L{setEditorData<PyQt4.QtGui.QItemDelegate.setEditorData>}""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class _CollectionItemDelegate: """Controls the editing process of an item.""" def __init__(self, collectionDelegate=None): """Constructor.""" QtGui.QItemDelegate.__init__(self) self._collectionDelegate = collectionDelegate self.actionController = None def setEditorData(self...
the_stack_v2_python_sparse
src/datafinder/gui/user/controller/repository/collection.py
DLR-SC/DataFinder
train
9
e3ecdad0d3c76e27e790a9edda1c5f417303d55d
[ "if std_w is None:\n std_w = 1 / np.sqrt(0.5 * n_input)\nself.lr = lr\nself.w = Tensor(n_output, n_input).normal_(0, std_w)\nself.dw = Tensor(self.w.shape).zero_()\nself.bias = bias\nif bias:\n if not std_b:\n self.b = Tensor(n_output, 1).fill_(0)\n else:\n self.b = Tensor(n_output, 1).normal...
<|body_start_0|> if std_w is None: std_w = 1 / np.sqrt(0.5 * n_input) self.lr = lr self.w = Tensor(n_output, n_input).normal_(0, std_w) self.dw = Tensor(self.w.shape).zero_() self.bias = bias if bias: if not std_b: self.b = Tensor(n...
Implements the fully connected layer module It requires the number of inputs and outputs. Weights are initialized assuming that a ReLU module will be used afterwards. If a Tanh module will be used instead, it is recommended to set std_w = 1 / np.sqrt(n_input) It is possible to set a default learning rate that will be u...
Linear
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Linear: """Implements the fully connected layer module It requires the number of inputs and outputs. Weights are initialized assuming that a ReLU module will be used afterwards. If a Tanh module will be used instead, it is recommended to set std_w = 1 / np.sqrt(n_input) It is possible to set a de...
stack_v2_sparse_classes_75kplus_train_000295
9,572
permissive
[ { "docstring": "INPUT: n_input: Size of input n_output: Number of hidden units lr: If adaptive learning rate is not used, learning rate used for update std_w: Normal distribution initialization of weights with std = std_w/ If None, std_w is chosen according to Xavier initialization. bias: If true, use bias std_...
5
stack_v2_sparse_classes_30k_train_050333
Implement the Python class `Linear` described below. Class description: Implements the fully connected layer module It requires the number of inputs and outputs. Weights are initialized assuming that a ReLU module will be used afterwards. If a Tanh module will be used instead, it is recommended to set std_w = 1 / np.s...
Implement the Python class `Linear` described below. Class description: Implements the fully connected layer module It requires the number of inputs and outputs. Weights are initialized assuming that a ReLU module will be used afterwards. If a Tanh module will be used instead, it is recommended to set std_w = 1 / np.s...
303fb507fc6a756b4bfbb3c9fbd57230c866b39b
<|skeleton|> class Linear: """Implements the fully connected layer module It requires the number of inputs and outputs. Weights are initialized assuming that a ReLU module will be used afterwards. If a Tanh module will be used instead, it is recommended to set std_w = 1 / np.sqrt(n_input) It is possible to set a de...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Linear: """Implements the fully connected layer module It requires the number of inputs and outputs. Weights are initialized assuming that a ReLU module will be used afterwards. If a Tanh module will be used instead, it is recommended to set std_w = 1 / np.sqrt(n_input) It is possible to set a default learnin...
the_stack_v2_python_sparse
Projects/Project2/framework/modules.py
lumosan/deeplearning2018
train
0
0a7abcfdcea9e7a9d51bd700567e44d3f52d45fa
[ "path = path.decode('utf-8')\n\ndef run():\n tags = SecureTagAPI(session.auth.user)\n result = tags.get([path], withDescriptions=returnDescription)\n if not result:\n raise TNonexistentTag()\n else:\n tag = TTag()\n tag.objectId = str(result[path]['id'])\n tag.path = path\n ...
<|body_start_0|> path = path.decode('utf-8') def run(): tags = SecureTagAPI(session.auth.user) result = tags.get([path], withDescriptions=returnDescription) if not result: raise TNonexistentTag() else: tag = TTag() ...
FacadeTagMixin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FacadeTagMixin: def getTag(self, session, path, returnDescription): """Get information about a L{Tag}. @param session: The L{AuthenticatedSession} for the request. @param path: The L{Tag.path} to get information about. @param returnDescription: A C{bool} indicating whether or not to incl...
stack_v2_sparse_classes_75kplus_train_000296
6,844
permissive
[ { "docstring": "Get information about a L{Tag}. @param session: The L{AuthenticatedSession} for the request. @param path: The L{Tag.path} to get information about. @param returnDescription: A C{bool} indicating whether or not to include the L{Tag}'s description in the result. @raise TNonexistentTag: Raised if a...
4
stack_v2_sparse_classes_30k_train_008757
Implement the Python class `FacadeTagMixin` described below. Class description: Implement the FacadeTagMixin class. Method signatures and docstrings: - def getTag(self, session, path, returnDescription): Get information about a L{Tag}. @param session: The L{AuthenticatedSession} for the request. @param path: The L{Ta...
Implement the Python class `FacadeTagMixin` described below. Class description: Implement the FacadeTagMixin class. Method signatures and docstrings: - def getTag(self, session, path, returnDescription): Get information about a L{Tag}. @param session: The L{AuthenticatedSession} for the request. @param path: The L{Ta...
b5a8c8349f3eaf3364cc4efba4736c3e33b30d96
<|skeleton|> class FacadeTagMixin: def getTag(self, session, path, returnDescription): """Get information about a L{Tag}. @param session: The L{AuthenticatedSession} for the request. @param path: The L{Tag.path} to get information about. @param returnDescription: A C{bool} indicating whether or not to incl...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FacadeTagMixin: def getTag(self, session, path, returnDescription): """Get information about a L{Tag}. @param session: The L{AuthenticatedSession} for the request. @param path: The L{Tag.path} to get information about. @param returnDescription: A C{bool} indicating whether or not to include the L{Tag}...
the_stack_v2_python_sparse
fluiddb/api/tag.py
fluidinfo/fluiddb
train
3
1ffa5814cc5ee2da8d735c79e1674aef1aecfad4
[ "host = 'foo.com:1234'\npath_info = '/_ah/login'\ncookie_dict = {}\naction = ''\nset_email = ''\nset_admin = False\ncontinue_url = ''\nstatus, location, set_cookie, content_type = self._run_test(host, path_info, cookie_dict, action, set_email, set_admin, continue_url)\nself.assertEqual(302, status)\nself.assertFals...
<|body_start_0|> host = 'foo.com:1234' path_info = '/_ah/login' cookie_dict = {} action = '' set_email = '' set_admin = False continue_url = '' status, location, set_cookie, content_type = self._run_test(host, path_info, cookie_dict, action, set_email, set...
Tests the various ways of invoking the login page.
LoginPageTest
[ "Apache-2.0", "LGPL-2.1-or-later", "BSD-3-Clause", "MIT", "GPL-2.0-or-later", "MPL-1.1" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoginPageTest: """Tests the various ways of invoking the login page.""" def test_no_params(self): """Tests just accessing the login URL with no params.""" <|body_0|> def test_login(self): """Tests when setting the user info with and without continue URL.""" ...
stack_v2_sparse_classes_75kplus_train_000297
12,436
permissive
[ { "docstring": "Tests just accessing the login URL with no params.", "name": "test_no_params", "signature": "def test_no_params(self)" }, { "docstring": "Tests when setting the user info with and without continue URL.", "name": "test_login", "signature": "def test_login(self)" }, { ...
5
stack_v2_sparse_classes_30k_train_028323
Implement the Python class `LoginPageTest` described below. Class description: Tests the various ways of invoking the login page. Method signatures and docstrings: - def test_no_params(self): Tests just accessing the login URL with no params. - def test_login(self): Tests when setting the user info with and without c...
Implement the Python class `LoginPageTest` described below. Class description: Tests the various ways of invoking the login page. Method signatures and docstrings: - def test_no_params(self): Tests just accessing the login URL with no params. - def test_login(self): Tests when setting the user info with and without c...
be17e5f658d7b42b5aa7eeb7a5ddd4962f3ea82f
<|skeleton|> class LoginPageTest: """Tests the various ways of invoking the login page.""" def test_no_params(self): """Tests just accessing the login URL with no params.""" <|body_0|> def test_login(self): """Tests when setting the user info with and without continue URL.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LoginPageTest: """Tests the various ways of invoking the login page.""" def test_no_params(self): """Tests just accessing the login URL with no params.""" host = 'foo.com:1234' path_info = '/_ah/login' cookie_dict = {} action = '' set_email = '' set...
the_stack_v2_python_sparse
AppServer/google/appengine/tools/devappserver2/login_test.py
obino/appscale
train
1
c76ce85112c52bafde6e529ee6819b36ee420489
[ "self.text_predicate = text_predicate\nself.content = content\nself.skipping = bool(start)\nself.start: Optional[str] = None\nif start is not None and self.skipping:\n self.start = start.replace('_', ' ')\nself.site = site or pywikibot.Site()\nif not namespaces:\n self.namespaces = self.site.namespaces\nelse:...
<|body_start_0|> self.text_predicate = text_predicate self.content = content self.skipping = bool(start) self.start: Optional[str] = None if start is not None and self.skipping: self.start = start.replace('_', ' ') self.site = site or pywikibot.Site() ...
Xml iterator that yields Page objects. .. versionadded:: 7.2 the `content` parameter :param filename: filename of XML dump :param start: skip entries below that value :param namespaces: namespace filter :param site: current site for the generator :param text_predicate: a callable with entry.text as parameter and boolea...
XMLDumpPageGenerator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class XMLDumpPageGenerator: """Xml iterator that yields Page objects. .. versionadded:: 7.2 the `content` parameter :param filename: filename of XML dump :param start: skip entries below that value :param namespaces: namespace filter :param site: current site for the generator :param text_predicate: a ...
stack_v2_sparse_classes_75kplus_train_000298
43,909
permissive
[ { "docstring": "Initializer.", "name": "__init__", "signature": "def __init__(self, filename: str, start: Optional[str]=None, namespaces: Union[None, NAMESPACE_OR_STR_TYPE, Sequence[NAMESPACE_OR_STR_TYPE]]=None, site: OPT_SITE_TYPE=None, text_predicate: Optional[Callable[[str], bool]]=None, content=Fals...
2
stack_v2_sparse_classes_30k_train_045884
Implement the Python class `XMLDumpPageGenerator` described below. Class description: Xml iterator that yields Page objects. .. versionadded:: 7.2 the `content` parameter :param filename: filename of XML dump :param start: skip entries below that value :param namespaces: namespace filter :param site: current site for ...
Implement the Python class `XMLDumpPageGenerator` described below. Class description: Xml iterator that yields Page objects. .. versionadded:: 7.2 the `content` parameter :param filename: filename of XML dump :param start: skip entries below that value :param namespaces: namespace filter :param site: current site for ...
5c01e6bfcd328bc6eae643e661f1a0ae57612808
<|skeleton|> class XMLDumpPageGenerator: """Xml iterator that yields Page objects. .. versionadded:: 7.2 the `content` parameter :param filename: filename of XML dump :param start: skip entries below that value :param namespaces: namespace filter :param site: current site for the generator :param text_predicate: a ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class XMLDumpPageGenerator: """Xml iterator that yields Page objects. .. versionadded:: 7.2 the `content` parameter :param filename: filename of XML dump :param start: skip entries below that value :param namespaces: namespace filter :param site: current site for the generator :param text_predicate: a callable with...
the_stack_v2_python_sparse
pywikibot/pagegenerators/_generators.py
wikimedia/pywikibot
train
432
649ee2a0c5056b2d5517f877353a895cae3b8adb
[ "self.mem_cell_ct = mem_cell_ct\nself.x_dim = x_dim\nconcat_len = x_dim + mem_cell_ct\nself.wg = rand_arr(-0.1, 0.1, mem_cell_ct, concat_len)\nself.wi = rand_arr(-0.1, 0.1, mem_cell_ct, concat_len)\nself.wf = rand_arr(-0.1, 0.1, mem_cell_ct, concat_len)\nself.wo = rand_arr(-0.1, 0.1, mem_cell_ct, concat_len)\nself....
<|body_start_0|> self.mem_cell_ct = mem_cell_ct self.x_dim = x_dim concat_len = x_dim + mem_cell_ct self.wg = rand_arr(-0.1, 0.1, mem_cell_ct, concat_len) self.wi = rand_arr(-0.1, 0.1, mem_cell_ct, concat_len) self.wf = rand_arr(-0.1, 0.1, mem_cell_ct, concat_len) ...
LSTMParam
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LSTMParam: def __int__(self, mem_cell_ct, x_dim): """初始化函数 Parameters ---------- mem_cell_ct: LSTM隐藏层神经元数量 x_dim: LSTM输入层维度 Returns ------- None""" <|body_0|> def apply_diff(self, lr=1): """:param lr: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_75kplus_train_000299
6,839
no_license
[ { "docstring": "初始化函数 Parameters ---------- mem_cell_ct: LSTM隐藏层神经元数量 x_dim: LSTM输入层维度 Returns ------- None", "name": "__int__", "signature": "def __int__(self, mem_cell_ct, x_dim)" }, { "docstring": ":param lr: :return:", "name": "apply_diff", "signature": "def apply_diff(self, lr=1)" ...
2
stack_v2_sparse_classes_30k_train_005404
Implement the Python class `LSTMParam` described below. Class description: Implement the LSTMParam class. Method signatures and docstrings: - def __int__(self, mem_cell_ct, x_dim): 初始化函数 Parameters ---------- mem_cell_ct: LSTM隐藏层神经元数量 x_dim: LSTM输入层维度 Returns ------- None - def apply_diff(self, lr=1): :param lr: :ret...
Implement the Python class `LSTMParam` described below. Class description: Implement the LSTMParam class. Method signatures and docstrings: - def __int__(self, mem_cell_ct, x_dim): 初始化函数 Parameters ---------- mem_cell_ct: LSTM隐藏层神经元数量 x_dim: LSTM输入层维度 Returns ------- None - def apply_diff(self, lr=1): :param lr: :ret...
0cc1eb0b1a856c428371d7eff9d8d36449bb774f
<|skeleton|> class LSTMParam: def __int__(self, mem_cell_ct, x_dim): """初始化函数 Parameters ---------- mem_cell_ct: LSTM隐藏层神经元数量 x_dim: LSTM输入层维度 Returns ------- None""" <|body_0|> def apply_diff(self, lr=1): """:param lr: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LSTMParam: def __int__(self, mem_cell_ct, x_dim): """初始化函数 Parameters ---------- mem_cell_ct: LSTM隐藏层神经元数量 x_dim: LSTM输入层维度 Returns ------- None""" self.mem_cell_ct = mem_cell_ct self.x_dim = x_dim concat_len = x_dim + mem_cell_ct self.wg = rand_arr(-0.1, 0.1, mem_cell_...
the_stack_v2_python_sparse
lstm.py
aloyschen/Code_wars
train
1