blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
467
8.64k
id
stringlengths
40
40
length_bytes
int64
515
49.7k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
160
3.93k
prompted_full_text
stringlengths
681
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.09k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
331
8.3k
source
stringclasses
1 value
source_path
stringlengths
5
177
source_repo
stringlengths
6
88
split
stringclasses
1 value
star_events_count
int64
0
209k
e6d475a01eae285977f77d781b84281b1f16c145
[ "frame = pd.read_csv(path, index_col=['FLOWS', 'PRODUCTS'], usecols=['FLOWS', 'PRODUCTS', 'OBS_VALUE', 'geo', 'TIME_PERIOD'])\ncls.validate_eb(frame)\narea, year = cls.handle_area_and_year(frame)\nframe = frame.reset_index().pivot('FLOWS', 'PRODUCTS', 'OBS_VALUE').fillna(0.0)\nreturn cls(frame, year, area)", "trn...
<|body_start_0|> frame = pd.read_csv(path, index_col=['FLOWS', 'PRODUCTS'], usecols=['FLOWS', 'PRODUCTS', 'OBS_VALUE', 'geo', 'TIME_PERIOD']) cls.validate_eb(frame) area, year = cls.handle_area_and_year(frame) frame = frame.reset_index().pivot('FLOWS', 'PRODUCTS', 'OBS_VALUE').fillna(0.0...
Load
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Load: def from_csv(cls, path): """Sets up an EnergyBalance from an Eurostat energy balance csv file""" <|body_0|> def from_world_balance_file(cls, area, year, path=''): """Grab country and year from the path or the frame""" <|body_1|> def from_eurostat(c...
stack_v2_sparse_classes_10k_train_008600
3,067
no_license
[ { "docstring": "Sets up an EnergyBalance from an Eurostat energy balance csv file", "name": "from_csv", "signature": "def from_csv(cls, path)" }, { "docstring": "Grab country and year from the path or the frame", "name": "from_world_balance_file", "signature": "def from_world_balance_fil...
4
stack_v2_sparse_classes_30k_test_000222
Implement the Python class `Load` described below. Class description: Implement the Load class. Method signatures and docstrings: - def from_csv(cls, path): Sets up an EnergyBalance from an Eurostat energy balance csv file - def from_world_balance_file(cls, area, year, path=''): Grab country and year from the path or...
Implement the Python class `Load` described below. Class description: Implement the Load class. Method signatures and docstrings: - def from_csv(cls, path): Sets up an EnergyBalance from an Eurostat energy balance csv file - def from_world_balance_file(cls, area, year, path=''): Grab country and year from the path or...
bef8f76c7e0ebc172646fef085c8705245998b2f
<|skeleton|> class Load: def from_csv(cls, path): """Sets up an EnergyBalance from an Eurostat energy balance csv file""" <|body_0|> def from_world_balance_file(cls, area, year, path=''): """Grab country and year from the path or the frame""" <|body_1|> def from_eurostat(c...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Load: def from_csv(cls, path): """Sets up an EnergyBalance from an Eurostat energy balance csv file""" frame = pd.read_csv(path, index_col=['FLOWS', 'PRODUCTS'], usecols=['FLOWS', 'PRODUCTS', 'OBS_VALUE', 'geo', 'TIME_PERIOD']) cls.validate_eb(frame) area, year = cls.handle_are...
the_stack_v2_python_sparse
tools/energy_balance_generator/etm_tools/energy_balance_operations/energy_balance/load.py
quintel/etdataset-public
train
4
6e4435718141c981c035f16699d94327133d63fd
[ "var_data = self.loadCustomData(save_filename=save_filename)\nif var_data:\n width = var_data.get('width', -1)\n height = var_data.get('height', -1)\n if width > 0 and height > 0:\n self.SetSize(wx.Size(width, height))\n x = var_data.get('x', -1)\n y = var_data.get('y', -1)\n if x <= 0 and ...
<|body_start_0|> var_data = self.loadCustomData(save_filename=save_filename) if var_data: width = var_data.get('width', -1) height = var_data.get('height', -1) if width > 0 and height > 0: self.SetSize(wx.Size(width, height)) x = var_data.g...
Manager for storing properties of wxPython forms.
iqStoredWxFormsManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class iqStoredWxFormsManager: """Manager for storing properties of wxPython forms.""" def loadCustomProperties(self, save_filename=None): """Load custom properties. :param save_filename: Stored file name. :return: True/False.""" <|body_0|> def saveCustomProperties(self, save_f...
stack_v2_sparse_classes_10k_train_008601
1,564
no_license
[ { "docstring": "Load custom properties. :param save_filename: Stored file name. :return: True/False.", "name": "loadCustomProperties", "signature": "def loadCustomProperties(self, save_filename=None)" }, { "docstring": "Save custom properties. :param save_filename: Stored file name. :return: Tru...
2
null
Implement the Python class `iqStoredWxFormsManager` described below. Class description: Manager for storing properties of wxPython forms. Method signatures and docstrings: - def loadCustomProperties(self, save_filename=None): Load custom properties. :param save_filename: Stored file name. :return: True/False. - def s...
Implement the Python class `iqStoredWxFormsManager` described below. Class description: Manager for storing properties of wxPython forms. Method signatures and docstrings: - def loadCustomProperties(self, save_filename=None): Load custom properties. :param save_filename: Stored file name. :return: True/False. - def s...
7550e242746cb2fb1219474463f8db21f8e3e114
<|skeleton|> class iqStoredWxFormsManager: """Manager for storing properties of wxPython forms.""" def loadCustomProperties(self, save_filename=None): """Load custom properties. :param save_filename: Stored file name. :return: True/False.""" <|body_0|> def saveCustomProperties(self, save_f...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class iqStoredWxFormsManager: """Manager for storing properties of wxPython forms.""" def loadCustomProperties(self, save_filename=None): """Load custom properties. :param save_filename: Stored file name. :return: True/False.""" var_data = self.loadCustomData(save_filename=save_filename) ...
the_stack_v2_python_sparse
iq/engine/wx/stored_wx_form_manager.py
XHermitOne/iq_framework
train
1
cb551029c7d4842f5f0ecf73a092b44db105a69f
[ "response = self.client.get(endpoint, filters, format='json')\nself.assertEqual(response.status_code, status_code)\nreturn response.data", "user_as_owner = Owner.get_owner(self.user)\nself.assertEqual(type(user_as_owner), Owner)\ngroup_as_owner = Owner.get_owner(self.group)\nself.assertEqual(type(group_as_owner),...
<|body_start_0|> response = self.client.get(endpoint, filters, format='json') self.assertEqual(response.status_code, status_code) return response.data <|end_body_0|> <|body_start_1|> user_as_owner = Owner.get_owner(self.user) self.assertEqual(type(user_as_owner), Owner) ...
Some simplistic tests to ensure the Owner model is setup correctly.
OwnerModelTest
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OwnerModelTest: """Some simplistic tests to ensure the Owner model is setup correctly.""" def do_request(self, endpoint, filters, status_code=200): """Perform an API request""" <|body_0|> def test_owner(self): """Tests for the 'owner' model""" <|body_1|> ...
stack_v2_sparse_classes_10k_train_008602
9,692
permissive
[ { "docstring": "Perform an API request", "name": "do_request", "signature": "def do_request(self, endpoint, filters, status_code=200)" }, { "docstring": "Tests for the 'owner' model", "name": "test_owner", "signature": "def test_owner(self)" }, { "docstring": "Test user APIs.", ...
4
null
Implement the Python class `OwnerModelTest` described below. Class description: Some simplistic tests to ensure the Owner model is setup correctly. Method signatures and docstrings: - def do_request(self, endpoint, filters, status_code=200): Perform an API request - def test_owner(self): Tests for the 'owner' model -...
Implement the Python class `OwnerModelTest` described below. Class description: Some simplistic tests to ensure the Owner model is setup correctly. Method signatures and docstrings: - def do_request(self, endpoint, filters, status_code=200): Perform an API request - def test_owner(self): Tests for the 'owner' model -...
e88a8e99a5f0b201c67a95cba097c729f090d5e2
<|skeleton|> class OwnerModelTest: """Some simplistic tests to ensure the Owner model is setup correctly.""" def do_request(self, endpoint, filters, status_code=200): """Perform an API request""" <|body_0|> def test_owner(self): """Tests for the 'owner' model""" <|body_1|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class OwnerModelTest: """Some simplistic tests to ensure the Owner model is setup correctly.""" def do_request(self, endpoint, filters, status_code=200): """Perform an API request""" response = self.client.get(endpoint, filters, format='json') self.assertEqual(response.status_code, stat...
the_stack_v2_python_sparse
InvenTree/users/tests.py
inventree/InvenTree
train
3,077
3890bc3de624292f2203e9910ed70a1b0e1cdf3b
[ "super().__init__(*args, **kwargs)\nself.set_fields_from_dict(['dst_key', 'src_key', 'how_merge'])\nself.fields['how_merge'].required = False", "form_data = super().clean()\nself.store_fields_in_dict([('dst_key', None), ('src_key', None), ('how_merge', None)])\nif self.workflow.has_data_frame:\n if not form_da...
<|body_start_0|> super().__init__(*args, **kwargs) self.set_fields_from_dict(['dst_key', 'src_key', 'how_merge']) self.fields['how_merge'].required = False <|end_body_0|> <|body_start_1|> form_data = super().clean() self.store_fields_in_dict([('dst_key', None), ('src_key', None)...
Form to request info for the SQL scheduled upload Three blocks of information are requested: Block 1: Name, description, start -- frequency -- stop times Block 2: Parameters for the SQL connection Block 3: Parameters for the merge: Left/Right column + merge method
ScheduleSQLUploadForm
[ "LGPL-2.0-or-later", "BSD-3-Clause", "MIT", "Apache-2.0", "LGPL-2.1-only", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScheduleSQLUploadForm: """Form to request info for the SQL scheduled upload Three blocks of information are requested: Block 1: Name, description, start -- frequency -- stop times Block 2: Parameters for the SQL connection Block 3: Parameters for the merge: Left/Right column + merge method""" ...
stack_v2_sparse_classes_10k_train_008603
2,781
permissive
[ { "docstring": "Initialize all the fields", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Store the fields in the Form Payload", "name": "clean", "signature": "def clean(self) -> Dict" } ]
2
null
Implement the Python class `ScheduleSQLUploadForm` described below. Class description: Form to request info for the SQL scheduled upload Three blocks of information are requested: Block 1: Name, description, start -- frequency -- stop times Block 2: Parameters for the SQL connection Block 3: Parameters for the merge: ...
Implement the Python class `ScheduleSQLUploadForm` described below. Class description: Form to request info for the SQL scheduled upload Three blocks of information are requested: Block 1: Name, description, start -- frequency -- stop times Block 2: Parameters for the SQL connection Block 3: Parameters for the merge: ...
c432745dfff932cbe7397100422d49df78f0a882
<|skeleton|> class ScheduleSQLUploadForm: """Form to request info for the SQL scheduled upload Three blocks of information are requested: Block 1: Name, description, start -- frequency -- stop times Block 2: Parameters for the SQL connection Block 3: Parameters for the merge: Left/Right column + merge method""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ScheduleSQLUploadForm: """Form to request info for the SQL scheduled upload Three blocks of information are requested: Block 1: Name, description, start -- frequency -- stop times Block 2: Parameters for the SQL connection Block 3: Parameters for the merge: Left/Right column + merge method""" def __init_...
the_stack_v2_python_sparse
ontask/scheduler/forms/sql.py
abelardopardo/ontask_b
train
43
6686b9ffc6573f146a957b5eb063297d49c57622
[ "result = {'result': 'NG', 'content': ''}\nctrl_doc = CtrlDsDoc()\ndoc_data = ctrl_doc.get_ds_doc(doc_id)\nif doc_data:\n result['result'] = 'OK'\n result['content'] = doc_data\nelse:\n result['error'] = '该文档不存在!'\nreturn result", "data_json = request.get_json()\nresult = {'result': 'NG', 'error': ''}\nd...
<|body_start_0|> result = {'result': 'NG', 'content': ''} ctrl_doc = CtrlDsDoc() doc_data = ctrl_doc.get_ds_doc(doc_id) if doc_data: result['result'] = 'OK' result['content'] = doc_data else: result['error'] = '该文档不存在!' return result <|...
ApiNewDSDoc
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApiNewDSDoc: def get(self, doc_id): """查看基本/详细设计信息 :param doc_id: :return:""" <|body_0|> def post(self): """新增设计文档 :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> result = {'result': 'NG', 'content': ''} ctrl_doc = CtrlDsDoc() ...
stack_v2_sparse_classes_10k_train_008604
31,026
no_license
[ { "docstring": "查看基本/详细设计信息 :param doc_id: :return:", "name": "get", "signature": "def get(self, doc_id)" }, { "docstring": "新增设计文档 :return:", "name": "post", "signature": "def post(self)" } ]
2
null
Implement the Python class `ApiNewDSDoc` described below. Class description: Implement the ApiNewDSDoc class. Method signatures and docstrings: - def get(self, doc_id): 查看基本/详细设计信息 :param doc_id: :return: - def post(self): 新增设计文档 :return:
Implement the Python class `ApiNewDSDoc` described below. Class description: Implement the ApiNewDSDoc class. Method signatures and docstrings: - def get(self, doc_id): 查看基本/详细设计信息 :param doc_id: :return: - def post(self): 新增设计文档 :return: <|skeleton|> class ApiNewDSDoc: def get(self, doc_id): """查看基本/详细...
64b31e7bdfcb8a4c95f0a8a607f0bcff576cec11
<|skeleton|> class ApiNewDSDoc: def get(self, doc_id): """查看基本/详细设计信息 :param doc_id: :return:""" <|body_0|> def post(self): """新增设计文档 :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ApiNewDSDoc: def get(self, doc_id): """查看基本/详细设计信息 :param doc_id: :return:""" result = {'result': 'NG', 'content': ''} ctrl_doc = CtrlDsDoc() doc_data = ctrl_doc.get_ds_doc(doc_id) if doc_data: result['result'] = 'OK' result['content'] = doc_data...
the_stack_v2_python_sparse
Source/collaboration_2/app/api_1_0/api_ds_doc.py
lsn1183/web_project
train
0
371b0e43a53619e74869a05b9bd5a3beea65d2a0
[ "cls.test_temp_dir = os.path.join(tf.test.get_temp_dir(), 'encoder_test')\nshutil.rmtree(cls.test_temp_dir, ignore_errors=True)\ntf.gfile.MakeDirs(cls.test_temp_dir)", "corpus = 'A B C D E F G H I J K L M N O P Q R S T U V W X Y Z'\nvocab_filename = os.path.join(self.test_temp_dir, 'abc.vocab')\nencoder = text_en...
<|body_start_0|> cls.test_temp_dir = os.path.join(tf.test.get_temp_dir(), 'encoder_test') shutil.rmtree(cls.test_temp_dir, ignore_errors=True) tf.gfile.MakeDirs(cls.test_temp_dir) <|end_body_0|> <|body_start_1|> corpus = 'A B C D E F G H I J K L M N O P Q R S T U V W X Y Z' voca...
TokenTextEncoderTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TokenTextEncoderTest: def setUpClass(cls): """Make sure the test dir exists and is empty.""" <|body_0|> def test_save_and_reload(self): """Test that saving and reloading doesn't change the vocab. Note that this test reads and writes to the filesystem, which necessita...
stack_v2_sparse_classes_10k_train_008605
14,602
permissive
[ { "docstring": "Make sure the test dir exists and is empty.", "name": "setUpClass", "signature": "def setUpClass(cls)" }, { "docstring": "Test that saving and reloading doesn't change the vocab. Note that this test reads and writes to the filesystem, which necessitates that this test size be \"l...
3
stack_v2_sparse_classes_30k_test_000325
Implement the Python class `TokenTextEncoderTest` described below. Class description: Implement the TokenTextEncoderTest class. Method signatures and docstrings: - def setUpClass(cls): Make sure the test dir exists and is empty. - def test_save_and_reload(self): Test that saving and reloading doesn't change the vocab...
Implement the Python class `TokenTextEncoderTest` described below. Class description: Implement the TokenTextEncoderTest class. Method signatures and docstrings: - def setUpClass(cls): Make sure the test dir exists and is empty. - def test_save_and_reload(self): Test that saving and reloading doesn't change the vocab...
1bb3b89427f669f2f0ec84633952e21b68964a23
<|skeleton|> class TokenTextEncoderTest: def setUpClass(cls): """Make sure the test dir exists and is empty.""" <|body_0|> def test_save_and_reload(self): """Test that saving and reloading doesn't change the vocab. Note that this test reads and writes to the filesystem, which necessita...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TokenTextEncoderTest: def setUpClass(cls): """Make sure the test dir exists and is empty.""" cls.test_temp_dir = os.path.join(tf.test.get_temp_dir(), 'encoder_test') shutil.rmtree(cls.test_temp_dir, ignore_errors=True) tf.gfile.MakeDirs(cls.test_temp_dir) def test_save_and...
the_stack_v2_python_sparse
trax/data/text_encoder_test.py
google/trax
train
8,180
98cdd48549f2caf0b11882e826abf723c2e1130c
[ "def getMinutes(time):\n return int(time[:2]) * 60 + int(time[3:])\nslots = [False] * (24 * 60 + 1)\nfirst, last = (2 ** 31 - 1, -2 ** 31)\nfor time in timePoints:\n minutes = getMinutes(time)\n if slots[minutes]:\n return 0\n else:\n slots[minutes] = True\n first = min(first, minut...
<|body_start_0|> def getMinutes(time): return int(time[:2]) * 60 + int(time[3:]) slots = [False] * (24 * 60 + 1) first, last = (2 ** 31 - 1, -2 ** 31) for time in timePoints: minutes = getMinutes(time) if slots[minutes]: return 0 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMinDifference(self, timePoints): """:type timePoints: List[str] :rtype: int""" <|body_0|> def findMinDifference2(self, timePoints): """:type timePoints: List[str] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> def getM...
stack_v2_sparse_classes_10k_train_008606
2,141
no_license
[ { "docstring": ":type timePoints: List[str] :rtype: int", "name": "findMinDifference", "signature": "def findMinDifference(self, timePoints)" }, { "docstring": ":type timePoints: List[str] :rtype: int", "name": "findMinDifference2", "signature": "def findMinDifference2(self, timePoints)"...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMinDifference(self, timePoints): :type timePoints: List[str] :rtype: int - def findMinDifference2(self, timePoints): :type timePoints: List[str] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMinDifference(self, timePoints): :type timePoints: List[str] :rtype: int - def findMinDifference2(self, timePoints): :type timePoints: List[str] :rtype: int <|skeleton|>...
635af6e22aa8eef8e7920a585d43a45a891a8157
<|skeleton|> class Solution: def findMinDifference(self, timePoints): """:type timePoints: List[str] :rtype: int""" <|body_0|> def findMinDifference2(self, timePoints): """:type timePoints: List[str] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def findMinDifference(self, timePoints): """:type timePoints: List[str] :rtype: int""" def getMinutes(time): return int(time[:2]) * 60 + int(time[3:]) slots = [False] * (24 * 60 + 1) first, last = (2 ** 31 - 1, -2 ** 31) for time in timePoints: ...
the_stack_v2_python_sparse
code539MinimumTimeDifference.py
cybelewang/leetcode-python
train
0
2ed8e2ee99e70d4fb88d5df1c1c6b74a3e7671d3
[ "if n == 1:\n return 9\nif n == 2:\n return 987\nif n == 3:\n return 123\nif n == 4:\n return 597\nif n == 5:\n return 677\nif n == 6:\n return 1218\nif n == 7:\n return 877\nif n == 8:\n return 475", "if n == 1:\n return 9\nif n == 2:\n return 987\nfor a in range(2, 9 * 10 ** (n - 1...
<|body_start_0|> if n == 1: return 9 if n == 2: return 987 if n == 3: return 123 if n == 4: return 597 if n == 5: return 677 if n == 6: return 1218 if n == 7: return 877 if...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def largestPalindrome_cheat(self, n): """:type n: int :rtype: int""" <|body_0|> def largestPalindrome(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if n == 1: return 9 if n == 2: ...
stack_v2_sparse_classes_10k_train_008607
1,851
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "largestPalindrome_cheat", "signature": "def largestPalindrome_cheat(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "largestPalindrome", "signature": "def largestPalindrome(self, n)" } ]
2
stack_v2_sparse_classes_30k_train_006290
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestPalindrome_cheat(self, n): :type n: int :rtype: int - def largestPalindrome(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 largestPalindrome_cheat(self, n): :type n: int :rtype: int - def largestPalindrome(self, n): :type n: int :rtype: int <|skeleton|> class Solution: def largestPalindrome...
3f0ffd519404165fd1a735441b212c801fd1ad1e
<|skeleton|> class Solution: def largestPalindrome_cheat(self, n): """:type n: int :rtype: int""" <|body_0|> def largestPalindrome(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def largestPalindrome_cheat(self, n): """:type n: int :rtype: int""" if n == 1: return 9 if n == 2: return 987 if n == 3: return 123 if n == 4: return 597 if n == 5: return 677 if n ==...
the_stack_v2_python_sparse
Problems/0400_0499/0479_Largest_Palindrome_Product/Project_Python3/Largest_Palindrome_Product.py
NobuyukiInoue/LeetCode
train
0
605d737393abfb1f7c4ccbb6e50d4de28d422788
[ "result = dict()\ncodec = dahuffman.HuffmanCodec.from_data(''.join(str_list))\nfor i in str_list:\n result.update({i: base64.b64encode(codec.encode(i)).decode('utf-8')})\ncode_table = codec.get_code_table()\ndata = {'code_table': code_table}\ndata = base64.b64encode(pickle.dumps(data)).decode('utf-8')\nresult.up...
<|body_start_0|> result = dict() codec = dahuffman.HuffmanCodec.from_data(''.join(str_list)) for i in str_list: result.update({i: base64.b64encode(codec.encode(i)).decode('utf-8')}) code_table = codec.get_code_table() data = {'code_table': code_table} data = b...
The HuffmanCoding class forms the base of the dependency provider for the Huffman Coding algorithm. It uses dahuffman.HuffmanCodec to perform the majority of the work. Data is base64 encoded for transfer over the network
HuffmanCoding
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HuffmanCoding: """The HuffmanCoding class forms the base of the dependency provider for the Huffman Coding algorithm. It uses dahuffman.HuffmanCodec to perform the majority of the work. Data is base64 encoded for transfer over the network""" def encode(str_list): """The main function...
stack_v2_sparse_classes_10k_train_008608
2,753
no_license
[ { "docstring": "The main function to produce a dictionary of original and encoded strings. A code table is added to the result for calibrating a new Huffman codec for decode. The code table is pickled first, and then base64 encoded to deal with custom _EOF marker included in dahuffman :param str_list: The list ...
2
stack_v2_sparse_classes_30k_train_003196
Implement the Python class `HuffmanCoding` described below. Class description: The HuffmanCoding class forms the base of the dependency provider for the Huffman Coding algorithm. It uses dahuffman.HuffmanCodec to perform the majority of the work. Data is base64 encoded for transfer over the network Method signatures ...
Implement the Python class `HuffmanCoding` described below. Class description: The HuffmanCoding class forms the base of the dependency provider for the Huffman Coding algorithm. It uses dahuffman.HuffmanCodec to perform the majority of the work. Data is base64 encoded for transfer over the network Method signatures ...
60caf3dbedc4512cd8d47c6fac4da7c4d13038d3
<|skeleton|> class HuffmanCoding: """The HuffmanCoding class forms the base of the dependency provider for the Huffman Coding algorithm. It uses dahuffman.HuffmanCodec to perform the majority of the work. Data is base64 encoded for transfer over the network""" def encode(str_list): """The main function...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class HuffmanCoding: """The HuffmanCoding class forms the base of the dependency provider for the Huffman Coding algorithm. It uses dahuffman.HuffmanCodec to perform the majority of the work. Data is base64 encoded for transfer over the network""" def encode(str_list): """The main function to produce a...
the_stack_v2_python_sparse
Development/V03/app/dependencies/huffman.py
8563a236e65cede7b14220e65c70ad5718144a3/microservices-interview-answers
train
0
e3e373dca38def5b549d4340cfe676d11bd436d6
[ "self.pokemon = pokemon\nself.targets = targets\nself.environment = environment\nself.action = None\nentries = []\nfor attack in self.pokemon.getAttacks():\n entries.append(AttackMenuEntry(attack, self.setAction))\nself.menu = Menu(entries, columns=2)\nscreen.setBottomView(ActionMenuWidget(self.menu, self.getWin...
<|body_start_0|> self.pokemon = pokemon self.targets = targets self.environment = environment self.action = None entries = [] for attack in self.pokemon.getAttacks(): entries.append(AttackMenuEntry(attack, self.setAction)) self.menu = Menu(entries, col...
Controller for Attack Menu
AttackMenuController
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AttackMenuController: """Controller for Attack Menu""" def __init__(self, pokemon, targets, environment, screen): """Initialize the Attack Menu""" <|body_0|> def setAction(self, entry): """Set the Chosen Action""" <|body_1|> <|end_skeleton|> <|body_star...
stack_v2_sparse_classes_10k_train_008609
2,031
no_license
[ { "docstring": "Initialize the Attack Menu", "name": "__init__", "signature": "def __init__(self, pokemon, targets, environment, screen)" }, { "docstring": "Set the Chosen Action", "name": "setAction", "signature": "def setAction(self, entry)" } ]
2
null
Implement the Python class `AttackMenuController` described below. Class description: Controller for Attack Menu Method signatures and docstrings: - def __init__(self, pokemon, targets, environment, screen): Initialize the Attack Menu - def setAction(self, entry): Set the Chosen Action
Implement the Python class `AttackMenuController` described below. Class description: Controller for Attack Menu Method signatures and docstrings: - def __init__(self, pokemon, targets, environment, screen): Initialize the Attack Menu - def setAction(self, entry): Set the Chosen Action <|skeleton|> class AttackMenuC...
3931eee5fd04e18bb1738a0b27a4c6979dc4db01
<|skeleton|> class AttackMenuController: """Controller for Attack Menu""" def __init__(self, pokemon, targets, environment, screen): """Initialize the Attack Menu""" <|body_0|> def setAction(self, entry): """Set the Chosen Action""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AttackMenuController: """Controller for Attack Menu""" def __init__(self, pokemon, targets, environment, screen): """Initialize the Attack Menu""" self.pokemon = pokemon self.targets = targets self.environment = environment self.action = None entries = [] ...
the_stack_v2_python_sparse
src/Screen/Pygame/Menu/ActionMenu/AttackMenu/attack_menu_controller.py
sgtnourry/Pokemon-Project
train
0
11ef01f03025f4049d8a9c4b631680f48a632216
[ "self.operands: List[Operand] = list(operands)\nfor i in range(len(self.operands)):\n self.operands[i] = Operand.validate_operand(self.operands[i])\nsuper().__init__()", "incomplete_expression = False\nfor operand in self.operands:\n if not issubclass(type(operand), Operand):\n raise RuntimeError(f'O...
<|body_start_0|> self.operands: List[Operand] = list(operands) for i in range(len(self.operands)): self.operands[i] = Operand.validate_operand(self.operands[i]) super().__init__() <|end_body_0|> <|body_start_1|> incomplete_expression = False for operand in self.opera...
Or operator class for filtering JumpStart content.
Or
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Or: """Or operator class for filtering JumpStart content.""" def __init__(self, *operands: Union[Operand, str]) -> None: """Instantiates Or object. Args: operands (Operand): Operand for Or-ing. Raises: RuntimeError: If the operands cannot be validated.""" <|body_0|> def ...
stack_v2_sparse_classes_10k_train_008610
16,623
permissive
[ { "docstring": "Instantiates Or object. Args: operands (Operand): Operand for Or-ing. Raises: RuntimeError: If the operands cannot be validated.", "name": "__init__", "signature": "def __init__(self, *operands: Union[Operand, str]) -> None" }, { "docstring": "Evaluates operator. Raises: RuntimeE...
3
null
Implement the Python class `Or` described below. Class description: Or operator class for filtering JumpStart content. Method signatures and docstrings: - def __init__(self, *operands: Union[Operand, str]) -> None: Instantiates Or object. Args: operands (Operand): Operand for Or-ing. Raises: RuntimeError: If the oper...
Implement the Python class `Or` described below. Class description: Or operator class for filtering JumpStart content. Method signatures and docstrings: - def __init__(self, *operands: Union[Operand, str]) -> None: Instantiates Or object. Args: operands (Operand): Operand for Or-ing. Raises: RuntimeError: If the oper...
8d5d7fd8ae1a917ed3e2b988d5e533bce244fd85
<|skeleton|> class Or: """Or operator class for filtering JumpStart content.""" def __init__(self, *operands: Union[Operand, str]) -> None: """Instantiates Or object. Args: operands (Operand): Operand for Or-ing. Raises: RuntimeError: If the operands cannot be validated.""" <|body_0|> def ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Or: """Or operator class for filtering JumpStart content.""" def __init__(self, *operands: Union[Operand, str]) -> None: """Instantiates Or object. Args: operands (Operand): Operand for Or-ing. Raises: RuntimeError: If the operands cannot be validated.""" self.operands: List[Operand] = li...
the_stack_v2_python_sparse
src/sagemaker/jumpstart/filters.py
aws/sagemaker-python-sdk
train
2,050
86ad86dc5c5dd74a17fd41fd0ddb73160d3f284f
[ "result = ''\nfor ch in mystring:\n if ch.isdigit() or ch == '-':\n result += ch\nreturn result", "schools_urls_xpath = '//*[@id=\"phmain_0_AllResults\"]/ul/li/span[1]/a/@href'\nschools_urls = response.xpath(schools_urls_xpath).extract()\nfor url in schools_urls:\n yield scrapy.Request(response.urljo...
<|body_start_0|> result = '' for ch in mystring: if ch.isdigit() or ch == '-': result += ch return result <|end_body_0|> <|body_start_1|> schools_urls_xpath = '//*[@id="phmain_0_AllResults"]/ul/li/span[1]/a/@href' schools_urls = response.xpath(schools...
a scrapy spider to crawl csmb.qc.ca domain to get school_name street_address city province postal_code phone_number school_url school_grades school_language school_type school_board response_url for each school found
MontrealCsmbSpider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MontrealCsmbSpider: """a scrapy spider to crawl csmb.qc.ca domain to get school_name street_address city province postal_code phone_number school_url school_grades school_language school_type school_board response_url for each school found""" def digits_only(self, mystring): """it ta...
stack_v2_sparse_classes_10k_train_008611
3,988
no_license
[ { "docstring": "it takes a sting conains some digits then return the only digits", "name": "digits_only", "signature": "def digits_only(self, mystring)" }, { "docstring": "get all schools urls then yield a Request for each one.", "name": "parse", "signature": "def parse(self, response)" ...
3
stack_v2_sparse_classes_30k_train_000157
Implement the Python class `MontrealCsmbSpider` described below. Class description: a scrapy spider to crawl csmb.qc.ca domain to get school_name street_address city province postal_code phone_number school_url school_grades school_language school_type school_board response_url for each school found Method signatures...
Implement the Python class `MontrealCsmbSpider` described below. Class description: a scrapy spider to crawl csmb.qc.ca domain to get school_name street_address city province postal_code phone_number school_url school_grades school_language school_type school_board response_url for each school found Method signatures...
350264cf6da323692c2838d8cb235ef61085851b
<|skeleton|> class MontrealCsmbSpider: """a scrapy spider to crawl csmb.qc.ca domain to get school_name street_address city province postal_code phone_number school_url school_grades school_language school_type school_board response_url for each school found""" def digits_only(self, mystring): """it ta...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MontrealCsmbSpider: """a scrapy spider to crawl csmb.qc.ca domain to get school_name street_address city province postal_code phone_number school_url school_grades school_language school_type school_board response_url for each school found""" def digits_only(self, mystring): """it takes a sting c...
the_stack_v2_python_sparse
school_scraping/spiders/montreal_csmb.py
ramadanmostafa/canada_school_scraping
train
0
accc97c0608a76a93dd8942a07ba74b2d946ff43
[ "if n < 1:\n return 0\nif n < 2:\n return 1\ndp = [1] * m\nfor _ in range(2, n):\n for i in range(1, m):\n dp[i] += dp[i - 1]\nreturn sum(dp)", "def combination(n, k):\n ret = 1\n while k > 0:\n ret *= n / k\n n -= 1\n k -= 1\n return ret\nif n < 1:\n return 0\nif ...
<|body_start_0|> if n < 1: return 0 if n < 2: return 1 dp = [1] * m for _ in range(2, n): for i in range(1, m): dp[i] += dp[i - 1] return sum(dp) <|end_body_0|> <|body_start_1|> def combination(n, k): ret = ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def uniquePaths(self, m, n): """:type m: int :type n: int :rtype: int""" <|body_0|> def uniquePaths_1(self, m, n): """:type m: int :type n: int :rtype: int""" <|body_1|> def uniquePaths_2(self, m, n): """:type m: int :type n: int :rtype...
stack_v2_sparse_classes_10k_train_008612
1,946
no_license
[ { "docstring": ":type m: int :type n: int :rtype: int", "name": "uniquePaths", "signature": "def uniquePaths(self, m, n)" }, { "docstring": ":type m: int :type n: int :rtype: int", "name": "uniquePaths_1", "signature": "def uniquePaths_1(self, m, n)" }, { "docstring": ":type m: i...
3
stack_v2_sparse_classes_30k_train_005882
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def uniquePaths(self, m, n): :type m: int :type n: int :rtype: int - def uniquePaths_1(self, m, n): :type m: int :type n: int :rtype: int - def uniquePaths_2(self, m, n): :type m...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def uniquePaths(self, m, n): :type m: int :type n: int :rtype: int - def uniquePaths_1(self, m, n): :type m: int :type n: int :rtype: int - def uniquePaths_2(self, m, n): :type m...
9fa6f81d8968dea51c255a6f92708cfc6bafb057
<|skeleton|> class Solution: def uniquePaths(self, m, n): """:type m: int :type n: int :rtype: int""" <|body_0|> def uniquePaths_1(self, m, n): """:type m: int :type n: int :rtype: int""" <|body_1|> def uniquePaths_2(self, m, n): """:type m: int :type n: int :rtype...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def uniquePaths(self, m, n): """:type m: int :type n: int :rtype: int""" if n < 1: return 0 if n < 2: return 1 dp = [1] * m for _ in range(2, n): for i in range(1, m): dp[i] += dp[i - 1] return sum(dp...
the_stack_v2_python_sparse
62. Unique Paths.py
ChihaoFeng/Leetcode
train
0
d4e2a0df87f091a6f573c49f5817d6cb699a8958
[ "list = []\nif root is None:\n return []\nlist += self.inorderTraversal(root.left)\nlist.append(root.val)\nlist += self.inorderTraversal(root.right)\nreturn list", "WHITE, GRAY = (0, 1)\nres = []\nstack = [(WHITE, root)]\nwhile stack:\n color, node = stack.pop()\n if node is None:\n continue\n ...
<|body_start_0|> list = [] if root is None: return [] list += self.inorderTraversal(root.left) list.append(root.val) list += self.inorderTraversal(root.right) return list <|end_body_0|> <|body_start_1|> WHITE, GRAY = (0, 1) res = [] st...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def inorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_0|> def inorderTraversal_iter(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> list = [] if...
stack_v2_sparse_classes_10k_train_008613
1,450
no_license
[ { "docstring": ":type root: TreeNode :rtype: List[int]", "name": "inorderTraversal", "signature": "def inorderTraversal(self, root)" }, { "docstring": ":type root: TreeNode :rtype: List[int]", "name": "inorderTraversal_iter", "signature": "def inorderTraversal_iter(self, root)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def inorderTraversal(self, root): :type root: TreeNode :rtype: List[int] - def inorderTraversal_iter(self, root): :type root: TreeNode :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def inorderTraversal(self, root): :type root: TreeNode :rtype: List[int] - def inorderTraversal_iter(self, root): :type root: TreeNode :rtype: List[int] <|skeleton|> class Solut...
3f4284330f9771037ca59e2e6a94122e51e58540
<|skeleton|> class Solution: def inorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_0|> def inorderTraversal_iter(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def inorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" list = [] if root is None: return [] list += self.inorderTraversal(root.left) list.append(root.val) list += self.inorderTraversal(root.right) return list...
the_stack_v2_python_sparse
Leetcode/94.二叉树的中序遍历.py
myf-algorithm/Leetcode
train
1
3c22ab963880eb2ce67863e8d014ed2fbe898fbd
[ "def middle(nums, left, right):\n if left <= right:\n if nums[left] <= nums[right]:\n min = nums[left]\n else:\n mid = (left + right) // 2\n if nums[mid] < nums[right]:\n min = middle(nums, left, mid)\n else:\n min = middle(n...
<|body_start_0|> def middle(nums, left, right): if left <= right: if nums[left] <= nums[right]: min = nums[left] else: mid = (left + right) // 2 if nums[mid] < nums[right]: min = middl...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMin(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def findMin2(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> def middle(nums, left, right): if left <...
stack_v2_sparse_classes_10k_train_008614
1,183
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "findMin", "signature": "def findMin(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "findMin2", "signature": "def findMin2(self, nums)" } ]
2
stack_v2_sparse_classes_30k_val_000015
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMin(self, nums): :type nums: List[int] :rtype: int - def findMin2(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMin(self, nums): :type nums: List[int] :rtype: int - def findMin2(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def findMin(self, nums...
0fc4c7af59246e3064db41989a45d9db413a624b
<|skeleton|> class Solution: def findMin(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def findMin2(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def findMin(self, nums): """:type nums: List[int] :rtype: int""" def middle(nums, left, right): if left <= right: if nums[left] <= nums[right]: min = nums[left] else: mid = (left + right) // 2 ...
the_stack_v2_python_sparse
153. Find Minimum in Rotated Sorted Array/findMin.py
Macielyoung/LeetCode
train
1
5286d282f412f7e981968c369122bf3d39357686
[ "super(Nasbench201, self).__init__()\nself.args.data_path = FileOps.download_dataset(self.args.data_path)\nself.nasbench201_api = API('self.args.data_path')", "if dataset not in VALID_DATASET:\n raise ValueError('Only cifar10, cifar100, and Imagenet dataset is supported.')\nops_list = self.nasbench201_api.str2...
<|body_start_0|> super(Nasbench201, self).__init__() self.args.data_path = FileOps.download_dataset(self.args.data_path) self.nasbench201_api = API('self.args.data_path') <|end_body_0|> <|body_start_1|> if dataset not in VALID_DATASET: raise ValueError('Only cifar10, cifar10...
Nasbench201 Dataset.
Nasbench201
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Nasbench201: """Nasbench201 Dataset.""" def __init__(self): """Construct the Nasbench201 class.""" <|body_0|> def query(self, arch_str, dataset): """Query an item from the dataset according to the given arch_str and dataset . :arch_str: arch_str to define the top...
stack_v2_sparse_classes_10k_train_008615
2,068
permissive
[ { "docstring": "Construct the Nasbench201 class.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Query an item from the dataset according to the given arch_str and dataset . :arch_str: arch_str to define the topology of the cell :type path: str :dataset: dataset type :...
2
stack_v2_sparse_classes_30k_train_005154
Implement the Python class `Nasbench201` described below. Class description: Nasbench201 Dataset. Method signatures and docstrings: - def __init__(self): Construct the Nasbench201 class. - def query(self, arch_str, dataset): Query an item from the dataset according to the given arch_str and dataset . :arch_str: arch_...
Implement the Python class `Nasbench201` described below. Class description: Nasbench201 Dataset. Method signatures and docstrings: - def __init__(self): Construct the Nasbench201 class. - def query(self, arch_str, dataset): Query an item from the dataset according to the given arch_str and dataset . :arch_str: arch_...
e4ef3a1c92d19d1d08c3ef0e2156b6fecefdbe04
<|skeleton|> class Nasbench201: """Nasbench201 Dataset.""" def __init__(self): """Construct the Nasbench201 class.""" <|body_0|> def query(self, arch_str, dataset): """Query an item from the dataset according to the given arch_str and dataset . :arch_str: arch_str to define the top...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Nasbench201: """Nasbench201 Dataset.""" def __init__(self): """Construct the Nasbench201 class.""" super(Nasbench201, self).__init__() self.args.data_path = FileOps.download_dataset(self.args.data_path) self.nasbench201_api = API('self.args.data_path') def query(self,...
the_stack_v2_python_sparse
zeus/datasets/common/nasbench201.py
huawei-noah/xingtian
train
308
6e5bcd01ff8181a7a44fd225fa2039a2cc227653
[ "sign = -1 if x < 0 else 1\nresult = str(abs(x))[::-1].lstrip('0')\nnum_result = int(result) if result else 0\nif num_result < self.MIN_INT or num_result > self.MAX_INT:\n num_result = 0\nreturn sign * num_result", "from math import log10\n\ndef num_of_digits(num):\n return int(log10(num) + 1)\nif not x:\n ...
<|body_start_0|> sign = -1 if x < 0 else 1 result = str(abs(x))[::-1].lstrip('0') num_result = int(result) if result else 0 if num_result < self.MIN_INT or num_result > self.MAX_INT: num_result = 0 return sign * num_result <|end_body_0|> <|body_start_1|> from...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverse(self, x): """:type x: int :rtype: int Runtime: 24 ms, faster than 100.00% of Python online submissions for Reverse Integer. Memory Usage: 11.7 MB, less than 5.56% of Python online submissions for Reverse Integer.""" <|body_0|> def reverse_math(self, x):...
stack_v2_sparse_classes_10k_train_008616
2,087
no_license
[ { "docstring": ":type x: int :rtype: int Runtime: 24 ms, faster than 100.00% of Python online submissions for Reverse Integer. Memory Usage: 11.7 MB, less than 5.56% of Python online submissions for Reverse Integer.", "name": "reverse", "signature": "def reverse(self, x)" }, { "docstring": ":typ...
2
stack_v2_sparse_classes_30k_train_003065
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverse(self, x): :type x: int :rtype: int Runtime: 24 ms, faster than 100.00% of Python online submissions for Reverse Integer. Memory Usage: 11.7 MB, less than 5.56% of Pyt...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverse(self, x): :type x: int :rtype: int Runtime: 24 ms, faster than 100.00% of Python online submissions for Reverse Integer. Memory Usage: 11.7 MB, less than 5.56% of Pyt...
6e09d1bfe9eb7476125eb31d95616a115f2e6f7f
<|skeleton|> class Solution: def reverse(self, x): """:type x: int :rtype: int Runtime: 24 ms, faster than 100.00% of Python online submissions for Reverse Integer. Memory Usage: 11.7 MB, less than 5.56% of Python online submissions for Reverse Integer.""" <|body_0|> def reverse_math(self, x):...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def reverse(self, x): """:type x: int :rtype: int Runtime: 24 ms, faster than 100.00% of Python online submissions for Reverse Integer. Memory Usage: 11.7 MB, less than 5.56% of Python online submissions for Reverse Integer.""" sign = -1 if x < 0 else 1 result = str(abs(x))[:...
the_stack_v2_python_sparse
reverse_integer.py
benjiaming/leetcode
train
0
3a7bf42ba0c8218fbc8decceb5f799b2bc5cbc11
[ "parameters = dict()\nparameters['page'] = GraphQLParam(page, 'PageInput', False)\nparameters['filter'] = GraphQLParam(host_filter, 'HostFilter', False)\nparameters['sort'] = GraphQLParam(sort, 'HostSort', False)\nresponse = self._query(name='getHosts', params=parameters, fields=HostList.fields())\nreturn HostList(...
<|body_start_0|> parameters = dict() parameters['page'] = GraphQLParam(page, 'PageInput', False) parameters['filter'] = GraphQLParam(host_filter, 'HostFilter', False) parameters['sort'] = GraphQLParam(sort, 'HostSort', False) response = self._query(name='getHosts', params=paramet...
Mixin to add host related methods to the GraphQL client
HostsMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HostsMixin: """Mixin to add host related methods to the GraphQL client""" def get_hosts(self, page: PageInput=None, host_filter: HostFilter=None, sort: HostSort=None) -> HostList: """Retrieves a list of host objects :param page: The requested page from the server. This is an optional...
stack_v2_sparse_classes_10k_train_008617
20,026
permissive
[ { "docstring": "Retrieves a list of host objects :param page: The requested page from the server. This is an optional argument and if omitted the server will default to returning the first page with a maximum of ``100`` items. :type page: PageInput, optional :param host_filter: A filter object to filter the hos...
2
stack_v2_sparse_classes_30k_train_002298
Implement the Python class `HostsMixin` described below. Class description: Mixin to add host related methods to the GraphQL client Method signatures and docstrings: - def get_hosts(self, page: PageInput=None, host_filter: HostFilter=None, sort: HostSort=None) -> HostList: Retrieves a list of host objects :param page...
Implement the Python class `HostsMixin` described below. Class description: Mixin to add host related methods to the GraphQL client Method signatures and docstrings: - def get_hosts(self, page: PageInput=None, host_filter: HostFilter=None, sort: HostSort=None) -> HostList: Retrieves a list of host objects :param page...
8ea044096bd18aaccbfb81eca4e26ec29895a18c
<|skeleton|> class HostsMixin: """Mixin to add host related methods to the GraphQL client""" def get_hosts(self, page: PageInput=None, host_filter: HostFilter=None, sort: HostSort=None) -> HostList: """Retrieves a list of host objects :param page: The requested page from the server. This is an optional...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class HostsMixin: """Mixin to add host related methods to the GraphQL client""" def get_hosts(self, page: PageInput=None, host_filter: HostFilter=None, sort: HostSort=None) -> HostList: """Retrieves a list of host objects :param page: The requested page from the server. This is an optional argument and...
the_stack_v2_python_sparse
nebpyclient/api/hosts.py
firefly707/nebpyclient
train
0
2bdd5461f975adb1f134e5843778291667383320
[ "cfg_path = os.path.join(base_path, HOST_CONFIG_FILE)\nif not os.path.exists(cfg_path):\n return False\nwith open(cfg_path, 'rb') as f:\n record = yaml.safe_load(f)\n if record and cls.KEY in record:\n return True\nreturn False", "if not os.path.exists(base_path):\n os.makedirs(base_path)\ncfg_...
<|body_start_0|> cfg_path = os.path.join(base_path, HOST_CONFIG_FILE) if not os.path.exists(cfg_path): return False with open(cfg_path, 'rb') as f: record = yaml.safe_load(f) if record and cls.KEY in record: return True return False <|e...
ConfigMixin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConfigMixin: def exists(cls, base_path): """Check that the configuration file exists and the key for this config type exists in the file""" <|body_0|> def save(self, base_path): """Serialize configuration to a YAML file for future use""" <|body_1|> def l...
stack_v2_sparse_classes_10k_train_008618
5,461
permissive
[ { "docstring": "Check that the configuration file exists and the key for this config type exists in the file", "name": "exists", "signature": "def exists(cls, base_path)" }, { "docstring": "Serialize configuration to a YAML file for future use", "name": "save", "signature": "def save(sel...
5
stack_v2_sparse_classes_30k_train_004732
Implement the Python class `ConfigMixin` described below. Class description: Implement the ConfigMixin class. Method signatures and docstrings: - def exists(cls, base_path): Check that the configuration file exists and the key for this config type exists in the file - def save(self, base_path): Serialize configuratio...
Implement the Python class `ConfigMixin` described below. Class description: Implement the ConfigMixin class. Method signatures and docstrings: - def exists(cls, base_path): Check that the configuration file exists and the key for this config type exists in the file - def save(self, base_path): Serialize configuratio...
5cf8f159183a80d2364e05bb30362e2798a7af37
<|skeleton|> class ConfigMixin: def exists(cls, base_path): """Check that the configuration file exists and the key for this config type exists in the file""" <|body_0|> def save(self, base_path): """Serialize configuration to a YAML file for future use""" <|body_1|> def l...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ConfigMixin: def exists(cls, base_path): """Check that the configuration file exists and the key for this config type exists in the file""" cfg_path = os.path.join(base_path, HOST_CONFIG_FILE) if not os.path.exists(cfg_path): return False with open(cfg_path, 'rb') a...
the_stack_v2_python_sparse
python_modules/libraries/dagster-aws/dagster_aws/cli/config.py
zzztimbo/dagster
train
1
76f32816b81a2645b48c5f143d13198f86ec11e7
[ "if isinstance(value, unicode):\n return value.encode('utf-8')\nelif isinstance(value, field.SEQUENCE_TYPES):\n if value and len(value) == 1:\n value = value[0]\n elif not value:\n value = ''\n else:\n value = ''.join(value)\nif not isinstance(value, str):\n value = str(value)\nr...
<|body_start_0|> if isinstance(value, unicode): return value.encode('utf-8') elif isinstance(value, field.SEQUENCE_TYPES): if value and len(value) == 1: value = value[0] elif not value: value = '' else: value...
SFString field/event type base-class
_SFString
[ "GPL-1.0-or-later", "MIT", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-other-copyleft", "LGPL-2.1-or-later", "GPL-3.0-only", "LGPL-2.0-or-later", "GPL-3.0-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _SFString: """SFString field/event type base-class""" def coerce(self, value): """Coerce the given value to our type Allowable types: simple string -> unchanged unicode string -> utf-8 encoded sequence of length == 1 where first element is a string -> returns first element sequence o...
stack_v2_sparse_classes_10k_train_008619
34,853
permissive
[ { "docstring": "Coerce the given value to our type Allowable types: simple string -> unchanged unicode string -> utf-8 encoded sequence of length == 1 where first element is a string -> returns first element sequence of length > 1 where all elements are strings -> returns string.join( value, '')", "name": "...
2
null
Implement the Python class `_SFString` described below. Class description: SFString field/event type base-class Method signatures and docstrings: - def coerce(self, value): Coerce the given value to our type Allowable types: simple string -> unchanged unicode string -> utf-8 encoded sequence of length == 1 where firs...
Implement the Python class `_SFString` described below. Class description: SFString field/event type base-class Method signatures and docstrings: - def coerce(self, value): Coerce the given value to our type Allowable types: simple string -> unchanged unicode string -> utf-8 encoded sequence of length == 1 where firs...
7f600ad153270feff12aa7aa86d7ed0a49ebc71c
<|skeleton|> class _SFString: """SFString field/event type base-class""" def coerce(self, value): """Coerce the given value to our type Allowable types: simple string -> unchanged unicode string -> utf-8 encoded sequence of length == 1 where first element is a string -> returns first element sequence o...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class _SFString: """SFString field/event type base-class""" def coerce(self, value): """Coerce the given value to our type Allowable types: simple string -> unchanged unicode string -> utf-8 encoded sequence of length == 1 where first element is a string -> returns first element sequence of length > 1 ...
the_stack_v2_python_sparse
pythonAnimations/pyOpenGLChess/engineDirectory/oglc-env/lib/python2.7/site-packages/vrml/fieldtypes.py
alexus37/AugmentedRealityChess
train
1
153bb61a97bdc6de811aff603ebbe2318fcb5571
[ "if not os.path.exists(path):\n return {}\nRequestFileCom.mutex.acquire()\nwith open(path, 'r') as f:\n content = f.readlines()\n request_dict = {}\n for line in content:\n try:\n key = line.split('::')[0]\n value = line.split('::')[1]\n if value.endswith('\\n'):\...
<|body_start_0|> if not os.path.exists(path): return {} RequestFileCom.mutex.acquire() with open(path, 'r') as f: content = f.readlines() request_dict = {} for line in content: try: key = line.split('::')[0] ...
This class allows supplies methods to handle the request file.
RequestFileCom
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RequestFileCom: """This class allows supplies methods to handle the request file.""" def file_to_dict(path='current_request.txt'): """The function reads the file and return a dict as follow: {key, value}.""" <|body_0|> def get_value(key): """The function returns ...
stack_v2_sparse_classes_10k_train_008620
2,224
no_license
[ { "docstring": "The function reads the file and return a dict as follow: {key, value}.", "name": "file_to_dict", "signature": "def file_to_dict(path='current_request.txt')" }, { "docstring": "The function returns the value of the current title in request file.", "name": "get_value", "sig...
3
stack_v2_sparse_classes_30k_train_002733
Implement the Python class `RequestFileCom` described below. Class description: This class allows supplies methods to handle the request file. Method signatures and docstrings: - def file_to_dict(path='current_request.txt'): The function reads the file and return a dict as follow: {key, value}. - def get_value(key): ...
Implement the Python class `RequestFileCom` described below. Class description: This class allows supplies methods to handle the request file. Method signatures and docstrings: - def file_to_dict(path='current_request.txt'): The function reads the file and return a dict as follow: {key, value}. - def get_value(key): ...
f97386d7ba9ec639083c150706429b832fd288eb
<|skeleton|> class RequestFileCom: """This class allows supplies methods to handle the request file.""" def file_to_dict(path='current_request.txt'): """The function reads the file and return a dict as follow: {key, value}.""" <|body_0|> def get_value(key): """The function returns ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RequestFileCom: """This class allows supplies methods to handle the request file.""" def file_to_dict(path='current_request.txt'): """The function reads the file and return a dict as follow: {key, value}.""" if not os.path.exists(path): return {} RequestFileCom.mutex.a...
the_stack_v2_python_sparse
Project/Code/Client/client2/RequestFileCom.py
Maor2871/CodeDup
train
0
0627d2caafcfd47f44e0c6288fc802ec50349495
[ "super().__init__()\nself.dataframe = self.process_data(data_path, file_geometries=file_geometries)\nself.clean_dataframe(sanitize=sanitize)\nif 'positions' not in self.dataframe:\n self.dataframe['positions'] = guess_positions(self.dataframe.molecules, optimize_molecule)\nif properties is not None:\n self.la...
<|body_start_0|> super().__init__() self.dataframe = self.process_data(data_path, file_geometries=file_geometries) self.clean_dataframe(sanitize=sanitize) if 'positions' not in self.dataframe: self.dataframe['positions'] = guess_positions(self.dataframe.molecules, optimize_mo...
Base class for the Data represented as graphs.
SwanGraphData
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SwanGraphData: """Base class for the Data represented as graphs.""" def __init__(self, data_path: PathLike, properties: Optional[Union[str, List[str]]]=None, sanitize: bool=True, file_geometries: Optional[PathLike]=None, optimize_molecule: bool=False) -> None: """Generate a dataset u...
stack_v2_sparse_classes_10k_train_008621
2,301
permissive
[ { "docstring": "Generate a dataset using graphs Parameters ---------- data_path path of the csv file properties Labels names sanitize Check that molecules have a valid conformer file_geometries Path to a file with the geometries in PDB format optimize_molecule Perform a molecular optimization using a force fiel...
2
stack_v2_sparse_classes_30k_train_002838
Implement the Python class `SwanGraphData` described below. Class description: Base class for the Data represented as graphs. Method signatures and docstrings: - def __init__(self, data_path: PathLike, properties: Optional[Union[str, List[str]]]=None, sanitize: bool=True, file_geometries: Optional[PathLike]=None, opt...
Implement the Python class `SwanGraphData` described below. Class description: Base class for the Data represented as graphs. Method signatures and docstrings: - def __init__(self, data_path: PathLike, properties: Optional[Union[str, List[str]]]=None, sanitize: bool=True, file_geometries: Optional[PathLike]=None, opt...
4edc9dc363ce901b1fcc19444bec42fc5930c4b9
<|skeleton|> class SwanGraphData: """Base class for the Data represented as graphs.""" def __init__(self, data_path: PathLike, properties: Optional[Union[str, List[str]]]=None, sanitize: bool=True, file_geometries: Optional[PathLike]=None, optimize_molecule: bool=False) -> None: """Generate a dataset u...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SwanGraphData: """Base class for the Data represented as graphs.""" def __init__(self, data_path: PathLike, properties: Optional[Union[str, List[str]]]=None, sanitize: bool=True, file_geometries: Optional[PathLike]=None, optimize_molecule: bool=False) -> None: """Generate a dataset using graphs P...
the_stack_v2_python_sparse
swan/dataset/data_graph_base.py
nlesc-nano/swan
train
15
476dbafcf90978aa393edcd047dadd0419ca1b63
[ "ref = 'tttt'\nquery = 'ttAtt'\nmatch = 4\nmismatch = 2\ngap_extend_penalty = 2\ngap_open_penalty = 4\naligner = ssw.Aligner.construct(match_score=match, mismatch_penalty=mismatch, gap_opening_penalty=gap_open_penalty, gap_extending_penalty=gap_extend_penalty)\nfilter_ = ssw.Filter()\nlength = aligner.set_reference...
<|body_start_0|> ref = 'tttt' query = 'ttAtt' match = 4 mismatch = 2 gap_extend_penalty = 2 gap_open_penalty = 4 aligner = ssw.Aligner.construct(match_score=match, mismatch_penalty=mismatch, gap_opening_penalty=gap_open_penalty, gap_extending_penalty=gap_extend_pe...
Tests for the wrapped SSW aligner in a way that fails with gcc5.4.
SswGccTest
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SswGccTest: """Tests for the wrapped SSW aligner in a way that fails with gcc5.4.""" def test_short(self): """Test very short strings.""" <|body_0|> def test_longer(self): """Test longer strings, so the second-best alignment is considered.""" <|body_1|> ...
stack_v2_sparse_classes_10k_train_008622
3,151
permissive
[ { "docstring": "Test very short strings.", "name": "test_short", "signature": "def test_short(self)" }, { "docstring": "Test longer strings, so the second-best alignment is considered.", "name": "test_longer", "signature": "def test_longer(self)" } ]
2
null
Implement the Python class `SswGccTest` described below. Class description: Tests for the wrapped SSW aligner in a way that fails with gcc5.4. Method signatures and docstrings: - def test_short(self): Test very short strings. - def test_longer(self): Test longer strings, so the second-best alignment is considered.
Implement the Python class `SswGccTest` described below. Class description: Tests for the wrapped SSW aligner in a way that fails with gcc5.4. Method signatures and docstrings: - def test_short(self): Test very short strings. - def test_longer(self): Test longer strings, so the second-best alignment is considered. <...
ab068c4588a02e2167051bd9e74c0c9579462b51
<|skeleton|> class SswGccTest: """Tests for the wrapped SSW aligner in a way that fails with gcc5.4.""" def test_short(self): """Test very short strings.""" <|body_0|> def test_longer(self): """Test longer strings, so the second-best alignment is considered.""" <|body_1|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SswGccTest: """Tests for the wrapped SSW aligner in a way that fails with gcc5.4.""" def test_short(self): """Test very short strings.""" ref = 'tttt' query = 'ttAtt' match = 4 mismatch = 2 gap_extend_penalty = 2 gap_open_penalty = 4 aligner...
the_stack_v2_python_sparse
deepvariant/realigner/python/ssw_misc_test.py
google/deepvariant
train
3,002
753daf2d8da574874f5212b85659377b3435ca31
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn ExtensionProperty()", "from .directory_object import DirectoryObject\nfrom .directory_object import DirectoryObject\nfields: Dict[str, Callable[[Any], None]] = {'appDisplayName': lambda n: setattr(self, 'app_display_name', n.get_str_va...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return ExtensionProperty() <|end_body_0|> <|body_start_1|> from .directory_object import DirectoryObject from .directory_object import DirectoryObject fields: Dict[str, Callable[[Any], ...
ExtensionProperty
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExtensionProperty: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ExtensionProperty: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object...
stack_v2_sparse_classes_10k_train_008623
3,640
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: ExtensionProperty", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_v...
3
null
Implement the Python class `ExtensionProperty` described below. Class description: Implement the ExtensionProperty class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ExtensionProperty: Creates a new instance of the appropriate class based on discrim...
Implement the Python class `ExtensionProperty` described below. Class description: Implement the ExtensionProperty class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ExtensionProperty: Creates a new instance of the appropriate class based on discrim...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class ExtensionProperty: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ExtensionProperty: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ExtensionProperty: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ExtensionProperty: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Exte...
the_stack_v2_python_sparse
msgraph/generated/models/extension_property.py
microsoftgraph/msgraph-sdk-python
train
135
46cd9f84e080b768279232e913c4a675ec288dba
[ "if not root:\n return []\nqueue = [root]\nindex = 0\nwhile index < len(queue):\n node = queue[index]\n if node:\n queue.append(node.left)\n queue.append(node.right)\n index += 1\nwhile not queue[-1]:\n queue.pop()\nreturn ','.join([str(node.val) if node else 'null' for node in queue])"...
<|body_start_0|> if not root: return [] queue = [root] index = 0 while index < len(queue): node = queue[index] if node: queue.append(node.left) queue.append(node.right) index += 1 while not queue[-1]:...
Codec
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_10k_train_008624
1,617
permissive
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_006931
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:...
cb2ed3524431aea2b204fe66797f9850bbe506a9
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return [] queue = [root] index = 0 while index < len(queue): node = queue[index] if node: queue.a...
the_stack_v2_python_sparse
archive/python/Python/breadth_first_search/297.serialize-and-deserialize-binary-tree.py
linfengzhou/LeetCode
train
0
568e380989467ef6ed91cf71259df4c8f8570db5
[ "GradientDescent.__init__(self, function)\nself.gamma = gamma\nself.epsilon = epsilon\nself.alpha = alpha\nself.gE = [0 for _ in range(self.dim)]\nself.dxE = [0 for _ in range(self.dim)]", "_x2 = 0\n_check = 0\nself.function.derivative(self.function.x)\nfor i in range(self.dim):\n self.gE[i] = self.gamma * sel...
<|body_start_0|> GradientDescent.__init__(self, function) self.gamma = gamma self.epsilon = epsilon self.alpha = alpha self.gE = [0 for _ in range(self.dim)] self.dxE = [0 for _ in range(self.dim)] <|end_body_0|> <|body_start_1|> _x2 = 0 _check = 0 ...
Implementation of AdaDelta.
AdaDeltaGD
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdaDeltaGD: """Implementation of AdaDelta.""" def __init__(self, function, gamma=0.95, epsilon=1e-06, alpha=1): """function: instance of Function gamma: the decaying parameter epsilon: safety parameter (to avoid division by 0)""" <|body_0|> def update(self, abs_tol=1e-05...
stack_v2_sparse_classes_10k_train_008625
1,953
permissive
[ { "docstring": "function: instance of Function gamma: the decaying parameter epsilon: safety parameter (to avoid division by 0)", "name": "__init__", "signature": "def __init__(self, function, gamma=0.95, epsilon=1e-06, alpha=1)" }, { "docstring": "update should return a number that when it is s...
2
stack_v2_sparse_classes_30k_train_006286
Implement the Python class `AdaDeltaGD` described below. Class description: Implementation of AdaDelta. Method signatures and docstrings: - def __init__(self, function, gamma=0.95, epsilon=1e-06, alpha=1): function: instance of Function gamma: the decaying parameter epsilon: safety parameter (to avoid division by 0) ...
Implement the Python class `AdaDeltaGD` described below. Class description: Implementation of AdaDelta. Method signatures and docstrings: - def __init__(self, function, gamma=0.95, epsilon=1e-06, alpha=1): function: instance of Function gamma: the decaying parameter epsilon: safety parameter (to avoid division by 0) ...
e12ea464e7845793c88adfff6da4c8454099c03b
<|skeleton|> class AdaDeltaGD: """Implementation of AdaDelta.""" def __init__(self, function, gamma=0.95, epsilon=1e-06, alpha=1): """function: instance of Function gamma: the decaying parameter epsilon: safety parameter (to avoid division by 0)""" <|body_0|> def update(self, abs_tol=1e-05...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AdaDeltaGD: """Implementation of AdaDelta.""" def __init__(self, function, gamma=0.95, epsilon=1e-06, alpha=1): """function: instance of Function gamma: the decaying parameter epsilon: safety parameter (to avoid division by 0)""" GradientDescent.__init__(self, function) self.gamma...
the_stack_v2_python_sparse
Optimization/Minimization/Gradient-Descent/python/GD/AdaDeltaGD.py
dkaramit/ASAP
train
2
0b6b362c8d56b4399304d42a9b9ca1d71d3ba473
[ "super(ObjBranch, self).__init__()\nself.trans_factor = trans_factor\nself.scale_factor = scale_factor\nself.inp_res = [256, 256]", "if scaletrans is None:\n batch_size = scale.shape[0]\nelse:\n batch_size = scaletrans.shape[0]\nif scale is None:\n scale = scaletrans[:, :1]\nif trans is None:\n trans ...
<|body_start_0|> super(ObjBranch, self).__init__() self.trans_factor = trans_factor self.scale_factor = scale_factor self.inp_res = [256, 256] <|end_body_0|> <|body_start_1|> if scaletrans is None: batch_size = scale.shape[0] else: batch_size = sc...
ObjBranch
[ "LicenseRef-scancode-unknown", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObjBranch: def __init__(self, trans_factor=1, scale_factor=1): """Args: trans_factor: Scaling parameter to insure translation and scale are updated similarly during training (if one is updated much more than the other, training is slowed down, because for instance only the variation of t...
stack_v2_sparse_classes_10k_train_008626
3,616
permissive
[ { "docstring": "Args: trans_factor: Scaling parameter to insure translation and scale are updated similarly during training (if one is updated much more than the other, training is slowed down, because for instance only the variation of translation or scale significantly influences the final loss variation) sca...
2
stack_v2_sparse_classes_30k_train_002258
Implement the Python class `ObjBranch` described below. Class description: Implement the ObjBranch class. Method signatures and docstrings: - def __init__(self, trans_factor=1, scale_factor=1): Args: trans_factor: Scaling parameter to insure translation and scale are updated similarly during training (if one is updat...
Implement the Python class `ObjBranch` described below. Class description: Implement the ObjBranch class. Method signatures and docstrings: - def __init__(self, trans_factor=1, scale_factor=1): Args: trans_factor: Scaling parameter to insure translation and scale are updated similarly during training (if one is updat...
9651c569c328707cc1ad1e4797b9e4b32083c446
<|skeleton|> class ObjBranch: def __init__(self, trans_factor=1, scale_factor=1): """Args: trans_factor: Scaling parameter to insure translation and scale are updated similarly during training (if one is updated much more than the other, training is slowed down, because for instance only the variation of t...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ObjBranch: def __init__(self, trans_factor=1, scale_factor=1): """Args: trans_factor: Scaling parameter to insure translation and scale are updated similarly during training (if one is updated much more than the other, training is slowed down, because for instance only the variation of translation or ...
the_stack_v2_python_sparse
meshreg/models/objbranch.py
pgrady3/handobjectconsist
train
0
e23bcee24105e40fd1fe594d716146490d323db9
[ "date = ['2013-04-20', '2013-04-21', '2013-04-22']\ntitle = ['MA for 2013-04', 'Football', 'Shopping']\ndetail = ['Time schedule is from 10:00 to 14:00', 'Plays football at Shin-Yokohama park.', 'Shopping with friends at Yokohama Station']\nexpected_date = ['2013-04-20', '2013-04-21', '2013-04-22', '2019-10-31']\ne...
<|body_start_0|> date = ['2013-04-20', '2013-04-21', '2013-04-22'] title = ['MA for 2013-04', 'Football', 'Shopping'] detail = ['Time schedule is from 10:00 to 14:00', 'Plays football at Shin-Yokohama park.', 'Shopping with friends at Yokohama Station'] expected_date = ['2013-04-20', '20...
TestStringMethods
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestStringMethods: def test_adding_schedule_success(self): """This is testing for adding schedule to the current schedule""" <|body_0|> def testing_delete_function(self): """This is testing for deleting schedule from the current schedule""" <|body_1|> de...
stack_v2_sparse_classes_10k_train_008627
5,436
no_license
[ { "docstring": "This is testing for adding schedule to the current schedule", "name": "test_adding_schedule_success", "signature": "def test_adding_schedule_success(self)" }, { "docstring": "This is testing for deleting schedule from the current schedule", "name": "testing_delete_function", ...
4
stack_v2_sparse_classes_30k_train_006852
Implement the Python class `TestStringMethods` described below. Class description: Implement the TestStringMethods class. Method signatures and docstrings: - def test_adding_schedule_success(self): This is testing for adding schedule to the current schedule - def testing_delete_function(self): This is testing for del...
Implement the Python class `TestStringMethods` described below. Class description: Implement the TestStringMethods class. Method signatures and docstrings: - def test_adding_schedule_success(self): This is testing for adding schedule to the current schedule - def testing_delete_function(self): This is testing for del...
72181672d800ec59bac06978cab08a59e734933e
<|skeleton|> class TestStringMethods: def test_adding_schedule_success(self): """This is testing for adding schedule to the current schedule""" <|body_0|> def testing_delete_function(self): """This is testing for deleting schedule from the current schedule""" <|body_1|> de...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestStringMethods: def test_adding_schedule_success(self): """This is testing for adding schedule to the current schedule""" date = ['2013-04-20', '2013-04-21', '2013-04-22'] title = ['MA for 2013-04', 'Football', 'Shopping'] detail = ['Time schedule is from 10:00 to 14:00', 'P...
the_stack_v2_python_sparse
TechExam/Exam Folder/Calendar_EYM/UnitTest.py
yemarn510/YM_Python
train
0
03ef1fdbabe2639106eb3eaec0b2c5972a3e6a55
[ "self.field = str(field)\nself.is_floating = bool(floating)\nself.derivative_order = int(derivative_order)\nsuper().__init__(channel_group=channel_group, gain_provider=gain_provider, name=name)", "values = getattr(integration.frames, self.field, None)\nif values is None:\n values = np.zeros(integration.size, d...
<|body_start_0|> self.field = str(field) self.is_floating = bool(floating) self.derivative_order = int(derivative_order) super().__init__(channel_group=channel_group, gain_provider=gain_provider, name=name) <|end_body_0|> <|body_start_1|> values = getattr(integration.frames, sel...
FieldResponse
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FieldResponse: def __init__(self, channel_group=None, gain_provider=None, name=None, floating=False, field=None, derivative_order=0): """Returns a field response mode. The field response mode is designed to return a signal based of a data field in the integration frame data. Parameters -...
stack_v2_sparse_classes_10k_train_008628
2,728
permissive
[ { "docstring": "Returns a field response mode. The field response mode is designed to return a signal based of a data field in the integration frame data. Parameters ---------- channel_group : ChannelGroup, optional The channel group owned by the mode. gain_provider : str or GainProvider, optional If a string i...
2
stack_v2_sparse_classes_30k_train_006364
Implement the Python class `FieldResponse` described below. Class description: Implement the FieldResponse class. Method signatures and docstrings: - def __init__(self, channel_group=None, gain_provider=None, name=None, floating=False, field=None, derivative_order=0): Returns a field response mode. The field response...
Implement the Python class `FieldResponse` described below. Class description: Implement the FieldResponse class. Method signatures and docstrings: - def __init__(self, channel_group=None, gain_provider=None, name=None, floating=False, field=None, derivative_order=0): Returns a field response mode. The field response...
493700340cd34d5f319af6f3a562a82135bb30dd
<|skeleton|> class FieldResponse: def __init__(self, channel_group=None, gain_provider=None, name=None, floating=False, field=None, derivative_order=0): """Returns a field response mode. The field response mode is designed to return a signal based of a data field in the integration frame data. Parameters -...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FieldResponse: def __init__(self, channel_group=None, gain_provider=None, name=None, floating=False, field=None, derivative_order=0): """Returns a field response mode. The field response mode is designed to return a signal based of a data field in the integration frame data. Parameters ---------- chan...
the_stack_v2_python_sparse
sofia_redux/scan/channels/mode/field_response.py
SOFIA-USRA/sofia_redux
train
12
7e90ae114aa9ea6108be0adb5f0c6aa7f4d7fd4b
[ "Piece.reset_counters()\nMaterial.reset_counter()\nLocator.reset_counter()\nBones.reset_counter()\nself.__part_count = part_count\nself.__skeleton = skeleton.replace('\\\\', '/')", "section = _SectionData('Global')\nsection.props.append(('VertexCount', Piece.get_global_vertex_count()))\nsection.props.append(('Tri...
<|body_start_0|> Piece.reset_counters() Material.reset_counter() Locator.reset_counter() Bones.reset_counter() self.__part_count = part_count self.__skeleton = skeleton.replace('\\', '/') <|end_body_0|> <|body_start_1|> section = _SectionData('Global') se...
Globall
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Globall: def __init__(self, part_count, skeleton): """Constructs global for PIM :param part_count: parts counter for current game object (including any parts from PIC and PIT :type part_count: int :param skeleton: file name of the skeleton file :type skeleton: str""" <|body_0|> ...
stack_v2_sparse_classes_10k_train_008629
2,625
no_license
[ { "docstring": "Constructs global for PIM :param part_count: parts counter for current game object (including any parts from PIC and PIT :type part_count: int :param skeleton: file name of the skeleton file :type skeleton: str", "name": "__init__", "signature": "def __init__(self, part_count, skeleton)"...
2
null
Implement the Python class `Globall` described below. Class description: Implement the Globall class. Method signatures and docstrings: - def __init__(self, part_count, skeleton): Constructs global for PIM :param part_count: parts counter for current game object (including any parts from PIC and PIT :type part_count:...
Implement the Python class `Globall` described below. Class description: Implement the Globall class. Method signatures and docstrings: - def __init__(self, part_count, skeleton): Constructs global for PIM :param part_count: parts counter for current game object (including any parts from PIC and PIT :type part_count:...
7b796d30dfd22b7706a93e4419ed913d18d29a44
<|skeleton|> class Globall: def __init__(self, part_count, skeleton): """Constructs global for PIM :param part_count: parts counter for current game object (including any parts from PIC and PIT :type part_count: int :param skeleton: file name of the skeleton file :type skeleton: str""" <|body_0|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Globall: def __init__(self, part_count, skeleton): """Constructs global for PIM :param part_count: parts counter for current game object (including any parts from PIC and PIT :type part_count: int :param skeleton: file name of the skeleton file :type skeleton: str""" Piece.reset_counters() ...
the_stack_v2_python_sparse
All_In_One/addons/io_scs_tools/exp/pim/globall.py
2434325680/Learnbgame
train
0
bf6986abbbc7712c848b3778cab7dc1cf0273435
[ "if not template_dirs:\n template_dirs = self.get_dirs(app_label=app_label, model_name=model_name)\nfor template_dir in template_dirs:\n try:\n name = safe_join(template_dir, template_name)\n except SuspiciousFileOperation:\n continue\n yield Origin(name=name, template_name=template_name, ...
<|body_start_0|> if not template_dirs: template_dirs = self.get_dirs(app_label=app_label, model_name=model_name) for template_dir in template_dirs: try: name = safe_join(template_dir, template_name) except SuspiciousFileOperation: conti...
FoundationMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FoundationMixin: def get_template_sources(self, template_name, template_dirs=None, app_label=None, model_name=None): """Return an Origin object pointing to an absolute path in each directory in template_dirs. For security reasons, if a path doesn't lie inside one of the template_dirs it ...
stack_v2_sparse_classes_10k_train_008630
2,535
permissive
[ { "docstring": "Return an Origin object pointing to an absolute path in each directory in template_dirs. For security reasons, if a path doesn't lie inside one of the template_dirs it is excluded from the result set. Source: django.template.loaders.filesystem.Loader Hard override accepts app_label and model_nam...
2
stack_v2_sparse_classes_30k_train_002316
Implement the Python class `FoundationMixin` described below. Class description: Implement the FoundationMixin class. Method signatures and docstrings: - def get_template_sources(self, template_name, template_dirs=None, app_label=None, model_name=None): Return an Origin object pointing to an absolute path in each dir...
Implement the Python class `FoundationMixin` described below. Class description: Implement the FoundationMixin class. Method signatures and docstrings: - def get_template_sources(self, template_name, template_dirs=None, app_label=None, model_name=None): Return an Origin object pointing to an absolute path in each dir...
3762baf7e10bf80bfb6efb44a585beff8e8fc882
<|skeleton|> class FoundationMixin: def get_template_sources(self, template_name, template_dirs=None, app_label=None, model_name=None): """Return an Origin object pointing to an absolute path in each directory in template_dirs. For security reasons, if a path doesn't lie inside one of the template_dirs it ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FoundationMixin: def get_template_sources(self, template_name, template_dirs=None, app_label=None, model_name=None): """Return an Origin object pointing to an absolute path in each directory in template_dirs. For security reasons, if a path doesn't lie inside one of the template_dirs it is excluded fr...
the_stack_v2_python_sparse
foundation/template/loaders/base.py
altio/foundation
train
5
47f3dc0d9132d74572235216c330a28e86d0bd34
[ "n = len(nums)\nif n == 0:\n return 0\nl = 0\nr = 0\nc = nums[0]\nans = 0\nwhile l < n:\n while c < k:\n r += 1\n if r >= n:\n break\n c += nums[r]\n if c == k:\n ans += 1\n c -= nums[l]\n if l < r:\n l += 1\n else:\n l += 1\n r = l\n ...
<|body_start_0|> n = len(nums) if n == 0: return 0 l = 0 r = 0 c = nums[0] ans = 0 while l < n: while c < k: r += 1 if r >= n: break c += nums[r] if c == k: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def subarraySumWA(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_0|> def subarraySumT(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_1|> def subarraySum(self, nums, k): """:type ...
stack_v2_sparse_classes_10k_train_008631
2,230
no_license
[ { "docstring": ":type nums: List[int] :type k: int :rtype: int", "name": "subarraySumWA", "signature": "def subarraySumWA(self, nums, k)" }, { "docstring": ":type nums: List[int] :type k: int :rtype: int", "name": "subarraySumT", "signature": "def subarraySumT(self, nums, k)" }, { ...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subarraySumWA(self, nums, k): :type nums: List[int] :type k: int :rtype: int - def subarraySumT(self, nums, k): :type nums: List[int] :type k: int :rtype: int - def subarrayS...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subarraySumWA(self, nums, k): :type nums: List[int] :type k: int :rtype: int - def subarraySumT(self, nums, k): :type nums: List[int] :type k: int :rtype: int - def subarrayS...
02ebe56cd92b9f4baeee132c5077892590018650
<|skeleton|> class Solution: def subarraySumWA(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_0|> def subarraySumT(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_1|> def subarraySum(self, nums, k): """:type ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def subarraySumWA(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" n = len(nums) if n == 0: return 0 l = 0 r = 0 c = nums[0] ans = 0 while l < n: while c < k: r += 1 ...
the_stack_v2_python_sparse
python/leetcode.560.py
CalvinNeo/LeetCode
train
3
b9eba7d515cd54628c5ef0b7208c2f9e8a1c01fb
[ "if head is None:\n return None\nresult_head = head\nodd_cur = head\neven_head = even_cur = head.next\nwhile even_cur is not None and even_cur.next is not None:\n tmp = odd_cur.next\n odd_cur.next = odd_cur.next.next\n if odd_cur.next is not None:\n odd_cur = odd_cur.next\n even_cur = tmp\n ...
<|body_start_0|> if head is None: return None result_head = head odd_cur = head even_head = even_cur = head.next while even_cur is not None and even_cur.next is not None: tmp = odd_cur.next odd_cur.next = odd_cur.next.next if odd_cu...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def oddEvenList2(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def oddEvenList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> if head is None: return ...
stack_v2_sparse_classes_10k_train_008632
1,764
no_license
[ { "docstring": ":type head: ListNode :rtype: ListNode", "name": "oddEvenList2", "signature": "def oddEvenList2(self, head)" }, { "docstring": ":type head: ListNode :rtype: ListNode", "name": "oddEvenList", "signature": "def oddEvenList(self, head)" } ]
2
stack_v2_sparse_classes_30k_train_002999
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def oddEvenList2(self, head): :type head: ListNode :rtype: ListNode - def oddEvenList(self, head): :type head: ListNode :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def oddEvenList2(self, head): :type head: ListNode :rtype: ListNode - def oddEvenList(self, head): :type head: ListNode :rtype: ListNode <|skeleton|> class Solution: def od...
852fad258f5070c7b93c35252f7404e85e709ea6
<|skeleton|> class Solution: def oddEvenList2(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def oddEvenList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def oddEvenList2(self, head): """:type head: ListNode :rtype: ListNode""" if head is None: return None result_head = head odd_cur = head even_head = even_cur = head.next while even_cur is not None and even_cur.next is not None: ...
the_stack_v2_python_sparse
301-400/328. Odd Even Linked List.py
SunnyMarkLiu/LeetCode
train
1
44b40b5fe641d3e6b46842f191837bd751edbdff
[ "self.key = key\nself.value = value\nself.prev = prev\nself.next = next", "if self.prev:\n self.prev.next = self.next\nif self.next:\n self.next.prev = self.prev" ]
<|body_start_0|> self.key = key self.value = value self.prev = prev self.next = next <|end_body_0|> <|body_start_1|> if self.prev: self.prev.next = self.next if self.next: self.next.prev = self.prev <|end_body_1|>
CacheNode
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CacheNode: def __init__(self, key, value, prev=None, next=None): """A node in a doubly-linked list-based LRU cache. :param key : Key by which to access nodes. :param value : Value accessed by key. :param prev [CacheNode] : Previous CacheNode in list, defaults to None :param next [CacheNo...
stack_v2_sparse_classes_10k_train_008633
4,360
permissive
[ { "docstring": "A node in a doubly-linked list-based LRU cache. :param key : Key by which to access nodes. :param value : Value accessed by key. :param prev [CacheNode] : Previous CacheNode in list, defaults to None :param next [CacheNode] : Next CacheNode in list, defaults to None", "name": "__init__", ...
2
stack_v2_sparse_classes_30k_train_001916
Implement the Python class `CacheNode` described below. Class description: Implement the CacheNode class. Method signatures and docstrings: - def __init__(self, key, value, prev=None, next=None): A node in a doubly-linked list-based LRU cache. :param key : Key by which to access nodes. :param value : Value accessed b...
Implement the Python class `CacheNode` described below. Class description: Implement the CacheNode class. Method signatures and docstrings: - def __init__(self, key, value, prev=None, next=None): A node in a doubly-linked list-based LRU cache. :param key : Key by which to access nodes. :param value : Value accessed b...
b0b3d3c6dc3fa397c8c7a492098a02cf75e0ff82
<|skeleton|> class CacheNode: def __init__(self, key, value, prev=None, next=None): """A node in a doubly-linked list-based LRU cache. :param key : Key by which to access nodes. :param value : Value accessed by key. :param prev [CacheNode] : Previous CacheNode in list, defaults to None :param next [CacheNo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CacheNode: def __init__(self, key, value, prev=None, next=None): """A node in a doubly-linked list-based LRU cache. :param key : Key by which to access nodes. :param value : Value accessed by key. :param prev [CacheNode] : Previous CacheNode in list, defaults to None :param next [CacheNode] : Next Cac...
the_stack_v2_python_sparse
cs/lambda_cs/03_data_structures/lru_cache/lru_cache_cachenode.py
tobias-fyi/vela
train
0
ae5cbd882c78ebb5413b5c645474fa006abb3c63
[ "super(MEGNet, self).__init__()\ntry:\n from torch_geometric.nn import Set2Set\nexcept ModuleNotFoundError:\n raise ImportError('MEGNet model requires torch_geometric to be installed')\nif mode not in ['classification', 'regression']:\n raise ValueError(\"mode must be either 'classification' or 'regression...
<|body_start_0|> super(MEGNet, self).__init__() try: from torch_geometric.nn import Set2Set except ModuleNotFoundError: raise ImportError('MEGNet model requires torch_geometric to be installed') if mode not in ['classification', 'regression']: raise Va...
MatErials Graph Network A model for predicting crystal and molecular properties using GraphNetworks. Example ------- >>> import numpy as np >>> from torch_geometric.data import Batch >>> from deepchem.feat import GraphData >>> n_nodes, n_node_features = 5, 10 >>> n_edges, n_edge_attrs = 5, 2 >>> n_global_features = 4 >...
MEGNet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MEGNet: """MatErials Graph Network A model for predicting crystal and molecular properties using GraphNetworks. Example ------- >>> import numpy as np >>> from torch_geometric.data import Batch >>> from deepchem.feat import GraphData >>> n_nodes, n_node_features = 5, 10 >>> n_edges, n_edge_attrs ...
stack_v2_sparse_classes_10k_train_008634
11,170
permissive
[ { "docstring": "Parameters ---------- n_node_features: int Number of features in a node n_edge_features: int Number of features in a edge n_global_features: int Number of global features n_blocks: int Number of GraphNetworks block to use in update is_undirected: bool, optional (default True) True when the graph...
2
null
Implement the Python class `MEGNet` described below. Class description: MatErials Graph Network A model for predicting crystal and molecular properties using GraphNetworks. Example ------- >>> import numpy as np >>> from torch_geometric.data import Batch >>> from deepchem.feat import GraphData >>> n_nodes, n_node_feat...
Implement the Python class `MEGNet` described below. Class description: MatErials Graph Network A model for predicting crystal and molecular properties using GraphNetworks. Example ------- >>> import numpy as np >>> from torch_geometric.data import Batch >>> from deepchem.feat import GraphData >>> n_nodes, n_node_feat...
ee6e67ebcf7bf04259cf13aff6388e2b791fea3d
<|skeleton|> class MEGNet: """MatErials Graph Network A model for predicting crystal and molecular properties using GraphNetworks. Example ------- >>> import numpy as np >>> from torch_geometric.data import Batch >>> from deepchem.feat import GraphData >>> n_nodes, n_node_features = 5, 10 >>> n_edges, n_edge_attrs ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MEGNet: """MatErials Graph Network A model for predicting crystal and molecular properties using GraphNetworks. Example ------- >>> import numpy as np >>> from torch_geometric.data import Batch >>> from deepchem.feat import GraphData >>> n_nodes, n_node_features = 5, 10 >>> n_edges, n_edge_attrs = 5, 2 >>> n_...
the_stack_v2_python_sparse
deepchem/models/torch_models/megnet.py
deepchem/deepchem
train
4,876
e578a369edf64f61418bc0d07009cb278ce335b9
[ "if '_xml_ns' in kwargs:\n self._xml_ns = kwargs['_xml_ns']\nif '_xml_ns_key' in kwargs:\n self._xml_ns_key = kwargs['_xml_ns_key']\nself.ModeID = ModeID\nself.ModeType = ModeType\nsuper(RadarModeType, self).__init__(**kwargs)", "mode = self.ModeType\nif mode == 'SPOTLIGHT':\n return 'SL'\nelif mode == '...
<|body_start_0|> if '_xml_ns' in kwargs: self._xml_ns = kwargs['_xml_ns'] if '_xml_ns_key' in kwargs: self._xml_ns_key = kwargs['_xml_ns_key'] self.ModeID = ModeID self.ModeType = ModeType super(RadarModeType, self).__init__(**kwargs) <|end_body_0|> <|bod...
Radar mode type container class
RadarModeType
[ "MIT", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RadarModeType: """Radar mode type container class""" def __init__(self, ModeType: str=None, ModeID: Optional[str]=None, **kwargs): """Parameters ---------- ModeType : str ModeID : None|str kwargs""" <|body_0|> def get_mode_abbreviation(self) -> str: """Get the mo...
stack_v2_sparse_classes_10k_train_008635
5,859
permissive
[ { "docstring": "Parameters ---------- ModeType : str ModeID : None|str kwargs", "name": "__init__", "signature": "def __init__(self, ModeType: str=None, ModeID: Optional[str]=None, **kwargs)" }, { "docstring": "Get the mode abbreviation for the suggested name. Returns ------- str", "name": "...
2
null
Implement the Python class `RadarModeType` described below. Class description: Radar mode type container class Method signatures and docstrings: - def __init__(self, ModeType: str=None, ModeID: Optional[str]=None, **kwargs): Parameters ---------- ModeType : str ModeID : None|str kwargs - def get_mode_abbreviation(sel...
Implement the Python class `RadarModeType` described below. Class description: Radar mode type container class Method signatures and docstrings: - def __init__(self, ModeType: str=None, ModeID: Optional[str]=None, **kwargs): Parameters ---------- ModeType : str ModeID : None|str kwargs - def get_mode_abbreviation(sel...
de1b1886f161a83b6c89aadc7a2c7cfc4892ef81
<|skeleton|> class RadarModeType: """Radar mode type container class""" def __init__(self, ModeType: str=None, ModeID: Optional[str]=None, **kwargs): """Parameters ---------- ModeType : str ModeID : None|str kwargs""" <|body_0|> def get_mode_abbreviation(self) -> str: """Get the mo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RadarModeType: """Radar mode type container class""" def __init__(self, ModeType: str=None, ModeID: Optional[str]=None, **kwargs): """Parameters ---------- ModeType : str ModeID : None|str kwargs""" if '_xml_ns' in kwargs: self._xml_ns = kwargs['_xml_ns'] if '_xml_ns_k...
the_stack_v2_python_sparse
sarpy/io/complex/sicd_elements/CollectionInfo.py
ngageoint/sarpy
train
192
09a1b6c560f856e1d686ae30b19f01eb21edce10
[ "painter = QPainter(self.outPixmap())\npainter.drawPixmap(QPoint(0, 0), self.startPixmap())\nreturn (-1.0, 1.0)", "out = self.outPixmap()\npainter = QPainter(out)\npainter.eraseRect(0, 0, out.width(), out.height())\nif alpha < 0.0:\n alpha = -1.0 * alpha\n source = self.startPixmap()\nelse:\n source = se...
<|body_start_0|> painter = QPainter(self.outPixmap()) painter.drawPixmap(QPoint(0, 0), self.startPixmap()) return (-1.0, 1.0) <|end_body_0|> <|body_start_1|> out = self.outPixmap() painter = QPainter(out) painter.eraseRect(0, 0, out.width(), out.height()) if alph...
A QPixmapTransition which animates using a fade effect.
QFadeTransition
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QFadeTransition: """A QPixmapTransition which animates using a fade effect.""" def preparePixmap(self): """Prepare the pixmap(s) for the transition. This method draws the starting pixmap into the output pixmap. The transition updates then draw the relevant pixmaps into the output usi...
stack_v2_sparse_classes_10k_train_008636
14,565
permissive
[ { "docstring": "Prepare the pixmap(s) for the transition. This method draws the starting pixmap into the output pixmap. The transition updates then draw the relevant pixmaps into the output using an appropriate alpha.", "name": "preparePixmap", "signature": "def preparePixmap(self)" }, { "docstr...
2
stack_v2_sparse_classes_30k_train_001931
Implement the Python class `QFadeTransition` described below. Class description: A QPixmapTransition which animates using a fade effect. Method signatures and docstrings: - def preparePixmap(self): Prepare the pixmap(s) for the transition. This method draws the starting pixmap into the output pixmap. The transition u...
Implement the Python class `QFadeTransition` described below. Class description: A QPixmapTransition which animates using a fade effect. Method signatures and docstrings: - def preparePixmap(self): Prepare the pixmap(s) for the transition. This method draws the starting pixmap into the output pixmap. The transition u...
1544e7fb371b8f941cfa2fde682795e479380284
<|skeleton|> class QFadeTransition: """A QPixmapTransition which animates using a fade effect.""" def preparePixmap(self): """Prepare the pixmap(s) for the transition. This method draws the starting pixmap into the output pixmap. The transition updates then draw the relevant pixmaps into the output usi...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class QFadeTransition: """A QPixmapTransition which animates using a fade effect.""" def preparePixmap(self): """Prepare the pixmap(s) for the transition. This method draws the starting pixmap into the output pixmap. The transition updates then draw the relevant pixmaps into the output using an appropr...
the_stack_v2_python_sparse
enaml/qt/q_pixmap_transition.py
MatthieuDartiailh/enaml
train
26
d9308740213e815b4e7a8b68d07333844a9dbc01
[ "self.API_KEY = api_key\nself.API_CURRENT = api_current\nself.API_FORECAST = api_forecast", "payloadCurrent = {'lat': str(lat), 'lon': str(lon), 'key': self.API_KEY}\ntry:\n r = requests.get(self.API_CURRENT, payloadCurrent)\n if r.status_code != 200:\n print('not successfull status code: ', r.status...
<|body_start_0|> self.API_KEY = api_key self.API_CURRENT = api_current self.API_FORECAST = api_forecast <|end_body_0|> <|body_start_1|> payloadCurrent = {'lat': str(lat), 'lon': str(lon), 'key': self.API_KEY} try: r = requests.get(self.API_CURRENT, payloadCurrent) ...
WeatherAPI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WeatherAPI: def __init__(self, api_key='3d34a9a9b0e544269a3ddbb97ec89ba7', api_current='https://api.weatherbit.io/v2.0/current', api_forecast='https://api.weatherbit.io/v2.0/forecast/hourly?'): """inits weather request class""" <|body_0|> def getCurrent(self, lat, lon): ...
stack_v2_sparse_classes_10k_train_008637
4,531
permissive
[ { "docstring": "inits weather request class", "name": "__init__", "signature": "def __init__(self, api_key='3d34a9a9b0e544269a3ddbb97ec89ba7', api_current='https://api.weatherbit.io/v2.0/current', api_forecast='https://api.weatherbit.io/v2.0/forecast/hourly?')" }, { "docstring": "queries the api...
3
stack_v2_sparse_classes_30k_train_005131
Implement the Python class `WeatherAPI` described below. Class description: Implement the WeatherAPI class. Method signatures and docstrings: - def __init__(self, api_key='3d34a9a9b0e544269a3ddbb97ec89ba7', api_current='https://api.weatherbit.io/v2.0/current', api_forecast='https://api.weatherbit.io/v2.0/forecast/hou...
Implement the Python class `WeatherAPI` described below. Class description: Implement the WeatherAPI class. Method signatures and docstrings: - def __init__(self, api_key='3d34a9a9b0e544269a3ddbb97ec89ba7', api_current='https://api.weatherbit.io/v2.0/current', api_forecast='https://api.weatherbit.io/v2.0/forecast/hou...
7e80b4f3af17959e75a61ac5a5f9c31805ce46dd
<|skeleton|> class WeatherAPI: def __init__(self, api_key='3d34a9a9b0e544269a3ddbb97ec89ba7', api_current='https://api.weatherbit.io/v2.0/current', api_forecast='https://api.weatherbit.io/v2.0/forecast/hourly?'): """inits weather request class""" <|body_0|> def getCurrent(self, lat, lon): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WeatherAPI: def __init__(self, api_key='3d34a9a9b0e544269a3ddbb97ec89ba7', api_current='https://api.weatherbit.io/v2.0/current', api_forecast='https://api.weatherbit.io/v2.0/forecast/hourly?'): """inits weather request class""" self.API_KEY = api_key self.API_CURRENT = api_current ...
the_stack_v2_python_sparse
backend/weather/weather_api.py
DinoSubbu/SmartEnergyManagementSystem
train
0
ef756d1f328db913294797b1c75adf059262fb9c
[ "if not height:\n return 0\nmax_hgt = max(height)\nlength = len(height)\nresult = length * max_hgt\nleft = 0\nright = length - 1\nwhile height[left] < max_hgt:\n left += 1\nwhile height[right] < max_hgt:\n right -= 1\ncurr = 0\nlast = 0\nwhile curr < left:\n if height[curr] > last:\n last = heigh...
<|body_start_0|> if not height: return 0 max_hgt = max(height) length = len(height) result = length * max_hgt left = 0 right = length - 1 while height[left] < max_hgt: left += 1 while height[right] < max_hgt: right -= 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def trap_old(self, height): """:type height: List[int] :rtype: int""" <|body_0|> def trap(self, height): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not height: return 0 max...
stack_v2_sparse_classes_10k_train_008638
1,926
no_license
[ { "docstring": ":type height: List[int] :rtype: int", "name": "trap_old", "signature": "def trap_old(self, height)" }, { "docstring": ":type height: List[int] :rtype: int", "name": "trap", "signature": "def trap(self, height)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def trap_old(self, height): :type height: List[int] :rtype: int - def trap(self, height): :type height: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def trap_old(self, height): :type height: List[int] :rtype: int - def trap(self, height): :type height: List[int] :rtype: int <|skeleton|> class Solution: def trap_old(self...
dbdb227e12f329e4ca064b338f1fbdca42f3a848
<|skeleton|> class Solution: def trap_old(self, height): """:type height: List[int] :rtype: int""" <|body_0|> def trap(self, height): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def trap_old(self, height): """:type height: List[int] :rtype: int""" if not height: return 0 max_hgt = max(height) length = len(height) result = length * max_hgt left = 0 right = length - 1 while height[left] < max_hgt: ...
the_stack_v2_python_sparse
LC42.py
Qiao-Liang/LeetCode
train
0
385ed474b5b4d52ee05209b2dd9b62718e81d358
[ "self.label = label\nself.subsample_factor = 1 if subsample_factor is None else subsample_factor\nself.items = []\nself.i = 0", "item = (self.i, x)\nif self.subsample_factor == 1 or self.i % self.subsample_factor == 1 or (not self.items):\n self.items.append(item)\nelse:\n self.items[-1] = item\nself.i += 1...
<|body_start_0|> self.label = label self.subsample_factor = 1 if subsample_factor is None else subsample_factor self.items = [] self.i = 0 <|end_body_0|> <|body_start_1|> item = (self.i, x) if self.subsample_factor == 1 or self.i % self.subsample_factor == 1 or (not self...
A section in the Logging structure.
_Section
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _Section: """A section in the Logging structure.""" def __init__(self, label, subsample_factor=None): """Initialize a Section instance. Args: label: A short name for the section. subsample_factor: Rate at which to subsample logging in this section.""" <|body_0|> def log(...
stack_v2_sparse_classes_10k_train_008639
3,542
permissive
[ { "docstring": "Initialize a Section instance. Args: label: A short name for the section. subsample_factor: Rate at which to subsample logging in this section.", "name": "__init__", "signature": "def __init__(self, label, subsample_factor=None)" }, { "docstring": "Add a record to the log.", ...
2
null
Implement the Python class `_Section` described below. Class description: A section in the Logging structure. Method signatures and docstrings: - def __init__(self, label, subsample_factor=None): Initialize a Section instance. Args: label: A short name for the section. subsample_factor: Rate at which to subsample log...
Implement the Python class `_Section` described below. Class description: A section in the Logging structure. Method signatures and docstrings: - def __init__(self, label, subsample_factor=None): Initialize a Section instance. Args: label: A short name for the section. subsample_factor: Rate at which to subsample log...
548dc4e2e6a8e3ac65e1921bd94fe589d661d47b
<|skeleton|> class _Section: """A section in the Logging structure.""" def __init__(self, label, subsample_factor=None): """Initialize a Section instance. Args: label: A short name for the section. subsample_factor: Rate at which to subsample logging in this section.""" <|body_0|> def log(...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class _Section: """A section in the Logging structure.""" def __init__(self, label, subsample_factor=None): """Initialize a Section instance. Args: label: A short name for the section. subsample_factor: Rate at which to subsample logging in this section.""" self.label = label self.subsa...
the_stack_v2_python_sparse
magenta/models/coconet/lib_logging.py
magenta/magenta
train
4,142
b8af26faeb4444367f05b43d3ffe9fba193942e1
[ "obj = context.object\nif obj is None:\n return False\nreturn all([bool(obj), obj.type == 'MESH'])", "scene = context.scene\npg = scene.pdt_pg\nobj = bpy.context.view_layer.objects.active\nif obj is None:\n self.report({'ERROR'}, PDT_ERR_NO_ACT_OBJ)\n return {'FINISHED'}\nif 'PDT_PP_LOC' in obj:\n pg....
<|body_start_0|> obj = context.object if obj is None: return False return all([bool(obj), obj.type == 'MESH']) <|end_body_0|> <|body_start_1|> scene = context.scene pg = scene.pdt_pg obj = bpy.context.view_layer.objects.active if obj is None: ...
Read Pivot Point Location from Object
PDT_OT_PivotRead
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PDT_OT_PivotRead: """Read Pivot Point Location from Object""" def poll(cls, context): """Check Object Status. Args: context: Blender bpy.context instance. Returns: Nothing.""" <|body_0|> def execute(self, context): """Reads Pivot Point Location from Object's Cust...
stack_v2_sparse_classes_10k_train_008640
13,734
permissive
[ { "docstring": "Check Object Status. Args: context: Blender bpy.context instance. Returns: Nothing.", "name": "poll", "signature": "def poll(cls, context)" }, { "docstring": "Reads Pivot Point Location from Object's Custom Properties. Note: Sets Pivot Point Location from Object's Custom Properti...
2
null
Implement the Python class `PDT_OT_PivotRead` described below. Class description: Read Pivot Point Location from Object Method signatures and docstrings: - def poll(cls, context): Check Object Status. Args: context: Blender bpy.context instance. Returns: Nothing. - def execute(self, context): Reads Pivot Point Locati...
Implement the Python class `PDT_OT_PivotRead` described below. Class description: Read Pivot Point Location from Object Method signatures and docstrings: - def poll(cls, context): Check Object Status. Args: context: Blender bpy.context instance. Returns: Nothing. - def execute(self, context): Reads Pivot Point Locati...
4d5c304878c1e0018d97c1b07bcaa3981632265a
<|skeleton|> class PDT_OT_PivotRead: """Read Pivot Point Location from Object""" def poll(cls, context): """Check Object Status. Args: context: Blender bpy.context instance. Returns: Nothing.""" <|body_0|> def execute(self, context): """Reads Pivot Point Location from Object's Cust...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PDT_OT_PivotRead: """Read Pivot Point Location from Object""" def poll(cls, context): """Check Object Status. Args: context: Blender bpy.context instance. Returns: Nothing.""" obj = context.object if obj is None: return False return all([bool(obj), obj.type == ...
the_stack_v2_python_sparse
src/bpy/3.6/scripts/addons/precision_drawing_tools/pdt_pivot_point.py
RnoB/3DVisualSwarm
train
0
6269d8d4f5120b1c608477a7e1a9793cc79edd40
[ "list_themes = sorted(themes_info(), key=lambda theme: theme['title'].lower())\nhtml = render_to_string('administration/manifest/themes-list.html', {'list_themes': list_themes, 'current': request.website.theme}, context_instance=RequestContext(request))\nresponse = Response(status.HTTP_200_OK, {'html': html})\nretu...
<|body_start_0|> list_themes = sorted(themes_info(), key=lambda theme: theme['title'].lower()) html = render_to_string('administration/manifest/themes-list.html', {'list_themes': list_themes, 'current': request.website.theme}, context_instance=RequestContext(request)) response = Response(status....
Management of the authentication of users.
ThemesListView
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ThemesListView: """Management of the authentication of users.""" def get(self, request): """Managements of the Themes List""" <|body_0|> def post(self, request): """Change the page layout""" <|body_1|> <|end_skeleton|> <|body_start_0|> list_them...
stack_v2_sparse_classes_10k_train_008641
5,299
permissive
[ { "docstring": "Managements of the Themes List", "name": "get", "signature": "def get(self, request)" }, { "docstring": "Change the page layout", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_002826
Implement the Python class `ThemesListView` described below. Class description: Management of the authentication of users. Method signatures and docstrings: - def get(self, request): Managements of the Themes List - def post(self, request): Change the page layout
Implement the Python class `ThemesListView` described below. Class description: Management of the authentication of users. Method signatures and docstrings: - def get(self, request): Managements of the Themes List - def post(self, request): Change the page layout <|skeleton|> class ThemesListView: """Management ...
00947315b5bca4977f1de40ddb951f843c345532
<|skeleton|> class ThemesListView: """Management of the authentication of users.""" def get(self, request): """Managements of the Themes List""" <|body_0|> def post(self, request): """Change the page layout""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ThemesListView: """Management of the authentication of users.""" def get(self, request): """Managements of the Themes List""" list_themes = sorted(themes_info(), key=lambda theme: theme['title'].lower()) html = render_to_string('administration/manifest/themes-list.html', {'list_th...
the_stack_v2_python_sparse
ionyweb/administration/views/manifest.py
ionyse/ionyweb
train
4
be44dd07365bc7b545def11d9cc4288f6a0eef02
[ "self.messages = messages\nself.source_permissions = permissions\nself.testable_permissions_map = {}\nif permissions:\n for permission in GetTestablePermissions(iam_client, messages, resource):\n self.testable_permissions_map[permission.name] = permission", "testing_permissions = []\nfor permission in s...
<|body_start_0|> self.messages = messages self.source_permissions = permissions self.testable_permissions_map = {} if permissions: for permission in GetTestablePermissions(iam_client, messages, resource): self.testable_permissions_map[permission.name] = permis...
Get different kinds of permissions list from permissions provided. Attributes: messages: The iam messages. source_permissions: A list of permissions to inspect. testable_permissions_map: A dict maps from permissions name string to Permission message provided by the API.
PermissionsHelper
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PermissionsHelper: """Get different kinds of permissions list from permissions provided. Attributes: messages: The iam messages. source_permissions: A list of permissions to inspect. testable_permissions_map: A dict maps from permissions name string to Permission message provided by the API.""" ...
stack_v2_sparse_classes_10k_train_008642
5,171
permissive
[ { "docstring": "Create a PermissionsHelper object. To get the testable permissions for the given resource and store as a dict. Args: iam_client: The iam client. messages: The iam messages. resource: Resource reference for the project/organization whose permissions are being inspected. permissions: A list of per...
6
null
Implement the Python class `PermissionsHelper` described below. Class description: Get different kinds of permissions list from permissions provided. Attributes: messages: The iam messages. source_permissions: A list of permissions to inspect. testable_permissions_map: A dict maps from permissions name string to Permi...
Implement the Python class `PermissionsHelper` described below. Class description: Get different kinds of permissions list from permissions provided. Attributes: messages: The iam messages. source_permissions: A list of permissions to inspect. testable_permissions_map: A dict maps from permissions name string to Permi...
85bb264e273568b5a0408f733b403c56373e2508
<|skeleton|> class PermissionsHelper: """Get different kinds of permissions list from permissions provided. Attributes: messages: The iam messages. source_permissions: A list of permissions to inspect. testable_permissions_map: A dict maps from permissions name string to Permission message provided by the API.""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PermissionsHelper: """Get different kinds of permissions list from permissions provided. Attributes: messages: The iam messages. source_permissions: A list of permissions to inspect. testable_permissions_map: A dict maps from permissions name string to Permission message provided by the API.""" def __ini...
the_stack_v2_python_sparse
google-cloud-sdk/lib/googlecloudsdk/api_lib/iam/util.py
bopopescu/socialliteapp
train
0
7430fb3fc614b445f337d2cc41ea219d49ab2751
[ "data = 281 * np.ones((3, 3, 3), dtype=np.float32)\nself.cube = set_up_variable_cube(data, realizations=[0, 1, 2])\nself.expected_data = self.cube.collapsed(['realization'], iris.analysis.MEAN).data", "result = collapsed(self.cube, 'realization', iris.analysis.MEAN)\nself.assertTupleEqual(result.cell_methods, ())...
<|body_start_0|> data = 281 * np.ones((3, 3, 3), dtype=np.float32) self.cube = set_up_variable_cube(data, realizations=[0, 1, 2]) self.expected_data = self.cube.collapsed(['realization'], iris.analysis.MEAN).data <|end_body_0|> <|body_start_1|> result = collapsed(self.cube, 'realization...
Test the collapsed utility.
Test_collapsed
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_collapsed: """Test the collapsed utility.""" def setUp(self): """Use temperature cube to test with.""" <|body_0|> def test_single_method(self): """Test that a collapsed cube is returned with no cell method added""" <|body_1|> def test_two_method...
stack_v2_sparse_classes_10k_train_008643
3,649
permissive
[ { "docstring": "Use temperature cube to test with.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test that a collapsed cube is returned with no cell method added", "name": "test_single_method", "signature": "def test_single_method(self)" }, { "docstring": "...
4
null
Implement the Python class `Test_collapsed` described below. Class description: Test the collapsed utility. Method signatures and docstrings: - def setUp(self): Use temperature cube to test with. - def test_single_method(self): Test that a collapsed cube is returned with no cell method added - def test_two_methods(se...
Implement the Python class `Test_collapsed` described below. Class description: Test the collapsed utility. Method signatures and docstrings: - def setUp(self): Use temperature cube to test with. - def test_single_method(self): Test that a collapsed cube is returned with no cell method added - def test_two_methods(se...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test_collapsed: """Test the collapsed utility.""" def setUp(self): """Use temperature cube to test with.""" <|body_0|> def test_single_method(self): """Test that a collapsed cube is returned with no cell method added""" <|body_1|> def test_two_method...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Test_collapsed: """Test the collapsed utility.""" def setUp(self): """Use temperature cube to test with.""" data = 281 * np.ones((3, 3, 3), dtype=np.float32) self.cube = set_up_variable_cube(data, realizations=[0, 1, 2]) self.expected_data = self.cube.collapsed(['realizati...
the_stack_v2_python_sparse
improver_tests/utilities/cube_manipulation/test_collapsed.py
metoppv/improver
train
101
6f675dfb5ced443a341560bdc8f4ed5b7552a312
[ "super().__init__(*args, **kwargs)\nif self.instance.name:\n self.old_name = self.instance.name", "form_data = super().clean()\nname = form_data.get('name')\nif not name:\n self.add_error('name', _('Name cannot be empty'))\n return form_data\nmsg = is_legal_name(form_data['name'])\nif msg:\n self.add_...
<|body_start_0|> super().__init__(*args, **kwargs) if self.instance.name: self.old_name = self.instance.name <|end_body_0|> <|body_start_1|> form_data = super().clean() name = form_data.get('name') if not name: self.add_error('name', _('Name cannot be emp...
Form to read information about a condition. The same as the filter but we need to enforce that the name is a valid variable name
ConditionForm
[ "LGPL-2.0-or-later", "BSD-3-Clause", "MIT", "Apache-2.0", "LGPL-2.1-only", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConditionForm: """Form to read information about a condition. The same as the filter but we need to enforce that the name is a valid variable name""" def __init__(self, *args, **kwargs): """Remember the old name.""" <|body_0|> def clean(self) -> Dict: """Check th...
stack_v2_sparse_classes_10k_train_008644
2,892
permissive
[ { "docstring": "Remember the old name.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Check that data is not empty.", "name": "clean", "signature": "def clean(self) -> Dict" } ]
2
null
Implement the Python class `ConditionForm` described below. Class description: Form to read information about a condition. The same as the filter but we need to enforce that the name is a valid variable name Method signatures and docstrings: - def __init__(self, *args, **kwargs): Remember the old name. - def clean(se...
Implement the Python class `ConditionForm` described below. Class description: Form to read information about a condition. The same as the filter but we need to enforce that the name is a valid variable name Method signatures and docstrings: - def __init__(self, *args, **kwargs): Remember the old name. - def clean(se...
c432745dfff932cbe7397100422d49df78f0a882
<|skeleton|> class ConditionForm: """Form to read information about a condition. The same as the filter but we need to enforce that the name is a valid variable name""" def __init__(self, *args, **kwargs): """Remember the old name.""" <|body_0|> def clean(self) -> Dict: """Check th...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ConditionForm: """Form to read information about a condition. The same as the filter but we need to enforce that the name is a valid variable name""" def __init__(self, *args, **kwargs): """Remember the old name.""" super().__init__(*args, **kwargs) if self.instance.name: ...
the_stack_v2_python_sparse
ontask/condition/forms.py
abelardopardo/ontask_b
train
43
d034dccccfa15c62ae5986af406f6ea4028dd84c
[ "self.num_points = num_points\nself.x_values = [0]\nself.y_values = [0]", "choise_list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\ndirection = choice([1, -1])\ndistance = choice(choise_list)\nstep = direction * distance\nreturn step", "while len(self.x_values) < self.num_points:\n x_step = self.get_step()\n y_step ...
<|body_start_0|> self.num_points = num_points self.x_values = [0] self.y_values = [0] <|end_body_0|> <|body_start_1|> choise_list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] direction = choice([1, -1]) distance = choice(choise_list) step = direction * distance retur...
一个生成随机漫步数据的类
RandomWalk
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomWalk: """一个生成随机漫步数据的类""" def __init__(self, num_points=5000): """初始化随机漫步的属性""" <|body_0|> def get_step(self): """确定漫步的距离和方向""" <|body_1|> def fill_walk(self): """计算随机漫步包含的所有点""" <|body_2|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_008645
1,449
no_license
[ { "docstring": "初始化随机漫步的属性", "name": "__init__", "signature": "def __init__(self, num_points=5000)" }, { "docstring": "确定漫步的距离和方向", "name": "get_step", "signature": "def get_step(self)" }, { "docstring": "计算随机漫步包含的所有点", "name": "fill_walk", "signature": "def fill_walk(sel...
3
stack_v2_sparse_classes_30k_train_001871
Implement the Python class `RandomWalk` described below. Class description: 一个生成随机漫步数据的类 Method signatures and docstrings: - def __init__(self, num_points=5000): 初始化随机漫步的属性 - def get_step(self): 确定漫步的距离和方向 - def fill_walk(self): 计算随机漫步包含的所有点
Implement the Python class `RandomWalk` described below. Class description: 一个生成随机漫步数据的类 Method signatures and docstrings: - def __init__(self, num_points=5000): 初始化随机漫步的属性 - def get_step(self): 确定漫步的距离和方向 - def fill_walk(self): 计算随机漫步包含的所有点 <|skeleton|> class RandomWalk: """一个生成随机漫步数据的类""" def __init__(sel...
5aa4f0adbec0176cee8cc73a27eb02a95469d651
<|skeleton|> class RandomWalk: """一个生成随机漫步数据的类""" def __init__(self, num_points=5000): """初始化随机漫步的属性""" <|body_0|> def get_step(self): """确定漫步的距离和方向""" <|body_1|> def fill_walk(self): """计算随机漫步包含的所有点""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RandomWalk: """一个生成随机漫步数据的类""" def __init__(self, num_points=5000): """初始化随机漫步的属性""" self.num_points = num_points self.x_values = [0] self.y_values = [0] def get_step(self): """确定漫步的距离和方向""" choise_list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] directio...
the_stack_v2_python_sparse
random_walk/random_walk.py
chenlfc/learnPython
train
0
90ac2fbed5ce65682195370a2f324ff9354e99ef
[ "project_id, recording_id = util.project_or_object(project, recording)\nurl = self.ARCHIVE_URL.format(base_url=self.url, project_id=project_id, recording_id=recording_id)\nself._no_response(url, method='PUT')", "project_id, recording_id = util.project_or_object(project, recording)\nurl = self.UNARCHIVE_URL.format...
<|body_start_0|> project_id, recording_id = util.project_or_object(project, recording) url = self.ARCHIVE_URL.format(base_url=self.url, project_id=project_id, recording_id=recording_id) self._no_response(url, method='PUT') <|end_body_0|> <|body_start_1|> project_id, recording_id = util....
RecordingEndpointBase
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RecordingEndpointBase: def archive(self, project=None, recording=None): """Archive a Recording given its Project and Recording ID. :param project: a Project object or ID :type project: basecampy3.endpoints.projects.Project|int :param recording: a Recording object or ID :type recording: R...
stack_v2_sparse_classes_10k_train_008646
9,721
permissive
[ { "docstring": "Archive a Recording given its Project and Recording ID. :param project: a Project object or ID :type project: basecampy3.endpoints.projects.Project|int :param recording: a Recording object or ID :type recording: Recording|int", "name": "archive", "signature": "def archive(self, project=N...
3
stack_v2_sparse_classes_30k_train_006431
Implement the Python class `RecordingEndpointBase` described below. Class description: Implement the RecordingEndpointBase class. Method signatures and docstrings: - def archive(self, project=None, recording=None): Archive a Recording given its Project and Recording ID. :param project: a Project object or ID :type pr...
Implement the Python class `RecordingEndpointBase` described below. Class description: Implement the RecordingEndpointBase class. Method signatures and docstrings: - def archive(self, project=None, recording=None): Archive a Recording given its Project and Recording ID. :param project: a Project object or ID :type pr...
bece72d06b91de0e33afd2181c59b895dbe7ae1f
<|skeleton|> class RecordingEndpointBase: def archive(self, project=None, recording=None): """Archive a Recording given its Project and Recording ID. :param project: a Project object or ID :type project: basecampy3.endpoints.projects.Project|int :param recording: a Recording object or ID :type recording: R...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RecordingEndpointBase: def archive(self, project=None, recording=None): """Archive a Recording given its Project and Recording ID. :param project: a Project object or ID :type project: basecampy3.endpoints.projects.Project|int :param recording: a Recording object or ID :type recording: Recording|int""...
the_stack_v2_python_sparse
basecampy3/endpoints/_base.py
phistrom/basecampy3
train
34
8debfd1102c21856b970035936380611c8565090
[ "self.rule_spec = line\nself.rules = []\nself.delete_kws = []\nself.section_name = []", "if self.rules:\n return\nirules, sname = interpret_entry(self.rule_spec, hdr)\nif sname:\n self.section_name.append(sname)\nif irules:\n self.rules = irules" ]
<|body_start_0|> self.rule_spec = line self.rules = [] self.delete_kws = [] self.section_name = [] <|end_body_0|> <|body_start_1|> if self.rules: return irules, sname = interpret_entry(self.rule_spec, hdr) if sname: self.section_name.appen...
This class encapsulates the logic needed for interpreting a single keyword rule from a text file. Notes ----- The ``.rules`` attribute contains the interpreted set of rules that corresponds to this line. Example:: Interpreting rule from {'meta.attribute': { 'rule': 'first', 'output': 'meta.attribute'}} --or-- {'meta.at...
KwRule
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KwRule: """This class encapsulates the logic needed for interpreting a single keyword rule from a text file. Notes ----- The ``.rules`` attribute contains the interpreted set of rules that corresponds to this line. Example:: Interpreting rule from {'meta.attribute': { 'rule': 'first', 'output': '...
stack_v2_sparse_classes_10k_train_008647
17,429
permissive
[ { "docstring": "Initialize new keyword rule. Parameters ========== line : dict Line should be dict with attribute name as the key, and a dict as the value specifying 'rule' and (optionally)'output'.", "name": "__init__", "signature": "def __init__(self, line)" }, { "docstring": "Use metadata to ...
2
null
Implement the Python class `KwRule` described below. Class description: This class encapsulates the logic needed for interpreting a single keyword rule from a text file. Notes ----- The ``.rules`` attribute contains the interpreted set of rules that corresponds to this line. Example:: Interpreting rule from {'meta.att...
Implement the Python class `KwRule` described below. Class description: This class encapsulates the logic needed for interpreting a single keyword rule from a text file. Notes ----- The ``.rules`` attribute contains the interpreted set of rules that corresponds to this line. Example:: Interpreting rule from {'meta.att...
a4a0e8ad2b88249f01445ee1dcf175229c51033f
<|skeleton|> class KwRule: """This class encapsulates the logic needed for interpreting a single keyword rule from a text file. Notes ----- The ``.rules`` attribute contains the interpreted set of rules that corresponds to this line. Example:: Interpreting rule from {'meta.attribute': { 'rule': 'first', 'output': '...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class KwRule: """This class encapsulates the logic needed for interpreting a single keyword rule from a text file. Notes ----- The ``.rules`` attribute contains the interpreted set of rules that corresponds to this line. Example:: Interpreting rule from {'meta.attribute': { 'rule': 'first', 'output': 'meta.attribut...
the_stack_v2_python_sparse
jwst/model_blender/blendrules.py
spacetelescope/jwst
train
449
104aee12b4f796981cab80555fcb49d5772aa1c3
[ "dump_node = ListNode(0)\ncur_node = dump_node\nwhile l1 or l2:\n while l1 and (l2 == None or l1.val <= l2.val):\n cur_node.next = ListNode(l1.val)\n cur_node = cur_node.next\n l1 = l1.next\n while l2 and (l1 == None or l2.val < l1.val):\n cur_node.next = ListNode(l2.val)\n ...
<|body_start_0|> dump_node = ListNode(0) cur_node = dump_node while l1 or l2: while l1 and (l2 == None or l1.val <= l2.val): cur_node.next = ListNode(l1.val) cur_node = cur_node.next l1 = l1.next while l2 and (l1 == None or ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def mergeKLists(self, lists): """:type lists: List[ListNode] :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> dump_nod...
stack_v2_sparse_classes_10k_train_008648
1,499
no_license
[ { "docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode", "name": "mergeTwoLists", "signature": "def mergeTwoLists(self, l1, l2)" }, { "docstring": ":type lists: List[ListNode] :rtype: ListNode", "name": "mergeKLists", "signature": "def mergeKLists(self, lists)" } ]
2
stack_v2_sparse_classes_30k_train_005134
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode <|skeleton|>...
22f208400cd7e13fcf2ebf189e61ccad7e22b098
<|skeleton|> class Solution: def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def mergeKLists(self, lists): """:type lists: List[ListNode] :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" dump_node = ListNode(0) cur_node = dump_node while l1 or l2: while l1 and (l2 == None or l1.val <= l2.val): cur_node.next = ListNode(l1.val) ...
the_stack_v2_python_sparse
previously_completed/1-30/23-Merge_k_Sorted_Lists.py
learnerjiahao/leetcode-solve
train
0
56d5e0e35200bf6629d652c3bac6fd3f4f6121d5
[ "self.data_point_vec = data_point_vec\nself.metric_name = metric_name\nself.mtype = mtype", "if dictionary is None:\n return None\ndata_point_vec = None\nif dictionary.get('dataPointVec') != None:\n data_point_vec = list()\n for structure in dictionary.get('dataPointVec'):\n data_point_vec.append(...
<|body_start_0|> self.data_point_vec = data_point_vec self.metric_name = metric_name self.mtype = mtype <|end_body_0|> <|body_start_1|> if dictionary is None: return None data_point_vec = None if dictionary.get('dataPointVec') != None: data_point_...
Implementation of the 'MetricDataBlock' model. Specifies a series of metric data points for a time series. Attributes: data_point_vec (list of MetricDataPoint): Array of Data Points. Specifies a list of metric data points for a time series. metric_name (string): Specifies the name of a metric such as 'kDiskAwaitTimeMse...
MetricDataBlock
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MetricDataBlock: """Implementation of the 'MetricDataBlock' model. Specifies a series of metric data points for a time series. Attributes: data_point_vec (list of MetricDataPoint): Array of Data Points. Specifies a list of metric data points for a time series. metric_name (string): Specifies the ...
stack_v2_sparse_classes_10k_train_008649
2,460
permissive
[ { "docstring": "Constructor for the MetricDataBlock class", "name": "__init__", "signature": "def __init__(self, data_point_vec=None, metric_name=None, mtype=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation o...
2
null
Implement the Python class `MetricDataBlock` described below. Class description: Implementation of the 'MetricDataBlock' model. Specifies a series of metric data points for a time series. Attributes: data_point_vec (list of MetricDataPoint): Array of Data Points. Specifies a list of metric data points for a time serie...
Implement the Python class `MetricDataBlock` described below. Class description: Implementation of the 'MetricDataBlock' model. Specifies a series of metric data points for a time series. Attributes: data_point_vec (list of MetricDataPoint): Array of Data Points. Specifies a list of metric data points for a time serie...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class MetricDataBlock: """Implementation of the 'MetricDataBlock' model. Specifies a series of metric data points for a time series. Attributes: data_point_vec (list of MetricDataPoint): Array of Data Points. Specifies a list of metric data points for a time series. metric_name (string): Specifies the ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MetricDataBlock: """Implementation of the 'MetricDataBlock' model. Specifies a series of metric data points for a time series. Attributes: data_point_vec (list of MetricDataPoint): Array of Data Points. Specifies a list of metric data points for a time series. metric_name (string): Specifies the name of a met...
the_stack_v2_python_sparse
cohesity_management_sdk/models/metric_data_block.py
cohesity/management-sdk-python
train
24
244437b8afbe5873d9918e7369ad48d5232f3df4
[ "args = parser.parse_args(request)\nrole = self.get_object(role_id)\nif 'include' in args and args.get('include') == 'permissions':\n schema = RoleWithPermissionSchema()\n serialized_roles = schema.dump(role)\nelse:\n serialized_roles = self.schema.dump(role)\nreturn response(serialized_roles, SUCCESS_MESS...
<|body_start_0|> args = parser.parse_args(request) role = self.get_object(role_id) if 'include' in args and args.get('include') == 'permissions': schema = RoleWithPermissionSchema() serialized_roles = schema.dump(role) else: serialized_roles = self.sch...
Roles Resource
RoleResource
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RoleResource: """Roles Resource""" def get(self, role_id): """Get a role""" <|body_0|> def patch(self, role_id): """Update a role""" <|body_1|> def delete(self, role_id): """Delete a role""" <|body_2|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_10k_train_008650
7,412
permissive
[ { "docstring": "Get a role", "name": "get", "signature": "def get(self, role_id)" }, { "docstring": "Update a role", "name": "patch", "signature": "def patch(self, role_id)" }, { "docstring": "Delete a role", "name": "delete", "signature": "def delete(self, role_id)" } ...
3
stack_v2_sparse_classes_30k_test_000235
Implement the Python class `RoleResource` described below. Class description: Roles Resource Method signatures and docstrings: - def get(self, role_id): Get a role - def patch(self, role_id): Update a role - def delete(self, role_id): Delete a role
Implement the Python class `RoleResource` described below. Class description: Roles Resource Method signatures and docstrings: - def get(self, role_id): Get a role - def patch(self, role_id): Update a role - def delete(self, role_id): Delete a role <|skeleton|> class RoleResource: """Roles Resource""" def g...
c5cf6baf60e95a7790156c85e37c76c697efd585
<|skeleton|> class RoleResource: """Roles Resource""" def get(self, role_id): """Get a role""" <|body_0|> def patch(self, role_id): """Update a role""" <|body_1|> def delete(self, role_id): """Delete a role""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RoleResource: """Roles Resource""" def get(self, role_id): """Get a role""" args = parser.parse_args(request) role = self.get_object(role_id) if 'include' in args and args.get('include') == 'permissions': schema = RoleWithPermissionSchema() serializ...
the_stack_v2_python_sparse
src/views/role.py
Nardri/rbac-service
train
0
c617f04672fad8564a6935c73a1c8b5bb90d4c4a
[ "if not self.LIST:\n check_login(lambda x: True)(self)\n logic = AssociationLogic(self.auth, sid, aid)\n logic.association.choosing_code = AssociationLogic.elective_code()\n logic.association.save()\n return Result(id=aid)\nparams = ParamsParser(request.GET)\nlimit = params.int('limit', desc='每页最大渲染数...
<|body_start_0|> if not self.LIST: check_login(lambda x: True)(self) logic = AssociationLogic(self.auth, sid, aid) logic.association.choosing_code = AssociationLogic.elective_code() logic.association.save() return Result(id=aid) params = Params...
AssociationVerification
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AssociationVerification: def get(self, request, sid, aid=''): """重置协会码 or 获取协会列表 :param request: :param sid: :param aid: :return:""" <|body_0|> def post(self, request, sid): """批量获取协会信息 :param request: :param sid: :return:""" <|body_1|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_10k_train_008651
7,404
no_license
[ { "docstring": "重置协会码 or 获取协会列表 :param request: :param sid: :param aid: :return:", "name": "get", "signature": "def get(self, request, sid, aid='')" }, { "docstring": "批量获取协会信息 :param request: :param sid: :return:", "name": "post", "signature": "def post(self, request, sid)" } ]
2
stack_v2_sparse_classes_30k_train_004298
Implement the Python class `AssociationVerification` described below. Class description: Implement the AssociationVerification class. Method signatures and docstrings: - def get(self, request, sid, aid=''): 重置协会码 or 获取协会列表 :param request: :param sid: :param aid: :return: - def post(self, request, sid): 批量获取协会信息 :para...
Implement the Python class `AssociationVerification` described below. Class description: Implement the AssociationVerification class. Method signatures and docstrings: - def get(self, request, sid, aid=''): 重置协会码 or 获取协会列表 :param request: :param sid: :param aid: :return: - def post(self, request, sid): 批量获取协会信息 :para...
a0553be3c259712de1fe5517b06317ad5756f79d
<|skeleton|> class AssociationVerification: def get(self, request, sid, aid=''): """重置协会码 or 获取协会列表 :param request: :param sid: :param aid: :return:""" <|body_0|> def post(self, request, sid): """批量获取协会信息 :param request: :param sid: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AssociationVerification: def get(self, request, sid, aid=''): """重置协会码 or 获取协会列表 :param request: :param sid: :param aid: :return:""" if not self.LIST: check_login(lambda x: True)(self) logic = AssociationLogic(self.auth, sid, aid) logic.association.choosing_...
the_stack_v2_python_sparse
LittlePigHoHo/server/association/views/info.py
shoogoome/hoho
train
1
fee878b3fb49d2eb8f59596dfd73e19487deac28
[ "m = len(nums)\ndp = [0] * (m + 1)\nfor i in range(1, m + 1):\n dp[i] = max(nums[i - 1], dp[i - 1] + nums[i - 1])\nreturn max(dp[1:])", "m = len(nums)\nlast = -float('inf')\nres = -float('inf')\nfor i in range(1, m + 1):\n last = max(nums[i - 1], last + nums[i - 1])\n res = max(res, last)\nreturn res" ]
<|body_start_0|> m = len(nums) dp = [0] * (m + 1) for i in range(1, m + 1): dp[i] = max(nums[i - 1], dp[i - 1] + nums[i - 1]) return max(dp[1:]) <|end_body_0|> <|body_start_1|> m = len(nums) last = -float('inf') res = -float('inf') for i in ra...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxSubArray(self, nums): """[-2,1_最短回文串.py,-3,4,-1_最短回文串.py,2,1_最短回文串.py,-5,4] dp[i] 以i结尾子数组的最大和 dp[i] = dp[i] + nums[i] if dp[i]+nums[i]>nums = nums[i] dp[0] = 0 res = max(dp)""" <|body_0|> def maxSubArray(self, nums): """[-2,1_最短回文串.py,-3,4,-1_最短回文串.p...
stack_v2_sparse_classes_10k_train_008652
1,162
no_license
[ { "docstring": "[-2,1_最短回文串.py,-3,4,-1_最短回文串.py,2,1_最短回文串.py,-5,4] dp[i] 以i结尾子数组的最大和 dp[i] = dp[i] + nums[i] if dp[i]+nums[i]>nums = nums[i] dp[0] = 0 res = max(dp)", "name": "maxSubArray", "signature": "def maxSubArray(self, nums)" }, { "docstring": "[-2,1_最短回文串.py,-3,4,-1_最短回文串.py,2,1_最短回文串.py...
2
stack_v2_sparse_classes_30k_train_001867
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray(self, nums): [-2,1_最短回文串.py,-3,4,-1_最短回文串.py,2,1_最短回文串.py,-5,4] dp[i] 以i结尾子数组的最大和 dp[i] = dp[i] + nums[i] if dp[i]+nums[i]>nums = nums[i] dp[0] = 0 res = max(dp) ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray(self, nums): [-2,1_最短回文串.py,-3,4,-1_最短回文串.py,2,1_最短回文串.py,-5,4] dp[i] 以i结尾子数组的最大和 dp[i] = dp[i] + nums[i] if dp[i]+nums[i]>nums = nums[i] dp[0] = 0 res = max(dp) ...
57f303aa6e76f7c5292fa60bffdfddcb4ff9ddfb
<|skeleton|> class Solution: def maxSubArray(self, nums): """[-2,1_最短回文串.py,-3,4,-1_最短回文串.py,2,1_最短回文串.py,-5,4] dp[i] 以i结尾子数组的最大和 dp[i] = dp[i] + nums[i] if dp[i]+nums[i]>nums = nums[i] dp[0] = 0 res = max(dp)""" <|body_0|> def maxSubArray(self, nums): """[-2,1_最短回文串.py,-3,4,-1_最短回文串.p...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maxSubArray(self, nums): """[-2,1_最短回文串.py,-3,4,-1_最短回文串.py,2,1_最短回文串.py,-5,4] dp[i] 以i结尾子数组的最大和 dp[i] = dp[i] + nums[i] if dp[i]+nums[i]>nums = nums[i] dp[0] = 0 res = max(dp)""" m = len(nums) dp = [0] * (m + 1) for i in range(1, m + 1): dp[i] = max(n...
the_stack_v2_python_sparse
3_Offer2nd-HandWriting/6_DP/3_连续子数组的最大和.py
fzingithub/SwordRefers2Offer
train
1
ede13065510e4903d5f52abfd5b7ae28abab7134
[ "identifier = self.data['id']\nstate_name = self.data['state_name']\nitem = self.core.item_manager.items.get(identifier)\nif not item:\n return self.error(ERROR_ITEM_NOT_FOUND, f'No item found with identifier {identifier}', 404)\nif state_name not in item.states.states.keys():\n return self.error(ERROR_INVALI...
<|body_start_0|> identifier = self.data['id'] state_name = self.data['state_name'] item = self.core.item_manager.items.get(identifier) if not item: return self.error(ERROR_ITEM_NOT_FOUND, f'No item found with identifier {identifier}', 404) if state_name not in item.st...
Endpoint for an item state
ItemStateView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ItemStateView: """Endpoint for an item state""" async def post(self) -> JSONResponse: """POST /item/{id}/states/{state_name}""" <|body_0|> async def get(self) -> JSONResponse: """GET /item/{id}/states/{state_name}""" <|body_1|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_10k_train_008653
10,547
permissive
[ { "docstring": "POST /item/{id}/states/{state_name}", "name": "post", "signature": "async def post(self) -> JSONResponse" }, { "docstring": "GET /item/{id}/states/{state_name}", "name": "get", "signature": "async def get(self) -> JSONResponse" } ]
2
stack_v2_sparse_classes_30k_val_000122
Implement the Python class `ItemStateView` described below. Class description: Endpoint for an item state Method signatures and docstrings: - async def post(self) -> JSONResponse: POST /item/{id}/states/{state_name} - async def get(self) -> JSONResponse: GET /item/{id}/states/{state_name}
Implement the Python class `ItemStateView` described below. Class description: Endpoint for an item state Method signatures and docstrings: - async def post(self) -> JSONResponse: POST /item/{id}/states/{state_name} - async def get(self) -> JSONResponse: GET /item/{id}/states/{state_name} <|skeleton|> class ItemStat...
ee630d3ebf96d5b1d2055487d49968bdbb93d5b9
<|skeleton|> class ItemStateView: """Endpoint for an item state""" async def post(self) -> JSONResponse: """POST /item/{id}/states/{state_name}""" <|body_0|> async def get(self) -> JSONResponse: """GET /item/{id}/states/{state_name}""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ItemStateView: """Endpoint for an item state""" async def post(self) -> JSONResponse: """POST /item/{id}/states/{state_name}""" identifier = self.data['id'] state_name = self.data['state_name'] item = self.core.item_manager.items.get(identifier) if not item: ...
the_stack_v2_python_sparse
homecontrol/modules/api/endpoints.py
lennart-k/HomeControl
train
7
716c761b2fa563564a0eefe179c55f317efca5a5
[ "self.num_of_ways = 0\n\ndef helper(nums, pos, current_sum):\n if pos >= len(nums):\n if current_sum == 0:\n self.num_of_ways += 1\n return\n helper(nums, pos + 1, current_sum + nums[pos])\n helper(nums, pos + 1, current_sum - nums[pos])\nhelper(nums, 0, S)\nreturn self.num_of_ways...
<|body_start_0|> self.num_of_ways = 0 def helper(nums, pos, current_sum): if pos >= len(nums): if current_sum == 0: self.num_of_ways += 1 return helper(nums, pos + 1, current_sum + nums[pos]) helper(nums, pos + 1, c...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findTargetSumWays(self, nums: List[int], S: int) -> int: """DFS""" <|body_0|> def findTargetSumWays(self, nums: List[int], S: int) -> int: """DFS + memoization""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.num_of_ways = 0 ...
stack_v2_sparse_classes_10k_train_008654
1,192
no_license
[ { "docstring": "DFS", "name": "findTargetSumWays", "signature": "def findTargetSumWays(self, nums: List[int], S: int) -> int" }, { "docstring": "DFS + memoization", "name": "findTargetSumWays", "signature": "def findTargetSumWays(self, nums: List[int], S: int) -> int" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findTargetSumWays(self, nums: List[int], S: int) -> int: DFS - def findTargetSumWays(self, nums: List[int], S: int) -> int: DFS + memoization
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findTargetSumWays(self, nums: List[int], S: int) -> int: DFS - def findTargetSumWays(self, nums: List[int], S: int) -> int: DFS + memoization <|skeleton|> class Solution: ...
e50dc0642f087f37ab3234390be3d8a0ed48fe62
<|skeleton|> class Solution: def findTargetSumWays(self, nums: List[int], S: int) -> int: """DFS""" <|body_0|> def findTargetSumWays(self, nums: List[int], S: int) -> int: """DFS + memoization""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def findTargetSumWays(self, nums: List[int], S: int) -> int: """DFS""" self.num_of_ways = 0 def helper(nums, pos, current_sum): if pos >= len(nums): if current_sum == 0: self.num_of_ways += 1 return ...
the_stack_v2_python_sparse
Leetcode/494. Target Sum.py
brlala/Educative-Grokking-Coding-Exercise
train
3
2c2204cd0d4dd2e4e2dbb49447a371f13cec2f63
[ "self.cloned_db_backup_status = cloned_db_backup_status\nself.db_backup_if_not_online_status = db_backup_if_not_online_status\nself.missing_db_backup_status = missing_db_backup_status\nself.offline_restoring_db_backup_status = offline_restoring_db_backup_status\nself.read_only_db_backup_status = read_only_db_backup...
<|body_start_0|> self.cloned_db_backup_status = cloned_db_backup_status self.db_backup_if_not_online_status = db_backup_if_not_online_status self.missing_db_backup_status = missing_db_backup_status self.offline_restoring_db_backup_status = offline_restoring_db_backup_status self....
Implementation of the 'AdvancedSettings' model. Message to capture SQL gflags. Attributes: cloned_db_backup_status (int): Whether to report error if SQL database is cloned. db_backup_if_not_online_status (int): Whether to report error if SQL database is not online, it includes states such as offline, restoring as well ...
AdvancedSettings
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdvancedSettings: """Implementation of the 'AdvancedSettings' model. Message to capture SQL gflags. Attributes: cloned_db_backup_status (int): Whether to report error if SQL database is cloned. db_backup_if_not_online_status (int): Whether to report error if SQL database is not online, it include...
stack_v2_sparse_classes_10k_train_008655
3,957
permissive
[ { "docstring": "Constructor for the AdvancedSettings class", "name": "__init__", "signature": "def __init__(self, cloned_db_backup_status=None, db_backup_if_not_online_status=None, missing_db_backup_status=None, offline_restoring_db_backup_status=None, read_only_db_backup_status=None, report_all_non_aut...
2
stack_v2_sparse_classes_30k_train_005340
Implement the Python class `AdvancedSettings` described below. Class description: Implementation of the 'AdvancedSettings' model. Message to capture SQL gflags. Attributes: cloned_db_backup_status (int): Whether to report error if SQL database is cloned. db_backup_if_not_online_status (int): Whether to report error if...
Implement the Python class `AdvancedSettings` described below. Class description: Implementation of the 'AdvancedSettings' model. Message to capture SQL gflags. Attributes: cloned_db_backup_status (int): Whether to report error if SQL database is cloned. db_backup_if_not_online_status (int): Whether to report error if...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class AdvancedSettings: """Implementation of the 'AdvancedSettings' model. Message to capture SQL gflags. Attributes: cloned_db_backup_status (int): Whether to report error if SQL database is cloned. db_backup_if_not_online_status (int): Whether to report error if SQL database is not online, it include...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AdvancedSettings: """Implementation of the 'AdvancedSettings' model. Message to capture SQL gflags. Attributes: cloned_db_backup_status (int): Whether to report error if SQL database is cloned. db_backup_if_not_online_status (int): Whether to report error if SQL database is not online, it includes states such...
the_stack_v2_python_sparse
cohesity_management_sdk/models/advanced_settings.py
cohesity/management-sdk-python
train
24
121ecbfeb94bfc8efbd3d2bd59e3a61b82c3fa5a
[ "self.zone = [(rr.rname, QTYPE[rr.rtype], rr) for rr in RR.fromZone(zone)]\nself.glob = glob\nself.eq = 'matchGlob' if glob else '__eq__'", "reply = request.reply()\nqname = request.q.qname\nqtype = QTYPE[request.q.qtype]\nfor name, rtype, rr in self.zone:\n if getattr(qname, self.eq)(name) and (qtype == rtype...
<|body_start_0|> self.zone = [(rr.rname, QTYPE[rr.rtype], rr) for rr in RR.fromZone(zone)] self.glob = glob self.eq = 'matchGlob' if glob else '__eq__' <|end_body_0|> <|body_start_1|> reply = request.reply() qname = request.q.qname qtype = QTYPE[request.q.qtype] ...
Simple fixed zone file resolver.
ZoneResolver
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZoneResolver: """Simple fixed zone file resolver.""" def __init__(self, zone, glob=False): """Initialise resolver from zone file. Stores RRs as a list of (label,type,rr) tuples If 'glob' is True use glob match against zone file""" <|body_0|> def resolve(self, request, ha...
stack_v2_sparse_classes_10k_train_008656
4,374
permissive
[ { "docstring": "Initialise resolver from zone file. Stores RRs as a list of (label,type,rr) tuples If 'glob' is True use glob match against zone file", "name": "__init__", "signature": "def __init__(self, zone, glob=False)" }, { "docstring": "Respond to DNS request - parameters are request packe...
2
stack_v2_sparse_classes_30k_train_005993
Implement the Python class `ZoneResolver` described below. Class description: Simple fixed zone file resolver. Method signatures and docstrings: - def __init__(self, zone, glob=False): Initialise resolver from zone file. Stores RRs as a list of (label,type,rr) tuples If 'glob' is True use glob match against zone file...
Implement the Python class `ZoneResolver` described below. Class description: Simple fixed zone file resolver. Method signatures and docstrings: - def __init__(self, zone, glob=False): Initialise resolver from zone file. Stores RRs as a list of (label,type,rr) tuples If 'glob' is True use glob match against zone file...
541f58da464296001109f9cfbb879256957b3819
<|skeleton|> class ZoneResolver: """Simple fixed zone file resolver.""" def __init__(self, zone, glob=False): """Initialise resolver from zone file. Stores RRs as a list of (label,type,rr) tuples If 'glob' is True use glob match against zone file""" <|body_0|> def resolve(self, request, ha...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ZoneResolver: """Simple fixed zone file resolver.""" def __init__(self, zone, glob=False): """Initialise resolver from zone file. Stores RRs as a list of (label,type,rr) tuples If 'glob' is True use glob match against zone file""" self.zone = [(rr.rname, QTYPE[rr.rtype], rr) for rr in RR....
the_stack_v2_python_sparse
code/default/lib/noarch/dnslib/zoneresolver.py
XX-net/XX-Net
train
40,250
b453a731f1d44a7e4ab25f462a729959e6262f6a
[ "pool = Pool()\namount = 0\ncomputerloan = pool.get('computer.loan')\ncomputer_loan = computerloan.search([('employee', '=', employee), ('salary_code', '=', employee.salary_code), ('state', '=', 'approve')])\nprint(computer_loan, 'computer_loan')\nif computer_loan:\n for loan in computer_loan:\n mydate = ...
<|body_start_0|> pool = Pool() amount = 0 computerloan = pool.get('computer.loan') computer_loan = computerloan.search([('employee', '=', employee), ('salary_code', '=', employee.salary_code), ('state', '=', 'approve')]) print(computer_loan, 'computer_loan') if computer_l...
SalaryRule
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SalaryRule: def calculate_COM_Loan(self, payslip, employee, contract): """Calcualte this method for computer loan""" <|body_0|> def calculate_HBA_Loan(self, payslip, employee, contract): """Calcualte this method for HBA Loan""" <|body_1|> <|end_skeleton|> <...
stack_v2_sparse_classes_10k_train_008657
4,077
no_license
[ { "docstring": "Calcualte this method for computer loan", "name": "calculate_COM_Loan", "signature": "def calculate_COM_Loan(self, payslip, employee, contract)" }, { "docstring": "Calcualte this method for HBA Loan", "name": "calculate_HBA_Loan", "signature": "def calculate_HBA_Loan(self...
2
stack_v2_sparse_classes_30k_train_003063
Implement the Python class `SalaryRule` described below. Class description: Implement the SalaryRule class. Method signatures and docstrings: - def calculate_COM_Loan(self, payslip, employee, contract): Calcualte this method for computer loan - def calculate_HBA_Loan(self, payslip, employee, contract): Calcualte this...
Implement the Python class `SalaryRule` described below. Class description: Implement the SalaryRule class. Method signatures and docstrings: - def calculate_COM_Loan(self, payslip, employee, contract): Calcualte this method for computer loan - def calculate_HBA_Loan(self, payslip, employee, contract): Calcualte this...
cd392bf0e80d71c4742568e9c1dd5e5211da56a9
<|skeleton|> class SalaryRule: def calculate_COM_Loan(self, payslip, employee, contract): """Calcualte this method for computer loan""" <|body_0|> def calculate_HBA_Loan(self, payslip, employee, contract): """Calcualte this method for HBA Loan""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SalaryRule: def calculate_COM_Loan(self, payslip, employee, contract): """Calcualte this method for computer loan""" pool = Pool() amount = 0 computerloan = pool.get('computer.loan') computer_loan = computerloan.search([('employee', '=', employee), ('salary_code', '=', ...
the_stack_v2_python_sparse
src/modules/customised/payroll_test_2/payroll_copy/hr_payroll_loan/hr_payroll_loan.py
kakamble-aiims/work
train
0
a6cb4bd1c560abaad1a0deaffc2214891c6453fa
[ "super(InputEmbedder, self).__init__()\nself.tf_dim = tf_dim\nself.msa_dim = msa_dim\nself.c_z = c_z\nself.c_m = c_m\nself.linear_tf_z_i = Linear(tf_dim, c_z)\nself.linear_tf_z_j = Linear(tf_dim, c_z)\nself.linear_tf_m = Linear(tf_dim, c_m)\nself.linear_msa_m = Linear(msa_dim, c_m)\nself.relpos_k = relpos_k\nself.n...
<|body_start_0|> super(InputEmbedder, self).__init__() self.tf_dim = tf_dim self.msa_dim = msa_dim self.c_z = c_z self.c_m = c_m self.linear_tf_z_i = Linear(tf_dim, c_z) self.linear_tf_z_j = Linear(tf_dim, c_z) self.linear_tf_m = Linear(tf_dim, c_m) ...
Embeds a subset of the input features. Implements Algorithms 3 (InputEmbedder) and 4 (relpos).
InputEmbedder
[ "Apache-2.0", "CC-BY-4.0", "LicenseRef-scancode-other-permissive", "CC-BY-NC-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InputEmbedder: """Embeds a subset of the input features. Implements Algorithms 3 (InputEmbedder) and 4 (relpos).""" def __init__(self, tf_dim: int, msa_dim: int, c_z: int, c_m: int, relpos_k: int, **kwargs): """Args: tf_dim: Final dimension of the target features msa_dim: Final dimen...
stack_v2_sparse_classes_10k_train_008658
9,577
permissive
[ { "docstring": "Args: tf_dim: Final dimension of the target features msa_dim: Final dimension of the MSA features c_z: Pair embedding dimension c_m: MSA embedding dimension relpos_k: Window size used in relative positional encoding", "name": "__init__", "signature": "def __init__(self, tf_dim: int, msa_...
3
stack_v2_sparse_classes_30k_train_001667
Implement the Python class `InputEmbedder` described below. Class description: Embeds a subset of the input features. Implements Algorithms 3 (InputEmbedder) and 4 (relpos). Method signatures and docstrings: - def __init__(self, tf_dim: int, msa_dim: int, c_z: int, c_m: int, relpos_k: int, **kwargs): Args: tf_dim: Fi...
Implement the Python class `InputEmbedder` described below. Class description: Embeds a subset of the input features. Implements Algorithms 3 (InputEmbedder) and 4 (relpos). Method signatures and docstrings: - def __init__(self, tf_dim: int, msa_dim: int, c_z: int, c_m: int, relpos_k: int, **kwargs): Args: tf_dim: Fi...
2134cc09b3994b6280e6e3c569dd7d761e4da7a0
<|skeleton|> class InputEmbedder: """Embeds a subset of the input features. Implements Algorithms 3 (InputEmbedder) and 4 (relpos).""" def __init__(self, tf_dim: int, msa_dim: int, c_z: int, c_m: int, relpos_k: int, **kwargs): """Args: tf_dim: Final dimension of the target features msa_dim: Final dimen...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class InputEmbedder: """Embeds a subset of the input features. Implements Algorithms 3 (InputEmbedder) and 4 (relpos).""" def __init__(self, tf_dim: int, msa_dim: int, c_z: int, c_m: int, relpos_k: int, **kwargs): """Args: tf_dim: Final dimension of the target features msa_dim: Final dimension of the M...
the_stack_v2_python_sparse
openfold/model/embedders.py
aqlaboratory/openfold
train
2,033
b0885d3fa034851753d0eeb9698a7f22fb479700
[ "self.__sql_db_path = sql_db_path\nself.__mapper = table_mapper_method\nself.__connection = sqlite3.connect(self.__sql_db_path)\nself.__c_names, self.__c_types, self.__c_tables, self.__tables_keys = ([], [], [], {})\nself.__generate_tables_dict()", "cur = self.__connection.cursor()\nquery = \"SELECT name FROM sql...
<|body_start_0|> self.__sql_db_path = sql_db_path self.__mapper = table_mapper_method self.__connection = sqlite3.connect(self.__sql_db_path) self.__c_names, self.__c_types, self.__c_tables, self.__tables_keys = ([], [], [], {}) self.__generate_tables_dict() <|end_body_0|> <|bod...
SqlInterfaceGeneric
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SqlInterfaceGeneric: def __init__(self, sql_db_path, table_mapper_method): """:param sql_db_path: The path to the sql_db_path. :type sql_db_path: str :param table_mapper_method: The method that maps all the table names of the db to there corresponding PRAGMA queries. :type table_mapper_m...
stack_v2_sparse_classes_10k_train_008659
10,669
permissive
[ { "docstring": ":param sql_db_path: The path to the sql_db_path. :type sql_db_path: str :param table_mapper_method: The method that maps all the table names of the db to there corresponding PRAGMA queries. :type table_mapper_method: function()", "name": "__init__", "signature": "def __init__(self, sql_d...
5
stack_v2_sparse_classes_30k_train_001025
Implement the Python class `SqlInterfaceGeneric` described below. Class description: Implement the SqlInterfaceGeneric class. Method signatures and docstrings: - def __init__(self, sql_db_path, table_mapper_method): :param sql_db_path: The path to the sql_db_path. :type sql_db_path: str :param table_mapper_method: Th...
Implement the Python class `SqlInterfaceGeneric` described below. Class description: Implement the SqlInterfaceGeneric class. Method signatures and docstrings: - def __init__(self, sql_db_path, table_mapper_method): :param sql_db_path: The path to the sql_db_path. :type sql_db_path: str :param table_mapper_method: Th...
09cecfb795cd9df33773a3095ff855d1c2eb396d
<|skeleton|> class SqlInterfaceGeneric: def __init__(self, sql_db_path, table_mapper_method): """:param sql_db_path: The path to the sql_db_path. :type sql_db_path: str :param table_mapper_method: The method that maps all the table names of the db to there corresponding PRAGMA queries. :type table_mapper_m...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SqlInterfaceGeneric: def __init__(self, sql_db_path, table_mapper_method): """:param sql_db_path: The path to the sql_db_path. :type sql_db_path: str :param table_mapper_method: The method that maps all the table names of the db to there corresponding PRAGMA queries. :type table_mapper_method: functio...
the_stack_v2_python_sparse
data_models/sql_provider/sql_interface_generic.py
imldresden/mcv-displaywall
train
2
230c9696ecd1af6f139dd14a5a44f54c8263132c
[ "year = response.xpath('//u/font/strong/em/text()').get()[0:4]\nfor item in response.xpath('//ol/li'):\n date_text = item.xpath('./font/strong/em/text()').get()\n meeting = Meeting(title=self.title, description='', classification=COMMISSION, start=self._parse_start(date_text, year), end=None, all_day=False, t...
<|body_start_0|> year = response.xpath('//u/font/strong/em/text()').get()[0:4] for item in response.xpath('//ol/li'): date_text = item.xpath('./font/strong/em/text()').get() meeting = Meeting(title=self.title, description='', classification=COMMISSION, start=self._parse_start(dat...
ChiSsa72Spider
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChiSsa72Spider: def parse(self, response): """`parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs.""" <|body_0|> def _parse_start(self, date_text, year): """Parse start datetime as a naive dat...
stack_v2_sparse_classes_10k_train_008660
3,869
permissive
[ { "docstring": "`parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs.", "name": "parse", "signature": "def parse(self, response)" }, { "docstring": "Parse start datetime as a naive datetime object.", "name": "_parse_st...
3
stack_v2_sparse_classes_30k_train_004560
Implement the Python class `ChiSsa72Spider` described below. Class description: Implement the ChiSsa72Spider class. Method signatures and docstrings: - def parse(self, response): `parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs. - def _pars...
Implement the Python class `ChiSsa72Spider` described below. Class description: Implement the ChiSsa72Spider class. Method signatures and docstrings: - def parse(self, response): `parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs. - def _pars...
611fce6a2705446e25a2fc33e32090a571eb35d1
<|skeleton|> class ChiSsa72Spider: def parse(self, response): """`parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs.""" <|body_0|> def _parse_start(self, date_text, year): """Parse start datetime as a naive dat...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ChiSsa72Spider: def parse(self, response): """`parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs.""" year = response.xpath('//u/font/strong/em/text()').get()[0:4] for item in response.xpath('//ol/li'): ...
the_stack_v2_python_sparse
city_scrapers/spiders/chi_ssa_72.py
City-Bureau/city-scrapers
train
308
8b36df1a9c4b2a4c9f6fe42a3773f9c834bc1e97
[ "if hasattr(self.opts.model, 'versions') and len(self.opts.fields) == 0:\n self.opts.exclude += ('versions',)\nsuper().__init__(*args, **kwargs)", "if not many:\n for key in list(data):\n if key == 'versions':\n data.pop(key)\n return {key: value for key, value in data.items() if value ...
<|body_start_0|> if hasattr(self.opts.model, 'versions') and len(self.opts.fields) == 0: self.opts.exclude += ('versions',) super().__init__(*args, **kwargs) <|end_body_0|> <|body_start_1|> if not many: for key in list(data): if key == 'versions': ...
Base Schema.
BaseSchema
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseSchema: """Base Schema.""" def __init__(self, *args, **kwargs): """Excludes versions. Otherwise database will query <name>_versions table.""" <|body_0|> def _remove_empty(self, data, many): """Remove all empty values and versions from the dumped dict.""" ...
stack_v2_sparse_classes_10k_train_008661
2,211
permissive
[ { "docstring": "Excludes versions. Otherwise database will query <name>_versions table.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Remove all empty values and versions from the dumped dict.", "name": "_remove_empty", "signature": "def _rem...
2
stack_v2_sparse_classes_30k_train_003371
Implement the Python class `BaseSchema` described below. Class description: Base Schema. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Excludes versions. Otherwise database will query <name>_versions table. - def _remove_empty(self, data, many): Remove all empty values and versions from the...
Implement the Python class `BaseSchema` described below. Class description: Base Schema. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Excludes versions. Otherwise database will query <name>_versions table. - def _remove_empty(self, data, many): Remove all empty values and versions from the...
923cb8a3ee88dcbaf0fe800ca70022b3c13c1d01
<|skeleton|> class BaseSchema: """Base Schema.""" def __init__(self, *args, **kwargs): """Excludes versions. Otherwise database will query <name>_versions table.""" <|body_0|> def _remove_empty(self, data, many): """Remove all empty values and versions from the dumped dict.""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BaseSchema: """Base Schema.""" def __init__(self, *args, **kwargs): """Excludes versions. Otherwise database will query <name>_versions table.""" if hasattr(self.opts.model, 'versions') and len(self.opts.fields) == 0: self.opts.exclude += ('versions',) super().__init__...
the_stack_v2_python_sparse
auth-api/src/auth_api/schemas/base_schema.py
bcgov/sbc-auth
train
13
e4e40cfb7699d61cf2739a1f4d5db252f074ba25
[ "path_list = self.get_all_path_in_summary_md_file(summary_md_file_path)\nfor each_path in path_list:\n if not os.path.exists(os.path.join(root_path, each_path)):\n print('[-] Error: 路径 {} 不存在'.format(each_path))", "result_list = list()\ntitle_re = re.compile('\\\\[.*\\\\]\\\\((.*)\\\\)')\nwith open(md_f...
<|body_start_0|> path_list = self.get_all_path_in_summary_md_file(summary_md_file_path) for each_path in path_list: if not os.path.exists(os.path.join(root_path, each_path)): print('[-] Error: 路径 {} 不存在'.format(each_path)) <|end_body_0|> <|body_start_1|> result_list ...
Checker
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Checker: def run(self, summary_md_file_path, root_path): """进行所有检查 :param summary_md_file_path: str(), 比如 "SUMMARY.md", 表示 SUMMARY.md 的路径 :param root_path: str(), 比如 "/Users/.../interview_collect", 表示所有 md 文件的根路径 :return: None""" <|body_0|> def get_all_path_in_summary_md_fil...
stack_v2_sparse_classes_10k_train_008662
1,945
no_license
[ { "docstring": "进行所有检查 :param summary_md_file_path: str(), 比如 \"SUMMARY.md\", 表示 SUMMARY.md 的路径 :param root_path: str(), 比如 \"/Users/.../interview_collect\", 表示所有 md 文件的根路径 :return: None", "name": "run", "signature": "def run(self, summary_md_file_path, root_path)" }, { "docstring": "通过读取 summar...
2
stack_v2_sparse_classes_30k_train_003519
Implement the Python class `Checker` described below. Class description: Implement the Checker class. Method signatures and docstrings: - def run(self, summary_md_file_path, root_path): 进行所有检查 :param summary_md_file_path: str(), 比如 "SUMMARY.md", 表示 SUMMARY.md 的路径 :param root_path: str(), 比如 "/Users/.../interview_coll...
Implement the Python class `Checker` described below. Class description: Implement the Checker class. Method signatures and docstrings: - def run(self, summary_md_file_path, root_path): 进行所有检查 :param summary_md_file_path: str(), 比如 "SUMMARY.md", 表示 SUMMARY.md 的路径 :param root_path: str(), 比如 "/Users/.../interview_coll...
a3ec3f4bf57099cbd6acf9ba4e9797e685d5a4ce
<|skeleton|> class Checker: def run(self, summary_md_file_path, root_path): """进行所有检查 :param summary_md_file_path: str(), 比如 "SUMMARY.md", 表示 SUMMARY.md 的路径 :param root_path: str(), 比如 "/Users/.../interview_collect", 表示所有 md 文件的根路径 :return: None""" <|body_0|> def get_all_path_in_summary_md_fil...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Checker: def run(self, summary_md_file_path, root_path): """进行所有检查 :param summary_md_file_path: str(), 比如 "SUMMARY.md", 表示 SUMMARY.md 的路径 :param root_path: str(), 比如 "/Users/.../interview_collect", 表示所有 md 文件的根路径 :return: None""" path_list = self.get_all_path_in_summary_md_file(summary_md_file...
the_stack_v2_python_sparse
python_script/check_summary.py
276585877/interview_collect
train
0
f4df295a349c9a3c85e322857c0ec8af352d00e7
[ "pwd = subprocess.Popen('pwd', stdout=subprocess.PIPE, shell=True).communicate()[0].decode('utf-8').replace('\\n', '')\nself.__dict__['HOST'] = {'value': HOST, 'required': True, 'description': 'The target host'}\nself.__dict__['COMMUNITY'] = {'value': COMMUNITY, 'required': True, 'description': 'Community string'}\...
<|body_start_0|> pwd = subprocess.Popen('pwd', stdout=subprocess.PIPE, shell=True).communicate()[0].decode('utf-8').replace('\n', '') self.__dict__['HOST'] = {'value': HOST, 'required': True, 'description': 'The target host'} self.__dict__['COMMUNITY'] = {'value': COMMUNITY, 'required': True, 'd...
Module Class
Module
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Module: """Module Class""" def __init__(self, HOST=None, COMMUNITY='public', VERSION='1', TEMP=None): """__init__(self, HOST=None, COMMUNITY='public', VERSION='1', TEMP=None :param HOST: :param COMMUNITY: :param VERSION: :param TEMP: Initialize the module with the module's desired op...
stack_v2_sparse_classes_10k_train_008663
2,640
no_license
[ { "docstring": "__init__(self, HOST=None, COMMUNITY='public', VERSION='1', TEMP=None :param HOST: :param COMMUNITY: :param VERSION: :param TEMP: Initialize the module with the module's desired options", "name": "__init__", "signature": "def __init__(self, HOST=None, COMMUNITY='public', VERSION='1', TEMP...
2
stack_v2_sparse_classes_30k_train_000072
Implement the Python class `Module` described below. Class description: Module Class Method signatures and docstrings: - def __init__(self, HOST=None, COMMUNITY='public', VERSION='1', TEMP=None): __init__(self, HOST=None, COMMUNITY='public', VERSION='1', TEMP=None :param HOST: :param COMMUNITY: :param VERSION: :param...
Implement the Python class `Module` described below. Class description: Module Class Method signatures and docstrings: - def __init__(self, HOST=None, COMMUNITY='public', VERSION='1', TEMP=None): __init__(self, HOST=None, COMMUNITY='public', VERSION='1', TEMP=None :param HOST: :param COMMUNITY: :param VERSION: :param...
99e1d75b3d1af2e44740584be6c2ef1c1601c43c
<|skeleton|> class Module: """Module Class""" def __init__(self, HOST=None, COMMUNITY='public', VERSION='1', TEMP=None): """__init__(self, HOST=None, COMMUNITY='public', VERSION='1', TEMP=None :param HOST: :param COMMUNITY: :param VERSION: :param TEMP: Initialize the module with the module's desired op...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Module: """Module Class""" def __init__(self, HOST=None, COMMUNITY='public', VERSION='1', TEMP=None): """__init__(self, HOST=None, COMMUNITY='public', VERSION='1', TEMP=None :param HOST: :param COMMUNITY: :param VERSION: :param TEMP: Initialize the module with the module's desired options""" ...
the_stack_v2_python_sparse
modules/auxiliary/snmp_enum.py
h4cklife/intrukit
train
3
0d72bce6b37703c275e5706c4ec71a85eeb0efeb
[ "self.api = None\nself.user_login = None\nself.user_pass = None\nself.user_token = None\nself._login()", "home = os.path.abspath(os.environ.get('HOME', ''))\nconfig_file_path = os.path.join(home, config_file_name)\nreturn config_file_path", "config = self._github_config(self.CONFIG)\nparser = configparser.RawCo...
<|body_start_0|> self.api = None self.user_login = None self.user_pass = None self.user_token = None self._login() <|end_body_0|> <|body_start_1|> home = os.path.abspath(os.environ.get('HOME', '')) config_file_path = os.path.join(home, config_file_name) r...
Provides integration with the GitHub API. Attributes: * api: An instance of github3 to interact with the GitHub API. * CONFIG: A string representing the config file name. * CONFIG_SECTION: A string representing the main config file section. * CONFIG_USER_LOGIN: A string representing the user login config. * CONFIG_USER...
GitHub
[ "MIT", "LicenseRef-scancode-free-unknown", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GitHub: """Provides integration with the GitHub API. Attributes: * api: An instance of github3 to interact with the GitHub API. * CONFIG: A string representing the config file name. * CONFIG_SECTION: A string representing the main config file section. * CONFIG_USER_LOGIN: A string representing th...
stack_v2_sparse_classes_10k_train_008664
6,388
permissive
[ { "docstring": "Inits GitHub. Args: * None. Returns: None.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Attempts to find the github config file. Adapted from https://github.com/sigmavirus24/github-cli. Args: * config_file_name: A String that represents the config fi...
4
stack_v2_sparse_classes_30k_train_006370
Implement the Python class `GitHub` described below. Class description: Provides integration with the GitHub API. Attributes: * api: An instance of github3 to interact with the GitHub API. * CONFIG: A string representing the config file name. * CONFIG_SECTION: A string representing the main config file section. * CONF...
Implement the Python class `GitHub` described below. Class description: Provides integration with the GitHub API. Attributes: * api: An instance of github3 to interact with the GitHub API. * CONFIG: A string representing the config file name. * CONFIG_SECTION: A string representing the main config file section. * CONF...
dd27b767cdc0c667655ab8e32e020ed4248bd112
<|skeleton|> class GitHub: """Provides integration with the GitHub API. Attributes: * api: An instance of github3 to interact with the GitHub API. * CONFIG: A string representing the config file name. * CONFIG_SECTION: A string representing the main config file section. * CONFIG_USER_LOGIN: A string representing th...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GitHub: """Provides integration with the GitHub API. Attributes: * api: An instance of github3 to interact with the GitHub API. * CONFIG: A string representing the config file name. * CONFIG_SECTION: A string representing the main config file section. * CONFIG_USER_LOGIN: A string representing the user login ...
the_stack_v2_python_sparse
something-learned/Cloud-Computing/AWS/01-awesome-aws/awesome/lib/github.py
agarrharr/code-rush-101
train
4
f7c7b8f1e85dcc4b42c917f4352be00537f8187b
[ "self['user'] = None\nself['use_keyring'] = False\nself['keyring_service'] = 'SR tools'\nself['server'] = 'www.studentrobotics.org'\nself['https_port'] = 443\ntry:\n self.update_from_file(get_config_filename())\nexcept OSError:\n pass", "with open(fname) as file:\n d = yaml.safe_load(file)\nif d is not N...
<|body_start_0|> self['user'] = None self['use_keyring'] = False self['keyring_service'] = 'SR tools' self['server'] = 'www.studentrobotics.org' self['https_port'] = 443 try: self.update_from_file(get_config_filename()) except OSError: pass...
Configuration reader for the tools.
Config
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Config: """Configuration reader for the tools.""" def __init__(self): """Create a new configuration reader with the default configuration values set.""" <|body_0|> def update_from_file(self, fname): """Update the config from the given YAML file :param str fname: ...
stack_v2_sparse_classes_10k_train_008665
3,258
no_license
[ { "docstring": "Create a new configuration reader with the default configuration values set.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Update the config from the given YAML file :param str fname: The filename of the YAML file. :raises IOError: If the YAML file ca...
4
stack_v2_sparse_classes_30k_train_007037
Implement the Python class `Config` described below. Class description: Configuration reader for the tools. Method signatures and docstrings: - def __init__(self): Create a new configuration reader with the default configuration values set. - def update_from_file(self, fname): Update the config from the given YAML fi...
Implement the Python class `Config` described below. Class description: Configuration reader for the tools. Method signatures and docstrings: - def __init__(self): Create a new configuration reader with the default configuration values set. - def update_from_file(self, fname): Update the config from the given YAML fi...
c97cea716311004129bdbf3651712ba3e970c1ff
<|skeleton|> class Config: """Configuration reader for the tools.""" def __init__(self): """Create a new configuration reader with the default configuration values set.""" <|body_0|> def update_from_file(self, fname): """Update the config from the given YAML file :param str fname: ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Config: """Configuration reader for the tools.""" def __init__(self): """Create a new configuration reader with the default configuration values set.""" self['user'] = None self['use_keyring'] = False self['keyring_service'] = 'SR tools' self['server'] = 'www.stude...
the_stack_v2_python_sparse
sr/tools/config.py
srobo/tools
train
4
0cc31e4d001e8ca87d2950a65047dce6fef1ac7a
[ "label_map = LabelMap.create_label_map(app_path, train_pattern)\nresource_loader = ResourceLoader.create_resource_loader(app_path)\ntrain_query_list = resource_loader.get_flattened_label_set(label_set=train_pattern)\nif TuneLevel.ENTITY.value in tuning_level:\n label_map.entity2id = LabelMap._get_entity_mappings...
<|body_start_0|> label_map = LabelMap.create_label_map(app_path, train_pattern) resource_loader = ResourceLoader.create_resource_loader(app_path) train_query_list = resource_loader.get_flattened_label_set(label_set=train_pattern) if TuneLevel.ENTITY.value in tuning_level: lab...
Class to generate the initial data for experimentation. (Seed Queries, Remaining Queries, and Test Queries). Handles initial sampling and data split based on configuation details.
DataBucketFactory
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataBucketFactory: """Class to generate the initial data for experimentation. (Seed Queries, Remaining Queries, and Test Queries). Handles initial sampling and data split based on configuation details.""" def get_data_bucket_for_strategy_tuning(app_path: str, tuning_level: list, train_patter...
stack_v2_sparse_classes_10k_train_008666
20,702
permissive
[ { "docstring": "Creates a DataBucket to be used for strategy tuning. Args: app_path (str): Path to MindMeld application tuning_level (list): The hierarchy levels to tune (\"domain\", \"intent\" or \"entity\") train_pattern (str): Regex pattern to match train files. (\".*train.*.txt\") test_pattern (str): Regex ...
2
stack_v2_sparse_classes_30k_train_007365
Implement the Python class `DataBucketFactory` described below. Class description: Class to generate the initial data for experimentation. (Seed Queries, Remaining Queries, and Test Queries). Handles initial sampling and data split based on configuation details. Method signatures and docstrings: - def get_data_bucket...
Implement the Python class `DataBucketFactory` described below. Class description: Class to generate the initial data for experimentation. (Seed Queries, Remaining Queries, and Test Queries). Handles initial sampling and data split based on configuation details. Method signatures and docstrings: - def get_data_bucket...
bd3547d5c1bd092dbd4a64a90528dfc2e2b3844a
<|skeleton|> class DataBucketFactory: """Class to generate the initial data for experimentation. (Seed Queries, Remaining Queries, and Test Queries). Handles initial sampling and data split based on configuation details.""" def get_data_bucket_for_strategy_tuning(app_path: str, tuning_level: list, train_patter...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DataBucketFactory: """Class to generate the initial data for experimentation. (Seed Queries, Remaining Queries, and Test Queries). Handles initial sampling and data split based on configuation details.""" def get_data_bucket_for_strategy_tuning(app_path: str, tuning_level: list, train_pattern: str, test_...
the_stack_v2_python_sparse
mindmeld/active_learning/data_loading.py
cisco/mindmeld
train
671
fd94796047c557b42d455180121d18b4c96ee72f
[ "from scoop.content.models.picture import Picture\nuuid = self.value\ncss_class = '{0}{1}'.format(' ' if 'class' in self.kwargs else '', self.kwargs.get('class', ''))\nimage = Picture.objects.get_by_uuid(uuid)\nreturn {'image': image, 'class': css_class}", "base = super(AnimationInline, self).get_template_name()[...
<|body_start_0|> from scoop.content.models.picture import Picture uuid = self.value css_class = '{0}{1}'.format(' ' if 'class' in self.kwargs else '', self.kwargs.get('class', '')) image = Picture.objects.get_by_uuid(uuid) return {'image': image, 'class': css_class} <|end_body_0|...
Inline d'insertion d'animations Format : {{animation imageuuid [class=css]}} Exemple : {{animation dF4y8P class="bordered"}}
AnimationInline
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnimationInline: """Inline d'insertion d'animations Format : {{animation imageuuid [class=css]}} Exemple : {{animation dF4y8P class="bordered"}}""" def get_context(self): """Renvoyer le contexte de rendu de l'inline""" <|body_0|> def get_template_name(self): """R...
stack_v2_sparse_classes_10k_train_008667
6,816
no_license
[ { "docstring": "Renvoyer le contexte de rendu de l'inline", "name": "get_context", "signature": "def get_context(self)" }, { "docstring": "Renvoyer le chemin du template", "name": "get_template_name", "signature": "def get_template_name(self)" } ]
2
null
Implement the Python class `AnimationInline` described below. Class description: Inline d'insertion d'animations Format : {{animation imageuuid [class=css]}} Exemple : {{animation dF4y8P class="bordered"}} Method signatures and docstrings: - def get_context(self): Renvoyer le contexte de rendu de l'inline - def get_t...
Implement the Python class `AnimationInline` described below. Class description: Inline d'insertion d'animations Format : {{animation imageuuid [class=css]}} Exemple : {{animation dF4y8P class="bordered"}} Method signatures and docstrings: - def get_context(self): Renvoyer le contexte de rendu de l'inline - def get_t...
8cef6f6e89c1990e2b25f83e54e0c3481d83b6d7
<|skeleton|> class AnimationInline: """Inline d'insertion d'animations Format : {{animation imageuuid [class=css]}} Exemple : {{animation dF4y8P class="bordered"}}""" def get_context(self): """Renvoyer le contexte de rendu de l'inline""" <|body_0|> def get_template_name(self): """R...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AnimationInline: """Inline d'insertion d'animations Format : {{animation imageuuid [class=css]}} Exemple : {{animation dF4y8P class="bordered"}}""" def get_context(self): """Renvoyer le contexte de rendu de l'inline""" from scoop.content.models.picture import Picture uuid = self.v...
the_stack_v2_python_sparse
scoop/content/util/inlines.py
artscoop/scoop
train
0
74d2eb33645925e71f2abbb450e02ec2a2db890b
[ "self.name = name\nself.org_no = org_no\nself.uni_customer_no = uni_customer_no\nself.created_before = APIHelper.RFC3339DateTime(created_before) if created_before else None\nself.created_after = APIHelper.RFC3339DateTime(created_after) if created_after else None\nself.last_modified_before = APIHelper.RFC3339DateTim...
<|body_start_0|> self.name = name self.org_no = org_no self.uni_customer_no = uni_customer_no self.created_before = APIHelper.RFC3339DateTime(created_before) if created_before else None self.created_after = APIHelper.RFC3339DateTime(created_after) if created_after else None ...
Implementation of the 'AccountSearchFilter' model. TODO: type model description here. Attributes: name (string): TODO: type description here. org_no (string): TODO: type description here. uni_customer_no (string): TODO: type description here. created_before (datetime): TODO: type description here. created_after (dateti...
AccountSearchFilter
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccountSearchFilter: """Implementation of the 'AccountSearchFilter' model. TODO: type model description here. Attributes: name (string): TODO: type description here. org_no (string): TODO: type description here. uni_customer_no (string): TODO: type description here. created_before (datetime): TOD...
stack_v2_sparse_classes_10k_train_008668
4,978
permissive
[ { "docstring": "Constructor for the AccountSearchFilter class", "name": "__init__", "signature": "def __init__(self, name=None, org_no=None, uni_customer_no=None, created_before=None, created_after=None, last_modified_before=None, last_modified_after=None, dealer_name=None, dealer_reference=None, enable...
2
stack_v2_sparse_classes_30k_train_000478
Implement the Python class `AccountSearchFilter` described below. Class description: Implementation of the 'AccountSearchFilter' model. TODO: type model description here. Attributes: name (string): TODO: type description here. org_no (string): TODO: type description here. uni_customer_no (string): TODO: type descripti...
Implement the Python class `AccountSearchFilter` described below. Class description: Implementation of the 'AccountSearchFilter' model. TODO: type model description here. Attributes: name (string): TODO: type description here. org_no (string): TODO: type description here. uni_customer_no (string): TODO: type descripti...
fa3918a6c54ea0eedb9146578645b7eb1755b642
<|skeleton|> class AccountSearchFilter: """Implementation of the 'AccountSearchFilter' model. TODO: type model description here. Attributes: name (string): TODO: type description here. org_no (string): TODO: type description here. uni_customer_no (string): TODO: type description here. created_before (datetime): TOD...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AccountSearchFilter: """Implementation of the 'AccountSearchFilter' model. TODO: type model description here. Attributes: name (string): TODO: type description here. org_no (string): TODO: type description here. uni_customer_no (string): TODO: type description here. created_before (datetime): TODO: type descr...
the_stack_v2_python_sparse
idfy_rest_client/models/account_search_filter.py
dealflowteam/Idfy
train
0
627df901eb782fb4142ecff0970083a9c47db8b5
[ "path = '/'.join([self.LOCKS_BASEURL, quote_plus(scope), quote_plus(name)])\nurl = build_url(choice(self.list_hosts), path=path, params={'did_type': 'dataset'})\nresult = self._send_request(url)\nif result.status_code == codes.ok:\n locks = self._load_json_data(result)\n return locks\nelse:\n exc_cls, exc_...
<|body_start_0|> path = '/'.join([self.LOCKS_BASEURL, quote_plus(scope), quote_plus(name)]) url = build_url(choice(self.list_hosts), path=path, params={'did_type': 'dataset'}) result = self._send_request(url) if result.status_code == codes.ok: locks = self._load_json_data(res...
Lock client class for working with rucio locks
LockClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LockClient: """Lock client class for working with rucio locks""" def get_dataset_locks(self, scope, name): """Get a dataset locks of the specified dataset. :param scope: the scope of the did of the locks to list. :param name: the name of the did of the locks to list.""" <|bod...
stack_v2_sparse_classes_10k_train_008669
3,973
permissive
[ { "docstring": "Get a dataset locks of the specified dataset. :param scope: the scope of the did of the locks to list. :param name: the name of the did of the locks to list.", "name": "get_dataset_locks", "signature": "def get_dataset_locks(self, scope, name)" }, { "docstring": "Get list of lock...
3
stack_v2_sparse_classes_30k_train_006481
Implement the Python class `LockClient` described below. Class description: Lock client class for working with rucio locks Method signatures and docstrings: - def get_dataset_locks(self, scope, name): Get a dataset locks of the specified dataset. :param scope: the scope of the did of the locks to list. :param name: t...
Implement the Python class `LockClient` described below. Class description: Lock client class for working with rucio locks Method signatures and docstrings: - def get_dataset_locks(self, scope, name): Get a dataset locks of the specified dataset. :param scope: the scope of the did of the locks to list. :param name: t...
7f0d229ac0b3bc7dec12c6e158bea2b82d414a3b
<|skeleton|> class LockClient: """Lock client class for working with rucio locks""" def get_dataset_locks(self, scope, name): """Get a dataset locks of the specified dataset. :param scope: the scope of the did of the locks to list. :param name: the name of the did of the locks to list.""" <|bod...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LockClient: """Lock client class for working with rucio locks""" def get_dataset_locks(self, scope, name): """Get a dataset locks of the specified dataset. :param scope: the scope of the did of the locks to list. :param name: the name of the did of the locks to list.""" path = '/'.join([s...
the_stack_v2_python_sparse
lib/rucio/client/lockclient.py
rucio/rucio
train
232
b9f095356cdbbd7a61aa5239322db13463ed208a
[ "self.assertRaises(TypeError, add_errors, 'one', 2)\nself.assertRaises(TypeError, add_errors, 2)\nself.assertRaises(TypeError, add_errors, 2, 5.5)\nself.assertRaises(TypeError, add_errors, 'one', 'two')", "self.assertEqual(9, add_errors(3, 6), \"Can't add it up\")\nself.assertEqual(5, add_errors(-1, 6), \"Can't a...
<|body_start_0|> self.assertRaises(TypeError, add_errors, 'one', 2) self.assertRaises(TypeError, add_errors, 2) self.assertRaises(TypeError, add_errors, 2, 5.5) self.assertRaises(TypeError, add_errors, 'one', 'two') <|end_body_0|> <|body_start_1|> self.assertEqual(9, add_errors(...
Test
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test: def testAddErrors(self): """Tests ensuring errors in data cause validation failures.""" <|body_0|> def testAddSuccesses(self): """Test ensuring that valid data passes.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.assertRaises(TypeError...
stack_v2_sparse_classes_10k_train_008670
914
no_license
[ { "docstring": "Tests ensuring errors in data cause validation failures.", "name": "testAddErrors", "signature": "def testAddErrors(self)" }, { "docstring": "Test ensuring that valid data passes.", "name": "testAddSuccesses", "signature": "def testAddSuccesses(self)" } ]
2
stack_v2_sparse_classes_30k_train_007080
Implement the Python class `Test` described below. Class description: Implement the Test class. Method signatures and docstrings: - def testAddErrors(self): Tests ensuring errors in data cause validation failures. - def testAddSuccesses(self): Test ensuring that valid data passes.
Implement the Python class `Test` described below. Class description: Implement the Test class. Method signatures and docstrings: - def testAddErrors(self): Tests ensuring errors in data cause validation failures. - def testAddSuccesses(self): Test ensuring that valid data passes. <|skeleton|> class Test: def t...
049c654ed626e97d7fe2f8dc61d84c60f10d7558
<|skeleton|> class Test: def testAddErrors(self): """Tests ensuring errors in data cause validation failures.""" <|body_0|> def testAddSuccesses(self): """Test ensuring that valid data passes.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Test: def testAddErrors(self): """Tests ensuring errors in data cause validation failures.""" self.assertRaises(TypeError, add_errors, 'one', 2) self.assertRaises(TypeError, add_errors, 2) self.assertRaises(TypeError, add_errors, 2, 5.5) self.assertRaises(TypeError, add...
the_stack_v2_python_sparse
workspace/Python3_Homework01/src/test_adder.py
paulrefalo/Python-2---4
train
0
bde200ab78ba02cdf6700fe3a5089ff0cacd8f30
[ "self.color_code = color_code\nself.day = day\nself.month = month\nself.name = name", "if type(self) is not type(other):\n return NotImplemented\nif self.day != other.day:\n return False\nif self.month != other.month:\n return False\nif self.name != other.name:\n return False\nif self.color_code != ot...
<|body_start_0|> self.color_code = color_code self.day = day self.month = month self.name = name <|end_body_0|> <|body_start_1|> if type(self) is not type(other): return NotImplemented if self.day != other.day: return False if self.month !...
Represents a calendar event. Attributes ---------- day : `int` The day's value. month : `int` The month's value. name : `str` The event's name. color_code : `str` Color code to use to highlight the event's name.
CalendarEvent
[ "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CalendarEvent: """Represents a calendar event. Attributes ---------- day : `int` The day's value. month : `int` The month's value. name : `str` The event's name. color_code : `str` Color code to use to highlight the event's name.""" def __init__(self, month, day, name, color_code): "...
stack_v2_sparse_classes_10k_train_008671
3,074
no_license
[ { "docstring": "Creates a new calendar event. Parameters ---------- month : `int` The month's value. day : `int` The day's value. name : `str` The event's name. color_code : `str` Color code to use to highlight the event's name.", "name": "__init__", "signature": "def __init__(self, month, day, name, co...
4
stack_v2_sparse_classes_30k_train_003053
Implement the Python class `CalendarEvent` described below. Class description: Represents a calendar event. Attributes ---------- day : `int` The day's value. month : `int` The month's value. name : `str` The event's name. color_code : `str` Color code to use to highlight the event's name. Method signatures and docst...
Implement the Python class `CalendarEvent` described below. Class description: Represents a calendar event. Attributes ---------- day : `int` The day's value. month : `int` The month's value. name : `str` The event's name. color_code : `str` Color code to use to highlight the event's name. Method signatures and docst...
74f92b598e86606ea3a269311316cddd84a5215f
<|skeleton|> class CalendarEvent: """Represents a calendar event. Attributes ---------- day : `int` The day's value. month : `int` The month's value. name : `str` The event's name. color_code : `str` Color code to use to highlight the event's name.""" def __init__(self, month, day, name, color_code): "...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CalendarEvent: """Represents a calendar event. Attributes ---------- day : `int` The day's value. month : `int` The month's value. name : `str` The event's name. color_code : `str` Color code to use to highlight the event's name.""" def __init__(self, month, day, name, color_code): """Creates a n...
the_stack_v2_python_sparse
koishi/plugins/touhou_calendar/calendar_event.py
HuyaneMatsu/Koishi
train
17
7016cf523071438599b010b38e3a4bb9ffbeed4f
[ "super().__init__()\nself.message = message\nself.status_code = status_code", "response = jsonify({'message': self.message, 'status': self.status_code})\nresponse.status_code = self.status_code\nreturn response" ]
<|body_start_0|> super().__init__() self.message = message self.status_code = status_code <|end_body_0|> <|body_start_1|> response = jsonify({'message': self.message, 'status': self.status_code}) response.status_code = self.status_code return response <|end_body_1|>
Error class for API HTTP errors.
ApiHTTPError
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApiHTTPError: """Error class for API HTTP errors.""" def __init__(self, message, status_code): """Initialize the class with a custom error message. Args: message: Description of the error. status_code: HTTP status code.""" <|body_0|> def build_response(self): """...
stack_v2_sparse_classes_10k_train_008672
1,531
permissive
[ { "docstring": "Initialize the class with a custom error message. Args: message: Description of the error. status_code: HTTP status code.", "name": "__init__", "signature": "def __init__(self, message, status_code)" }, { "docstring": "Create a response object. Returns: Response object (instance ...
2
stack_v2_sparse_classes_30k_train_003022
Implement the Python class `ApiHTTPError` described below. Class description: Error class for API HTTP errors. Method signatures and docstrings: - def __init__(self, message, status_code): Initialize the class with a custom error message. Args: message: Description of the error. status_code: HTTP status code. - def b...
Implement the Python class `ApiHTTPError` described below. Class description: Error class for API HTTP errors. Method signatures and docstrings: - def __init__(self, message, status_code): Initialize the class with a custom error message. Args: message: Description of the error. status_code: HTTP status code. - def b...
24f471b58ca4a87cb053961b5f05c07a544ca7b8
<|skeleton|> class ApiHTTPError: """Error class for API HTTP errors.""" def __init__(self, message, status_code): """Initialize the class with a custom error message. Args: message: Description of the error. status_code: HTTP status code.""" <|body_0|> def build_response(self): """...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ApiHTTPError: """Error class for API HTTP errors.""" def __init__(self, message, status_code): """Initialize the class with a custom error message. Args: message: Description of the error. status_code: HTTP status code.""" super().__init__() self.message = message self.sta...
the_stack_v2_python_sparse
timesketch/lib/errors.py
google/timesketch
train
2,263
8828e66fe2db9dc500c592a04008f0b9a3720fe6
[ "env = ZerosEnvironment(batch_size=batch_size, observation_shape=observation_shape)\n\n@common.function\ndef observation_and_reward():\n observation = env.reset().observation\n reward = env.step(tf.zeros(batch_size)).reward\n return (observation, reward)\nobservation, reward = observation_and_reward()\nexp...
<|body_start_0|> env = ZerosEnvironment(batch_size=batch_size, observation_shape=observation_shape) @common.function def observation_and_reward(): observation = env.reset().observation reward = env.step(tf.zeros(batch_size)).reward return (observation, reward...
BanditTFEnvironmentTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BanditTFEnvironmentTest: def testObservationAndRewardShapes(self, batch_size, observation_shape): """Exercise `reset` and `step`. Ensure correct shapes are returned.""" <|body_0|> def testTwoConsecutiveSteps(self, batch_size, observation_shape): """Test two consecuti...
stack_v2_sparse_classes_10k_train_008673
5,763
permissive
[ { "docstring": "Exercise `reset` and `step`. Ensure correct shapes are returned.", "name": "testObservationAndRewardShapes", "signature": "def testObservationAndRewardShapes(self, batch_size, observation_shape)" }, { "docstring": "Test two consecutive calls to `step`.", "name": "testTwoConse...
3
null
Implement the Python class `BanditTFEnvironmentTest` described below. Class description: Implement the BanditTFEnvironmentTest class. Method signatures and docstrings: - def testObservationAndRewardShapes(self, batch_size, observation_shape): Exercise `reset` and `step`. Ensure correct shapes are returned. - def test...
Implement the Python class `BanditTFEnvironmentTest` described below. Class description: Implement the BanditTFEnvironmentTest class. Method signatures and docstrings: - def testObservationAndRewardShapes(self, batch_size, observation_shape): Exercise `reset` and `step`. Ensure correct shapes are returned. - def test...
eca1093d3a047e538f17f6ab92ab4d8144284f23
<|skeleton|> class BanditTFEnvironmentTest: def testObservationAndRewardShapes(self, batch_size, observation_shape): """Exercise `reset` and `step`. Ensure correct shapes are returned.""" <|body_0|> def testTwoConsecutiveSteps(self, batch_size, observation_shape): """Test two consecuti...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BanditTFEnvironmentTest: def testObservationAndRewardShapes(self, batch_size, observation_shape): """Exercise `reset` and `step`. Ensure correct shapes are returned.""" env = ZerosEnvironment(batch_size=batch_size, observation_shape=observation_shape) @common.function def obse...
the_stack_v2_python_sparse
tf_agents/bandits/environments/bandit_tf_environment_test.py
tensorflow/agents
train
2,755
b47f32ffeef53ff13b2856ed4ed02651d05282e6
[ "self._payment_dates = payment_dates\nself._payment_steps = payment_steps\nself._exercise_dates = exercise_dates\nself._exercise_steps = exercise_steps\nself._steps = int(exercise_steps[len(exercise_steps) - 1])\nself._frequency = frequency\nself._the_tree = {}", "coupon_rates = np.ones_like(self._payment_steps) ...
<|body_start_0|> self._payment_dates = payment_dates self._payment_steps = payment_steps self._exercise_dates = exercise_dates self._exercise_steps = exercise_steps self._steps = int(exercise_steps[len(exercise_steps) - 1]) self._frequency = frequency self._the_tr...
Representation of a simple swaption product such as European or Bermudan Swaption
SimpleSwaption
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimpleSwaption: """Representation of a simple swaption product such as European or Bermudan Swaption""" def __init__(self, payment_dates, payment_steps, exercise_dates, exercise_steps, frequency=2): """Initialize a SimpleSwaption object Parameters ---------- payment_dates : array_lik...
stack_v2_sparse_classes_10k_train_008674
11,731
no_license
[ { "docstring": "Initialize a SimpleSwaption object Parameters ---------- payment_dates : array_like of shape (M, ) with datetime payment dates payment_steps : array_like of shape (M, ) with integer payment steps that corresponds to the tree exercise_dates : array_like of shape (M, ) with datetime exercise dates...
2
stack_v2_sparse_classes_30k_train_003798
Implement the Python class `SimpleSwaption` described below. Class description: Representation of a simple swaption product such as European or Bermudan Swaption Method signatures and docstrings: - def __init__(self, payment_dates, payment_steps, exercise_dates, exercise_steps, frequency=2): Initialize a SimpleSwapti...
Implement the Python class `SimpleSwaption` described below. Class description: Representation of a simple swaption product such as European or Bermudan Swaption Method signatures and docstrings: - def __init__(self, payment_dates, payment_steps, exercise_dates, exercise_steps, frequency=2): Initialize a SimpleSwapti...
9f710a8de56fb9b4456c6f98be91f4b22ef5ede5
<|skeleton|> class SimpleSwaption: """Representation of a simple swaption product such as European or Bermudan Swaption""" def __init__(self, payment_dates, payment_steps, exercise_dates, exercise_steps, frequency=2): """Initialize a SimpleSwaption object Parameters ---------- payment_dates : array_lik...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SimpleSwaption: """Representation of a simple swaption product such as European or Bermudan Swaption""" def __init__(self, payment_dates, payment_steps, exercise_dates, exercise_steps, frequency=2): """Initialize a SimpleSwaption object Parameters ---------- payment_dates : array_like of shape (M...
the_stack_v2_python_sparse
Hull-White Model/simple_derivatives.py
jesusmramirez/Term-Structure-Models
train
1
2410ea9745e9297f2b51ec04e7f68dc291b3448c
[ "TITLE_TEXT = 'Scatter Plot Explorer - Data Commons'\nself.driver.get(self.url_ + SCATTER_URL)\nreq = urllib.request.Request(self.driver.current_url)\nwith urllib.request.urlopen(req) as response:\n self.assertEqual(response.getcode(), 200)\nreq = urllib.request.Request(self.url_ + '/scatter.js')\nwith urllib.re...
<|body_start_0|> TITLE_TEXT = 'Scatter Plot Explorer - Data Commons' self.driver.get(self.url_ + SCATTER_URL) req = urllib.request.Request(self.driver.current_url) with urllib.request.urlopen(req) as response: self.assertEqual(response.getcode(), 200) req = urllib.req...
TestScatter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestScatter: def test_server_and_page(self): """Test the server can run successfully.""" <|body_0|> def test_charts_from_url(self): """Given the url directly, test the page shows up correctly""" <|body_1|> def test_manually_enter_options(self): "...
stack_v2_sparse_classes_10k_train_008675
5,568
permissive
[ { "docstring": "Test the server can run successfully.", "name": "test_server_and_page", "signature": "def test_server_and_page(self)" }, { "docstring": "Given the url directly, test the page shows up correctly", "name": "test_charts_from_url", "signature": "def test_charts_from_url(self)...
3
stack_v2_sparse_classes_30k_val_000196
Implement the Python class `TestScatter` described below. Class description: Implement the TestScatter class. Method signatures and docstrings: - def test_server_and_page(self): Test the server can run successfully. - def test_charts_from_url(self): Given the url directly, test the page shows up correctly - def test_...
Implement the Python class `TestScatter` described below. Class description: Implement the TestScatter class. Method signatures and docstrings: - def test_server_and_page(self): Test the server can run successfully. - def test_charts_from_url(self): Given the url directly, test the page shows up correctly - def test_...
928625749a74dd9de473170b5683f62a4bbdbd15
<|skeleton|> class TestScatter: def test_server_and_page(self): """Test the server can run successfully.""" <|body_0|> def test_charts_from_url(self): """Given the url directly, test the page shows up correctly""" <|body_1|> def test_manually_enter_options(self): "...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestScatter: def test_server_and_page(self): """Test the server can run successfully.""" TITLE_TEXT = 'Scatter Plot Explorer - Data Commons' self.driver.get(self.url_ + SCATTER_URL) req = urllib.request.Request(self.driver.current_url) with urllib.request.urlopen(req) a...
the_stack_v2_python_sparse
server/webdriver_tests/scatter_test.py
localsite/website
train
0
46d29b031bf6c5c4f2ce7f642e336055f97dacf0
[ "flavors_controller = self.driver.manager.flavors_controller\nresult = flavors_controller.list()\nflavor_list = [flavor_response.Model(item, self) for item in result]\nreturn {'flavors': flavor_list}", "flavors_controller = self.driver.manager.flavors_controller\ntry:\n result = flavors_controller.get(flavor_i...
<|body_start_0|> flavors_controller = self.driver.manager.flavors_controller result = flavors_controller.list() flavor_list = [flavor_response.Model(item, self) for item in result] return {'flavors': flavor_list} <|end_body_0|> <|body_start_1|> flavors_controller = self.driver.m...
FlavorsController
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FlavorsController: def get_all(self): """get all flavor list.""" <|body_0|> def get_one(self, flavor_id): """get_one :param flavor_model :returns JSON flavor(HTTP 200) or HTTP 404""" <|body_1|> def post(self): """POST :returns JSON flavor(HTTP 20...
stack_v2_sparse_classes_10k_train_008676
3,772
permissive
[ { "docstring": "get all flavor list.", "name": "get_all", "signature": "def get_all(self)" }, { "docstring": "get_one :param flavor_model :returns JSON flavor(HTTP 200) or HTTP 404", "name": "get_one", "signature": "def get_one(self, flavor_id)" }, { "docstring": "POST :returns J...
4
stack_v2_sparse_classes_30k_train_006985
Implement the Python class `FlavorsController` described below. Class description: Implement the FlavorsController class. Method signatures and docstrings: - def get_all(self): get all flavor list. - def get_one(self, flavor_id): get_one :param flavor_model :returns JSON flavor(HTTP 200) or HTTP 404 - def post(self):...
Implement the Python class `FlavorsController` described below. Class description: Implement the FlavorsController class. Method signatures and docstrings: - def get_all(self): get all flavor list. - def get_one(self, flavor_id): get_one :param flavor_model :returns JSON flavor(HTTP 200) or HTTP 404 - def post(self):...
0620ff595f8fcaa445b684de99ad130a3c398461
<|skeleton|> class FlavorsController: def get_all(self): """get all flavor list.""" <|body_0|> def get_one(self, flavor_id): """get_one :param flavor_model :returns JSON flavor(HTTP 200) or HTTP 404""" <|body_1|> def post(self): """POST :returns JSON flavor(HTTP 20...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FlavorsController: def get_all(self): """get all flavor list.""" flavors_controller = self.driver.manager.flavors_controller result = flavors_controller.list() flavor_list = [flavor_response.Model(item, self) for item in result] return {'flavors': flavor_list} def ...
the_stack_v2_python_sparse
poppy/transport/pecan/controllers/v1/flavors.py
rackerlabs/poppy
train
3
a02aae8b0ad9829c94253ecbd7d633c80ff9b73a
[ "super().__init__(config)\nself.in_proj_weight = nn.Parameter(torch.cat([bart_layer.self_attn.q_proj.weight, bart_layer.self_attn.k_proj.weight, bart_layer.self_attn.v_proj.weight]))\nself.in_proj_bias = nn.Parameter(torch.cat([bart_layer.self_attn.q_proj.bias, bart_layer.self_attn.k_proj.bias, bart_layer.self_attn...
<|body_start_0|> super().__init__(config) self.in_proj_weight = nn.Parameter(torch.cat([bart_layer.self_attn.q_proj.weight, bart_layer.self_attn.k_proj.weight, bart_layer.self_attn.v_proj.weight])) self.in_proj_bias = nn.Parameter(torch.cat([bart_layer.self_attn.q_proj.bias, bart_layer.self_attn...
BartEncoderLayerBetterTransformer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BartEncoderLayerBetterTransformer: def __init__(self, bart_layer, config): """A simple conversion of the `BartEncoderLayer` to its `BetterTransformer` implementation. Args: bart_layer (`torch.nn.Module`): The original `BartEncoderLayer` where the weights needs to be retrieved.""" ...
stack_v2_sparse_classes_10k_train_008677
43,670
no_license
[ { "docstring": "A simple conversion of the `BartEncoderLayer` to its `BetterTransformer` implementation. Args: bart_layer (`torch.nn.Module`): The original `BartEncoderLayer` where the weights needs to be retrieved.", "name": "__init__", "signature": "def __init__(self, bart_layer, config)" }, { ...
2
stack_v2_sparse_classes_30k_train_005422
Implement the Python class `BartEncoderLayerBetterTransformer` described below. Class description: Implement the BartEncoderLayerBetterTransformer class. Method signatures and docstrings: - def __init__(self, bart_layer, config): A simple conversion of the `BartEncoderLayer` to its `BetterTransformer` implementation....
Implement the Python class `BartEncoderLayerBetterTransformer` described below. Class description: Implement the BartEncoderLayerBetterTransformer class. Method signatures and docstrings: - def __init__(self, bart_layer, config): A simple conversion of the `BartEncoderLayer` to its `BetterTransformer` implementation....
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class BartEncoderLayerBetterTransformer: def __init__(self, bart_layer, config): """A simple conversion of the `BartEncoderLayer` to its `BetterTransformer` implementation. Args: bart_layer (`torch.nn.Module`): The original `BartEncoderLayer` where the weights needs to be retrieved.""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BartEncoderLayerBetterTransformer: def __init__(self, bart_layer, config): """A simple conversion of the `BartEncoderLayer` to its `BetterTransformer` implementation. Args: bart_layer (`torch.nn.Module`): The original `BartEncoderLayer` where the weights needs to be retrieved.""" super().__ini...
the_stack_v2_python_sparse
generated/test_huggingface_optimum.py
jansel/pytorch-jit-paritybench
train
35
d5d848b66adf92824d83f6fb00f26c77dcb0bbac
[ "BaseBNNPrior.__init__(self, bnn_omega, components)\nself.params_to_exclude = []\nself.set_params_list(self.params_to_exclude)\nself.set_comps_qphi_to_e1e2()", "kwargs = Dict()\nfor comp, param_name in self.params_to_realize:\n hyperparams = getattr(self, comp)[param_name].copy()\n kwargs[comp][param_name] ...
<|body_start_0|> BaseBNNPrior.__init__(self, bnn_omega, components) self.params_to_exclude = [] self.set_params_list(self.params_to_exclude) self.set_comps_qphi_to_e1e2() <|end_body_0|> <|body_start_1|> kwargs = Dict() for comp, param_name in self.params_to_realize: ...
BNN prior with independent parameters Note ---- This BNNPrior is cosmology-agnostic. For a version that's useful for H0 inference, see `DiagonalCosmoBNNPrior`.
DiagonalBNNPrior
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DiagonalBNNPrior: """BNN prior with independent parameters Note ---- This BNNPrior is cosmology-agnostic. For a version that's useful for H0 inference, see `DiagonalCosmoBNNPrior`.""" def __init__(self, bnn_omega, components): """Note ---- The dictionary attributes are copies of the ...
stack_v2_sparse_classes_10k_train_008678
2,765
permissive
[ { "docstring": "Note ---- The dictionary attributes are copies of the config corresponding to each component. The number of attributes depends on the number of components. Attributes ---------- components : list list of components, e.g. `lens_mass` lens_mass : dict profile type and parameters of the lens mass s...
2
stack_v2_sparse_classes_30k_train_002623
Implement the Python class `DiagonalBNNPrior` described below. Class description: BNN prior with independent parameters Note ---- This BNNPrior is cosmology-agnostic. For a version that's useful for H0 inference, see `DiagonalCosmoBNNPrior`. Method signatures and docstrings: - def __init__(self, bnn_omega, components...
Implement the Python class `DiagonalBNNPrior` described below. Class description: BNN prior with independent parameters Note ---- This BNNPrior is cosmology-agnostic. For a version that's useful for H0 inference, see `DiagonalCosmoBNNPrior`. Method signatures and docstrings: - def __init__(self, bnn_omega, components...
2a9a1b3eafbafef925bedab4b3137a3505a9b750
<|skeleton|> class DiagonalBNNPrior: """BNN prior with independent parameters Note ---- This BNNPrior is cosmology-agnostic. For a version that's useful for H0 inference, see `DiagonalCosmoBNNPrior`.""" def __init__(self, bnn_omega, components): """Note ---- The dictionary attributes are copies of the ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DiagonalBNNPrior: """BNN prior with independent parameters Note ---- This BNNPrior is cosmology-agnostic. For a version that's useful for H0 inference, see `DiagonalCosmoBNNPrior`.""" def __init__(self, bnn_omega, components): """Note ---- The dictionary attributes are copies of the config corres...
the_stack_v2_python_sparse
baobab/bnn_priors/diagonal_bnn_prior.py
jiwoncpark/baobab
train
9
8b030049f7f1d747ce6afe82a09d31c5eb156c20
[ "if 'host' not in kwargs:\n raise TobyException(\"'host' is mandatory\", host_obj=self)\nif kwargs.get('connect_mode', '').lower() == 'console':\n kwargs['strict'] = True\nkwargs['os'] = kwargs.get('os', 'BROCADE')\nself._kwargs = kwargs\nself.connected = False\nself.mode = 'user'\nself.prompt = '>\\\\s+'\nsu...
<|body_start_0|> if 'host' not in kwargs: raise TobyException("'host' is mandatory", host_obj=self) if kwargs.get('connect_mode', '').lower() == 'console': kwargs['strict'] = True kwargs['os'] = kwargs.get('os', 'BROCADE') self._kwargs = kwargs self.connec...
Generic Brocade class for common operations
Brocade
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Brocade: """Generic Brocade class for common operations""" def __init__(self, *args, **kwargs): """Base class for Brocade devices :param host: **REQUIRED** host-name or IP address of target device :param os: *OPTIONAL* Operating System of device. Default is BROCADE :param user: *OPTI...
stack_v2_sparse_classes_10k_train_008679
5,819
no_license
[ { "docstring": "Base class for Brocade devices :param host: **REQUIRED** host-name or IP address of target device :param os: *OPTIONAL* Operating System of device. Default is BROCADE :param user: *OPTIONAL* Login user name. If not provided will be derived from Toby framework defaults. :param password: *OPTIONAL...
5
null
Implement the Python class `Brocade` described below. Class description: Generic Brocade class for common operations Method signatures and docstrings: - def __init__(self, *args, **kwargs): Base class for Brocade devices :param host: **REQUIRED** host-name or IP address of target device :param os: *OPTIONAL* Operatin...
Implement the Python class `Brocade` described below. Class description: Generic Brocade class for common operations Method signatures and docstrings: - def __init__(self, *args, **kwargs): Base class for Brocade devices :param host: **REQUIRED** host-name or IP address of target device :param os: *OPTIONAL* Operatin...
3966c63d48557b0b94303896eed7a767593a4832
<|skeleton|> class Brocade: """Generic Brocade class for common operations""" def __init__(self, *args, **kwargs): """Base class for Brocade devices :param host: **REQUIRED** host-name or IP address of target device :param os: *OPTIONAL* Operating System of device. Default is BROCADE :param user: *OPTI...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Brocade: """Generic Brocade class for common operations""" def __init__(self, *args, **kwargs): """Base class for Brocade devices :param host: **REQUIRED** host-name or IP address of target device :param os: *OPTIONAL* Operating System of device. Default is BROCADE :param user: *OPTIONAL* Login u...
the_stack_v2_python_sparse
NITA/lib/jnpr/toby/hldcl/brocade/brocade.py
fengyun4623/file
train
0
1174ca5ef6d34fe241daf5d1c8a5ae07858c1242
[ "m, n = (len(matrix), len(matrix[0]))\nq = [(matrix[0][0], 0, 0)]\nans = None\nfor _ in range(k):\n ans, i, j = heapq.heappop(q)\n if j + 1 < n:\n heapq.heappush(q, (matrix[i][j + 1], i, j + 1))\n if j == 0 and i + 1 < m:\n heapq.heappush(q, (matrix[i + 1][j], i + 1, j))\nreturn ans", "lo, ...
<|body_start_0|> m, n = (len(matrix), len(matrix[0])) q = [(matrix[0][0], 0, 0)] ans = None for _ in range(k): ans, i, j = heapq.heappop(q) if j + 1 < n: heapq.heappush(q, (matrix[i][j + 1], i, j + 1)) if j == 0 and i + 1 < m: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def kthSmallestHeap(self, matrix, k): """:type matrix: List[List[int]] :type k: int :rtype: int""" <|body_0|> def kthSmallest(self, matrix, k): """Heap of list :type matrix: List[List[int]] :type k: int :rtype: int""" <|body_1|> def countLower(...
stack_v2_sparse_classes_10k_train_008680
2,192
no_license
[ { "docstring": ":type matrix: List[List[int]] :type k: int :rtype: int", "name": "kthSmallestHeap", "signature": "def kthSmallestHeap(self, matrix, k)" }, { "docstring": "Heap of list :type matrix: List[List[int]] :type k: int :rtype: int", "name": "kthSmallest", "signature": "def kthSma...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def kthSmallestHeap(self, matrix, k): :type matrix: List[List[int]] :type k: int :rtype: int - def kthSmallest(self, matrix, k): Heap of list :type matrix: List[List[int]] :type ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def kthSmallestHeap(self, matrix, k): :type matrix: List[List[int]] :type k: int :rtype: int - def kthSmallest(self, matrix, k): Heap of list :type matrix: List[List[int]] :type ...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def kthSmallestHeap(self, matrix, k): """:type matrix: List[List[int]] :type k: int :rtype: int""" <|body_0|> def kthSmallest(self, matrix, k): """Heap of list :type matrix: List[List[int]] :type k: int :rtype: int""" <|body_1|> def countLower(...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def kthSmallestHeap(self, matrix, k): """:type matrix: List[List[int]] :type k: int :rtype: int""" m, n = (len(matrix), len(matrix[0])) q = [(matrix[0][0], 0, 0)] ans = None for _ in range(k): ans, i, j = heapq.heappop(q) if j + 1 < n: ...
the_stack_v2_python_sparse
K/KthSmallestElementinaSortedMatrix.py
bssrdf/pyleet
train
2
4b42b73fdb1a36f31b0f36dcd082f9c769b92a5c
[ "self.size = size\nself.current_size = 0\nself.values = collections.deque()", "if self.current_size < self.size:\n self.values.append(val)\n self.current_size += 1\n return 1.0 * sum(self.values) / len(self.values)\nelse:\n self.values.append(val)\n self.values.popleft()\n return 1.0 * sum(self....
<|body_start_0|> self.size = size self.current_size = 0 self.values = collections.deque() <|end_body_0|> <|body_start_1|> if self.current_size < self.size: self.values.append(val) self.current_size += 1 return 1.0 * sum(self.values) / len(self.values)...
MovingAverage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" <|body_0|> def next(self, val): """:type val: int :rtype: float""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.size = size self.current...
stack_v2_sparse_classes_10k_train_008681
1,304
no_license
[ { "docstring": "Initialize your data structure here. :type size: int", "name": "__init__", "signature": "def __init__(self, size)" }, { "docstring": ":type val: int :rtype: float", "name": "next", "signature": "def next(self, val)" } ]
2
stack_v2_sparse_classes_30k_train_003996
Implement the Python class `MovingAverage` described below. Class description: Implement the MovingAverage class. Method signatures and docstrings: - def __init__(self, size): Initialize your data structure here. :type size: int - def next(self, val): :type val: int :rtype: float
Implement the Python class `MovingAverage` described below. Class description: Implement the MovingAverage class. Method signatures and docstrings: - def __init__(self, size): Initialize your data structure here. :type size: int - def next(self, val): :type val: int :rtype: float <|skeleton|> class MovingAverage: ...
6de551327f96ec4d4b63d0045281b65bbb4f5d0f
<|skeleton|> class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" <|body_0|> def next(self, val): """:type val: int :rtype: float""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" self.size = size self.current_size = 0 self.values = collections.deque() def next(self, val): """:type val: int :rtype: float""" if self.current_size < self....
the_stack_v2_python_sparse
MovingAverage.py
JingweiTu/leetcode
train
0
0a34b4e70ba768e49d9059f8ff38047e599a854f
[ "super().__init__(**kwargs)\nself.allow_ipv4 = allow_ipv4\nself.resolve = resolve", "value = super()._validate(cfg, value)\ntry:\n addr = IPv4Address(value)\nexcept:\n pass\nelse:\n if self.allow_ipv4:\n return str(addr)\n raise ValueError('value is not a valid DNS hostname')\nif self.resolve:\...
<|body_start_0|> super().__init__(**kwargs) self.allow_ipv4 = allow_ipv4 self.resolve = resolve <|end_body_0|> <|body_start_1|> value = super()._validate(cfg, value) try: addr = IPv4Address(value) except: pass else: if self.all...
A field representing a network hostname or, optionally, a network address.
HostnameField
[ "ISC" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HostnameField: """A field representing a network hostname or, optionally, a network address.""" def __init__(self, *, allow_ipv4: bool=True, resolve: bool=False, **kwargs): """:param allow_ipv4: allow both a hostname and an IPv4 address :param resolve: resolve hostnames to their IPv4...
stack_v2_sparse_classes_10k_train_008682
4,387
permissive
[ { "docstring": ":param allow_ipv4: allow both a hostname and an IPv4 address :param resolve: resolve hostnames to their IPv4 address and raise a :class:`ValueError` if the resolution fails", "name": "__init__", "signature": "def __init__(self, *, allow_ipv4: bool=True, resolve: bool=False, **kwargs)" ...
2
stack_v2_sparse_classes_30k_train_002692
Implement the Python class `HostnameField` described below. Class description: A field representing a network hostname or, optionally, a network address. Method signatures and docstrings: - def __init__(self, *, allow_ipv4: bool=True, resolve: bool=False, **kwargs): :param allow_ipv4: allow both a hostname and an IPv...
Implement the Python class `HostnameField` described below. Class description: A field representing a network hostname or, optionally, a network address. Method signatures and docstrings: - def __init__(self, *, allow_ipv4: bool=True, resolve: bool=False, **kwargs): :param allow_ipv4: allow both a hostname and an IPv...
1499ff8f00a43a592571a10666823e125d5fbc49
<|skeleton|> class HostnameField: """A field representing a network hostname or, optionally, a network address.""" def __init__(self, *, allow_ipv4: bool=True, resolve: bool=False, **kwargs): """:param allow_ipv4: allow both a hostname and an IPv4 address :param resolve: resolve hostnames to their IPv4...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class HostnameField: """A field representing a network hostname or, optionally, a network address.""" def __init__(self, *, allow_ipv4: bool=True, resolve: bool=False, **kwargs): """:param allow_ipv4: allow both a hostname and an IPv4 address :param resolve: resolve hostnames to their IPv4 address and ...
the_stack_v2_python_sparse
cincoconfig/fields/net_field.py
ameily/cincoconfig
train
6
d26aa17184ed3846a2e954bf7ebdb5870aca4019
[ "os.remove(invoice_file)\nadd_furniture(invoice_file, 'Elisa Miles', 'LR04', 'Leather Sofa', 25)\nadd_furniture(invoice_file, 'Edward Data', 'KT78', 'Kitchen Table', 10)\nadd_furniture(invoice_file, 'Alex Gonzales', 'BR02', 'Queen Mattress', 17)\nexpected = [['Elisa Miles', 'LR04', 'Leather Sofa', '25'], ['Edward D...
<|body_start_0|> os.remove(invoice_file) add_furniture(invoice_file, 'Elisa Miles', 'LR04', 'Leather Sofa', 25) add_furniture(invoice_file, 'Edward Data', 'KT78', 'Kitchen Table', 10) add_furniture(invoice_file, 'Alex Gonzales', 'BR02', 'Queen Mattress', 17) expected = [['Elisa M...
This class tests inventory functions
InventoryTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InventoryTests: """This class tests inventory functions""" def test_add_furniture(self, invoice_file='invoice_test.csv'): """Test inventory function""" <|body_0|> def test_single_customer(self, invoice_file='invoice_test.csv'): """This module tests single_custome...
stack_v2_sparse_classes_10k_train_008683
1,772
no_license
[ { "docstring": "Test inventory function", "name": "test_add_furniture", "signature": "def test_add_furniture(self, invoice_file='invoice_test.csv')" }, { "docstring": "This module tests single_customer function", "name": "test_single_customer", "signature": "def test_single_customer(self...
2
null
Implement the Python class `InventoryTests` described below. Class description: This class tests inventory functions Method signatures and docstrings: - def test_add_furniture(self, invoice_file='invoice_test.csv'): Test inventory function - def test_single_customer(self, invoice_file='invoice_test.csv'): This module...
Implement the Python class `InventoryTests` described below. Class description: This class tests inventory functions Method signatures and docstrings: - def test_add_furniture(self, invoice_file='invoice_test.csv'): Test inventory function - def test_single_customer(self, invoice_file='invoice_test.csv'): This module...
5dac60f39e3909ff05b26721d602ed20f14d6be3
<|skeleton|> class InventoryTests: """This class tests inventory functions""" def test_add_furniture(self, invoice_file='invoice_test.csv'): """Test inventory function""" <|body_0|> def test_single_customer(self, invoice_file='invoice_test.csv'): """This module tests single_custome...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class InventoryTests: """This class tests inventory functions""" def test_add_furniture(self, invoice_file='invoice_test.csv'): """Test inventory function""" os.remove(invoice_file) add_furniture(invoice_file, 'Elisa Miles', 'LR04', 'Leather Sofa', 25) add_furniture(invoice_file...
the_stack_v2_python_sparse
students/philip_behrend/lesson08/test_inventory.py
JavaRod/SP_Python220B_2019
train
1
d91c6af0dd2ba70391d785b296f46f9070e0a9d0
[ "self.name = name\nself.scope = scope\nself.app_bundle_identifier = app_bundle_identifier\nself.provider_bundle_identifier = provider_bundle_identifier\nself.provider_configuration = provider_configuration\nself.uses_cert = uses_cert", "if dictionary is None:\n return None\nname = dictionary.get('name')\nscope...
<|body_start_0|> self.name = name self.scope = scope self.app_bundle_identifier = app_bundle_identifier self.provider_bundle_identifier = provider_bundle_identifier self.provider_configuration = provider_configuration self.uses_cert = uses_cert <|end_body_0|> <|body_star...
Implementation of the 'updateNetworkSmProfileUmbrella' model. TODO: type model description here. Attributes: name (string): optional: A new name for the profile scope (string): optional: A new scope for the profile (one of all, none, withAny, withAll, withoutAny, or withoutAll) and a set of tags of the devices to be as...
UpdateNetworkSmProfileUmbrellaModel
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateNetworkSmProfileUmbrellaModel: """Implementation of the 'updateNetworkSmProfileUmbrella' model. TODO: type model description here. Attributes: name (string): optional: A new name for the profile scope (string): optional: A new scope for the profile (one of all, none, withAny, withAll, witho...
stack_v2_sparse_classes_10k_train_008684
3,762
permissive
[ { "docstring": "Constructor for the UpdateNetworkSmProfileUmbrellaModel class", "name": "__init__", "signature": "def __init__(self, name=None, scope=None, app_bundle_identifier=None, provider_bundle_identifier=None, provider_configuration=None, uses_cert=None)" }, { "docstring": "Creates an ins...
2
null
Implement the Python class `UpdateNetworkSmProfileUmbrellaModel` described below. Class description: Implementation of the 'updateNetworkSmProfileUmbrella' model. TODO: type model description here. Attributes: name (string): optional: A new name for the profile scope (string): optional: A new scope for the profile (on...
Implement the Python class `UpdateNetworkSmProfileUmbrellaModel` described below. Class description: Implementation of the 'updateNetworkSmProfileUmbrella' model. TODO: type model description here. Attributes: name (string): optional: A new name for the profile scope (string): optional: A new scope for the profile (on...
9894089eb013318243ae48869cc5130eb37f80c0
<|skeleton|> class UpdateNetworkSmProfileUmbrellaModel: """Implementation of the 'updateNetworkSmProfileUmbrella' model. TODO: type model description here. Attributes: name (string): optional: A new name for the profile scope (string): optional: A new scope for the profile (one of all, none, withAny, withAll, witho...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UpdateNetworkSmProfileUmbrellaModel: """Implementation of the 'updateNetworkSmProfileUmbrella' model. TODO: type model description here. Attributes: name (string): optional: A new name for the profile scope (string): optional: A new scope for the profile (one of all, none, withAny, withAll, withoutAny, or wit...
the_stack_v2_python_sparse
meraki_sdk/models/update_network_sm_profile_umbrella_model.py
RaulCatalano/meraki-python-sdk
train
1
9e24943be8af28db2bbb5f7466475a61ca292dce
[ "try:\n playbook_file = open(resource, 'r')\nexcept (IOError, OSError) as e:\n logger.error('Could not load workflow from {0}. Reason: {1}'.format(resource, format_exception_message(e)))\n return None\nelse:\n with playbook_file:\n workflow_loaded = playbook_file.read()\n try:\n ...
<|body_start_0|> try: playbook_file = open(resource, 'r') except (IOError, OSError) as e: logger.error('Could not load workflow from {0}. Reason: {1}'.format(resource, format_exception_message(e))) return None else: with playbook_file: ...
JsonPlaybookLoader
[ "CC0-1.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JsonPlaybookLoader: def load_workflow(resource, workflow_name): """Loads a workflow from a file. Args: resource (str): Path to the workflow. workflow_name (str): Name of the workflow to load. Returns: True on success, False otherwise.""" <|body_0|> def load_playbook(resource...
stack_v2_sparse_classes_10k_train_008685
4,183
permissive
[ { "docstring": "Loads a workflow from a file. Args: resource (str): Path to the workflow. workflow_name (str): Name of the workflow to load. Returns: True on success, False otherwise.", "name": "load_workflow", "signature": "def load_workflow(resource, workflow_name)" }, { "docstring": "Loads a ...
3
stack_v2_sparse_classes_30k_train_000370
Implement the Python class `JsonPlaybookLoader` described below. Class description: Implement the JsonPlaybookLoader class. Method signatures and docstrings: - def load_workflow(resource, workflow_name): Loads a workflow from a file. Args: resource (str): Path to the workflow. workflow_name (str): Name of the workflo...
Implement the Python class `JsonPlaybookLoader` described below. Class description: Implement the JsonPlaybookLoader class. Method signatures and docstrings: - def load_workflow(resource, workflow_name): Loads a workflow from a file. Args: resource (str): Path to the workflow. workflow_name (str): Name of the workflo...
18cd8b6d10241955bea5422947af9cf67f73aead
<|skeleton|> class JsonPlaybookLoader: def load_workflow(resource, workflow_name): """Loads a workflow from a file. Args: resource (str): Path to the workflow. workflow_name (str): Name of the workflow to load. Returns: True on success, False otherwise.""" <|body_0|> def load_playbook(resource...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class JsonPlaybookLoader: def load_workflow(resource, workflow_name): """Loads a workflow from a file. Args: resource (str): Path to the workflow. workflow_name (str): Name of the workflow to load. Returns: True on success, False otherwise.""" try: playbook_file = open(resource, 'r') ...
the_stack_v2_python_sparse
core/jsonplaybookloader.py
JustinTervala/WALKOFF
train
0
403a758b75638730e19b3da7d8e0eb82d5de0a6c
[ "super().__init__(name, X, metadata)\nself.name = name\nself.X = X\nself.metadata = metadata", "conditions = []\nif not hasattr(processed_cycler_run, 'diagnostic_summary') & hasattr(processed_cycler_run, 'diagnostic_data'):\n return False\nif processed_cycler_run.diagnostic_summary is None:\n return False\n...
<|body_start_0|> super().__init__(name, X, metadata) self.name = name self.X = X self.metadata = metadata <|end_body_0|> <|body_start_1|> conditions = [] if not hasattr(processed_cycler_run, 'diagnostic_summary') & hasattr(processed_cycler_run, 'diagnostic_data'): ...
Object corresponding to the fitted material parameters of the cell. Material parameters are determined by using high resolution half cell data to fit full cell dQdV curves. Rows of the output dataframe correspond to each of the diagnostics throughout the life of the cell. name (str): predictor object name. X (pandas.Da...
IntracellCycles
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IntracellCycles: """Object corresponding to the fitted material parameters of the cell. Material parameters are determined by using high resolution half cell data to fit full cell dQdV curves. Rows of the output dataframe correspond to each of the diagnostics throughout the life of the cell. name...
stack_v2_sparse_classes_10k_train_008686
10,932
permissive
[ { "docstring": "Args: name (str): predictor object name X (pandas.DataFrame): features in DataFrame format. metadata (dict): information about the data and code used to produce features", "name": "__init__", "signature": "def __init__(self, name, X, metadata)" }, { "docstring": "This function de...
3
stack_v2_sparse_classes_30k_train_001885
Implement the Python class `IntracellCycles` described below. Class description: Object corresponding to the fitted material parameters of the cell. Material parameters are determined by using high resolution half cell data to fit full cell dQdV curves. Rows of the output dataframe correspond to each of the diagnostic...
Implement the Python class `IntracellCycles` described below. Class description: Object corresponding to the fitted material parameters of the cell. Material parameters are determined by using high resolution half cell data to fit full cell dQdV curves. Rows of the output dataframe correspond to each of the diagnostic...
39c4cb952294d3e5ebcd2c85877d538f50d91979
<|skeleton|> class IntracellCycles: """Object corresponding to the fitted material parameters of the cell. Material parameters are determined by using high resolution half cell data to fit full cell dQdV curves. Rows of the output dataframe correspond to each of the diagnostics throughout the life of the cell. name...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class IntracellCycles: """Object corresponding to the fitted material parameters of the cell. Material parameters are determined by using high resolution half cell data to fit full cell dQdV curves. Rows of the output dataframe correspond to each of the diagnostics throughout the life of the cell. name (str): predi...
the_stack_v2_python_sparse
beep/features/intracell_losses.py
lewis2222/beep
train
1
c1956712668b79cbb93841e0527c3210a2a2c1a2
[ "self.backup_file_path = backup_file_path\nself.excluded_file_paths = excluded_file_paths\nself.skip_nested_volumes = skip_nested_volumes", "if dictionary is None:\n return None\nbackup_file_path = dictionary.get('backupFilePath')\nexcluded_file_paths = dictionary.get('excludedFilePaths')\nskip_nested_volumes ...
<|body_start_0|> self.backup_file_path = backup_file_path self.excluded_file_paths = excluded_file_paths self.skip_nested_volumes = skip_nested_volumes <|end_body_0|> <|body_start_1|> if dictionary is None: return None backup_file_path = dictionary.get('backupFilePat...
Implementation of the 'FilePathParameters' model. Specifies a file or a directory to protect in a Physical Server. If a directory is specified, all of its descendants are also backed up. Optionally, files or subdirectories can be explicitly excluded. Attributes: backup_file_path (string): Specifies absolute path to a f...
FilePathParameters
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FilePathParameters: """Implementation of the 'FilePathParameters' model. Specifies a file or a directory to protect in a Physical Server. If a directory is specified, all of its descendants are also backed up. Optionally, files or subdirectories can be explicitly excluded. Attributes: backup_file...
stack_v2_sparse_classes_10k_train_008687
2,594
permissive
[ { "docstring": "Constructor for the FilePathParameters class", "name": "__init__", "signature": "def __init__(self, backup_file_path=None, excluded_file_paths=None, skip_nested_volumes=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A ...
2
stack_v2_sparse_classes_30k_train_000732
Implement the Python class `FilePathParameters` described below. Class description: Implementation of the 'FilePathParameters' model. Specifies a file or a directory to protect in a Physical Server. If a directory is specified, all of its descendants are also backed up. Optionally, files or subdirectories can be expli...
Implement the Python class `FilePathParameters` described below. Class description: Implementation of the 'FilePathParameters' model. Specifies a file or a directory to protect in a Physical Server. If a directory is specified, all of its descendants are also backed up. Optionally, files or subdirectories can be expli...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class FilePathParameters: """Implementation of the 'FilePathParameters' model. Specifies a file or a directory to protect in a Physical Server. If a directory is specified, all of its descendants are also backed up. Optionally, files or subdirectories can be explicitly excluded. Attributes: backup_file...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FilePathParameters: """Implementation of the 'FilePathParameters' model. Specifies a file or a directory to protect in a Physical Server. If a directory is specified, all of its descendants are also backed up. Optionally, files or subdirectories can be explicitly excluded. Attributes: backup_file_path (string...
the_stack_v2_python_sparse
cohesity_management_sdk/models/file_path_parameters.py
cohesity/management-sdk-python
train
24
e0af6dfbdec7a38410a949cd965e439bd94e672e
[ "self.logger = Logger('Simulation')\nself.model = model\nself.x0 = model.state0\nself.finished = False\nself.controller = controller", "self.fps = 30\nself.tf = tf\nself.t = np.linspace(0.0, self.tf, self.tf * self.fps)\n\ndef dxdt(x, t):\n return self.model.rhs(x, t, self.controller.controller(x, t, self.x0),...
<|body_start_0|> self.logger = Logger('Simulation') self.model = model self.x0 = model.state0 self.finished = False self.controller = controller <|end_body_0|> <|body_start_1|> self.fps = 30 self.tf = tf self.t = np.linspace(0.0, self.tf, self.tf * self.f...
This class accepts a ArmModel and a Controller class that must define a function control(x, t, x0) and performs a numerical integration.
Simulation
[ "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Simulation: """This class accepts a ArmModel and a Controller class that must define a function control(x, t, x0) and performs a numerical integration.""" def __init__(self, model, controller): """Constructor. Parameters ---------- model: a reference to ToyModel controller: a referen...
stack_v2_sparse_classes_10k_train_008688
9,732
permissive
[ { "docstring": "Constructor. Parameters ---------- model: a reference to ToyModel controller: a reference to a tracking controller (forcing)", "name": "__init__", "signature": "def __init__(self, model, controller)" }, { "docstring": "Numerical integration of the model for the given initial stat...
3
stack_v2_sparse_classes_30k_train_004919
Implement the Python class `Simulation` described below. Class description: This class accepts a ArmModel and a Controller class that must define a function control(x, t, x0) and performs a numerical integration. Method signatures and docstrings: - def __init__(self, model, controller): Constructor. Parameters ------...
Implement the Python class `Simulation` described below. Class description: This class accepts a ArmModel and a Controller class that must define a function control(x, t, x0) and performs a numerical integration. Method signatures and docstrings: - def __init__(self, model, controller): Constructor. Parameters ------...
331ae7ab01e768c6a8c20ec8090464eeef547eea
<|skeleton|> class Simulation: """This class accepts a ArmModel and a Controller class that must define a function control(x, t, x0) and performs a numerical integration.""" def __init__(self, model, controller): """Constructor. Parameters ---------- model: a reference to ToyModel controller: a referen...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Simulation: """This class accepts a ArmModel and a Controller class that must define a function control(x, t, x0) and performs a numerical integration.""" def __init__(self, model, controller): """Constructor. Parameters ---------- model: a reference to ToyModel controller: a reference to a track...
the_stack_v2_python_sparse
arm_model/simulation.py
mitkof6/musculoskeletal-redundancy
train
7
ed46b5406f59f324d2bbeb561840472b956066c8
[ "transform_or_spec = self._specs.get('transform_or_spec', self.transform_or_spec)\nif hasattr(transform_or_spec, '_batch'):\n transform_or_spec = transform_or_spec._batch(batch_size)\nreturn _DeferredTensorSpec(self._get_batched_input_spec(batch_size), transform_or_spec=transform_or_spec, dtype=self.dtype, shape...
<|body_start_0|> transform_or_spec = self._specs.get('transform_or_spec', self.transform_or_spec) if hasattr(transform_or_spec, '_batch'): transform_or_spec = transform_or_spec._batch(batch_size) return _DeferredTensorSpec(self._get_batched_input_spec(batch_size), transform_or_spec=t...
`tf.TypeSpec` for `tfp.util.DeferredTensor`.
_DeferredTensorBatchableSpec
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _DeferredTensorBatchableSpec: """`tf.TypeSpec` for `tfp.util.DeferredTensor`.""" def _batch(self, batch_size): """Returns a TypeSpec representing a batch of DeferredTensors.""" <|body_0|> def _unbatch(self): """Returns a TypeSpec representing a single DeferredTen...
stack_v2_sparse_classes_10k_train_008689
37,367
permissive
[ { "docstring": "Returns a TypeSpec representing a batch of DeferredTensors.", "name": "_batch", "signature": "def _batch(self, batch_size)" }, { "docstring": "Returns a TypeSpec representing a single DeferredTensor.", "name": "_unbatch", "signature": "def _unbatch(self)" } ]
2
stack_v2_sparse_classes_30k_train_001100
Implement the Python class `_DeferredTensorBatchableSpec` described below. Class description: `tf.TypeSpec` for `tfp.util.DeferredTensor`. Method signatures and docstrings: - def _batch(self, batch_size): Returns a TypeSpec representing a batch of DeferredTensors. - def _unbatch(self): Returns a TypeSpec representing...
Implement the Python class `_DeferredTensorBatchableSpec` described below. Class description: `tf.TypeSpec` for `tfp.util.DeferredTensor`. Method signatures and docstrings: - def _batch(self, batch_size): Returns a TypeSpec representing a batch of DeferredTensors. - def _unbatch(self): Returns a TypeSpec representing...
42a64ba0d9e0973b1707fcd9b8bd8d14b2d4e3e5
<|skeleton|> class _DeferredTensorBatchableSpec: """`tf.TypeSpec` for `tfp.util.DeferredTensor`.""" def _batch(self, batch_size): """Returns a TypeSpec representing a batch of DeferredTensors.""" <|body_0|> def _unbatch(self): """Returns a TypeSpec representing a single DeferredTen...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class _DeferredTensorBatchableSpec: """`tf.TypeSpec` for `tfp.util.DeferredTensor`.""" def _batch(self, batch_size): """Returns a TypeSpec representing a batch of DeferredTensors.""" transform_or_spec = self._specs.get('transform_or_spec', self.transform_or_spec) if hasattr(transform_or...
the_stack_v2_python_sparse
tensorflow_probability/python/util/deferred_tensor.py
tensorflow/probability
train
4,055
df8801b358a40c0079308ce0a943089d2866a5c5
[ "if self.ufp_event_obj is not None:\n return cast(Event, getattr(obj, self.ufp_event_obj, None))\nreturn None", "if event is None:\n return False\nnow = dt_util.utcnow()\nvalue = now > event.start\nif value and event.end is not None and (now > event.end):\n value = False\nreturn value" ]
<|body_start_0|> if self.ufp_event_obj is not None: return cast(Event, getattr(obj, self.ufp_event_obj, None)) return None <|end_body_0|> <|body_start_1|> if event is None: return False now = dt_util.utcnow() value = now > event.start if value and...
Mixin for events.
ProtectEventMixin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProtectEventMixin: """Mixin for events.""" def get_event_obj(self, obj: T) -> Event | None: """Return value from UniFi Protect device.""" <|body_0|> def get_is_on(self, event: Event | None) -> bool: """Return value if event is active.""" <|body_1|> <|end...
stack_v2_sparse_classes_10k_train_008690
5,372
permissive
[ { "docstring": "Return value from UniFi Protect device.", "name": "get_event_obj", "signature": "def get_event_obj(self, obj: T) -> Event | None" }, { "docstring": "Return value if event is active.", "name": "get_is_on", "signature": "def get_is_on(self, event: Event | None) -> bool" }...
2
stack_v2_sparse_classes_30k_train_005225
Implement the Python class `ProtectEventMixin` described below. Class description: Mixin for events. Method signatures and docstrings: - def get_event_obj(self, obj: T) -> Event | None: Return value from UniFi Protect device. - def get_is_on(self, event: Event | None) -> bool: Return value if event is active.
Implement the Python class `ProtectEventMixin` described below. Class description: Mixin for events. Method signatures and docstrings: - def get_event_obj(self, obj: T) -> Event | None: Return value from UniFi Protect device. - def get_is_on(self, event: Event | None) -> bool: Return value if event is active. <|skel...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class ProtectEventMixin: """Mixin for events.""" def get_event_obj(self, obj: T) -> Event | None: """Return value from UniFi Protect device.""" <|body_0|> def get_is_on(self, event: Event | None) -> bool: """Return value if event is active.""" <|body_1|> <|end...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ProtectEventMixin: """Mixin for events.""" def get_event_obj(self, obj: T) -> Event | None: """Return value from UniFi Protect device.""" if self.ufp_event_obj is not None: return cast(Event, getattr(obj, self.ufp_event_obj, None)) return None def get_is_on(self, ...
the_stack_v2_python_sparse
homeassistant/components/unifiprotect/models.py
home-assistant/core
train
35,501
9f2933577bc4bf8b56ca6dc685e847be039c2b31
[ "print('decrypt')\nwith open(key_file, 'r') as kf:\n rsa = RSA.importKey(kf.read(), passphrase=passphrase)\n with open(encrypted_file, 'rb') as df:\n data = rsa.decrypt(df.read())\n print('data:\\n')\n print(data)\n print('hex:')\n print(data.encode('hex'))\n with ope...
<|body_start_0|> print('decrypt') with open(key_file, 'r') as kf: rsa = RSA.importKey(kf.read(), passphrase=passphrase) with open(encrypted_file, 'rb') as df: data = rsa.decrypt(df.read()) print('data:\n') print(data) ...
RSAHelper
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RSAHelper: def decrypt(cls, encrypted_file, key_file, out_file='output_dec', passphrase=''): """解密 :param out_file: :param encrypted_file: :param key_file: :param passphrase: :return:""" <|body_0|> def encrypt(cls, raw_file, key_file, out_file='output_enc', passphrase=''): ...
stack_v2_sparse_classes_10k_train_008691
1,843
permissive
[ { "docstring": "解密 :param out_file: :param encrypted_file: :param key_file: :param passphrase: :return:", "name": "decrypt", "signature": "def decrypt(cls, encrypted_file, key_file, out_file='output_dec', passphrase='')" }, { "docstring": "加密 :param out_file: :param raw_file: :param key_file: :p...
2
stack_v2_sparse_classes_30k_val_000038
Implement the Python class `RSAHelper` described below. Class description: Implement the RSAHelper class. Method signatures and docstrings: - def decrypt(cls, encrypted_file, key_file, out_file='output_dec', passphrase=''): 解密 :param out_file: :param encrypted_file: :param key_file: :param passphrase: :return: - def ...
Implement the Python class `RSAHelper` described below. Class description: Implement the RSAHelper class. Method signatures and docstrings: - def decrypt(cls, encrypted_file, key_file, out_file='output_dec', passphrase=''): 解密 :param out_file: :param encrypted_file: :param key_file: :param passphrase: :return: - def ...
30bbfd8bb97cda2b4762156aaf2973296f0e7cde
<|skeleton|> class RSAHelper: def decrypt(cls, encrypted_file, key_file, out_file='output_dec', passphrase=''): """解密 :param out_file: :param encrypted_file: :param key_file: :param passphrase: :return:""" <|body_0|> def encrypt(cls, raw_file, key_file, out_file='output_enc', passphrase=''): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RSAHelper: def decrypt(cls, encrypted_file, key_file, out_file='output_dec', passphrase=''): """解密 :param out_file: :param encrypted_file: :param key_file: :param passphrase: :return:""" print('decrypt') with open(key_file, 'r') as kf: rsa = RSA.importKey(kf.read(), passphr...
the_stack_v2_python_sparse
crypto/rsa/rsa_helper.py
restran/hacker-scripts
train
31
73e477ed7b980d5707c1f21b4e08c4bf66ac31a8
[ "super(Application, self).__init__(master)\nself.grid()\nself.create_widgets()", "Label(self, text='Charecter creation params:').grid(row=0, column=0, columnspan=2, sticky=W)\nLabel(self, text='Name: ').grid(row=1, column=0, sticky=W)\nself.person_ent = Entry(self)\nself.person_ent.grid(row=1, column=1, sticky=W)...
<|body_start_0|> super(Application, self).__init__(master) self.grid() self.create_widgets() <|end_body_0|> <|body_start_1|> Label(self, text='Charecter creation params:').grid(row=0, column=0, columnspan=2, sticky=W) Label(self, text='Name: ').grid(row=1, column=0, sticky=W) ...
GUI app that generates a story based on user inputs
Application
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Application: """GUI app that generates a story based on user inputs""" def __init__(self, master): """Frame initiation""" <|body_0|> def create_widgets(self): """generates controls""" <|body_1|> def tell_story(self): """put generated story in...
stack_v2_sparse_classes_10k_train_008692
4,235
no_license
[ { "docstring": "Frame initiation", "name": "__init__", "signature": "def __init__(self, master)" }, { "docstring": "generates controls", "name": "create_widgets", "signature": "def create_widgets(self)" }, { "docstring": "put generated story into text area", "name": "tell_sto...
3
null
Implement the Python class `Application` described below. Class description: GUI app that generates a story based on user inputs Method signatures and docstrings: - def __init__(self, master): Frame initiation - def create_widgets(self): generates controls - def tell_story(self): put generated story into text area
Implement the Python class `Application` described below. Class description: GUI app that generates a story based on user inputs Method signatures and docstrings: - def __init__(self, master): Frame initiation - def create_widgets(self): generates controls - def tell_story(self): put generated story into text area <...
19343c985f368770dc01ce415506506d62a23285
<|skeleton|> class Application: """GUI app that generates a story based on user inputs""" def __init__(self, master): """Frame initiation""" <|body_0|> def create_widgets(self): """generates controls""" <|body_1|> def tell_story(self): """put generated story in...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Application: """GUI app that generates a story based on user inputs""" def __init__(self, master): """Frame initiation""" super(Application, self).__init__(master) self.grid() self.create_widgets() def create_widgets(self): """generates controls""" Lab...
the_stack_v2_python_sparse
gui/mad_lib.py
gofr1/python-learning
train
0
c328caa15112491d0a840bb65454bd4812540486
[ "super(BasePlusNameSubEnt, self).__init__(config, vocab)\nself.name_model = NameModel(config, vocab)\nself.dim = self.name_model.dim + self.dim\nself.init_e_model()", "fv = []\nfv.extend(self.name_model.emb(entity))\nfv.extend(super().emb(entity))\nreturn fv" ]
<|body_start_0|> super(BasePlusNameSubEnt, self).__init__(config, vocab) self.name_model = NameModel(config, vocab) self.dim = self.name_model.dim + self.dim self.init_e_model() <|end_body_0|> <|body_start_1|> fv = [] fv.extend(self.name_model.emb(entity)) fv.ext...
BasePlusNameSubEnt
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BasePlusNameSubEnt: def __init__(self, config, vocab): """A Sub Entity model.""" <|body_0|> def emb(self, entity): """Get all features of entity.""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(BasePlusNameSubEnt, self).__init__(config, vocab)...
stack_v2_sparse_classes_10k_train_008693
1,518
permissive
[ { "docstring": "A Sub Entity model.", "name": "__init__", "signature": "def __init__(self, config, vocab)" }, { "docstring": "Get all features of entity.", "name": "emb", "signature": "def emb(self, entity)" } ]
2
stack_v2_sparse_classes_30k_train_001599
Implement the Python class `BasePlusNameSubEnt` described below. Class description: Implement the BasePlusNameSubEnt class. Method signatures and docstrings: - def __init__(self, config, vocab): A Sub Entity model. - def emb(self, entity): Get all features of entity.
Implement the Python class `BasePlusNameSubEnt` described below. Class description: Implement the BasePlusNameSubEnt class. Method signatures and docstrings: - def __init__(self, config, vocab): A Sub Entity model. - def emb(self, entity): Get all features of entity. <|skeleton|> class BasePlusNameSubEnt: def _...
542659170897ad05f7612639cb918886859ae9d6
<|skeleton|> class BasePlusNameSubEnt: def __init__(self, config, vocab): """A Sub Entity model.""" <|body_0|> def emb(self, entity): """Get all features of entity.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BasePlusNameSubEnt: def __init__(self, config, vocab): """A Sub Entity model.""" super(BasePlusNameSubEnt, self).__init__(config, vocab) self.name_model = NameModel(config, vocab) self.dim = self.name_model.dim + self.dim self.init_e_model() def emb(self, entity): ...
the_stack_v2_python_sparse
src/python/coref/models/entity/BasePlusNameSubEnt.py
nmonath/coref_tools
train
0
8e73fe7b8dd0aceaaa4c0739085c488d2649a286
[ "new_car = Car(name=validated_data.get('name'), url=validated_data.get('url'), car_type=validated_data.get('car_type'))\nnew_car.save()\nreturn new_car", "instance.name = validated_data.get('name', instance.name)\ninstance.url = validated_data.get('url', instance.url)\ninstance.car_type = validated_data.get('car_...
<|body_start_0|> new_car = Car(name=validated_data.get('name'), url=validated_data.get('url'), car_type=validated_data.get('car_type')) new_car.save() return new_car <|end_body_0|> <|body_start_1|> instance.name = validated_data.get('name', instance.name) instance.url = validate...
CarSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CarSerializer: def create(self, validated_data): """create and return new 'Car' instance""" <|body_0|> def update(self, instance, validated_data): """Update and return an existing `Car` instance""" <|body_1|> <|end_skeleton|> <|body_start_0|> new_ca...
stack_v2_sparse_classes_10k_train_008694
6,342
no_license
[ { "docstring": "create and return new 'Car' instance", "name": "create", "signature": "def create(self, validated_data)" }, { "docstring": "Update and return an existing `Car` instance", "name": "update", "signature": "def update(self, instance, validated_data)" } ]
2
stack_v2_sparse_classes_30k_test_000017
Implement the Python class `CarSerializer` described below. Class description: Implement the CarSerializer class. Method signatures and docstrings: - def create(self, validated_data): create and return new 'Car' instance - def update(self, instance, validated_data): Update and return an existing `Car` instance
Implement the Python class `CarSerializer` described below. Class description: Implement the CarSerializer class. Method signatures and docstrings: - def create(self, validated_data): create and return new 'Car' instance - def update(self, instance, validated_data): Update and return an existing `Car` instance <|ske...
dba8d1fdb96889e41328e792816a4968cbeb1ed4
<|skeleton|> class CarSerializer: def create(self, validated_data): """create and return new 'Car' instance""" <|body_0|> def update(self, instance, validated_data): """Update and return an existing `Car` instance""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CarSerializer: def create(self, validated_data): """create and return new 'Car' instance""" new_car = Car(name=validated_data.get('name'), url=validated_data.get('url'), car_type=validated_data.get('car_type')) new_car.save() return new_car def update(self, instance, valid...
the_stack_v2_python_sparse
cars_web/cars_app/serializers.py
Ignisor/cars_scrapper
train
0
c8dedbc240007f0f1b271698e2a85448f1f93533
[ "candidate = math.gcd(len(str1), len(str2))\nif str1 + str2 != str2 + str1:\n return ''\nreturn str1[:candidate]", "candidate = math.gcd(len(str1), len(str2))\nif len(str1) // candidate * str1[:candidate] == str1 and len(str2) // candidate * str1[:candidate] == str2:\n return str1[:candidate]\nreturn ''" ]
<|body_start_0|> candidate = math.gcd(len(str1), len(str2)) if str1 + str2 != str2 + str1: return '' return str1[:candidate] <|end_body_0|> <|body_start_1|> candidate = math.gcd(len(str1), len(str2)) if len(str1) // candidate * str1[:candidate] == str1 and len(str2) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def gcdOfStrings(self, str1: str, str2: str) -> str: """执行用时 :40 ms, 在所有 Python3 提交中击败了44.21%的用户 内存消耗 :13.5 MB, 在所有 Python3 提交中击败了7.48%的用户 数学法: 1、先计算出两个字符串最大公因子长度 2、如果两个字符串存在最大公因子T,str1=m*T,str2=n*T.必定满足str1 + str2 == str2 + str1 :param str1: :param str2: :return:""" <|...
stack_v2_sparse_classes_10k_train_008695
2,028
no_license
[ { "docstring": "执行用时 :40 ms, 在所有 Python3 提交中击败了44.21%的用户 内存消耗 :13.5 MB, 在所有 Python3 提交中击败了7.48%的用户 数学法: 1、先计算出两个字符串最大公因子长度 2、如果两个字符串存在最大公因子T,str1=m*T,str2=n*T.必定满足str1 + str2 == str2 + str1 :param str1: :param str2: :return:", "name": "gcdOfStrings", "signature": "def gcdOfStrings(self, str1: str, str2:...
2
stack_v2_sparse_classes_30k_train_005706
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def gcdOfStrings(self, str1: str, str2: str) -> str: 执行用时 :40 ms, 在所有 Python3 提交中击败了44.21%的用户 内存消耗 :13.5 MB, 在所有 Python3 提交中击败了7.48%的用户 数学法: 1、先计算出两个字符串最大公因子长度 2、如果两个字符串存在最大公因子T,...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def gcdOfStrings(self, str1: str, str2: str) -> str: 执行用时 :40 ms, 在所有 Python3 提交中击败了44.21%的用户 内存消耗 :13.5 MB, 在所有 Python3 提交中击败了7.48%的用户 数学法: 1、先计算出两个字符串最大公因子长度 2、如果两个字符串存在最大公因子T,...
e43ee86c5a8cdb808da09b4b6138e10275abadb5
<|skeleton|> class Solution: def gcdOfStrings(self, str1: str, str2: str) -> str: """执行用时 :40 ms, 在所有 Python3 提交中击败了44.21%的用户 内存消耗 :13.5 MB, 在所有 Python3 提交中击败了7.48%的用户 数学法: 1、先计算出两个字符串最大公因子长度 2、如果两个字符串存在最大公因子T,str1=m*T,str2=n*T.必定满足str1 + str2 == str2 + str1 :param str1: :param str2: :return:""" <|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def gcdOfStrings(self, str1: str, str2: str) -> str: """执行用时 :40 ms, 在所有 Python3 提交中击败了44.21%的用户 内存消耗 :13.5 MB, 在所有 Python3 提交中击败了7.48%的用户 数学法: 1、先计算出两个字符串最大公因子长度 2、如果两个字符串存在最大公因子T,str1=m*T,str2=n*T.必定满足str1 + str2 == str2 + str1 :param str1: :param str2: :return:""" candidate = math...
the_stack_v2_python_sparse
LeetCode/1071. Greatest Common Divisor of Strings.py
yiming1012/MyLeetCode
train
2
e883bfdb1f4a15131c819b93e74b2c85909a434f
[ "if not matrix:\n return 0\nn = len(matrix)\nm = len(matrix[0])\ndp = [[0 for _ in xrange(m)] for _ in xrange(n)]\nmax_length = 0\nfor i in xrange(n):\n for j in xrange(m):\n if i == 0 or j == 0:\n dp[i][j] = int(matrix[i][j])\n elif matrix[i][j] == '1':\n dp[i][j] = min(dp...
<|body_start_0|> if not matrix: return 0 n = len(matrix) m = len(matrix[0]) dp = [[0 for _ in xrange(m)] for _ in xrange(n)] max_length = 0 for i in xrange(n): for j in xrange(m): if i == 0 or j == 0: dp[i][j] = ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maximalSquare(self, matrix): """DP solution.""" <|body_0|> def maximalSquareNCubic(self, matrix): """:type matrix: List[List[str]] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not matrix: return 0 ...
stack_v2_sparse_classes_10k_train_008696
2,983
no_license
[ { "docstring": "DP solution.", "name": "maximalSquare", "signature": "def maximalSquare(self, matrix)" }, { "docstring": ":type matrix: List[List[str]] :rtype: int", "name": "maximalSquareNCubic", "signature": "def maximalSquareNCubic(self, matrix)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maximalSquare(self, matrix): DP solution. - def maximalSquareNCubic(self, matrix): :type matrix: List[List[str]] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maximalSquare(self, matrix): DP solution. - def maximalSquareNCubic(self, matrix): :type matrix: List[List[str]] :rtype: int <|skeleton|> class Solution: def maximalSqu...
33c623f226981942780751554f0593f2c71cf458
<|skeleton|> class Solution: def maximalSquare(self, matrix): """DP solution.""" <|body_0|> def maximalSquareNCubic(self, matrix): """:type matrix: List[List[str]] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maximalSquare(self, matrix): """DP solution.""" if not matrix: return 0 n = len(matrix) m = len(matrix[0]) dp = [[0 for _ in xrange(m)] for _ in xrange(n)] max_length = 0 for i in xrange(n): for j in xrange(m): ...
the_stack_v2_python_sparse
dynamic_programming/leetcode_Maximum_Square.py
monkeylyf/interviewjam
train
59
a0375a14808ca2ec406e1aacfc95c2b68d9e19d8
[ "self.seed = 33\nreset(self.seed)\nself.testing = testing\nself.layer = layer\nself.case = case\nself.model_dtype = self.testing.get('model_dtype')\npaddle.set_default_dtype(self.model_dtype)\nself.layer_name = self.layer.get('Layer').get('layer_name')\nself.layer_param = self.layer.get('Layer').get('params')\nself...
<|body_start_0|> self.seed = 33 reset(self.seed) self.testing = testing self.layer = layer self.case = case self.model_dtype = self.testing.get('model_dtype') paddle.set_default_dtype(self.model_dtype) self.layer_name = self.layer.get('Layer').get('layer_n...
构建Layer训练的通用类
LayerTrain
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LayerTrain: """构建Layer训练的通用类""" def __init__(self, testing, case, layer): """初始化""" <|body_0|> def dy_train(self): """dygraph train""" <|body_1|> def dy_train_dl(self): """dygraph train with dataloader""" <|body_2|> def dy2st_tra...
stack_v2_sparse_classes_10k_train_008697
6,570
no_license
[ { "docstring": "初始化", "name": "__init__", "signature": "def __init__(self, testing, case, layer)" }, { "docstring": "dygraph train", "name": "dy_train", "signature": "def dy_train(self)" }, { "docstring": "dygraph train with dataloader", "name": "dy_train_dl", "signature"...
6
null
Implement the Python class `LayerTrain` described below. Class description: 构建Layer训练的通用类 Method signatures and docstrings: - def __init__(self, testing, case, layer): 初始化 - def dy_train(self): dygraph train - def dy_train_dl(self): dygraph train with dataloader - def dy2st_train(self): dy2st train - def dy2st_train_...
Implement the Python class `LayerTrain` described below. Class description: 构建Layer训练的通用类 Method signatures and docstrings: - def __init__(self, testing, case, layer): 初始化 - def dy_train(self): dygraph train - def dy_train_dl(self): dygraph train with dataloader - def dy2st_train(self): dy2st train - def dy2st_train_...
bd3790ce72a2a26611b5eda3901651b5a809348f
<|skeleton|> class LayerTrain: """构建Layer训练的通用类""" def __init__(self, testing, case, layer): """初始化""" <|body_0|> def dy_train(self): """dygraph train""" <|body_1|> def dy_train_dl(self): """dygraph train with dataloader""" <|body_2|> def dy2st_tra...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LayerTrain: """构建Layer训练的通用类""" def __init__(self, testing, case, layer): """初始化""" self.seed = 33 reset(self.seed) self.testing = testing self.layer = layer self.case = case self.model_dtype = self.testing.get('model_dtype') paddle.set_defa...
the_stack_v2_python_sparse
framework/e2e/paddleLT/engine/train.py
PaddlePaddle/PaddleTest
train
42
a27d12c4a81e6ba65fd390657ca38f2b7ee02065
[ "url = '/api/options/?list=org_structure'\nresponse = self.client.get(url)\nself.assertEqual(response.status_code, 200)\nself.assertContains(response, self.div1.name)\nr = response.json()\nself.assertTrue(isinstance(r, dict))\nself.assertTrue(isinstance(r['objects'], list))\nself.branch1.active = False\nself.branch...
<|body_start_0|> url = '/api/options/?list=org_structure' response = self.client.get(url) self.assertEqual(response.status_code, 200) self.assertContains(response, self.div1.name) r = response.json() self.assertTrue(isinstance(r, dict)) self.assertTrue(isinstance(...
OptionResourceTestCase
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OptionResourceTestCase: def test_data_org_structure(self): """Test the data_org_structure API endpoint""" <|body_0|> def test_data_cost_centre(self): """Test the data_cost_centre API endpoint""" <|body_1|> def test_data_org_unit(self): """Test th...
stack_v2_sparse_classes_10k_train_008698
18,653
permissive
[ { "docstring": "Test the data_org_structure API endpoint", "name": "test_data_org_structure", "signature": "def test_data_org_structure(self)" }, { "docstring": "Test the data_cost_centre API endpoint", "name": "test_data_cost_centre", "signature": "def test_data_cost_centre(self)" }, ...
4
stack_v2_sparse_classes_30k_train_003389
Implement the Python class `OptionResourceTestCase` described below. Class description: Implement the OptionResourceTestCase class. Method signatures and docstrings: - def test_data_org_structure(self): Test the data_org_structure API endpoint - def test_data_cost_centre(self): Test the data_cost_centre API endpoint ...
Implement the Python class `OptionResourceTestCase` described below. Class description: Implement the OptionResourceTestCase class. Method signatures and docstrings: - def test_data_org_structure(self): Test the data_org_structure API endpoint - def test_data_cost_centre(self): Test the data_cost_centre API endpoint ...
4d5caceba69cac7f59b63745a0f52322004df2eb
<|skeleton|> class OptionResourceTestCase: def test_data_org_structure(self): """Test the data_org_structure API endpoint""" <|body_0|> def test_data_cost_centre(self): """Test the data_cost_centre API endpoint""" <|body_1|> def test_data_org_unit(self): """Test th...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class OptionResourceTestCase: def test_data_org_structure(self): """Test the data_org_structure API endpoint""" url = '/api/options/?list=org_structure' response = self.client.get(url) self.assertEqual(response.status_code, 200) self.assertContains(response, self.div1.name) ...
the_stack_v2_python_sparse
organisation/test_api.py
bryceprince0/it-assets
train
0
942714f4b8023e452e056b7ea12d72b2d5563c29
[ "super(ResNetEmbeddings, self).__init__()\nself.drop_prob = drop_prob\nresnet = models.resnet152(pretrained=True)\nmodules = list(resnet.children())[:-1]\nself.resnet = nn.Sequential(*modules)\nself.fc1 = nn.Linear(resnet.fc.in_features, fc1_size)\nself.bn1 = nn.BatchNorm1d(fc1_size, momentum=momentum)\nself.fc2 = ...
<|body_start_0|> super(ResNetEmbeddings, self).__init__() self.drop_prob = drop_prob resnet = models.resnet152(pretrained=True) modules = list(resnet.children())[:-1] self.resnet = nn.Sequential(*modules) self.fc1 = nn.Linear(resnet.fc.in_features, fc1_size) self....
ResNetEmbeddings
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResNetEmbeddings: def __init__(self, embed_size, fc1_size=512, fc2_size=512, drop_prob=0.2, momentum=0.1): """Still making adjustments""" <|body_0|> def forward(self, x): """Inputs: x - (batch_size, sequence_length, D, H, W): Input sequence of images""" <|bod...
stack_v2_sparse_classes_10k_train_008699
13,489
no_license
[ { "docstring": "Still making adjustments", "name": "__init__", "signature": "def __init__(self, embed_size, fc1_size=512, fc2_size=512, drop_prob=0.2, momentum=0.1)" }, { "docstring": "Inputs: x - (batch_size, sequence_length, D, H, W): Input sequence of images", "name": "forward", "sign...
2
null
Implement the Python class `ResNetEmbeddings` described below. Class description: Implement the ResNetEmbeddings class. Method signatures and docstrings: - def __init__(self, embed_size, fc1_size=512, fc2_size=512, drop_prob=0.2, momentum=0.1): Still making adjustments - def forward(self, x): Inputs: x - (batch_size,...
Implement the Python class `ResNetEmbeddings` described below. Class description: Implement the ResNetEmbeddings class. Method signatures and docstrings: - def __init__(self, embed_size, fc1_size=512, fc2_size=512, drop_prob=0.2, momentum=0.1): Still making adjustments - def forward(self, x): Inputs: x - (batch_size,...
ad713e4eb15a2d9573622bace528fc86e19a6545
<|skeleton|> class ResNetEmbeddings: def __init__(self, embed_size, fc1_size=512, fc2_size=512, drop_prob=0.2, momentum=0.1): """Still making adjustments""" <|body_0|> def forward(self, x): """Inputs: x - (batch_size, sequence_length, D, H, W): Input sequence of images""" <|bod...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ResNetEmbeddings: def __init__(self, embed_size, fc1_size=512, fc2_size=512, drop_prob=0.2, momentum=0.1): """Still making adjustments""" super(ResNetEmbeddings, self).__init__() self.drop_prob = drop_prob resnet = models.resnet152(pretrained=True) modules = list(resnet...
the_stack_v2_python_sparse
manipulation/plating/RNNs/rnns/networks.py
HARPLab/gastronomy
train
6