blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
b60734479f1c0cb2ccbcb23571f67dd1c408a627
[ "if hasattr(self.survey_record, 'grade'):\n grade = self.survey_record.grade\nvals_grade = {True: 'pass', False: 'fail'}\nself.data['grade'] = vals_grade.get(grade, None) or grade\nreturn super(GradeSurveyRecordForm, self).getFields(*args)", "fields = super(GradeSurveyRecordForm, self).insertFields()\ngrade_ch...
<|body_start_0|> if hasattr(self.survey_record, 'grade'): grade = self.survey_record.grade vals_grade = {True: 'pass', False: 'fail'} self.data['grade'] = vals_grade.get(grade, None) or grade return super(GradeSurveyRecordForm, self).getFields(*args) <|end_body_0|> <|body_st...
RecordForm for the GradeSurveyTakeForm.
GradeSurveyRecordForm
[ "Apache-2.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GradeSurveyRecordForm: """RecordForm for the GradeSurveyTakeForm.""" def getFields(self, *args): """Add the extra grade field's value from survey_record.""" <|body_0|> def insertFields(self): """Add ordered fields to self.fields, add grade field with grade choice...
stack_v2_sparse_classes_36k_train_033800
9,757
permissive
[ { "docstring": "Add the extra grade field's value from survey_record.", "name": "getFields", "signature": "def getFields(self, *args)" }, { "docstring": "Add ordered fields to self.fields, add grade field with grade choices.", "name": "insertFields", "signature": "def insertFields(self)"...
2
stack_v2_sparse_classes_30k_train_008384
Implement the Python class `GradeSurveyRecordForm` described below. Class description: RecordForm for the GradeSurveyTakeForm. Method signatures and docstrings: - def getFields(self, *args): Add the extra grade field's value from survey_record. - def insertFields(self): Add ordered fields to self.fields, add grade fi...
Implement the Python class `GradeSurveyRecordForm` described below. Class description: RecordForm for the GradeSurveyTakeForm. Method signatures and docstrings: - def getFields(self, *args): Add the extra grade field's value from survey_record. - def insertFields(self): Add ordered fields to self.fields, add grade fi...
9bd45c168f8ddb5c0e6c04eacdcaeafd61908be7
<|skeleton|> class GradeSurveyRecordForm: """RecordForm for the GradeSurveyTakeForm.""" def getFields(self, *args): """Add the extra grade field's value from survey_record.""" <|body_0|> def insertFields(self): """Add ordered fields to self.fields, add grade field with grade choice...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GradeSurveyRecordForm: """RecordForm for the GradeSurveyTakeForm.""" def getFields(self, *args): """Add the extra grade field's value from survey_record.""" if hasattr(self.survey_record, 'grade'): grade = self.survey_record.grade vals_grade = {True: 'pass', False: 'fa...
the_stack_v2_python_sparse
app/soc/modules/gsoc/views/models/grading_project_survey.py
pombredanne/Melange-1
train
0
27b8b8878b2be882e27fa6878b75b5b550604c68
[ "file_type = kwargs.pop('file_type', False)\nsuper(CoverageTemporalForm, self).__init__(*args, **kwargs)\nself.helper = CoverageTemporalFormHelper(allow_edit, res_short_id, element_id, element_name='Temporal Coverage', file_type=file_type)\nself.number = 0\nself.delete_modal_form = None\nif res_short_id:\n self....
<|body_start_0|> file_type = kwargs.pop('file_type', False) super(CoverageTemporalForm, self).__init__(*args, **kwargs) self.helper = CoverageTemporalFormHelper(allow_edit, res_short_id, element_id, element_name='Temporal Coverage', file_type=file_type) self.number = 0 self.delet...
Render Coverage Temporal Form.
CoverageTemporalForm
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CoverageTemporalForm: """Render Coverage Temporal Form.""" def __init__(self, allow_edit=True, res_short_id=None, element_id=None, *args, **kwargs): """Render Coverage Temporal Form.""" <|body_0|> def clean(self): """Modify the form's cleaned_data dictionary.""" ...
stack_v2_sparse_classes_36k_train_033801
43,447
permissive
[ { "docstring": "Render Coverage Temporal Form.", "name": "__init__", "signature": "def __init__(self, allow_edit=True, res_short_id=None, element_id=None, *args, **kwargs)" }, { "docstring": "Modify the form's cleaned_data dictionary.", "name": "clean", "signature": "def clean(self)" }...
2
null
Implement the Python class `CoverageTemporalForm` described below. Class description: Render Coverage Temporal Form. Method signatures and docstrings: - def __init__(self, allow_edit=True, res_short_id=None, element_id=None, *args, **kwargs): Render Coverage Temporal Form. - def clean(self): Modify the form's cleaned...
Implement the Python class `CoverageTemporalForm` described below. Class description: Render Coverage Temporal Form. Method signatures and docstrings: - def __init__(self, allow_edit=True, res_short_id=None, element_id=None, *args, **kwargs): Render Coverage Temporal Form. - def clean(self): Modify the form's cleaned...
69855813052243c702c9b0108d2eac3f4f1a768f
<|skeleton|> class CoverageTemporalForm: """Render Coverage Temporal Form.""" def __init__(self, allow_edit=True, res_short_id=None, element_id=None, *args, **kwargs): """Render Coverage Temporal Form.""" <|body_0|> def clean(self): """Modify the form's cleaned_data dictionary.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CoverageTemporalForm: """Render Coverage Temporal Form.""" def __init__(self, allow_edit=True, res_short_id=None, element_id=None, *args, **kwargs): """Render Coverage Temporal Form.""" file_type = kwargs.pop('file_type', False) super(CoverageTemporalForm, self).__init__(*args, **...
the_stack_v2_python_sparse
hs_core/forms.py
hydroshare/hydroshare
train
207
1594a09317edb4bc228dbb1cfb1cf4998336d3d8
[ "try:\n respone = super().post(request, *args, **kwargs)\n complaint = request.data['complaint']\n comp = ComplaintModel.objects.get(id=complaint)\n comp.collection_count += 1\n comp.save()\nexcept Exception as e:\n raise e\nelse:\n return respone", "complaint_collection = self.queryset.filte...
<|body_start_0|> try: respone = super().post(request, *args, **kwargs) complaint = request.data['complaint'] comp = ComplaintModel.objects.get(id=complaint) comp.collection_count += 1 comp.save() except Exception as e: raise e ...
吐槽收藏
ComplaintCollectionView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ComplaintCollectionView: """吐槽收藏""" def post(self, request, *args, **kwargs): """点赞""" <|body_0|> def destroy(self, request, complaint, *args, **kwargs): """取消收藏""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: respone = super()....
stack_v2_sparse_classes_36k_train_033802
9,460
no_license
[ { "docstring": "点赞", "name": "post", "signature": "def post(self, request, *args, **kwargs)" }, { "docstring": "取消收藏", "name": "destroy", "signature": "def destroy(self, request, complaint, *args, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_006396
Implement the Python class `ComplaintCollectionView` described below. Class description: 吐槽收藏 Method signatures and docstrings: - def post(self, request, *args, **kwargs): 点赞 - def destroy(self, request, complaint, *args, **kwargs): 取消收藏
Implement the Python class `ComplaintCollectionView` described below. Class description: 吐槽收藏 Method signatures and docstrings: - def post(self, request, *args, **kwargs): 点赞 - def destroy(self, request, complaint, *args, **kwargs): 取消收藏 <|skeleton|> class ComplaintCollectionView: """吐槽收藏""" def post(self, ...
c0df44858d0951e345de245505ae8f71f8b5e1b6
<|skeleton|> class ComplaintCollectionView: """吐槽收藏""" def post(self, request, *args, **kwargs): """点赞""" <|body_0|> def destroy(self, request, complaint, *args, **kwargs): """取消收藏""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ComplaintCollectionView: """吐槽收藏""" def post(self, request, *args, **kwargs): """点赞""" try: respone = super().post(request, *args, **kwargs) complaint = request.data['complaint'] comp = ComplaintModel.objects.get(id=complaint) comp.collectio...
the_stack_v2_python_sparse
mlh/apps/complaints/views.py
AmirHuang/mlh
train
0
65b97a25227a2b59cf60a8d6a69058d8e9cc5339
[ "self.left = left\nself.op = op\nself.right = right", "left_val = self.left.evaluate(env)\nright_val = self.right.evaluate(env)\nif self.op == '+':\n return left_val + right_val\nelif self.op == '*':\n return left_val * right_val\nelse:\n raise ValueError(f'Invalid operator {self.op}')" ]
<|body_start_0|> self.left = left self.op = op self.right = right <|end_body_0|> <|body_start_1|> left_val = self.left.evaluate(env) right_val = self.right.evaluate(env) if self.op == '+': return left_val + right_val elif self.op == '*': r...
An arithmetic binary operation. Attributes: ----------- left: the left operand op: the name of the operator right: the right operand Invariants: ----------- - self.op == '+' or self.op == '*'
BinOp
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BinOp: """An arithmetic binary operation. Attributes: ----------- left: the left operand op: the name of the operator right: the right operand Invariants: ----------- - self.op == '+' or self.op == '*'""" def __init__(self, left: Expr, op: str, right: Expr) -> None: """Initialize a n...
stack_v2_sparse_classes_36k_train_033803
9,378
permissive
[ { "docstring": "Initialize a new binary operation express. Parameters: ----------- :param left: the left operand :param op: the name of the operator :param right: the right operand Preconditions: -------------- <op> is the string '+' or '*'.", "name": "__init__", "signature": "def __init__(self, left: E...
2
stack_v2_sparse_classes_30k_train_019253
Implement the Python class `BinOp` described below. Class description: An arithmetic binary operation. Attributes: ----------- left: the left operand op: the name of the operator right: the right operand Invariants: ----------- - self.op == '+' or self.op == '*' Method signatures and docstrings: - def __init__(self, ...
Implement the Python class `BinOp` described below. Class description: An arithmetic binary operation. Attributes: ----------- left: the left operand op: the name of the operator right: the right operand Invariants: ----------- - self.op == '+' or self.op == '*' Method signatures and docstrings: - def __init__(self, ...
81324825827ac776d45844d79f4aa75a4ad5af11
<|skeleton|> class BinOp: """An arithmetic binary operation. Attributes: ----------- left: the left operand op: the name of the operator right: the right operand Invariants: ----------- - self.op == '+' or self.op == '*'""" def __init__(self, left: Expr, op: str, right: Expr) -> None: """Initialize a n...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BinOp: """An arithmetic binary operation. Attributes: ----------- left: the left operand op: the name of the operator right: the right operand Invariants: ----------- - self.op == '+' or self.op == '*'""" def __init__(self, left: Expr, op: str, right: Expr) -> None: """Initialize a new binary ope...
the_stack_v2_python_sparse
DataStructures/Trees/ExpressionTree/ExpressionTree.py
m0sys/Algorithms
train
0
2c1ce9b33fc0b7ac96c0e683692982322e64f2ae
[ "q = quantity.DipoleMoment(1.0, 'C*m')\nself.assertAlmostEqual(q.value, 1.0, 6)\nself.assertAlmostEqual(q.value_si, 1.0, 6)\nself.assertEqual(q.units, 'C*m')", "q = quantity.DipoleMoment(1.0, 'De')\nself.assertAlmostEqual(q.value, 1.0, 6)\nself.assertAlmostEqual(q.value_si * constants.c * 1e+21, 1.0, 6)\nself.ass...
<|body_start_0|> q = quantity.DipoleMoment(1.0, 'C*m') self.assertAlmostEqual(q.value, 1.0, 6) self.assertAlmostEqual(q.value_si, 1.0, 6) self.assertEqual(q.units, 'C*m') <|end_body_0|> <|body_start_1|> q = quantity.DipoleMoment(1.0, 'De') self.assertAlmostEqual(q.value,...
Contains unit tests of the DipoleMoment unit type object.
TestDipoleMoment
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestDipoleMoment: """Contains unit tests of the DipoleMoment unit type object.""" def test_Ctimesm(self): """Test the creation of a dipole moment quantity with units of C*m.""" <|body_0|> def test_D(self): """Test the creation of a dipole moment quantity with uni...
stack_v2_sparse_classes_36k_train_033804
33,010
permissive
[ { "docstring": "Test the creation of a dipole moment quantity with units of C*m.", "name": "test_Ctimesm", "signature": "def test_Ctimesm(self)" }, { "docstring": "Test the creation of a dipole moment quantity with units of J/mol.", "name": "test_D", "signature": "def test_D(self)" } ]
2
stack_v2_sparse_classes_30k_train_011870
Implement the Python class `TestDipoleMoment` described below. Class description: Contains unit tests of the DipoleMoment unit type object. Method signatures and docstrings: - def test_Ctimesm(self): Test the creation of a dipole moment quantity with units of C*m. - def test_D(self): Test the creation of a dipole mom...
Implement the Python class `TestDipoleMoment` described below. Class description: Contains unit tests of the DipoleMoment unit type object. Method signatures and docstrings: - def test_Ctimesm(self): Test the creation of a dipole moment quantity with units of C*m. - def test_D(self): Test the creation of a dipole mom...
0937b2e0a955dcf21b79674a4e89f43941c0dd85
<|skeleton|> class TestDipoleMoment: """Contains unit tests of the DipoleMoment unit type object.""" def test_Ctimesm(self): """Test the creation of a dipole moment quantity with units of C*m.""" <|body_0|> def test_D(self): """Test the creation of a dipole moment quantity with uni...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestDipoleMoment: """Contains unit tests of the DipoleMoment unit type object.""" def test_Ctimesm(self): """Test the creation of a dipole moment quantity with units of C*m.""" q = quantity.DipoleMoment(1.0, 'C*m') self.assertAlmostEqual(q.value, 1.0, 6) self.assertAlmostE...
the_stack_v2_python_sparse
rmgpy/quantityTest.py
vrlambert/RMG-Py
train
1
e48db48b4904d94863a7bf939d9296d002c7d29b
[ "if not matrix:\n return []\nm = len(matrix)\nn = len(matrix[0])\nresult = [[0 for j in range(m)] for i in range(n)]\nfor i in range(n):\n for j in range(m):\n result[i][j] = matrix[m - j - 1][i]\nreturn result", "if not matrix:\n return\nn = len(matrix)\nvisited = {}\nfor i in range(n):\n for ...
<|body_start_0|> if not matrix: return [] m = len(matrix) n = len(matrix[0]) result = [[0 for j in range(m)] for i in range(n)] for i in range(n): for j in range(m): result[i][j] = matrix[m - j - 1][i] return result <|end_body_0|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rotate(self, matrix): """返回一个新矩阵,可以实现m*n矩阵的旋转 :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.""" <|body_0|> def rotate2(self, matrix): """旋转矩阵,修改原有的矩阵,不返回 :type matrix: List[List[int]] :rtype: void Do n...
stack_v2_sparse_classes_36k_train_033805
2,349
no_license
[ { "docstring": "返回一个新矩阵,可以实现m*n矩阵的旋转 :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.", "name": "rotate", "signature": "def rotate(self, matrix)" }, { "docstring": "旋转矩阵,修改原有的矩阵,不返回 :type matrix: List[List[int]] :rtype: void Do not return anythin...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate(self, matrix): 返回一个新矩阵,可以实现m*n矩阵的旋转 :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead. - def rotate2(self, matrix): 旋转矩...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate(self, matrix): 返回一个新矩阵,可以实现m*n矩阵的旋转 :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead. - def rotate2(self, matrix): 旋转矩...
04d87d76b762f6ea7cfb3a453382b2d7d4e154dc
<|skeleton|> class Solution: def rotate(self, matrix): """返回一个新矩阵,可以实现m*n矩阵的旋转 :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.""" <|body_0|> def rotate2(self, matrix): """旋转矩阵,修改原有的矩阵,不返回 :type matrix: List[List[int]] :rtype: void Do n...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rotate(self, matrix): """返回一个新矩阵,可以实现m*n矩阵的旋转 :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.""" if not matrix: return [] m = len(matrix) n = len(matrix[0]) result = [[0 for j in range(m)] for ...
the_stack_v2_python_sparse
leetcode/048 Rotate Image.py
mofei952/algorithm_exercise
train
1
6b50876f984fb071cf6dddc0a55b801ecd64dd7c
[ "size = 0\ncid = CustomID()\nuser: UserModel = self.current_user\nfn = os.path.join(upload_dir, str(cid.to_hex()))\nm = hashlib.blake2b()\npost = await self.post_data()\nfield: FileField = post.get('file', None)\nif not (field and isinstance(field, FileField)):\n return self.finish(RETCODE.INVALID_POSTDATA, '没有提...
<|body_start_0|> size = 0 cid = CustomID() user: UserModel = self.current_user fn = os.path.join(upload_dir, str(cid.to_hex())) m = hashlib.blake2b() post = await self.post_data() field: FileField = post.get('file', None) if not (field and isinstance(field...
UploadView
[ "Zlib" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UploadView: async def upload(self): """上传图片 随机文件名,上传至指定目录。完成后修改文件名为hash值 :return:""" <|body_0|> async def qn_token(self): """获取七牛 token :return:""" <|body_1|> async def qn_callback(self): """七牛回调 :return:""" <|body_2|> <|end_skeleton|> ...
stack_v2_sparse_classes_36k_train_033806
3,832
permissive
[ { "docstring": "上传图片 随机文件名,上传至指定目录。完成后修改文件名为hash值 :return:", "name": "upload", "signature": "async def upload(self)" }, { "docstring": "获取七牛 token :return:", "name": "qn_token", "signature": "async def qn_token(self)" }, { "docstring": "七牛回调 :return:", "name": "qn_callback", ...
3
stack_v2_sparse_classes_30k_train_019673
Implement the Python class `UploadView` described below. Class description: Implement the UploadView class. Method signatures and docstrings: - async def upload(self): 上传图片 随机文件名,上传至指定目录。完成后修改文件名为hash值 :return: - async def qn_token(self): 获取七牛 token :return: - async def qn_callback(self): 七牛回调 :return:
Implement the Python class `UploadView` described below. Class description: Implement the UploadView class. Method signatures and docstrings: - async def upload(self): 上传图片 随机文件名,上传至指定目录。完成后修改文件名为hash值 :return: - async def qn_token(self): 获取七牛 token :return: - async def qn_callback(self): 七牛回调 :return: <|skeleton|> ...
c3a4af0f98693a08b850b47ff01091c4e884cc18
<|skeleton|> class UploadView: async def upload(self): """上传图片 随机文件名,上传至指定目录。完成后修改文件名为hash值 :return:""" <|body_0|> async def qn_token(self): """获取七牛 token :return:""" <|body_1|> async def qn_callback(self): """七牛回调 :return:""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UploadView: async def upload(self): """上传图片 随机文件名,上传至指定目录。完成后修改文件名为hash值 :return:""" size = 0 cid = CustomID() user: UserModel = self.current_user fn = os.path.join(upload_dir, str(cid.to_hex())) m = hashlib.blake2b() post = await self.post_data() ...
the_stack_v2_python_sparse
backend/api/upload.py
LiangTang1993/Icarus
train
1
4b8587edb634c2b77e3f0b949d8a2b4de765f880
[ "profile.addListsToCraftTypeRepository('skeinforge_tools.craft_plugins.carve.html', self)\nself.fileNameInput = settings.FileNameInput().getFromFileName(interpret.getTranslatorFileTypeTuples(), 'Open File for Carve', self, '')\nself.openWikiManualHelpPage = settings.HelpPage().getOpenFromAbsolute('http://www.bitsfr...
<|body_start_0|> profile.addListsToCraftTypeRepository('skeinforge_tools.craft_plugins.carve.html', self) self.fileNameInput = settings.FileNameInput().getFromFileName(interpret.getTranslatorFileTypeTuples(), 'Open File for Carve', self, '') self.openWikiManualHelpPage = settings.HelpPage().getO...
A class to handle the carve settings.
CarveRepository
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CarveRepository: """A class to handle the carve settings.""" def __init__(self): """Set the default settings, execute title & settings fileName.""" <|body_0|> def execute(self): """Carve button has been clicked.""" <|body_1|> <|end_skeleton|> <|body_sta...
stack_v2_sparse_classes_36k_train_033807
10,436
no_license
[ { "docstring": "Set the default settings, execute title & settings fileName.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Carve button has been clicked.", "name": "execute", "signature": "def execute(self)" } ]
2
null
Implement the Python class `CarveRepository` described below. Class description: A class to handle the carve settings. Method signatures and docstrings: - def __init__(self): Set the default settings, execute title & settings fileName. - def execute(self): Carve button has been clicked.
Implement the Python class `CarveRepository` described below. Class description: A class to handle the carve settings. Method signatures and docstrings: - def __init__(self): Set the default settings, execute title & settings fileName. - def execute(self): Carve button has been clicked. <|skeleton|> class CarveRepos...
fd69d8e856780c826386dc973ceabcc03623f3e8
<|skeleton|> class CarveRepository: """A class to handle the carve settings.""" def __init__(self): """Set the default settings, execute title & settings fileName.""" <|body_0|> def execute(self): """Carve button has been clicked.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CarveRepository: """A class to handle the carve settings.""" def __init__(self): """Set the default settings, execute title & settings fileName.""" profile.addListsToCraftTypeRepository('skeinforge_tools.craft_plugins.carve.html', self) self.fileNameInput = settings.FileNameInput(...
the_stack_v2_python_sparse
skeinforge_tools/craft_plugins/carve.py
bmander/skeinforge
train
34
3b995da70207dc5e13b6e32e44ce57cf89386b61
[ "super().__init__()\nself.gru = nn.GRU(300, embedding_dim // 2, num_layers=1, batch_first=True, bidirectional=True)\nself.layer_norm = nn.LayerNorm(embedding_dim)\nself.embedding_dim = embedding_dim", "lengths = lengths.long()\nreorder = False\nsorted_len, indices = torch.sort(lengths, descending=True)\nif not to...
<|body_start_0|> super().__init__() self.gru = nn.GRU(300, embedding_dim // 2, num_layers=1, batch_first=True, bidirectional=True) self.layer_norm = nn.LayerNorm(embedding_dim) self.embedding_dim = embedding_dim <|end_body_0|> <|body_start_1|> lengths = lengths.long() re...
SentenceEncoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SentenceEncoder: def __init__(self, embedding_dim=1024): """Parameters ---------- embedding_dim : int, optional Dimension of output sentence embedding "d_t", by default 1024""" <|body_0|> def forward(self, words, lengths): """Return sentence embedding (B, D) from seq...
stack_v2_sparse_classes_36k_train_033808
2,400
no_license
[ { "docstring": "Parameters ---------- embedding_dim : int, optional Dimension of output sentence embedding \"d_t\", by default 1024", "name": "__init__", "signature": "def __init__(self, embedding_dim=1024)" }, { "docstring": "Return sentence embedding (B, D) from sequence of \"word embeddings\"...
2
stack_v2_sparse_classes_30k_test_000600
Implement the Python class `SentenceEncoder` described below. Class description: Implement the SentenceEncoder class. Method signatures and docstrings: - def __init__(self, embedding_dim=1024): Parameters ---------- embedding_dim : int, optional Dimension of output sentence embedding "d_t", by default 1024 - def forw...
Implement the Python class `SentenceEncoder` described below. Class description: Implement the SentenceEncoder class. Method signatures and docstrings: - def __init__(self, embedding_dim=1024): Parameters ---------- embedding_dim : int, optional Dimension of output sentence embedding "d_t", by default 1024 - def forw...
79ec94cf5c9b32e58b41e120ad834e48378fc3e6
<|skeleton|> class SentenceEncoder: def __init__(self, embedding_dim=1024): """Parameters ---------- embedding_dim : int, optional Dimension of output sentence embedding "d_t", by default 1024""" <|body_0|> def forward(self, words, lengths): """Return sentence embedding (B, D) from seq...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SentenceEncoder: def __init__(self, embedding_dim=1024): """Parameters ---------- embedding_dim : int, optional Dimension of output sentence embedding "d_t", by default 1024""" super().__init__() self.gru = nn.GRU(300, embedding_dim // 2, num_layers=1, batch_first=True, bidirectional=T...
the_stack_v2_python_sparse
src/modules/geneva/sentence_encoder.py
DPS0340/LatteGAN
train
0
f48e1782fed55afeb7e0871b409a6cc287fb935c
[ "pre_sum = reduce(lambda x, y: x + [x[-1] + y], A, [0])\ncount = 0\nfor i in range(len(pre_sum)):\n for j in range(i + 1, len(pre_sum)):\n div = pre_sum[j] - pre_sum[i]\n if div % K == 0:\n count += 1\nreturn count", "pre_sum_div = {0: 1}\ntotal = count = 0\nfor num in A:\n total +=...
<|body_start_0|> pre_sum = reduce(lambda x, y: x + [x[-1] + y], A, [0]) count = 0 for i in range(len(pre_sum)): for j in range(i + 1, len(pre_sum)): div = pre_sum[j] - pre_sum[i] if div % K == 0: count += 1 return count <|en...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def subarraysDivByK2(self, A, K): """:type A: List[int] :type K: int :rtype: int""" <|body_0|> def subarraysDivByK(self, A, K): """:type A: List[int] :type K: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> pre_sum = reduce...
stack_v2_sparse_classes_36k_train_033809
2,311
permissive
[ { "docstring": ":type A: List[int] :type K: int :rtype: int", "name": "subarraysDivByK2", "signature": "def subarraysDivByK2(self, A, K)" }, { "docstring": ":type A: List[int] :type K: int :rtype: int", "name": "subarraysDivByK", "signature": "def subarraysDivByK(self, A, K)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subarraysDivByK2(self, A, K): :type A: List[int] :type K: int :rtype: int - def subarraysDivByK(self, A, K): :type A: List[int] :type K: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subarraysDivByK2(self, A, K): :type A: List[int] :type K: int :rtype: int - def subarraysDivByK(self, A, K): :type A: List[int] :type K: int :rtype: int <|skeleton|> class S...
0dd67edca4e0b0323cb5a7239f02ea46383cd15a
<|skeleton|> class Solution: def subarraysDivByK2(self, A, K): """:type A: List[int] :type K: int :rtype: int""" <|body_0|> def subarraysDivByK(self, A, K): """:type A: List[int] :type K: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def subarraysDivByK2(self, A, K): """:type A: List[int] :type K: int :rtype: int""" pre_sum = reduce(lambda x, y: x + [x[-1] + y], A, [0]) count = 0 for i in range(len(pre_sum)): for j in range(i + 1, len(pre_sum)): div = pre_sum[j] - pre_s...
the_stack_v2_python_sparse
974.subarray-sums-divisible-by-k.py
windard/leeeeee
train
0
93ad0588178f50294832dba3f15d149292882aec
[ "if isinstance(key, int):\n return DI(key)\nif key not in DI._member_map_:\n extend_enum(DI, key, default)\nreturn DI[key]", "if not (isinstance(value, int) and 0 <= value <= 15):\n raise ValueError('%r is not a valid %s' % (value, cls.__name__))\nif 3 <= value <= 15:\n extend_enum(cls, 'Unassigned [%...
<|body_start_0|> if isinstance(key, int): return DI(key) if key not in DI._member_map_: extend_enum(DI, key, default) return DI[key] <|end_body_0|> <|body_start_1|> if not (isinstance(value, int) and 0 <= value <= 15): raise ValueError('%r is not a va...
Enumeration class for DI.
DI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DI: """Enumeration class for DI.""" def get(key, default=-1): """Backport support for original codes.""" <|body_0|> def _missing_(cls, value): """Lookup function used when value is not found.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if is...
stack_v2_sparse_classes_36k_train_033810
1,121
no_license
[ { "docstring": "Backport support for original codes.", "name": "get", "signature": "def get(key, default=-1)" }, { "docstring": "Lookup function used when value is not found.", "name": "_missing_", "signature": "def _missing_(cls, value)" } ]
2
stack_v2_sparse_classes_30k_train_014572
Implement the Python class `DI` described below. Class description: Enumeration class for DI. Method signatures and docstrings: - def get(key, default=-1): Backport support for original codes. - def _missing_(cls, value): Lookup function used when value is not found.
Implement the Python class `DI` described below. Class description: Enumeration class for DI. Method signatures and docstrings: - def get(key, default=-1): Backport support for original codes. - def _missing_(cls, value): Lookup function used when value is not found. <|skeleton|> class DI: """Enumeration class f...
fd43ccca1d032f8f230c4467dcb5df757669ef13
<|skeleton|> class DI: """Enumeration class for DI.""" def get(key, default=-1): """Backport support for original codes.""" <|body_0|> def _missing_(cls, value): """Lookup function used when value is not found.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DI: """Enumeration class for DI.""" def get(key, default=-1): """Backport support for original codes.""" if isinstance(key, int): return DI(key) if key not in DI._member_map_: extend_enum(DI, key, default) return DI[key] def _missing_(cls, valu...
the_stack_v2_python_sparse
venv/lib/python3.6/site-packages/pcapkit/const/hip/di.py
IvanLetteri/MLfeaturesExtractor
train
0
42f4cb10619e6c4336a3a8203286bd1c27cdb2f3
[ "self.f = f\nself.gp = GP(X_init, Y_init, l, sigma_f)\nl, h = bounds\nself.X_s = np.linspace(l, h, num=ac_samples)[:, np.newaxis]\nself.xsi = xsi\nself.minimize = minimize", "mu, sigma = self.gp.predict(self.X_s)\nmu = mu.flatten()\nmu_sample, _ = self.gp.predict(self.gp.X)\nsigma = np.maximum(1e-15, sigma.flatte...
<|body_start_0|> self.f = f self.gp = GP(X_init, Y_init, l, sigma_f) l, h = bounds self.X_s = np.linspace(l, h, num=ac_samples)[:, np.newaxis] self.xsi = xsi self.minimize = minimize <|end_body_0|> <|body_start_1|> mu, sigma = self.gp.predict(self.X_s) mu...
performs Bayesian optimization on a noiseless 1D Gaussian process
BayesianOptimization
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BayesianOptimization: """performs Bayesian optimization on a noiseless 1D Gaussian process""" def __init__(self, f, X_init, Y_init, bounds, ac_samples, l=1, sigma_f=1, xsi=0.01, minimize=True): """f is the black-box function to be optimized X_init ndarray (t, 1) inputs already sample...
stack_v2_sparse_classes_36k_train_033811
3,735
no_license
[ { "docstring": "f is the black-box function to be optimized X_init ndarray (t, 1) inputs already sampled with black-box function Y_init ndarray (t, 1) outputs of black-box function for each input in X_init t is the number of initial samples bounds tuple (min, max) representing the bounds of the space in which t...
3
stack_v2_sparse_classes_30k_val_000800
Implement the Python class `BayesianOptimization` described below. Class description: performs Bayesian optimization on a noiseless 1D Gaussian process Method signatures and docstrings: - def __init__(self, f, X_init, Y_init, bounds, ac_samples, l=1, sigma_f=1, xsi=0.01, minimize=True): f is the black-box function to...
Implement the Python class `BayesianOptimization` described below. Class description: performs Bayesian optimization on a noiseless 1D Gaussian process Method signatures and docstrings: - def __init__(self, f, X_init, Y_init, bounds, ac_samples, l=1, sigma_f=1, xsi=0.01, minimize=True): f is the black-box function to...
5114f884241b3406940b00450d8c71f55d5d6a70
<|skeleton|> class BayesianOptimization: """performs Bayesian optimization on a noiseless 1D Gaussian process""" def __init__(self, f, X_init, Y_init, bounds, ac_samples, l=1, sigma_f=1, xsi=0.01, minimize=True): """f is the black-box function to be optimized X_init ndarray (t, 1) inputs already sample...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BayesianOptimization: """performs Bayesian optimization on a noiseless 1D Gaussian process""" def __init__(self, f, X_init, Y_init, bounds, ac_samples, l=1, sigma_f=1, xsi=0.01, minimize=True): """f is the black-box function to be optimized X_init ndarray (t, 1) inputs already sampled with black-...
the_stack_v2_python_sparse
unsupervised_learning/0x03-hyperparameter_tuning/5-bayes_opt.py
icculp/holbertonschool-machine_learning
train
0
67c3136048229d5169497fbaefa6e09455fa5af5
[ "goalking_qs = GoalKing.objects.by_season(season).select_related('member__user')\ngoalking_list = [x for x in goalking_qs if x.total_goals > 0]\nif len(goalking_list) > 0:\n m_list = [x for x in goalking_list if x.member.gender == Member.GENDER.Male]\n l_list = [x for x in goalking_list if x.member.gender == ...
<|body_start_0|> goalking_qs = GoalKing.objects.by_season(season).select_related('member__user') goalking_list = [x for x in goalking_qs if x.total_goals > 0] if len(goalking_list) > 0: m_list = [x for x in goalking_list if x.member.gender == Member.GENDER.Male] l_list = ...
Provides useful methods for GoalKing related views
GoalKingMixin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GoalKingMixin: """Provides useful methods for GoalKing related views""" def get_goalking_list(self, season): """Returns a list of GoalKing items for the specified season""" <|body_0|> def apply_ranking(self, goalking_list): """Adds a rank attribute to each GoalKi...
stack_v2_sparse_classes_36k_train_033812
21,351
no_license
[ { "docstring": "Returns a list of GoalKing items for the specified season", "name": "get_goalking_list", "signature": "def get_goalking_list(self, season)" }, { "docstring": "Adds a rank attribute to each GoalKing instance in the given list based on the total number of goals scored by that perso...
2
stack_v2_sparse_classes_30k_train_012446
Implement the Python class `GoalKingMixin` described below. Class description: Provides useful methods for GoalKing related views Method signatures and docstrings: - def get_goalking_list(self, season): Returns a list of GoalKing items for the specified season - def apply_ranking(self, goalking_list): Adds a rank att...
Implement the Python class `GoalKingMixin` described below. Class description: Provides useful methods for GoalKing related views Method signatures and docstrings: - def get_goalking_list(self, season): Returns a list of GoalKing items for the specified season - def apply_ranking(self, goalking_list): Adds a rank att...
f38e1984064bdf81f05b86f4650824dd28946c19
<|skeleton|> class GoalKingMixin: """Provides useful methods for GoalKing related views""" def get_goalking_list(self, season): """Returns a list of GoalKing items for the specified season""" <|body_0|> def apply_ranking(self, goalking_list): """Adds a rank attribute to each GoalKi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GoalKingMixin: """Provides useful methods for GoalKing related views""" def get_goalking_list(self, season): """Returns a list of GoalKing items for the specified season""" goalking_qs = GoalKing.objects.by_season(season).select_related('member__user') goalking_list = [x for x in ...
the_stack_v2_python_sparse
cshcsite/matches/views.py
cshc/cshc_website
train
2
172dedd6b626c9aa7cc5e5c305e07ae65f480f4c
[ "categories.MastiffPlugin.__init__(self, name)\nself.cat_name = 'ZIP'\nself.my_types = ['Zip archive', 'ZIP compressed archive']\nself.yara_filetype = 'rule iszip {\\n\\t condition:\\n\\t\\t uint32(0x0) == 0x04034b50\\n }'", "try:\n if zipfile.is_zipfile(file_name) is True:\n return self.ca...
<|body_start_0|> categories.MastiffPlugin.__init__(self, name) self.cat_name = 'ZIP' self.my_types = ['Zip archive', 'ZIP compressed archive'] self.yara_filetype = 'rule iszip {\n\t condition:\n\t\t uint32(0x0) == 0x04034b50\n }' <|end_body_0|> <|body_start_1|> try:...
Category class for Zip documents.
ZipCat
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZipCat: """Category class for Zip documents.""" def __init__(self, name=None): """Initialize the category.""" <|body_0|> def is_my_filetype(self, id_dict, file_name): """Determine if the magic string is appropriate for this category""" <|body_1|> <|end_s...
stack_v2_sparse_classes_36k_train_033813
1,922
permissive
[ { "docstring": "Initialize the category.", "name": "__init__", "signature": "def __init__(self, name=None)" }, { "docstring": "Determine if the magic string is appropriate for this category", "name": "is_my_filetype", "signature": "def is_my_filetype(self, id_dict, file_name)" } ]
2
stack_v2_sparse_classes_30k_train_002314
Implement the Python class `ZipCat` described below. Class description: Category class for Zip documents. Method signatures and docstrings: - def __init__(self, name=None): Initialize the category. - def is_my_filetype(self, id_dict, file_name): Determine if the magic string is appropriate for this category
Implement the Python class `ZipCat` described below. Class description: Category class for Zip documents. Method signatures and docstrings: - def __init__(self, name=None): Initialize the category. - def is_my_filetype(self, id_dict, file_name): Determine if the magic string is appropriate for this category <|skelet...
d97cb19340de207cb02437ae811ca23181fc0236
<|skeleton|> class ZipCat: """Category class for Zip documents.""" def __init__(self, name=None): """Initialize the category.""" <|body_0|> def is_my_filetype(self, id_dict, file_name): """Determine if the magic string is appropriate for this category""" <|body_1|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ZipCat: """Category class for Zip documents.""" def __init__(self, name=None): """Initialize the category.""" categories.MastiffPlugin.__init__(self, name) self.cat_name = 'ZIP' self.my_types = ['Zip archive', 'ZIP compressed archive'] self.yara_filetype = 'rule is...
the_stack_v2_python_sparse
mastiff/plugins/category/zip.py
mshelton/mastiff
train
0
2d9fe3a28440caaa4483df7b8fa14d4b2cc5699f
[ "vals = []\n\ndef ser(node):\n if node is None:\n vals.append('#')\n return\n vals.append(str(node.val))\n ser(node.left)\n ser(node.right)\nser(root)\nreturn ' '.join(vals)", "vals = data.split().__iter__()\n\ndef de(iterv):\n v = next(iterv)\n if v == '#':\n return None\n ...
<|body_start_0|> vals = [] def ser(node): if node is None: vals.append('#') return vals.append(str(node.val)) ser(node.left) ser(node.right) ser(root) return ' '.join(vals) <|end_body_0|> <|body_start_1|> ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_033814
1,076
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
80e44f4e9d3a5b592fdebe0bf16d1df54e99991e
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" vals = [] def ser(node): if node is None: vals.append('#') return vals.append(str(node.val)) ser(node.left) ...
the_stack_v2_python_sparse
Python/297 - Serialize and Deserialize Binary Tree/297_serialize-and-deserialize-binary-tree.py
aptend/leetcode-rua
train
2
a35056b09eea6517026fe79a19ded1e009d8f755
[ "super().__init__(**kwargs)\nself.fields.get('originalQuantity').widget = forms.HiddenInput()\nif self.instance.pk:\n self._initial_inventory = self.instance.currentInventory\nelse:\n self._initial_inventory = 0\n self.fields.get('originalQuantity').initial = 0\nself.fields.get('newQuantity').initial = sel...
<|body_start_0|> super().__init__(**kwargs) self.fields.get('originalQuantity').widget = forms.HiddenInput() if self.instance.pk: self._initial_inventory = self.instance.currentInventory else: self._initial_inventory = 0 self.fields.get('originalQuanti...
This custom admin form causes the newQuantity field to be displayed in place of the originalQuantity field. That way, the user can update the inventory of merch without having to go through the full record of inventory adjustments. The form save() method handles the logic of updating the underlying inventory data appro...
MerchItemVariantForm
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MerchItemVariantForm: """This custom admin form causes the newQuantity field to be displayed in place of the originalQuantity field. That way, the user can update the inventory of merch without having to go through the full record of inventory adjustments. The form save() method handles the logic...
stack_v2_sparse_classes_36k_train_033815
5,904
permissive
[ { "docstring": "Hide the originalQuantity field and set the newQuantity field to reflect current inventory levels.", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "If the quantity has been updated, then update inventory records.", "name": "save", "sign...
2
null
Implement the Python class `MerchItemVariantForm` described below. Class description: This custom admin form causes the newQuantity field to be displayed in place of the originalQuantity field. That way, the user can update the inventory of merch without having to go through the full record of inventory adjustments. T...
Implement the Python class `MerchItemVariantForm` described below. Class description: This custom admin form causes the newQuantity field to be displayed in place of the originalQuantity field. That way, the user can update the inventory of merch without having to go through the full record of inventory adjustments. T...
19db3e83e76ea2002ee841989410d12d1e601023
<|skeleton|> class MerchItemVariantForm: """This custom admin form causes the newQuantity field to be displayed in place of the originalQuantity field. That way, the user can update the inventory of merch without having to go through the full record of inventory adjustments. The form save() method handles the logic...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MerchItemVariantForm: """This custom admin form causes the newQuantity field to be displayed in place of the originalQuantity field. That way, the user can update the inventory of merch without having to go through the full record of inventory adjustments. The form save() method handles the logic of updating ...
the_stack_v2_python_sparse
danceschool/merch/admin.py
django-danceschool/django-danceschool
train
40
a5074633eab4db18935c010e57833462b514d124
[ "if not nums:\n return []\nnum_map = {}\nfor i in range(len(nums)):\n if num_map.__contains__(nums[i]):\n num_map[nums[i]] += 1\n else:\n num_map[nums[i]] = 1\nres = []\nfor i in range(len(nums)):\n target = 0 - nums[i]\n cur_res = []\n for j in range(len(nums)):\n if num_map....
<|body_start_0|> if not nums: return [] num_map = {} for i in range(len(nums)): if num_map.__contains__(nums[i]): num_map[nums[i]] += 1 else: num_map[nums[i]] = 1 res = [] for i in range(len(nums)): t...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def threeSum(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def threeSum2(self, nums): """超时 :type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not nums: ...
stack_v2_sparse_classes_36k_train_033816
2,740
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "threeSum", "signature": "def threeSum(self, nums)" }, { "docstring": "超时 :type nums: List[int] :rtype: List[List[int]]", "name": "threeSum2", "signature": "def threeSum2(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def threeSum(self, nums): :type nums: List[int] :rtype: List[List[int]] - def threeSum2(self, nums): 超时 :type nums: List[int] :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def threeSum(self, nums): :type nums: List[int] :rtype: List[List[int]] - def threeSum2(self, nums): 超时 :type nums: List[int] :rtype: List[List[int]] <|skeleton|> class Solution...
beabfd31379f44ffd767fc676912db5022495b53
<|skeleton|> class Solution: def threeSum(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def threeSum2(self, nums): """超时 :type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def threeSum(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" if not nums: return [] num_map = {} for i in range(len(nums)): if num_map.__contains__(nums[i]): num_map[nums[i]] += 1 else: ...
the_stack_v2_python_sparse
leetCode/top50/015threeSum.py
fatezy/Algorithm
train
1
8c4bfcb12144832fe0fc13690053e32f6f69a982
[ "self.new_pixel = new_pixel\naxes = image.axes\nself.data_to_display_trans = axes.transData\nself.display_to_data_trans = axes.transData.inverted()\nextent = image.get_extent()\nxmin, xmax, ymin, ymax = extent\narr = image.get_array()\nself.delta_x, self.delta_y = ((xmax - xmin) / arr.shape[1], (ymax - ymin) / arr....
<|body_start_0|> self.new_pixel = new_pixel axes = image.axes self.data_to_display_trans = axes.transData self.display_to_data_trans = axes.transData.inverted() extent = image.get_extent() xmin, xmax, ymin, ymax = extent arr = image.get_array() self.delta_...
Define a transformation that computes the new position on an image grid that will take that position to the next pixel in a given direction. The __call__ method expects a derived type to implement the actual computation of the new data coordinates
PixelPositionTransform
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PixelPositionTransform: """Define a transformation that computes the new position on an image grid that will take that position to the next pixel in a given direction. The __call__ method expects a derived type to implement the actual computation of the new data coordinates""" def __init__(s...
stack_v2_sparse_classes_36k_train_033817
8,295
no_license
[ { "docstring": ":param image: A reference to the image the cursor hovers over", "name": "__init__", "signature": "def __init__(self, image: AxesImage, new_pixel: Callable[[float, float], Tuple[float, float]])" }, { "docstring": "Given the position of a cursor on the given image move the cursor t...
3
stack_v2_sparse_classes_30k_train_017001
Implement the Python class `PixelPositionTransform` described below. Class description: Define a transformation that computes the new position on an image grid that will take that position to the next pixel in a given direction. The __call__ method expects a derived type to implement the actual computation of the new ...
Implement the Python class `PixelPositionTransform` described below. Class description: Define a transformation that computes the new position on an image grid that will take that position to the next pixel in a given direction. The __call__ method expects a derived type to implement the actual computation of the new ...
14de3d1c024374d5b3ed4e524da0e406669aa801
<|skeleton|> class PixelPositionTransform: """Define a transformation that computes the new position on an image grid that will take that position to the next pixel in a given direction. The __call__ method expects a derived type to implement the actual computation of the new data coordinates""" def __init__(s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PixelPositionTransform: """Define a transformation that computes the new position on an image grid that will take that position to the next pixel in a given direction. The __call__ method expects a derived type to implement the actual computation of the new data coordinates""" def __init__(self, image: A...
the_stack_v2_python_sparse
python/movecursor/keymove.py
martyngigg/sandbox
train
0
c8049094844995027357513c2e867c03987995f7
[ "\"\"\" Take parameters, and Sprite Constants \"\"\"\nsuper(BeesSprite, self).__init__(world_map, BeesSprite.IMAGE, GRID_LOCK, BeesSprite.HEALTH_BAR, BeesSprite.AVG_SPEED, BeesSprite.VISION, coordinates)\nself.type = 'bees'\nself.prey = ['plant']", "visible_tiles = vision.vision(15, self.world_map, self.tile)\nvi...
<|body_start_0|> """ Take parameters, and Sprite Constants """ super(BeesSprite, self).__init__(world_map, BeesSprite.IMAGE, GRID_LOCK, BeesSprite.HEALTH_BAR, BeesSprite.AVG_SPEED, BeesSprite.VISION, coordinates) self.type = 'bees' self.prey = ['plant'] <|end_body_0|> <|body_start_1|> ...
BeesSprite
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BeesSprite: def __init__(self, world_map, GRID_LOCK, coordinates=None): """Create a BeesSprite object :param world_map: WorldMap Object :param coordinates: Array of coordinates [x,y] :param GRID_LOCK: Lock for screen (for threading)""" <|body_0|> def move(self, target=None):...
stack_v2_sparse_classes_36k_train_033818
3,276
no_license
[ { "docstring": "Create a BeesSprite object :param world_map: WorldMap Object :param coordinates: Array of coordinates [x,y] :param GRID_LOCK: Lock for screen (for threading)", "name": "__init__", "signature": "def __init__(self, world_map, GRID_LOCK, coordinates=None)" }, { "docstring": "@Overri...
3
stack_v2_sparse_classes_30k_train_019372
Implement the Python class `BeesSprite` described below. Class description: Implement the BeesSprite class. Method signatures and docstrings: - def __init__(self, world_map, GRID_LOCK, coordinates=None): Create a BeesSprite object :param world_map: WorldMap Object :param coordinates: Array of coordinates [x,y] :param...
Implement the Python class `BeesSprite` described below. Class description: Implement the BeesSprite class. Method signatures and docstrings: - def __init__(self, world_map, GRID_LOCK, coordinates=None): Create a BeesSprite object :param world_map: WorldMap Object :param coordinates: Array of coordinates [x,y] :param...
8995bd57ae0faaf7420c74e1a7b2c091c64d6942
<|skeleton|> class BeesSprite: def __init__(self, world_map, GRID_LOCK, coordinates=None): """Create a BeesSprite object :param world_map: WorldMap Object :param coordinates: Array of coordinates [x,y] :param GRID_LOCK: Lock for screen (for threading)""" <|body_0|> def move(self, target=None):...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BeesSprite: def __init__(self, world_map, GRID_LOCK, coordinates=None): """Create a BeesSprite object :param world_map: WorldMap Object :param coordinates: Array of coordinates [x,y] :param GRID_LOCK: Lock for screen (for threading)""" """ Take parameters, and Sprite Constants """ supe...
the_stack_v2_python_sparse
sprites/sprite___bees.py
EcoSimulator/EcoSim2.0
train
0
c4fe998291186c383b796494c24d8eb0f77027fa
[ "super(SpectralNormConv2D, self).__init__()\nself.filters = filters\nself.kernel_size = kernel_size\nself.stride = stride\nself.padding = padding.upper()\nself.iteration = iteration\nself.scope = scope", "with tf.variable_scope(self.scope):\n w = tf.get_variable('kernel', shape=[self.kernel_size, self.kernel_s...
<|body_start_0|> super(SpectralNormConv2D, self).__init__() self.filters = filters self.kernel_size = kernel_size self.stride = stride self.padding = padding.upper() self.iteration = iteration self.scope = scope <|end_body_0|> <|body_start_1|> with tf.var...
SpectralNormConv2D
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpectralNormConv2D: def __init__(self, filters, kernel_size=3, stride=1, padding='same', iteration=1, scope='sn_conv'): """Convolutional layer containing a wrapper to the spectral_norm() operation. Args: filters (int): number of filters kernel_size (int): kernel size for the convolutiona...
stack_v2_sparse_classes_36k_train_033819
5,370
permissive
[ { "docstring": "Convolutional layer containing a wrapper to the spectral_norm() operation. Args: filters (int): number of filters kernel_size (int): kernel size for the convolutional layer stride (int): stride for the convolutional layer padding (str): padding to apply to the convolved tensor iteration (int): p...
2
null
Implement the Python class `SpectralNormConv2D` described below. Class description: Implement the SpectralNormConv2D class. Method signatures and docstrings: - def __init__(self, filters, kernel_size=3, stride=1, padding='same', iteration=1, scope='sn_conv'): Convolutional layer containing a wrapper to the spectral_n...
Implement the Python class `SpectralNormConv2D` described below. Class description: Implement the SpectralNormConv2D class. Method signatures and docstrings: - def __init__(self, filters, kernel_size=3, stride=1, padding='same', iteration=1, scope='sn_conv'): Convolutional layer containing a wrapper to the spectral_n...
fc05d70d411d20147075392c14fced274c1bf6ee
<|skeleton|> class SpectralNormConv2D: def __init__(self, filters, kernel_size=3, stride=1, padding='same', iteration=1, scope='sn_conv'): """Convolutional layer containing a wrapper to the spectral_norm() operation. Args: filters (int): number of filters kernel_size (int): kernel size for the convolutiona...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SpectralNormConv2D: def __init__(self, filters, kernel_size=3, stride=1, padding='same', iteration=1, scope='sn_conv'): """Convolutional layer containing a wrapper to the spectral_norm() operation. Args: filters (int): number of filters kernel_size (int): kernel size for the convolutional layer stride...
the_stack_v2_python_sparse
idas/losses/models/layers/spectral_norm.py
gvalvano/multiscale-adversarial-attention-gates
train
40
cfb6f615097ca851c2d08b06acc6f8d9b1df136e
[ "super().__init__()\n\ndef discriminator_block(in_filters, out_filters, bn=True):\n block = [torch.nn.Conv2d(in_filters, out_filters, 3, 2, 1), torch.nn.LeakyReLU(0.2, inplace=True), torch.nn.Dropout2d(0.25)]\n if bn:\n block.append(torch.nn.BatchNorm2d(out_filters, 0.8))\n return block\nself.model ...
<|body_start_0|> super().__init__() def discriminator_block(in_filters, out_filters, bn=True): block = [torch.nn.Conv2d(in_filters, out_filters, 3, 2, 1), torch.nn.LeakyReLU(0.2, inplace=True), torch.nn.Dropout2d(0.25)] if bn: block.append(torch.nn.BatchNorm2d(ou...
A convolutional discriminator model
Discriminator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Discriminator: """A convolutional discriminator model""" def __init__(self, num_channels, img_size): """Parameters ---------- num_channels : int number of input channels img_size : int size of input images""" <|body_0|> def forward(self, img): """Forwards an imag...
stack_v2_sparse_classes_36k_train_033820
3,368
permissive
[ { "docstring": "Parameters ---------- num_channels : int number of input channels img_size : int size of input images", "name": "__init__", "signature": "def __init__(self, num_channels, img_size)" }, { "docstring": "Forwards an image batch through the discriminator network Parameters ----------...
2
stack_v2_sparse_classes_30k_train_001668
Implement the Python class `Discriminator` described below. Class description: A convolutional discriminator model Method signatures and docstrings: - def __init__(self, num_channels, img_size): Parameters ---------- num_channels : int number of input channels img_size : int size of input images - def forward(self, i...
Implement the Python class `Discriminator` described below. Class description: A convolutional discriminator model Method signatures and docstrings: - def __init__(self, num_channels, img_size): Parameters ---------- num_channels : int number of input channels img_size : int size of input images - def forward(self, i...
1078f5030b8aac2bf022daf5fa14d66f74c3c893
<|skeleton|> class Discriminator: """A convolutional discriminator model""" def __init__(self, num_channels, img_size): """Parameters ---------- num_channels : int number of input channels img_size : int size of input images""" <|body_0|> def forward(self, img): """Forwards an imag...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Discriminator: """A convolutional discriminator model""" def __init__(self, num_channels, img_size): """Parameters ---------- num_channels : int number of input channels img_size : int size of input images""" super().__init__() def discriminator_block(in_filters, out_filters, bn=...
the_stack_v2_python_sparse
dlutils/models/gans/dragan/models.py
justusschock/dl-utils
train
15
bac4db69a0f7a82e0e142a7c49319c49344a5886
[ "me = request.me\npk = request.data.get('id')\ntry:\n pk = int(pk)\nexcept:\n return self.error(errorcode.MSG_INVALID_DATA, errorcode.INVALID_DATA)\narticle = Article.objects.filter(pk=pk, is_deleted=False).first()\nif article is None:\n return self.error(errorcode.MSG_NO_DATA, errorcode.NO_DATA)\nif artic...
<|body_start_0|> me = request.me pk = request.data.get('id') try: pk = int(pk) except: return self.error(errorcode.MSG_INVALID_DATA, errorcode.INVALID_DATA) article = Article.objects.filter(pk=pk, is_deleted=False).first() if article is None: ...
DraftView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DraftView: def post(self, request): """发表草稿,不需要内容数据,节省资源""" <|body_0|> def get(self, request): """查看本人的所有草稿,可分页""" <|body_1|> <|end_skeleton|> <|body_start_0|> me = request.me pk = request.data.get('id') try: pk = int(pk)...
stack_v2_sparse_classes_36k_train_033821
8,733
no_license
[ { "docstring": "发表草稿,不需要内容数据,节省资源", "name": "post", "signature": "def post(self, request)" }, { "docstring": "查看本人的所有草稿,可分页", "name": "get", "signature": "def get(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_009170
Implement the Python class `DraftView` described below. Class description: Implement the DraftView class. Method signatures and docstrings: - def post(self, request): 发表草稿,不需要内容数据,节省资源 - def get(self, request): 查看本人的所有草稿,可分页
Implement the Python class `DraftView` described below. Class description: Implement the DraftView class. Method signatures and docstrings: - def post(self, request): 发表草稿,不需要内容数据,节省资源 - def get(self, request): 查看本人的所有草稿,可分页 <|skeleton|> class DraftView: def post(self, request): """发表草稿,不需要内容数据,节省资源""" ...
6a68fb207f43e5ed65299cc08535b35d5e934ead
<|skeleton|> class DraftView: def post(self, request): """发表草稿,不需要内容数据,节省资源""" <|body_0|> def get(self, request): """查看本人的所有草稿,可分页""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DraftView: def post(self, request): """发表草稿,不需要内容数据,节省资源""" me = request.me pk = request.data.get('id') try: pk = int(pk) except: return self.error(errorcode.MSG_INVALID_DATA, errorcode.INVALID_DATA) article = Article.objects.filter(pk=pk...
the_stack_v2_python_sparse
apps/articles_v2/views.py
Slowhalfframe/fanyijiang-API
train
0
c636b1f38a35c107404544795fdf3f7e9bd04bf3
[ "super()._build(name=name)\nself.mjcf_model.asset.add('texture', type='skybox', builtin='gradient', rgb1=(0.4, 0.6, 0.8), rgb2=(0.0, 0.0, 0.0), width=100, height=100)\ngroundplane_texture = self.mjcf_model.asset.add('texture', name='groundplane', type='2d', builtin='checker', rgb1=(0.2, 0.3, 0.4), rgb2=(0.1, 0.2, 0...
<|body_start_0|> super()._build(name=name) self.mjcf_model.asset.add('texture', type='skybox', builtin='gradient', rgb1=(0.4, 0.6, 0.8), rgb2=(0.0, 0.0, 0.0), width=100, height=100) groundplane_texture = self.mjcf_model.asset.add('texture', name='groundplane', type='2d', builtin='checker', rgb1=...
Suite-specific subclass of the standard Composer arena.
Standard
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Standard: """Suite-specific subclass of the standard Composer arena.""" def _build(self, name=None): """Initializes this arena. Args: name: (optional) A string, the name of this arena. If `None`, use the model name defined in the MJCF file.""" <|body_0|> def attach_offse...
stack_v2_sparse_classes_36k_train_033822
2,993
permissive
[ { "docstring": "Initializes this arena. Args: name: (optional) A string, the name of this arena. If `None`, use the model name defined in the MJCF file.", "name": "_build", "signature": "def _build(self, name=None)" }, { "docstring": "Attaches another entity at a position offset from the attachm...
2
null
Implement the Python class `Standard` described below. Class description: Suite-specific subclass of the standard Composer arena. Method signatures and docstrings: - def _build(self, name=None): Initializes this arena. Args: name: (optional) A string, the name of this arena. If `None`, use the model name defined in t...
Implement the Python class `Standard` described below. Class description: Suite-specific subclass of the standard Composer arena. Method signatures and docstrings: - def _build(self, name=None): Initializes this arena. Args: name: (optional) A string, the name of this arena. If `None`, use the model name defined in t...
d6f9cb4e4a616d1e1d3bd8944bc89541434f1d49
<|skeleton|> class Standard: """Suite-specific subclass of the standard Composer arena.""" def _build(self, name=None): """Initializes this arena. Args: name: (optional) A string, the name of this arena. If `None`, use the model name defined in the MJCF file.""" <|body_0|> def attach_offse...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Standard: """Suite-specific subclass of the standard Composer arena.""" def _build(self, name=None): """Initializes this arena. Args: name: (optional) A string, the name of this arena. If `None`, use the model name defined in the MJCF file.""" super()._build(name=name) self.mjcf_m...
the_stack_v2_python_sparse
dm_control/manipulation/shared/arenas.py
wangsd01/dm_control
train
0
9e6c6379570de71c3fccbd75b680222c6089e555
[ "from collections import defaultdict\ngraph = defaultdict(list)\nfor to_learn, pre in prerequisites:\n graph[pre].append(to_learn)\nvisited = set()\nbeing_visited = set()\n\ndef dfs(pre):\n if pre in being_visited:\n return False\n if pre in visited:\n return True\n visited.add(pre)\n b...
<|body_start_0|> from collections import defaultdict graph = defaultdict(list) for to_learn, pre in prerequisites: graph[pre].append(to_learn) visited = set() being_visited = set() def dfs(pre): if pre in being_visited: return Fals...
拓扑排序 判断图中是否有环 解法:广度优先搜索/深度优先搜索
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """拓扑排序 判断图中是否有环 解法:广度优先搜索/深度优先搜索""" def canFinish0(self, numCourses, prerequisites): """DFS版本 :type numCourses: int :type prerequisites: List[List[int]] :rtype: bool""" <|body_0|> def canFinish(self, numCourses, prerequisites): """BFS版本 :type numCourse...
stack_v2_sparse_classes_36k_train_033823
2,538
no_license
[ { "docstring": "DFS版本 :type numCourses: int :type prerequisites: List[List[int]] :rtype: bool", "name": "canFinish0", "signature": "def canFinish0(self, numCourses, prerequisites)" }, { "docstring": "BFS版本 :type numCourses: int :type prerequisites: List[List[int]] :rtype: bool", "name": "can...
2
null
Implement the Python class `Solution` described below. Class description: 拓扑排序 判断图中是否有环 解法:广度优先搜索/深度优先搜索 Method signatures and docstrings: - def canFinish0(self, numCourses, prerequisites): DFS版本 :type numCourses: int :type prerequisites: List[List[int]] :rtype: bool - def canFinish(self, numCourses, prerequisites): ...
Implement the Python class `Solution` described below. Class description: 拓扑排序 判断图中是否有环 解法:广度优先搜索/深度优先搜索 Method signatures and docstrings: - def canFinish0(self, numCourses, prerequisites): DFS版本 :type numCourses: int :type prerequisites: List[List[int]] :rtype: bool - def canFinish(self, numCourses, prerequisites): ...
6e18c5d257840489cc3fb1079ae3804c743982a4
<|skeleton|> class Solution: """拓扑排序 判断图中是否有环 解法:广度优先搜索/深度优先搜索""" def canFinish0(self, numCourses, prerequisites): """DFS版本 :type numCourses: int :type prerequisites: List[List[int]] :rtype: bool""" <|body_0|> def canFinish(self, numCourses, prerequisites): """BFS版本 :type numCourse...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """拓扑排序 判断图中是否有环 解法:广度优先搜索/深度优先搜索""" def canFinish0(self, numCourses, prerequisites): """DFS版本 :type numCourses: int :type prerequisites: List[List[int]] :rtype: bool""" from collections import defaultdict graph = defaultdict(list) for to_learn, pre in prerequisi...
the_stack_v2_python_sparse
207.课程表.py
yangyuxiang1996/leetcode
train
0
c0e627cd8df6c2bad3834721d80edaeb05d2348d
[ "super().__init__(self.PROBLEM_NAME)\nself.input_characters_matrix = input_characters_matrix\nself.dictionary = dictionary", "print('Solving {} problem ...'.format(self.PROBLEM_NAME))\ngraph = self.create_graph()\ncharacters_list = self.get_characters_list()\nvertices = graph.get_vertices()\nvisited = [False] * l...
<|body_start_0|> super().__init__(self.PROBLEM_NAME) self.input_characters_matrix = input_characters_matrix self.dictionary = dictionary <|end_body_0|> <|body_start_1|> print('Solving {} problem ...'.format(self.PROBLEM_NAME)) graph = self.create_graph() characters_list ...
FindWordsInABoardOfCharacters
FindWordsInABoardOfCharacters
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FindWordsInABoardOfCharacters: """FindWordsInABoardOfCharacters""" def __init__(self, input_characters_matrix, dictionary): """Find all possible words in a board of characters (Boggle) Args: input_characters_matrix: Characters matrix dictionary: dictionary of words Returns: None Rais...
stack_v2_sparse_classes_36k_train_033824
5,246
no_license
[ { "docstring": "Find all possible words in a board of characters (Boggle) Args: input_characters_matrix: Characters matrix dictionary: dictionary of words Returns: None Raises: None", "name": "__init__", "signature": "def __init__(self, input_characters_matrix, dictionary)" }, { "docstring": "So...
6
stack_v2_sparse_classes_30k_train_003720
Implement the Python class `FindWordsInABoardOfCharacters` described below. Class description: FindWordsInABoardOfCharacters Method signatures and docstrings: - def __init__(self, input_characters_matrix, dictionary): Find all possible words in a board of characters (Boggle) Args: input_characters_matrix: Characters ...
Implement the Python class `FindWordsInABoardOfCharacters` described below. Class description: FindWordsInABoardOfCharacters Method signatures and docstrings: - def __init__(self, input_characters_matrix, dictionary): Find all possible words in a board of characters (Boggle) Args: input_characters_matrix: Characters ...
11f4d25cb211740514c119a60962d075a0817abd
<|skeleton|> class FindWordsInABoardOfCharacters: """FindWordsInABoardOfCharacters""" def __init__(self, input_characters_matrix, dictionary): """Find all possible words in a board of characters (Boggle) Args: input_characters_matrix: Characters matrix dictionary: dictionary of words Returns: None Rais...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FindWordsInABoardOfCharacters: """FindWordsInABoardOfCharacters""" def __init__(self, input_characters_matrix, dictionary): """Find all possible words in a board of characters (Boggle) Args: input_characters_matrix: Characters matrix dictionary: dictionary of words Returns: None Raises: None""" ...
the_stack_v2_python_sparse
python/problems/graphs/find_words_in_a_character_board.py
santhosh-kumar/AlgorithmsAndDataStructures
train
2
5021d22bfcfdb51e870b93a8c3f18013bd4db3ff
[ "def recursion(n):\n if n == 0:\n return 0\n if n == 1:\n return 1\n return recursion(n - 1) + recursion(n - 2)\nreturn recursion(n)", "a, b = (0, 1)\nfor i in range(n):\n a, b = (b, a + b)\nreturn a" ]
<|body_start_0|> def recursion(n): if n == 0: return 0 if n == 1: return 1 return recursion(n - 1) + recursion(n - 2) return recursion(n) <|end_body_0|> <|body_start_1|> a, b = (0, 1) for i in range(n): a, b...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def fibonacci1(self, n): """:type n:int :rtype:int""" <|body_0|> def fibonacci2(self, n): """:type n:int :rtype:int""" <|body_1|> <|end_skeleton|> <|body_start_0|> def recursion(n): if n == 0: return 0 ...
stack_v2_sparse_classes_36k_train_033825
513
no_license
[ { "docstring": ":type n:int :rtype:int", "name": "fibonacci1", "signature": "def fibonacci1(self, n)" }, { "docstring": ":type n:int :rtype:int", "name": "fibonacci2", "signature": "def fibonacci2(self, n)" } ]
2
stack_v2_sparse_classes_30k_train_015748
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fibonacci1(self, n): :type n:int :rtype:int - def fibonacci2(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 fibonacci1(self, n): :type n:int :rtype:int - def fibonacci2(self, n): :type n:int :rtype:int <|skeleton|> class Solution: def fibonacci1(self, n): """:type n:i...
42a15943394ae533dcd0d5bbf52e4366ab0756ab
<|skeleton|> class Solution: def fibonacci1(self, n): """:type n:int :rtype:int""" <|body_0|> def fibonacci2(self, n): """:type n:int :rtype:int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def fibonacci1(self, n): """:type n:int :rtype:int""" def recursion(n): if n == 0: return 0 if n == 1: return 1 return recursion(n - 1) + recursion(n - 2) return recursion(n) def fibonacci2(self, n): ...
the_stack_v2_python_sparse
test10.py
nihao-hit/jianzhiOffer
train
0
7e46e88f389e11a52353de84c5962d892d27558a
[ "x = chainer.Variable(np.random.normal(size=16))\nn = 3\nys = AdaLossBranch(n_branch=3).apply((x,))\nfor i in range(n):\n self.assertTrue(np.allclose(x.array, ys[i].array))", "x = chainer.Variable(np.random.normal(size=16).astype(np.float16))\nn = 3\nys = AdaLossBranch(n_branch=3).apply((x,))\nfor i in range(n...
<|body_start_0|> x = chainer.Variable(np.random.normal(size=16)) n = 3 ys = AdaLossBranch(n_branch=3).apply((x,)) for i in range(n): self.assertTrue(np.allclose(x.array, ys[i].array)) <|end_body_0|> <|body_start_1|> x = chainer.Variable(np.random.normal(size=16).asty...
Check the result from ada_loss_branch
AdaLossBranchTest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdaLossBranchTest: """Check the result from ada_loss_branch""" def test_forward(self): """forward should act as normal""" <|body_0|> def test_backward(self): """Check whether rescaling works properly""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_033826
2,064
permissive
[ { "docstring": "forward should act as normal", "name": "test_forward", "signature": "def test_forward(self)" }, { "docstring": "Check whether rescaling works properly", "name": "test_backward", "signature": "def test_backward(self)" } ]
2
stack_v2_sparse_classes_30k_train_009825
Implement the Python class `AdaLossBranchTest` described below. Class description: Check the result from ada_loss_branch Method signatures and docstrings: - def test_forward(self): forward should act as normal - def test_backward(self): Check whether rescaling works properly
Implement the Python class `AdaLossBranchTest` described below. Class description: Check the result from ada_loss_branch Method signatures and docstrings: - def test_forward(self): forward should act as normal - def test_backward(self): Check whether rescaling works properly <|skeleton|> class AdaLossBranchTest: ...
0ca435433b9953e33656173c4d60ebd61c5c5e87
<|skeleton|> class AdaLossBranchTest: """Check the result from ada_loss_branch""" def test_forward(self): """forward should act as normal""" <|body_0|> def test_backward(self): """Check whether rescaling works properly""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdaLossBranchTest: """Check the result from ada_loss_branch""" def test_forward(self): """forward should act as normal""" x = chainer.Variable(np.random.normal(size=16)) n = 3 ys = AdaLossBranch(n_branch=3).apply((x,)) for i in range(n): self.assertTrue...
the_stack_v2_python_sparse
ada_loss/chainer_impl/functions/ada_loss_branch_test.py
MetaVai/gradient-scaling
train
0
9481c50268e1d8e996d07bd0f7415f29761d861c
[ "self.entity_description = description\nself.pushbullet = pb\nself._attr_name = f'Pushbullet {description.key}'", "try:\n self._attr_native_value = self.pushbullet.data[self.entity_description.key]\n self._attr_extra_state_attributes = self.pushbullet.data\nexcept (KeyError, TypeError):\n pass" ]
<|body_start_0|> self.entity_description = description self.pushbullet = pb self._attr_name = f'Pushbullet {description.key}' <|end_body_0|> <|body_start_1|> try: self._attr_native_value = self.pushbullet.data[self.entity_description.key] self._attr_extra_state_a...
Representation of a Pushbullet Sensor.
PushBulletNotificationSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PushBulletNotificationSensor: """Representation of a Pushbullet Sensor.""" def __init__(self, pb, description: SensorEntityDescription): """Initialize the Pushbullet sensor.""" <|body_0|> def update(self): """Fetch the latest data from the sensor. This will fetch...
stack_v2_sparse_classes_36k_train_033827
4,378
permissive
[ { "docstring": "Initialize the Pushbullet sensor.", "name": "__init__", "signature": "def __init__(self, pb, description: SensorEntityDescription)" }, { "docstring": "Fetch the latest data from the sensor. This will fetch the 'sensor reading' into self._state but also all attributes into self._s...
2
stack_v2_sparse_classes_30k_train_012344
Implement the Python class `PushBulletNotificationSensor` described below. Class description: Representation of a Pushbullet Sensor. Method signatures and docstrings: - def __init__(self, pb, description: SensorEntityDescription): Initialize the Pushbullet sensor. - def update(self): Fetch the latest data from the se...
Implement the Python class `PushBulletNotificationSensor` described below. Class description: Representation of a Pushbullet Sensor. Method signatures and docstrings: - def __init__(self, pb, description: SensorEntityDescription): Initialize the Pushbullet sensor. - def update(self): Fetch the latest data from the se...
8de7966104911bca6f855a1755a6d71a07afb9de
<|skeleton|> class PushBulletNotificationSensor: """Representation of a Pushbullet Sensor.""" def __init__(self, pb, description: SensorEntityDescription): """Initialize the Pushbullet sensor.""" <|body_0|> def update(self): """Fetch the latest data from the sensor. This will fetch...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PushBulletNotificationSensor: """Representation of a Pushbullet Sensor.""" def __init__(self, pb, description: SensorEntityDescription): """Initialize the Pushbullet sensor.""" self.entity_description = description self.pushbullet = pb self._attr_name = f'Pushbullet {descr...
the_stack_v2_python_sparse
homeassistant/components/pushbullet/sensor.py
AlexxIT/home-assistant
train
9
22b55acd19baa319e9b3cedb43beb5b0107ca2c2
[ "if isinstance(logvol, volumes.LogicalVolume):\n logvol = logvol.name\nassert volumes.get(logvol), 'No such logical volume: %s' % logvol\nif not world_pv:\n world_pv = placements.store[0].name\nself.__dict__ = dict(name=name, hcname=hcname, logvol=logvol, world_pv=world_pv)\nstore.append(self)\nreturn", "re...
<|body_start_0|> if isinstance(logvol, volumes.LogicalVolume): logvol = logvol.name assert volumes.get(logvol), 'No such logical volume: %s' % logvol if not world_pv: world_pv = placements.store[0].name self.__dict__ = dict(name=name, hcname=hcname, logvol=logvol,...
SensitiveDetector
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SensitiveDetector: def __init__(self, name, hcname, logvol, world_pv=None): """Describe a sensitive detector associated with the named hitcollection and logical volume. If world_pv is None it is assumed to be the first one in placements.store.""" <|body_0|> def touchables(se...
stack_v2_sparse_classes_36k_train_033828
1,535
no_license
[ { "docstring": "Describe a sensitive detector associated with the named hitcollection and logical volume. If world_pv is None it is assumed to be the first one in placements.store.", "name": "__init__", "signature": "def __init__(self, name, hcname, logvol, world_pv=None)" }, { "docstring": "Ret...
3
stack_v2_sparse_classes_30k_train_019581
Implement the Python class `SensitiveDetector` described below. Class description: Implement the SensitiveDetector class. Method signatures and docstrings: - def __init__(self, name, hcname, logvol, world_pv=None): Describe a sensitive detector associated with the named hitcollection and logical volume. If world_pv i...
Implement the Python class `SensitiveDetector` described below. Class description: Implement the SensitiveDetector class. Method signatures and docstrings: - def __init__(self, name, hcname, logvol, world_pv=None): Describe a sensitive detector associated with the named hitcollection and logical volume. If world_pv i...
1ceca86383f4f774d56c3f159658518242875bc6
<|skeleton|> class SensitiveDetector: def __init__(self, name, hcname, logvol, world_pv=None): """Describe a sensitive detector associated with the named hitcollection and logical volume. If world_pv is None it is assumed to be the first one in placements.store.""" <|body_0|> def touchables(se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SensitiveDetector: def __init__(self, name, hcname, logvol, world_pv=None): """Describe a sensitive detector associated with the named hitcollection and logical volume. If world_pv is None it is assumed to be the first one in placements.store.""" if isinstance(logvol, volumes.LogicalVolume): ...
the_stack_v2_python_sparse
python/cowbells/geom/sensitive.py
brettviren/cowbells
train
0
46387d7f47da692898cc02ef9a31660e46dc86dc
[ "device = get_object_or_404(Device, slug=slug)\nself.check_object_permissions(request, device)\nserializer = DeviceProfileSerializer(device, many=False)\nreturn Response(data=serializer.data, status=status.HTTP_200_OK)", "device = get_object_or_404(Device, slug=slug)\nself.check_object_permissions(request, device...
<|body_start_0|> device = get_object_or_404(Device, slug=slug) self.check_object_permissions(request, device) serializer = DeviceProfileSerializer(device, many=False) return Response(data=serializer.data, status=status.HTTP_200_OK) <|end_body_0|> <|body_start_1|> device = get_ob...
DeviceProfileAPIView
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeviceProfileAPIView: def get(self, request, slug=None): """Retrieve""" <|body_0|> def put(self, request, slug=None): """Update""" <|body_1|> <|end_skeleton|> <|body_start_0|> device = get_object_or_404(Device, slug=slug) self.check_object_p...
stack_v2_sparse_classes_36k_train_033829
5,225
permissive
[ { "docstring": "Retrieve", "name": "get", "signature": "def get(self, request, slug=None)" }, { "docstring": "Update", "name": "put", "signature": "def put(self, request, slug=None)" } ]
2
stack_v2_sparse_classes_30k_train_017114
Implement the Python class `DeviceProfileAPIView` described below. Class description: Implement the DeviceProfileAPIView class. Method signatures and docstrings: - def get(self, request, slug=None): Retrieve - def put(self, request, slug=None): Update
Implement the Python class `DeviceProfileAPIView` described below. Class description: Implement the DeviceProfileAPIView class. Method signatures and docstrings: - def get(self, request, slug=None): Retrieve - def put(self, request, slug=None): Update <|skeleton|> class DeviceProfileAPIView: def get(self, reque...
98e1ff8bab7dda3492e5ff637bf5aafd111c840c
<|skeleton|> class DeviceProfileAPIView: def get(self, request, slug=None): """Retrieve""" <|body_0|> def put(self, request, slug=None): """Update""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DeviceProfileAPIView: def get(self, request, slug=None): """Retrieve""" device = get_object_or_404(Device, slug=slug) self.check_object_permissions(request, device) serializer = DeviceProfileSerializer(device, many=False) return Response(data=serializer.data, status=sta...
the_stack_v2_python_sparse
mikaponics/device/views/resources/device_crud_api_views.py
mikaponics/mikaponics-back
train
4
2a30416e62fcdf4c3a4f01081eb1c874f00701c3
[ "data = {'account_bank': user.account_bank, 'account_number': user.account_number, 'amount': amount, 'narration': 'Jumga Transfer', 'beneficiary_name': user.get_full_name()}\nflutterwave = Flutterwave()\nresponse = flutterwave.create_a_transfer(data)\nif response.status_code == 200:\n response = response.json()\...
<|body_start_0|> data = {'account_bank': user.account_bank, 'account_number': user.account_number, 'amount': amount, 'narration': 'Jumga Transfer', 'beneficiary_name': user.get_full_name()} flutterwave = Flutterwave() response = flutterwave.create_a_transfer(data) if response.status_code...
Order Service module
OrderServices
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrderServices: """Order Service module""" def transfer_to_user(user, amount): """Transfer to a Jumga User""" <|body_0|> def process_transaction_for_each_product_order(self, product_order): """Allocate commissions and transfer""" <|body_1|> def calcul...
stack_v2_sparse_classes_36k_train_033830
2,731
permissive
[ { "docstring": "Transfer to a Jumga User", "name": "transfer_to_user", "signature": "def transfer_to_user(user, amount)" }, { "docstring": "Allocate commissions and transfer", "name": "process_transaction_for_each_product_order", "signature": "def process_transaction_for_each_product_ord...
3
stack_v2_sparse_classes_30k_train_018145
Implement the Python class `OrderServices` described below. Class description: Order Service module Method signatures and docstrings: - def transfer_to_user(user, amount): Transfer to a Jumga User - def process_transaction_for_each_product_order(self, product_order): Allocate commissions and transfer - def calculate_...
Implement the Python class `OrderServices` described below. Class description: Order Service module Method signatures and docstrings: - def transfer_to_user(user, amount): Transfer to a Jumga User - def process_transaction_for_each_product_order(self, product_order): Allocate commissions and transfer - def calculate_...
77b9a8735da11aaf2b21c92ad6750b9e98aae267
<|skeleton|> class OrderServices: """Order Service module""" def transfer_to_user(user, amount): """Transfer to a Jumga User""" <|body_0|> def process_transaction_for_each_product_order(self, product_order): """Allocate commissions and transfer""" <|body_1|> def calcul...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OrderServices: """Order Service module""" def transfer_to_user(user, amount): """Transfer to a Jumga User""" data = {'account_bank': user.account_bank, 'account_number': user.account_number, 'amount': amount, 'narration': 'Jumga Transfer', 'beneficiary_name': user.get_full_name()} ...
the_stack_v2_python_sparse
server/orders/services.py
Taycode/jumga
train
6
c9a27d1bf9d365c225e22d05fc40f45e67024e47
[ "visitQueue = deque([root])\nserializedString = '['\nwhile visitQueue:\n node = visitQueue.pop()\n if node is not None:\n serializedString += str(node.val) + ','\n visitQueue.appendleft(node.left)\n visitQueue.appendleft(node.right)\n else:\n serializedString += 'null,'\n if ...
<|body_start_0|> visitQueue = deque([root]) serializedString = '[' while visitQueue: node = visitQueue.pop() if node is not None: serializedString += str(node.val) + ',' visitQueue.appendleft(node.left) visitQueue.appendleft...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|b...
stack_v2_sparse_classes_36k_train_033831
3,153
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root: TreeNode) -> str" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature"...
2
stack_v2_sparse_classes_30k_train_021308
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data: str) -> TreeNode: Decodes your encoded dat...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data: str) -> TreeNode: Decodes your encoded dat...
da1774fd07b7326e66d9478b3d2619e0499ac2b7
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" visitQueue = deque([root]) serializedString = '[' while visitQueue: node = visitQueue.pop() if node is not None: ...
the_stack_v2_python_sparse
Python3/BinaryTree/SerializeandDeserializeBinaryTree/Naive297.py
daviddwlee84/LeetCode
train
14
a8d80efe8948e933046749e6576d037c80d2ac66
[ "row_num = len(array)\ncol_num = len(array[0])\ni = row_num - 1\nj = 0\nwhile i >= 0 and j <= col_num - 1:\n if target < array[i][j]:\n i -= 1\n elif target > array[i][j]:\n j += 1\n else:\n return True\nreturn False", "row_num = len(array)\ncol_num = len(array[0])\ni = 0\nj = col_nu...
<|body_start_0|> row_num = len(array) col_num = len(array[0]) i = row_num - 1 j = 0 while i >= 0 and j <= col_num - 1: if target < array[i][j]: i -= 1 elif target > array[i][j]: j += 1 else: retur...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def Find(self, target, array): """从左下角开始遍历""" <|body_0|> def Find1(self, target, array): """从右下角开始遍历""" <|body_1|> <|end_skeleton|> <|body_start_0|> row_num = len(array) col_num = len(array[0]) i = row_num - 1 j = 0...
stack_v2_sparse_classes_36k_train_033832
1,202
no_license
[ { "docstring": "从左下角开始遍历", "name": "Find", "signature": "def Find(self, target, array)" }, { "docstring": "从右下角开始遍历", "name": "Find1", "signature": "def Find1(self, target, array)" } ]
2
stack_v2_sparse_classes_30k_train_018119
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def Find(self, target, array): 从左下角开始遍历 - def Find1(self, target, array): 从右下角开始遍历
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def Find(self, target, array): 从左下角开始遍历 - def Find1(self, target, array): 从右下角开始遍历 <|skeleton|> class Solution: def Find(self, target, array): """从左下角开始遍历""" ...
72543bf087b4dc691bb01880ed42fbc782a43f20
<|skeleton|> class Solution: def Find(self, target, array): """从左下角开始遍历""" <|body_0|> def Find1(self, target, array): """从右下角开始遍历""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def Find(self, target, array): """从左下角开始遍历""" row_num = len(array) col_num = len(array[0]) i = row_num - 1 j = 0 while i >= 0 and j <= col_num - 1: if target < array[i][j]: i -= 1 elif target > array[i][j]: ...
the_stack_v2_python_sparse
剑指offer/01-二维数组中的查找.py
kingsvalley/mannuan.github.io
train
0
b42213ff3dbf14aa0a28da07419e8467e99ecd60
[ "Command.__init__(self, device_name, configuration, plugin_manager, logger)\nself.device = self.configuration.get_device(self.device_name)\nif self.device.get('provisioner') is None:\n raise RuntimeError('No provisioner is specified in the config. Cannot perform command.')\nself.provisioner = self.plugin_manager...
<|body_start_0|> Command.__init__(self, device_name, configuration, plugin_manager, logger) self.device = self.configuration.get_device(self.device_name) if self.device.get('provisioner') is None: raise RuntimeError('No provisioner is specified in the config. Cannot perform command.'...
Delete a device from the provisioner.
ProvisionerDeleteCommand
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProvisionerDeleteCommand: """Delete a device from the provisioner.""" def __init__(self, device_name, configuration, plugin_manager, logger=None): """Retrieve dependencies, prepare to perform command.""" <|body_0|> def execute(self): """Execute the command""" ...
stack_v2_sparse_classes_36k_train_033833
1,450
permissive
[ { "docstring": "Retrieve dependencies, prepare to perform command.", "name": "__init__", "signature": "def __init__(self, device_name, configuration, plugin_manager, logger=None)" }, { "docstring": "Execute the command", "name": "execute", "signature": "def execute(self)" } ]
2
stack_v2_sparse_classes_30k_val_000349
Implement the Python class `ProvisionerDeleteCommand` described below. Class description: Delete a device from the provisioner. Method signatures and docstrings: - def __init__(self, device_name, configuration, plugin_manager, logger=None): Retrieve dependencies, prepare to perform command. - def execute(self): Execu...
Implement the Python class `ProvisionerDeleteCommand` described below. Class description: Delete a device from the provisioner. Method signatures and docstrings: - def __init__(self, device_name, configuration, plugin_manager, logger=None): Retrieve dependencies, prepare to perform command. - def execute(self): Execu...
b0c88b877921dda20d0af4dab6497a50600d975d
<|skeleton|> class ProvisionerDeleteCommand: """Delete a device from the provisioner.""" def __init__(self, device_name, configuration, plugin_manager, logger=None): """Retrieve dependencies, prepare to perform command.""" <|body_0|> def execute(self): """Execute the command""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProvisionerDeleteCommand: """Delete a device from the provisioner.""" def __init__(self, device_name, configuration, plugin_manager, logger=None): """Retrieve dependencies, prepare to perform command.""" Command.__init__(self, device_name, configuration, plugin_manager, logger) se...
the_stack_v2_python_sparse
actsys/control/commands/provisioner/provisioner_delete.py
intel-ctrlsys/actsys
train
5
7ae6d231cc49f237a3699ef5c61695ade5bc021c
[ "global device_list_page, admin_page\ndevice_list_page = DeviceListPage(self.driver)\nadmin_page = AdminPage(self.driver)\nadmin_page.into_subsystem('业务管理')\nadmin_page.select_menu('首页/渠道终端管理/设备管理')", "admin_page.select_menu('T设备列表')\ndevice_list_page.simple_query_device(store='房山区')\nassert '房山区' in device_list_...
<|body_start_0|> global device_list_page, admin_page device_list_page = DeviceListPage(self.driver) admin_page = AdminPage(self.driver) admin_page.into_subsystem('业务管理') admin_page.select_menu('首页/渠道终端管理/设备管理') <|end_body_0|> <|body_start_1|> admin_page.select_menu('T设备列...
TestDeviceList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestDeviceList: def set_up(self): """前置操作 :return:""" <|body_0|> def test_query_device_list(self, set_up): """查询设备列表""" <|body_1|> def test_reset_query_device_list(self): """重置查询设备列表""" <|body_2|> def test_click_more_query_device_lis...
stack_v2_sparse_classes_36k_train_033834
2,523
no_license
[ { "docstring": "前置操作 :return:", "name": "set_up", "signature": "def set_up(self)" }, { "docstring": "查询设备列表", "name": "test_query_device_list", "signature": "def test_query_device_list(self, set_up)" }, { "docstring": "重置查询设备列表", "name": "test_reset_query_device_list", "s...
6
stack_v2_sparse_classes_30k_train_004183
Implement the Python class `TestDeviceList` described below. Class description: Implement the TestDeviceList class. Method signatures and docstrings: - def set_up(self): 前置操作 :return: - def test_query_device_list(self, set_up): 查询设备列表 - def test_reset_query_device_list(self): 重置查询设备列表 - def test_click_more_query_devi...
Implement the Python class `TestDeviceList` described below. Class description: Implement the TestDeviceList class. Method signatures and docstrings: - def set_up(self): 前置操作 :return: - def test_query_device_list(self, set_up): 查询设备列表 - def test_reset_query_device_list(self): 重置查询设备列表 - def test_click_more_query_devi...
86d1b085af2d3808ac8472d541f4bf26d26591e0
<|skeleton|> class TestDeviceList: def set_up(self): """前置操作 :return:""" <|body_0|> def test_query_device_list(self, set_up): """查询设备列表""" <|body_1|> def test_reset_query_device_list(self): """重置查询设备列表""" <|body_2|> def test_click_more_query_device_lis...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestDeviceList: def set_up(self): """前置操作 :return:""" global device_list_page, admin_page device_list_page = DeviceListPage(self.driver) admin_page = AdminPage(self.driver) admin_page.into_subsystem('业务管理') admin_page.select_menu('首页/渠道终端管理/设备管理') def test_...
the_stack_v2_python_sparse
src/cases/business_manage/channel_device_manage/device_manage/test_device_list_page_300.py
102244653/SeleniumByPython
train
2
848075a952c30d25e36759c555e45bda1c96b4cd
[ "for exc_path in self.path_exclude:\n if exc_path in fullname:\n return\nfor ori_path, _ in self.path_spec:\n if fullname.startswith(ori_path):\n return importlib.util.spec_from_loader(fullname, self)", "for ori_path, cur_path in self.path_spec:\n if not fullname.startswith(ori_path):\n ...
<|body_start_0|> for exc_path in self.path_exclude: if exc_path in fullname: return for ori_path, _ in self.path_spec: if fullname.startswith(ori_path): return importlib.util.spec_from_loader(fullname, self) <|end_body_0|> <|body_start_1|> ...
ModularNAS Importer class.
ModNASImporter
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModNASImporter: """ModularNAS Importer class.""" def find_spec(self, fullname, path, target=None): """Handle ModularNAS imports.""" <|body_0|> def load_module(self, fullname): """Load ModularNAS module by import path.""" <|body_1|> <|end_skeleton|> <|bo...
stack_v2_sparse_classes_36k_train_033835
2,044
permissive
[ { "docstring": "Handle ModularNAS imports.", "name": "find_spec", "signature": "def find_spec(self, fullname, path, target=None)" }, { "docstring": "Load ModularNAS module by import path.", "name": "load_module", "signature": "def load_module(self, fullname)" } ]
2
null
Implement the Python class `ModNASImporter` described below. Class description: ModularNAS Importer class. Method signatures and docstrings: - def find_spec(self, fullname, path, target=None): Handle ModularNAS imports. - def load_module(self, fullname): Load ModularNAS module by import path.
Implement the Python class `ModNASImporter` described below. Class description: ModularNAS Importer class. Method signatures and docstrings: - def find_spec(self, fullname, path, target=None): Handle ModularNAS imports. - def load_module(self, fullname): Load ModularNAS module by import path. <|skeleton|> class ModN...
12e37a1991eb6771a2999fe0a46ddda920c47948
<|skeleton|> class ModNASImporter: """ModularNAS Importer class.""" def find_spec(self, fullname, path, target=None): """Handle ModularNAS imports.""" <|body_0|> def load_module(self, fullname): """Load ModularNAS module by import path.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ModNASImporter: """ModularNAS Importer class.""" def find_spec(self, fullname, path, target=None): """Handle ModularNAS imports.""" for exc_path in self.path_exclude: if exc_path in fullname: return for ori_path, _ in self.path_spec: if full...
the_stack_v2_python_sparse
vega/algorithms/nas/modnas/compat/importer.py
huawei-noah/vega
train
850
9c879ac91c2692085274e3567788772c03231a63
[ "try:\n triggers = await self.nyuki.storage.triggers.get()\nexcept AutoReconnect:\n return Response(status=503)\nreturn Response(triggers)", "data = await request.post()\ntry:\n form = data['form']\n tid = data['tid']\nexcept KeyError:\n return Response(status=400, body={'error': \"'form' and 'tid'...
<|body_start_0|> try: triggers = await self.nyuki.storage.triggers.get() except AutoReconnect: return Response(status=503) return Response(triggers) <|end_body_0|> <|body_start_1|> data = await request.post() try: form = data['form'] ...
ApiWorkflowTriggers
[ "MIT", "GPL-1.0-or-later", "LicenseRef-scancode-other-copyleft", "GPL-2.0-or-later", "LicenseRef-scancode-unknown-license-reference", "LGPL-2.1-or-later", "GPL-2.0-only", "LicenseRef-scancode-proprietary-license", "LicenseRef-scancode-generic-exception", "Apache-2.0", "LicenseRef-scancode-warran...
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApiWorkflowTriggers: async def get(self, request): """Return the list of all trigger forms""" <|body_0|> async def put(self, request): """Upload a trigger form file""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: triggers = await se...
stack_v2_sparse_classes_36k_train_033836
15,185
permissive
[ { "docstring": "Return the list of all trigger forms", "name": "get", "signature": "async def get(self, request)" }, { "docstring": "Upload a trigger form file", "name": "put", "signature": "async def put(self, request)" } ]
2
null
Implement the Python class `ApiWorkflowTriggers` described below. Class description: Implement the ApiWorkflowTriggers class. Method signatures and docstrings: - async def get(self, request): Return the list of all trigger forms - async def put(self, request): Upload a trigger form file
Implement the Python class `ApiWorkflowTriggers` described below. Class description: Implement the ApiWorkflowTriggers class. Method signatures and docstrings: - async def get(self, request): Return the list of all trigger forms - async def put(self, request): Upload a trigger form file <|skeleton|> class ApiWorkflo...
f185fababee380660930243515652093855acfe7
<|skeleton|> class ApiWorkflowTriggers: async def get(self, request): """Return the list of all trigger forms""" <|body_0|> async def put(self, request): """Upload a trigger form file""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ApiWorkflowTriggers: async def get(self, request): """Return the list of all trigger forms""" try: triggers = await self.nyuki.storage.triggers.get() except AutoReconnect: return Response(status=503) return Response(triggers) async def put(self, req...
the_stack_v2_python_sparse
nyuki/workflow/api/instances.py
d-nery/nyuki
train
0
341d162608288e729940124af1ae357f3ccc90e4
[ "post = Post.query.get_or_404(post_id)\nif g.current_user != post.author:\n return api_abort(403)\nreturn jsonify(post_schema(post))", "post = Post.query.get_or_404(post_id)\nif g.current_user != post.author:\n return api_abort(403)\ndata = request.get_json()\ntitle = data.get('title')\nbody = data.get('bod...
<|body_start_0|> post = Post.query.get_or_404(post_id) if g.current_user != post.author: return api_abort(403) return jsonify(post_schema(post)) <|end_body_0|> <|body_start_1|> post = Post.query.get_or_404(post_id) if g.current_user != post.author: return...
CurrentUserPostAPI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CurrentUserPostAPI: def get(self, post_id): """Get current user post.""" <|body_0|> def put(self, post_id): """Edit item.""" <|body_1|> def patch(self, post_id): """Toggle post can_comment.""" <|body_2|> def delete(self, post_id): ...
stack_v2_sparse_classes_36k_train_033837
7,567
permissive
[ { "docstring": "Get current user post.", "name": "get", "signature": "def get(self, post_id)" }, { "docstring": "Edit item.", "name": "put", "signature": "def put(self, post_id)" }, { "docstring": "Toggle post can_comment.", "name": "patch", "signature": "def patch(self, ...
4
stack_v2_sparse_classes_30k_train_019560
Implement the Python class `CurrentUserPostAPI` described below. Class description: Implement the CurrentUserPostAPI class. Method signatures and docstrings: - def get(self, post_id): Get current user post. - def put(self, post_id): Edit item. - def patch(self, post_id): Toggle post can_comment. - def delete(self, po...
Implement the Python class `CurrentUserPostAPI` described below. Class description: Implement the CurrentUserPostAPI class. Method signatures and docstrings: - def get(self, post_id): Get current user post. - def put(self, post_id): Edit item. - def patch(self, post_id): Toggle post can_comment. - def delete(self, po...
dd5cf5f1ae9df0d2d25e41c113df50b16a8465e7
<|skeleton|> class CurrentUserPostAPI: def get(self, post_id): """Get current user post.""" <|body_0|> def put(self, post_id): """Edit item.""" <|body_1|> def patch(self, post_id): """Toggle post can_comment.""" <|body_2|> def delete(self, post_id): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CurrentUserPostAPI: def get(self, post_id): """Get current user post.""" post = Post.query.get_or_404(post_id) if g.current_user != post.author: return api_abort(403) return jsonify(post_schema(post)) def put(self, post_id): """Edit item.""" pos...
the_stack_v2_python_sparse
awesome_flask_webapp/apis/v1/resources.py
yeh-George/awesome-flask-webapp
train
0
cc639848fefbadf3f664190c4f3bc8978d9bf84a
[ "size, ans = (len(s), 0)\nmemo = [0] * size\nfor i in range(1, size):\n if ')' == s[i] and i - memo[i - 1] > 0 and ('(' == s[i - memo[i - 1] - 1]):\n memo[i] = memo[i - 1] + 2 + (memo[i - memo[i - 1] - 2] if i - memo[i - 1] > 1 else 0)\n ans = max(ans, memo[i])\nreturn ans", "size, ans = (len(s),...
<|body_start_0|> size, ans = (len(s), 0) memo = [0] * size for i in range(1, size): if ')' == s[i] and i - memo[i - 1] > 0 and ('(' == s[i - memo[i - 1] - 1]): memo[i] = memo[i - 1] + 2 + (memo[i - memo[i - 1] - 2] if i - memo[i - 1] > 1 else 0) ans = ...
SolutionLongestValidParentheses
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SolutionLongestValidParentheses: def longestValidParentheses(self, s): """:type s: str :rtype: int""" <|body_0|> def longestValidParentheses1(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> size, ans = (len(s), ...
stack_v2_sparse_classes_36k_train_033838
1,052
no_license
[ { "docstring": ":type s: str :rtype: int", "name": "longestValidParentheses", "signature": "def longestValidParentheses(self, s)" }, { "docstring": ":type s: str :rtype: int", "name": "longestValidParentheses1", "signature": "def longestValidParentheses1(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_018525
Implement the Python class `SolutionLongestValidParentheses` described below. Class description: Implement the SolutionLongestValidParentheses class. Method signatures and docstrings: - def longestValidParentheses(self, s): :type s: str :rtype: int - def longestValidParentheses1(self, s): :type s: str :rtype: int
Implement the Python class `SolutionLongestValidParentheses` described below. Class description: Implement the SolutionLongestValidParentheses class. Method signatures and docstrings: - def longestValidParentheses(self, s): :type s: str :rtype: int - def longestValidParentheses1(self, s): :type s: str :rtype: int <|...
a07d8b3cfd5eadb3c3b2f4383cb8ffc32d52f928
<|skeleton|> class SolutionLongestValidParentheses: def longestValidParentheses(self, s): """:type s: str :rtype: int""" <|body_0|> def longestValidParentheses1(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SolutionLongestValidParentheses: def longestValidParentheses(self, s): """:type s: str :rtype: int""" size, ans = (len(s), 0) memo = [0] * size for i in range(1, size): if ')' == s[i] and i - memo[i - 1] > 0 and ('(' == s[i - memo[i - 1] - 1]): memo[...
the_stack_v2_python_sparse
python/LongestValidParentheses.py
hellocomrade/happycoding
train
5
e974712da7d8f2688ca9b10fc25758deadc6a0dd
[ "self.domain_controller = domain_controller\nself.domain_name = domain_name\nself.name = name\nself.owner_id = owner_id\nself.mtype = mtype\nself.uuid = uuid", "if dictionary is None:\n return None\ndomain_controller = cohesity_management_sdk.models.ad_domain_controller.AdDomainController.from_dictionary(dicti...
<|body_start_0|> self.domain_controller = domain_controller self.domain_name = domain_name self.name = name self.owner_id = owner_id self.mtype = mtype self.uuid = uuid <|end_body_0|> <|body_start_1|> if dictionary is None: return None domain_...
Implementation of the 'AdProtectionSource' model. Specifies an object representing an AD entity. Attributes: domain_controller (AdDomainController): Specifies the domain controller residing in this physical machine. domain_name (string): Specifies the domain name corresponding to the domain controller. name (string): S...
AdProtectionSource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdProtectionSource: """Implementation of the 'AdProtectionSource' model. Specifies an object representing an AD entity. Attributes: domain_controller (AdDomainController): Specifies the domain controller residing in this physical machine. domain_name (string): Specifies the domain name correspond...
stack_v2_sparse_classes_36k_train_033839
3,093
permissive
[ { "docstring": "Constructor for the AdProtectionSource class", "name": "__init__", "signature": "def __init__(self, domain_controller=None, domain_name=None, name=None, owner_id=None, mtype=None, uuid=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary ...
2
null
Implement the Python class `AdProtectionSource` described below. Class description: Implementation of the 'AdProtectionSource' model. Specifies an object representing an AD entity. Attributes: domain_controller (AdDomainController): Specifies the domain controller residing in this physical machine. domain_name (string...
Implement the Python class `AdProtectionSource` described below. Class description: Implementation of the 'AdProtectionSource' model. Specifies an object representing an AD entity. Attributes: domain_controller (AdDomainController): Specifies the domain controller residing in this physical machine. domain_name (string...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class AdProtectionSource: """Implementation of the 'AdProtectionSource' model. Specifies an object representing an AD entity. Attributes: domain_controller (AdDomainController): Specifies the domain controller residing in this physical machine. domain_name (string): Specifies the domain name correspond...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdProtectionSource: """Implementation of the 'AdProtectionSource' model. Specifies an object representing an AD entity. Attributes: domain_controller (AdDomainController): Specifies the domain controller residing in this physical machine. domain_name (string): Specifies the domain name corresponding to the do...
the_stack_v2_python_sparse
cohesity_management_sdk/models/ad_protection_source.py
cohesity/management-sdk-python
train
24
8abdb2b37183e21287ed8dc024c1118c2a931efc
[ "self.id = id\nself.amount = amount\nself.posted_date = posted_date\nself.description = description\nself.memo = memo\nself.normalized_payee = normalized_payee\nself.institution_transaction_id = institution_transaction_id\nself.category = category\nself.mtype = mtype\nself.security_type = security_type\nself.symbol...
<|body_start_0|> self.id = id self.amount = amount self.posted_date = posted_date self.description = description self.memo = memo self.normalized_payee = normalized_payee self.institution_transaction_id = institution_transaction_id self.category = category...
Implementation of the 'VOA Report Transaction' model. TODO: type model description here. Attributes: id (long|int): The Finicity ID of the transaction amount (float): The total amount of the transaction. Transactions for deposits are positive values, withdrawals and debits are negative values. posted_date (long|int): A...
VOAReportTransaction
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VOAReportTransaction: """Implementation of the 'VOA Report Transaction' model. TODO: type model description here. Attributes: id (long|int): The Finicity ID of the transaction amount (float): The total amount of the transaction. Transactions for deposits are positive values, withdrawals and debit...
stack_v2_sparse_classes_36k_train_033840
5,373
permissive
[ { "docstring": "Constructor for the VOAReportTransaction class", "name": "__init__", "signature": "def __init__(self, id=None, amount=None, posted_date=None, description=None, memo=None, normalized_payee=None, institution_transaction_id=None, category=None, mtype=None, security_type=None, symbol=None, c...
2
null
Implement the Python class `VOAReportTransaction` described below. Class description: Implementation of the 'VOA Report Transaction' model. TODO: type model description here. Attributes: id (long|int): The Finicity ID of the transaction amount (float): The total amount of the transaction. Transactions for deposits are...
Implement the Python class `VOAReportTransaction` described below. Class description: Implementation of the 'VOA Report Transaction' model. TODO: type model description here. Attributes: id (long|int): The Finicity ID of the transaction amount (float): The total amount of the transaction. Transactions for deposits are...
b2ab1ded435db75c78d42261f5e4acd2a3061487
<|skeleton|> class VOAReportTransaction: """Implementation of the 'VOA Report Transaction' model. TODO: type model description here. Attributes: id (long|int): The Finicity ID of the transaction amount (float): The total amount of the transaction. Transactions for deposits are positive values, withdrawals and debit...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VOAReportTransaction: """Implementation of the 'VOA Report Transaction' model. TODO: type model description here. Attributes: id (long|int): The Finicity ID of the transaction amount (float): The total amount of the transaction. Transactions for deposits are positive values, withdrawals and debits are negativ...
the_stack_v2_python_sparse
finicityapi/models/voa_report_transaction.py
monarchmoney/finicity-python
train
0
00955885009c7ff8851319c51fd276636c38ecb6
[ "if by == By.ID:\n return ElementSearchCriteria(FindByType.ID, by_value)\nelif by == By.NAME:\n return ElementSearchCriteria(FindByType.NAME, by_value)\nelif by == By.XPATH:\n return ElementSearchCriteria(FindByType.XPATH, by_value)\nelif by == By.CLASS_NAME:\n return ElementSearchCriteria(FindByType.CL...
<|body_start_0|> if by == By.ID: return ElementSearchCriteria(FindByType.ID, by_value) elif by == By.NAME: return ElementSearchCriteria(FindByType.NAME, by_value) elif by == By.XPATH: return ElementSearchCriteria(FindByType.XPATH, by_value) elif by == ...
Contains helper methods for Selenium actions, mostly locator-related
SeleniumHelper
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SeleniumHelper: """Contains helper methods for Selenium actions, mostly locator-related""" def create_search_criteria(by: By, by_value: str): """Translator method to create element search criteria to send to the Agent Args: by (By): The element locator strategy to be used by_value (s...
stack_v2_sparse_classes_36k_train_033841
3,845
permissive
[ { "docstring": "Translator method to create element search criteria to send to the Agent Args: by (By): The element locator strategy to be used by_value (str): The associated element locator strategy value Returns: ElementSearchCriteria: object representing the element search criteria", "name": "create_sear...
2
stack_v2_sparse_classes_30k_train_000481
Implement the Python class `SeleniumHelper` described below. Class description: Contains helper methods for Selenium actions, mostly locator-related Method signatures and docstrings: - def create_search_criteria(by: By, by_value: str): Translator method to create element search criteria to send to the Agent Args: by ...
Implement the Python class `SeleniumHelper` described below. Class description: Contains helper methods for Selenium actions, mostly locator-related Method signatures and docstrings: - def create_search_criteria(by: By, by_value: str): Translator method to create element search criteria to send to the Agent Args: by ...
f6f6baf202598c9d234b3314f8e44fbd10a0f427
<|skeleton|> class SeleniumHelper: """Contains helper methods for Selenium actions, mostly locator-related""" def create_search_criteria(by: By, by_value: str): """Translator method to create element search criteria to send to the Agent Args: by (By): The element locator strategy to be used by_value (s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SeleniumHelper: """Contains helper methods for Selenium actions, mostly locator-related""" def create_search_criteria(by: By, by_value: str): """Translator method to create element search criteria to send to the Agent Args: by (By): The element locator strategy to be used by_value (str): The asso...
the_stack_v2_python_sparse
src/testproject/helpers/seleniumhelper.py
bbornhau/python-opensdk
train
0
4535dab4ec04fcbfbfd98d70dffc5b7a356ec053
[ "self.opts = opts\nself.filelist = filelist\nself.filenum = len(self.filelist)", "for i in range(self.filenum):\n print('Processing: ', self.filelist[i])\n file_path = self.filelist[i]\n input_pc_format = self.opts.input_format\n output_pc_format = self.opts.output_format\n d = self.opts.d\n ass...
<|body_start_0|> self.opts = opts self.filelist = filelist self.filenum = len(self.filelist) <|end_body_0|> <|body_start_1|> for i in range(self.filenum): print('Processing: ', self.filelist[i]) file_path = self.filelist[i] input_pc_format = self.opts...
Voxel_FormatFactory
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Voxel_FormatFactory: def __init__(self, opts, filelist): """:param opts: 超参 :param filelist: 要处理的文件列表""" <|body_0|> def mesh_voxel(self): """转换mesh成3d体素网格 :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.opts = opts self.filelis...
stack_v2_sparse_classes_36k_train_033842
2,529
no_license
[ { "docstring": ":param opts: 超参 :param filelist: 要处理的文件列表", "name": "__init__", "signature": "def __init__(self, opts, filelist)" }, { "docstring": "转换mesh成3d体素网格 :return:", "name": "mesh_voxel", "signature": "def mesh_voxel(self)" } ]
2
stack_v2_sparse_classes_30k_train_006705
Implement the Python class `Voxel_FormatFactory` described below. Class description: Implement the Voxel_FormatFactory class. Method signatures and docstrings: - def __init__(self, opts, filelist): :param opts: 超参 :param filelist: 要处理的文件列表 - def mesh_voxel(self): 转换mesh成3d体素网格 :return:
Implement the Python class `Voxel_FormatFactory` described below. Class description: Implement the Voxel_FormatFactory class. Method signatures and docstrings: - def __init__(self, opts, filelist): :param opts: 超参 :param filelist: 要处理的文件列表 - def mesh_voxel(self): 转换mesh成3d体素网格 :return: <|skeleton|> class Voxel_Forma...
b4de6d3b75908e7ee93a45520f037f4930db1e12
<|skeleton|> class Voxel_FormatFactory: def __init__(self, opts, filelist): """:param opts: 超参 :param filelist: 要处理的文件列表""" <|body_0|> def mesh_voxel(self): """转换mesh成3d体素网格 :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Voxel_FormatFactory: def __init__(self, opts, filelist): """:param opts: 超参 :param filelist: 要处理的文件列表""" self.opts = opts self.filelist = filelist self.filenum = len(self.filelist) def mesh_voxel(self): """转换mesh成3d体素网格 :return:""" for i in range(self.filen...
the_stack_v2_python_sparse
lib/voxel_factory.py
jlqzzz/PointCloudToolBox
train
0
5da5a955ea0d8aed2682e0c365e95db6a8f4baa6
[ "self.times = times\nself.winList = []\nself.playerCount = dict()\nself.winner = -1\nfor p, t in zip(persons, times):\n if self.winner == -1:\n self.winner = p\n self.playerCount[p] = self.playerCount.get(p, 0) + 1\n self.winList.append(self.winner)\n continue\n self.playerCount[p]...
<|body_start_0|> self.times = times self.winList = [] self.playerCount = dict() self.winner = -1 for p, t in zip(persons, times): if self.winner == -1: self.winner = p self.playerCount[p] = self.playerCount.get(p, 0) + 1 ...
TopVotedCandidate
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TopVotedCandidate: def __init__(self, persons, times): """:type persons: List[int] :type times: List[int]""" <|body_0|> def q(self, t): """:type t: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.times = times self.winLi...
stack_v2_sparse_classes_36k_train_033843
3,043
no_license
[ { "docstring": ":type persons: List[int] :type times: List[int]", "name": "__init__", "signature": "def __init__(self, persons, times)" }, { "docstring": ":type t: int :rtype: int", "name": "q", "signature": "def q(self, t)" } ]
2
null
Implement the Python class `TopVotedCandidate` described below. Class description: Implement the TopVotedCandidate class. Method signatures and docstrings: - def __init__(self, persons, times): :type persons: List[int] :type times: List[int] - def q(self, t): :type t: int :rtype: int
Implement the Python class `TopVotedCandidate` described below. Class description: Implement the TopVotedCandidate class. Method signatures and docstrings: - def __init__(self, persons, times): :type persons: List[int] :type times: List[int] - def q(self, t): :type t: int :rtype: int <|skeleton|> class TopVotedCandi...
11c81645893fd65f585c3f558ea837c7dd3cb654
<|skeleton|> class TopVotedCandidate: def __init__(self, persons, times): """:type persons: List[int] :type times: List[int]""" <|body_0|> def q(self, t): """:type t: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TopVotedCandidate: def __init__(self, persons, times): """:type persons: List[int] :type times: List[int]""" self.times = times self.winList = [] self.playerCount = dict() self.winner = -1 for p, t in zip(persons, times): if self.winner == -1: ...
the_stack_v2_python_sparse
LC_Online_Election.py
venkatsvpr/Problems_Solved
train
5
cf322fcb858e9c85a98eff7a9b5748064137bd0e
[ "nums_len = len(nums)\nif not nums or nums_len < 2:\n return 0\nend = 0\nstart = nums_len - 1\niter_range = range(nums_len - 1)\nfor i in iter_range:\n if nums[i + 1] < nums[i]:\n end = i + 1\n start = min(i, start)\n self.swap(nums, i, i + 1)\nfor i in reversed(iter_range):\n if nums[...
<|body_start_0|> nums_len = len(nums) if not nums or nums_len < 2: return 0 end = 0 start = nums_len - 1 iter_range = range(nums_len - 1) for i in iter_range: if nums[i + 1] < nums[i]: end = i + 1 start = min(i, star...
给定一个数组,如:[2, 6, 4, 8, 10, 9, 15], 找出这个数组的最短子数组,当这个子数组排好序后,整个数组变为有序。 这里的子数组为:[6, 4, 8, 10, 9] 输出这个子数组的长度 https://leetcode.com/problems/shortest-unsorted-continuous-subarray/
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """给定一个数组,如:[2, 6, 4, 8, 10, 9, 15], 找出这个数组的最短子数组,当这个子数组排好序后,整个数组变为有序。 这里的子数组为:[6, 4, 8, 10, 9] 输出这个子数组的长度 https://leetcode.com/problems/shortest-unsorted-continuous-subarray/""" def findUnsortedSubarray(self, nums): """:param nums:List[int] :return:int""" <|body_0|...
stack_v2_sparse_classes_36k_train_033844
1,271
no_license
[ { "docstring": ":param nums:List[int] :return:int", "name": "findUnsortedSubarray", "signature": "def findUnsortedSubarray(self, nums)" }, { "docstring": ":param nums: List[int] :param a: int :param b: int :return: void", "name": "swap", "signature": "def swap(self, nums, a, b)" } ]
2
stack_v2_sparse_classes_30k_train_019801
Implement the Python class `Solution` described below. Class description: 给定一个数组,如:[2, 6, 4, 8, 10, 9, 15], 找出这个数组的最短子数组,当这个子数组排好序后,整个数组变为有序。 这里的子数组为:[6, 4, 8, 10, 9] 输出这个子数组的长度 https://leetcode.com/problems/shortest-unsorted-continuous-subarray/ Method signatures and docstrings: - def findUnsortedSubarray(self, nums...
Implement the Python class `Solution` described below. Class description: 给定一个数组,如:[2, 6, 4, 8, 10, 9, 15], 找出这个数组的最短子数组,当这个子数组排好序后,整个数组变为有序。 这里的子数组为:[6, 4, 8, 10, 9] 输出这个子数组的长度 https://leetcode.com/problems/shortest-unsorted-continuous-subarray/ Method signatures and docstrings: - def findUnsortedSubarray(self, nums...
077cbd25d480c21ac994f7b33e897e9f392ea032
<|skeleton|> class Solution: """给定一个数组,如:[2, 6, 4, 8, 10, 9, 15], 找出这个数组的最短子数组,当这个子数组排好序后,整个数组变为有序。 这里的子数组为:[6, 4, 8, 10, 9] 输出这个子数组的长度 https://leetcode.com/problems/shortest-unsorted-continuous-subarray/""" def findUnsortedSubarray(self, nums): """:param nums:List[int] :return:int""" <|body_0|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """给定一个数组,如:[2, 6, 4, 8, 10, 9, 15], 找出这个数组的最短子数组,当这个子数组排好序后,整个数组变为有序。 这里的子数组为:[6, 4, 8, 10, 9] 输出这个子数组的长度 https://leetcode.com/problems/shortest-unsorted-continuous-subarray/""" def findUnsortedSubarray(self, nums): """:param nums:List[int] :return:int""" nums_len = len(nums) ...
the_stack_v2_python_sparse
leetcode/ContinuousSubarray.py
Mryangtaofang/pyleetcode
train
0
fd8e2a7a758f8308cefd394c7ef1a3d62a97fc29
[ "regex = InvenTree.helpers.str2bool(request.query_params.get('search_regex', False))\nsearch_fields = super().get_search_fields(view, request)\nfields = []\nif search_fields:\n for field in search_fields:\n if regex:\n field = '$' + field\n fields.append(field)\nreturn fields", "whole ...
<|body_start_0|> regex = InvenTree.helpers.str2bool(request.query_params.get('search_regex', False)) search_fields = super().get_search_fields(view, request) fields = [] if search_fields: for field in search_fields: if regex: field = '$' + ...
Custom search filter which allows adjusting of search terms dynamically
InvenTreeSearchFilter
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InvenTreeSearchFilter: """Custom search filter which allows adjusting of search terms dynamically""" def get_search_fields(self, view, request): """Return a set of search fields for the request, adjusted based on request params. The following query params are available to 'augment' t...
stack_v2_sparse_classes_36k_train_033845
4,204
permissive
[ { "docstring": "Return a set of search fields for the request, adjusted based on request params. The following query params are available to 'augment' the search (in decreasing order of priority) - search_regex: If True, search is performed on 'regex' comparison", "name": "get_search_fields", "signature...
2
null
Implement the Python class `InvenTreeSearchFilter` described below. Class description: Custom search filter which allows adjusting of search terms dynamically Method signatures and docstrings: - def get_search_fields(self, view, request): Return a set of search fields for the request, adjusted based on request params...
Implement the Python class `InvenTreeSearchFilter` described below. Class description: Custom search filter which allows adjusting of search terms dynamically Method signatures and docstrings: - def get_search_fields(self, view, request): Return a set of search fields for the request, adjusted based on request params...
e88a8e99a5f0b201c67a95cba097c729f090d5e2
<|skeleton|> class InvenTreeSearchFilter: """Custom search filter which allows adjusting of search terms dynamically""" def get_search_fields(self, view, request): """Return a set of search fields for the request, adjusted based on request params. The following query params are available to 'augment' t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InvenTreeSearchFilter: """Custom search filter which allows adjusting of search terms dynamically""" def get_search_fields(self, view, request): """Return a set of search fields for the request, adjusted based on request params. The following query params are available to 'augment' the search (in...
the_stack_v2_python_sparse
InvenTree/InvenTree/filters.py
inventree/InvenTree
train
3,077
4aab4d8352387190a113fd53dad85494dfbc10ff
[ "for key, val in original.items():\n if key not in self.fields:\n data[key] = val\nreturn data", "for key, val in original.items():\n if key not in self.fields:\n data[key] = val\nreturn data" ]
<|body_start_0|> for key, val in original.items(): if key not in self.fields: data[key] = val return data <|end_body_0|> <|body_start_1|> for key, val in original.items(): if key not in self.fields: data[key] = val return data <|en...
UnknownSchemaMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UnknownSchemaMixin: def _handle_load_unknown(self, data, original): """Preserve unknown keys during deserialization.""" <|body_0|> def _handle_dump_unknown(self, data, original): """Preserve unknown keys during deserialization.""" <|body_1|> <|end_skeleton|>...
stack_v2_sparse_classes_36k_train_033846
5,044
permissive
[ { "docstring": "Preserve unknown keys during deserialization.", "name": "_handle_load_unknown", "signature": "def _handle_load_unknown(self, data, original)" }, { "docstring": "Preserve unknown keys during deserialization.", "name": "_handle_dump_unknown", "signature": "def _handle_dump_...
2
stack_v2_sparse_classes_30k_train_014300
Implement the Python class `UnknownSchemaMixin` described below. Class description: Implement the UnknownSchemaMixin class. Method signatures and docstrings: - def _handle_load_unknown(self, data, original): Preserve unknown keys during deserialization. - def _handle_dump_unknown(self, data, original): Preserve unkno...
Implement the Python class `UnknownSchemaMixin` described below. Class description: Implement the UnknownSchemaMixin class. Method signatures and docstrings: - def _handle_load_unknown(self, data, original): Preserve unknown keys during deserialization. - def _handle_dump_unknown(self, data, original): Preserve unkno...
fdda93f1ac4122c24720701a112c608006c184dd
<|skeleton|> class UnknownSchemaMixin: def _handle_load_unknown(self, data, original): """Preserve unknown keys during deserialization.""" <|body_0|> def _handle_dump_unknown(self, data, original): """Preserve unknown keys during deserialization.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UnknownSchemaMixin: def _handle_load_unknown(self, data, original): """Preserve unknown keys during deserialization.""" for key, val in original.items(): if key not in self.fields: data[key] = val return data def _handle_dump_unknown(self, data, origina...
the_stack_v2_python_sparse
polyaxon_schemas/utils.py
mmourafiq/polyaxon-schemas
train
0
8553946710a5a0b1aa06fc5c9ddb4bb86c2fe9b8
[ "assert isinstance(session_idx, int)\nassert isinstance(conf, AudioWindowLoaderConf)\nself.file: Path = get_binary_audio_file(session_idx, conf.tag)\nsuper().__init__(self.file)\nself.conf: AudioWindowLoaderConf = conf\nself.length: int = get_noof_windows(get_file_length(self.file), conf.wsize, conf.wstep)\nif conf...
<|body_start_0|> assert isinstance(session_idx, int) assert isinstance(conf, AudioWindowLoaderConf) self.file: Path = get_binary_audio_file(session_idx, conf.tag) super().__init__(self.file) self.conf: AudioWindowLoaderConf = conf self.length: int = get_noof_windows(get_f...
AudioWindowLoader
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AudioWindowLoader: def __init__(self, session_idx: int, conf: AudioWindowLoaderConf): """Create a loader for a single (binary) audio file. :param session_idx: The session index of the file. This is the global index, as assigned by the metadata constructor :param conf: The loader configur...
stack_v2_sparse_classes_36k_train_033847
2,952
permissive
[ { "docstring": "Create a loader for a single (binary) audio file. :param session_idx: The session index of the file. This is the global index, as assigned by the metadata constructor :param conf: The loader configuration", "name": "__init__", "signature": "def __init__(self, session_idx: int, conf: Audi...
2
null
Implement the Python class `AudioWindowLoader` described below. Class description: Implement the AudioWindowLoader class. Method signatures and docstrings: - def __init__(self, session_idx: int, conf: AudioWindowLoaderConf): Create a loader for a single (binary) audio file. :param session_idx: The session index of th...
Implement the Python class `AudioWindowLoader` described below. Class description: Implement the AudioWindowLoader class. Method signatures and docstrings: - def __init__(self, session_idx: int, conf: AudioWindowLoaderConf): Create a loader for a single (binary) audio file. :param session_idx: The session index of th...
90b9717c862087a727ef56a04e048b70174b8918
<|skeleton|> class AudioWindowLoader: def __init__(self, session_idx: int, conf: AudioWindowLoaderConf): """Create a loader for a single (binary) audio file. :param session_idx: The session index of the file. This is the global index, as assigned by the metadata constructor :param conf: The loader configur...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AudioWindowLoader: def __init__(self, session_idx: int, conf: AudioWindowLoaderConf): """Create a loader for a single (binary) audio file. :param session_idx: The session index of the file. This is the global index, as assigned by the metadata constructor :param conf: The loader configuration""" ...
the_stack_v2_python_sparse
src/dataset/wu2/loaders.py
mug-auth/ssl-chewing
train
1
4f7fe68f14e96a64b9d56840cdba54d5c9b01f2c
[ "if len(A) > len(B):\n lst1 = B\n lst2 = A\nelse:\n lst1 = A\n lst2 = B\nm = len(lst1)\nn = len(lst2)\nreturn self.find_median2(lst1, lst2, m, n)", "if m == 0:\n return median(lst2)\nelif m <= 3:\n next_lst1 = lst1\n if n <= m + 3:\n next_lst2 = lst2\n else:\n next_lst2 = lst...
<|body_start_0|> if len(A) > len(B): lst1 = B lst2 = A else: lst1 = A lst2 = B m = len(lst1) n = len(lst2) return self.find_median2(lst1, lst2, m, n) <|end_body_0|> <|body_start_1|> if m == 0: return median(lst2...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMedianSortedArrays(self, A, B): """Given two sorted list A and B return the median of combined list (A+B), as a float""" <|body_0|> def find_median2(self, lst1, lst2, m, n): """Given two sorted list lst1 and lst2 return the median of combined list (...
stack_v2_sparse_classes_36k_train_033848
3,629
no_license
[ { "docstring": "Given two sorted list A and B return the median of combined list (A+B), as a float", "name": "findMedianSortedArrays", "signature": "def findMedianSortedArrays(self, A, B)" }, { "docstring": "Given two sorted list lst1 and lst2 return the median of combined list (lst1+lst2), as a...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMedianSortedArrays(self, A, B): Given two sorted list A and B return the median of combined list (A+B), as a float - def find_median2(self, lst1, lst2, m, n): Given two s...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMedianSortedArrays(self, A, B): Given two sorted list A and B return the median of combined list (A+B), as a float - def find_median2(self, lst1, lst2, m, n): Given two s...
46182640d38e6250e02da46cf69bd849954a79e6
<|skeleton|> class Solution: def findMedianSortedArrays(self, A, B): """Given two sorted list A and B return the median of combined list (A+B), as a float""" <|body_0|> def find_median2(self, lst1, lst2, m, n): """Given two sorted list lst1 and lst2 return the median of combined list (...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findMedianSortedArrays(self, A, B): """Given two sorted list A and B return the median of combined list (A+B), as a float""" if len(A) > len(B): lst1 = B lst2 = A else: lst1 = A lst2 = B m = len(lst1) n = len...
the_stack_v2_python_sparse
src/Median of Two Sorted Arrays.py
wangzhixuan/LeetCodeSolution
train
0
f57f2262e1f3f12a46bca6711d533612cdcf3bc3
[ "assert noise_variance is None or likelihood is None, 'Cannot set both `noise_variance` and `likelihood`.'\nif likelihood is None:\n if noise_variance is None:\n noise_variance = 1.0\n likelihood = Gaussian(noise_variance)\nX_data, Y_data = data_input_to_tensor(data)\nnum_latent_gps = Y_data.shape[-1] ...
<|body_start_0|> assert noise_variance is None or likelihood is None, 'Cannot set both `noise_variance` and `likelihood`.' if likelihood is None: if noise_variance is None: noise_variance = 1.0 likelihood = Gaussian(noise_variance) X_data, Y_data = data_in...
Common base class for SGPR and GPRFITC that provides the common __init__ and upper_bound() methods.
SGPRBase_deprecated
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SGPRBase_deprecated: """Common base class for SGPR and GPRFITC that provides the common __init__ and upper_bound() methods.""" def __init__(self, data: RegressionData, kernel: Kernel, inducing_variable: InducingPointsLike, *, mean_function: Optional[MeanFunction]=None, num_latent_gps: Option...
stack_v2_sparse_classes_36k_train_033849
22,082
permissive
[ { "docstring": "This method only works with a Gaussian likelihood, its variance is initialized to `noise_variance`. :param data: a tuple of (X, Y), where the inputs X has shape [N, D] and the outputs Y has shape [N, R]. :param inducing_variable: an InducingPoints instance or a matrix of the pseudo inputs Z, of ...
2
stack_v2_sparse_classes_30k_val_001164
Implement the Python class `SGPRBase_deprecated` described below. Class description: Common base class for SGPR and GPRFITC that provides the common __init__ and upper_bound() methods. Method signatures and docstrings: - def __init__(self, data: RegressionData, kernel: Kernel, inducing_variable: InducingPointsLike, *...
Implement the Python class `SGPRBase_deprecated` described below. Class description: Common base class for SGPR and GPRFITC that provides the common __init__ and upper_bound() methods. Method signatures and docstrings: - def __init__(self, data: RegressionData, kernel: Kernel, inducing_variable: InducingPointsLike, *...
b716d22c7428f1bbe6bf4b361fdd0c7cb342a000
<|skeleton|> class SGPRBase_deprecated: """Common base class for SGPR and GPRFITC that provides the common __init__ and upper_bound() methods.""" def __init__(self, data: RegressionData, kernel: Kernel, inducing_variable: InducingPointsLike, *, mean_function: Optional[MeanFunction]=None, num_latent_gps: Option...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SGPRBase_deprecated: """Common base class for SGPR and GPRFITC that provides the common __init__ and upper_bound() methods.""" def __init__(self, data: RegressionData, kernel: Kernel, inducing_variable: InducingPointsLike, *, mean_function: Optional[MeanFunction]=None, num_latent_gps: Optional[int]=None,...
the_stack_v2_python_sparse
gpflow/models/sgpr.py
vishalbelsare/GPflow
train
0
c81f1f64bbb56e616af6b20f9de86ea23a479c20
[ "salt = _generate_salt(DEFAULT_SALT_LEN)\niterations = DEFAULT_ITERATIONS_COUNT\npassword_hash = _encrypt(pw, salt, iterations, DEFAULT_HASH_LEN)\nreturn '%s$%s$%s' % (iterations, base64.b64encode(salt), base64.b64encode(password_hash))", "try:\n iterations_str, salt_b64, password_hash_b64 = reference.split('$...
<|body_start_0|> salt = _generate_salt(DEFAULT_SALT_LEN) iterations = DEFAULT_ITERATIONS_COUNT password_hash = _encrypt(pw, salt, iterations, DEFAULT_HASH_LEN) return '%s$%s$%s' % (iterations, base64.b64encode(salt), base64.b64encode(password_hash)) <|end_body_0|> <|body_start_1|> ...
PBKDF2DigestScheme
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PBKDF2DigestScheme: def encrypt(self, pw): """Encrypt the provided plain text password. Returns string in format: <iterations>$<base64_salt>$<base64_hash>""" <|body_0|> def validate(self, reference, attempt): """Validate the provided password string. Reference is the...
stack_v2_sparse_classes_36k_train_033850
2,813
no_license
[ { "docstring": "Encrypt the provided plain text password. Returns string in format: <iterations>$<base64_salt>$<base64_hash>", "name": "encrypt", "signature": "def encrypt(self, pw)" }, { "docstring": "Validate the provided password string. Reference is the correct password, which may be encrypt...
2
null
Implement the Python class `PBKDF2DigestScheme` described below. Class description: Implement the PBKDF2DigestScheme class. Method signatures and docstrings: - def encrypt(self, pw): Encrypt the provided plain text password. Returns string in format: <iterations>$<base64_salt>$<base64_hash> - def validate(self, refer...
Implement the Python class `PBKDF2DigestScheme` described below. Class description: Implement the PBKDF2DigestScheme class. Method signatures and docstrings: - def encrypt(self, pw): Encrypt the provided plain text password. Returns string in format: <iterations>$<base64_salt>$<base64_hash> - def validate(self, refer...
1ea508c3d2b51742bc3b448c445cd0a3dba9e798
<|skeleton|> class PBKDF2DigestScheme: def encrypt(self, pw): """Encrypt the provided plain text password. Returns string in format: <iterations>$<base64_salt>$<base64_hash>""" <|body_0|> def validate(self, reference, attempt): """Validate the provided password string. Reference is the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PBKDF2DigestScheme: def encrypt(self, pw): """Encrypt the provided plain text password. Returns string in format: <iterations>$<base64_salt>$<base64_hash>""" salt = _generate_salt(DEFAULT_SALT_LEN) iterations = DEFAULT_ITERATIONS_COUNT password_hash = _encrypt(pw, salt, iterati...
the_stack_v2_python_sparse
Products/ZenUtils/pbkdf2.py
zenoss/zenoss-prodbin
train
27
a882fa8a40c0ccfb6f84b73582bf3cc90d9e8bee
[ "Graph.__init__(self, n, nodeData)\nself._adjList = []\nfor i in range(n):\n self._adjList.append([])", "if node1 < self._numVerts and node2 < self._numVerts:\n self._adjList[node1].append(node2)\n self._adjList[node2].append(node1)\n return True\nelif node1 >= self._numVerts:\n raise NodeIndexOutO...
<|body_start_0|> Graph.__init__(self, n, nodeData) self._adjList = [] for i in range(n): self._adjList.append([]) <|end_body_0|> <|body_start_1|> if node1 < self._numVerts and node2 < self._numVerts: self._adjList[node1].append(node2) self._adjList[no...
A graph contains vertices and edges: This implementation uses an adjacency list to represent edges.
ListGraph
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ListGraph: """A graph contains vertices and edges: This implementation uses an adjacency list to represent edges.""" def __init__(self, n, nodeData=[]): """Takes the number of nodes in the graph, and optionally a list of data to associate with each node. The data is assigned to nodes...
stack_v2_sparse_classes_36k_train_033851
16,606
no_license
[ { "docstring": "Takes the number of nodes in the graph, and optionally a list of data to associate with each node. The data is assigned to nodes in numeric order, starting with node 0. The edge information is represented using an adjacency list. This is initialized, but contains no edges; edges must be added se...
5
null
Implement the Python class `ListGraph` described below. Class description: A graph contains vertices and edges: This implementation uses an adjacency list to represent edges. Method signatures and docstrings: - def __init__(self, n, nodeData=[]): Takes the number of nodes in the graph, and optionally a list of data t...
Implement the Python class `ListGraph` described below. Class description: A graph contains vertices and edges: This implementation uses an adjacency list to represent edges. Method signatures and docstrings: - def __init__(self, n, nodeData=[]): Takes the number of nodes in the graph, and optionally a list of data t...
97bb378a325b1639110de06b88d6e237dffc7330
<|skeleton|> class ListGraph: """A graph contains vertices and edges: This implementation uses an adjacency list to represent edges.""" def __init__(self, n, nodeData=[]): """Takes the number of nodes in the graph, and optionally a list of data to associate with each node. The data is assigned to nodes...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ListGraph: """A graph contains vertices and edges: This implementation uses an adjacency list to represent edges.""" def __init__(self, n, nodeData=[]): """Takes the number of nodes in the graph, and optionally a list of data to associate with each node. The data is assigned to nodes in numeric o...
the_stack_v2_python_sparse
backups/speedy_nav-2/scripts/Graphs.py
FoxRobotLab/catkin_ws
train
6
cacd8ed164dd86cee7aa6a47d724ce9f43cc852f
[ "self._inverse_index = dict()\nself._dcount = 0\nfor file in os.listdir(directory):\n self._dcount += 1\n file = Document(directory + '/' + file)\n word_list = file.get_words()\n for word in word_list:\n if word not in self._inverse_index.keys():\n self._inverse_index[word] = [file]\n ...
<|body_start_0|> self._inverse_index = dict() self._dcount = 0 for file in os.listdir(directory): self._dcount += 1 file = Document(directory + '/' + file) word_list = file.get_words() for word in word_list: if word not in self._inv...
SearchEngine
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SearchEngine: def __init__(self, directory): """Initialize SearchEngine by creating the object from a given directory name, which has an inverse index that maps each word to the documents in which the word appears.""" <|body_0|> def _calculate_idf(self, term): """Fro...
stack_v2_sparse_classes_36k_train_033852
2,841
no_license
[ { "docstring": "Initialize SearchEngine by creating the object from a given directory name, which has an inverse index that maps each word to the documents in which the word appears.", "name": "__init__", "signature": "def __init__(self, directory)" }, { "docstring": "From the given term, functi...
3
stack_v2_sparse_classes_30k_train_018047
Implement the Python class `SearchEngine` described below. Class description: Implement the SearchEngine class. Method signatures and docstrings: - def __init__(self, directory): Initialize SearchEngine by creating the object from a given directory name, which has an inverse index that maps each word to the documents...
Implement the Python class `SearchEngine` described below. Class description: Implement the SearchEngine class. Method signatures and docstrings: - def __init__(self, directory): Initialize SearchEngine by creating the object from a given directory name, which has an inverse index that maps each word to the documents...
c480d2f7203f8ae2f78abd87aa7f743ead30cca4
<|skeleton|> class SearchEngine: def __init__(self, directory): """Initialize SearchEngine by creating the object from a given directory name, which has an inverse index that maps each word to the documents in which the word appears.""" <|body_0|> def _calculate_idf(self, term): """Fro...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SearchEngine: def __init__(self, directory): """Initialize SearchEngine by creating the object from a given directory name, which has an inverse index that maps each word to the documents in which the word appears.""" self._inverse_index = dict() self._dcount = 0 for file in os...
the_stack_v2_python_sparse
Advanced Data Programming/hw4/search_engine.py
getachew67/UW-Python-AI-Coursework-Projects
train
0
d3465b903788536c612f5ae4df0d43f34d1078a9
[ "super(baseline_network_conv, self).__init__()\nself.linear1st = nn.Linear(input_size, hidden_size)\nself.FC_layers = nn.ModuleList([MLP(hidden_size) for i in range(n_linear_layers)])\nself.myreshape = View(output_size)\nself.conv_layer1 = nn.Sequential(nn.Conv2d(1, 1, kernel_size=5, padding=2))", "x = self.linea...
<|body_start_0|> super(baseline_network_conv, self).__init__() self.linear1st = nn.Linear(input_size, hidden_size) self.FC_layers = nn.ModuleList([MLP(hidden_size) for i in range(n_linear_layers)]) self.myreshape = View(output_size) self.conv_layer1 = nn.Sequential(nn.Conv2d(1, 1...
a simple feedforward network from mean word vector representation to 2D brain activation NOTE: we do note employ deconvolutions, just reshape the output and (possibly) apply some convolutions. This network implements a function from extbf{R}^d -> extbf{R}^k imes extbf{R}^k where d is the dimension of word embeddings an...
baseline_network_conv
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class baseline_network_conv: """a simple feedforward network from mean word vector representation to 2D brain activation NOTE: we do note employ deconvolutions, just reshape the output and (possibly) apply some convolutions. This network implements a function from extbf{R}^d -> extbf{R}^k imes extbf{R}...
stack_v2_sparse_classes_36k_train_033853
2,538
no_license
[ { "docstring": "INPUT: - input_size : dimension of word vector embeddings - hidden_size : dimension of linear hidden layers (try to match with dimension of output images) - output_size : size output image (e.g., if 20, then image will be 20 by 20) - n_linear_layers : number of fully connected layers - n_conv_la...
2
stack_v2_sparse_classes_30k_train_020018
Implement the Python class `baseline_network_conv` described below. Class description: a simple feedforward network from mean word vector representation to 2D brain activation NOTE: we do note employ deconvolutions, just reshape the output and (possibly) apply some convolutions. This network implements a function from...
Implement the Python class `baseline_network_conv` described below. Class description: a simple feedforward network from mean word vector representation to 2D brain activation NOTE: we do note employ deconvolutions, just reshape the output and (possibly) apply some convolutions. This network implements a function from...
97ad23f27877ba143311ab79afb81f60b8c2c01f
<|skeleton|> class baseline_network_conv: """a simple feedforward network from mean word vector representation to 2D brain activation NOTE: we do note employ deconvolutions, just reshape the output and (possibly) apply some convolutions. This network implements a function from extbf{R}^d -> extbf{R}^k imes extbf{R}...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class baseline_network_conv: """a simple feedforward network from mean word vector representation to 2D brain activation NOTE: we do note employ deconvolutions, just reshape the output and (possibly) apply some convolutions. This network implements a function from extbf{R}^d -> extbf{R}^k imes extbf{R}^k where d is...
the_stack_v2_python_sparse
Code/networks/baseline_network_conv.py
piomonti/abstract2brain
train
0
edc81c749fb9780625a96a3f24be57a1a5028743
[ "cm = {}\nwm = {}\nfor c, w in itertools.zip_longest(pattern, s.split()):\n if c is None or w is None or (c in cm and cm[c] != w) or (w in wm and wm[w] != c):\n return False\n cm[c] = w\n wm[w] = c\nreturn True", "pw = {}\nwp = {}\nfor p, w in itertools.zip_longest(pattern, s.split()):\n if p i...
<|body_start_0|> cm = {} wm = {} for c, w in itertools.zip_longest(pattern, s.split()): if c is None or w is None or (c in cm and cm[c] != w) or (w in wm and wm[w] != c): return False cm[c] = w wm[w] = c return True <|end_body_0|> <|bo...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def wordPattern(self, pattern: str, s: str) -> bool: """Jan 31, 2022 13:02""" <|body_0|> def wordPattern(self, pattern: str, s: str) -> bool: """Mar 04, 2023 20:08""" <|body_1|> <|end_skeleton|> <|body_start_0|> cm = {} wm = {} ...
stack_v2_sparse_classes_36k_train_033854
2,226
no_license
[ { "docstring": "Jan 31, 2022 13:02", "name": "wordPattern", "signature": "def wordPattern(self, pattern: str, s: str) -> bool" }, { "docstring": "Mar 04, 2023 20:08", "name": "wordPattern", "signature": "def wordPattern(self, pattern: str, s: str) -> bool" } ]
2
stack_v2_sparse_classes_30k_train_016540
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def wordPattern(self, pattern: str, s: str) -> bool: Jan 31, 2022 13:02 - def wordPattern(self, pattern: str, s: str) -> bool: Mar 04, 2023 20:08
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def wordPattern(self, pattern: str, s: str) -> bool: Jan 31, 2022 13:02 - def wordPattern(self, pattern: str, s: str) -> bool: Mar 04, 2023 20:08 <|skeleton|> class Solution: ...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def wordPattern(self, pattern: str, s: str) -> bool: """Jan 31, 2022 13:02""" <|body_0|> def wordPattern(self, pattern: str, s: str) -> bool: """Mar 04, 2023 20:08""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def wordPattern(self, pattern: str, s: str) -> bool: """Jan 31, 2022 13:02""" cm = {} wm = {} for c, w in itertools.zip_longest(pattern, s.split()): if c is None or w is None or (c in cm and cm[c] != w) or (w in wm and wm[w] != c): return F...
the_stack_v2_python_sparse
leetcode/solved/290_Word_Pattern/solution.py
sungminoh/algorithms
train
0
5e5f3f3f9e42bf5e4464012324a3c61083dc0816
[ "self.id = id\nself.account_id = account_id\nself.audit_log_reference = audit_log_reference\nself.external_reference = external_reference\nself.oauth_client_id = oauth_client_id\nself.ip_address = ip_address\nself.xslt = xslt\nself.data_to_sign = data_to_sign\nself.result = result\nself.certificate = certificate\ns...
<|body_start_0|> self.id = id self.account_id = account_id self.audit_log_reference = audit_log_reference self.external_reference = external_reference self.oauth_client_id = oauth_client_id self.ip_address = ip_address self.xslt = xslt self.data_to_sign = ...
Implementation of the 'MerchantSignTransaction' model. TODO: type model description here. Attributes: id (uuid|string): Transaction Id account_id (uuid|string): Your account Id audit_log_reference (uuid|string): Audit log Id external_reference (string): External Reference oauth_client_id (string): The oauth client used...
MerchantSignTransaction
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MerchantSignTransaction: """Implementation of the 'MerchantSignTransaction' model. TODO: type model description here. Attributes: id (uuid|string): Transaction Id account_id (uuid|string): Your account Id audit_log_reference (uuid|string): Audit log Id external_reference (string): External Refere...
stack_v2_sparse_classes_36k_train_033855
4,518
permissive
[ { "docstring": "Constructor for the MerchantSignTransaction class", "name": "__init__", "signature": "def __init__(self, id=None, account_id=None, audit_log_reference=None, external_reference=None, oauth_client_id=None, ip_address=None, xslt=None, data_to_sign=None, result=None, certificate=None, time_s...
2
stack_v2_sparse_classes_30k_train_014664
Implement the Python class `MerchantSignTransaction` described below. Class description: Implementation of the 'MerchantSignTransaction' model. TODO: type model description here. Attributes: id (uuid|string): Transaction Id account_id (uuid|string): Your account Id audit_log_reference (uuid|string): Audit log Id exter...
Implement the Python class `MerchantSignTransaction` described below. Class description: Implementation of the 'MerchantSignTransaction' model. TODO: type model description here. Attributes: id (uuid|string): Transaction Id account_id (uuid|string): Your account Id audit_log_reference (uuid|string): Audit log Id exter...
fa3918a6c54ea0eedb9146578645b7eb1755b642
<|skeleton|> class MerchantSignTransaction: """Implementation of the 'MerchantSignTransaction' model. TODO: type model description here. Attributes: id (uuid|string): Transaction Id account_id (uuid|string): Your account Id audit_log_reference (uuid|string): Audit log Id external_reference (string): External Refere...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MerchantSignTransaction: """Implementation of the 'MerchantSignTransaction' model. TODO: type model description here. Attributes: id (uuid|string): Transaction Id account_id (uuid|string): Your account Id audit_log_reference (uuid|string): Audit log Id external_reference (string): External Reference oauth_cli...
the_stack_v2_python_sparse
idfy_rest_client/models/merchant_sign_transaction.py
dealflowteam/Idfy
train
0
3461d7e94d781666a648e1a69b346c03d863afd3
[ "response = utility.ExecutorResponse()\nresponse._stdout = '{\"key\":\"value\"}'\nresponse._parse_raw_input()\nself.assertEqual(response._json, '{\"key\":\"value\"}')\nself.assertEqual(response._parsed_output, {'key': 'value'})", "response = utility.ExecutorResponse()\nresponse._stdout = 'non-json string'\nrespon...
<|body_start_0|> response = utility.ExecutorResponse() response._stdout = '{"key":"value"}' response._parse_raw_input() self.assertEqual(response._json, '{"key":"value"}') self.assertEqual(response._parsed_output, {'key': 'value'}) <|end_body_0|> <|body_start_1|> respons...
UtilityTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UtilityTest: def test_parse_raw_input_json(self): """Testing json stdout is correctly parsed.""" <|body_0|> def test_parse_raw_input_text(self): """Testing non-json stdout is correctly parsed.""" <|body_1|> <|end_skeleton|> <|body_start_0|> response...
stack_v2_sparse_classes_36k_train_033856
1,529
permissive
[ { "docstring": "Testing json stdout is correctly parsed.", "name": "test_parse_raw_input_json", "signature": "def test_parse_raw_input_json(self)" }, { "docstring": "Testing non-json stdout is correctly parsed.", "name": "test_parse_raw_input_text", "signature": "def test_parse_raw_input...
2
stack_v2_sparse_classes_30k_train_000554
Implement the Python class `UtilityTest` described below. Class description: Implement the UtilityTest class. Method signatures and docstrings: - def test_parse_raw_input_json(self): Testing json stdout is correctly parsed. - def test_parse_raw_input_text(self): Testing non-json stdout is correctly parsed.
Implement the Python class `UtilityTest` described below. Class description: Implement the UtilityTest class. Method signatures and docstrings: - def test_parse_raw_input_json(self): Testing json stdout is correctly parsed. - def test_parse_raw_input_text(self): Testing non-json stdout is correctly parsed. <|skeleto...
3fb199658f68e7debf4906d9ce32a9a307e39243
<|skeleton|> class UtilityTest: def test_parse_raw_input_json(self): """Testing json stdout is correctly parsed.""" <|body_0|> def test_parse_raw_input_text(self): """Testing non-json stdout is correctly parsed.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UtilityTest: def test_parse_raw_input_json(self): """Testing json stdout is correctly parsed.""" response = utility.ExecutorResponse() response._stdout = '{"key":"value"}' response._parse_raw_input() self.assertEqual(response._json, '{"key":"value"}') self.asser...
the_stack_v2_python_sparse
sdk/python/kfp/deprecated/cli/diagnose_me/utility_test.py
kubeflow/pipelines
train
3,434
344e378fa957de55fa8d9165a576cc0ef116a934
[ "if model._meta.app_label in self.route_app_labels:\n return self.db_entry\nreturn None", "if model._meta.app_label in self.route_app_labels:\n return self.db_entry\nreturn None", "if obj1._meta.app_label in self.route_app_labels or obj2._meta.app_label in self.route_app_labels:\n return True\nreturn N...
<|body_start_0|> if model._meta.app_label in self.route_app_labels: return self.db_entry return None <|end_body_0|> <|body_start_1|> if model._meta.app_label in self.route_app_labels: return self.db_entry return None <|end_body_1|> <|body_start_2|> if ob...
A router to control all database operations on models in the auth application.
ProductionPortalRouter
[ "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProductionPortalRouter: """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 auth_db.""" <|body_0|> def db_for_write(self, model, **hints): """Attempts to...
stack_v2_sparse_classes_36k_train_033857
2,942
permissive
[ { "docstring": "Attempts to read auth models go to auth_db.", "name": "db_for_read", "signature": "def db_for_read(self, model, **hints)" }, { "docstring": "Attempts to write auth models go to auth_db.", "name": "db_for_write", "signature": "def db_for_write(self, model, **hints)" }, ...
4
stack_v2_sparse_classes_30k_train_011350
Implement the Python class `ProductionPortalRouter` 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 auth_db. - def db_for_write(self, model, ...
Implement the Python class `ProductionPortalRouter` 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 auth_db. - def db_for_write(self, model, ...
3b31e13b9cef9a805f9d517efc9449068b829fcb
<|skeleton|> class ProductionPortalRouter: """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 auth_db.""" <|body_0|> def db_for_write(self, model, **hints): """Attempts to...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProductionPortalRouter: """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 auth_db.""" if model._meta.app_label in self.route_app_labels: return self.db_entry ...
the_stack_v2_python_sparse
src/ensembl/production/portal/routers.py
Ensembl/ensembl-production-services
train
4
811bba35eb2ec0e7704604caedfe18dbe7483e8c
[ "files = {'file': open(test_csv_file, 'rb')}\nvalues = {'token': test_token, 'name': test_upload_name, 'layer_type': 'heat'}\noutput = requests.post(url, files=files, data=values)\nexpected_output = 'file ' + test_upload_name + ' added for the user ' + test_first_name\nassert output.json()['message'] == expected_ou...
<|body_start_0|> files = {'file': open(test_csv_file, 'rb')} values = {'token': test_token, 'name': test_upload_name, 'layer_type': 'heat'} output = requests.post(url, files=files, data=values) expected_output = 'file ' + test_upload_name + ' added for the user ' + test_first_name ...
TestAddUploads
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestAddUploads: def test_post_working(self): """this test will pass the uploads/add method""" <|body_0|> def test_post_missing_parameter(self): """this test will fail because of missing parameters""" <|body_1|> def test_post_user_unidentified(self): ...
stack_v2_sparse_classes_36k_train_033858
1,594
permissive
[ { "docstring": "this test will pass the uploads/add method", "name": "test_post_working", "signature": "def test_post_working(self)" }, { "docstring": "this test will fail because of missing parameters", "name": "test_post_missing_parameter", "signature": "def test_post_missing_parameter...
3
null
Implement the Python class `TestAddUploads` described below. Class description: Implement the TestAddUploads class. Method signatures and docstrings: - def test_post_working(self): this test will pass the uploads/add method - def test_post_missing_parameter(self): this test will fail because of missing parameters - d...
Implement the Python class `TestAddUploads` described below. Class description: Implement the TestAddUploads class. Method signatures and docstrings: - def test_post_working(self): this test will pass the uploads/add method - def test_post_missing_parameter(self): this test will fail because of missing parameters - d...
ba1e287dbc63e34bf9feb80b65b02c1db93ce91c
<|skeleton|> class TestAddUploads: def test_post_working(self): """this test will pass the uploads/add method""" <|body_0|> def test_post_missing_parameter(self): """this test will fail because of missing parameters""" <|body_1|> def test_post_user_unidentified(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestAddUploads: def test_post_working(self): """this test will pass the uploads/add method""" files = {'file': open(test_csv_file, 'rb')} values = {'token': test_token, 'name': test_upload_name, 'layer_type': 'heat'} output = requests.post(url, files=files, data=values) ...
the_stack_v2_python_sparse
pytest_suit/routes/uploads/test_addUploads.py
HotMaps/Hotmaps-toolbox-service
train
4
c156c8f898a8c5574ecf63a41c97e214e537f5c6
[ "tf.random.set_seed(42)\ndtype = np.float64\ninstant_forward_rate_fn_1 = lambda t: 2 * [0.2]\nprocess_1 = tff.models.hull_white.VectorHullWhiteModel(dim=2, mean_reversion=[0.1, 0.2], volatility=[0.1, 0.2], initial_discount_rate_fn=instant_forward_rate_fn_1, dtype=dtype)\ninstant_forward_rate_fn_2 = lambda t: 3 * [0...
<|body_start_0|> tf.random.set_seed(42) dtype = np.float64 instant_forward_rate_fn_1 = lambda t: 2 * [0.2] process_1 = tff.models.hull_white.VectorHullWhiteModel(dim=2, mean_reversion=[0.1, 0.2], volatility=[0.1, 0.2], initial_discount_rate_fn=instant_forward_rate_fn_1, dtype=dtype) ...
JoinedItoProcessTest
[ "Apache-2.0", "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JoinedItoProcessTest: def test_join_hull_white(self): """Tests that join of Hull White is the same as VectorHullWhite.""" <|body_0|> def test_invalid_processes(self): """Tests that all processes should be `ItoProcess`es.""" <|body_1|> def test_inconsiste...
stack_v2_sparse_classes_36k_train_033859
4,200
permissive
[ { "docstring": "Tests that join of Hull White is the same as VectorHullWhite.", "name": "test_join_hull_white", "signature": "def test_join_hull_white(self)" }, { "docstring": "Tests that all processes should be `ItoProcess`es.", "name": "test_invalid_processes", "signature": "def test_i...
3
null
Implement the Python class `JoinedItoProcessTest` described below. Class description: Implement the JoinedItoProcessTest class. Method signatures and docstrings: - def test_join_hull_white(self): Tests that join of Hull White is the same as VectorHullWhite. - def test_invalid_processes(self): Tests that all processes...
Implement the Python class `JoinedItoProcessTest` described below. Class description: Implement the JoinedItoProcessTest class. Method signatures and docstrings: - def test_join_hull_white(self): Tests that join of Hull White is the same as VectorHullWhite. - def test_invalid_processes(self): Tests that all processes...
0d3a2193c0f2d320b65e602cf01d7a617da484df
<|skeleton|> class JoinedItoProcessTest: def test_join_hull_white(self): """Tests that join of Hull White is the same as VectorHullWhite.""" <|body_0|> def test_invalid_processes(self): """Tests that all processes should be `ItoProcess`es.""" <|body_1|> def test_inconsiste...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JoinedItoProcessTest: def test_join_hull_white(self): """Tests that join of Hull White is the same as VectorHullWhite.""" tf.random.set_seed(42) dtype = np.float64 instant_forward_rate_fn_1 = lambda t: 2 * [0.2] process_1 = tff.models.hull_white.VectorHullWhiteModel(dim...
the_stack_v2_python_sparse
tf_quant_finance/models/joined_ito_process_test.py
google/tf-quant-finance
train
4,165
012588622b4eb7bfba1cde1f599dd65aaae0f6f0
[ "image = pygame.Surface(self.size)\nimage.fill(chaser.colour)\nsuper().__init__(image)\nself.velocity = (int(chaser.direction * self.speed), 0)\nself.rect.center = chaser.rect.center", "self.rect.move_ip(self.velocity)\nself.blit_to(display)\nif self.rect.colliderect(other_player.rect):\n return True" ]
<|body_start_0|> image = pygame.Surface(self.size) image.fill(chaser.colour) super().__init__(image) self.velocity = (int(chaser.direction * self.speed), 0) self.rect.center = chaser.rect.center <|end_body_0|> <|body_start_1|> self.rect.move_ip(self.velocity) sel...
Sprite subclass for the player's bullet.
Bullet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Bullet: """Sprite subclass for the player's bullet.""" def __init__(self, chaser): """Create the bullet.""" <|body_0|> def update(self, other_player, display): """Update the bullet. The update involves moveing the bullet, blitting it to the display, and checking ...
stack_v2_sparse_classes_36k_train_033860
9,555
no_license
[ { "docstring": "Create the bullet.", "name": "__init__", "signature": "def __init__(self, chaser)" }, { "docstring": "Update the bullet. The update involves moveing the bullet, blitting it to the display, and checking if the bullet has hit the opponent.", "name": "update", "signature": "...
2
stack_v2_sparse_classes_30k_train_000583
Implement the Python class `Bullet` described below. Class description: Sprite subclass for the player's bullet. Method signatures and docstrings: - def __init__(self, chaser): Create the bullet. - def update(self, other_player, display): Update the bullet. The update involves moveing the bullet, blitting it to the d...
Implement the Python class `Bullet` described below. Class description: Sprite subclass for the player's bullet. Method signatures and docstrings: - def __init__(self, chaser): Create the bullet. - def update(self, other_player, display): Update the bullet. The update involves moveing the bullet, blitting it to the d...
e7bbc0f7cfab13a2e16baa4c931d3a412c86277c
<|skeleton|> class Bullet: """Sprite subclass for the player's bullet.""" def __init__(self, chaser): """Create the bullet.""" <|body_0|> def update(self, other_player, display): """Update the bullet. The update involves moveing the bullet, blitting it to the display, and checking ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Bullet: """Sprite subclass for the player's bullet.""" def __init__(self, chaser): """Create the bullet.""" image = pygame.Surface(self.size) image.fill(chaser.colour) super().__init__(image) self.velocity = (int(chaser.direction * self.speed), 0) self.rect...
the_stack_v2_python_sparse
GunTag.py
Chig00/Python
train
1
81dd8a4241f2afff221da36ffb4e554c47561822
[ "if len(prices) < 2 or k == 0:\n return 0\nif k >= len(prices) // 2:\n return self.maxProfitGreedy(prices)\nholds = [-9999] * k\nreleases = [0] * k\nfor j, price in enumerate(prices):\n for i in range(min((j + 2) // 2, k) - 1, -1, -1):\n releases[i] = max(releases[i], holds[i] + price)\n if i...
<|body_start_0|> if len(prices) < 2 or k == 0: return 0 if k >= len(prices) // 2: return self.maxProfitGreedy(prices) holds = [-9999] * k releases = [0] * k for j, price in enumerate(prices): for i in range(min((j + 2) // 2, k) - 1, -1, -1): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, k, prices): """:type k: int :type prices: List[int] :rtype: int""" <|body_0|> def maxProfitGreedy(self, prices): """:type prices: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(prices) < 2 ...
stack_v2_sparse_classes_36k_train_033861
757
no_license
[ { "docstring": ":type k: int :type prices: List[int] :rtype: int", "name": "maxProfit", "signature": "def maxProfit(self, k, prices)" }, { "docstring": ":type prices: List[int] :rtype: int", "name": "maxProfitGreedy", "signature": "def maxProfitGreedy(self, prices)" } ]
2
stack_v2_sparse_classes_30k_train_001314
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, k, prices): :type k: int :type prices: List[int] :rtype: int - def maxProfitGreedy(self, prices): :type prices: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, k, prices): :type k: int :type prices: List[int] :rtype: int - def maxProfitGreedy(self, prices): :type prices: List[int] :rtype: int <|skeleton|> class Solu...
15f012927dc34b5d751af6633caa5e8882d26ff7
<|skeleton|> class Solution: def maxProfit(self, k, prices): """:type k: int :type prices: List[int] :rtype: int""" <|body_0|> def maxProfitGreedy(self, prices): """:type prices: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit(self, k, prices): """:type k: int :type prices: List[int] :rtype: int""" if len(prices) < 2 or k == 0: return 0 if k >= len(prices) // 2: return self.maxProfitGreedy(prices) holds = [-9999] * k releases = [0] * k f...
the_stack_v2_python_sparse
python/188.BestTimeToBuyAndSellStockIV.py
MaxPoon/Leetcode
train
15
6ed5ed013f1e4201ef64999205814a86a8e29875
[ "opts = SCons.Variables.Variables()\nopts.Add(SCons.Variables.PackageVariable('test', 'test option help', '/default/path'))\no = opts.options[0]\nassert o.key == 'test', o.key\nassert o.help == 'test option help\\n ( yes | no | /path/to/test )', repr(o.help)\nassert o.default == '/default/path', o.default\nasser...
<|body_start_0|> opts = SCons.Variables.Variables() opts.Add(SCons.Variables.PackageVariable('test', 'test option help', '/default/path')) o = opts.options[0] assert o.key == 'test', o.key assert o.help == 'test option help\n ( yes | no | /path/to/test )', repr(o.help) ...
PackageVariableTestCase
[ "MIT", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PackageVariableTestCase: def test_PackageVariable(self) -> None: """Test PackageVariable creation""" <|body_0|> def test_converter(self) -> None: """Test the PackageVariable converter""" <|body_1|> def test_validator(self) -> None: """Test the Pa...
stack_v2_sparse_classes_36k_train_033862
4,162
permissive
[ { "docstring": "Test PackageVariable creation", "name": "test_PackageVariable", "signature": "def test_PackageVariable(self) -> None" }, { "docstring": "Test the PackageVariable converter", "name": "test_converter", "signature": "def test_converter(self) -> None" }, { "docstring"...
3
null
Implement the Python class `PackageVariableTestCase` described below. Class description: Implement the PackageVariableTestCase class. Method signatures and docstrings: - def test_PackageVariable(self) -> None: Test PackageVariable creation - def test_converter(self) -> None: Test the PackageVariable converter - def t...
Implement the Python class `PackageVariableTestCase` described below. Class description: Implement the PackageVariableTestCase class. Method signatures and docstrings: - def test_PackageVariable(self) -> None: Test PackageVariable creation - def test_converter(self) -> None: Test the PackageVariable converter - def t...
b2a7d7066a2b854460a334a5fe737ea389655e6e
<|skeleton|> class PackageVariableTestCase: def test_PackageVariable(self) -> None: """Test PackageVariable creation""" <|body_0|> def test_converter(self) -> None: """Test the PackageVariable converter""" <|body_1|> def test_validator(self) -> None: """Test the Pa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PackageVariableTestCase: def test_PackageVariable(self) -> None: """Test PackageVariable creation""" opts = SCons.Variables.Variables() opts.Add(SCons.Variables.PackageVariable('test', 'test option help', '/default/path')) o = opts.options[0] assert o.key == 'test', o.k...
the_stack_v2_python_sparse
SCons/Variables/PackageVariableTests.py
SCons/scons
train
1,827
70e4bef96104fabc0963cbe668b215e4c41a2495
[ "super().__init__(input_tensor_spec=input_tensor_spec, name=name)\nconv_blocks = []\nchannels = input_tensor_spec.shape[0]\nfor i in range(len(filters)):\n block = [alf.layers.Conv2D(channels, filters[i], 3, strides=1, padding=1, use_bias=False, activation=alf.math.identity), torch.nn.InstanceNorm2d(filters[i], ...
<|body_start_0|> super().__init__(input_tensor_spec=input_tensor_spec, name=name) conv_blocks = [] channels = input_tensor_spec.shape[0] for i in range(len(filters)): block = [alf.layers.Conv2D(channels, filters[i], 3, strides=1, padding=1, use_bias=False, activation=alf.math...
Implement the UNet architecture used by MoNet. See Appendix B.2 of the MoNet paper `<https://arxiv.org/abs/1901.11390>`_ for details. The architecture is slightly different from the one in the paper, where for the downsampling path, we don't downsample for the first block but always downsample for the other blocks. For...
MoNetUNet
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MoNetUNet: """Implement the UNet architecture used by MoNet. See Appendix B.2 of the MoNet paper `<https://arxiv.org/abs/1901.11390>`_ for details. The architecture is slightly different from the one in the paper, where for the downsampling path, we don't downsample for the first block but always...
stack_v2_sparse_classes_36k_train_033863
18,086
permissive
[ { "docstring": "Args: input_tensor_spec: spec of the input image filters: a tuple of output channels along the downsampling path, each for a conv layer. The upsampling path uses a reversed tuple. nonskip_fc_layers: a tuple of fc layer sizes for the bottleneck connection (nonskip) of the UNet. output_channels: f...
2
null
Implement the Python class `MoNetUNet` described below. Class description: Implement the UNet architecture used by MoNet. See Appendix B.2 of the MoNet paper `<https://arxiv.org/abs/1901.11390>`_ for details. The architecture is slightly different from the one in the paper, where for the downsampling path, we don't do...
Implement the Python class `MoNetUNet` described below. Class description: Implement the UNet architecture used by MoNet. See Appendix B.2 of the MoNet paper `<https://arxiv.org/abs/1901.11390>`_ for details. The architecture is slightly different from the one in the paper, where for the downsampling path, we don't do...
b00ff2fa5e660de31020338ba340263183fbeaa4
<|skeleton|> class MoNetUNet: """Implement the UNet architecture used by MoNet. See Appendix B.2 of the MoNet paper `<https://arxiv.org/abs/1901.11390>`_ for details. The architecture is slightly different from the one in the paper, where for the downsampling path, we don't downsample for the first block but always...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MoNetUNet: """Implement the UNet architecture used by MoNet. See Appendix B.2 of the MoNet paper `<https://arxiv.org/abs/1901.11390>`_ for details. The architecture is slightly different from the one in the paper, where for the downsampling path, we don't downsample for the first block but always downsample f...
the_stack_v2_python_sparse
alf/algorithms/monet_algorithm.py
HorizonRobotics/alf
train
288
4e3e9e8730cfd84c5ebcbb0e960f2edca827b38f
[ "super(STNLICls, self).__init__()\nself.enc = StarTransEnc(embed=embed, hidden_size=hidden_size, num_layers=num_layers, num_head=num_head, head_dim=head_dim, max_len=max_len, emb_dropout=emb_dropout, dropout=dropout)\nself.cls = _NLICls(hidden_size, num_cls, cls_hidden_size)", "mask1 = seq_len_to_mask(seq_len1)\n...
<|body_start_0|> super(STNLICls, self).__init__() self.enc = StarTransEnc(embed=embed, hidden_size=hidden_size, num_layers=num_layers, num_head=num_head, head_dim=head_dim, max_len=max_len, emb_dropout=emb_dropout, dropout=dropout) self.cls = _NLICls(hidden_size, num_cls, cls_hidden_size) <|end_...
用于自然语言推断(NLI)的Star-Transformer
STNLICls
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class STNLICls: """用于自然语言推断(NLI)的Star-Transformer""" def __init__(self, embed, num_cls, hidden_size=300, num_layers=4, num_head=8, head_dim=32, max_len=512, cls_hidden_size=600, emb_dropout=0.1, dropout=0.1): """:param embed: 单词词典, 可以是 tuple, 包括(num_embedings, embedding_dim), 即 embedding的大...
stack_v2_sparse_classes_36k_train_033864
11,601
permissive
[ { "docstring": ":param embed: 单词词典, 可以是 tuple, 包括(num_embedings, embedding_dim), 即 embedding的大小和每个词的维度. 也可以传入 nn.Embedding 对象, 此时就以传入的对象作为embedding :param num_cls: 输出类别个数 :param hidden_size: 模型中特征维度. Default: 300 :param num_layers: 模型层数. Default: 4 :param num_head: 模型中multi-head的head个数. Default: 8 :param head_d...
3
stack_v2_sparse_classes_30k_train_017634
Implement the Python class `STNLICls` described below. Class description: 用于自然语言推断(NLI)的Star-Transformer Method signatures and docstrings: - def __init__(self, embed, num_cls, hidden_size=300, num_layers=4, num_head=8, head_dim=32, max_len=512, cls_hidden_size=600, emb_dropout=0.1, dropout=0.1): :param embed: 单词词典, 可...
Implement the Python class `STNLICls` described below. Class description: 用于自然语言推断(NLI)的Star-Transformer Method signatures and docstrings: - def __init__(self, embed, num_cls, hidden_size=300, num_layers=4, num_head=8, head_dim=32, max_len=512, cls_hidden_size=600, emb_dropout=0.1, dropout=0.1): :param embed: 单词词典, 可...
dffc7a06cdbff2671a3ca73d2398159d91a4a7db
<|skeleton|> class STNLICls: """用于自然语言推断(NLI)的Star-Transformer""" def __init__(self, embed, num_cls, hidden_size=300, num_layers=4, num_head=8, head_dim=32, max_len=512, cls_hidden_size=600, emb_dropout=0.1, dropout=0.1): """:param embed: 单词词典, 可以是 tuple, 包括(num_embedings, embedding_dim), 即 embedding的大...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class STNLICls: """用于自然语言推断(NLI)的Star-Transformer""" def __init__(self, embed, num_cls, hidden_size=300, num_layers=4, num_head=8, head_dim=32, max_len=512, cls_hidden_size=600, emb_dropout=0.1, dropout=0.1): """:param embed: 单词词典, 可以是 tuple, 包括(num_embedings, embedding_dim), 即 embedding的大小和每个词的维度. 也可以...
the_stack_v2_python_sparse
phenobert/utils/fastNLP/models/star_transformer.py
TianlabTech/PhenoBERT
train
2
a146ecb100fe70bd0a80e17f83b333370fafc67f
[ "workBook = xlrd.open_workbook(filePath)\nif sheetName is None and sheetIndex is None:\n sheet = workBook.sheet_by_index(0)\nelif sheetName is not None:\n try:\n sheet = workBook.sheet_by_name(sheetName)\n except xlrd.biffh.XLRDError:\n return '给定的sheetName不存在'\nelse:\n try:\n sheet...
<|body_start_0|> workBook = xlrd.open_workbook(filePath) if sheetName is None and sheetIndex is None: sheet = workBook.sheet_by_index(0) elif sheetName is not None: try: sheet = workBook.sheet_by_name(sheetName) except xlrd.biffh.XLRDError: ...
GetInfoFromExcel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetInfoFromExcel: def getInfoFromExcel(filePath, sheetName=None, sheetIndex=None, row=None, col=None): """给定EXCEL文件以及sheet名称或索引返回对应 行或列或整张表的**""" <|body_0|> def getCountFromExcel(filePath, sheetName=None, sheetIndex=None): """给定EXCEL文件以及sheet名称或索引返回对应 (行数,列数)""" ...
stack_v2_sparse_classes_36k_train_033865
5,076
no_license
[ { "docstring": "给定EXCEL文件以及sheet名称或索引返回对应 行或列或整张表的**", "name": "getInfoFromExcel", "signature": "def getInfoFromExcel(filePath, sheetName=None, sheetIndex=None, row=None, col=None)" }, { "docstring": "给定EXCEL文件以及sheet名称或索引返回对应 (行数,列数)", "name": "getCountFromExcel", "signature": "def getC...
3
stack_v2_sparse_classes_30k_train_013548
Implement the Python class `GetInfoFromExcel` described below. Class description: Implement the GetInfoFromExcel class. Method signatures and docstrings: - def getInfoFromExcel(filePath, sheetName=None, sheetIndex=None, row=None, col=None): 给定EXCEL文件以及sheet名称或索引返回对应 行或列或整张表的** - def getCountFromExcel(filePath, sheetN...
Implement the Python class `GetInfoFromExcel` described below. Class description: Implement the GetInfoFromExcel class. Method signatures and docstrings: - def getInfoFromExcel(filePath, sheetName=None, sheetIndex=None, row=None, col=None): 给定EXCEL文件以及sheet名称或索引返回对应 行或列或整张表的** - def getCountFromExcel(filePath, sheetN...
d90c7e32532eb086ba385ab99a375c4ccbeca9a2
<|skeleton|> class GetInfoFromExcel: def getInfoFromExcel(filePath, sheetName=None, sheetIndex=None, row=None, col=None): """给定EXCEL文件以及sheet名称或索引返回对应 行或列或整张表的**""" <|body_0|> def getCountFromExcel(filePath, sheetName=None, sheetIndex=None): """给定EXCEL文件以及sheet名称或索引返回对应 (行数,列数)""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GetInfoFromExcel: def getInfoFromExcel(filePath, sheetName=None, sheetIndex=None, row=None, col=None): """给定EXCEL文件以及sheet名称或索引返回对应 行或列或整张表的**""" workBook = xlrd.open_workbook(filePath) if sheetName is None and sheetIndex is None: sheet = workBook.sheet_by_index(0) ...
the_stack_v2_python_sparse
invest/useExcel.py
husky8/cccode
train
0
a738ee84820c1a24d5abe31b01dd30c56ba90da6
[ "super(VitalsWidget, self).__init__('Vitals', parent)\nself.setAllowedAreas(QtCore.Qt.DockWidgetArea.LeftDockWidgetArea | QtCore.Qt.DockWidgetArea.RightDockWidgetArea)\nself._initUI()", "frame = QtGui.QFrame()\nself.setWidget(frame)\nlayout = QtGui.QVBoxLayout()\nframe.setLayout(layout)\nlayout.addWidget(QtGui.QL...
<|body_start_0|> super(VitalsWidget, self).__init__('Vitals', parent) self.setAllowedAreas(QtCore.Qt.DockWidgetArea.LeftDockWidgetArea | QtCore.Qt.DockWidgetArea.RightDockWidgetArea) self._initUI() <|end_body_0|> <|body_start_1|> frame = QtGui.QFrame() self.setWidget(frame) ...
A dockable widget to display rover vitals.
VitalsWidget
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VitalsWidget: """A dockable widget to display rover vitals.""" def __init__(self, parent=None): """Create and initialize a VitalsWidget. Args: parent (QWidget): Parent Qt widget.""" <|body_0|> def _initUI(self): """Private method to setup the widget UI.""" ...
stack_v2_sparse_classes_36k_train_033866
1,851
no_license
[ { "docstring": "Create and initialize a VitalsWidget. Args: parent (QWidget): Parent Qt widget.", "name": "__init__", "signature": "def __init__(self, parent=None)" }, { "docstring": "Private method to setup the widget UI.", "name": "_initUI", "signature": "def _initUI(self)" } ]
2
stack_v2_sparse_classes_30k_train_014752
Implement the Python class `VitalsWidget` described below. Class description: A dockable widget to display rover vitals. Method signatures and docstrings: - def __init__(self, parent=None): Create and initialize a VitalsWidget. Args: parent (QWidget): Parent Qt widget. - def _initUI(self): Private method to setup the...
Implement the Python class `VitalsWidget` described below. Class description: A dockable widget to display rover vitals. Method signatures and docstrings: - def __init__(self, parent=None): Create and initialize a VitalsWidget. Args: parent (QWidget): Parent Qt widget. - def _initUI(self): Private method to setup the...
b7f6adf76ab7e52eef585497ffd9ef93d6a0a4e0
<|skeleton|> class VitalsWidget: """A dockable widget to display rover vitals.""" def __init__(self, parent=None): """Create and initialize a VitalsWidget. Args: parent (QWidget): Parent Qt widget.""" <|body_0|> def _initUI(self): """Private method to setup the widget UI.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VitalsWidget: """A dockable widget to display rover vitals.""" def __init__(self, parent=None): """Create and initialize a VitalsWidget. Args: parent (QWidget): Parent Qt widget.""" super(VitalsWidget, self).__init__('Vitals', parent) self.setAllowedAreas(QtCore.Qt.DockWidgetArea....
the_stack_v2_python_sparse
BaseStation/Views/VitalsWidget.py
ISU-MAVRIC/MAVRIC_Controller
train
0
09b99e240155f9ca87b9b25afca926fb394e25a9
[ "cls.user = UserFactory()\ncls.auth = AuthFactory()\ncls.device = TOTPDevice.objects.create(user=cls.user)\ncls.relate = TOTPDevice.challenge.objects.create(device=cls.device, token=cls.auth)\ncls.algorithm = TOTPAlgorithm()", "for i in (-2, -1, 0, 1, 2):\n description = 'TOTP not verified for `i={0}`'.format(...
<|body_start_0|> cls.user = UserFactory() cls.auth = AuthFactory() cls.device = TOTPDevice.objects.create(user=cls.user) cls.relate = TOTPDevice.challenge.objects.create(device=cls.device, token=cls.auth) cls.algorithm = TOTPAlgorithm() <|end_body_0|> <|body_start_1|> fo...
Tests for TOTP verification implementation.
VerificationTests
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VerificationTests: """Tests for TOTP verification implementation.""" def setUpTestData(cls): """Set up the test data within the test db.""" <|body_0|> def test_successful_verification(self): """Test a all successful scenario's for TOTP validation. Note: when ther...
stack_v2_sparse_classes_36k_train_033867
2,012
permissive
[ { "docstring": "Set up the test data within the test db.", "name": "setUpTestData", "signature": "def setUpTestData(cls)" }, { "docstring": "Test a all successful scenario's for TOTP validation. Note: when there is a tolerance of 2 there are actually 5 possibilities 1 and 2 steps before now, now...
3
stack_v2_sparse_classes_30k_train_014506
Implement the Python class `VerificationTests` described below. Class description: Tests for TOTP verification implementation. Method signatures and docstrings: - def setUpTestData(cls): Set up the test data within the test db. - def test_successful_verification(self): Test a all successful scenario's for TOTP valida...
Implement the Python class `VerificationTests` described below. Class description: Tests for TOTP verification implementation. Method signatures and docstrings: - def setUpTestData(cls): Set up the test data within the test db. - def test_successful_verification(self): Test a all successful scenario's for TOTP valida...
6342f473a287a546088e868e46be333323fd866c
<|skeleton|> class VerificationTests: """Tests for TOTP verification implementation.""" def setUpTestData(cls): """Set up the test data within the test db.""" <|body_0|> def test_successful_verification(self): """Test a all successful scenario's for TOTP validation. Note: when ther...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VerificationTests: """Tests for TOTP verification implementation.""" def setUpTestData(cls): """Set up the test data within the test db.""" cls.user = UserFactory() cls.auth = AuthFactory() cls.device = TOTPDevice.objects.create(user=cls.user) cls.relate = TOTPDevi...
the_stack_v2_python_sparse
rest_multi_factor/plugins/totp/tests.py
KENTIVO/rest-multi-factor
train
0
50d6549c16564cfa90fe7757a6b328154f41d339
[ "if sum_ <= 0:\n raise ValueError('Sum must be positive.')\nif size < 2:\n raise ValueError('Size must be greater than 1.')\nself.dp = np.zeros((sum_ + 1, size + 1), dtype=object)\nself.combs = self.get_combinations(sum_, size)", "if self.dp[sum][n]:\n return self.dp[sum][n]\ntmp_list = []\nif n == 1:\n ...
<|body_start_0|> if sum_ <= 0: raise ValueError('Sum must be positive.') if size < 2: raise ValueError('Size must be greater than 1.') self.dp = np.zeros((sum_ + 1, size + 1), dtype=object) self.combs = self.get_combinations(sum_, size) <|end_body_0|> <|body_star...
Class to generate all combinations of non-negative integers that have equal sum.
EqualSumCombinations
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EqualSumCombinations: """Class to generate all combinations of non-negative integers that have equal sum.""" def __init__(self, sum_, size): """Constructor to initialize the variables. Parameters ---------- sum_ : int Desired sum (must be greater than 0). size : int Number of integer...
stack_v2_sparse_classes_36k_train_033868
1,889
permissive
[ { "docstring": "Constructor to initialize the variables. Parameters ---------- sum_ : int Desired sum (must be greater than 0). size : int Number of integers (must be greater than 1). Raises ------ ValueError If sum is less than 2.", "name": "__init__", "signature": "def __init__(self, sum_, size)" },...
2
stack_v2_sparse_classes_30k_train_014045
Implement the Python class `EqualSumCombinations` described below. Class description: Class to generate all combinations of non-negative integers that have equal sum. Method signatures and docstrings: - def __init__(self, sum_, size): Constructor to initialize the variables. Parameters ---------- sum_ : int Desired s...
Implement the Python class `EqualSumCombinations` described below. Class description: Class to generate all combinations of non-negative integers that have equal sum. Method signatures and docstrings: - def __init__(self, sum_, size): Constructor to initialize the variables. Parameters ---------- sum_ : int Desired s...
d511d91500f757de46162d2f8331e353a68de6a0
<|skeleton|> class EqualSumCombinations: """Class to generate all combinations of non-negative integers that have equal sum.""" def __init__(self, sum_, size): """Constructor to initialize the variables. Parameters ---------- sum_ : int Desired sum (must be greater than 0). size : int Number of integer...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EqualSumCombinations: """Class to generate all combinations of non-negative integers that have equal sum.""" def __init__(self, sum_, size): """Constructor to initialize the variables. Parameters ---------- sum_ : int Desired sum (must be greater than 0). size : int Number of integers (must be gr...
the_stack_v2_python_sparse
chemml/chem/magpie_python/utility/EqualSumCombinations.py
hachmannlab/chemml
train
140
a47b129242e4954c44511e3b5d017ba217629b99
[ "params = dict()\nparams['applicationguid'] = applicationguid\nreturn q.workflowengine.actionmanager.startActorAction('cloudinstallservice', 'initialize', params, jobguid=jobguid, executionparams=executionparams)", "params = dict()\nparams['machineguid'] = machineguid\nreturn q.workflowengine.actionmanager.startA...
<|body_start_0|> params = dict() params['applicationguid'] = applicationguid return q.workflowengine.actionmanager.startActorAction('cloudinstallservice', 'initialize', params, jobguid=jobguid, executionparams=executionparams) <|end_body_0|> <|body_start_1|> params = dict() para...
cloudinstallservice
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class cloudinstallservice: def initialize(self, applicationguid='', jobguid='', executionparams={}): """Installs and configures the cloud install service. @param applicationguid: Guid of the application which needs to be initialized @type applicationguid: guid @param jobguid: Guid of the job @...
stack_v2_sparse_classes_36k_train_033869
4,461
no_license
[ { "docstring": "Installs and configures the cloud install service. @param applicationguid: Guid of the application which needs to be initialized @type applicationguid: guid @param jobguid: Guid of the job @type jobguid: guid @param executionParams: dictionary with additional executionParams @type executionParam...
4
stack_v2_sparse_classes_30k_train_010676
Implement the Python class `cloudinstallservice` described below. Class description: Implement the cloudinstallservice class. Method signatures and docstrings: - def initialize(self, applicationguid='', jobguid='', executionparams={}): Installs and configures the cloud install service. @param applicationguid: Guid of...
Implement the Python class `cloudinstallservice` described below. Class description: Implement the cloudinstallservice class. Method signatures and docstrings: - def initialize(self, applicationguid='', jobguid='', executionparams={}): Installs and configures the cloud install service. @param applicationguid: Guid of...
53d349fa6bee0ccead29afd6676979b44c109a61
<|skeleton|> class cloudinstallservice: def initialize(self, applicationguid='', jobguid='', executionparams={}): """Installs and configures the cloud install service. @param applicationguid: Guid of the application which needs to be initialized @type applicationguid: guid @param jobguid: Guid of the job @...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class cloudinstallservice: def initialize(self, applicationguid='', jobguid='', executionparams={}): """Installs and configures the cloud install service. @param applicationguid: Guid of the application which needs to be initialized @type applicationguid: guid @param jobguid: Guid of the job @type jobguid: ...
the_stack_v2_python_sparse
apps/cloud_api_generator/actor/cloudinstallservice.py
racktivity/ext-pylabs-core
train
0
a23199544234ac2152a5052c3010a5e60b590cf1
[ "leaf_nodes1 = self.getLeafNodes(root1)\nleaf_nodes2 = self.getLeafNodes(root2)\nif leaf_nodes1 == leaf_nodes2:\n return True\nreturn False", "if root.left == None and root.right == None:\n res.append(root)\nelif root.left != None:\n self.getLeafNodes(root.left, res)\nelif root.right != None:\n self.g...
<|body_start_0|> leaf_nodes1 = self.getLeafNodes(root1) leaf_nodes2 = self.getLeafNodes(root2) if leaf_nodes1 == leaf_nodes2: return True return False <|end_body_0|> <|body_start_1|> if root.left == None and root.right == None: res.append(root) el...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def leafSimilar(self, root1, root2): """:type root1: TreeNode :type root2: TreeNode :rtype: bool""" <|body_0|> def getLeafNodes(self, root, res): """:type root: TreeNode :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_033870
1,562
no_license
[ { "docstring": ":type root1: TreeNode :type root2: TreeNode :rtype: bool", "name": "leafSimilar", "signature": "def leafSimilar(self, root1, root2)" }, { "docstring": ":type root: TreeNode :rtype: List[List[int]]", "name": "getLeafNodes", "signature": "def getLeafNodes(self, root, res)" ...
2
stack_v2_sparse_classes_30k_train_003253
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def leafSimilar(self, root1, root2): :type root1: TreeNode :type root2: TreeNode :rtype: bool - def getLeafNodes(self, root, res): :type root: TreeNode :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def leafSimilar(self, root1, root2): :type root1: TreeNode :type root2: TreeNode :rtype: bool - def getLeafNodes(self, root, res): :type root: TreeNode :rtype: List[List[int]] <...
1211eac167f33084f536007468ea10c1a0ceab08
<|skeleton|> class Solution: def leafSimilar(self, root1, root2): """:type root1: TreeNode :type root2: TreeNode :rtype: bool""" <|body_0|> def getLeafNodes(self, root, res): """:type root: TreeNode :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def leafSimilar(self, root1, root2): """:type root1: TreeNode :type root2: TreeNode :rtype: bool""" leaf_nodes1 = self.getLeafNodes(root1) leaf_nodes2 = self.getLeafNodes(root2) if leaf_nodes1 == leaf_nodes2: return True return False def getLe...
the_stack_v2_python_sparse
872_LeafSimilarTrees.py
renukadeshmukh/Leetcode_Solutions
train
3
d52ba227f6b54888b09eb610d738e5972616868b
[ "confirmed_config = settings.proxies.pool.get('confirmation', {})\nhorizon = horizon or confirmed_config.get('horizon')\nif not horizon:\n raise ConfigError('Horizon Not Specified in Config')\nrequests = self.requests(active=active, success=True)\nreturn requests[int(-1 * horizon):]", "confirmed_config = setti...
<|body_start_0|> confirmed_config = settings.proxies.pool.get('confirmation', {}) horizon = horizon or confirmed_config.get('horizon') if not horizon: raise ConfigError('Horizon Not Specified in Config') requests = self.requests(active=active, success=True) return req...
ConfirmedMetrics
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConfirmedMetrics: def confirmations_in_horizon(self, horizon=None, active=False): """Returns the number of confirmed requests in the last `horizon` requests.""" <|body_0|> def confirmed_in_horizon(self, horizon=None, active=False): """Returns True if the proxy has a ...
stack_v2_sparse_classes_36k_train_033871
13,482
no_license
[ { "docstring": "Returns the number of confirmed requests in the last `horizon` requests.", "name": "confirmations_in_horizon", "signature": "def confirmations_in_horizon(self, horizon=None, active=False)" }, { "docstring": "Returns True if the proxy has a certain number of confirmations in the `...
4
null
Implement the Python class `ConfirmedMetrics` described below. Class description: Implement the ConfirmedMetrics class. Method signatures and docstrings: - def confirmations_in_horizon(self, horizon=None, active=False): Returns the number of confirmed requests in the last `horizon` requests. - def confirmed_in_horizo...
Implement the Python class `ConfirmedMetrics` described below. Class description: Implement the ConfirmedMetrics class. Method signatures and docstrings: - def confirmations_in_horizon(self, horizon=None, active=False): Returns the number of confirmed requests in the last `horizon` requests. - def confirmed_in_horizo...
e27d6ab0da018495a4b54e41a15cc84dc0df14ab
<|skeleton|> class ConfirmedMetrics: def confirmations_in_horizon(self, horizon=None, active=False): """Returns the number of confirmed requests in the last `horizon` requests.""" <|body_0|> def confirmed_in_horizon(self, horizon=None, active=False): """Returns True if the proxy has a ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConfirmedMetrics: def confirmations_in_horizon(self, horizon=None, active=False): """Returns the number of confirmed requests in the last `horizon` requests.""" confirmed_config = settings.proxies.pool.get('confirmation', {}) horizon = horizon or confirmed_config.get('horizon') ...
the_stack_v2_python_sparse
instattack/core/models/mixins.py
nickmflorin/instagram-attack
train
9
d18d96414d5f2d71fa0be07189bbaff67fbeb970
[ "from .traces import ScriptEndpointTrace\nif self.is_new():\n raise SyncanoValidationError('Method allowed only on existing model.')\nproperties = self.get_endpoint_data()\nhttp_method = 'POST'\nendpoint = self._meta.resolve_endpoint('run', properties, http_method)\nconnection = self._get_connection(**payload)\n...
<|body_start_0|> from .traces import ScriptEndpointTrace if self.is_new(): raise SyncanoValidationError('Method allowed only on existing model.') properties = self.get_endpoint_data() http_method = 'POST' endpoint = self._meta.resolve_endpoint('run', properties, http_...
OO wrapper around script endpoints `link <http://docs.syncano.com/docs/codebox-sockets>`_. :ivar name: :class:`~syncano.models.fields.SlugField` :ivar script: :class:`~syncano.models.fields.IntegerField` :ivar links: :class:`~syncano.models.fields.HyperlinkedField` .. note:: **ScriptEndpoint** has special method called...
ScriptEndpoint
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScriptEndpoint: """OO wrapper around script endpoints `link <http://docs.syncano.com/docs/codebox-sockets>`_. :ivar name: :class:`~syncano.models.fields.SlugField` :ivar script: :class:`~syncano.models.fields.IntegerField` :ivar links: :class:`~syncano.models.fields.HyperlinkedField` .. note:: **...
stack_v2_sparse_classes_36k_train_033872
13,042
no_license
[ { "docstring": "Usage:: >>> se = ScriptEndpoint.please.get('instance-name', 'script-name') >>> se.run() >>> se.run(variable_one=1, variable_two=2)", "name": "run", "signature": "def run(self, cache_key=None, **payload)" }, { "docstring": "Usage:: >>> se = ScriptEndpoint.please.get('instance-name...
2
stack_v2_sparse_classes_30k_train_001798
Implement the Python class `ScriptEndpoint` described below. Class description: OO wrapper around script endpoints `link <http://docs.syncano.com/docs/codebox-sockets>`_. :ivar name: :class:`~syncano.models.fields.SlugField` :ivar script: :class:`~syncano.models.fields.IntegerField` :ivar links: :class:`~syncano.model...
Implement the Python class `ScriptEndpoint` described below. Class description: OO wrapper around script endpoints `link <http://docs.syncano.com/docs/codebox-sockets>`_. :ivar name: :class:`~syncano.models.fields.SlugField` :ivar script: :class:`~syncano.models.fields.IntegerField` :ivar links: :class:`~syncano.model...
3a1cff87a565a075ca6f54bfe55089bb152fdbf3
<|skeleton|> class ScriptEndpoint: """OO wrapper around script endpoints `link <http://docs.syncano.com/docs/codebox-sockets>`_. :ivar name: :class:`~syncano.models.fields.SlugField` :ivar script: :class:`~syncano.models.fields.IntegerField` :ivar links: :class:`~syncano.models.fields.HyperlinkedField` .. note:: **...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ScriptEndpoint: """OO wrapper around script endpoints `link <http://docs.syncano.com/docs/codebox-sockets>`_. :ivar name: :class:`~syncano.models.fields.SlugField` :ivar script: :class:`~syncano.models.fields.IntegerField` :ivar links: :class:`~syncano.models.fields.HyperlinkedField` .. note:: **ScriptEndpoin...
the_stack_v2_python_sparse
syncano/models/incentives.py
Syncano/syncano-python
train
4
f655368559a0a5831d788afb6403534cfd7faa3b
[ "num.sort()\nn = len(num)\npositiveIndex = 1\norderI = 1\nwhile num[positiveIndex - 1] <= 0:\n positiveIndex += 1\nwhile num[positiveIndex - 1] == orderI:\n positiveIndex += 1\n orderI += 1\n if positiveIndex > n:\n break\nreturn orderI", "n = len(num)\nif 1 not in num or not num:\n return 1...
<|body_start_0|> num.sort() n = len(num) positiveIndex = 1 orderI = 1 while num[positiveIndex - 1] <= 0: positiveIndex += 1 while num[positiveIndex - 1] == orderI: positiveIndex += 1 orderI += 1 if positiveIndex > n: ...
Desc: Given an unsorted integer array, find the smallest missing positive integer.
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """Desc: Given an unsorted integer array, find the smallest missing positive integer.""" def firstMissingPositive1(self, num): """:type num: int :rtype: str""" <|body_0|> def firstMissingPositive(self, num): """:type num: int :rtype: str""" <|bo...
stack_v2_sparse_classes_36k_train_033873
1,172
no_license
[ { "docstring": ":type num: int :rtype: str", "name": "firstMissingPositive1", "signature": "def firstMissingPositive1(self, num)" }, { "docstring": ":type num: int :rtype: str", "name": "firstMissingPositive", "signature": "def firstMissingPositive(self, num)" } ]
2
stack_v2_sparse_classes_30k_train_018682
Implement the Python class `Solution` described below. Class description: Desc: Given an unsorted integer array, find the smallest missing positive integer. Method signatures and docstrings: - def firstMissingPositive1(self, num): :type num: int :rtype: str - def firstMissingPositive(self, num): :type num: int :rtype...
Implement the Python class `Solution` described below. Class description: Desc: Given an unsorted integer array, find the smallest missing positive integer. Method signatures and docstrings: - def firstMissingPositive1(self, num): :type num: int :rtype: str - def firstMissingPositive(self, num): :type num: int :rtype...
0fb8fa7d9ef65bee816a8aa35326b975d6fb7844
<|skeleton|> class Solution: """Desc: Given an unsorted integer array, find the smallest missing positive integer.""" def firstMissingPositive1(self, num): """:type num: int :rtype: str""" <|body_0|> def firstMissingPositive(self, num): """:type num: int :rtype: str""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """Desc: Given an unsorted integer array, find the smallest missing positive integer.""" def firstMissingPositive1(self, num): """:type num: int :rtype: str""" num.sort() n = len(num) positiveIndex = 1 orderI = 1 while num[positiveIndex - 1] <= 0:...
the_stack_v2_python_sparse
041-First Missing Positive.py
Damon0626/Leetcode-
train
1
545a599f7d48cab2fed0a8bde19fc66717a63538
[ "validate_part_name('hello world')\nwith self.assertRaises(django_exceptions.ValidationError):\n validate_part_name('This | name is not } valid')", "validate_overage('100%')\nvalidate_overage('10')\nvalidate_overage('45.2 %')\nwith self.assertRaises(django_exceptions.ValidationError):\n validate_overage('-1...
<|body_start_0|> validate_part_name('hello world') with self.assertRaises(django_exceptions.ValidationError): validate_part_name('This | name is not } valid') <|end_body_0|> <|body_start_1|> validate_overage('100%') validate_overage('10') validate_overage('45.2 %') ...
Simple tests for custom field validators.
ValidatorTest
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ValidatorTest: """Simple tests for custom field validators.""" def test_part_name(self): """Test part name validator.""" <|body_0|> def test_overage(self): """Test overage validator.""" <|body_1|> <|end_skeleton|> <|body_start_0|> validate_part_...
stack_v2_sparse_classes_36k_train_033874
28,979
permissive
[ { "docstring": "Test part name validator.", "name": "test_part_name", "signature": "def test_part_name(self)" }, { "docstring": "Test overage validator.", "name": "test_overage", "signature": "def test_overage(self)" } ]
2
null
Implement the Python class `ValidatorTest` described below. Class description: Simple tests for custom field validators. Method signatures and docstrings: - def test_part_name(self): Test part name validator. - def test_overage(self): Test overage validator.
Implement the Python class `ValidatorTest` described below. Class description: Simple tests for custom field validators. Method signatures and docstrings: - def test_part_name(self): Test part name validator. - def test_overage(self): Test overage validator. <|skeleton|> class ValidatorTest: """Simple tests for ...
5a08ef908dd5344b4433436a4679d122f7f99e41
<|skeleton|> class ValidatorTest: """Simple tests for custom field validators.""" def test_part_name(self): """Test part name validator.""" <|body_0|> def test_overage(self): """Test overage validator.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ValidatorTest: """Simple tests for custom field validators.""" def test_part_name(self): """Test part name validator.""" validate_part_name('hello world') with self.assertRaises(django_exceptions.ValidationError): validate_part_name('This | name is not } valid') d...
the_stack_v2_python_sparse
InvenTree/InvenTree/tests.py
onurtatli/InvenTree
train
0
bc0fe4a8d67442c495f0d2cc78000da764ecbb49
[ "self.n = len(words)\nself.wordIndex = {}\nfor i in xrange(self.n):\n word = words[i]\n if word in self.wordIndex:\n self.wordIndex[word].append(i)\n else:\n self.wordIndex[word] = [i]", "a, b = (self.wordIndex[word1], self.wordIndex[word2])\nm, n, i, j, res = (len(a), len(b), 0, 0, self.n)...
<|body_start_0|> self.n = len(words) self.wordIndex = {} for i in xrange(self.n): word = words[i] if word in self.wordIndex: self.wordIndex[word].append(i) else: self.wordIndex[word] = [i] <|end_body_0|> <|body_start_1|> ...
WordDistance
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WordDistance: def __init__(self, words): """initialize your data structure here. :type words: List[str]""" <|body_0|> def shortest(self, word1, word2): """Adds a word into the data structure. :type word1: str :type word2: str :rtype: int""" <|body_1|> <|end_...
stack_v2_sparse_classes_36k_train_033875
1,099
no_license
[ { "docstring": "initialize your data structure here. :type words: List[str]", "name": "__init__", "signature": "def __init__(self, words)" }, { "docstring": "Adds a word into the data structure. :type word1: str :type word2: str :rtype: int", "name": "shortest", "signature": "def shortes...
2
stack_v2_sparse_classes_30k_train_016951
Implement the Python class `WordDistance` described below. Class description: Implement the WordDistance class. Method signatures and docstrings: - def __init__(self, words): initialize your data structure here. :type words: List[str] - def shortest(self, word1, word2): Adds a word into the data structure. :type word...
Implement the Python class `WordDistance` described below. Class description: Implement the WordDistance class. Method signatures and docstrings: - def __init__(self, words): initialize your data structure here. :type words: List[str] - def shortest(self, word1, word2): Adds a word into the data structure. :type word...
f1b85a2bfee024ef3afdf2ca0b223842c2d2d3f3
<|skeleton|> class WordDistance: def __init__(self, words): """initialize your data structure here. :type words: List[str]""" <|body_0|> def shortest(self, word1, word2): """Adds a word into the data structure. :type word1: str :type word2: str :rtype: int""" <|body_1|> <|end_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WordDistance: def __init__(self, words): """initialize your data structure here. :type words: List[str]""" self.n = len(words) self.wordIndex = {} for i in xrange(self.n): word = words[i] if word in self.wordIndex: self.wordIndex[word].ap...
the_stack_v2_python_sparse
244-Shortest-Word-Distance-II/solution.py
Xochitlxie/Leetcode
train
0
c678bf6e311c441d9545e094dd1cb14e85c4091c
[ "self.problem = problem\nself.pp = post.PostProcessor(dict(casedir='Results', clean_casedir=True))\nself.pp.add_field(post.SolutionField('Solution', dict(save=True, save_as=['hdf5', 'xdmf'], plot=True, plot_args=dict(range_min=float(u_min), range_max=float(u_max)))))\nself.pp.add_field(post.SolutionField('Flux', di...
<|body_start_0|> self.problem = problem self.pp = post.PostProcessor(dict(casedir='Results', clean_casedir=True)) self.pp.add_field(post.SolutionField('Solution', dict(save=True, save_as=['hdf5', 'xdmf'], plot=True, plot_args=dict(range_min=float(u_min), range_max=float(u_max))))) self.p...
user_action function for storing the solution and flux.
ProcessSolution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProcessSolution: """user_action function for storing the solution and flux.""" def __init__(self, problem, u_min=0, u_max=1): """Define fields to be stored/plotted.""" <|body_0|> def __call__(self, t, u, timestep): """Store u and its flux to file.""" <|bo...
stack_v2_sparse_classes_36k_train_033876
19,607
no_license
[ { "docstring": "Define fields to be stored/plotted.", "name": "__init__", "signature": "def __init__(self, problem, u_min=0, u_max=1)" }, { "docstring": "Store u and its flux to file.", "name": "__call__", "signature": "def __call__(self, t, u, timestep)" } ]
2
stack_v2_sparse_classes_30k_train_010716
Implement the Python class `ProcessSolution` described below. Class description: user_action function for storing the solution and flux. Method signatures and docstrings: - def __init__(self, problem, u_min=0, u_max=1): Define fields to be stored/plotted. - def __call__(self, t, u, timestep): Store u and its flux to ...
Implement the Python class `ProcessSolution` described below. Class description: user_action function for storing the solution and flux. Method signatures and docstrings: - def __init__(self, problem, u_min=0, u_max=1): Define fields to be stored/plotted. - def __call__(self, t, u, timestep): Store u and its flux to ...
5e9a0e03aa7ddf5e5ddf89943ccc68d94b539e95
<|skeleton|> class ProcessSolution: """user_action function for storing the solution and flux.""" def __init__(self, problem, u_min=0, u_max=1): """Define fields to be stored/plotted.""" <|body_0|> def __call__(self, t, u, timestep): """Store u and its flux to file.""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProcessSolution: """user_action function for storing the solution and flux.""" def __init__(self, problem, u_min=0, u_max=1): """Define fields to be stored/plotted.""" self.problem = problem self.pp = post.PostProcessor(dict(casedir='Results', clean_casedir=True)) self.pp....
the_stack_v2_python_sparse
Solving_PDEs_in_Python_Langtangen/src/src/heat_class.py
burakbayramli/books
train
223
af788f1b33b24a6c2c3e80cb974c69b73c94106a
[ "try:\n response, status = (OrgService.get_contacts(org_id), http_status.HTTP_200_OK)\nexcept BusinessException as exception:\n response, status = ({'code': exception.code, 'message': exception.message}, exception.status_code)\nreturn (response, status)", "request_json = request.get_json()\nvalid_format, er...
<|body_start_0|> try: response, status = (OrgService.get_contacts(org_id), http_status.HTTP_200_OK) except BusinessException as exception: response, status = ({'code': exception.code, 'message': exception.message}, exception.status_code) return (response, status) <|end_bo...
Resource for managing org contacts.
OrgContacts
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrgContacts: """Resource for managing org contacts.""" def get(org_id): """Retrieve the set of contacts associated with the specified org.""" <|body_0|> def post(org_id): """Create a new contact for the specified org.""" <|body_1|> def put(org_id): ...
stack_v2_sparse_classes_36k_train_033877
30,185
permissive
[ { "docstring": "Retrieve the set of contacts associated with the specified org.", "name": "get", "signature": "def get(org_id)" }, { "docstring": "Create a new contact for the specified org.", "name": "post", "signature": "def post(org_id)" }, { "docstring": "Update an existing c...
4
stack_v2_sparse_classes_30k_val_000871
Implement the Python class `OrgContacts` described below. Class description: Resource for managing org contacts. Method signatures and docstrings: - def get(org_id): Retrieve the set of contacts associated with the specified org. - def post(org_id): Create a new contact for the specified org. - def put(org_id): Updat...
Implement the Python class `OrgContacts` described below. Class description: Resource for managing org contacts. Method signatures and docstrings: - def get(org_id): Retrieve the set of contacts associated with the specified org. - def post(org_id): Create a new contact for the specified org. - def put(org_id): Updat...
923cb8a3ee88dcbaf0fe800ca70022b3c13c1d01
<|skeleton|> class OrgContacts: """Resource for managing org contacts.""" def get(org_id): """Retrieve the set of contacts associated with the specified org.""" <|body_0|> def post(org_id): """Create a new contact for the specified org.""" <|body_1|> def put(org_id): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OrgContacts: """Resource for managing org contacts.""" def get(org_id): """Retrieve the set of contacts associated with the specified org.""" try: response, status = (OrgService.get_contacts(org_id), http_status.HTTP_200_OK) except BusinessException as exception: ...
the_stack_v2_python_sparse
auth-api/src/auth_api/resources/org.py
bcgov/sbc-auth
train
13
595542f64e8dbcdc6f9d8cf293b84c27dda263de
[ "user = request.user\nredis_conn = get_redis_connection('history')\nsku_ids = redis_conn.zrevrange('history_%s' % user.id, 0, 4)\nskus = []\nfor sku_id in sku_ids:\n sku = SKU.objects.get(id=sku_id)\n skus.append({'id': sku.id, 'name': sku.name, 'price': sku.price, 'default_image_url': sku.default_image.url})...
<|body_start_0|> user = request.user redis_conn = get_redis_connection('history') sku_ids = redis_conn.zrevrange('history_%s' % user.id, 0, 4) skus = [] for sku_id in sku_ids: sku = SKU.objects.get(id=sku_id) skus.append({'id': sku.id, 'name': sku.name, 'p...
用户浏览记录
UserBrowseHistory
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserBrowseHistory: """用户浏览记录""" def get(self, request): """查询用户浏览记录""" <|body_0|> def post(self, request): """保存用户浏览记录""" <|body_1|> <|end_skeleton|> <|body_start_0|> user = request.user redis_conn = get_redis_connection('history') ...
stack_v2_sparse_classes_36k_train_033878
22,758
permissive
[ { "docstring": "查询用户浏览记录", "name": "get", "signature": "def get(self, request)" }, { "docstring": "保存用户浏览记录", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_test_000027
Implement the Python class `UserBrowseHistory` described below. Class description: 用户浏览记录 Method signatures and docstrings: - def get(self, request): 查询用户浏览记录 - def post(self, request): 保存用户浏览记录
Implement the Python class `UserBrowseHistory` described below. Class description: 用户浏览记录 Method signatures and docstrings: - def get(self, request): 查询用户浏览记录 - def post(self, request): 保存用户浏览记录 <|skeleton|> class UserBrowseHistory: """用户浏览记录""" def get(self, request): """查询用户浏览记录""" <|body_...
2434231795b3319dfda60b19af18442ee5f6fa73
<|skeleton|> class UserBrowseHistory: """用户浏览记录""" def get(self, request): """查询用户浏览记录""" <|body_0|> def post(self, request): """保存用户浏览记录""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserBrowseHistory: """用户浏览记录""" def get(self, request): """查询用户浏览记录""" user = request.user redis_conn = get_redis_connection('history') sku_ids = redis_conn.zrevrange('history_%s' % user.id, 0, 4) skus = [] for sku_id in sku_ids: sku = SKU.objec...
the_stack_v2_python_sparse
meiduo_project/meiduo_mall/meiduo_mall/apps/users/views.py
xlztongxue/meiduoshangcheng
train
0
464949bfc4b9cc9a9708f74e2ea77e2221ddff98
[ "super(GRUCell, self).__init__()\nself._device = device\nself._input_size = input_size\nself._hidden_size = hidden_size\nself._layer_norm = layer_norm\nself._W_i2r = nn.Parameter(torch.Tensor(input_size, hidden_size))\nself._W_h2r = nn.Parameter(torch.Tensor(hidden_size, hidden_size))\nself._b_r = nn.Parameter(torc...
<|body_start_0|> super(GRUCell, self).__init__() self._device = device self._input_size = input_size self._hidden_size = hidden_size self._layer_norm = layer_norm self._W_i2r = nn.Parameter(torch.Tensor(input_size, hidden_size)) self._W_h2r = nn.Parameter(torch.Te...
Implementation of a GRU cell based on https://arxiv.org/pdf/1412.3555.pdf
GRUCell
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GRUCell: """Implementation of a GRU cell based on https://arxiv.org/pdf/1412.3555.pdf""" def __init__(self, device, input_size, hidden_size, layer_norm=False): """Initializes a GRU Cell. Args: device: torch device object. input_size: int, size of the input vector. hidden_size: int, R...
stack_v2_sparse_classes_36k_train_033879
3,421
no_license
[ { "docstring": "Initializes a GRU Cell. Args: device: torch device object. input_size: int, size of the input vector. hidden_size: int, RNN hidden layer dimension.", "name": "__init__", "signature": "def __init__(self, device, input_size, hidden_size, layer_norm=False)" }, { "docstring": "Implem...
4
null
Implement the Python class `GRUCell` described below. Class description: Implementation of a GRU cell based on https://arxiv.org/pdf/1412.3555.pdf Method signatures and docstrings: - def __init__(self, device, input_size, hidden_size, layer_norm=False): Initializes a GRU Cell. Args: device: torch device object. input...
Implement the Python class `GRUCell` described below. Class description: Implementation of a GRU cell based on https://arxiv.org/pdf/1412.3555.pdf Method signatures and docstrings: - def __init__(self, device, input_size, hidden_size, layer_norm=False): Initializes a GRU Cell. Args: device: torch device object. input...
cfbb1ec62ddbda639ab4f21f47d35c6d06e2d55d
<|skeleton|> class GRUCell: """Implementation of a GRU cell based on https://arxiv.org/pdf/1412.3555.pdf""" def __init__(self, device, input_size, hidden_size, layer_norm=False): """Initializes a GRU Cell. Args: device: torch device object. input_size: int, size of the input vector. hidden_size: int, R...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GRUCell: """Implementation of a GRU cell based on https://arxiv.org/pdf/1412.3555.pdf""" def __init__(self, device, input_size, hidden_size, layer_norm=False): """Initializes a GRU Cell. Args: device: torch device object. input_size: int, size of the input vector. hidden_size: int, RNN hidden lay...
the_stack_v2_python_sparse
myTorch/memory/GRUCell.py
apsarath/myTorch
train
0
260008cb08d4596459986159ddbae9298b1fbcef
[ "if DbManager.connection_string == None:\n if current_app.config.get('DEBUG'):\n DbManager.connection_string = 'mysql+mysqldb://{user}:{password}@{host}/{database}'.format(user=current_app.config.get('CLOUDSQL_USER'), password=current_app.config.get('CLOUDSQL_PASSWORD'), host=current_app.config.get('DB_HO...
<|body_start_0|> if DbManager.connection_string == None: if current_app.config.get('DEBUG'): DbManager.connection_string = 'mysql+mysqldb://{user}:{password}@{host}/{database}'.format(user=current_app.config.get('CLOUDSQL_USER'), password=current_app.config.get('CLOUDSQL_PASSWORD'), ...
Clase encargada de establecer la conexión con la base de datos
DbManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DbManager: """Clase encargada de establecer la conexión con la base de datos""" def set_connection_string(): """Establecer la cadena de conexión dependiendo del entorno :return:""" <|body_0|> def get_database_session(): """Obtener una sesión de la base de datos :...
stack_v2_sparse_classes_36k_train_033880
1,985
no_license
[ { "docstring": "Establecer la cadena de conexión dependiendo del entorno :return:", "name": "set_connection_string", "signature": "def set_connection_string()" }, { "docstring": "Obtener una sesión de la base de datos :return:", "name": "get_database_session", "signature": "def get_datab...
2
stack_v2_sparse_classes_30k_train_011638
Implement the Python class `DbManager` described below. Class description: Clase encargada de establecer la conexión con la base de datos Method signatures and docstrings: - def set_connection_string(): Establecer la cadena de conexión dependiendo del entorno :return: - def get_database_session(): Obtener una sesión ...
Implement the Python class `DbManager` described below. Class description: Clase encargada de establecer la conexión con la base de datos Method signatures and docstrings: - def set_connection_string(): Establecer la cadena de conexión dependiendo del entorno :return: - def get_database_session(): Obtener una sesión ...
aa16640032cb85340a7d64781e521d752d2b4a95
<|skeleton|> class DbManager: """Clase encargada de establecer la conexión con la base de datos""" def set_connection_string(): """Establecer la cadena de conexión dependiendo del entorno :return:""" <|body_0|> def get_database_session(): """Obtener una sesión de la base de datos :...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DbManager: """Clase encargada de establecer la conexión con la base de datos""" def set_connection_string(): """Establecer la cadena de conexión dependiendo del entorno :return:""" if DbManager.connection_string == None: if current_app.config.get('DEBUG'): DbMa...
the_stack_v2_python_sparse
service/src/db_manager.py
Kaykos/concept
train
0
403f790395687e6a12d3be776685d040b5cfe9cf
[ "result = ''\nfor integer in self.roman:\n while True:\n if num >= integer[1]:\n result += integer[0]\n num -= integer[1]\n else:\n break\nreturn result", "num = 0\nroman_dict = dict(self.roman)\nfor letter in range(len(cs)):\n if letter > 0 and roman_dict[cs[l...
<|body_start_0|> result = '' for integer in self.roman: while True: if num >= integer[1]: result += integer[0] num -= integer[1] else: break return result <|end_body_0|> <|body_start_1|> ...
roman_integer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class roman_integer: def int_to_roman(self, num): """" converts a number to a roman numeral""" <|body_0|> def roman_to_int(self, cs): """converts a roman numeral to a normal number""" <|body_1|> <|end_skeleton|> <|body_start_0|> result = '' for in...
stack_v2_sparse_classes_36k_train_033881
4,375
no_license
[ { "docstring": "\" converts a number to a roman numeral", "name": "int_to_roman", "signature": "def int_to_roman(self, num)" }, { "docstring": "converts a roman numeral to a normal number", "name": "roman_to_int", "signature": "def roman_to_int(self, cs)" } ]
2
null
Implement the Python class `roman_integer` described below. Class description: Implement the roman_integer class. Method signatures and docstrings: - def int_to_roman(self, num): " converts a number to a roman numeral - def roman_to_int(self, cs): converts a roman numeral to a normal number
Implement the Python class `roman_integer` described below. Class description: Implement the roman_integer class. Method signatures and docstrings: - def int_to_roman(self, num): " converts a number to a roman numeral - def roman_to_int(self, cs): converts a roman numeral to a normal number <|skeleton|> class roman_...
929dde1723fb2f54870c8a9badc80fc23e8400d3
<|skeleton|> class roman_integer: def int_to_roman(self, num): """" converts a number to a roman numeral""" <|body_0|> def roman_to_int(self, cs): """converts a roman numeral to a normal number""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class roman_integer: def int_to_roman(self, num): """" converts a number to a roman numeral""" result = '' for integer in self.roman: while True: if num >= integer[1]: result += integer[0] num -= integer[1] e...
the_stack_v2_python_sparse
_algorithms_challenges/w3resource/Practice_python-master/Pyhon_class.py
syurskyi/Algorithms_and_Data_Structure
train
4
923ebc335f0719fb5328f2ce9923e1af5fc2ab9d
[ "if not s or not t:\n return ''\ncounter_s = Counter(s)\ncounter_t = Counter(t)\nif not all((counter_s[k] >= counter_t[k] for k in counter_t.keys())):\n return ''\nlen_s, len_t = (len(s), len(t))\nleft, right = (0, 0)\nresult = s\nneed = {k: v for k, v in counter_t.items()}\nwhile right < len_s:\n if max(n...
<|body_start_0|> if not s or not t: return '' counter_s = Counter(s) counter_t = Counter(t) if not all((counter_s[k] >= counter_t[k] for k in counter_t.keys())): return '' len_s, len_t = (len(s), len(t)) left, right = (0, 0) result = s ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minWindow2(self, s: str, t: str) -> str: """20190929 题设的要求是, 不仅要包含所有的字母, 而且字母个数也要符合要求 执行用时 :1524 ms, 在所有 Python3 提交中击败了6.02% 的用户 内存消耗 :14.6 MB, 在所有 Python3 提交中击败了15.00%的用户 滑动窗口的思想我明白, 但是边界问题还是处理不好 把 win 替换成 need, 检查窗口是否合法的效率上有所提高 (5 倍), 但还是差了点啊 执行用时 :320 ms, 在所有 Python3 提交中...
stack_v2_sparse_classes_36k_train_033882
3,751
no_license
[ { "docstring": "20190929 题设的要求是, 不仅要包含所有的字母, 而且字母个数也要符合要求 执行用时 :1524 ms, 在所有 Python3 提交中击败了6.02% 的用户 内存消耗 :14.6 MB, 在所有 Python3 提交中击败了15.00%的用户 滑动窗口的思想我明白, 但是边界问题还是处理不好 把 win 替换成 need, 检查窗口是否合法的效率上有所提高 (5 倍), 但还是差了点啊 执行用时 :320 ms, 在所有 Python3 提交中击败了32.13% 的用户 内存消耗 :14.5 MB, 在所有 Python3 提交中击败了15.00%的用户", "na...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minWindow2(self, s: str, t: str) -> str: 20190929 题设的要求是, 不仅要包含所有的字母, 而且字母个数也要符合要求 执行用时 :1524 ms, 在所有 Python3 提交中击败了6.02% 的用户 内存消耗 :14.6 MB, 在所有 Python3 提交中击败了15.00%的用户 滑动窗口的...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minWindow2(self, s: str, t: str) -> str: 20190929 题设的要求是, 不仅要包含所有的字母, 而且字母个数也要符合要求 执行用时 :1524 ms, 在所有 Python3 提交中击败了6.02% 的用户 内存消耗 :14.6 MB, 在所有 Python3 提交中击败了15.00%的用户 滑动窗口的...
99a3abf1774933af73a8405f9b59e5e64906bca4
<|skeleton|> class Solution: def minWindow2(self, s: str, t: str) -> str: """20190929 题设的要求是, 不仅要包含所有的字母, 而且字母个数也要符合要求 执行用时 :1524 ms, 在所有 Python3 提交中击败了6.02% 的用户 内存消耗 :14.6 MB, 在所有 Python3 提交中击败了15.00%的用户 滑动窗口的思想我明白, 但是边界问题还是处理不好 把 win 替换成 need, 检查窗口是否合法的效率上有所提高 (5 倍), 但还是差了点啊 执行用时 :320 ms, 在所有 Python3 提交中...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minWindow2(self, s: str, t: str) -> str: """20190929 题设的要求是, 不仅要包含所有的字母, 而且字母个数也要符合要求 执行用时 :1524 ms, 在所有 Python3 提交中击败了6.02% 的用户 内存消耗 :14.6 MB, 在所有 Python3 提交中击败了15.00%的用户 滑动窗口的思想我明白, 但是边界问题还是处理不好 把 win 替换成 need, 检查窗口是否合法的效率上有所提高 (5 倍), 但还是差了点啊 执行用时 :320 ms, 在所有 Python3 提交中击败了32.13% 的用户 ...
the_stack_v2_python_sparse
leetcode/76.minimum-window-substring.py
iamkissg/leetcode
train
0
914928948a5e56bdf4bf6117e2faa0ea7824712c
[ "state_id = self.request.get('sid')\nif not state_id:\n self.ReportError('Missing required parameters.', status=400)\n return\nstate = ndb.Key(page_state.PageState, state_id).get()\nif not state:\n self.ReportError('Invalid sid.', status=400)\n return\nif self.request.get('v2', None) is None:\n self....
<|body_start_0|> state_id = self.request.get('sid') if not state_id: self.ReportError('Missing required parameters.', status=400) return state = ndb.Key(page_state.PageState, state_id).get() if not state: self.ReportError('Invalid sid.', status=400) ...
Handles short URI.
ShortUriHandler
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShortUriHandler: """Handles short URI.""" def get(self): """Handles getting page states.""" <|body_0|> def post(self): """Handles saving page states and getting state id.""" <|body_1|> <|end_skeleton|> <|body_start_0|> state_id = self.request.ge...
stack_v2_sparse_classes_36k_train_033883
3,613
permissive
[ { "docstring": "Handles getting page states.", "name": "get", "signature": "def get(self)" }, { "docstring": "Handles saving page states and getting state id.", "name": "post", "signature": "def post(self)" } ]
2
null
Implement the Python class `ShortUriHandler` described below. Class description: Handles short URI. Method signatures and docstrings: - def get(self): Handles getting page states. - def post(self): Handles saving page states and getting state id.
Implement the Python class `ShortUriHandler` described below. Class description: Handles short URI. Method signatures and docstrings: - def get(self): Handles getting page states. - def post(self): Handles saving page states and getting state id. <|skeleton|> class ShortUriHandler: """Handles short URI.""" ...
53102de187a48ac2cfc241fef54dcbc29c453a8e
<|skeleton|> class ShortUriHandler: """Handles short URI.""" def get(self): """Handles getting page states.""" <|body_0|> def post(self): """Handles saving page states and getting state id.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ShortUriHandler: """Handles short URI.""" def get(self): """Handles getting page states.""" state_id = self.request.get('sid') if not state_id: self.ReportError('Missing required parameters.', status=400) return state = ndb.Key(page_state.PageState,...
the_stack_v2_python_sparse
dashboard/dashboard/short_uri.py
catapult-project/catapult
train
2,032
d4873078fa15995f3cd14cdad05d7fa9544c3801
[ "self.server = server\nself.sender = sender\nself.recipient = recipient\nself.logger = logger", "if socket.gethostname().find('.') >= 0:\n hostname = socket.gethostname()\nelse:\n hostname = socket.gethostbyaddr(socket.gethostname())[0]\nlocaltime = time.asctime(time.localtime(time.time()))\njob = inspect.s...
<|body_start_0|> self.server = server self.sender = sender self.recipient = recipient self.logger = logger <|end_body_0|> <|body_start_1|> if socket.gethostname().find('.') >= 0: hostname = socket.gethostname() else: hostname = socket.gethostbyadd...
notify
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class notify: def __init__(self, server, sender, recipient, logger=None): """Constructor""" <|body_0|> def send(self, subject, message): """Send an email message""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.server = server self.sender = se...
stack_v2_sparse_classes_36k_train_033884
2,629
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, server, sender, recipient, logger=None)" }, { "docstring": "Send an email message", "name": "send", "signature": "def send(self, subject, message)" } ]
2
null
Implement the Python class `notify` described below. Class description: Implement the notify class. Method signatures and docstrings: - def __init__(self, server, sender, recipient, logger=None): Constructor - def send(self, subject, message): Send an email message
Implement the Python class `notify` described below. Class description: Implement the notify class. Method signatures and docstrings: - def __init__(self, server, sender, recipient, logger=None): Constructor - def send(self, subject, message): Send an email message <|skeleton|> class notify: def __init__(self, ...
db90c1d0a94fef527250687f960c1b1733e12c9f
<|skeleton|> class notify: def __init__(self, server, sender, recipient, logger=None): """Constructor""" <|body_0|> def send(self, subject, message): """Send an email message""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class notify: def __init__(self, server, sender, recipient, logger=None): """Constructor""" self.server = server self.sender = sender self.recipient = recipient self.logger = logger def send(self, subject, message): """Send an email message""" if socket.g...
the_stack_v2_python_sparse
qclasses/qemail.py
abhay123lp/quinico
train
0
5a7c5fc8ca6cbd6a2f3105cac2c37bf878eddfa5
[ "super().__init__(number)\nself.platform = platform\nself.length_of_display = display_size", "assert not text.embed_commas\nmapping = TextToSegmentMapper.map_segment_text_to_segments(text, self.length_of_display, FOURTEEN_SEGMENTS)\nresult = map(lambda x: x.get_vpe_encoding(), mapping)\ncommand = platform_pb2.Com...
<|body_start_0|> super().__init__(number) self.platform = platform self.length_of_display = display_size <|end_body_0|> <|body_start_1|> assert not text.embed_commas mapping = TextToSegmentMapper.map_segment_text_to_segments(text, self.length_of_display, FOURTEEN_SEGMENTS) ...
VPE segment display.
VisualPinballEngineSegmentDisplay
[ "MIT", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VisualPinballEngineSegmentDisplay: """VPE segment display.""" def __init__(self, number, display_size, platform): """Initialise segment display.""" <|body_0|> def _set_text(self, text: ColoredSegmentDisplayText) -> None: """Set text to VPE segment displays.""" ...
stack_v2_sparse_classes_36k_train_033885
18,330
permissive
[ { "docstring": "Initialise segment display.", "name": "__init__", "signature": "def __init__(self, number, display_size, platform)" }, { "docstring": "Set text to VPE segment displays.", "name": "_set_text", "signature": "def _set_text(self, text: ColoredSegmentDisplayText) -> None" } ...
2
stack_v2_sparse_classes_30k_train_002002
Implement the Python class `VisualPinballEngineSegmentDisplay` described below. Class description: VPE segment display. Method signatures and docstrings: - def __init__(self, number, display_size, platform): Initialise segment display. - def _set_text(self, text: ColoredSegmentDisplayText) -> None: Set text to VPE se...
Implement the Python class `VisualPinballEngineSegmentDisplay` described below. Class description: VPE segment display. Method signatures and docstrings: - def __init__(self, number, display_size, platform): Initialise segment display. - def _set_text(self, text: ColoredSegmentDisplayText) -> None: Set text to VPE se...
9f90c8b1586363b65340017bfa3af5d56d32c6d9
<|skeleton|> class VisualPinballEngineSegmentDisplay: """VPE segment display.""" def __init__(self, number, display_size, platform): """Initialise segment display.""" <|body_0|> def _set_text(self, text: ColoredSegmentDisplayText) -> None: """Set text to VPE segment displays.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VisualPinballEngineSegmentDisplay: """VPE segment display.""" def __init__(self, number, display_size, platform): """Initialise segment display.""" super().__init__(number) self.platform = platform self.length_of_display = display_size def _set_text(self, text: Colore...
the_stack_v2_python_sparse
mpf/platforms/visual_pinball_engine/visual_pinball_engine.py
missionpinball/mpf
train
191
1b347eeca875b9f23267b7e75ac82238e49b9c2c
[ "super(Inception4e, self).__init__()\nbranch1_list = [{'type': ConvBNLayer, 'num_channels': num_channels, 'num_filters': ch3x3reduced, 'filter_size': 1, 'stride': 1, 'padding': 0, 'act': 'relu'}, {'type': ConvBNLayer, 'num_channels': ch3x3reduced, 'num_filters': ch3x3, 'filter_size': 3, 'stride': 2, 'padding': 1, '...
<|body_start_0|> super(Inception4e, self).__init__() branch1_list = [{'type': ConvBNLayer, 'num_channels': num_channels, 'num_filters': ch3x3reduced, 'filter_size': 1, 'stride': 1, 'padding': 0, 'act': 'relu'}, {'type': ConvBNLayer, 'num_channels': ch3x3reduced, 'num_filters': ch3x3, 'filter_size': 3, '...
Inception4e
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Inception4e: def __init__(self, num_channels, ch3x3reduced, ch3x3, doublech3x3reduced, doublech3x3_1, doublech3x3_2, pool_proj): """@Brief `Inception4e` @Parameters num_channels : channel numbers of input tensor ch1x1 : output channel numbers of 1x1 conv ch3x3reduced : channel numbers of...
stack_v2_sparse_classes_36k_train_033886
22,436
permissive
[ { "docstring": "@Brief `Inception4e` @Parameters num_channels : channel numbers of input tensor ch1x1 : output channel numbers of 1x1 conv ch3x3reduced : channel numbers of 1x1 conv before 3x3 conv ch3x3 : output channel numbers of 3x3 conv doublech3x3reduced : channel numbers of 1x1 conv before the double 3x3 ...
2
stack_v2_sparse_classes_30k_train_008118
Implement the Python class `Inception4e` described below. Class description: Implement the Inception4e class. Method signatures and docstrings: - def __init__(self, num_channels, ch3x3reduced, ch3x3, doublech3x3reduced, doublech3x3_1, doublech3x3_2, pool_proj): @Brief `Inception4e` @Parameters num_channels : channel ...
Implement the Python class `Inception4e` described below. Class description: Implement the Inception4e class. Method signatures and docstrings: - def __init__(self, num_channels, ch3x3reduced, ch3x3, doublech3x3reduced, doublech3x3_1, doublech3x3_2, pool_proj): @Brief `Inception4e` @Parameters num_channels : channel ...
78ff3c3ab3906012a0f4a612251347632aa493a7
<|skeleton|> class Inception4e: def __init__(self, num_channels, ch3x3reduced, ch3x3, doublech3x3reduced, doublech3x3_1, doublech3x3_2, pool_proj): """@Brief `Inception4e` @Parameters num_channels : channel numbers of input tensor ch1x1 : output channel numbers of 1x1 conv ch3x3reduced : channel numbers of...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Inception4e: def __init__(self, num_channels, ch3x3reduced, ch3x3, doublech3x3reduced, doublech3x3_1, doublech3x3_2, pool_proj): """@Brief `Inception4e` @Parameters num_channels : channel numbers of input tensor ch1x1 : output channel numbers of 1x1 conv ch3x3reduced : channel numbers of 1x1 conv befo...
the_stack_v2_python_sparse
ECO/paddle1.8/model/ECO.py
thinkall/Contrib
train
1
bd96779cbd1a8e8c860370b167a87a20102decab
[ "if root == None:\n return ''\nres = []\nq = collections.deque()\nq.append(root)\nwhile q:\n x = q.popleft()\n if x:\n res.append(str(x.val))\n q.append(x.left)\n q.append(x.right)\n else:\n res.append('None')\nreturn ','.join(res)", "if data == '':\n return None\ndata =...
<|body_start_0|> if root == None: return '' res = [] q = collections.deque() q.append(root) while q: x = q.popleft() if x: res.append(str(x.val)) q.append(x.left) q.append(x.right) els...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_033887
1,591
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
c745168a01380edb52155ca3918787d2dd356e5b
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if root == None: return '' res = [] q = collections.deque() q.append(root) while q: x = q.popleft() if x: ...
the_stack_v2_python_sparse
pythonAlgorithm/Practice/hard/297二叉树的序列化与反序列化.py
bossjoker1/algorithm
train
4
58542b1e771c416d52bd63fc2cef3876e04e4e25
[ "if matrix:\n self.__s = [[0 for _ in range(len(matrix[0]) + 1)] for _ in range(len(matrix) + 1)]\n for i in range(1, len(matrix) + 1):\n for j in range(1, len(matrix[0]) + 1):\n self.__s[i][j] = self.__s[i - 1][j] + self.__s[i][j - 1] - self.__s[i - 1][j - 1] + matrix[i - 1][j - 1]\nelse:\n...
<|body_start_0|> if matrix: self.__s = [[0 for _ in range(len(matrix[0]) + 1)] for _ in range(len(matrix) + 1)] for i in range(1, len(matrix) + 1): for j in range(1, len(matrix[0]) + 1): self.__s[i][j] = self.__s[i - 1][j] + self.__s[i][j - 1] - self._...
NumMatrix
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """:type row1: int :type col1: int :type row2: int :type col2: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_36k_train_033888
980
no_license
[ { "docstring": ":type matrix: List[List[int]]", "name": "__init__", "signature": "def __init__(self, matrix)" }, { "docstring": ":type row1: int :type col1: int :type row2: int :type col2: int :rtype: int", "name": "sumRegion", "signature": "def sumRegion(self, row1, col1, row2, col2)" ...
2
null
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:...
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:...
bccd0f6ebb00e9569093f8ec18ebf0e94035dce6
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """:type row1: int :type col1: int :type row2: int :type col2: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" if matrix: self.__s = [[0 for _ in range(len(matrix[0]) + 1)] for _ in range(len(matrix) + 1)] for i in range(1, len(matrix) + 1): for j in range(1, len(matrix[0]) + 1): ...
the_stack_v2_python_sparse
Range Sum Query 2D - Immutable.py
nan0445/Leetcode-Python
train
0
ea1eb37a0b409262b7b18ccb5509ede5cb6b841d
[ "super().__init__(**kwargs)\nself.data = None\nself.visited = None\nself.blocks = None\nself.last_activity_time = None\nself.last_visited = None", "review_request = self.review_request\nself.visited, self.last_visited = self.track_review_request_visit()\ndata = ReviewRequestPageData(review_request=review_request,...
<|body_start_0|> super().__init__(**kwargs) self.data = None self.visited = None self.blocks = None self.last_activity_time = None self.last_visited = None <|end_body_0|> <|body_start_1|> review_request = self.review_request self.visited, self.last_visite...
A view for the main review request page. This page shows information on the review request, all the reviews and issues that have been posted, and the status updates made on uploaded changes.
ReviewRequestDetailView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReviewRequestDetailView: """A view for the main review request page. This page shows information on the review request, all the reviews and issues that have been posted, and the status updates made on uploaded changes.""" def __init__(self, **kwargs) -> None: """Initialize a view for...
stack_v2_sparse_classes_36k_train_033889
9,999
permissive
[ { "docstring": "Initialize a view for the request. Args: **kwargs (dict): Keyword arguments passed to :py:meth:`as_view`.", "name": "__init__", "signature": "def __init__(self, **kwargs) -> None" }, { "docstring": "Return an ETag for the view. This will look up state needed for the request and g...
5
null
Implement the Python class `ReviewRequestDetailView` described below. Class description: A view for the main review request page. This page shows information on the review request, all the reviews and issues that have been posted, and the status updates made on uploaded changes. Method signatures and docstrings: - de...
Implement the Python class `ReviewRequestDetailView` described below. Class description: A view for the main review request page. This page shows information on the review request, all the reviews and issues that have been posted, and the status updates made on uploaded changes. Method signatures and docstrings: - de...
c3a991f1e9d7682239a1ab0e8661cee6da01d537
<|skeleton|> class ReviewRequestDetailView: """A view for the main review request page. This page shows information on the review request, all the reviews and issues that have been posted, and the status updates made on uploaded changes.""" def __init__(self, **kwargs) -> None: """Initialize a view for...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReviewRequestDetailView: """A view for the main review request page. This page shows information on the review request, all the reviews and issues that have been posted, and the status updates made on uploaded changes.""" def __init__(self, **kwargs) -> None: """Initialize a view for the request....
the_stack_v2_python_sparse
reviewboard/reviews/views/review_request_detail.py
reviewboard/reviewboard
train
1,141
25431300491e13c1f707034cc13176048c0f791f
[ "del dest, default\nself._flag_instance = flag_instance\nflag_names = [self._flag_instance.name]\nif self._flag_instance.short_name:\n flag_names.append(self._flag_instance.short_name)\nself._flag_names = frozenset(flag_names)\nsuper(_BooleanFlagAction, self).__init__(option_strings=option_strings, dest=argparse...
<|body_start_0|> del dest, default self._flag_instance = flag_instance flag_names = [self._flag_instance.name] if self._flag_instance.short_name: flag_names.append(self._flag_instance.short_name) self._flag_names = frozenset(flag_names) super(_BooleanFlagActio...
Action class for Abseil boolean flags.
_BooleanFlagAction
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _BooleanFlagAction: """Action class for Abseil boolean flags.""" def __init__(self, option_strings, dest, help, metavar, flag_instance, default=argparse.SUPPRESS): """Initializes _BooleanFlagAction. Args: option_strings: See argparse.Action. dest: Ignored. The flag is always defined ...
stack_v2_sparse_classes_36k_train_033890
14,437
permissive
[ { "docstring": "Initializes _BooleanFlagAction. Args: option_strings: See argparse.Action. dest: Ignored. The flag is always defined with dest=argparse.SUPPRESS. help: See argparse.Action. metavar: See argparse.Action. flag_instance: absl.flags.Flag, the absl flag instance. default: Ignored. The flag always use...
2
null
Implement the Python class `_BooleanFlagAction` described below. Class description: Action class for Abseil boolean flags. Method signatures and docstrings: - def __init__(self, option_strings, dest, help, metavar, flag_instance, default=argparse.SUPPRESS): Initializes _BooleanFlagAction. Args: option_strings: See ar...
Implement the Python class `_BooleanFlagAction` described below. Class description: Action class for Abseil boolean flags. Method signatures and docstrings: - def __init__(self, option_strings, dest, help, metavar, flag_instance, default=argparse.SUPPRESS): Initializes _BooleanFlagAction. Args: option_strings: See ar...
171aae3f9c57b41089e25ec61fc84c35baa3079d
<|skeleton|> class _BooleanFlagAction: """Action class for Abseil boolean flags.""" def __init__(self, option_strings, dest, help, metavar, flag_instance, default=argparse.SUPPRESS): """Initializes _BooleanFlagAction. Args: option_strings: See argparse.Action. dest: Ignored. The flag is always defined ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _BooleanFlagAction: """Action class for Abseil boolean flags.""" def __init__(self, option_strings, dest, help, metavar, flag_instance, default=argparse.SUPPRESS): """Initializes _BooleanFlagAction. Args: option_strings: See argparse.Action. dest: Ignored. The flag is always defined with dest=arg...
the_stack_v2_python_sparse
third_party/py/abseil/absl/flags/argparse_flags.py
bazelbuild/bazel
train
20,294
80cc66fa2d1c9cb3fbe89a096b85b6c23880e261
[ "plantform_dict = self.init_platform_args()\nself.pat_driver = self.init_driver(plantform_dict)\nself.pat = OperateElement(self.pat_driver)", "platform_sec_ops = {'testplatform1': ['platform_name', 'platform_version', 'device_name', 'app_package', 'app_activity']}\nplatform_config = conf_args.ConfigArgs('../conf/...
<|body_start_0|> plantform_dict = self.init_platform_args() self.pat_driver = self.init_driver(plantform_dict) self.pat = OperateElement(self.pat_driver) <|end_body_0|> <|body_start_1|> platform_sec_ops = {'testplatform1': ['platform_name', 'platform_version', 'device_name', 'app_packag...
StartPatient
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StartPatient: def __init__(self): """类初始化函数""" <|body_0|> def init_platform_args(): """初始化: 获取 测试平台 参数 :return: 参数字典 plantform_config""" <|body_1|> def init_driver(plantform_dict): """初始化 webdriver :return: driver""" <|body_2|> <|end_ske...
stack_v2_sparse_classes_36k_train_033891
2,057
no_license
[ { "docstring": "类初始化函数", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "初始化: 获取 测试平台 参数 :return: 参数字典 plantform_config", "name": "init_platform_args", "signature": "def init_platform_args()" }, { "docstring": "初始化 webdriver :return: driver", "name": ...
3
stack_v2_sparse_classes_30k_train_017955
Implement the Python class `StartPatient` described below. Class description: Implement the StartPatient class. Method signatures and docstrings: - def __init__(self): 类初始化函数 - def init_platform_args(): 初始化: 获取 测试平台 参数 :return: 参数字典 plantform_config - def init_driver(plantform_dict): 初始化 webdriver :return: driver
Implement the Python class `StartPatient` described below. Class description: Implement the StartPatient class. Method signatures and docstrings: - def __init__(self): 类初始化函数 - def init_platform_args(): 初始化: 获取 测试平台 参数 :return: 参数字典 plantform_config - def init_driver(plantform_dict): 初始化 webdriver :return: driver <|...
b7152a6157bf6fc40d063149deb55aa89c793bb0
<|skeleton|> class StartPatient: def __init__(self): """类初始化函数""" <|body_0|> def init_platform_args(): """初始化: 获取 测试平台 参数 :return: 参数字典 plantform_config""" <|body_1|> def init_driver(plantform_dict): """初始化 webdriver :return: driver""" <|body_2|> <|end_ske...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StartPatient: def __init__(self): """类初始化函数""" plantform_dict = self.init_platform_args() self.pat_driver = self.init_driver(plantform_dict) self.pat = OperateElement(self.pat_driver) def init_platform_args(): """初始化: 获取 测试平台 参数 :return: 参数字典 plantform_config""" ...
the_stack_v2_python_sparse
business/startPatient.py
fendou345/app_auto
train
0
bab346dbdb547045bd0cbe189f12d4a36ded41c6
[ "curr = 0\ntotal = 1\nfor page in books:\n if curr + page > min_pages:\n total += 1\n curr = 0\n curr += page\nreturn total", "if m > len(books) or not m:\n return -1\nlow = max(books)\nhigh = sum(books)\nwhile low < high:\n mid = (low + high) // 2\n result = self.count_students(books...
<|body_start_0|> curr = 0 total = 1 for page in books: if curr + page > min_pages: total += 1 curr = 0 curr += page return total <|end_body_0|> <|body_start_1|> if m > len(books) or not m: return -1 low ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def count_students(self, books, min_pages): """Returns number of students needed if you assign to each student min_pages. Time complexity: O(n). Space complexity: O(1), n is len(books).""" <|body_0|> def min_pages(self, books, m): """Returns minimum number ...
stack_v2_sparse_classes_36k_train_033892
2,089
no_license
[ { "docstring": "Returns number of students needed if you assign to each student min_pages. Time complexity: O(n). Space complexity: O(1), n is len(books).", "name": "count_students", "signature": "def count_students(self, books, min_pages)" }, { "docstring": "Returns minimum number of pages per ...
2
stack_v2_sparse_classes_30k_train_013048
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def count_students(self, books, min_pages): Returns number of students needed if you assign to each student min_pages. Time complexity: O(n). Space complexity: O(1), n is len(boo...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def count_students(self, books, min_pages): Returns number of students needed if you assign to each student min_pages. Time complexity: O(n). Space complexity: O(1), n is len(boo...
71b722ddfe8da04572e527b055cf8723d5c87bbf
<|skeleton|> class Solution: def count_students(self, books, min_pages): """Returns number of students needed if you assign to each student min_pages. Time complexity: O(n). Space complexity: O(1), n is len(books).""" <|body_0|> def min_pages(self, books, m): """Returns minimum number ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def count_students(self, books, min_pages): """Returns number of students needed if you assign to each student min_pages. Time complexity: O(n). Space complexity: O(1), n is len(books).""" curr = 0 total = 1 for page in books: if curr + page > min_pages: ...
the_stack_v2_python_sparse
Binary_Search/allocate_books.py
vladn90/Algorithms
train
0
dc640536bba212964069ff5476d89dbbe1f6673e
[ "if data is None:\n if n <= 0:\n raise ValueError('n must be a positive value')\n if p >= 1 or p <= 0:\n raise ValueError('p must be greater than 0 and less than 1')\n else:\n self.n = int(n)\n self.p = float(p)\nelif not isinstance(data, list):\n raise TypeError('data must b...
<|body_start_0|> if data is None: if n <= 0: raise ValueError('n must be a positive value') if p >= 1 or p <= 0: raise ValueError('p must be greater than 0 and less than 1') else: self.n = int(n) self.p = float(p...
Class Binomial
Binomial
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Binomial: """Class Binomial""" def __init__(self, data=None, n=1, p=0.5): """Contructor of class binomial and definition""" <|body_0|> def pmf(self, k): """Definition of probability density function""" <|body_1|> def factor(number): """Factor...
stack_v2_sparse_classes_36k_train_033893
2,018
no_license
[ { "docstring": "Contructor of class binomial and definition", "name": "__init__", "signature": "def __init__(self, data=None, n=1, p=0.5)" }, { "docstring": "Definition of probability density function", "name": "pmf", "signature": "def pmf(self, k)" }, { "docstring": "Factorial o...
4
stack_v2_sparse_classes_30k_test_000723
Implement the Python class `Binomial` described below. Class description: Class Binomial Method signatures and docstrings: - def __init__(self, data=None, n=1, p=0.5): Contructor of class binomial and definition - def pmf(self, k): Definition of probability density function - def factor(number): Factorial outside of ...
Implement the Python class `Binomial` described below. Class description: Class Binomial Method signatures and docstrings: - def __init__(self, data=None, n=1, p=0.5): Contructor of class binomial and definition - def pmf(self, k): Definition of probability density function - def factor(number): Factorial outside of ...
74213384b0998f65e123adc146ea5e91c4d77b37
<|skeleton|> class Binomial: """Class Binomial""" def __init__(self, data=None, n=1, p=0.5): """Contructor of class binomial and definition""" <|body_0|> def pmf(self, k): """Definition of probability density function""" <|body_1|> def factor(number): """Factor...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Binomial: """Class Binomial""" def __init__(self, data=None, n=1, p=0.5): """Contructor of class binomial and definition""" if data is None: if n <= 0: raise ValueError('n must be a positive value') if p >= 1 or p <= 0: raise ValueEr...
the_stack_v2_python_sparse
math/0x03-probability/binomial.py
PilarPinto/holbertonschool-machine_learning
train
0
09222643100a3693261a4aa64611fff7bd981946
[ "try:\n return Comment.objects.get(id=id)\nexcept Comment.DoesNotExist:\n raise Http404", "comment_object = self.get_object(id)\nresponse = self.serializer_class(comment_object)\nreturn Response(response.data)", "comments = self.get_object(id)\ncomments.delete()\nreturn Response(status=status.HTTP_204_NO_...
<|body_start_0|> try: return Comment.objects.get(id=id) except Comment.DoesNotExist: raise Http404 <|end_body_0|> <|body_start_1|> comment_object = self.get_object(id) response = self.serializer_class(comment_object) return Response(response.data) <|end_b...
This class is an API for geting comment of post detail.
CommentViewDetail
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommentViewDetail: """This class is an API for geting comment of post detail.""" def get_object(self, id): """Get comment by id. Args: request: Django Rest Framework request object. id: id of comment. format: pattern for Web APIs. Return: comment object.""" <|body_0|> de...
stack_v2_sparse_classes_36k_train_033894
17,464
no_license
[ { "docstring": "Get comment by id. Args: request: Django Rest Framework request object. id: id of comment. format: pattern for Web APIs. Return: comment object.", "name": "get_object", "signature": "def get_object(self, id)" }, { "docstring": "Get single comment object. Args: request: Django Res...
3
stack_v2_sparse_classes_30k_train_003313
Implement the Python class `CommentViewDetail` described below. Class description: This class is an API for geting comment of post detail. Method signatures and docstrings: - def get_object(self, id): Get comment by id. Args: request: Django Rest Framework request object. id: id of comment. format: pattern for Web AP...
Implement the Python class `CommentViewDetail` described below. Class description: This class is an API for geting comment of post detail. Method signatures and docstrings: - def get_object(self, id): Get comment by id. Args: request: Django Rest Framework request object. id: id of comment. format: pattern for Web AP...
1d01b8133669208cdd35d4aa61a41521ecd52720
<|skeleton|> class CommentViewDetail: """This class is an API for geting comment of post detail.""" def get_object(self, id): """Get comment by id. Args: request: Django Rest Framework request object. id: id of comment. format: pattern for Web APIs. Return: comment object.""" <|body_0|> de...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CommentViewDetail: """This class is an API for geting comment of post detail.""" def get_object(self, id): """Get comment by id. Args: request: Django Rest Framework request object. id: id of comment. format: pattern for Web APIs. Return: comment object.""" try: return Comment...
the_stack_v2_python_sparse
newsfeed/views.py
whsatku/social
train
10
8b1171348a6fcff638df74cd80ebad3e9831b2b9
[ "super().__init__()\nself.attention_window = config.attention_window[layer_id]\nself.attention_layer = LongformerSelfAttention(config, layer_id=layer_id)\nself.attention = None", "attention_mask = mask.int()\nattention_mask[mask == 0] = -1\nattention_mask[mask == 1] = 0\noutput, self.attention = self.attention_la...
<|body_start_0|> super().__init__() self.attention_window = config.attention_window[layer_id] self.attention_layer = LongformerSelfAttention(config, layer_id=layer_id) self.attention = None <|end_body_0|> <|body_start_1|> attention_mask = mask.int() attention_mask[mask =...
Longformer based Local Attention Definition.
LongformerAttention
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LongformerAttention: """Longformer based Local Attention Definition.""" def __init__(self, config: LongformerConfig, layer_id: int): """Compute Longformer based Self-Attention. Args: config : Longformer attention configuration layer_id: Integer representing the layer index""" ...
stack_v2_sparse_classes_36k_train_033895
2,070
permissive
[ { "docstring": "Compute Longformer based Self-Attention. Args: config : Longformer attention configuration layer_id: Integer representing the layer index", "name": "__init__", "signature": "def __init__(self, config: LongformerConfig, layer_id: int)" }, { "docstring": "Compute Longformer Self-At...
2
null
Implement the Python class `LongformerAttention` described below. Class description: Longformer based Local Attention Definition. Method signatures and docstrings: - def __init__(self, config: LongformerConfig, layer_id: int): Compute Longformer based Self-Attention. Args: config : Longformer attention configuration ...
Implement the Python class `LongformerAttention` described below. Class description: Longformer based Local Attention Definition. Method signatures and docstrings: - def __init__(self, config: LongformerConfig, layer_id: int): Compute Longformer based Self-Attention. Args: config : Longformer attention configuration ...
bcd20948db7846ee523443ef9fd78c7a1248c95e
<|skeleton|> class LongformerAttention: """Longformer based Local Attention Definition.""" def __init__(self, config: LongformerConfig, layer_id: int): """Compute Longformer based Self-Attention. Args: config : Longformer attention configuration layer_id: Integer representing the layer index""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LongformerAttention: """Longformer based Local Attention Definition.""" def __init__(self, config: LongformerConfig, layer_id: int): """Compute Longformer based Self-Attention. Args: config : Longformer attention configuration layer_id: Integer representing the layer index""" super().__in...
the_stack_v2_python_sparse
espnet/nets/pytorch_backend/transformer/longformer_attention.py
espnet/espnet
train
7,242
25b84a7ccf0e5f354831f12d9bf42adab3f3cac4
[ "self.name = name\nself.start_point = start\nself.end_point = end", "start = self.start_point.position\nend = self.end_point.position\nreturn end - start" ]
<|body_start_0|> self.name = name self.start_point = start self.end_point = end <|end_body_0|> <|body_start_1|> start = self.start_point.position end = self.end_point.position return end - start <|end_body_1|>
AxisReal
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AxisReal: def __init__(self, name: Name, start: MarkerReal, end: MarkerReal): """Parameters ---------- name: The AxisName of the Axis start: The initial Marker""" <|body_0|> def axis(self) -> np.ndarray: """Returns the axis vector""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_36k_train_033896
649
permissive
[ { "docstring": "Parameters ---------- name: The AxisName of the Axis start: The initial Marker", "name": "__init__", "signature": "def __init__(self, name: Name, start: MarkerReal, end: MarkerReal)" }, { "docstring": "Returns the axis vector", "name": "axis", "signature": "def axis(self)...
2
stack_v2_sparse_classes_30k_train_002167
Implement the Python class `AxisReal` described below. Class description: Implement the AxisReal class. Method signatures and docstrings: - def __init__(self, name: Name, start: MarkerReal, end: MarkerReal): Parameters ---------- name: The AxisName of the Axis start: The initial Marker - def axis(self) -> np.ndarray:...
Implement the Python class `AxisReal` described below. Class description: Implement the AxisReal class. Method signatures and docstrings: - def __init__(self, name: Name, start: MarkerReal, end: MarkerReal): Parameters ---------- name: The AxisName of the Axis start: The initial Marker - def axis(self) -> np.ndarray:...
70265cb1931c463a24f27013350e363134ce6801
<|skeleton|> class AxisReal: def __init__(self, name: Name, start: MarkerReal, end: MarkerReal): """Parameters ---------- name: The AxisName of the Axis start: The initial Marker""" <|body_0|> def axis(self) -> np.ndarray: """Returns the axis vector""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AxisReal: def __init__(self, name: Name, start: MarkerReal, end: MarkerReal): """Parameters ---------- name: The AxisName of the Axis start: The initial Marker""" self.name = name self.start_point = start self.end_point = end def axis(self) -> np.ndarray: """Return...
the_stack_v2_python_sparse
binding/python3/model_creation/axis_real.py
pyomeca/biorbd
train
63
7dccaef5ad5037d3ae6870574e63861d9cf8f585
[ "self.curl_buffer = CurlBuffer()\nself.curl = pycurl.Curl()\nself.curl.setopt(self.curl.VERBOSE, 0)\nself.curl.setopt(self.curl.WRITEFUNCTION, self.curl_buffer.body_callback)\nself.curl.setopt(self.curl.URL, self.url)\nself.curl.perform()", "query_string = '?sensor=false&address=%s' % urlquote(address)\nself.url ...
<|body_start_0|> self.curl_buffer = CurlBuffer() self.curl = pycurl.Curl() self.curl.setopt(self.curl.VERBOSE, 0) self.curl.setopt(self.curl.WRITEFUNCTION, self.curl_buffer.body_callback) self.curl.setopt(self.curl.URL, self.url) self.curl.perform() <|end_body_0|> <|body...
Retrieve latitude/longitude coordinate for an address. Production uses Google's geocoding service. Test mode uses Open Street Maps' geocoding service. Option (for performance boost) to allow Jenkins to return static location.
GeocodeLocation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GeocodeLocation: """Retrieve latitude/longitude coordinate for an address. Production uses Google's geocoding service. Test mode uses Open Street Maps' geocoding service. Option (for performance boost) to allow Jenkins to return static location.""" def _execute_curl(self): """Use cur...
stack_v2_sparse_classes_36k_train_033897
4,650
no_license
[ { "docstring": "Use curl to submit request to geocoder service.", "name": "_execute_curl", "signature": "def _execute_curl(self)" }, { "docstring": "Use google API to retrieve lat/long coords for this address.", "name": "_google_service", "signature": "def _google_service(self, address)"...
5
stack_v2_sparse_classes_30k_train_016350
Implement the Python class `GeocodeLocation` described below. Class description: Retrieve latitude/longitude coordinate for an address. Production uses Google's geocoding service. Test mode uses Open Street Maps' geocoding service. Option (for performance boost) to allow Jenkins to return static location. Method sign...
Implement the Python class `GeocodeLocation` described below. Class description: Retrieve latitude/longitude coordinate for an address. Production uses Google's geocoding service. Test mode uses Open Street Maps' geocoding service. Option (for performance boost) to allow Jenkins to return static location. Method sign...
a780ccdc3350d4b5c7990c65d1af8d71060c62cc
<|skeleton|> class GeocodeLocation: """Retrieve latitude/longitude coordinate for an address. Production uses Google's geocoding service. Test mode uses Open Street Maps' geocoding service. Option (for performance boost) to allow Jenkins to return static location.""" def _execute_curl(self): """Use cur...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GeocodeLocation: """Retrieve latitude/longitude coordinate for an address. Production uses Google's geocoding service. Test mode uses Open Street Maps' geocoding service. Option (for performance boost) to allow Jenkins to return static location.""" def _execute_curl(self): """Use curl to submit r...
the_stack_v2_python_sparse
geolocation/geocode_address.py
wcirillo/ten
train
0
d3258a9f4904080f6b5a3059bf53899bf6a1666a
[ "with open('./test-biofile/test-multiple-fasta-001.fa', 'r') as inf:\n mfr = biofile.MultipleFASTAReader(inf, biofile.UCSCExonHeader)\n for cds_alignment in mfr.CDSs():\n L = None\n for entry in cds_alignment:\n if L is None:\n L = len(entry.sequence)\n self....
<|body_start_0|> with open('./test-biofile/test-multiple-fasta-001.fa', 'r') as inf: mfr = biofile.MultipleFASTAReader(inf, biofile.UCSCExonHeader) for cds_alignment in mfr.CDSs(): L = None for entry in cds_alignment: if L is None: ...
test002
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class test002: def test_reading(self): """Reading and length""" <|body_0|> def test_length(self): """Length""" <|body_1|> <|end_skeleton|> <|body_start_0|> with open('./test-biofile/test-multiple-fasta-001.fa', 'r') as inf: mfr = biofile.Multi...
stack_v2_sparse_classes_36k_train_033898
2,259
no_license
[ { "docstring": "Reading and length", "name": "test_reading", "signature": "def test_reading(self)" }, { "docstring": "Length", "name": "test_length", "signature": "def test_length(self)" } ]
2
null
Implement the Python class `test002` described below. Class description: Implement the test002 class. Method signatures and docstrings: - def test_reading(self): Reading and length - def test_length(self): Length
Implement the Python class `test002` described below. Class description: Implement the test002 class. Method signatures and docstrings: - def test_reading(self): Reading and length - def test_length(self): Length <|skeleton|> class test002: def test_reading(self): """Reading and length""" <|body...
d7ddd2b585a841c6d986974a24a53e4d1abe71ba
<|skeleton|> class test002: def test_reading(self): """Reading and length""" <|body_0|> def test_length(self): """Length""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class test002: def test_reading(self): """Reading and length""" with open('./test-biofile/test-multiple-fasta-001.fa', 'r') as inf: mfr = biofile.MultipleFASTAReader(inf, biofile.UCSCExonHeader) for cds_alignment in mfr.CDSs(): L = None for ent...
the_stack_v2_python_sparse
src/biofile_test.py
dad/base
train
0
f13a3854175dbf3ac1dc5746c9ff21377f2a12d5
[ "def print_error_usage(message):\n error_msg = str('ArgumentError # %s\\n\\nUsage:' % message + self.usage)\n sys.stderr.write(error_msg)\n sys.exit(2)\nself.exit(print_error_usage(message))", "def print_error_usage(message):\n sys.stderr.write(message)\n sys.exit(2)\nself.exit(print_error_usage(me...
<|body_start_0|> def print_error_usage(message): error_msg = str('ArgumentError # %s\n\nUsage:' % message + self.usage) sys.stderr.write(error_msg) sys.exit(2) self.exit(print_error_usage(message)) <|end_body_0|> <|body_start_1|> def print_error_usage(message...
DESCRIPTION: Child class from ArgumentParser, used to customize the error message.
CustomParser
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomParser: """DESCRIPTION: Child class from ArgumentParser, used to customize the error message.""" def error(self, message): """DESCRIPTION: Function which overrides the original error from argparse""" <|body_0|> def general_error(self, message): """DESCRIPTI...
stack_v2_sparse_classes_36k_train_033899
13,513
permissive
[ { "docstring": "DESCRIPTION: Function which overrides the original error from argparse", "name": "error", "signature": "def error(self, message)" }, { "docstring": "DESCRIPTION: Function which overrides the original error from argparse", "name": "general_error", "signature": "def general...
2
stack_v2_sparse_classes_30k_train_013154
Implement the Python class `CustomParser` described below. Class description: DESCRIPTION: Child class from ArgumentParser, used to customize the error message. Method signatures and docstrings: - def error(self, message): DESCRIPTION: Function which overrides the original error from argparse - def general_error(self...
Implement the Python class `CustomParser` described below. Class description: DESCRIPTION: Child class from ArgumentParser, used to customize the error message. Method signatures and docstrings: - def error(self, message): DESCRIPTION: Function which overrides the original error from argparse - def general_error(self...
62bbb20d15c78d2554d7258bdae655452ac826c7
<|skeleton|> class CustomParser: """DESCRIPTION: Child class from ArgumentParser, used to customize the error message.""" def error(self, message): """DESCRIPTION: Function which overrides the original error from argparse""" <|body_0|> def general_error(self, message): """DESCRIPTI...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CustomParser: """DESCRIPTION: Child class from ArgumentParser, used to customize the error message.""" def error(self, message): """DESCRIPTION: Function which overrides the original error from argparse""" def print_error_usage(message): error_msg = str('ArgumentError # %s\n\n...
the_stack_v2_python_sparse
rbkcli/interface/rbk_cli.py
rubrikinc/rbkcli
train
12