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
85e097bf77eb7059717f5b98b090a6f8797cb239
[ "if user is None or user.is_active is False:\n raise ValueError('{\"detail\":\"' + str(_('In order to perform this operation, your account must be active')) + '\"}')\nif user.is_staff:\n images = accounts_models.PublicFeed.objects.all()\nelse:\n images = accounts_models.PublicFeed.objects.filter(user_id=us...
<|body_start_0|> if user is None or user.is_active is False: raise ValueError('{"detail":"' + str(_('In order to perform this operation, your account must be active')) + '"}') if user.is_staff: images = accounts_models.PublicFeed.objects.all() else: images = a...
this class contain a crud for the image upload to public feed 420
UploadImagePublicProfileService
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UploadImagePublicProfileService: """this class contain a crud for the image upload to public feed 420""" def list(self, user: accounts_models.User) -> accounts_models.PublicFeed: """Get all images upload to public feed 420. if user is admin o staff the can see all images upload for a...
stack_v2_sparse_classes_10k_train_004900
42,606
no_license
[ { "docstring": "Get all images upload to public feed 420. if user is admin o staff the can see all images upload for any user in weedmtach. :param user: user weedmatch :type user: Model User :return: Model PublicFeed :raise: ValueError", "name": "list", "signature": "def list(self, user: accounts_models...
5
stack_v2_sparse_classes_30k_train_003117
Implement the Python class `UploadImagePublicProfileService` described below. Class description: this class contain a crud for the image upload to public feed 420 Method signatures and docstrings: - def list(self, user: accounts_models.User) -> accounts_models.PublicFeed: Get all images upload to public feed 420. if ...
Implement the Python class `UploadImagePublicProfileService` described below. Class description: this class contain a crud for the image upload to public feed 420 Method signatures and docstrings: - def list(self, user: accounts_models.User) -> accounts_models.PublicFeed: Get all images upload to public feed 420. if ...
497b8724d6e02582f28bc9c5a19f93ec21db84d8
<|skeleton|> class UploadImagePublicProfileService: """this class contain a crud for the image upload to public feed 420""" def list(self, user: accounts_models.User) -> accounts_models.PublicFeed: """Get all images upload to public feed 420. if user is admin o staff the can see all images upload for a...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UploadImagePublicProfileService: """this class contain a crud for the image upload to public feed 420""" def list(self, user: accounts_models.User) -> accounts_models.PublicFeed: """Get all images upload to public feed 420. if user is admin o staff the can see all images upload for any user in we...
the_stack_v2_python_sparse
accounts/services.py
carlos-o/weedmatchheroku
train
0
008acc477c6de384db81166439581d21a3140acd
[ "if not root:\n return '[]'\nres = [root.val]\nq = collections.deque([root])\nwhile q:\n front = q.popleft()\n if front.left:\n q.append(front.left)\n if front.right:\n q.append(front.right)\n res.append(front.left.val if front.left else 'null')\n res.append(front.right.val if front....
<|body_start_0|> if not root: return '[]' res = [root.val] q = collections.deque([root]) while q: front = q.popleft() if front.left: q.append(front.left) if front.right: q.append(front.right) res....
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_10k_train_004901
17,936
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
035ef08434fa1ca781a6fb2f9eed3538b7d20c02
<|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 '[]' res = [root.val] q = collections.deque([root]) while q: front = q.popleft() if front.left: ...
the_stack_v2_python_sparse
leetcode_python/Tree/serialize-and-deserialize-binary-tree.py
yennanliu/CS_basics
train
64
801a861f2d8fab540fb6225be46064eb4f81564a
[ "self.driver.get(detail_url)\nsleep(2)\nself.driver.execute_script('window.scrollTo(0, 1300)')\nreport_title = self.driver.find_element(CarDetail_Locator.REPORT_TITLE).text\ntt_check.assertEqual('检测报告', report_title, '检测报告tab的title,期望是检测报告,实际是%s' % report_title)", "self.driver.get(detail_url)\nsleep(2)\nself.driv...
<|body_start_0|> self.driver.get(detail_url) sleep(2) self.driver.execute_script('window.scrollTo(0, 1300)') report_title = self.driver.find_element(CarDetail_Locator.REPORT_TITLE).text tt_check.assertEqual('检测报告', report_title, '检测报告tab的title,期望是检测报告,实际是%s' % report_title) <|end...
Report
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Report: def test_report_title(self): """测试检测报告title显示的是否正确@author:zhangyanli""" <|body_0|> def test_report_type(self): """测试检测报告各类型显示的是否正确@author:zhangyanli""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.driver.get(detail_url) sleep(2)...
stack_v2_sparse_classes_10k_train_004902
1,735
no_license
[ { "docstring": "测试检测报告title显示的是否正确@author:zhangyanli", "name": "test_report_title", "signature": "def test_report_title(self)" }, { "docstring": "测试检测报告各类型显示的是否正确@author:zhangyanli", "name": "test_report_type", "signature": "def test_report_type(self)" } ]
2
stack_v2_sparse_classes_30k_test_000097
Implement the Python class `Report` described below. Class description: Implement the Report class. Method signatures and docstrings: - def test_report_title(self): 测试检测报告title显示的是否正确@author:zhangyanli - def test_report_type(self): 测试检测报告各类型显示的是否正确@author:zhangyanli
Implement the Python class `Report` described below. Class description: Implement the Report class. Method signatures and docstrings: - def test_report_title(self): 测试检测报告title显示的是否正确@author:zhangyanli - def test_report_type(self): 测试检测报告各类型显示的是否正确@author:zhangyanli <|skeleton|> class Report: def test_report_ti...
a73e4ed1dc02f05e93f11788591efe68109fd277
<|skeleton|> class Report: def test_report_title(self): """测试检测报告title显示的是否正确@author:zhangyanli""" <|body_0|> def test_report_type(self): """测试检测报告各类型显示的是否正确@author:zhangyanli""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Report: def test_report_title(self): """测试检测报告title显示的是否正确@author:zhangyanli""" self.driver.get(detail_url) sleep(2) self.driver.execute_script('window.scrollTo(0, 1300)') report_title = self.driver.find_element(CarDetail_Locator.REPORT_TITLE).text tt_check.asse...
the_stack_v2_python_sparse
taocheM/test_detail/test_carreport.py
zhangyanli616/TaoCheAuto
train
0
980de806b394bb46849606d7e27fdf360354e87e
[ "super().setUpTestData()\ncompanies = [Company(name=f'Company {idx}', description='Some company') for idx in range(3)]\nCompany.objects.bulk_create(companies)\ncontacts = []\nfor cmp in Company.objects.all():\n contacts += [Contact(company=cmp, name=f'My name {idx}') for idx in range(3)]\nContact.objects.bulk_cr...
<|body_start_0|> super().setUpTestData() companies = [Company(name=f'Company {idx}', description='Some company') for idx in range(3)] Company.objects.bulk_create(companies) contacts = [] for cmp in Company.objects.all(): contacts += [Contact(company=cmp, name=f'My nam...
Tests for the Contact models
ContactTest
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ContactTest: """Tests for the Contact models""" def setUpTestData(cls): """Perform init for this test class""" <|body_0|> def test_list(self): """Test company list API endpoint""" <|body_1|> def test_create(self): """Test that we can create a...
stack_v2_sparse_classes_10k_train_004903
19,439
permissive
[ { "docstring": "Perform init for this test class", "name": "setUpTestData", "signature": "def setUpTestData(cls)" }, { "docstring": "Test company list API endpoint", "name": "test_list", "signature": "def test_list(self)" }, { "docstring": "Test that we can create a new Contact o...
5
stack_v2_sparse_classes_30k_train_001309
Implement the Python class `ContactTest` described below. Class description: Tests for the Contact models Method signatures and docstrings: - def setUpTestData(cls): Perform init for this test class - def test_list(self): Test company list API endpoint - def test_create(self): Test that we can create a new Contact ob...
Implement the Python class `ContactTest` described below. Class description: Tests for the Contact models Method signatures and docstrings: - def setUpTestData(cls): Perform init for this test class - def test_list(self): Test company list API endpoint - def test_create(self): Test that we can create a new Contact ob...
e88a8e99a5f0b201c67a95cba097c729f090d5e2
<|skeleton|> class ContactTest: """Tests for the Contact models""" def setUpTestData(cls): """Perform init for this test class""" <|body_0|> def test_list(self): """Test company list API endpoint""" <|body_1|> def test_create(self): """Test that we can create a...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ContactTest: """Tests for the Contact models""" def setUpTestData(cls): """Perform init for this test class""" super().setUpTestData() companies = [Company(name=f'Company {idx}', description='Some company') for idx in range(3)] Company.objects.bulk_create(companies) ...
the_stack_v2_python_sparse
InvenTree/company/test_api.py
inventree/InvenTree
train
3,077
f8bb3e91da6541b197aad0efae6ec0c9126fb60f
[ "self.pr_state = pr_state\nself._default_min = 0.8 * self.pr_state.d_max\nself._default_max = 1.2 * self.pr_state.d_max", "if dmin is None:\n dmin = self._default_min\nif dmax is None:\n dmax = self._default_max\nresults = Results()\nfor i in range(npts):\n d = dmin + i * (dmax - dmin) / (npts - 1.0)\n ...
<|body_start_0|> self.pr_state = pr_state self._default_min = 0.8 * self.pr_state.d_max self._default_max = 1.2 * self.pr_state.d_max <|end_body_0|> <|body_start_1|> if dmin is None: dmin = self._default_min if dmax is None: dmax = self._default_max ...
The explorer class
DistExplorer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DistExplorer: """The explorer class""" def __init__(self, pr_state): """Initialization. :param pr_state: sas.sascalc.pr.invertor.Invertor object""" <|body_0|> def __call__(self, dmin=None, dmax=None, npts=10): """Compute the outputs as a function of D_max. :param...
stack_v2_sparse_classes_10k_train_004904
3,307
permissive
[ { "docstring": "Initialization. :param pr_state: sas.sascalc.pr.invertor.Invertor object", "name": "__init__", "signature": "def __init__(self, pr_state)" }, { "docstring": "Compute the outputs as a function of D_max. :param dmin: minimum value for D_max :param dmax: maximum value for D_max :par...
2
stack_v2_sparse_classes_30k_train_007108
Implement the Python class `DistExplorer` described below. Class description: The explorer class Method signatures and docstrings: - def __init__(self, pr_state): Initialization. :param pr_state: sas.sascalc.pr.invertor.Invertor object - def __call__(self, dmin=None, dmax=None, npts=10): Compute the outputs as a func...
Implement the Python class `DistExplorer` described below. Class description: The explorer class Method signatures and docstrings: - def __init__(self, pr_state): Initialization. :param pr_state: sas.sascalc.pr.invertor.Invertor object - def __call__(self, dmin=None, dmax=None, npts=10): Compute the outputs as a func...
55b1e9f6db58e33729f2a93b7dd1d8bf255b46f7
<|skeleton|> class DistExplorer: """The explorer class""" def __init__(self, pr_state): """Initialization. :param pr_state: sas.sascalc.pr.invertor.Invertor object""" <|body_0|> def __call__(self, dmin=None, dmax=None, npts=10): """Compute the outputs as a function of D_max. :param...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DistExplorer: """The explorer class""" def __init__(self, pr_state): """Initialization. :param pr_state: sas.sascalc.pr.invertor.Invertor object""" self.pr_state = pr_state self._default_min = 0.8 * self.pr_state.d_max self._default_max = 1.2 * self.pr_state.d_max def...
the_stack_v2_python_sparse
src/sas/sascalc/pr/distance_explorer.py
SasView/sasview
train
48
e2837251d0e687836465e0cb1a86cf825cfccb92
[ "date_time_string = self._FormatDateTime(output_mediator, event, event_data, event_data_stream)\ntimestamp_description = event.timestamp_desc or 'UNKNOWN'\nmessage = self._FormatMessage(output_mediator, event, event_data, event_data_stream)\nmessage = message.replace(self._DESCRIPTION_FIELD_DELIMITER, ' ')\nreturn ...
<|body_start_0|> date_time_string = self._FormatDateTime(output_mediator, event, event_data, event_data_stream) timestamp_description = event.timestamp_desc or 'UNKNOWN' message = self._FormatMessage(output_mediator, event, event_data, event_data_stream) message = message.replace(self._D...
TLN output module field formatting helper.
TLNFieldFormattingHelper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TLNFieldFormattingHelper: """TLN output module field formatting helper.""" def _FormatDescription(self, output_mediator, event, event_data, event_data_stream): """Formats a description field. Args: output_mediator (OutputMediator): mediates interactions between output modules and oth...
stack_v2_sparse_classes_10k_train_004905
5,497
permissive
[ { "docstring": "Formats a description field. Args: output_mediator (OutputMediator): mediates interactions between output modules and other components, such as storage and dfVFS. event (EventObject): event. event_data (EventData): event data. event_data_stream (EventDataStream): event data stream. Returns: str:...
3
stack_v2_sparse_classes_30k_train_003146
Implement the Python class `TLNFieldFormattingHelper` described below. Class description: TLN output module field formatting helper. Method signatures and docstrings: - def _FormatDescription(self, output_mediator, event, event_data, event_data_stream): Formats a description field. Args: output_mediator (OutputMediat...
Implement the Python class `TLNFieldFormattingHelper` described below. Class description: TLN output module field formatting helper. Method signatures and docstrings: - def _FormatDescription(self, output_mediator, event, event_data, event_data_stream): Formats a description field. Args: output_mediator (OutputMediat...
d6022f8cfebfddf2d08ab2d300a41b61f3349933
<|skeleton|> class TLNFieldFormattingHelper: """TLN output module field formatting helper.""" def _FormatDescription(self, output_mediator, event, event_data, event_data_stream): """Formats a description field. Args: output_mediator (OutputMediator): mediates interactions between output modules and oth...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TLNFieldFormattingHelper: """TLN output module field formatting helper.""" def _FormatDescription(self, output_mediator, event, event_data, event_data_stream): """Formats a description field. Args: output_mediator (OutputMediator): mediates interactions between output modules and other components...
the_stack_v2_python_sparse
plaso/output/tln.py
log2timeline/plaso
train
1,506
371f7250db3db5a1ed091f2cfa2d49854ae3ca24
[ "dict = {}\nfor each in nums:\n if each not in dict:\n dict[each] = 1\n else:\n dict[each] += 1\nres = []\nfor each in dict.keys():\n if dict[each] == 2:\n res.append(each)\nreturn res", "a = []\nb = set()\nfor each in nums:\n if each in b:\n a.append(each)\n else:\n ...
<|body_start_0|> dict = {} for each in nums: if each not in dict: dict[each] = 1 else: dict[each] += 1 res = [] for each in dict.keys(): if dict[each] == 2: res.append(each) return res <|end_body_...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findDuplicates(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def findDuplicates2(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> dict = {} for each...
stack_v2_sparse_classes_10k_train_004906
724
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "findDuplicates", "signature": "def findDuplicates(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "findDuplicates2", "signature": "def findDuplicates2(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findDuplicates(self, nums): :type nums: List[int] :rtype: List[int] - def findDuplicates2(self, nums): :type nums: List[int] :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findDuplicates(self, nums): :type nums: List[int] :rtype: List[int] - def findDuplicates2(self, nums): :type nums: List[int] :rtype: List[int] <|skeleton|> class Solution: ...
4105e18050b15fc0409c75353ad31be17187dd34
<|skeleton|> class Solution: def findDuplicates(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def findDuplicates2(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def findDuplicates(self, nums): """:type nums: List[int] :rtype: List[int]""" dict = {} for each in nums: if each not in dict: dict[each] = 1 else: dict[each] += 1 res = [] for each in dict.keys(): ...
the_stack_v2_python_sparse
findDuplicates.py
NeilWangziyu/Leetcode_py
train
2
78eac0d7ab32ee63c9542b0a7e7ed12ea5fe9fcf
[ "super(HonourAutoCombat, self).start()\nfor char in self.characters.values():\n character = char['char']\n character.start_auto_combat_skill()", "for char in self.characters.values():\n character = char['char']\n character.stop_auto_combat_skill()\nawait super(HonourAutoCombat, self).finish()" ]
<|body_start_0|> super(HonourAutoCombat, self).start() for char in self.characters.values(): character = char['char'] character.start_auto_combat_skill() <|end_body_0|> <|body_start_1|> for char in self.characters.values(): character = char['char'] ...
This implements the honour combat handler.
HonourAutoCombat
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HonourAutoCombat: """This implements the honour combat handler.""" def start(self): """Start a combat, make all NPCs to cast skills automatically.""" <|body_0|> async def finish(self): """Finish a combat. Send results to players, and kill all failed characters.""...
stack_v2_sparse_classes_10k_train_004907
856
permissive
[ { "docstring": "Start a combat, make all NPCs to cast skills automatically.", "name": "start", "signature": "def start(self)" }, { "docstring": "Finish a combat. Send results to players, and kill all failed characters.", "name": "finish", "signature": "async def finish(self)" } ]
2
stack_v2_sparse_classes_30k_train_000698
Implement the Python class `HonourAutoCombat` described below. Class description: This implements the honour combat handler. Method signatures and docstrings: - def start(self): Start a combat, make all NPCs to cast skills automatically. - async def finish(self): Finish a combat. Send results to players, and kill all...
Implement the Python class `HonourAutoCombat` described below. Class description: This implements the honour combat handler. Method signatures and docstrings: - def start(self): Start a combat, make all NPCs to cast skills automatically. - async def finish(self): Finish a combat. Send results to players, and kill all...
5fa06b29bf800646dc4da5851fdf7a1f299f15a7
<|skeleton|> class HonourAutoCombat: """This implements the honour combat handler.""" def start(self): """Start a combat, make all NPCs to cast skills automatically.""" <|body_0|> async def finish(self): """Finish a combat. Send results to players, and kill all failed characters.""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class HonourAutoCombat: """This implements the honour combat handler.""" def start(self): """Start a combat, make all NPCs to cast skills automatically.""" super(HonourAutoCombat, self).start() for char in self.characters.values(): character = char['char'] charac...
the_stack_v2_python_sparse
muddery/server/combat/combat_runner/honour_auto_combat.py
muddery/muddery
train
139
b1a650b937b507391196567a83dec206663e2280
[ "self._helper = helper.ImportHelper()\nwith tempfile.NamedTemporaryFile('w', suffix='.yaml') as fw:\n fw.write(MOCK_CONFIG)\n fw.seek(0)\n self._helper.add_config(fw.name)", "streamer = MockStreamer()\nself._helper.configure_streamer(streamer, data_type='foo:no')\nself.assertEqual(streamer.format_string,...
<|body_start_0|> self._helper = helper.ImportHelper() with tempfile.NamedTemporaryFile('w', suffix='.yaml') as fw: fw.write(MOCK_CONFIG) fw.seek(0) self._helper.add_config(fw.name) <|end_body_0|> <|body_start_1|> streamer = MockStreamer() self._helper...
Test Timesketch import helper.
TimesketchHelperTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimesketchHelperTest: """Test Timesketch import helper.""" def setUp(self): """Set up the test.""" <|body_0|> def test_not_config(self): """Test a helper that does not match.""" <|body_1|> def test_sub_column(self): """Test a helper that matc...
stack_v2_sparse_classes_10k_train_004908
4,792
permissive
[ { "docstring": "Set up the test.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test a helper that does not match.", "name": "test_not_config", "signature": "def test_not_config(self)" }, { "docstring": "Test a helper that matches on sub columns.", "name...
5
null
Implement the Python class `TimesketchHelperTest` described below. Class description: Test Timesketch import helper. Method signatures and docstrings: - def setUp(self): Set up the test. - def test_not_config(self): Test a helper that does not match. - def test_sub_column(self): Test a helper that matches on sub colu...
Implement the Python class `TimesketchHelperTest` described below. Class description: Test Timesketch import helper. Method signatures and docstrings: - def setUp(self): Set up the test. - def test_not_config(self): Test a helper that does not match. - def test_sub_column(self): Test a helper that matches on sub colu...
24f471b58ca4a87cb053961b5f05c07a544ca7b8
<|skeleton|> class TimesketchHelperTest: """Test Timesketch import helper.""" def setUp(self): """Set up the test.""" <|body_0|> def test_not_config(self): """Test a helper that does not match.""" <|body_1|> def test_sub_column(self): """Test a helper that matc...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TimesketchHelperTest: """Test Timesketch import helper.""" def setUp(self): """Set up the test.""" self._helper = helper.ImportHelper() with tempfile.NamedTemporaryFile('w', suffix='.yaml') as fw: fw.write(MOCK_CONFIG) fw.seek(0) self._helper.ad...
the_stack_v2_python_sparse
importer_client/python/timesketch_import_client/helper_test.py
google/timesketch
train
2,263
84c7b4672491ecd3605e73296a97ef10b2a7eeac
[ "if self.end and self.start and (self.start >= self.end):\n self.not_valid('Start date after end date?', 'Consistency error', self.start)\nif not self.end and (not self.duration):\n self.not_valid('Either end or a duration must be specified', 'Consistency Error', self.end)\nif self.end is not None:\n self....
<|body_start_0|> if self.end and self.start and (self.start >= self.end): self.not_valid('Start date after end date?', 'Consistency error', self.start) if not self.end and (not self.duration): self.not_valid('Either end or a duration must be specified', 'Consistency Error', self....
Command to create a new Sprint
CreateSprintCommand
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreateSprintCommand: """Command to create a new Sprint""" def consistency_validation(self, env): """Validate the consistency of dates and duration together, the individual parameter format validation has already occurred, now we check the relation between them, in particular: start <...
stack_v2_sparse_classes_10k_train_004909
46,751
no_license
[ { "docstring": "Validate the consistency of dates and duration together, the individual parameter format validation has already occurred, now we check the relation between them, in particular: start < end if end is not present, duration must be if duration is not present, end must be", "name": "consistency_...
3
null
Implement the Python class `CreateSprintCommand` described below. Class description: Command to create a new Sprint Method signatures and docstrings: - def consistency_validation(self, env): Validate the consistency of dates and duration together, the individual parameter format validation has already occurred, now w...
Implement the Python class `CreateSprintCommand` described below. Class description: Command to create a new Sprint Method signatures and docstrings: - def consistency_validation(self, env): Validate the consistency of dates and duration together, the individual parameter format validation has already occurred, now w...
1059b76554363004887b2a60953957f413b80bb0
<|skeleton|> class CreateSprintCommand: """Command to create a new Sprint""" def consistency_validation(self, env): """Validate the consistency of dates and duration together, the individual parameter format validation has already occurred, now we check the relation between them, in particular: start <...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CreateSprintCommand: """Command to create a new Sprint""" def consistency_validation(self, env): """Validate the consistency of dates and duration together, the individual parameter format validation has already occurred, now we check the relation between them, in particular: start < end if end i...
the_stack_v2_python_sparse
agilo/scrum/sprint/controller.py
djangsters/agilo
train
0
39ec904b209ac1263abcd6a99fb489bc874cdea1
[ "if handler_config is None:\n raise CSVFileToSQLHandlerError('None passed as handler config.')\nself.name = handler_config[CONFIG_NAME]\nself.source = handler_config[CONFIG_SOURCE]\nself.exitonfailure = handler_config[CONFIG_EXITONFAILURE]\nself.recursive = handler_config[CONFIG_RECURSIVE]\nself.delete_source = ...
<|body_start_0|> if handler_config is None: raise CSVFileToSQLHandlerError('None passed as handler config.') self.name = handler_config[CONFIG_NAME] self.source = handler_config[CONFIG_SOURCE] self.exitonfailure = handler_config[CONFIG_EXITONFAILURE] self.recursive = ...
Import CSV file to MySQL database. Read in CSV file and insert/update rows within a given MySQL database/table. If no key attribute is specified then the rows are inserted otherwise updated. Attributes: name : Name of handler object source: Directory to watch for files recursive: Boolean == true perform recursive file ...
CSVFileToSQLHandler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CSVFileToSQLHandler: """Import CSV file to MySQL database. Read in CSV file and insert/update rows within a given MySQL database/table. If no key attribute is specified then the rows are inserted otherwise updated. Attributes: name : Name of handler object source: Directory to watch for files rec...
stack_v2_sparse_classes_10k_train_004910
5,607
permissive
[ { "docstring": "Initialise handler attributes. Args: handler_config (ConfigDict): Handler configuration. Raises: CSVFileToSQLHandlerError: None passed as handler configuration.", "name": "__init__", "signature": "def __init__(self, handler_config: ConfigDict) -> None" }, { "docstring": "Import C...
2
stack_v2_sparse_classes_30k_train_000935
Implement the Python class `CSVFileToSQLHandler` described below. Class description: Import CSV file to MySQL database. Read in CSV file and insert/update rows within a given MySQL database/table. If no key attribute is specified then the rows are inserted otherwise updated. Attributes: name : Name of handler object s...
Implement the Python class `CSVFileToSQLHandler` described below. Class description: Import CSV file to MySQL database. Read in CSV file and insert/update rows within a given MySQL database/table. If no key attribute is specified then the rows are inserted otherwise updated. Attributes: name : Name of handler object s...
abbd95b0ddd9da577b6cad69708f2e31db694d94
<|skeleton|> class CSVFileToSQLHandler: """Import CSV file to MySQL database. Read in CSV file and insert/update rows within a given MySQL database/table. If no key attribute is specified then the rows are inserted otherwise updated. Attributes: name : Name of handler object source: Directory to watch for files rec...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CSVFileToSQLHandler: """Import CSV file to MySQL database. Read in CSV file and insert/update rows within a given MySQL database/table. If no key attribute is specified then the rows are inserted otherwise updated. Attributes: name : Name of handler object source: Directory to watch for files recursive: Boole...
the_stack_v2_python_sparse
FPE/builtin/csvfile_to_sql_handler.py
clockworkengineer/Constrictor
train
1
54b3e82178d6d185c5df7325c906c948b1d10ad5
[ "words.sort()\nwords += ['z']\nstack = []\nret = ''\nlength_ret = 0\nfor i in range(len(words)):\n s = words[i]\n length_s = len(s)\n if length_s == 1:\n if stack and len(stack[-1]) > length_ret:\n ret = stack[-1]\n length_ret = len(ret)\n stack = [words[i]]\n else:\n...
<|body_start_0|> words.sort() words += ['z'] stack = [] ret = '' length_ret = 0 for i in range(len(words)): s = words[i] length_s = len(s) if length_s == 1: if stack and len(stack[-1]) > length_ret: r...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestWord(self, words): """:type words: List[str] :rtype: str""" <|body_0|> def longestWord2(self, words): """:type words: List[str] :rtype: str""" <|body_1|> def longestWord1(self, words): """:type words: List[str] :rtype: str"""...
stack_v2_sparse_classes_10k_train_004911
2,692
no_license
[ { "docstring": ":type words: List[str] :rtype: str", "name": "longestWord", "signature": "def longestWord(self, words)" }, { "docstring": ":type words: List[str] :rtype: str", "name": "longestWord2", "signature": "def longestWord2(self, words)" }, { "docstring": ":type words: Lis...
3
stack_v2_sparse_classes_30k_train_000747
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestWord(self, words): :type words: List[str] :rtype: str - def longestWord2(self, words): :type words: List[str] :rtype: str - def longestWord1(self, words): :type words:...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestWord(self, words): :type words: List[str] :rtype: str - def longestWord2(self, words): :type words: List[str] :rtype: str - def longestWord1(self, words): :type words:...
70bdd75b6af2e1811c1beab22050c01d28d7373e
<|skeleton|> class Solution: def longestWord(self, words): """:type words: List[str] :rtype: str""" <|body_0|> def longestWord2(self, words): """:type words: List[str] :rtype: str""" <|body_1|> def longestWord1(self, words): """:type words: List[str] :rtype: str"""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def longestWord(self, words): """:type words: List[str] :rtype: str""" words.sort() words += ['z'] stack = [] ret = '' length_ret = 0 for i in range(len(words)): s = words[i] length_s = len(s) if length_s == ...
the_stack_v2_python_sparse
python/leetcode_bak/720_Longest_Word_in_Dictionary.py
bobcaoge/my-code
train
0
3ea752b496dd506b0ef584709aefc59c05417052
[ "if not root:\n return json.dumps([])\narr = []\nqueue = [[root, -1]]\nwhile queue:\n tmp = queue.pop(0)\n cur, parentIdx = (tmp[0], tmp[1])\n arr.append([cur.val, parentIdx])\n if cur.left:\n queue.append([cur.left, len(arr) - 1])\n if cur.right:\n queue.append([cur.right, len(arr) ...
<|body_start_0|> if not root: return json.dumps([]) arr = [] queue = [[root, -1]] while queue: tmp = queue.pop(0) cur, parentIdx = (tmp[0], tmp[1]) arr.append([cur.val, parentIdx]) if cur.left: queue.append([cur....
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: ...
stack_v2_sparse_classes_10k_train_004912
1,317
no_license
[ { "docstring": "Encodes a tree to a single string.", "name": "serialize", "signature": "def serialize(self, root: TreeNode) -> str" }, { "docstring": "Decodes your encoded data to tree.", "name": "deserialize", "signature": "def deserialize(self, data: str) -> TreeNode" } ]
2
stack_v2_sparse_classes_30k_train_007175
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree.
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree. <|skeleton|> class Co...
6c716ee37fcb82387f050422f578daa142926101
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" if not root: return json.dumps([]) arr = [] queue = [[root, -1]] while queue: tmp = queue.pop(0) cur, parentIdx = (tmp[0], tmp[1]) ...
the_stack_v2_python_sparse
src/449.py
yibwu/leetcode
train
0
305fee1943e236aa1338f3a083890bf0053eaec6
[ "if self.dialog is None:\n self.dialog = TextureBakerDlg()\nreturn self.dialog.Open(dlgtype=c4d.DLG_TYPE_ASYNC, pluginid=PLUGIN_ID, defaultw=250, defaulth=50)", "if self.dialog is None:\n self.dialog = TextureBakerDlg()\nreturn self.dialog.Restore(pluginid=PLUGIN_ID, secret=sec_ref)" ]
<|body_start_0|> if self.dialog is None: self.dialog = TextureBakerDlg() return self.dialog.Open(dlgtype=c4d.DLG_TYPE_ASYNC, pluginid=PLUGIN_ID, defaultw=250, defaulth=50) <|end_body_0|> <|body_start_1|> if self.dialog is None: self.dialog = TextureBakerDlg() ret...
Command Data class that holds the TextureBakerDlg instance.
TextureBakerData
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextureBakerData: """Command Data class that holds the TextureBakerDlg instance.""" def Execute(self, doc): """Called when the user Execute the command (CallCommand or a clicks on the Command from the plugin menu) Args: doc (c4d.documents.BaseDocument): the current active document Re...
stack_v2_sparse_classes_10k_train_004913
10,936
permissive
[ { "docstring": "Called when the user Execute the command (CallCommand or a clicks on the Command from the plugin menu) Args: doc (c4d.documents.BaseDocument): the current active document Returns: bool: True if the command success", "name": "Execute", "signature": "def Execute(self, doc)" }, { "d...
2
null
Implement the Python class `TextureBakerData` described below. Class description: Command Data class that holds the TextureBakerDlg instance. Method signatures and docstrings: - def Execute(self, doc): Called when the user Execute the command (CallCommand or a clicks on the Command from the plugin menu) Args: doc (c4...
Implement the Python class `TextureBakerData` described below. Class description: Command Data class that holds the TextureBakerDlg instance. Method signatures and docstrings: - def Execute(self, doc): Called when the user Execute the command (CallCommand or a clicks on the Command from the plugin menu) Args: doc (c4...
b1ea3fce533df34094bc3d0bd6460dfb84306e53
<|skeleton|> class TextureBakerData: """Command Data class that holds the TextureBakerDlg instance.""" def Execute(self, doc): """Called when the user Execute the command (CallCommand or a clicks on the Command from the plugin menu) Args: doc (c4d.documents.BaseDocument): the current active document Re...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TextureBakerData: """Command Data class that holds the TextureBakerDlg instance.""" def Execute(self, doc): """Called when the user Execute the command (CallCommand or a clicks on the Command from the plugin menu) Args: doc (c4d.documents.BaseDocument): the current active document Returns: bool: ...
the_stack_v2_python_sparse
plugins/py-texture_baker_r18/py-texture_baker_r18.pyp
PluginCafe/cinema4d_py_sdk_extended
train
112
b552b57e885cc03f71d154a606903e93c7d561f0
[ "self.signatures = signature_dict\nself.ssgsea_kwds = ssgsea_kwds\nself.all_ids = reduce(lambda x, y: x.union(y), self.signatures.values(), set())", "series_in = False\nif isinstance(sample_data, pd.Series):\n sample_data = pd.DataFrame(sample_data)\n series_in = True\nif sample_data.index.duplicated().any(...
<|body_start_0|> self.signatures = signature_dict self.ssgsea_kwds = ssgsea_kwds self.all_ids = reduce(lambda x, y: x.union(y), self.signatures.values(), set()) <|end_body_0|> <|body_start_1|> series_in = False if isinstance(sample_data, pd.Series): sample_data = pd....
Basic classifier that uses pre-defined signatures to score samples and assess classification.
ssGSEAClassifier
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ssGSEAClassifier: """Basic classifier that uses pre-defined signatures to score samples and assess classification.""" def __init__(self, signature_dict, **ssgsea_kwds): """:param signature_dict: Dictionary. Keys are the class name, values are iterables of genes / probes or any other ...
stack_v2_sparse_classes_10k_train_004914
3,530
no_license
[ { "docstring": ":param signature_dict: Dictionary. Keys are the class name, values are iterables of genes / probes or any other row index :param ssgsea_kwds: Any additional kwargs are passed directly to the ssgsea algorithm.", "name": "__init__", "signature": "def __init__(self, signature_dict, **ssgsea...
2
stack_v2_sparse_classes_30k_train_006283
Implement the Python class `ssGSEAClassifier` described below. Class description: Basic classifier that uses pre-defined signatures to score samples and assess classification. Method signatures and docstrings: - def __init__(self, signature_dict, **ssgsea_kwds): :param signature_dict: Dictionary. Keys are the class n...
Implement the Python class `ssGSEAClassifier` described below. Class description: Basic classifier that uses pre-defined signatures to score samples and assess classification. Method signatures and docstrings: - def __init__(self, signature_dict, **ssgsea_kwds): :param signature_dict: Dictionary. Keys are the class n...
3cb6fa0e763ddc0a375fcd99a55eab5f9df26fe3
<|skeleton|> class ssGSEAClassifier: """Basic classifier that uses pre-defined signatures to score samples and assess classification.""" def __init__(self, signature_dict, **ssgsea_kwds): """:param signature_dict: Dictionary. Keys are the class name, values are iterables of genes / probes or any other ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ssGSEAClassifier: """Basic classifier that uses pre-defined signatures to score samples and assess classification.""" def __init__(self, signature_dict, **ssgsea_kwds): """:param signature_dict: Dictionary. Keys are the class name, values are iterables of genes / probes or any other row index :pa...
the_stack_v2_python_sparse
classification/signature.py
gaberosser/qmul-bioinf
train
3
be76ad3d413e402df7e6ac137d0d26a444ef98f9
[ "super().__init__(2, 1, seed)\nself.stamp_size = stamp_size\nself.max_shift = max_shift if max_shift is not None else self.stamp_size / 10.0\nself.mag_name = mag_name\nself.bright_cut = bright_cut\nself.dim_cut = dim_cut", "if self.mag_name not in table.colnames:\n raise ValueError(f\"Catalog must have '{self....
<|body_start_0|> super().__init__(2, 1, seed) self.stamp_size = stamp_size self.max_shift = max_shift if max_shift is not None else self.stamp_size / 10.0 self.mag_name = mag_name self.bright_cut = bright_cut self.dim_cut = dim_cut <|end_body_0|> <|body_start_1|> ...
Sampling function for pairs of galaxies. Picks one centered bright galaxy and second dim. The bright galaxy is centered at the center of the stamp and the dim galaxy is shifted. The bright galaxy is chosen with magnitude less than `bright_cut` and the dim galaxy is chosen with magnitude cut larger than `bright_cut` and...
PairSampling
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PairSampling: """Sampling function for pairs of galaxies. Picks one centered bright galaxy and second dim. The bright galaxy is centered at the center of the stamp and the dim galaxy is shifted. The bright galaxy is chosen with magnitude less than `bright_cut` and the dim galaxy is chosen with ma...
stack_v2_sparse_classes_10k_train_004915
12,943
permissive
[ { "docstring": "Initializes the PairSampling function. Args: stamp_size: Size of the desired stamp (in arcseconds). max_shift: Maximum value of shift from center. If None then its set as one-tenth the stamp size (in arcseconds). mag_name: Name of the magnitude column in the catalog to be used. seed: See parent ...
2
stack_v2_sparse_classes_30k_train_005535
Implement the Python class `PairSampling` described below. Class description: Sampling function for pairs of galaxies. Picks one centered bright galaxy and second dim. The bright galaxy is centered at the center of the stamp and the dim galaxy is shifted. The bright galaxy is chosen with magnitude less than `bright_cu...
Implement the Python class `PairSampling` described below. Class description: Sampling function for pairs of galaxies. Picks one centered bright galaxy and second dim. The bright galaxy is centered at the center of the stamp and the dim galaxy is shifted. The bright galaxy is chosen with magnitude less than `bright_cu...
f5b716a373f130238100db8980aa0d282822983a
<|skeleton|> class PairSampling: """Sampling function for pairs of galaxies. Picks one centered bright galaxy and second dim. The bright galaxy is centered at the center of the stamp and the dim galaxy is shifted. The bright galaxy is chosen with magnitude less than `bright_cut` and the dim galaxy is chosen with ma...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PairSampling: """Sampling function for pairs of galaxies. Picks one centered bright galaxy and second dim. The bright galaxy is centered at the center of the stamp and the dim galaxy is shifted. The bright galaxy is chosen with magnitude less than `bright_cut` and the dim galaxy is chosen with magnitude cut l...
the_stack_v2_python_sparse
btk/sampling_functions.py
LSSTDESC/BlendingToolKit
train
22
2e1fd26f62781ba9df41587ee8cbae5e72f487e1
[ "if t == MOUSE:\n return [(m, p, 3 - t) for p in graph[c] if p != 0]\nelif t == CAT:\n return [(p, c, 3 - t) for p in graph[m] if p != 0]", "childrenCount = {}\nfor m in range(len(graph)):\n for c in range(len(graph)):\n childrenCount[m, c, MOUSE] = len(graph[m])\n childrenCount[m, c, CAT] ...
<|body_start_0|> if t == MOUSE: return [(m, p, 3 - t) for p in graph[c] if p != 0] elif t == CAT: return [(p, c, 3 - t) for p in graph[m] if p != 0] <|end_body_0|> <|body_start_1|> childrenCount = {} for m in range(len(graph)): for c in range(len(grap...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def getParents(self, graph, m, c, t): """get parent states of (m, c, t)""" <|body_0|> def catMouseGame(self, graph): """Let (m,c,t) be the state of the game. m is the mouse location, c is cat location, t is 1 means it's mouse's turn, t is 2 means it's cat' ...
stack_v2_sparse_classes_10k_train_004916
4,078
no_license
[ { "docstring": "get parent states of (m, c, t)", "name": "getParents", "signature": "def getParents(self, graph, m, c, t)" }, { "docstring": "Let (m,c,t) be the state of the game. m is the mouse location, c is cat location, t is 1 means it's mouse's turn, t is 2 means it's cat' turn. Then the al...
2
stack_v2_sparse_classes_30k_train_006139
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getParents(self, graph, m, c, t): get parent states of (m, c, t) - def catMouseGame(self, graph): Let (m,c,t) be the state of the game. m is the mouse location, c is cat loca...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getParents(self, graph, m, c, t): get parent states of (m, c, t) - def catMouseGame(self, graph): Let (m,c,t) be the state of the game. m is the mouse location, c is cat loca...
ad2f5bd0aec3d2c2c77b7c18627c1dd8fe8c0653
<|skeleton|> class Solution: def getParents(self, graph, m, c, t): """get parent states of (m, c, t)""" <|body_0|> def catMouseGame(self, graph): """Let (m,c,t) be the state of the game. m is the mouse location, c is cat location, t is 1 means it's mouse's turn, t is 2 means it's cat' ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def getParents(self, graph, m, c, t): """get parent states of (m, c, t)""" if t == MOUSE: return [(m, p, 3 - t) for p in graph[c] if p != 0] elif t == CAT: return [(p, c, 3 - t) for p in graph[m] if p != 0] def catMouseGame(self, graph): "...
the_stack_v2_python_sparse
913 Cat and Mouse.py
jz33/LeetCodeSolutions
train
8
35aba2df40eeff2793ccfa02505ad40fda7e51a3
[ "n = len(regular)\nOFFSET = 2 * n\nadjMap = defaultdict(lambda: defaultdict(lambda: INF))\nfor pre, cur in pairwise(range(n + 1)):\n adjMap[pre][cur] = regular[pre]\n adjMap[pre][pre + OFFSET] = expressCost\n adjMap[pre + OFFSET][pre] = 0\n adjMap[pre + OFFSET][cur + OFFSET] = express[pre]\ndist = defau...
<|body_start_0|> n = len(regular) OFFSET = 2 * n adjMap = defaultdict(lambda: defaultdict(lambda: INF)) for pre, cur in pairwise(range(n + 1)): adjMap[pre][cur] = regular[pre] adjMap[pre][pre + OFFSET] = expressCost adjMap[pre + OFFSET][pre] = 0 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minimumCosts(self, regular: List[int], express: List[int], expressCost: int) -> List[int]: """注意到原图有环,所以通用的方法是 dijkstra 求最短路""" <|body_0|> def minimumCosts2(self, A: List[int], B: List[int], C: int) -> List[int]: """将每个车站视为一个点(缩点),那么转移就是拓扑序dp了""" ...
stack_v2_sparse_classes_10k_train_004917
2,105
no_license
[ { "docstring": "注意到原图有环,所以通用的方法是 dijkstra 求最短路", "name": "minimumCosts", "signature": "def minimumCosts(self, regular: List[int], express: List[int], expressCost: int) -> List[int]" }, { "docstring": "将每个车站视为一个点(缩点),那么转移就是拓扑序dp了", "name": "minimumCosts2", "signature": "def minimumCosts2(...
2
stack_v2_sparse_classes_30k_train_007006
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minimumCosts(self, regular: List[int], express: List[int], expressCost: int) -> List[int]: 注意到原图有环,所以通用的方法是 dijkstra 求最短路 - def minimumCosts2(self, A: List[int], B: List[int]...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minimumCosts(self, regular: List[int], express: List[int], expressCost: int) -> List[int]: 注意到原图有环,所以通用的方法是 dijkstra 求最短路 - def minimumCosts2(self, A: List[int], B: List[int]...
7e79e26bb8f641868561b186e34c1127ed63c9e0
<|skeleton|> class Solution: def minimumCosts(self, regular: List[int], express: List[int], expressCost: int) -> List[int]: """注意到原图有环,所以通用的方法是 dijkstra 求最短路""" <|body_0|> def minimumCosts2(self, A: List[int], B: List[int], C: int) -> List[int]: """将每个车站视为一个点(缩点),那么转移就是拓扑序dp了""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def minimumCosts(self, regular: List[int], express: List[int], expressCost: int) -> List[int]: """注意到原图有环,所以通用的方法是 dijkstra 求最短路""" n = len(regular) OFFSET = 2 * n adjMap = defaultdict(lambda: defaultdict(lambda: INF)) for pre, cur in pairwise(range(n + 1)): ...
the_stack_v2_python_sparse
11_动态规划/dp分类/线性dp/2361. Minimum Costs Using the Train Line-火车站问题.py
981377660LMT/algorithm-study
train
225
5b82728ecdb8af261742df9cdf47c4237b1d2a6e
[ "assert cluster\nosh = ObjectStateHolder('mscluster')\nosh.setAttribute('data_name', cluster.name)\nmodeling.setAppSystemVendor(osh)\nif cluster.version:\n osh.setAttribute('version', cluster.version)\ndetails = cluster.details\nif details:\n if details.defaultNetworkRole:\n osh.setAttribute('defaultNe...
<|body_start_0|> assert cluster osh = ObjectStateHolder('mscluster') osh.setAttribute('data_name', cluster.name) modeling.setAppSystemVendor(osh) if cluster.version: osh.setAttribute('version', cluster.version) details = cluster.details if details: ...
Builder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Builder: def buildCluster(self, cluster): """@types: Cluster -> ObjectStateHolder""" <|body_0|> def buildClusterPdo(self, pdo): """@types: Builder.Pdo -> ObjectStateHolder""" <|body_1|> <|end_skeleton|> <|body_start_0|> assert cluster osh = ...
stack_v2_sparse_classes_10k_train_004918
15,554
no_license
[ { "docstring": "@types: Cluster -> ObjectStateHolder", "name": "buildCluster", "signature": "def buildCluster(self, cluster)" }, { "docstring": "@types: Builder.Pdo -> ObjectStateHolder", "name": "buildClusterPdo", "signature": "def buildClusterPdo(self, pdo)" } ]
2
null
Implement the Python class `Builder` described below. Class description: Implement the Builder class. Method signatures and docstrings: - def buildCluster(self, cluster): @types: Cluster -> ObjectStateHolder - def buildClusterPdo(self, pdo): @types: Builder.Pdo -> ObjectStateHolder
Implement the Python class `Builder` described below. Class description: Implement the Builder class. Method signatures and docstrings: - def buildCluster(self, cluster): @types: Cluster -> ObjectStateHolder - def buildClusterPdo(self, pdo): @types: Builder.Pdo -> ObjectStateHolder <|skeleton|> class Builder: d...
c431e809e8d0f82e1bca7e3429dd0245560b5680
<|skeleton|> class Builder: def buildCluster(self, cluster): """@types: Cluster -> ObjectStateHolder""" <|body_0|> def buildClusterPdo(self, pdo): """@types: Builder.Pdo -> ObjectStateHolder""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Builder: def buildCluster(self, cluster): """@types: Cluster -> ObjectStateHolder""" assert cluster osh = ObjectStateHolder('mscluster') osh.setAttribute('data_name', cluster.name) modeling.setAppSystemVendor(osh) if cluster.version: osh.setAttribute...
the_stack_v2_python_sparse
reference/ucmdb/discovery/ms_cluster.py
madmonkyang/cda-record
train
0
e98c17b010c1258e3c9b144718ae074979299732
[ "if self.op.mode in (constants.IALLOCATOR_MODE_ALLOC, constants.IALLOCATOR_MODE_MULTI_ALLOC):\n self.inst_uuid, iname = self.cfg.ExpandInstanceName(self.op.name)\n if iname is not None:\n raise errors.OpPrereqError(\"Instance '%s' already in the cluster\" % iname, errors.ECODE_EXISTS)\n for row in s...
<|body_start_0|> if self.op.mode in (constants.IALLOCATOR_MODE_ALLOC, constants.IALLOCATOR_MODE_MULTI_ALLOC): self.inst_uuid, iname = self.cfg.ExpandInstanceName(self.op.name) if iname is not None: raise errors.OpPrereqError("Instance '%s' already in the cluster" % iname,...
Run allocator tests. This LU runs the allocator tests
LUTestAllocator
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LUTestAllocator: """Run allocator tests. This LU runs the allocator tests""" def CheckPrereq(self): """Check prerequisites. This checks the opcode parameters depending on the director and mode test.""" <|body_0|> def Exec(self, feedback_fn): """Run the allocator ...
stack_v2_sparse_classes_10k_train_004919
16,228
permissive
[ { "docstring": "Check prerequisites. This checks the opcode parameters depending on the director and mode test.", "name": "CheckPrereq", "signature": "def CheckPrereq(self)" }, { "docstring": "Run the allocator test.", "name": "Exec", "signature": "def Exec(self, feedback_fn)" } ]
2
stack_v2_sparse_classes_30k_train_005379
Implement the Python class `LUTestAllocator` described below. Class description: Run allocator tests. This LU runs the allocator tests Method signatures and docstrings: - def CheckPrereq(self): Check prerequisites. This checks the opcode parameters depending on the director and mode test. - def Exec(self, feedback_fn...
Implement the Python class `LUTestAllocator` described below. Class description: Run allocator tests. This LU runs the allocator tests Method signatures and docstrings: - def CheckPrereq(self): Check prerequisites. This checks the opcode parameters depending on the director and mode test. - def Exec(self, feedback_fn...
456ea285a7583183c2c8e5bcffe9006ec8a9d658
<|skeleton|> class LUTestAllocator: """Run allocator tests. This LU runs the allocator tests""" def CheckPrereq(self): """Check prerequisites. This checks the opcode parameters depending on the director and mode test.""" <|body_0|> def Exec(self, feedback_fn): """Run the allocator ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LUTestAllocator: """Run allocator tests. This LU runs the allocator tests""" def CheckPrereq(self): """Check prerequisites. This checks the opcode parameters depending on the director and mode test.""" if self.op.mode in (constants.IALLOCATOR_MODE_ALLOC, constants.IALLOCATOR_MODE_MULTI_AL...
the_stack_v2_python_sparse
lib/cmdlib/test.py
ganeti/ganeti
train
465
28d8ca8fe401e5e77888d61cdb98f6e9f49fae94
[ "super().__init__()\nself.filename = filename\nself.line_format = '[{0:20s}]\\t\\t[Requested: {1} -- Data: {2}]\\n'", "f = open(self.filename, 'a')\nfor key in data:\n f.write(self.line_format.format(datetime.now().__str__(), key, data[key]))\nf.close()" ]
<|body_start_0|> super().__init__() self.filename = filename self.line_format = '[{0:20s}]\t\t[Requested: {1} -- Data: {2}]\n' <|end_body_0|> <|body_start_1|> f = open(self.filename, 'a') for key in data: f.write(self.line_format.format(datetime.now().__str__(), key,...
Implements an interface to write data to file.
FileWriter
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileWriter: """Implements an interface to write data to file.""" def __init__(self, filename): """FileWriter implementation of broadcaster. Keyword Arguments: filename -- the name of the file to read/write to.""" <|body_0|> def publish_dictionary(self, data): """...
stack_v2_sparse_classes_10k_train_004920
2,907
permissive
[ { "docstring": "FileWriter implementation of broadcaster. Keyword Arguments: filename -- the name of the file to read/write to.", "name": "__init__", "signature": "def __init__(self, filename)" }, { "docstring": "Writes a formated dictionary update to file. Keyword Arguments: data -- The data di...
2
stack_v2_sparse_classes_30k_train_003716
Implement the Python class `FileWriter` described below. Class description: Implements an interface to write data to file. Method signatures and docstrings: - def __init__(self, filename): FileWriter implementation of broadcaster. Keyword Arguments: filename -- the name of the file to read/write to. - def publish_dic...
Implement the Python class `FileWriter` described below. Class description: Implements an interface to write data to file. Method signatures and docstrings: - def __init__(self, filename): FileWriter implementation of broadcaster. Keyword Arguments: filename -- the name of the file to read/write to. - def publish_dic...
b5d75cb82e4bc3e9c4e428a288c6ac98a4aa2c52
<|skeleton|> class FileWriter: """Implements an interface to write data to file.""" def __init__(self, filename): """FileWriter implementation of broadcaster. Keyword Arguments: filename -- the name of the file to read/write to.""" <|body_0|> def publish_dictionary(self, data): """...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FileWriter: """Implements an interface to write data to file.""" def __init__(self, filename): """FileWriter implementation of broadcaster. Keyword Arguments: filename -- the name of the file to read/write to.""" super().__init__() self.filename = filename self.line_format...
the_stack_v2_python_sparse
src/broadcaster/broadcaster.py
vt-sailbot/sailbot-21
train
5
023776c9402f0f5915c2378c604e27879993da21
[ "self.description = description\nself.domain = domain\nself.name = name\nself.nfs_access = nfs_access\nself.nfs_squash = nfs_squash", "if dictionary is None:\n return None\ndescription = dictionary.get('description')\ndomain = dictionary.get('domain')\nname = dictionary.get('name')\nnfs_access = dictionary.get...
<|body_start_0|> self.description = description self.domain = domain self.name = name self.nfs_access = nfs_access self.nfs_squash = nfs_squash <|end_body_0|> <|body_start_1|> if dictionary is None: return None description = dictionary.get('descriptio...
Implementation of the 'NisNetgroup' model. Defines an NIS Netgroup. Attributes: description (string): Description of the netgroup. domain (string): Specifies the domain of the netgroup. name (string): Specifies the name of the netgroup. nfs_access (NfsAccessEnum): Specifies whether clients from this netgroup can mount ...
NisNetgroup
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NisNetgroup: """Implementation of the 'NisNetgroup' model. Defines an NIS Netgroup. Attributes: description (string): Description of the netgroup. domain (string): Specifies the domain of the netgroup. name (string): Specifies the name of the netgroup. nfs_access (NfsAccessEnum): Specifies whethe...
stack_v2_sparse_classes_10k_train_004921
2,471
permissive
[ { "docstring": "Constructor for the NisNetgroup class", "name": "__init__", "signature": "def __init__(self, description=None, domain=None, name=None, nfs_access=None, nfs_squash=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictio...
2
null
Implement the Python class `NisNetgroup` described below. Class description: Implementation of the 'NisNetgroup' model. Defines an NIS Netgroup. Attributes: description (string): Description of the netgroup. domain (string): Specifies the domain of the netgroup. name (string): Specifies the name of the netgroup. nfs_a...
Implement the Python class `NisNetgroup` described below. Class description: Implementation of the 'NisNetgroup' model. Defines an NIS Netgroup. Attributes: description (string): Description of the netgroup. domain (string): Specifies the domain of the netgroup. name (string): Specifies the name of the netgroup. nfs_a...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class NisNetgroup: """Implementation of the 'NisNetgroup' model. Defines an NIS Netgroup. Attributes: description (string): Description of the netgroup. domain (string): Specifies the domain of the netgroup. name (string): Specifies the name of the netgroup. nfs_access (NfsAccessEnum): Specifies whethe...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NisNetgroup: """Implementation of the 'NisNetgroup' model. Defines an NIS Netgroup. Attributes: description (string): Description of the netgroup. domain (string): Specifies the domain of the netgroup. name (string): Specifies the name of the netgroup. nfs_access (NfsAccessEnum): Specifies whether clients fro...
the_stack_v2_python_sparse
cohesity_management_sdk/models/nis_netgroup.py
cohesity/management-sdk-python
train
24
87368b51c1f1784b15294fe42a4709ef0866ee44
[ "self.verbose = set_or_default(verbose, VERBOSE)\n'If ``True`` return verbose results.'\nself.fatal = set_or_default(fatal, FATAL)\n'If ``True``, die on test failure'\nself.passing = set_or_default(passing, PASSING)\n'If ``True`` attempt to return passing test cases.'\nself.results = {}\n'Dict that represents the r...
<|body_start_0|> self.verbose = set_or_default(verbose, VERBOSE) 'If ``True`` return verbose results.' self.fatal = set_or_default(fatal, FATAL) 'If ``True``, die on test failure' self.passing = set_or_default(passing, PASSING) 'If ``True`` attempt to return passing test ...
DtfResults
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DtfResults: def __init__(self, verbose=None, fatal=None, passing=None): """An interface to capture and report results from DtfCases.""" <|body_0|> def add(self, name, result, msg): """:param string name: The name of the test. :param bool result: ``True`` if the test ...
stack_v2_sparse_classes_10k_train_004922
4,828
permissive
[ { "docstring": "An interface to capture and report results from DtfCases.", "name": "__init__", "signature": "def __init__(self, verbose=None, fatal=None, passing=None)" }, { "docstring": ":param string name: The name of the test. :param bool result: ``True`` if the test passed, and ``False`` if...
6
stack_v2_sparse_classes_30k_train_000204
Implement the Python class `DtfResults` described below. Class description: Implement the DtfResults class. Method signatures and docstrings: - def __init__(self, verbose=None, fatal=None, passing=None): An interface to capture and report results from DtfCases. - def add(self, name, result, msg): :param string name: ...
Implement the Python class `DtfResults` described below. Class description: Implement the DtfResults class. Method signatures and docstrings: - def __init__(self, verbose=None, fatal=None, passing=None): An interface to capture and report results from DtfCases. - def add(self, name, result, msg): :param string name: ...
34bb5b5e0fcc986e923bd20102faeddf96437508
<|skeleton|> class DtfResults: def __init__(self, verbose=None, fatal=None, passing=None): """An interface to capture and report results from DtfCases.""" <|body_0|> def add(self, name, result, msg): """:param string name: The name of the test. :param bool result: ``True`` if the test ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DtfResults: def __init__(self, verbose=None, fatal=None, passing=None): """An interface to capture and report results from DtfCases.""" self.verbose = set_or_default(verbose, VERBOSE) 'If ``True`` return verbose results.' self.fatal = set_or_default(fatal, FATAL) 'If ``...
the_stack_v2_python_sparse
dtf/results.py
tychoish/dtf
train
0
7d36c52ee93cdceb413da17b691a813df91ae5c7
[ "self.settings = ai_game.settings\nfilname = 'highscore.txt'\nwith open(filname, 'r') as objects:\n num = objects.read()\nself.high_score = int(num)\nself.reset_stats()\nself.game_active = False", "self.ship_left = self.settings.ship_limit\nself.score = 0\nself.level = 1" ]
<|body_start_0|> self.settings = ai_game.settings filname = 'highscore.txt' with open(filname, 'r') as objects: num = objects.read() self.high_score = int(num) self.reset_stats() self.game_active = False <|end_body_0|> <|body_start_1|> self.ship_left ...
Track statistics for Alien Invasion.
GameStats
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GameStats: """Track statistics for Alien Invasion.""" def __init__(self, ai_game): """Initilaze statistics.""" <|body_0|> def reset_stats(self): """Initilize stastics that can change during the game.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_004923
690
no_license
[ { "docstring": "Initilaze statistics.", "name": "__init__", "signature": "def __init__(self, ai_game)" }, { "docstring": "Initilize stastics that can change during the game.", "name": "reset_stats", "signature": "def reset_stats(self)" } ]
2
stack_v2_sparse_classes_30k_train_003693
Implement the Python class `GameStats` described below. Class description: Track statistics for Alien Invasion. Method signatures and docstrings: - def __init__(self, ai_game): Initilaze statistics. - def reset_stats(self): Initilize stastics that can change during the game.
Implement the Python class `GameStats` described below. Class description: Track statistics for Alien Invasion. Method signatures and docstrings: - def __init__(self, ai_game): Initilaze statistics. - def reset_stats(self): Initilize stastics that can change during the game. <|skeleton|> class GameStats: """Trac...
eb40f515564fe781eaaf5202165e06be6b22b34d
<|skeleton|> class GameStats: """Track statistics for Alien Invasion.""" def __init__(self, ai_game): """Initilaze statistics.""" <|body_0|> def reset_stats(self): """Initilize stastics that can change during the game.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GameStats: """Track statistics for Alien Invasion.""" def __init__(self, ai_game): """Initilaze statistics.""" self.settings = ai_game.settings filname = 'highscore.txt' with open(filname, 'r') as objects: num = objects.read() self.high_score = int(num)...
the_stack_v2_python_sparse
SidewaysShooter/game_stats.py
noshah/Python_Practice
train
0
01937a48602655b93701941497a9605e4d6d02e1
[ "fsm = cls.FSM[operator_type]\nnext_state_info = fsm.get((current_status, event), None)\nreturn next_state_info", "if current_status is None:\n current_status = shop.status if shop.status else cls.STATUS_INIT\nnext_state = cls.get_next_state(operator_type, current_status, event)\nnext_status = next_state['next...
<|body_start_0|> fsm = cls.FSM[operator_type] next_state_info = fsm.get((current_status, event), None) return next_state_info <|end_body_0|> <|body_start_1|> if current_status is None: current_status = shop.status if shop.status else cls.STATUS_INIT next_state = cls....
商户有限状态机
ShopFSM
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShopFSM: """商户有限状态机""" def get_next_state(cls, operator_type, current_status, event): """获取下一状态 :param operator_type: 'OUTSIDE'/'FE_INSIDE' :param current_status: 当前状态 :param event: 条件 :return: 如果返回None表示错误状态或条件""" <|body_0|> def update_status(cls, operator_type, shop, e...
stack_v2_sparse_classes_10k_train_004924
6,677
permissive
[ { "docstring": "获取下一状态 :param operator_type: 'OUTSIDE'/'FE_INSIDE' :param current_status: 当前状态 :param event: 条件 :return: 如果返回None表示错误状态或条件", "name": "get_next_state", "signature": "def get_next_state(cls, operator_type, current_status, event)" }, { "docstring": "更新对象的状态 :param operator_type: 'OU...
2
null
Implement the Python class `ShopFSM` described below. Class description: 商户有限状态机 Method signatures and docstrings: - def get_next_state(cls, operator_type, current_status, event): 获取下一状态 :param operator_type: 'OUTSIDE'/'FE_INSIDE' :param current_status: 当前状态 :param event: 条件 :return: 如果返回None表示错误状态或条件 - def update_st...
Implement the Python class `ShopFSM` described below. Class description: 商户有限状态机 Method signatures and docstrings: - def get_next_state(cls, operator_type, current_status, event): 获取下一状态 :param operator_type: 'OUTSIDE'/'FE_INSIDE' :param current_status: 当前状态 :param event: 条件 :return: 如果返回None表示错误状态或条件 - def update_st...
a7c9567975b5372b2edabddb0fec8d73bc01c3dc
<|skeleton|> class ShopFSM: """商户有限状态机""" def get_next_state(cls, operator_type, current_status, event): """获取下一状态 :param operator_type: 'OUTSIDE'/'FE_INSIDE' :param current_status: 当前状态 :param event: 条件 :return: 如果返回None表示错误状态或条件""" <|body_0|> def update_status(cls, operator_type, shop, e...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ShopFSM: """商户有限状态机""" def get_next_state(cls, operator_type, current_status, event): """获取下一状态 :param operator_type: 'OUTSIDE'/'FE_INSIDE' :param current_status: 当前状态 :param event: 条件 :return: 如果返回None表示错误状态或条件""" fsm = cls.FSM[operator_type] next_state_info = fsm.get((current_st...
the_stack_v2_python_sparse
Dispatcher/data_and_service/shop/model_logics/fsm.py
cash2one/Logistics
train
0
243b4a17e32fcf653187c6bc45f397e5bf1a89e6
[ "super(FlowData, self).__init__()\nself.filename_flow = 'trash can flow meter.xls'\nself.start_rowx = 2\nself.end_rowx = 17\nself.poly_order = 2\nself.trash_volume = 0.0776\nself.P = 100.0", "worksheet = xlrd.open_workbook(filename=self.filename_flow).sheet_by_index(0)\nself.corrected_reading = np.array(worksheet...
<|body_start_0|> super(FlowData, self).__init__() self.filename_flow = 'trash can flow meter.xls' self.start_rowx = 2 self.end_rowx = 17 self.poly_order = 2 self.trash_volume = 0.0776 self.P = 100.0 <|end_body_0|> <|body_start_1|> worksheet = xlrd.open_wo...
Class for handling flow rate and pressure drop data.
FlowData
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FlowData: """Class for handling flow rate and pressure drop data.""" def __init__(self): """Sets default file name, start row, and end row.""" <|body_0|> def import_flow_data(self): """Imports data and stores it in numpy arrays.""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_10k_train_004925
7,912
no_license
[ { "docstring": "Sets default file name, start row, and end row.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Imports data and stores it in numpy arrays.", "name": "import_flow_data", "signature": "def import_flow_data(self)" } ]
2
stack_v2_sparse_classes_30k_train_003387
Implement the Python class `FlowData` described below. Class description: Class for handling flow rate and pressure drop data. Method signatures and docstrings: - def __init__(self): Sets default file name, start row, and end row. - def import_flow_data(self): Imports data and stores it in numpy arrays.
Implement the Python class `FlowData` described below. Class description: Class for handling flow rate and pressure drop data. Method signatures and docstrings: - def __init__(self): Sets default file name, start row, and end row. - def import_flow_data(self): Imports data and stores it in numpy arrays. <|skeleton|>...
d619b66b1f16557e06c94eee1c16d4ee2a9e896a
<|skeleton|> class FlowData: """Class for handling flow rate and pressure drop data.""" def __init__(self): """Sets default file name, start row, and end row.""" <|body_0|> def import_flow_data(self): """Imports data and stores it in numpy arrays.""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FlowData: """Class for handling flow rate and pressure drop data.""" def __init__(self): """Sets default file name, start row, and end row.""" super(FlowData, self).__init__() self.filename_flow = 'trash can flow meter.xls' self.start_rowx = 2 self.end_rowx = 17 ...
the_stack_v2_python_sparse
exp_data.py
hfateh/TE_Model-1
train
0
4eca387528e53aa20835173db4bbc588aa27c96d
[ "super().__init__()\nself.attn = attn\nself.ffn = ffn\nself.skiplayers = clones(SkipLayer(ffn.d, drop), 2)\nself.d = ffn.d", "x = self.skiplayers[0](x, lambda x: self.attn(x, x, x, mask))\nx = self.skiplayers[1](x, self.ffn)\nreturn x" ]
<|body_start_0|> super().__init__() self.attn = attn self.ffn = ffn self.skiplayers = clones(SkipLayer(ffn.d, drop), 2) self.d = ffn.d <|end_body_0|> <|body_start_1|> x = self.skiplayers[0](x, lambda x: self.attn(x, x, x, mask)) x = self.skiplayers[1](x, self.ffn...
EncoderLayer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncoderLayer: def __init__(self, attn, ffn, drop): """attn:MultiAttentionLayer ffn:feed forward Layer drop:drop factor for skip connection""" <|body_0|> def forward(self, x, mask): """x:(N,T,D) mask:(N,1,T) return:(N,T,D)""" <|body_1|> <|end_skeleton|> <|bo...
stack_v2_sparse_classes_10k_train_004926
11,927
no_license
[ { "docstring": "attn:MultiAttentionLayer ffn:feed forward Layer drop:drop factor for skip connection", "name": "__init__", "signature": "def __init__(self, attn, ffn, drop)" }, { "docstring": "x:(N,T,D) mask:(N,1,T) return:(N,T,D)", "name": "forward", "signature": "def forward(self, x, m...
2
stack_v2_sparse_classes_30k_train_003220
Implement the Python class `EncoderLayer` described below. Class description: Implement the EncoderLayer class. Method signatures and docstrings: - def __init__(self, attn, ffn, drop): attn:MultiAttentionLayer ffn:feed forward Layer drop:drop factor for skip connection - def forward(self, x, mask): x:(N,T,D) mask:(N,...
Implement the Python class `EncoderLayer` described below. Class description: Implement the EncoderLayer class. Method signatures and docstrings: - def __init__(self, attn, ffn, drop): attn:MultiAttentionLayer ffn:feed forward Layer drop:drop factor for skip connection - def forward(self, x, mask): x:(N,T,D) mask:(N,...
24e60f24b6e442db22507adddd6bf3e2c343c013
<|skeleton|> class EncoderLayer: def __init__(self, attn, ffn, drop): """attn:MultiAttentionLayer ffn:feed forward Layer drop:drop factor for skip connection""" <|body_0|> def forward(self, x, mask): """x:(N,T,D) mask:(N,1,T) return:(N,T,D)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EncoderLayer: def __init__(self, attn, ffn, drop): """attn:MultiAttentionLayer ffn:feed forward Layer drop:drop factor for skip connection""" super().__init__() self.attn = attn self.ffn = ffn self.skiplayers = clones(SkipLayer(ffn.d, drop), 2) self.d = ffn.d ...
the_stack_v2_python_sparse
daily/8/pytorch_tutoral/nmt/model.py
mckjzhangxk/deepAI
train
1
04ab08ce29e6f248d90c5dd862be84a028191e39
[ "try:\n return Vrf.objects.filter(id=id_vrf).uniqueResult()\nexcept ObjectDoesNotExist as e:\n raise VrfNotFoundError(u'Vrf id = %s does not exist.' % id_vrf)\nexcept OperationalError as e:\n cls.log.error(u'Lock wait timeout exceeded.')\n raise OperationalError(u'Lock wait timeout exceeded; try restart...
<|body_start_0|> try: return Vrf.objects.filter(id=id_vrf).uniqueResult() except ObjectDoesNotExist as e: raise VrfNotFoundError(u'Vrf id = %s does not exist.' % id_vrf) except OperationalError as e: cls.log.error(u'Lock wait timeout exceeded.') ra...
Vrf
[ "Apache-2.0", "BSD-3-Clause", "MIT", "LicenseRef-scancode-public-domain", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Vrf: def get_by_pk(cls, id_vrf): """Get Vrf by id. @return: Vrf. @raise VrfNotFoundError: Vrf is not registered. @raise VrfError: Failed to search for the Vrf. @raise OperationalError: Lock wait timeout exceed""" <|body_0|> def create(self, authenticated_user): """In...
stack_v2_sparse_classes_10k_train_004927
5,338
permissive
[ { "docstring": "Get Vrf by id. @return: Vrf. @raise VrfNotFoundError: Vrf is not registered. @raise VrfError: Failed to search for the Vrf. @raise OperationalError: Lock wait timeout exceed", "name": "get_by_pk", "signature": "def get_by_pk(cls, id_vrf)" }, { "docstring": "Include new Vrf. @retu...
4
null
Implement the Python class `Vrf` described below. Class description: Implement the Vrf class. Method signatures and docstrings: - def get_by_pk(cls, id_vrf): Get Vrf by id. @return: Vrf. @raise VrfNotFoundError: Vrf is not registered. @raise VrfError: Failed to search for the Vrf. @raise OperationalError: Lock wait t...
Implement the Python class `Vrf` described below. Class description: Implement the Vrf class. Method signatures and docstrings: - def get_by_pk(cls, id_vrf): Get Vrf by id. @return: Vrf. @raise VrfNotFoundError: Vrf is not registered. @raise VrfError: Failed to search for the Vrf. @raise OperationalError: Lock wait t...
eb27e1d977a1c4bb1fee8fb51b8d8050c64696d9
<|skeleton|> class Vrf: def get_by_pk(cls, id_vrf): """Get Vrf by id. @return: Vrf. @raise VrfNotFoundError: Vrf is not registered. @raise VrfError: Failed to search for the Vrf. @raise OperationalError: Lock wait timeout exceed""" <|body_0|> def create(self, authenticated_user): """In...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Vrf: def get_by_pk(cls, id_vrf): """Get Vrf by id. @return: Vrf. @raise VrfNotFoundError: Vrf is not registered. @raise VrfError: Failed to search for the Vrf. @raise OperationalError: Lock wait timeout exceed""" try: return Vrf.objects.filter(id=id_vrf).uniqueResult() exce...
the_stack_v2_python_sparse
networkapi/api_vrf/models.py
globocom/GloboNetworkAPI
train
86
bf2f829c85d143ecb2efc1d2f3c5bf88e7f54b82
[ "self.instr = Instructions(reg, mem, alu)\nself.mem = mem\nself.reg = reg\nself.op_codes = {}\nself.op_codes[1] = self.instr.halt\nself.op_codes[32] = self.instr.add\nself.op_codes[33] = self.instr.lda\nself.op_codes[34] = self.instr.sta\nself.op_codes[35] = self.instr.jmp\nself.op_codes[36] = self.instr.sza\nself....
<|body_start_0|> self.instr = Instructions(reg, mem, alu) self.mem = mem self.reg = reg self.op_codes = {} self.op_codes[1] = self.instr.halt self.op_codes[32] = self.instr.add self.op_codes[33] = self.instr.lda self.op_codes[34] = self.instr.sta s...
Decode op codes into instructions.
Decoder
[ "Artistic-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Decoder: """Decode op codes into instructions.""" def __init__(self, reg, mem, alu): """Create the op code instruction map.""" <|body_0|> def fetch_execute(self): """The fetch execute cycle. Fetch the next instruction and the value of the address following it. Th...
stack_v2_sparse_classes_10k_train_004928
5,867
permissive
[ { "docstring": "Create the op code instruction map.", "name": "__init__", "signature": "def __init__(self, reg, mem, alu)" }, { "docstring": "The fetch execute cycle. Fetch the next instruction and the value of the address following it. That value, typically an address itself, is passed to the i...
2
stack_v2_sparse_classes_30k_train_006562
Implement the Python class `Decoder` described below. Class description: Decode op codes into instructions. Method signatures and docstrings: - def __init__(self, reg, mem, alu): Create the op code instruction map. - def fetch_execute(self): The fetch execute cycle. Fetch the next instruction and the value of the add...
Implement the Python class `Decoder` described below. Class description: Decode op codes into instructions. Method signatures and docstrings: - def __init__(self, reg, mem, alu): Create the op code instruction map. - def fetch_execute(self): The fetch execute cycle. Fetch the next instruction and the value of the add...
75997d72ceefdc35fd3c76fe50676626cb2be887
<|skeleton|> class Decoder: """Decode op codes into instructions.""" def __init__(self, reg, mem, alu): """Create the op code instruction map.""" <|body_0|> def fetch_execute(self): """The fetch execute cycle. Fetch the next instruction and the value of the address following it. Th...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Decoder: """Decode op codes into instructions.""" def __init__(self, reg, mem, alu): """Create the op code instruction map.""" self.instr = Instructions(reg, mem, alu) self.mem = mem self.reg = reg self.op_codes = {} self.op_codes[1] = self.instr.halt ...
the_stack_v2_python_sparse
decoder.py
kmggh/python-simple-machine
train
0
ca7b7dd63bafccdf224096b922a3730f1d50aa78
[ "data = KlifsToKissimData.from_structure_klifs_id(structure_klifs_id, klifs_session)\nif data is None:\n logger.warning(f'{structure_klifs_id}: Empty fingerprint (data unaccessible).')\n fingerprint = None\nelse:\n fingerprint = cls.from_text(data.text, data.extension, data.residue_ids, data.residue_ixs, d...
<|body_start_0|> data = KlifsToKissimData.from_structure_klifs_id(structure_klifs_id, klifs_session) if data is None: logger.warning(f'{structure_klifs_id}: Empty fingerprint (data unaccessible).') fingerprint = None else: fingerprint = cls.from_text(data.text...
Fingerprint
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Fingerprint: def from_structure_klifs_id(cls, structure_klifs_id, klifs_session=None): """Calculate fingerprint for a KLIFS structure (by structure KLIFS ID). Parameters ---------- structure_klifs_id : int Structure KLIFS ID. klifs_session : opencadd.databases.klifs.session.Session or No...
stack_v2_sparse_classes_10k_train_004929
5,476
permissive
[ { "docstring": "Calculate fingerprint for a KLIFS structure (by structure KLIFS ID). Parameters ---------- structure_klifs_id : int Structure KLIFS ID. klifs_session : opencadd.databases.klifs.session.Session or None Local or remote KLIFS session. If None (default), set up remote KLIFS session. Returns ------- ...
4
stack_v2_sparse_classes_30k_train_006088
Implement the Python class `Fingerprint` described below. Class description: Implement the Fingerprint class. Method signatures and docstrings: - def from_structure_klifs_id(cls, structure_klifs_id, klifs_session=None): Calculate fingerprint for a KLIFS structure (by structure KLIFS ID). Parameters ---------- structu...
Implement the Python class `Fingerprint` described below. Class description: Implement the Fingerprint class. Method signatures and docstrings: - def from_structure_klifs_id(cls, structure_klifs_id, klifs_session=None): Calculate fingerprint for a KLIFS structure (by structure KLIFS ID). Parameters ---------- structu...
8433bb64062ed785503b96b52f39bbdb02f66381
<|skeleton|> class Fingerprint: def from_structure_klifs_id(cls, structure_klifs_id, klifs_session=None): """Calculate fingerprint for a KLIFS structure (by structure KLIFS ID). Parameters ---------- structure_klifs_id : int Structure KLIFS ID. klifs_session : opencadd.databases.klifs.session.Session or No...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Fingerprint: def from_structure_klifs_id(cls, structure_klifs_id, klifs_session=None): """Calculate fingerprint for a KLIFS structure (by structure KLIFS ID). Parameters ---------- structure_klifs_id : int Structure KLIFS ID. klifs_session : opencadd.databases.klifs.session.Session or None Local or re...
the_stack_v2_python_sparse
kissim/encoding/fingerprint.py
volkamerlab/kissim
train
26
3911d2285a9a7b9710305824fe2e8f31e4dddad3
[ "self._file: Path = file_path\nself._schema: vol.Schema = schema\nself._data: dict[str, Any] = _DEFAULT\nself.read_data()", "try:\n self._data = self._schema(_DEFAULT)\nexcept vol.Invalid as ex:\n _LOGGER.error(\"Can't reset %s: %s\", self._file, humanize_error(self._data, ex))\nelse:\n self.save_data()"...
<|body_start_0|> self._file: Path = file_path self._schema: vol.Schema = schema self._data: dict[str, Any] = _DEFAULT self.read_data() <|end_body_0|> <|body_start_1|> try: self._data = self._schema(_DEFAULT) except vol.Invalid as ex: _LOGGER.error...
Baseclass for classes that uses configuration files, the files can be JSON/YAML.
FileConfiguration
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileConfiguration: """Baseclass for classes that uses configuration files, the files can be JSON/YAML.""" def __init__(self, file_path: Path, schema: vol.Schema): """Initialize hass object.""" <|body_0|> def reset_data(self) -> None: """Reset configuration to def...
stack_v2_sparse_classes_10k_train_004930
3,335
permissive
[ { "docstring": "Initialize hass object.", "name": "__init__", "signature": "def __init__(self, file_path: Path, schema: vol.Schema)" }, { "docstring": "Reset configuration to default.", "name": "reset_data", "signature": "def reset_data(self) -> None" }, { "docstring": "Read conf...
4
stack_v2_sparse_classes_30k_train_001472
Implement the Python class `FileConfiguration` described below. Class description: Baseclass for classes that uses configuration files, the files can be JSON/YAML. Method signatures and docstrings: - def __init__(self, file_path: Path, schema: vol.Schema): Initialize hass object. - def reset_data(self) -> None: Reset...
Implement the Python class `FileConfiguration` described below. Class description: Baseclass for classes that uses configuration files, the files can be JSON/YAML. Method signatures and docstrings: - def __init__(self, file_path: Path, schema: vol.Schema): Initialize hass object. - def reset_data(self) -> None: Reset...
4838b280adafed0997f32e021274b531178386cd
<|skeleton|> class FileConfiguration: """Baseclass for classes that uses configuration files, the files can be JSON/YAML.""" def __init__(self, file_path: Path, schema: vol.Schema): """Initialize hass object.""" <|body_0|> def reset_data(self) -> None: """Reset configuration to def...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FileConfiguration: """Baseclass for classes that uses configuration files, the files can be JSON/YAML.""" def __init__(self, file_path: Path, schema: vol.Schema): """Initialize hass object.""" self._file: Path = file_path self._schema: vol.Schema = schema self._data: dict[...
the_stack_v2_python_sparse
supervisor/utils/common.py
home-assistant/supervisor
train
928
dde40df29d623461c39f0e99caace39934694631
[ "if nums is None or len(nums) <= 0:\n return 0\nl = len(nums)\nprev = 0\ncur = 0\nmax_value = -1 * 2 ** 31\nfor i in range(1, l + 1):\n for j in range(i, l + 1):\n if i == j:\n cur = nums[j - 1]\n prev = nums[j - 1]\n else:\n cur = prev + nums[j - 1]\n ...
<|body_start_0|> if nums is None or len(nums) <= 0: return 0 l = len(nums) prev = 0 cur = 0 max_value = -1 * 2 ** 31 for i in range(1, l + 1): for j in range(i, l + 1): if i == j: cur = nums[j - 1] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxSubArray_bak(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def maxSubArray(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if nums is None or len(nums) <= 0: ...
stack_v2_sparse_classes_10k_train_004931
1,945
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "maxSubArray_bak", "signature": "def maxSubArray_bak(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "maxSubArray", "signature": "def maxSubArray(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_000927
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray_bak(self, nums): :type nums: List[int] :rtype: int - def maxSubArray(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 maxSubArray_bak(self, nums): :type nums: List[int] :rtype: int - def maxSubArray(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def maxSubA...
aa1d6677a89f15141a615d6d6151b09bcb825397
<|skeleton|> class Solution: def maxSubArray_bak(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def maxSubArray(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 maxSubArray_bak(self, nums): """:type nums: List[int] :rtype: int""" if nums is None or len(nums) <= 0: return 0 l = len(nums) prev = 0 cur = 0 max_value = -1 * 2 ** 31 for i in range(1, l + 1): for j in range(i, l +...
the_stack_v2_python_sparse
leetcode/dp/max_subarray.py
shubham166/Competitive_Programming
train
0
76636a1200484ae7d2ef3113785f4f033cdaf370
[ "links = response.xpath('//a[@class=\"product-title-link\"]/@href').extract()\nfor link in links:\n yield response.follow('https://www.labirint.ru' + link, callback=self.parse_item)\nnext_page = response.xpath('//a[@class=\"pagination-next__text\"]/@href').extract_first()\nif next_page:\n yield response.follo...
<|body_start_0|> links = response.xpath('//a[@class="product-title-link"]/@href').extract() for link in links: yield response.follow('https://www.labirint.ru' + link, callback=self.parse_item) next_page = response.xpath('//a[@class="pagination-next__text"]/@href').extract_first() ...
Labirint.ru spider.
LabirintruSpider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LabirintruSpider: """Labirint.ru spider.""" def parse(self, response): """Novelty page parser.""" <|body_0|> def parse_item(self, response: HtmlResponse): """Book item parser.""" <|body_1|> <|end_skeleton|> <|body_start_0|> links = response.xpat...
stack_v2_sparse_classes_10k_train_004932
1,756
no_license
[ { "docstring": "Novelty page parser.", "name": "parse", "signature": "def parse(self, response)" }, { "docstring": "Book item parser.", "name": "parse_item", "signature": "def parse_item(self, response: HtmlResponse)" } ]
2
stack_v2_sparse_classes_30k_train_005094
Implement the Python class `LabirintruSpider` described below. Class description: Labirint.ru spider. Method signatures and docstrings: - def parse(self, response): Novelty page parser. - def parse_item(self, response: HtmlResponse): Book item parser.
Implement the Python class `LabirintruSpider` described below. Class description: Labirint.ru spider. Method signatures and docstrings: - def parse(self, response): Novelty page parser. - def parse_item(self, response: HtmlResponse): Book item parser. <|skeleton|> class LabirintruSpider: """Labirint.ru spider.""...
69488f0e788578722bf4f1cf171508f1e5624145
<|skeleton|> class LabirintruSpider: """Labirint.ru spider.""" def parse(self, response): """Novelty page parser.""" <|body_0|> def parse_item(self, response: HtmlResponse): """Book item parser.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LabirintruSpider: """Labirint.ru spider.""" def parse(self, response): """Novelty page parser.""" links = response.xpath('//a[@class="product-title-link"]/@href').extract() for link in links: yield response.follow('https://www.labirint.ru' + link, callback=self.parse_i...
the_stack_v2_python_sparse
lesson_6/bookparser/spiders/labirintru.py
IInvasion/collecting_and_processing_web_data
train
0
3e5e6b59f567da9d7ac620a18efbb25eaa2b2054
[ "len_nums = len(nums)\nif len_nums <= 1:\n return 0\np = 0\nstep = 0\nwhile p < len_nums:\n c_v = nums[p]\n temp_dict = dict()\n for i in range(1, c_v + 1):\n if p + i < len_nums:\n temp_dict[p + i + nums[p + i]] = p + i\n if p + i == len_nums - 1:\n return st...
<|body_start_0|> len_nums = len(nums) if len_nums <= 1: return 0 p = 0 step = 0 while p < len_nums: c_v = nums[p] temp_dict = dict() for i in range(1, c_v + 1): if p + i < len_nums: temp_dict[p + ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def jump(self, nums: List[int]) -> int: """贪心算法 :param nums: :return:""" <|body_0|> def jump2(self, nums: List[int]) -> int: """递归,遍历所有可能性 :param nums: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> len_nums = len(nums) i...
stack_v2_sparse_classes_10k_train_004933
4,406
no_license
[ { "docstring": "贪心算法 :param nums: :return:", "name": "jump", "signature": "def jump(self, nums: List[int]) -> int" }, { "docstring": "递归,遍历所有可能性 :param nums: :return:", "name": "jump2", "signature": "def jump2(self, nums: List[int]) -> int" } ]
2
stack_v2_sparse_classes_30k_val_000131
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def jump(self, nums: List[int]) -> int: 贪心算法 :param nums: :return: - def jump2(self, nums: List[int]) -> int: 递归,遍历所有可能性 :param nums: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def jump(self, nums: List[int]) -> int: 贪心算法 :param nums: :return: - def jump2(self, nums: List[int]) -> int: 递归,遍历所有可能性 :param nums: :return: <|skeleton|> class Solution: ...
bbcb7c3c9aa51141695d73b90bf8f04c794be131
<|skeleton|> class Solution: def jump(self, nums: List[int]) -> int: """贪心算法 :param nums: :return:""" <|body_0|> def jump2(self, nums: List[int]) -> int: """递归,遍历所有可能性 :param nums: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def jump(self, nums: List[int]) -> int: """贪心算法 :param nums: :return:""" len_nums = len(nums) if len_nums <= 1: return 0 p = 0 step = 0 while p < len_nums: c_v = nums[p] temp_dict = dict() for i in range(...
the_stack_v2_python_sparse
00001_00100/00045_跳跃游戏II.py
xiphodon/leetcode_studio
train
1
da9c15c98e48592ce33e686931d10fe18c2bd657
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn UnifiedRoleManagementPolicyEnablementRule()", "from .unified_role_management_policy_rule import UnifiedRoleManagementPolicyRule\nfrom .unified_role_management_policy_rule import UnifiedRoleManagementPolicyRule\nfields: Dict[str, Callab...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return UnifiedRoleManagementPolicyEnablementRule() <|end_body_0|> <|body_start_1|> from .unified_role_management_policy_rule import UnifiedRoleManagementPolicyRule from .unified_role_management...
UnifiedRoleManagementPolicyEnablementRule
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UnifiedRoleManagementPolicyEnablementRule: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UnifiedRoleManagementPolicyEnablementRule: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to re...
stack_v2_sparse_classes_10k_train_004934
2,533
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: UnifiedRoleManagementPolicyEnablementRule", "name": "create_from_discriminator_value", "signature": "def cre...
3
null
Implement the Python class `UnifiedRoleManagementPolicyEnablementRule` described below. Class description: Implement the UnifiedRoleManagementPolicyEnablementRule class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UnifiedRoleManagementPolicyEnableme...
Implement the Python class `UnifiedRoleManagementPolicyEnablementRule` described below. Class description: Implement the UnifiedRoleManagementPolicyEnablementRule class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UnifiedRoleManagementPolicyEnableme...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class UnifiedRoleManagementPolicyEnablementRule: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UnifiedRoleManagementPolicyEnablementRule: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to re...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UnifiedRoleManagementPolicyEnablementRule: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UnifiedRoleManagementPolicyEnablementRule: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discrim...
the_stack_v2_python_sparse
msgraph/generated/models/unified_role_management_policy_enablement_rule.py
microsoftgraph/msgraph-sdk-python
train
135
1d0d0fc24cfca0022dbda83b86f6cb95ae3b2a78
[ "self.message_handlers = [[] for i in range(self.NUMBER_OF_MESSAGE_TYPES)]\nself.lock = threading.Lock()\nself.logger = Logger().getLogger('backend.core.MessageBus')", "if isinstance(message_handler, MessageHandler):\n for key in message_priority_list:\n rule = (message_priority_list[key], message_handl...
<|body_start_0|> self.message_handlers = [[] for i in range(self.NUMBER_OF_MESSAGE_TYPES)] self.lock = threading.Lock() self.logger = Logger().getLogger('backend.core.MessageBus') <|end_body_0|> <|body_start_1|> if isinstance(message_handler, MessageHandler): for key in mess...
MessageBus is the heart of the backend messaging system. Almost all communication between components goes through this MessageBus. Components communicate with Messages, which are delivered to MessageHandlers via MessageBus. MessageBus knows which MessageHandlers are interested in which type of Messages. MessageBus is a...
MessageBus
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MessageBus: """MessageBus is the heart of the backend messaging system. Almost all communication between components goes through this MessageBus. Components communicate with Messages, which are delivered to MessageHandlers via MessageBus. MessageBus knows which MessageHandlers are interested in w...
stack_v2_sparse_classes_10k_train_004935
4,666
no_license
[ { "docstring": "Create a new MessageBus object.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Register a new MessageHandler to this MessageBus @param message_handler: MessageHandler object @param message_priority_list: Priority list for this MessageHandler", "nam...
4
stack_v2_sparse_classes_30k_train_003797
Implement the Python class `MessageBus` described below. Class description: MessageBus is the heart of the backend messaging system. Almost all communication between components goes through this MessageBus. Components communicate with Messages, which are delivered to MessageHandlers via MessageBus. MessageBus knows wh...
Implement the Python class `MessageBus` described below. Class description: MessageBus is the heart of the backend messaging system. Almost all communication between components goes through this MessageBus. Components communicate with Messages, which are delivered to MessageHandlers via MessageBus. MessageBus knows wh...
945463032481c3afdef56d0ef9f5be102829eb35
<|skeleton|> class MessageBus: """MessageBus is the heart of the backend messaging system. Almost all communication between components goes through this MessageBus. Components communicate with Messages, which are delivered to MessageHandlers via MessageBus. MessageBus knows which MessageHandlers are interested in w...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MessageBus: """MessageBus is the heart of the backend messaging system. Almost all communication between components goes through this MessageBus. Components communicate with Messages, which are delivered to MessageHandlers via MessageBus. MessageBus knows which MessageHandlers are interested in which type of ...
the_stack_v2_python_sparse
entertainerlib/backend/core/message_bus.py
tiwilliam/entertainer
train
0
10a2e03965397bb9d9cee9f675f7b95e49ece52e
[ "self.max_frames = max_frames\nself.sink = sink\nself.pipelines = pipelines\nself.name = name\nself.count = 0\nself.payload = b''", "self.count += 1\nself.payload += data\ndebug('BufferedPipe count: {}, max frames: {}'.format(self.count, self.max_frames))\nif self.count == self.max_frames:\n debug('BufferedPip...
<|body_start_0|> self.max_frames = max_frames self.sink = sink self.pipelines = pipelines self.name = name self.count = 0 self.payload = b'' <|end_body_0|> <|body_start_1|> self.count += 1 self.payload += data debug('BufferedPipe count: {}, max fr...
BufferedPipe
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BufferedPipe: def __init__(self, max_frames: int, sink, pipelines: list, name: str=None): """Create a buffer which will call the provided `sink` when full. It will call `sink` with the number of frames and the accumulated bytes when it reaches `max_buffer_size` frames. pass list of `pipe...
stack_v2_sparse_classes_10k_train_004936
1,348
no_license
[ { "docstring": "Create a buffer which will call the provided `sink` when full. It will call `sink` with the number of frames and the accumulated bytes when it reaches `max_buffer_size` frames. pass list of `pipelines` as arg to process this buffer using specified pipelines only (not all pipelines)", "name":...
3
stack_v2_sparse_classes_30k_train_001165
Implement the Python class `BufferedPipe` described below. Class description: Implement the BufferedPipe class. Method signatures and docstrings: - def __init__(self, max_frames: int, sink, pipelines: list, name: str=None): Create a buffer which will call the provided `sink` when full. It will call `sink` with the nu...
Implement the Python class `BufferedPipe` described below. Class description: Implement the BufferedPipe class. Method signatures and docstrings: - def __init__(self, max_frames: int, sink, pipelines: list, name: str=None): Create a buffer which will call the provided `sink` when full. It will call `sink` with the nu...
bc81942cf8fea5e4cb127117f9e76577910c1a3d
<|skeleton|> class BufferedPipe: def __init__(self, max_frames: int, sink, pipelines: list, name: str=None): """Create a buffer which will call the provided `sink` when full. It will call `sink` with the number of frames and the accumulated bytes when it reaches `max_buffer_size` frames. pass list of `pipe...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BufferedPipe: def __init__(self, max_frames: int, sink, pipelines: list, name: str=None): """Create a buffer which will call the provided `sink` when full. It will call `sink` with the number of frames and the accumulated bytes when it reaches `max_buffer_size` frames. pass list of `pipelines` as arg ...
the_stack_v2_python_sparse
lib/BufferedPipe.py
wzulfikar/py-phonic
train
0
d44b0d52e4cfa37e936664595b8a13b265f96a6a
[ "queue = deque([(n, 0)])\nvisited = set()\nwhile queue:\n num, step = queue.popleft()\n remains = [num - n * n for n in range(1, int(num ** 0.5) + 1)]\n for i in remains:\n if i == 0:\n return step + 1\n if i not in visited:\n queue.append((i, step + 1))\n vis...
<|body_start_0|> queue = deque([(n, 0)]) visited = set() while queue: num, step = queue.popleft() remains = [num - n * n for n in range(1, int(num ** 0.5) + 1)] for i in remains: if i == 0: return step + 1 if...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def num_squares(self, n): """:type n: int :rtype: int""" <|body_0|> def num_squares_2(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> queue = deque([(n, 0)]) visited = set() while queue...
stack_v2_sparse_classes_10k_train_004937
1,571
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "num_squares", "signature": "def num_squares(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "num_squares_2", "signature": "def num_squares_2(self, n)" } ]
2
stack_v2_sparse_classes_30k_train_005789
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def num_squares(self, n): :type n: int :rtype: int - def num_squares_2(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 num_squares(self, n): :type n: int :rtype: int - def num_squares_2(self, n): :type n: int :rtype: int <|skeleton|> class Solution: def num_squares(self, n): """...
cc7740026c3774be21ab924b99ae7596ef20d0e4
<|skeleton|> class Solution: def num_squares(self, n): """:type n: int :rtype: int""" <|body_0|> def num_squares_2(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 num_squares(self, n): """:type n: int :rtype: int""" queue = deque([(n, 0)]) visited = set() while queue: num, step = queue.popleft() remains = [num - n * n for n in range(1, int(num ** 0.5) + 1)] for i in remains: ...
the_stack_v2_python_sparse
data_structure/queues_and_stacks/279_num_squares.py
yangtao0304/hands-on-programming-exercise
train
0
cf0f1df8f532da2aefa06001d44d225cb74eaf3a
[ "region_spec = concepts.ResourceSpec('cloudbuild.projects.locations', resource_name='region', projectsId=concepts.DEFAULT_PROJECT_ATTRIBUTE_CONFIG, locationsId=resource_args.RegionAttributeConfig())\nconcept_parsers.ConceptParser.ForResource('--region', region_spec, 'Cloud region', required=True).AddToParser(parser...
<|body_start_0|> region_spec = concepts.ResourceSpec('cloudbuild.projects.locations', resource_name='region', projectsId=concepts.DEFAULT_PROJECT_ATTRIBUTE_CONFIG, locationsId=resource_args.RegionAttributeConfig()) concept_parsers.ConceptParser.ForResource('--region', region_spec, 'Cloud region', requir...
Create a build trigger for a GCB v2 repository.
CreateRepository
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreateRepository: """Create a build trigger for a GCB v2 repository.""" def Args(parser): """Register flags for this command. Args: parser: An argparse.ArgumentParser-like object. It is mocked out in order to capture some information, but behaves like an ArgumentParser.""" <|...
stack_v2_sparse_classes_10k_train_004938
7,136
permissive
[ { "docstring": "Register flags for this command. Args: parser: An argparse.ArgumentParser-like object. It is mocked out in order to capture some information, but behaves like an ArgumentParser.", "name": "Args", "signature": "def Args(parser)" }, { "docstring": "Parses command line arguments int...
3
null
Implement the Python class `CreateRepository` described below. Class description: Create a build trigger for a GCB v2 repository. Method signatures and docstrings: - def Args(parser): Register flags for this command. Args: parser: An argparse.ArgumentParser-like object. It is mocked out in order to capture some infor...
Implement the Python class `CreateRepository` described below. Class description: Create a build trigger for a GCB v2 repository. Method signatures and docstrings: - def Args(parser): Register flags for this command. Args: parser: An argparse.ArgumentParser-like object. It is mocked out in order to capture some infor...
392abf004b16203030e6efd2f0af24db7c8d669e
<|skeleton|> class CreateRepository: """Create a build trigger for a GCB v2 repository.""" def Args(parser): """Register flags for this command. Args: parser: An argparse.ArgumentParser-like object. It is mocked out in order to capture some information, but behaves like an ArgumentParser.""" <|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CreateRepository: """Create a build trigger for a GCB v2 repository.""" def Args(parser): """Register flags for this command. Args: parser: An argparse.ArgumentParser-like object. It is mocked out in order to capture some information, but behaves like an ArgumentParser.""" region_spec = c...
the_stack_v2_python_sparse
lib/surface/builds/triggers/create/repository.py
google-cloud-sdk-unofficial/google-cloud-sdk
train
9
1738ed8d4580f1107dfbee9373698fe766ade0ac
[ "ENFORCER.enforce_call(action='identity:list_project_tags', build_target=_build_project_target_enforcement)\nref = PROVIDERS.resource_api.list_project_tags(project_id)\nreturn self.wrap_member(ref)", "ENFORCER.enforce_call(action='identity:update_project_tags', build_target=_build_project_target_enforcement)\ntag...
<|body_start_0|> ENFORCER.enforce_call(action='identity:list_project_tags', build_target=_build_project_target_enforcement) ref = PROVIDERS.resource_api.list_project_tags(project_id) return self.wrap_member(ref) <|end_body_0|> <|body_start_1|> ENFORCER.enforce_call(action='identity:upda...
ProjectTagsResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProjectTagsResource: def get(self, project_id): """List tags associated with a given project. GET /v3/projects/{project_id}/tags""" <|body_0|> def put(self, project_id): """Update all tags associated with a given project. PUT /v3/projects/{project_id}/tags""" ...
stack_v2_sparse_classes_10k_train_004939
22,149
permissive
[ { "docstring": "List tags associated with a given project. GET /v3/projects/{project_id}/tags", "name": "get", "signature": "def get(self, project_id)" }, { "docstring": "Update all tags associated with a given project. PUT /v3/projects/{project_id}/tags", "name": "put", "signature": "de...
3
stack_v2_sparse_classes_30k_train_002411
Implement the Python class `ProjectTagsResource` described below. Class description: Implement the ProjectTagsResource class. Method signatures and docstrings: - def get(self, project_id): List tags associated with a given project. GET /v3/projects/{project_id}/tags - def put(self, project_id): Update all tags associ...
Implement the Python class `ProjectTagsResource` described below. Class description: Implement the ProjectTagsResource class. Method signatures and docstrings: - def get(self, project_id): List tags associated with a given project. GET /v3/projects/{project_id}/tags - def put(self, project_id): Update all tags associ...
03a0a8146a78682ede9eca12a5a7fdacde2035c8
<|skeleton|> class ProjectTagsResource: def get(self, project_id): """List tags associated with a given project. GET /v3/projects/{project_id}/tags""" <|body_0|> def put(self, project_id): """Update all tags associated with a given project. PUT /v3/projects/{project_id}/tags""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ProjectTagsResource: def get(self, project_id): """List tags associated with a given project. GET /v3/projects/{project_id}/tags""" ENFORCER.enforce_call(action='identity:list_project_tags', build_target=_build_project_target_enforcement) ref = PROVIDERS.resource_api.list_project_tags(...
the_stack_v2_python_sparse
keystone/api/projects.py
sapcc/keystone
train
0
44ee63fa031f015a32b8a8d6083697416065d539
[ "self.destination = destination\nself.from_user_id = from_user_id\nself.to_user_id = to_user_id\nself.project_id = project_id\nself.project_name = project_name\nself.auth_role = auth_role\nself.user_message = user_message\nself.share_user_ids = share_user_ids", "item_id = self.get_existing_item_id(api)\nif not it...
<|body_start_0|> self.destination = destination self.from_user_id = from_user_id self.to_user_id = to_user_id self.project_id = project_id self.project_name = project_name self.auth_role = auth_role self.user_message = user_message self.share_user_ids = sh...
Contains data for processing either share or deliver.
D4S2Item
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class D4S2Item: """Contains data for processing either share or deliver.""" def __init__(self, destination, from_user_id, to_user_id, project_id, project_name, auth_role, user_message, share_user_ids): """Save data for use with send method. :param destination: str type of message we are se...
stack_v2_sparse_classes_10k_train_004940
21,979
permissive
[ { "docstring": "Save data for use with send method. :param destination: str type of message we are sending(SHARE_DESTINATION or DELIVER_DESTINATION) :param from_user_id: str uuid(duke-data-service) of the user who is sending the share/delivery :param to_user_id: str uuid(duke-data-service) of the user is receiv...
4
stack_v2_sparse_classes_30k_train_006759
Implement the Python class `D4S2Item` described below. Class description: Contains data for processing either share or deliver. Method signatures and docstrings: - def __init__(self, destination, from_user_id, to_user_id, project_id, project_name, auth_role, user_message, share_user_ids): Save data for use with send ...
Implement the Python class `D4S2Item` described below. Class description: Contains data for processing either share or deliver. Method signatures and docstrings: - def __init__(self, destination, from_user_id, to_user_id, project_id, project_name, auth_role, user_message, share_user_ids): Save data for use with send ...
0e9d058429de915b8da5afefb21186f6b69cc235
<|skeleton|> class D4S2Item: """Contains data for processing either share or deliver.""" def __init__(self, destination, from_user_id, to_user_id, project_id, project_name, auth_role, user_message, share_user_ids): """Save data for use with send method. :param destination: str type of message we are se...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class D4S2Item: """Contains data for processing either share or deliver.""" def __init__(self, destination, from_user_id, to_user_id, project_id, project_name, auth_role, user_message, share_user_ids): """Save data for use with send method. :param destination: str type of message we are sending(SHARE_D...
the_stack_v2_python_sparse
ddsc/core/d4s2.py
Duke-GCB/DukeDSClient
train
6
350be941f0720ac139c61e422e69aafca0aee117
[ "self.__subscriptions = []\nself.__publisher = None\nself.drop_policy = 'ignore'", "try:\n if isinstance(subscription, Subscription):\n sub = Subscribe(subscription, self.__pool, self.myAddress)\n self.send(self.__pool, sub)\nexcept Exception:\n handle_actor_system_fail()", "try:\n if isi...
<|body_start_0|> self.__subscriptions = [] self.__publisher = None self.drop_policy = 'ignore' <|end_body_0|> <|body_start_1|> try: if isinstance(subscription, Subscription): sub = Subscribe(subscription, self.__pool, self.myAddress) self.send...
Publisher. Publishes messages to subscribers.
Publisher
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Publisher: """Publisher. Publishes messages to subscribers.""" def __init__(self): """Constructor :param router: The router to use. All extend PubSub which is default. :type router: PubSub""" <|body_0|> def subscribe(self, subscription): """Subscribe a subscripti...
stack_v2_sparse_classes_10k_train_004941
3,196
permissive
[ { "docstring": "Constructor :param router: The router to use. All extend PubSub which is default. :type router: PubSub", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Subscribe a subscription actor :param subscription: The subscription to use :type subscription: Subscr...
6
stack_v2_sparse_classes_30k_train_001363
Implement the Python class `Publisher` described below. Class description: Publisher. Publishes messages to subscribers. Method signatures and docstrings: - def __init__(self): Constructor :param router: The router to use. All extend PubSub which is default. :type router: PubSub - def subscribe(self, subscription): S...
Implement the Python class `Publisher` described below. Class description: Publisher. Publishes messages to subscribers. Method signatures and docstrings: - def __init__(self): Constructor :param router: The router to use. All extend PubSub which is default. :type router: PubSub - def subscribe(self, subscription): S...
db93ea9acf58b0da12bcc78ab267e83f3c3c473b
<|skeleton|> class Publisher: """Publisher. Publishes messages to subscribers.""" def __init__(self): """Constructor :param router: The router to use. All extend PubSub which is default. :type router: PubSub""" <|body_0|> def subscribe(self, subscription): """Subscribe a subscripti...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Publisher: """Publisher. Publishes messages to subscribers.""" def __init__(self): """Constructor :param router: The router to use. All extend PubSub which is default. :type router: PubSub""" self.__subscriptions = [] self.__publisher = None self.drop_policy = 'ignore' ...
the_stack_v2_python_sparse
reactive/streams/base_objects/publisher.py
xyicheng/ReactiveThespian
train
0
54478c202509058514035cf7f88d25a00312b5bc
[ "Integrator.setup_integrator(self)\nself.setup_cl(context)\nself.cl_precision = self.particles.get_cl_precision()", "self.context = context\nfor calc in self.calcs:\n calc.setup_cl(context)\nroot = get_pysph_root()\nsrc = cl_read(path.join(root, 'solver/integrator.cl'), self.particles.get_cl_precision())\nself...
<|body_start_0|> Integrator.setup_integrator(self) self.setup_cl(context) self.cl_precision = self.particles.get_cl_precision() <|end_body_0|> <|body_start_1|> self.context = context for calc in self.calcs: calc.setup_cl(context) root = get_pysph_root() ...
CLIntegrator
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CLIntegrator: def setup_integrator(self, context): """Setup the additional particle arrays for integration. Parameters: ----------- context -- the OpenCL context setup_cl on the calcs must be called when all particle properties on the particle array are created. This is important as all ...
stack_v2_sparse_classes_10k_train_004942
9,164
permissive
[ { "docstring": "Setup the additional particle arrays for integration. Parameters: ----------- context -- the OpenCL context setup_cl on the calcs must be called when all particle properties on the particle array are created. This is important as all device buffers will created.", "name": "setup_integrator",...
6
stack_v2_sparse_classes_30k_train_003779
Implement the Python class `CLIntegrator` described below. Class description: Implement the CLIntegrator class. Method signatures and docstrings: - def setup_integrator(self, context): Setup the additional particle arrays for integration. Parameters: ----------- context -- the OpenCL context setup_cl on the calcs mus...
Implement the Python class `CLIntegrator` described below. Class description: Implement the CLIntegrator class. Method signatures and docstrings: - def setup_integrator(self, context): Setup the additional particle arrays for integration. Parameters: ----------- context -- the OpenCL context setup_cl on the calcs mus...
5bb1fc46a9c84aefd42758356a9986689db05454
<|skeleton|> class CLIntegrator: def setup_integrator(self, context): """Setup the additional particle arrays for integration. Parameters: ----------- context -- the OpenCL context setup_cl on the calcs must be called when all particle properties on the particle array are created. This is important as all ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CLIntegrator: def setup_integrator(self, context): """Setup the additional particle arrays for integration. Parameters: ----------- context -- the OpenCL context setup_cl on the calcs must be called when all particle properties on the particle array are created. This is important as all device buffers...
the_stack_v2_python_sparse
source/pysph/solver/cl_integrator.py
pankajp/pysph
train
1
0fc3a2ed33206875f71dde5dac974fd2acdbe63d
[ "@lru_cache(None)\ndef dfs(n):\n if n == 1:\n return 0\n ans = 0\n if n & 1:\n ans += 1 + min(dfs(n + 1), dfs(n - 1))\n else:\n ans += 1 + dfs(n // 2)\n return ans\nreturn dfs(n)", "def dfs(n):\n if n in memo:\n return memo[n]\n ans = 0\n if n & 1:\n ans ...
<|body_start_0|> @lru_cache(None) def dfs(n): if n == 1: return 0 ans = 0 if n & 1: ans += 1 + min(dfs(n + 1), dfs(n - 1)) else: ans += 1 + dfs(n // 2) return ans return dfs(n) <|end_body_...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def integerReplacement1(self, n: int) -> int: """思路:记忆化递归-标准库 @param n: @return:""" <|body_0|> def integerReplacement2(self, n: int) -> int: """思路:记忆化递归-备忘录 @param n: @return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> @lru_cache(None...
stack_v2_sparse_classes_10k_train_004943
1,555
no_license
[ { "docstring": "思路:记忆化递归-标准库 @param n: @return:", "name": "integerReplacement1", "signature": "def integerReplacement1(self, n: int) -> int" }, { "docstring": "思路:记忆化递归-备忘录 @param n: @return:", "name": "integerReplacement2", "signature": "def integerReplacement2(self, n: int) -> int" }...
2
stack_v2_sparse_classes_30k_train_006007
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def integerReplacement1(self, n: int) -> int: 思路:记忆化递归-标准库 @param n: @return: - def integerReplacement2(self, n: int) -> int: 思路:记忆化递归-备忘录 @param n: @return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def integerReplacement1(self, n: int) -> int: 思路:记忆化递归-标准库 @param n: @return: - def integerReplacement2(self, n: int) -> int: 思路:记忆化递归-备忘录 @param n: @return: <|skeleton|> class ...
e43ee86c5a8cdb808da09b4b6138e10275abadb5
<|skeleton|> class Solution: def integerReplacement1(self, n: int) -> int: """思路:记忆化递归-标准库 @param n: @return:""" <|body_0|> def integerReplacement2(self, n: int) -> int: """思路:记忆化递归-备忘录 @param n: @return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def integerReplacement1(self, n: int) -> int: """思路:记忆化递归-标准库 @param n: @return:""" @lru_cache(None) def dfs(n): if n == 1: return 0 ans = 0 if n & 1: ans += 1 + min(dfs(n + 1), dfs(n - 1)) else: ...
the_stack_v2_python_sparse
LeetCode/记忆化/397. 整数替换.py
yiming1012/MyLeetCode
train
2
8e8882f1ef437e2cf4589b6cb9190bc70df1a60c
[ "if postorder:\n root = TreeNode(postorder.pop())\n ind = inorder.index(root.val)\n root.left = self.buildTree(inorder[:ind], postorder[:ind])\n root.right = self.buildTree(inorder[ind + 1:], postorder[ind:])\n return root\nreturn None", "temp = []\nnodes = []\ncurrent = root\nwhile current:\n i...
<|body_start_0|> if postorder: root = TreeNode(postorder.pop()) ind = inorder.index(root.val) root.left = self.buildTree(inorder[:ind], postorder[:ind]) root.right = self.buildTree(inorder[ind + 1:], postorder[ind:]) return root return None <|e...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def buildTree(self, inorder, postorder): """:type inorder: List[int] :type postorder: List[int] :rtype: TreeNode""" <|body_0|> def inorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_10k_train_004944
1,501
no_license
[ { "docstring": ":type inorder: List[int] :type postorder: List[int] :rtype: TreeNode", "name": "buildTree", "signature": "def buildTree(self, inorder, postorder)" }, { "docstring": ":type root: TreeNode :rtype: List[int]", "name": "inorderTraversal", "signature": "def inorderTraversal(se...
2
stack_v2_sparse_classes_30k_train_002494
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def buildTree(self, inorder, postorder): :type inorder: List[int] :type postorder: List[int] :rtype: TreeNode - def inorderTraversal(self, root): :type root: TreeNode :rtype: Lis...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def buildTree(self, inorder, postorder): :type inorder: List[int] :type postorder: List[int] :rtype: TreeNode - def inorderTraversal(self, root): :type root: TreeNode :rtype: Lis...
6e4129d7c092be933497da2156680d25f72e42a4
<|skeleton|> class Solution: def buildTree(self, inorder, postorder): """:type inorder: List[int] :type postorder: List[int] :rtype: TreeNode""" <|body_0|> def inorderTraversal(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 buildTree(self, inorder, postorder): """:type inorder: List[int] :type postorder: List[int] :rtype: TreeNode""" if postorder: root = TreeNode(postorder.pop()) ind = inorder.index(root.val) root.left = self.buildTree(inorder[:ind], postorder[:in...
the_stack_v2_python_sparse
106_construct-binary-tree-from-inorder-and-postorder-traversal.py
setu4993/LeetCode
train
0
2bec81149662312e79c4bf490537b81533701d67
[ "def _commands_help(topic):\n com = obj.get('endroid.plugins.command')\n return com._help_main(topic, plugin=obj)\nif not 'commands' in obj._help_topics:\n setattr(obj, 'help_topics', {'commands': _commands_help})\nreturn obj._help_topics", "topics = obj._help_topics.copy()\ntopics.update(value)\nobj._he...
<|body_start_0|> def _commands_help(topic): com = obj.get('endroid.plugins.command') return com._help_main(topic, plugin=obj) if not 'commands' in obj._help_topics: setattr(obj, 'help_topics', {'commands': _commands_help}) return obj._help_topics <|end_body_0|...
Descriptor to handle auto-updating of the help_topics. This is required if a plugin doesn't just define its help_topics at the class level, and instead sets it during its initialisation. This descriptor will update the help_topics instead of replacing them when set.
_Topics
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _Topics: """Descriptor to handle auto-updating of the help_topics. This is required if a plugin doesn't just define its help_topics at the class level, and instead sets it during its initialisation. This descriptor will update the help_topics instead of replacing them when set.""" def __get_...
stack_v2_sparse_classes_10k_train_004945
13,347
no_license
[ { "docstring": "As well as fetching the help_topics (from the _help_topics field), this also injects the 'commands' entry into topics. It is done here, as this is the first point at which we have an instance of the plugin (needed to do the filtering later when displaying the help). Moral of the story: injecting...
2
stack_v2_sparse_classes_30k_train_003260
Implement the Python class `_Topics` described below. Class description: Descriptor to handle auto-updating of the help_topics. This is required if a plugin doesn't just define its help_topics at the class level, and instead sets it during its initialisation. This descriptor will update the help_topics instead of repl...
Implement the Python class `_Topics` described below. Class description: Descriptor to handle auto-updating of the help_topics. This is required if a plugin doesn't just define its help_topics at the class level, and instead sets it during its initialisation. This descriptor will update the help_topics instead of repl...
26e19a67551c0524186c096439c33eaa003c8f20
<|skeleton|> class _Topics: """Descriptor to handle auto-updating of the help_topics. This is required if a plugin doesn't just define its help_topics at the class level, and instead sets it during its initialisation. This descriptor will update the help_topics instead of replacing them when set.""" def __get_...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class _Topics: """Descriptor to handle auto-updating of the help_topics. This is required if a plugin doesn't just define its help_topics at the class level, and instead sets it during its initialisation. This descriptor will update the help_topics instead of replacing them when set.""" def __get__(self, obj, ...
the_stack_v2_python_sparse
src/endroid/plugins/command.py
ensoft/endroid
train
0
c13c0c436c5e436f594253a29b25b05189225cb8
[ "ressource_options = default_ressource_options(request, current_app)\nif rss_name:\n RssUtils.validate_rss_name(rss_name)\n spec = {'name': {'$regex': rss_name}}\nelse:\n spec = {}\nresults = current_app.mongo.finder(cursor=current_app.mongo.rss, spec=spec)\ndata = [document for document in results]\nretur...
<|body_start_0|> ressource_options = default_ressource_options(request, current_app) if rss_name: RssUtils.validate_rss_name(rss_name) spec = {'name': {'$regex': rss_name}} else: spec = {} results = current_app.mongo.finder(cursor=current_app.mongo.rss...
docstrings
Rss
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Rss: """docstrings""" def get(self, rss_name=None): """retrieve the list of a rss""" <|body_0|> def post(self): """add a new rss @post data: <name> <url>""" <|body_1|> def patch(self, rss_name): """patch a rss for the givent rss_name paramete...
stack_v2_sparse_classes_10k_train_004946
2,828
permissive
[ { "docstring": "retrieve the list of a rss", "name": "get", "signature": "def get(self, rss_name=None)" }, { "docstring": "add a new rss @post data: <name> <url>", "name": "post", "signature": "def post(self)" }, { "docstring": "patch a rss for the givent rss_name parameter @patc...
3
stack_v2_sparse_classes_30k_train_003600
Implement the Python class `Rss` described below. Class description: docstrings Method signatures and docstrings: - def get(self, rss_name=None): retrieve the list of a rss - def post(self): add a new rss @post data: <name> <url> - def patch(self, rss_name): patch a rss for the givent rss_name parameter @patch data: ...
Implement the Python class `Rss` described below. Class description: docstrings Method signatures and docstrings: - def get(self, rss_name=None): retrieve the list of a rss - def post(self): add a new rss @post data: <name> <url> - def patch(self, rss_name): patch a rss for the givent rss_name parameter @patch data: ...
657304c8b017a98935de9728fc695abe8be7cc4f
<|skeleton|> class Rss: """docstrings""" def get(self, rss_name=None): """retrieve the list of a rss""" <|body_0|> def post(self): """add a new rss @post data: <name> <url>""" <|body_1|> def patch(self, rss_name): """patch a rss for the givent rss_name paramete...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Rss: """docstrings""" def get(self, rss_name=None): """retrieve the list of a rss""" ressource_options = default_ressource_options(request, current_app) if rss_name: RssUtils.validate_rss_name(rss_name) spec = {'name': {'$regex': rss_name}} else: ...
the_stack_v2_python_sparse
Observer/api/resources/rss.py
Lujeni/old-projects
train
0
43debd58cd0ea6ce7012740db86698eda79cfb55
[ "if self.domain and self.suffix:\n return self.domain + '.' + self.suffix\nreturn ''", "if self.domain and self.suffix:\n return '.'.join((i for i in self if i))\nreturn ''", "if not (self.suffix or self.subdomain) and IP_RE.match(self.domain):\n return self.domain\nreturn ''" ]
<|body_start_0|> if self.domain and self.suffix: return self.domain + '.' + self.suffix return '' <|end_body_0|> <|body_start_1|> if self.domain and self.suffix: return '.'.join((i for i in self if i)) return '' <|end_body_1|> <|body_start_2|> if not (se...
namedtuple of a URL's subdomain, domain, and suffix.
ExtractResult
[ "GPL-3.0-only", "Python-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExtractResult: """namedtuple of a URL's subdomain, domain, and suffix.""" def registered_domain(self): """Joins the domain and suffix fields with a dot, if they're both set. >>> extract('http://forums.bbc.co.uk').registered_domain 'bbc.co.uk' >>> extract('http://localhost:8080').regi...
stack_v2_sparse_classes_10k_train_004947
7,568
permissive
[ { "docstring": "Joins the domain and suffix fields with a dot, if they're both set. >>> extract('http://forums.bbc.co.uk').registered_domain 'bbc.co.uk' >>> extract('http://localhost:8080').registered_domain ''", "name": "registered_domain", "signature": "def registered_domain(self)" }, { "docst...
3
null
Implement the Python class `ExtractResult` described below. Class description: namedtuple of a URL's subdomain, domain, and suffix. Method signatures and docstrings: - def registered_domain(self): Joins the domain and suffix fields with a dot, if they're both set. >>> extract('http://forums.bbc.co.uk').registered_dom...
Implement the Python class `ExtractResult` described below. Class description: namedtuple of a URL's subdomain, domain, and suffix. Method signatures and docstrings: - def registered_domain(self): Joins the domain and suffix fields with a dot, if they're both set. >>> extract('http://forums.bbc.co.uk').registered_dom...
b6edb06fc4e53a90c756459d7c03f8b33692b42b
<|skeleton|> class ExtractResult: """namedtuple of a URL's subdomain, domain, and suffix.""" def registered_domain(self): """Joins the domain and suffix fields with a dot, if they're both set. >>> extract('http://forums.bbc.co.uk').registered_domain 'bbc.co.uk' >>> extract('http://localhost:8080').regi...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ExtractResult: """namedtuple of a URL's subdomain, domain, and suffix.""" def registered_domain(self): """Joins the domain and suffix fields with a dot, if they're both set. >>> extract('http://forums.bbc.co.uk').registered_domain 'bbc.co.uk' >>> extract('http://localhost:8080').registered_domain...
the_stack_v2_python_sparse
python/app/thirdparty/oneforall/common/tldextract.py
taomujian/linbing
train
545
6f9caafc549beea5b3756706faed5ee5ee719966
[ "self.ser = serial.Serial(port=serial_port, timeout=timeout, write_timeout=write_timeout)\nself._serial_port = serial_port\nself._attr_name = name\nself._attributes = {LAMP_HOURS: STATE_UNKNOWN, INPUT_SOURCE: STATE_UNKNOWN, ECO_MODE: STATE_UNKNOWN}", "ret = ''\ntry:\n if not self.ser.is_open:\n self.ser...
<|body_start_0|> self.ser = serial.Serial(port=serial_port, timeout=timeout, write_timeout=write_timeout) self._serial_port = serial_port self._attr_name = name self._attributes = {LAMP_HOURS: STATE_UNKNOWN, INPUT_SOURCE: STATE_UNKNOWN, ECO_MODE: STATE_UNKNOWN} <|end_body_0|> <|body_sta...
Represents an Acer Projector as a switch.
AcerSwitch
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AcerSwitch: """Represents an Acer Projector as a switch.""" def __init__(self, serial_port: str, name: str, timeout: int, write_timeout: int) -> None: """Init of the Acer projector.""" <|body_0|> def _write_read(self, msg: str) -> str: """Write to the projector a...
stack_v2_sparse_classes_10k_train_004948
4,527
permissive
[ { "docstring": "Init of the Acer projector.", "name": "__init__", "signature": "def __init__(self, serial_port: str, name: str, timeout: int, write_timeout: int) -> None" }, { "docstring": "Write to the projector and read the return.", "name": "_write_read", "signature": "def _write_read...
6
null
Implement the Python class `AcerSwitch` described below. Class description: Represents an Acer Projector as a switch. Method signatures and docstrings: - def __init__(self, serial_port: str, name: str, timeout: int, write_timeout: int) -> None: Init of the Acer projector. - def _write_read(self, msg: str) -> str: Wri...
Implement the Python class `AcerSwitch` described below. Class description: Represents an Acer Projector as a switch. Method signatures and docstrings: - def __init__(self, serial_port: str, name: str, timeout: int, write_timeout: int) -> None: Init of the Acer projector. - def _write_read(self, msg: str) -> str: Wri...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class AcerSwitch: """Represents an Acer Projector as a switch.""" def __init__(self, serial_port: str, name: str, timeout: int, write_timeout: int) -> None: """Init of the Acer projector.""" <|body_0|> def _write_read(self, msg: str) -> str: """Write to the projector a...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AcerSwitch: """Represents an Acer Projector as a switch.""" def __init__(self, serial_port: str, name: str, timeout: int, write_timeout: int) -> None: """Init of the Acer projector.""" self.ser = serial.Serial(port=serial_port, timeout=timeout, write_timeout=write_timeout) self._s...
the_stack_v2_python_sparse
homeassistant/components/acer_projector/switch.py
home-assistant/core
train
35,501
03cf94c6ce8ba1a25d1d14423071f393a949d212
[ "if root:\n if root.left and root.right:\n return self.isSameTree(root.left, root.right)\n elif not root.left and (not root.right):\n return True\n else:\n return False\nelse:\n return True", "if not (p and q or (not p and (not q))):\n return False\nif p:\n if p.val != q.val...
<|body_start_0|> if root: if root.left and root.right: return self.isSameTree(root.left, root.right) elif not root.left and (not root.right): return True else: return False else: return True <|end_body_0|> <...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isSymmetric(self, root): """:type root: TreeNode :rtype: bool""" <|body_0|> def isSameTree(self, p, q): """:type p: TreeNode :type q: TreeNode :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> if root: if root.le...
stack_v2_sparse_classes_10k_train_004949
885
no_license
[ { "docstring": ":type root: TreeNode :rtype: bool", "name": "isSymmetric", "signature": "def isSymmetric(self, root)" }, { "docstring": ":type p: TreeNode :type q: TreeNode :rtype: bool", "name": "isSameTree", "signature": "def isSameTree(self, p, q)" } ]
2
stack_v2_sparse_classes_30k_val_000154
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isSymmetric(self, root): :type root: TreeNode :rtype: bool - def isSameTree(self, p, q): :type p: TreeNode :type q: TreeNode :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isSymmetric(self, root): :type root: TreeNode :rtype: bool - def isSameTree(self, p, q): :type p: TreeNode :type q: TreeNode :rtype: bool <|skeleton|> class Solution: d...
2711bc08f15266bec4ca135e8e3e629df46713eb
<|skeleton|> class Solution: def isSymmetric(self, root): """:type root: TreeNode :rtype: bool""" <|body_0|> def isSameTree(self, p, q): """:type p: TreeNode :type q: TreeNode :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def isSymmetric(self, root): """:type root: TreeNode :rtype: bool""" if root: if root.left and root.right: return self.isSameTree(root.left, root.right) elif not root.left and (not root.right): return True else: ...
the_stack_v2_python_sparse
0.算法/101_Symmetric_Tree.py
unlimitediw/CheckCode
train
0
4d2f236e01d15de1940ea12c64551c74448a6743
[ "self.d = dict()\nself.begin = Trie('')\nfor i, v in enumerate(sentences):\n self.begin.insert(v, v, times[i])\n self.d[v] = times[i]\nself.t = self.begin\nself.input_s = ''", "ans = []\nif c == '#':\n self.d[self.input_s] = self.d.get(self.input_s, 0) + 1\n self.begin.insert(self.input_s, self.input_...
<|body_start_0|> self.d = dict() self.begin = Trie('') for i, v in enumerate(sentences): self.begin.insert(v, v, times[i]) self.d[v] = times[i] self.t = self.begin self.input_s = '' <|end_body_0|> <|body_start_1|> ans = [] if c == '#': ...
AutocompleteSystem
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AutocompleteSystem: def __init__(self, sentences, times): """:type sentences: List[str] :type times: List[int]""" <|body_0|> def input(self, c): """:type c: str :rtype: List[str]""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.d = dict() ...
stack_v2_sparse_classes_10k_train_004950
1,816
no_license
[ { "docstring": ":type sentences: List[str] :type times: List[int]", "name": "__init__", "signature": "def __init__(self, sentences, times)" }, { "docstring": ":type c: str :rtype: List[str]", "name": "input", "signature": "def input(self, c)" } ]
2
stack_v2_sparse_classes_30k_train_004228
Implement the Python class `AutocompleteSystem` described below. Class description: Implement the AutocompleteSystem class. Method signatures and docstrings: - def __init__(self, sentences, times): :type sentences: List[str] :type times: List[int] - def input(self, c): :type c: str :rtype: List[str]
Implement the Python class `AutocompleteSystem` described below. Class description: Implement the AutocompleteSystem class. Method signatures and docstrings: - def __init__(self, sentences, times): :type sentences: List[str] :type times: List[int] - def input(self, c): :type c: str :rtype: List[str] <|skeleton|> cla...
9eb44afa4233fdedc2e5c72be0fdf54b25d1c45c
<|skeleton|> class AutocompleteSystem: def __init__(self, sentences, times): """:type sentences: List[str] :type times: List[int]""" <|body_0|> def input(self, c): """:type c: str :rtype: List[str]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AutocompleteSystem: def __init__(self, sentences, times): """:type sentences: List[str] :type times: List[int]""" self.d = dict() self.begin = Trie('') for i, v in enumerate(sentences): self.begin.insert(v, v, times[i]) self.d[v] = times[i] self....
the_stack_v2_python_sparse
Facebook/Pro642. Design Search Autocomplete System.py
YoyinZyc/Leetcode_Python
train
0
224b6a9b58d06e8efff273ed5952ca27e045022a
[ "for line in self:\n line.overdue_amount = 0\n if line.type == 'out_invoice':\n payments_obj = self.env['account.payment'].search([('partner_id', '=', line.partner_id.id), ('state', '=', 'posted'), ('bulk_payment_id.state', 'in', ['cheque_on_hand', 'deposited']), ('payment_type_name', '=', 'Cheque')])\...
<|body_start_0|> for line in self: line.overdue_amount = 0 if line.type == 'out_invoice': payments_obj = self.env['account.payment'].search([('partner_id', '=', line.partner_id.id), ('state', '=', 'posted'), ('bulk_payment_id.state', 'in', ['cheque_on_hand', 'deposited'])...
AccountInvoiceInherit
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccountInvoiceInherit: def _compute_overdue_amount(self): """Calculating Real outstanding by excluding all draft cheque payments""" <|body_0|> def _compute_stored_overdue_amount(self): """Calculating Real outstanding by excluding all draft cheque payments""" ...
stack_v2_sparse_classes_10k_train_004951
3,962
no_license
[ { "docstring": "Calculating Real outstanding by excluding all draft cheque payments", "name": "_compute_overdue_amount", "signature": "def _compute_overdue_amount(self)" }, { "docstring": "Calculating Real outstanding by excluding all draft cheque payments", "name": "_compute_stored_overdue_...
3
stack_v2_sparse_classes_30k_train_007256
Implement the Python class `AccountInvoiceInherit` described below. Class description: Implement the AccountInvoiceInherit class. Method signatures and docstrings: - def _compute_overdue_amount(self): Calculating Real outstanding by excluding all draft cheque payments - def _compute_stored_overdue_amount(self): Calcu...
Implement the Python class `AccountInvoiceInherit` described below. Class description: Implement the AccountInvoiceInherit class. Method signatures and docstrings: - def _compute_overdue_amount(self): Calculating Real outstanding by excluding all draft cheque payments - def _compute_stored_overdue_amount(self): Calcu...
b6b32366d966aa550af1de50fd4dd1f1e9daefd0
<|skeleton|> class AccountInvoiceInherit: def _compute_overdue_amount(self): """Calculating Real outstanding by excluding all draft cheque payments""" <|body_0|> def _compute_stored_overdue_amount(self): """Calculating Real outstanding by excluding all draft cheque payments""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AccountInvoiceInherit: def _compute_overdue_amount(self): """Calculating Real outstanding by excluding all draft cheque payments""" for line in self: line.overdue_amount = 0 if line.type == 'out_invoice': payments_obj = self.env['account.payment'].search...
the_stack_v2_python_sparse
invoice_outstanding/models/account_invoice.py
EshangAllion/rts-payroll
train
2
c3096c3c335acda40c457610d618589d73f8b90c
[ "l, r = (0, len(height) - 1)\nwater = 0\nwhile l < r:\n if height[l] < height[r]:\n i = l + 1\n while i < r and height[i] < height[l]:\n water += height[l] - height[i]\n i += 1\n l = i\n else:\n i = r - 1\n while i > l and height[i] < height[r]:\n ...
<|body_start_0|> l, r = (0, len(height) - 1) water = 0 while l < r: if height[l] < height[r]: i = l + 1 while i < r and height[i] < height[l]: water += height[l] - height[i] i += 1 l = i ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def trap1(self, height: List[int]) -> int: """greedy time: O(N) space: O(1)""" <|body_0|> def trap2(self, height: List[int]) -> int: """monotonic stack time: O(N) space: O(N)""" <|body_1|> <|end_skeleton|> <|body_start_0|> l, r = (0, len(h...
stack_v2_sparse_classes_10k_train_004952
1,641
no_license
[ { "docstring": "greedy time: O(N) space: O(1)", "name": "trap1", "signature": "def trap1(self, height: List[int]) -> int" }, { "docstring": "monotonic stack time: O(N) space: O(N)", "name": "trap2", "signature": "def trap2(self, height: List[int]) -> int" } ]
2
stack_v2_sparse_classes_30k_train_004568
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def trap1(self, height: List[int]) -> int: greedy time: O(N) space: O(1) - def trap2(self, height: List[int]) -> int: monotonic stack time: O(N) space: O(N)
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def trap1(self, height: List[int]) -> int: greedy time: O(N) space: O(1) - def trap2(self, height: List[int]) -> int: monotonic stack time: O(N) space: O(N) <|skeleton|> class S...
6ff1941ff213a843013100ac7033e2d4f90fbd6a
<|skeleton|> class Solution: def trap1(self, height: List[int]) -> int: """greedy time: O(N) space: O(1)""" <|body_0|> def trap2(self, height: List[int]) -> int: """monotonic stack time: O(N) space: O(N)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def trap1(self, height: List[int]) -> int: """greedy time: O(N) space: O(1)""" l, r = (0, len(height) - 1) water = 0 while l < r: if height[l] < height[r]: i = l + 1 while i < r and height[i] < height[l]: ...
the_stack_v2_python_sparse
Leetcode 0042. Trapping Rain Water.py
Chaoran-sjsu/leetcode
train
0
2e7f6dac0b79271ba1d8184474af53820bae0490
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn TenantAppManagementPolicy()", "from .app_management_configuration import AppManagementConfiguration\nfrom .policy_base import PolicyBase\nfrom .app_management_configuration import AppManagementConfiguration\nfrom .policy_base import Po...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return TenantAppManagementPolicy() <|end_body_0|> <|body_start_1|> from .app_management_configuration import AppManagementConfiguration from .policy_base import PolicyBase from .app_man...
TenantAppManagementPolicy
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TenantAppManagementPolicy: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TenantAppManagementPolicy: """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 c...
stack_v2_sparse_classes_10k_train_004953
3,160
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: TenantAppManagementPolicy", "name": "create_from_discriminator_value", "signature": "def create_from_discrim...
3
stack_v2_sparse_classes_30k_train_006210
Implement the Python class `TenantAppManagementPolicy` described below. Class description: Implement the TenantAppManagementPolicy class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TenantAppManagementPolicy: Creates a new instance of the appropriat...
Implement the Python class `TenantAppManagementPolicy` described below. Class description: Implement the TenantAppManagementPolicy class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TenantAppManagementPolicy: Creates a new instance of the appropriat...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class TenantAppManagementPolicy: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TenantAppManagementPolicy: """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 c...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TenantAppManagementPolicy: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TenantAppManagementPolicy: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the obje...
the_stack_v2_python_sparse
msgraph/generated/models/tenant_app_management_policy.py
microsoftgraph/msgraph-sdk-python
train
135
e944924f06776adce205340fdb95884385004029
[ "url = reverse('api-part-parameter-list')\nresponse = self.get(url)\nself.assertEqual(len(response.data), 7)\nresponse = self.get(url, {'part': 3})\nself.assertEqual(len(response.data), 3)\nresponse = self.get(url, {'template': 1})\nself.assertEqual(len(response.data), 4)", "with self.assertRaises(django_exceptio...
<|body_start_0|> url = reverse('api-part-parameter-list') response = self.get(url) self.assertEqual(len(response.data), 7) response = self.get(url, {'part': 3}) self.assertEqual(len(response.data), 3) response = self.get(url, {'template': 1}) self.assertEqual(len(...
Tests for the ParParameter API.
PartParameterTest
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PartParameterTest: """Tests for the ParParameter API.""" def test_list_params(self): """Test for listing part parameters.""" <|body_0|> def test_param_template_validation(self): """Test that part parameter template validation routines work correctly.""" <...
stack_v2_sparse_classes_10k_train_004954
12,864
permissive
[ { "docstring": "Test for listing part parameters.", "name": "test_list_params", "signature": "def test_list_params(self)" }, { "docstring": "Test that part parameter template validation routines work correctly.", "name": "test_param_template_validation", "signature": "def test_param_temp...
5
stack_v2_sparse_classes_30k_test_000203
Implement the Python class `PartParameterTest` described below. Class description: Tests for the ParParameter API. Method signatures and docstrings: - def test_list_params(self): Test for listing part parameters. - def test_param_template_validation(self): Test that part parameter template validation routines work co...
Implement the Python class `PartParameterTest` described below. Class description: Tests for the ParParameter API. Method signatures and docstrings: - def test_list_params(self): Test for listing part parameters. - def test_param_template_validation(self): Test that part parameter template validation routines work co...
e88a8e99a5f0b201c67a95cba097c729f090d5e2
<|skeleton|> class PartParameterTest: """Tests for the ParParameter API.""" def test_list_params(self): """Test for listing part parameters.""" <|body_0|> def test_param_template_validation(self): """Test that part parameter template validation routines work correctly.""" <...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PartParameterTest: """Tests for the ParParameter API.""" def test_list_params(self): """Test for listing part parameters.""" url = reverse('api-part-parameter-list') response = self.get(url) self.assertEqual(len(response.data), 7) response = self.get(url, {'part': ...
the_stack_v2_python_sparse
InvenTree/part/test_param.py
inventree/InvenTree
train
3,077
4d9c5447d5c09557490f1a6f16236ecb19bf0b34
[ "self.existing_tags_ids = [1, 2, 3, 4]\nself.content_id = 1\nself.tag_ids = [1, 5, 7]\nself.content = MagicMock(spec=Content, id=self.content_id, owner_id=21, tags=MagicMock(spec=Tag, all=MagicMock(return_value=MagicMock(values_list=MagicMock(return_value=self.existing_tags_ids)))))", "mock_objects.get.return_val...
<|body_start_0|> self.existing_tags_ids = [1, 2, 3, 4] self.content_id = 1 self.tag_ids = [1, 5, 7] self.content = MagicMock(spec=Content, id=self.content_id, owner_id=21, tags=MagicMock(spec=Tag, all=MagicMock(return_value=MagicMock(values_list=MagicMock(return_value=self.existing_tags_...
Test case for PushFeeds
TestStreamFeedsUtils
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestStreamFeedsUtils: """Test case for PushFeeds""" def setUp(self): """SetUp method for test case""" <|body_0|> def test_update_content_tags_at_getsream(self, mock_objects, mock_delay, mock_parent_ids): """test case for testing the update_content_tags_at_getsrea...
stack_v2_sparse_classes_10k_train_004955
20,391
no_license
[ { "docstring": "SetUp method for test case", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "test case for testing the update_content_tags_at_getsream", "name": "test_update_content_tags_at_getsream", "signature": "def test_update_content_tags_at_getsream(self, mock_ob...
2
stack_v2_sparse_classes_30k_train_006473
Implement the Python class `TestStreamFeedsUtils` described below. Class description: Test case for PushFeeds Method signatures and docstrings: - def setUp(self): SetUp method for test case - def test_update_content_tags_at_getsream(self, mock_objects, mock_delay, mock_parent_ids): test case for testing the update_co...
Implement the Python class `TestStreamFeedsUtils` described below. Class description: Test case for PushFeeds Method signatures and docstrings: - def setUp(self): SetUp method for test case - def test_update_content_tags_at_getsream(self, mock_objects, mock_delay, mock_parent_ids): test case for testing the update_co...
248a7b406686c0c98e944319a6eca08485104f5d
<|skeleton|> class TestStreamFeedsUtils: """Test case for PushFeeds""" def setUp(self): """SetUp method for test case""" <|body_0|> def test_update_content_tags_at_getsream(self, mock_objects, mock_delay, mock_parent_ids): """test case for testing the update_content_tags_at_getsrea...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestStreamFeedsUtils: """Test case for PushFeeds""" def setUp(self): """SetUp method for test case""" self.existing_tags_ids = [1, 2, 3, 4] self.content_id = 1 self.tag_ids = [1, 5, 7] self.content = MagicMock(spec=Content, id=self.content_id, owner_id=21, tags=Mag...
the_stack_v2_python_sparse
common/feeds/tests.py
skshivammahajan/DRFChat
train
0
7b982aa2d89c4863922a845486d87a8dd74a0055
[ "res_list = []\nif root is None:\n return res_list\nres_list.append(root.val)\nres_left_list = self.preorderTraversal(root.left)\nres_list = res_list + res_left_list\nres_right_list = self.preorderTraversal(root.right)\nres_list = res_list + res_right_list\nreturn res_list", "res_list = []\nif root is None:\n ...
<|body_start_0|> res_list = [] if root is None: return res_list res_list.append(root.val) res_left_list = self.preorderTraversal(root.left) res_list = res_list + res_left_list res_right_list = self.preorderTraversal(root.right) res_list = res_list + re...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def preorderTraversal(self, root): """递归 :type root: TreeNode :rtype: List[int]""" <|body_0|> def preorderTraversal2(self, root): """迭代,利用队列 :type root: TreeNode :rtype: List[int]""" <|body_1|> def preorderTraversal3(self, root): """迭代,...
stack_v2_sparse_classes_10k_train_004956
2,391
no_license
[ { "docstring": "递归 :type root: TreeNode :rtype: List[int]", "name": "preorderTraversal", "signature": "def preorderTraversal(self, root)" }, { "docstring": "迭代,利用队列 :type root: TreeNode :rtype: List[int]", "name": "preorderTraversal2", "signature": "def preorderTraversal2(self, root)" ...
3
stack_v2_sparse_classes_30k_train_004249
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def preorderTraversal(self, root): 递归 :type root: TreeNode :rtype: List[int] - def preorderTraversal2(self, root): 迭代,利用队列 :type root: TreeNode :rtype: List[int] - def preorderTr...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def preorderTraversal(self, root): 递归 :type root: TreeNode :rtype: List[int] - def preorderTraversal2(self, root): 迭代,利用队列 :type root: TreeNode :rtype: List[int] - def preorderTr...
f564806bd8e18831eeb20f2fd4bdd2d4aaa829ce
<|skeleton|> class Solution: def preorderTraversal(self, root): """递归 :type root: TreeNode :rtype: List[int]""" <|body_0|> def preorderTraversal2(self, root): """迭代,利用队列 :type root: TreeNode :rtype: List[int]""" <|body_1|> def preorderTraversal3(self, root): """迭代,...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def preorderTraversal(self, root): """递归 :type root: TreeNode :rtype: List[int]""" res_list = [] if root is None: return res_list res_list.append(root.val) res_left_list = self.preorderTraversal(root.left) res_list = res_list + res_left_lis...
the_stack_v2_python_sparse
Week 02/id_684/LeetCode_144_684.py
cboopen/algorithm004-04
train
2
b5303726718e72dcbc078532a7ed19f0047f14e8
[ "if obj.user_id:\n return self.get_user_member(obj['user'])\nelif obj.group_id:\n return self.get_group_member(obj['group'])", "profile = user.get('profile', {})\nname = profile.get('full_name') or user.get('username') or _('Untitled')\ndescription = profile.get('affiliations') or ''\nfake_user_obj = Simple...
<|body_start_0|> if obj.user_id: return self.get_user_member(obj['user']) elif obj.group_id: return self.get_group_member(obj['group']) <|end_body_0|> <|body_start_1|> profile = user.get('profile', {}) name = profile.get('full_name') or user.get('username') or _(...
Public Dump Schema.
PublicDumpSchema
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PublicDumpSchema: """Public Dump Schema.""" def get_member(self, obj): """Get a member.""" <|body_0|> def get_user_member(self, user): """Get a user member.""" <|body_1|> def get_group_member(self, group): """Get a group member.""" <|...
stack_v2_sparse_classes_10k_train_004957
6,688
permissive
[ { "docstring": "Get a member.", "name": "get_member", "signature": "def get_member(self, obj)" }, { "docstring": "Get a user member.", "name": "get_user_member", "signature": "def get_user_member(self, user)" }, { "docstring": "Get a group member.", "name": "get_group_member"...
3
stack_v2_sparse_classes_30k_train_002012
Implement the Python class `PublicDumpSchema` described below. Class description: Public Dump Schema. Method signatures and docstrings: - def get_member(self, obj): Get a member. - def get_user_member(self, user): Get a user member. - def get_group_member(self, group): Get a group member.
Implement the Python class `PublicDumpSchema` described below. Class description: Public Dump Schema. Method signatures and docstrings: - def get_member(self, obj): Get a member. - def get_user_member(self, user): Get a user member. - def get_group_member(self, group): Get a group member. <|skeleton|> class PublicDu...
9a17455c06bf606c19c6b1367e4e3d36bf017be9
<|skeleton|> class PublicDumpSchema: """Public Dump Schema.""" def get_member(self, obj): """Get a member.""" <|body_0|> def get_user_member(self, user): """Get a user member.""" <|body_1|> def get_group_member(self, group): """Get a group member.""" <|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PublicDumpSchema: """Public Dump Schema.""" def get_member(self, obj): """Get a member.""" if obj.user_id: return self.get_user_member(obj['user']) elif obj.group_id: return self.get_group_member(obj['group']) def get_user_member(self, user): "...
the_stack_v2_python_sparse
invenio_communities/members/services/schemas.py
inveniosoftware/invenio-communities
train
5
aa7029f71aa4f657ea5e28c5908cc715e9b77802
[ "res = 0\nfor i in range(len(grid)):\n for j in range(len(grid[0])):\n if grid[i][j] == 1:\n self.step = 0\n self.dfs(grid, i, j)\n res = max(res, self.step)\nreturn res", "if x < 0 or y < 0 or x > len(grid) - 1 or (y > len(grid[0]) - 1) or (grid[x][y] != 1):\n return...
<|body_start_0|> res = 0 for i in range(len(grid)): for j in range(len(grid[0])): if grid[i][j] == 1: self.step = 0 self.dfs(grid, i, j) res = max(res, self.step) return res <|end_body_0|> <|body_start_1|> ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxAreaOfIsland(self, grid): """:type grid: List[List[int]] :rtype: int""" <|body_0|> def dfs(self, grid, x, y): """:type grid: List[list[int]] :type x: int :type y: int :rtype : None""" <|body_1|> <|end_skeleton|> <|body_start_0|> res...
stack_v2_sparse_classes_10k_train_004958
1,685
permissive
[ { "docstring": ":type grid: List[List[int]] :rtype: int", "name": "maxAreaOfIsland", "signature": "def maxAreaOfIsland(self, grid)" }, { "docstring": ":type grid: List[list[int]] :type x: int :type y: int :rtype : None", "name": "dfs", "signature": "def dfs(self, grid, x, y)" } ]
2
stack_v2_sparse_classes_30k_train_000347
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxAreaOfIsland(self, grid): :type grid: List[List[int]] :rtype: int - def dfs(self, grid, x, y): :type grid: List[list[int]] :type x: int :type y: int :rtype : None
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxAreaOfIsland(self, grid): :type grid: List[List[int]] :rtype: int - def dfs(self, grid, x, y): :type grid: List[list[int]] :type x: int :type y: int :rtype : None <|skele...
55c6c3e7890b596b709b50cafa415b9594c03edd
<|skeleton|> class Solution: def maxAreaOfIsland(self, grid): """:type grid: List[List[int]] :rtype: int""" <|body_0|> def dfs(self, grid, x, y): """:type grid: List[list[int]] :type x: int :type y: int :rtype : None""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maxAreaOfIsland(self, grid): """:type grid: List[List[int]] :rtype: int""" res = 0 for i in range(len(grid)): for j in range(len(grid[0])): if grid[i][j] == 1: self.step = 0 self.dfs(grid, i, j) ...
the_stack_v2_python_sparse
max-area-of-island.py
summer-vacation/AlgoExec
train
1
741c6773ee9da987a6884ccf683917d9f868c4c8
[ "kwargs = super(NewbobRelative, cls).load_initial_kwargs_from_config(config)\nkwargs.update({'relativeErrorThreshold': config.float('newbob_relative_error_threshold', -0.01), 'learningRateDecayFactor': config.float('newbob_learning_rate_decay', 0.5)})\nreturn kwargs", "super(NewbobRelative, self).__init__(**kwarg...
<|body_start_0|> kwargs = super(NewbobRelative, cls).load_initial_kwargs_from_config(config) kwargs.update({'relativeErrorThreshold': config.float('newbob_relative_error_threshold', -0.01), 'learningRateDecayFactor': config.float('newbob_learning_rate_decay', 0.5)}) return kwargs <|end_body_0|> ...
NewbobRelative
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NewbobRelative: def load_initial_kwargs_from_config(cls, config): """:type config: Config.Config :rtype: dict[str]""" <|body_0|> def __init__(self, relativeErrorThreshold, learningRateDecayFactor, **kwargs): """:param float defaultLearningRate: learning rate for epoc...
stack_v2_sparse_classes_10k_train_004959
19,323
no_license
[ { "docstring": ":type config: Config.Config :rtype: dict[str]", "name": "load_initial_kwargs_from_config", "signature": "def load_initial_kwargs_from_config(cls, config)" }, { "docstring": ":param float defaultLearningRate: learning rate for epoch 1+2 :type relativeErrorThreshold: float :type le...
3
null
Implement the Python class `NewbobRelative` described below. Class description: Implement the NewbobRelative class. Method signatures and docstrings: - def load_initial_kwargs_from_config(cls, config): :type config: Config.Config :rtype: dict[str] - def __init__(self, relativeErrorThreshold, learningRateDecayFactor, ...
Implement the Python class `NewbobRelative` described below. Class description: Implement the NewbobRelative class. Method signatures and docstrings: - def load_initial_kwargs_from_config(cls, config): :type config: Config.Config :rtype: dict[str] - def __init__(self, relativeErrorThreshold, learningRateDecayFactor, ...
d494b3041069d377d6a7a9c296a14334f2fa5acc
<|skeleton|> class NewbobRelative: def load_initial_kwargs_from_config(cls, config): """:type config: Config.Config :rtype: dict[str]""" <|body_0|> def __init__(self, relativeErrorThreshold, learningRateDecayFactor, **kwargs): """:param float defaultLearningRate: learning rate for epoc...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NewbobRelative: def load_initial_kwargs_from_config(cls, config): """:type config: Config.Config :rtype: dict[str]""" kwargs = super(NewbobRelative, cls).load_initial_kwargs_from_config(config) kwargs.update({'relativeErrorThreshold': config.float('newbob_relative_error_threshold', -0....
the_stack_v2_python_sparse
python/rwth-i6_returnn/returnn-master/LearningRateControl.py
LiuFang816/SALSTM_py_data
train
10
1a79384472c7b5858646db5c053721bf8dca7635
[ "super(HonourAutoCombatHandler, self).start_combat()\nfor char in self.characters.values():\n character = char['char']\n character.start_auto_combat_skill()", "for char in self.characters.values():\n character = char['char']\n character.stop_auto_combat_skill()\nsuper(HonourAutoCombatHandler, self).fi...
<|body_start_0|> super(HonourAutoCombatHandler, self).start_combat() for char in self.characters.values(): character = char['char'] character.start_auto_combat_skill() <|end_body_0|> <|body_start_1|> for char in self.characters.values(): character = char['cha...
This implements the honour combat handler.
HonourAutoCombatHandler
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HonourAutoCombatHandler: """This implements the honour combat handler.""" def start_combat(self): """Start a combat, make all NPCs to cast skills automatically.""" <|body_0|> def finish(self): """Finish a combat. Send results to players, and kill all failed chara...
stack_v2_sparse_classes_10k_train_004960
887
permissive
[ { "docstring": "Start a combat, make all NPCs to cast skills automatically.", "name": "start_combat", "signature": "def start_combat(self)" }, { "docstring": "Finish a combat. Send results to players, and kill all failed characters.", "name": "finish", "signature": "def finish(self)" }...
2
stack_v2_sparse_classes_30k_train_003699
Implement the Python class `HonourAutoCombatHandler` described below. Class description: This implements the honour combat handler. Method signatures and docstrings: - def start_combat(self): Start a combat, make all NPCs to cast skills automatically. - def finish(self): Finish a combat. Send results to players, and ...
Implement the Python class `HonourAutoCombatHandler` described below. Class description: This implements the honour combat handler. Method signatures and docstrings: - def start_combat(self): Start a combat, make all NPCs to cast skills automatically. - def finish(self): Finish a combat. Send results to players, and ...
4b4c6c0dc5cc237a5df012a05ed260fad1a793a7
<|skeleton|> class HonourAutoCombatHandler: """This implements the honour combat handler.""" def start_combat(self): """Start a combat, make all NPCs to cast skills automatically.""" <|body_0|> def finish(self): """Finish a combat. Send results to players, and kill all failed chara...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class HonourAutoCombatHandler: """This implements the honour combat handler.""" def start_combat(self): """Start a combat, make all NPCs to cast skills automatically.""" super(HonourAutoCombatHandler, self).start_combat() for char in self.characters.values(): character = cha...
the_stack_v2_python_sparse
muddery/server/combat/honour_auto_combat_handler.py
nobodxbodon/muddery
train
0
037d5658e5e85f09b18e9b0cab84902de5aed6fe
[ "super().__init__()\nassert use_masking != use_weighted_masking or not use_masking\nself.use_masking = use_masking\nself.use_weighted_masking = use_weighted_masking\nreduction = 'none' if self.use_weighted_masking else 'mean'\nself.l1_criterion = nn.L1Loss(reduction=reduction)\nself.mse_criterion = nn.MSELoss(reduc...
<|body_start_0|> super().__init__() assert use_masking != use_weighted_masking or not use_masking self.use_masking = use_masking self.use_weighted_masking = use_weighted_masking reduction = 'none' if self.use_weighted_masking else 'mean' self.l1_criterion = nn.L1Loss(redu...
Loss function module for Tacotron2.
Tacotron2Loss
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Tacotron2Loss: """Loss function module for Tacotron2.""" def __init__(self, use_masking=True, use_weighted_masking=False, bce_pos_weight=20.0): """Initialize Tactoron2 loss module. Args: use_masking (bool): Whether to apply masking for padded part in loss calculation. use_weighted_ma...
stack_v2_sparse_classes_10k_train_004961
46,210
permissive
[ { "docstring": "Initialize Tactoron2 loss module. Args: use_masking (bool): Whether to apply masking for padded part in loss calculation. use_weighted_masking (bool): Whether to apply weighted masking in loss calculation. bce_pos_weight (float): Weight of positive sample of stop token.", "name": "__init__",...
2
stack_v2_sparse_classes_30k_train_000895
Implement the Python class `Tacotron2Loss` described below. Class description: Loss function module for Tacotron2. Method signatures and docstrings: - def __init__(self, use_masking=True, use_weighted_masking=False, bce_pos_weight=20.0): Initialize Tactoron2 loss module. Args: use_masking (bool): Whether to apply mas...
Implement the Python class `Tacotron2Loss` described below. Class description: Loss function module for Tacotron2. Method signatures and docstrings: - def __init__(self, use_masking=True, use_weighted_masking=False, bce_pos_weight=20.0): Initialize Tactoron2 loss module. Args: use_masking (bool): Whether to apply mas...
17854a04d43c231eff66bfed9d6aa55e94a29e79
<|skeleton|> class Tacotron2Loss: """Loss function module for Tacotron2.""" def __init__(self, use_masking=True, use_weighted_masking=False, bce_pos_weight=20.0): """Initialize Tactoron2 loss module. Args: use_masking (bool): Whether to apply masking for padded part in loss calculation. use_weighted_ma...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Tacotron2Loss: """Loss function module for Tacotron2.""" def __init__(self, use_masking=True, use_weighted_masking=False, bce_pos_weight=20.0): """Initialize Tactoron2 loss module. Args: use_masking (bool): Whether to apply masking for padded part in loss calculation. use_weighted_masking (bool):...
the_stack_v2_python_sparse
paddlespeech/t2s/modules/losses.py
anniyanvr/DeepSpeech-1
train
0
91201728441ca58c4e83f156ddb088b37387d498
[ "self.SetStartDate(2013, 10, 7)\nself.SetEndDate(2013, 10, 11)\nself.SetCash(100000)\nself.symbols = [['SPY', SecurityType.Equity], ['EURUSD', SecurityType.Forex]]\nself.targets = []\nfor item in self.symbols:\n symbol = self.AddSecurity(item[1], item[0]).Symbol\n self.targets.append(PortfolioTarget(symbol, 0...
<|body_start_0|> self.SetStartDate(2013, 10, 7) self.SetEndDate(2013, 10, 11) self.SetCash(100000) self.symbols = [['SPY', SecurityType.Equity], ['EURUSD', SecurityType.Forex]] self.targets = [] for item in self.symbols: symbol = self.AddSecurity(item[1], item...
Collective2SignalExportDemonstrationAlgorithm
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Collective2SignalExportDemonstrationAlgorithm: def Initialize(self): """Initialize the date and add all equity symbols present in list _symbols""" <|body_0|> def OnData(self, data): """Reduce the quantity of holdings for one security and increase the holdings to the ...
stack_v2_sparse_classes_10k_train_004962
4,637
permissive
[ { "docstring": "Initialize the date and add all equity symbols present in list _symbols", "name": "Initialize", "signature": "def Initialize(self)" }, { "docstring": "Reduce the quantity of holdings for one security and increase the holdings to the another one when the EMA's indicators crosses b...
2
null
Implement the Python class `Collective2SignalExportDemonstrationAlgorithm` described below. Class description: Implement the Collective2SignalExportDemonstrationAlgorithm class. Method signatures and docstrings: - def Initialize(self): Initialize the date and add all equity symbols present in list _symbols - def OnDa...
Implement the Python class `Collective2SignalExportDemonstrationAlgorithm` described below. Class description: Implement the Collective2SignalExportDemonstrationAlgorithm class. Method signatures and docstrings: - def Initialize(self): Initialize the date and add all equity symbols present in list _symbols - def OnDa...
b33dd3bc140e14b883f39ecf848a793cf7292277
<|skeleton|> class Collective2SignalExportDemonstrationAlgorithm: def Initialize(self): """Initialize the date and add all equity symbols present in list _symbols""" <|body_0|> def OnData(self, data): """Reduce the quantity of holdings for one security and increase the holdings to the ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Collective2SignalExportDemonstrationAlgorithm: def Initialize(self): """Initialize the date and add all equity symbols present in list _symbols""" self.SetStartDate(2013, 10, 7) self.SetEndDate(2013, 10, 11) self.SetCash(100000) self.symbols = [['SPY', SecurityType.Equi...
the_stack_v2_python_sparse
Algorithm.Python/Collective2SignalExportDemonstrationAlgorithm.py
Capnode/Algoloop
train
87
77f8713c7443fb029ded2cb01acaebe8d1d8a8fd
[ "super(SmoothL1Loss, self).__init__()\nself.beta = desc['beta'] if 'beta' in desc else 1.0\nself.reduction = desc['reduction'] if 'reduction' in desc else 'mean'\nself.loss_weight = desc['loss_weight'] if 'loss_weight' in desc else 1.0", "reduction = reduction_override if reduction_override else self.reduction\ni...
<|body_start_0|> super(SmoothL1Loss, self).__init__() self.beta = desc['beta'] if 'beta' in desc else 1.0 self.reduction = desc['reduction'] if 'reduction' in desc else 'mean' self.loss_weight = desc['loss_weight'] if 'loss_weight' in desc else 1.0 <|end_body_0|> <|body_start_1|> ...
Smooth L1 Loss.
SmoothL1Loss
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SmoothL1Loss: """Smooth L1 Loss.""" def __init__(self, desc): """Init smooth l1 loss. :param desc: config dict""" <|body_0|> def forward(self, pred, target, weight=None, avg_factor=None, reduction_override=None, **kwargs): """Forward compute. :param pred: predict...
stack_v2_sparse_classes_10k_train_004963
2,297
permissive
[ { "docstring": "Init smooth l1 loss. :param desc: config dict", "name": "__init__", "signature": "def __init__(self, desc)" }, { "docstring": "Forward compute. :param pred: predict :param target: target :param weight: weight :param avg_factor: avg factor :param reduction_override: reduce overrid...
2
stack_v2_sparse_classes_30k_train_000315
Implement the Python class `SmoothL1Loss` described below. Class description: Smooth L1 Loss. Method signatures and docstrings: - def __init__(self, desc): Init smooth l1 loss. :param desc: config dict - def forward(self, pred, target, weight=None, avg_factor=None, reduction_override=None, **kwargs): Forward compute....
Implement the Python class `SmoothL1Loss` described below. Class description: Smooth L1 Loss. Method signatures and docstrings: - def __init__(self, desc): Init smooth l1 loss. :param desc: config dict - def forward(self, pred, target, weight=None, avg_factor=None, reduction_override=None, **kwargs): Forward compute....
e4ef3a1c92d19d1d08c3ef0e2156b6fecefdbe04
<|skeleton|> class SmoothL1Loss: """Smooth L1 Loss.""" def __init__(self, desc): """Init smooth l1 loss. :param desc: config dict""" <|body_0|> def forward(self, pred, target, weight=None, avg_factor=None, reduction_override=None, **kwargs): """Forward compute. :param pred: predict...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SmoothL1Loss: """Smooth L1 Loss.""" def __init__(self, desc): """Init smooth l1 loss. :param desc: config dict""" super(SmoothL1Loss, self).__init__() self.beta = desc['beta'] if 'beta' in desc else 1.0 self.reduction = desc['reduction'] if 'reduction' in desc else 'mean' ...
the_stack_v2_python_sparse
zeus/networks/pytorch/losses/smooth_l1_loss.py
huawei-noah/xingtian
train
308
3a853e31d9c343085a28a64cf7019df3b1142925
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')" ]
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
A set of methods for managing data of the Project resource.
ProjectDataServiceServicer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProjectDataServiceServicer: """A set of methods for managing data of the Project resource.""" def UploadFile(self, request_iterator, context): """Uploads a file to the specified project.""" <|body_0|> def DownloadFile(self, request, context): """Downloads the spe...
stack_v2_sparse_classes_10k_train_004964
5,007
permissive
[ { "docstring": "Uploads a file to the specified project.", "name": "UploadFile", "signature": "def UploadFile(self, request_iterator, context)" }, { "docstring": "Downloads the specified file from the specified project.", "name": "DownloadFile", "signature": "def DownloadFile(self, reque...
2
stack_v2_sparse_classes_30k_train_004302
Implement the Python class `ProjectDataServiceServicer` described below. Class description: A set of methods for managing data of the Project resource. Method signatures and docstrings: - def UploadFile(self, request_iterator, context): Uploads a file to the specified project. - def DownloadFile(self, request, contex...
Implement the Python class `ProjectDataServiceServicer` described below. Class description: A set of methods for managing data of the Project resource. Method signatures and docstrings: - def UploadFile(self, request_iterator, context): Uploads a file to the specified project. - def DownloadFile(self, request, contex...
b906a014dd893e2697864e1e48e814a8d9fbc48c
<|skeleton|> class ProjectDataServiceServicer: """A set of methods for managing data of the Project resource.""" def UploadFile(self, request_iterator, context): """Uploads a file to the specified project.""" <|body_0|> def DownloadFile(self, request, context): """Downloads the spe...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ProjectDataServiceServicer: """A set of methods for managing data of the Project resource.""" def UploadFile(self, request_iterator, context): """Uploads a file to the specified project.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented...
the_stack_v2_python_sparse
yandex/cloud/datasphere/v1/project_data_service_pb2_grpc.py
yandex-cloud/python-sdk
train
63
f4925c088c1a78c3f5e5e35ebba5d6dc528e92d5
[ "if order is None:\n raise ValueError('Polynomial order cannot be None')\nCenteredBasisFn.__init__(self, **kwargs)\nTimefnCollection.__init__(self)\nself.build(order=order, tau=tau, minorder=minorder)", "for exp in range(minorder, order + 1):\n if exp == 0:\n fn = Constant(tmin=self.tmin, tmax=self.t...
<|body_start_0|> if order is None: raise ValueError('Polynomial order cannot be None') CenteredBasisFn.__init__(self, **kwargs) TimefnCollection.__init__(self) self.build(order=order, tau=tau, minorder=minorder) <|end_body_0|> <|body_start_1|> for exp in range(minord...
Collection of power objects to represent a polynomial.
Polynomial
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Polynomial: """Collection of power objects to represent a polynomial.""" def __init__(self, order=None, tau=1, minorder=0, **kwargs): """Constructor of a polynomial of specified order.""" <|body_0|> def build(self, order=None, tau=1, minorder=0): """Build the pow...
stack_v2_sparse_classes_10k_train_004965
1,827
permissive
[ { "docstring": "Constructor of a polynomial of specified order.", "name": "__init__", "signature": "def __init__(self, order=None, tau=1, minorder=0, **kwargs)" }, { "docstring": "Build the power objects and add it to collection.", "name": "build", "signature": "def build(self, order=Non...
2
stack_v2_sparse_classes_30k_train_004392
Implement the Python class `Polynomial` described below. Class description: Collection of power objects to represent a polynomial. Method signatures and docstrings: - def __init__(self, order=None, tau=1, minorder=0, **kwargs): Constructor of a polynomial of specified order. - def build(self, order=None, tau=1, minor...
Implement the Python class `Polynomial` described below. Class description: Collection of power objects to represent a polynomial. Method signatures and docstrings: - def __init__(self, order=None, tau=1, minorder=0, **kwargs): Constructor of a polynomial of specified order. - def build(self, order=None, tau=1, minor...
d53d6bc102dc4eb1b8d153fad80e10bd12f98029
<|skeleton|> class Polynomial: """Collection of power objects to represent a polynomial.""" def __init__(self, order=None, tau=1, minorder=0, **kwargs): """Constructor of a polynomial of specified order.""" <|body_0|> def build(self, order=None, tau=1, minorder=0): """Build the pow...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Polynomial: """Collection of power objects to represent a polynomial.""" def __init__(self, order=None, tau=1, minorder=0, **kwargs): """Constructor of a polynomial of specified order.""" if order is None: raise ValueError('Polynomial order cannot be None') CenteredBas...
the_stack_v2_python_sparse
src/timefn/Polynomial.py
isce-framework/fringe
train
74
1b8b79444ecbd7eab4216982a7028412f22af6c5
[ "value = encode_value(value, flags)\nresponse = await self._write(key, value, flags=flags)\nreturn response.body is True", "value = encode_value(value, flags)\nindex = extract_attr(index, keys=['ModifyIndex', 'Index'])\nresponse = await self._write(key, value, flags=flags, cas=index)\nreturn response.body is True...
<|body_start_0|> value = encode_value(value, flags) response = await self._write(key, value, flags=flags) return response.body is True <|end_body_0|> <|body_start_1|> value = encode_value(value, flags) index = extract_attr(index, keys=['ModifyIndex', 'Index']) response =...
WriteMixin
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WriteMixin: async def set(self, key, value, *, flags=None): """Sets the key to the given value. Parameters: key (str): Key to set value (Payload): Value to set, It will be encoded by flags flags (int): Flags to set with value Returns: bool: ``True`` on success""" <|body_0|> ...
stack_v2_sparse_classes_10k_train_004966
19,443
permissive
[ { "docstring": "Sets the key to the given value. Parameters: key (str): Key to set value (Payload): Value to set, It will be encoded by flags flags (int): Flags to set with value Returns: bool: ``True`` on success", "name": "set", "signature": "async def set(self, key, value, *, flags=None)" }, { ...
5
stack_v2_sparse_classes_30k_val_000063
Implement the Python class `WriteMixin` described below. Class description: Implement the WriteMixin class. Method signatures and docstrings: - async def set(self, key, value, *, flags=None): Sets the key to the given value. Parameters: key (str): Key to set value (Payload): Value to set, It will be encoded by flags ...
Implement the Python class `WriteMixin` described below. Class description: Implement the WriteMixin class. Method signatures and docstrings: - async def set(self, key, value, *, flags=None): Sets the key to the given value. Parameters: key (str): Key to set value (Payload): Value to set, It will be encoded by flags ...
02f7a529d7dc2e49bed942111067aa5faf320e90
<|skeleton|> class WriteMixin: async def set(self, key, value, *, flags=None): """Sets the key to the given value. Parameters: key (str): Key to set value (Payload): Value to set, It will be encoded by flags flags (int): Flags to set with value Returns: bool: ``True`` on success""" <|body_0|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WriteMixin: async def set(self, key, value, *, flags=None): """Sets the key to the given value. Parameters: key (str): Key to set value (Payload): Value to set, It will be encoded by flags flags (int): Flags to set with value Returns: bool: ``True`` on success""" value = encode_value(value, fl...
the_stack_v2_python_sparse
aioconsul/client/kv_endpoint.py
johnnoone/aioconsul
train
8
dad70f49e5a69177b94cefb3d0cfc6e04acf2f16
[ "try:\n jd = jc.load_obj_json('{}')\n jd.config = 'Y'\n jd.nn_id = nnid\n netconf.update_network(jd)\n netconf.save_conf(nnid, request.body)\n netconf.set_on_net_conf(nnid)\n return_data = {'status': '200', 'result': nnid}\n return Response(json.dumps(return_data))\nexcept Exception as e:\n ...
<|body_start_0|> try: jd = jc.load_obj_json('{}') jd.config = 'Y' jd.nn_id = nnid netconf.update_network(jd) netconf.save_conf(nnid, request.body) netconf.set_on_net_conf(nnid) return_data = {'status': '200', 'result': nnid} ...
1. Name : ConvNeuralNetConfig 2. Steps - CNN essential steps - post /api/v1/type/common/env/ - post /api/v1/type/common/nninfo/{nnid}/ - post /api/v1/type/imagedata/base/{baseid}/ - post /api/v1/type/imagedata/base/{baseid}/table/{tb}/ - post /api/v1/type/imagedata/base/{baseid}/table/{tb}/label/{label}/data/ - post /a...
ConvNeuralNetConfig
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConvNeuralNetConfig: """1. Name : ConvNeuralNetConfig 2. Steps - CNN essential steps - post /api/v1/type/common/env/ - post /api/v1/type/common/nninfo/{nnid}/ - post /api/v1/type/imagedata/base/{baseid}/ - post /api/v1/type/imagedata/base/{baseid}/table/{tb}/ - post /api/v1/type/imagedata/base/{b...
stack_v2_sparse_classes_10k_train_004967
3,143
no_license
[ { "docstring": "- desc : insert cnn configuration data", "name": "post", "signature": "def post(self, request, nnid)" }, { "docstring": "- desc : get cnn configuration data", "name": "get", "signature": "def get(self, request, nnid)" }, { "docstring": "- desc ; update cnn configu...
4
stack_v2_sparse_classes_30k_train_004685
Implement the Python class `ConvNeuralNetConfig` described below. Class description: 1. Name : ConvNeuralNetConfig 2. Steps - CNN essential steps - post /api/v1/type/common/env/ - post /api/v1/type/common/nninfo/{nnid}/ - post /api/v1/type/imagedata/base/{baseid}/ - post /api/v1/type/imagedata/base/{baseid}/table/{tb}...
Implement the Python class `ConvNeuralNetConfig` described below. Class description: 1. Name : ConvNeuralNetConfig 2. Steps - CNN essential steps - post /api/v1/type/common/env/ - post /api/v1/type/common/nninfo/{nnid}/ - post /api/v1/type/imagedata/base/{baseid}/ - post /api/v1/type/imagedata/base/{baseid}/table/{tb}...
ef058737f391de817c74398ef9a5d3a28f973c98
<|skeleton|> class ConvNeuralNetConfig: """1. Name : ConvNeuralNetConfig 2. Steps - CNN essential steps - post /api/v1/type/common/env/ - post /api/v1/type/common/nninfo/{nnid}/ - post /api/v1/type/imagedata/base/{baseid}/ - post /api/v1/type/imagedata/base/{baseid}/table/{tb}/ - post /api/v1/type/imagedata/base/{b...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ConvNeuralNetConfig: """1. Name : ConvNeuralNetConfig 2. Steps - CNN essential steps - post /api/v1/type/common/env/ - post /api/v1/type/common/nninfo/{nnid}/ - post /api/v1/type/imagedata/base/{baseid}/ - post /api/v1/type/imagedata/base/{baseid}/table/{tb}/ - post /api/v1/type/imagedata/base/{baseid}/table/...
the_stack_v2_python_sparse
tfmsarest/views/cnn_config.py
TensorMSA/tensormsa_old
train
6
c5afd837def6a6ec93ab77a5746a49b3d3ffd86d
[ "assert padding in ['SAME'], 'Error: unsupported padding for transposed conv'\nif isinstance(stride, int):\n stride = [1, stride, stride, 1]\nelse:\n assert len(stride) == 2, 'stride is either an int or a 2-tuple'\n stride = [1, stride[0], stride[1], 1]\nif isinstance(w, int):\n w = [w, w]\nself.padding...
<|body_start_0|> assert padding in ['SAME'], 'Error: unsupported padding for transposed conv' if isinstance(stride, int): stride = [1, stride, stride, 1] else: assert len(stride) == 2, 'stride is either an int or a 2-tuple' stride = [1, stride[0], stride[1], 1...
Convolution layer with support for equalized learning.
LayerTransposedConv
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LayerTransposedConv: """Convolution layer with support for equalized learning.""" def __init__(self, name, w, n, stride, padding='SAME', use_scaling=False, relu_slope=1.0): """Layer constructor. Args: name: string, layer name. stride: int or 2-tuple, stride for the convolution kernel...
stack_v2_sparse_classes_10k_train_004968
13,442
permissive
[ { "docstring": "Layer constructor. Args: name: string, layer name. stride: int or 2-tuple, stride for the convolution kernel. w: int or 2-tuple, width of the convolution kernel. n: 2-tuple int, [n_in_channels, n_out_channels] padding: string, the padding method {SAME, VALID, REFLECT}. use_scaling: bool, whether...
2
stack_v2_sparse_classes_30k_test_000090
Implement the Python class `LayerTransposedConv` described below. Class description: Convolution layer with support for equalized learning. Method signatures and docstrings: - def __init__(self, name, w, n, stride, padding='SAME', use_scaling=False, relu_slope=1.0): Layer constructor. Args: name: string, layer name. ...
Implement the Python class `LayerTransposedConv` described below. Class description: Convolution layer with support for equalized learning. Method signatures and docstrings: - def __init__(self, name, w, n, stride, padding='SAME', use_scaling=False, relu_slope=1.0): Layer constructor. Args: name: string, layer name. ...
091d6ae9e087cf5a6e18b00bce7d8f7ede9d9d08
<|skeleton|> class LayerTransposedConv: """Convolution layer with support for equalized learning.""" def __init__(self, name, w, n, stride, padding='SAME', use_scaling=False, relu_slope=1.0): """Layer constructor. Args: name: string, layer name. stride: int or 2-tuple, stride for the convolution kernel...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LayerTransposedConv: """Convolution layer with support for equalized learning.""" def __init__(self, name, w, n, stride, padding='SAME', use_scaling=False, relu_slope=1.0): """Layer constructor. Args: name: string, layer name. stride: int or 2-tuple, stride for the convolution kernel. w: int or 2...
the_stack_v2_python_sparse
layers.py
MoustafaMeshry/StEP
train
6
4880c4ec6aedda01753fb907e133501d10badef7
[ "if (d, f, target) in self.memo:\n return self.memo[d, f, target]\nmod = 10 ** 9 + 7\nif target < d or target > d * f:\n return 0\nif d == 0:\n return 1 if target == 0 else 0\nself.memo[d, f, target] = sum((self.numRollsToTarget(d - 1, f, target - x) for x in range(1, f + 1))) % mod\nreturn self.memo[d, f,...
<|body_start_0|> if (d, f, target) in self.memo: return self.memo[d, f, target] mod = 10 ** 9 + 7 if target < d or target > d * f: return 0 if d == 0: return 1 if target == 0 else 0 self.memo[d, f, target] = sum((self.numRollsToTarget(d - 1, f,...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numRollsToTarget(self, d, f, target): """:type d: int :type f: int :type target: int :rtype: int""" <|body_0|> def numRollsToTarget_1(self, d, f, target): """:type d: int :type f: int :type target: int :rtype: int""" <|body_1|> def numRolls...
stack_v2_sparse_classes_10k_train_004969
4,009
no_license
[ { "docstring": ":type d: int :type f: int :type target: int :rtype: int", "name": "numRollsToTarget", "signature": "def numRollsToTarget(self, d, f, target)" }, { "docstring": ":type d: int :type f: int :type target: int :rtype: int", "name": "numRollsToTarget_1", "signature": "def numRo...
3
stack_v2_sparse_classes_30k_train_002563
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numRollsToTarget(self, d, f, target): :type d: int :type f: int :type target: int :rtype: int - def numRollsToTarget_1(self, d, f, target): :type d: int :type f: int :type ta...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numRollsToTarget(self, d, f, target): :type d: int :type f: int :type target: int :rtype: int - def numRollsToTarget_1(self, d, f, target): :type d: int :type f: int :type ta...
3d9e0ad2f6ed92ec969556f75d97c51ea4854719
<|skeleton|> class Solution: def numRollsToTarget(self, d, f, target): """:type d: int :type f: int :type target: int :rtype: int""" <|body_0|> def numRollsToTarget_1(self, d, f, target): """:type d: int :type f: int :type target: int :rtype: int""" <|body_1|> def numRolls...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def numRollsToTarget(self, d, f, target): """:type d: int :type f: int :type target: int :rtype: int""" if (d, f, target) in self.memo: return self.memo[d, f, target] mod = 10 ** 9 + 7 if target < d or target > d * f: return 0 if d == 0...
the_stack_v2_python_sparse
Solutions/1155_numRollsToTarget.py
YoupengLi/leetcode-sorting
train
3
a52af499ea9b595160cdbfeee615c6064df45520
[ "assert isinstance(cookie_jar, CookieJar)\ncookie_jar.__class__ = cls\nassert isinstance(cookie_jar, PickleableCookieJar)\nreturn cookie_jar", "state = self.__dict__.copy()\nstate.pop('_cookies_lock')\nreturn state", "self.__dict__.update(state)\nif '_cookies_lock' not in self.__dict__:\n self._cookies_lock ...
<|body_start_0|> assert isinstance(cookie_jar, CookieJar) cookie_jar.__class__ = cls assert isinstance(cookie_jar, PickleableCookieJar) return cookie_jar <|end_body_0|> <|body_start_1|> state = self.__dict__.copy() state.pop('_cookies_lock') return state <|end_bo...
A pickleable CookieJar class
PickleableCookieJar
[ "LicenseRef-scancode-warranty-disclaimer", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PickleableCookieJar: """A pickleable CookieJar class""" def cast(cls, cookie_jar: CookieJar): """Make a kind of cast to convert the class from CookieJar to PickleableCookieJar""" <|body_0|> def __getstate__(self): """Unlike a normal CookieJar, this class is pickl...
stack_v2_sparse_classes_10k_train_004970
4,220
permissive
[ { "docstring": "Make a kind of cast to convert the class from CookieJar to PickleableCookieJar", "name": "cast", "signature": "def cast(cls, cookie_jar: CookieJar)" }, { "docstring": "Unlike a normal CookieJar, this class is pickleable.", "name": "__getstate__", "signature": "def __getst...
3
null
Implement the Python class `PickleableCookieJar` described below. Class description: A pickleable CookieJar class Method signatures and docstrings: - def cast(cls, cookie_jar: CookieJar): Make a kind of cast to convert the class from CookieJar to PickleableCookieJar - def __getstate__(self): Unlike a normal CookieJar...
Implement the Python class `PickleableCookieJar` described below. Class description: A pickleable CookieJar class Method signatures and docstrings: - def cast(cls, cookie_jar: CookieJar): Make a kind of cast to convert the class from CookieJar to PickleableCookieJar - def __getstate__(self): Unlike a normal CookieJar...
ece10d24449faaccd7d65a4093c6b5679ee0b383
<|skeleton|> class PickleableCookieJar: """A pickleable CookieJar class""" def cast(cls, cookie_jar: CookieJar): """Make a kind of cast to convert the class from CookieJar to PickleableCookieJar""" <|body_0|> def __getstate__(self): """Unlike a normal CookieJar, this class is pickl...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PickleableCookieJar: """A pickleable CookieJar class""" def cast(cls, cookie_jar: CookieJar): """Make a kind of cast to convert the class from CookieJar to PickleableCookieJar""" assert isinstance(cookie_jar, CookieJar) cookie_jar.__class__ = cls assert isinstance(cookie_j...
the_stack_v2_python_sparse
resources/lib/utils/cookies.py
CastagnaIT/plugin.video.netflix
train
2,019
00208201d290bf3ba95bb8f0797e723620c166e0
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn AttackSimulationSimulationUserCoverage()", "from .attack_simulation_user import AttackSimulationUser\nfrom .attack_simulation_user import AttackSimulationUser\nfields: Dict[str, Callable[[Any], None]] = {'attackSimulationUser': lambda ...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return AttackSimulationSimulationUserCoverage() <|end_body_0|> <|body_start_1|> from .attack_simulation_user import AttackSimulationUser from .attack_simulation_user import AttackSimulationUser...
AttackSimulationSimulationUserCoverage
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AttackSimulationSimulationUserCoverage: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AttackSimulationSimulationUserCoverage: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the...
stack_v2_sparse_classes_10k_train_004971
4,198
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: AttackSimulationSimulationUserCoverage", "name": "create_from_discriminator_value", "signature": "def create...
3
stack_v2_sparse_classes_30k_train_006465
Implement the Python class `AttackSimulationSimulationUserCoverage` described below. Class description: Implement the AttackSimulationSimulationUserCoverage class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AttackSimulationSimulationUserCoverage: C...
Implement the Python class `AttackSimulationSimulationUserCoverage` described below. Class description: Implement the AttackSimulationSimulationUserCoverage class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AttackSimulationSimulationUserCoverage: C...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class AttackSimulationSimulationUserCoverage: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AttackSimulationSimulationUserCoverage: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AttackSimulationSimulationUserCoverage: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AttackSimulationSimulationUserCoverage: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator...
the_stack_v2_python_sparse
msgraph/generated/models/attack_simulation_simulation_user_coverage.py
microsoftgraph/msgraph-sdk-python
train
135
d40d60aa8544335a6ff99a90a85800a8a2f3e24d
[ "self.create_and_verify_stack('single/basic_api')\nfirst_dep_ids = self.get_stack_deployment_ids()\nself.assertEqual(len(first_dep_ids), 1)\nself.set_template_resource_property('MyApi', 'DefinitionUri', self.get_s3_uri('swagger2.json'))\nself.update_stack()\nsecond_dep_ids = self.get_stack_deployment_ids()\nself.as...
<|body_start_0|> self.create_and_verify_stack('single/basic_api') first_dep_ids = self.get_stack_deployment_ids() self.assertEqual(len(first_dep_ids), 1) self.set_template_resource_property('MyApi', 'DefinitionUri', self.get_s3_uri('swagger2.json')) self.update_stack() se...
Basic AWS::Serverless::Api tests
TestBasicApi
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestBasicApi: """Basic AWS::Serverless::Api tests""" def test_basic_api(self): """Creates an API and updates its DefinitionUri""" <|body_0|> def test_basic_api_with_mode(self): """Creates an API and updates its DefinitionUri""" <|body_1|> def test_ba...
stack_v2_sparse_classes_10k_train_004972
5,166
permissive
[ { "docstring": "Creates an API and updates its DefinitionUri", "name": "test_basic_api", "signature": "def test_basic_api(self)" }, { "docstring": "Creates an API and updates its DefinitionUri", "name": "test_basic_api_with_mode", "signature": "def test_basic_api_with_mode(self)" }, ...
6
stack_v2_sparse_classes_30k_train_003316
Implement the Python class `TestBasicApi` described below. Class description: Basic AWS::Serverless::Api tests Method signatures and docstrings: - def test_basic_api(self): Creates an API and updates its DefinitionUri - def test_basic_api_with_mode(self): Creates an API and updates its DefinitionUri - def test_basic_...
Implement the Python class `TestBasicApi` described below. Class description: Basic AWS::Serverless::Api tests Method signatures and docstrings: - def test_basic_api(self): Creates an API and updates its DefinitionUri - def test_basic_api_with_mode(self): Creates an API and updates its DefinitionUri - def test_basic_...
0bb862ea715a4aafbb7984b407a81856b3ae19c4
<|skeleton|> class TestBasicApi: """Basic AWS::Serverless::Api tests""" def test_basic_api(self): """Creates an API and updates its DefinitionUri""" <|body_0|> def test_basic_api_with_mode(self): """Creates an API and updates its DefinitionUri""" <|body_1|> def test_ba...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestBasicApi: """Basic AWS::Serverless::Api tests""" def test_basic_api(self): """Creates an API and updates its DefinitionUri""" self.create_and_verify_stack('single/basic_api') first_dep_ids = self.get_stack_deployment_ids() self.assertEqual(len(first_dep_ids), 1) ...
the_stack_v2_python_sparse
integration/single/test_basic_api.py
aws/serverless-application-model
train
2,055
07e8cf1822f5f800afec874dc06db03440594b73
[ "if len(nums) == 0:\n return None\nif len(nums) == 1:\n return nums[0]\nfor i in range(1, len(nums), 1):\n nums[i] = nums[i] + nums[i - 1]\nstart = 1\nmaxVal = nums[0]\nwhile start < len(nums):\n end = start\n s = nums[end]\n if s > maxVal:\n maxVal = s\n while end < len(nums):\n ...
<|body_start_0|> if len(nums) == 0: return None if len(nums) == 1: return nums[0] for i in range(1, len(nums), 1): nums[i] = nums[i] + nums[i - 1] start = 1 maxVal = nums[0] while start < len(nums): end = start s...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxSubArray(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def maxSubArray2(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(nums) == 0: return None ...
stack_v2_sparse_classes_10k_train_004973
1,044
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "maxSubArray", "signature": "def maxSubArray(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "maxSubArray2", "signature": "def maxSubArray2(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray(self, nums): :type nums: List[int] :rtype: int - def maxSubArray2(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 maxSubArray(self, nums): :type nums: List[int] :rtype: int - def maxSubArray2(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def maxSubArra...
e836343be5185f8843bb77197fccff250e9a77e3
<|skeleton|> class Solution: def maxSubArray(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def maxSubArray2(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 maxSubArray(self, nums): """:type nums: List[int] :rtype: int""" if len(nums) == 0: return None if len(nums) == 1: return nums[0] for i in range(1, len(nums), 1): nums[i] = nums[i] + nums[i - 1] start = 1 maxVal ...
the_stack_v2_python_sparse
leetcode/max_subarray.py
rishabhranawat/challenge
train
0
037d5658e5e85f09b18e9b0cab84902de5aed6fe
[ "assert check_argument_types()\nsuper().__init__()\nassert use_masking != use_weighted_masking or not use_masking\nself.use_masking = use_masking\nself.use_weighted_masking = use_weighted_masking\nreduction = 'none' if self.use_weighted_masking else 'mean'\nself.mse_criterion = nn.MSELoss(reduction=reduction)\nself...
<|body_start_0|> assert check_argument_types() super().__init__() assert use_masking != use_weighted_masking or not use_masking self.use_masking = use_masking self.use_weighted_masking = use_weighted_masking reduction = 'none' if self.use_weighted_masking else 'mean' ...
VarianceLoss
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VarianceLoss: def __init__(self, use_masking: bool=True, use_weighted_masking: bool=False): """Initialize JETS variance loss module. Args: use_masking (bool): Whether to apply masking for padded part in loss calculation. use_weighted_masking (bool): Whether to weighted masking in loss ca...
stack_v2_sparse_classes_10k_train_004974
46,210
permissive
[ { "docstring": "Initialize JETS variance loss module. Args: use_masking (bool): Whether to apply masking for padded part in loss calculation. use_weighted_masking (bool): Whether to weighted masking in loss calculation.", "name": "__init__", "signature": "def __init__(self, use_masking: bool=True, use_w...
2
stack_v2_sparse_classes_30k_train_002021
Implement the Python class `VarianceLoss` described below. Class description: Implement the VarianceLoss class. Method signatures and docstrings: - def __init__(self, use_masking: bool=True, use_weighted_masking: bool=False): Initialize JETS variance loss module. Args: use_masking (bool): Whether to apply masking for...
Implement the Python class `VarianceLoss` described below. Class description: Implement the VarianceLoss class. Method signatures and docstrings: - def __init__(self, use_masking: bool=True, use_weighted_masking: bool=False): Initialize JETS variance loss module. Args: use_masking (bool): Whether to apply masking for...
17854a04d43c231eff66bfed9d6aa55e94a29e79
<|skeleton|> class VarianceLoss: def __init__(self, use_masking: bool=True, use_weighted_masking: bool=False): """Initialize JETS variance loss module. Args: use_masking (bool): Whether to apply masking for padded part in loss calculation. use_weighted_masking (bool): Whether to weighted masking in loss ca...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class VarianceLoss: def __init__(self, use_masking: bool=True, use_weighted_masking: bool=False): """Initialize JETS variance loss module. Args: use_masking (bool): Whether to apply masking for padded part in loss calculation. use_weighted_masking (bool): Whether to weighted masking in loss calculation.""" ...
the_stack_v2_python_sparse
paddlespeech/t2s/modules/losses.py
anniyanvr/DeepSpeech-1
train
0
1b35840c85755524de2b13c94d529569683f53cf
[ "tree_node_list = []\nfor i in range(len(tree_data)):\n if tree_data[i] != 'null':\n tree_node_list.append(TreeNode(tree_data[i]))\n else:\n tree_node_list.append(None)\nfor i in range(len(tree_data)):\n if tree_node_list[i]:\n if 2 * i + 2 < len(tree_data):\n tree_node_list...
<|body_start_0|> tree_node_list = [] for i in range(len(tree_data)): if tree_data[i] != 'null': tree_node_list.append(TreeNode(tree_data[i])) else: tree_node_list.append(None) for i in range(len(tree_data)): if tree_node_list[i]...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def buildTree(self, tree_data): """:type tree_data: list :rtype: TreeNode""" <|body_0|> def maxDepth(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> tree_node_list = [] for i in rang...
stack_v2_sparse_classes_10k_train_004975
1,354
no_license
[ { "docstring": ":type tree_data: list :rtype: TreeNode", "name": "buildTree", "signature": "def buildTree(self, tree_data)" }, { "docstring": ":type root: TreeNode :rtype: int", "name": "maxDepth", "signature": "def maxDepth(self, root)" } ]
2
stack_v2_sparse_classes_30k_train_007304
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def buildTree(self, tree_data): :type tree_data: list :rtype: TreeNode - def maxDepth(self, root): :type root: TreeNode :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def buildTree(self, tree_data): :type tree_data: list :rtype: TreeNode - def maxDepth(self, root): :type root: TreeNode :rtype: int <|skeleton|> class Solution: def buildTr...
37ece0a8e92a41ced2b4ce0f2d8dda3826b915ae
<|skeleton|> class Solution: def buildTree(self, tree_data): """:type tree_data: list :rtype: TreeNode""" <|body_0|> def maxDepth(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def buildTree(self, tree_data): """:type tree_data: list :rtype: TreeNode""" tree_node_list = [] for i in range(len(tree_data)): if tree_data[i] != 'null': tree_node_list.append(TreeNode(tree_data[i])) else: tree_node_li...
the_stack_v2_python_sparse
Q104MaximumDepthofBinaryTree.py
ShenTonyM/LeetCode-Learn
train
0
d305f1870b6c70dd447b39d202d420daeeb492dd
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn MainError()", "from .error_details import ErrorDetails\nfrom .inner_error import InnerError\nfrom .error_details import ErrorDetails\nfrom .inner_error import InnerError\nfields: Dict[str, Callable[[Any], None]] = {'code': lambda n: se...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return MainError() <|end_body_0|> <|body_start_1|> from .error_details import ErrorDetails from .inner_error import InnerError from .error_details import ErrorDetails from .inne...
MainError
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MainError: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MainError: """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: MainEr...
stack_v2_sparse_classes_10k_train_004976
3,350
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: MainError", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value(par...
3
null
Implement the Python class `MainError` described below. Class description: Implement the MainError class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MainError: Creates a new instance of the appropriate class based on discriminator value Args: parse...
Implement the Python class `MainError` described below. Class description: Implement the MainError class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MainError: Creates a new instance of the appropriate class based on discriminator value Args: parse...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class MainError: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MainError: """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: MainEr...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MainError: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MainError: """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: MainError""" ...
the_stack_v2_python_sparse
msgraph/generated/models/o_data_errors/main_error.py
microsoftgraph/msgraph-sdk-python
train
135
85f47f0d3e6a9c0418d427d00de354e8fc2f4223
[ "self.plugin = OrographicEnhancement()\nself.plugin.grid_spacing_km = 3.0\nself.point_orogenh = np.array([[4.1, 4.6, 5.6, 6.8, 5.5], [4.4, 4.6, 5.8, 6.2, 5.5], [5.2, 3.0, 3.4, 5.1, 3.3], [0.6, 2.0, 1.8, 4.2, 2.5], [0.0, 0.0, 0.2, 3.2, 1.8]])\nself.wind_speed = np.full((5, 5), 25.0, dtype=np.float32)\nsin_wind_dir =...
<|body_start_0|> self.plugin = OrographicEnhancement() self.plugin.grid_spacing_km = 3.0 self.point_orogenh = np.array([[4.1, 4.6, 5.6, 6.8, 5.5], [4.4, 4.6, 5.8, 6.2, 5.5], [5.2, 3.0, 3.4, 5.1, 3.3], [0.6, 2.0, 1.8, 4.2, 2.5], [0.0, 0.0, 0.2, 3.2, 1.8]]) self.wind_speed = np.full((5, 5)...
Test the _compute_weighted_values method
Test__compute_weighted_values
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test__compute_weighted_values: """Test the _compute_weighted_values method""" def setUp(self): """Set up plugin and some inputs""" <|body_0|> def test_basic(self): """Test output is two arrays""" <|body_1|> def test_values(self): """Test valu...
stack_v2_sparse_classes_10k_train_004977
34,979
permissive
[ { "docstring": "Set up plugin and some inputs", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test output is two arrays", "name": "test_basic", "signature": "def test_basic(self)" }, { "docstring": "Test values are as expected", "name": "test_values", ...
3
null
Implement the Python class `Test__compute_weighted_values` described below. Class description: Test the _compute_weighted_values method Method signatures and docstrings: - def setUp(self): Set up plugin and some inputs - def test_basic(self): Test output is two arrays - def test_values(self): Test values are as expec...
Implement the Python class `Test__compute_weighted_values` described below. Class description: Test the _compute_weighted_values method Method signatures and docstrings: - def setUp(self): Set up plugin and some inputs - def test_basic(self): Test output is two arrays - def test_values(self): Test values are as expec...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test__compute_weighted_values: """Test the _compute_weighted_values method""" def setUp(self): """Set up plugin and some inputs""" <|body_0|> def test_basic(self): """Test output is two arrays""" <|body_1|> def test_values(self): """Test valu...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Test__compute_weighted_values: """Test the _compute_weighted_values method""" def setUp(self): """Set up plugin and some inputs""" self.plugin = OrographicEnhancement() self.plugin.grid_spacing_km = 3.0 self.point_orogenh = np.array([[4.1, 4.6, 5.6, 6.8, 5.5], [4.4, 4.6, 5...
the_stack_v2_python_sparse
improver_tests/orographic_enhancement/test_OrographicEnhancement.py
metoppv/improver
train
101
b652cd16ecd3e43b2865ffbc2505e7d68a8ca4ae
[ "self.total_count = total_count\nself.step = step\nself.cursor = 0", "self.cursor += 1\nif self.cursor > 1 and eq(self.cursor % self.step, 0):\n print('%.1f%%' % (100.0 * self.cursor / self.total_count))" ]
<|body_start_0|> self.total_count = total_count self.step = step self.cursor = 0 <|end_body_0|> <|body_start_1|> self.cursor += 1 if self.cursor > 1 and eq(self.cursor % self.step, 0): print('%.1f%%' % (100.0 * self.cursor / self.total_count)) <|end_body_1|>
ProcessPrint
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProcessPrint: def __init__(self, total_count, step=50): """:param total_count: 总量 :param step: 步长 :return:""" <|body_0|> def forward(self): """前进 :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.total_count = total_count self.st...
stack_v2_sparse_classes_10k_train_004978
3,299
permissive
[ { "docstring": ":param total_count: 总量 :param step: 步长 :return:", "name": "__init__", "signature": "def __init__(self, total_count, step=50)" }, { "docstring": "前进 :return:", "name": "forward", "signature": "def forward(self)" } ]
2
null
Implement the Python class `ProcessPrint` described below. Class description: Implement the ProcessPrint class. Method signatures and docstrings: - def __init__(self, total_count, step=50): :param total_count: 总量 :param step: 步长 :return: - def forward(self): 前进 :return:
Implement the Python class `ProcessPrint` described below. Class description: Implement the ProcessPrint class. Method signatures and docstrings: - def __init__(self, total_count, step=50): :param total_count: 总量 :param step: 步长 :return: - def forward(self): 前进 :return: <|skeleton|> class ProcessPrint: def __in...
a7c9567975b5372b2edabddb0fec8d73bc01c3dc
<|skeleton|> class ProcessPrint: def __init__(self, total_count, step=50): """:param total_count: 总量 :param step: 步长 :return:""" <|body_0|> def forward(self): """前进 :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ProcessPrint: def __init__(self, total_count, step=50): """:param total_count: 总量 :param step: 步长 :return:""" self.total_count = total_count self.step = step self.cursor = 0 def forward(self): """前进 :return:""" self.cursor += 1 if self.cursor > 1 an...
the_stack_v2_python_sparse
Dispatcher/tools_lib/common_util/archived/utils.py
cash2one/Logistics
train
0
150526e2268e028666be9eed2338ff75ac2e6966
[ "expected_obj = self.resize_prep_end_obj\nactual_json = json.dumps(self.instance_resize_prep_end_dict)\nactual_obj = InstanceResizePrepEnd.deserialize(actual_json, 'json')\nself.assertEqual(expected_obj, actual_obj)\nself.assertFalse(actual_obj.is_empty())", "modified_dict = self.instance_resize_prep_end_dict.cop...
<|body_start_0|> expected_obj = self.resize_prep_end_obj actual_json = json.dumps(self.instance_resize_prep_end_dict) actual_obj = InstanceResizePrepEnd.deserialize(actual_json, 'json') self.assertEqual(expected_obj, actual_obj) self.assertFalse(actual_obj.is_empty()) <|end_body_...
InstanceResizePrepEndTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InstanceResizePrepEndTest: def test_instance_resize_prep_end_valid_json(self): """Verify that the valid event deserialized correctly""" <|body_0|> def test_instance_resize_prep_end_missing_attribute_json(self): """Verify event missing expected attribute does not dese...
stack_v2_sparse_classes_10k_train_004979
5,720
permissive
[ { "docstring": "Verify that the valid event deserialized correctly", "name": "test_instance_resize_prep_end_valid_json", "signature": "def test_instance_resize_prep_end_valid_json(self)" }, { "docstring": "Verify event missing expected attribute does not deserialize", "name": "test_instance_...
3
null
Implement the Python class `InstanceResizePrepEndTest` described below. Class description: Implement the InstanceResizePrepEndTest class. Method signatures and docstrings: - def test_instance_resize_prep_end_valid_json(self): Verify that the valid event deserialized correctly - def test_instance_resize_prep_end_missi...
Implement the Python class `InstanceResizePrepEndTest` described below. Class description: Implement the InstanceResizePrepEndTest class. Method signatures and docstrings: - def test_instance_resize_prep_end_valid_json(self): Verify that the valid event deserialized correctly - def test_instance_resize_prep_end_missi...
7d49cf6bfd7e1a6e5b739e7de52f2e18e5ccf924
<|skeleton|> class InstanceResizePrepEndTest: def test_instance_resize_prep_end_valid_json(self): """Verify that the valid event deserialized correctly""" <|body_0|> def test_instance_resize_prep_end_missing_attribute_json(self): """Verify event missing expected attribute does not dese...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class InstanceResizePrepEndTest: def test_instance_resize_prep_end_valid_json(self): """Verify that the valid event deserialized correctly""" expected_obj = self.resize_prep_end_obj actual_json = json.dumps(self.instance_resize_prep_end_dict) actual_obj = InstanceResizePrepEnd.deseri...
the_stack_v2_python_sparse
metatests/events/models/compute/test_instance_resize_prep.py
kurhula/cloudcafe
train
0
31d527a544437cb4deac06a44ce603773282d238
[ "hrd = pcs.Field('hrd', 16, default=1)\npro = pcs.Field('pro', 16, default=2048)\nhln = pcs.Field('hln', 8, default=6)\npln = pcs.Field('pln', 8, default=4)\nop = pcs.Field('op', 16)\nsha = pcs.StringField('sha', 48)\nspa = pcs.Field('spa', 32)\ntha = pcs.StringField('tha', 48)\ntpa = pcs.Field('tpa', 32)\npcs.Pack...
<|body_start_0|> hrd = pcs.Field('hrd', 16, default=1) pro = pcs.Field('pro', 16, default=2048) hln = pcs.Field('hln', 8, default=6) pln = pcs.Field('pln', 8, default=4) op = pcs.Field('op', 16) sha = pcs.StringField('sha', 48) spa = pcs.Field('spa', 32) t...
arp
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class arp: def __init__(self, bytes=None): """initialize an ARP packet""" <|body_0|> def __str__(self): """return a human readable version of an ARP packet""" <|body_1|> <|end_skeleton|> <|body_start_0|> hrd = pcs.Field('hrd', 16, default=1) pro =...
stack_v2_sparse_classes_10k_train_004980
4,350
no_license
[ { "docstring": "initialize an ARP packet", "name": "__init__", "signature": "def __init__(self, bytes=None)" }, { "docstring": "return a human readable version of an ARP packet", "name": "__str__", "signature": "def __str__(self)" } ]
2
stack_v2_sparse_classes_30k_train_000541
Implement the Python class `arp` described below. Class description: Implement the arp class. Method signatures and docstrings: - def __init__(self, bytes=None): initialize an ARP packet - def __str__(self): return a human readable version of an ARP packet
Implement the Python class `arp` described below. Class description: Implement the arp class. Method signatures and docstrings: - def __init__(self, bytes=None): initialize an ARP packet - def __str__(self): return a human readable version of an ARP packet <|skeleton|> class arp: def __init__(self, bytes=None):...
a070a39586b582fbeea72abf12bbfd812955ad81
<|skeleton|> class arp: def __init__(self, bytes=None): """initialize an ARP packet""" <|body_0|> def __str__(self): """return a human readable version of an ARP packet""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class arp: def __init__(self, bytes=None): """initialize an ARP packet""" hrd = pcs.Field('hrd', 16, default=1) pro = pcs.Field('pro', 16, default=2048) hln = pcs.Field('hln', 8, default=6) pln = pcs.Field('pln', 8, default=4) op = pcs.Field('op', 16) sha = pc...
the_stack_v2_python_sparse
src/pcs/packets/arp.py
bilouro/tcptest
train
0
ecfbb7619ad69652fba8c29608cadcb7db8389c8
[ "super().__init__()\nself.resize_input = resize_input\nself.normalize_input = normalize_input\ninception = fid_inception_v3()\nself.features = nn.Sequential(inception.Conv2d_1a_3x3, inception.Conv2d_2a_3x3, inception.Conv2d_2b_3x3, nn.MaxPool2d(kernel_size=3, stride=2), inception.Conv2d_3b_1x1, inception.Conv2d_4a_...
<|body_start_0|> super().__init__() self.resize_input = resize_input self.normalize_input = normalize_input inception = fid_inception_v3() self.features = nn.Sequential(inception.Conv2d_1a_3x3, inception.Conv2d_2a_3x3, inception.Conv2d_2b_3x3, nn.MaxPool2d(kernel_size=3, stride=2...
Pretrained InceptionV3 network returning feature maps
FIDInceptionV3
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FIDInceptionV3: """Pretrained InceptionV3 network returning feature maps""" def __init__(self, resize_input=True, normalize_input=True, requires_grad=False): """Build pretrained InceptionV3 Parameters ---------- resize_input : bool If true, bilinearly resizes input to width and heigh...
stack_v2_sparse_classes_10k_train_004981
10,118
permissive
[ { "docstring": "Build pretrained InceptionV3 Parameters ---------- resize_input : bool If true, bilinearly resizes input to width and height 299 before feeding input to model. As the network without fully connected layers is fully convolutional, it should be able to handle inputs of arbitrary size, so resizing ...
2
stack_v2_sparse_classes_30k_train_001675
Implement the Python class `FIDInceptionV3` described below. Class description: Pretrained InceptionV3 network returning feature maps Method signatures and docstrings: - def __init__(self, resize_input=True, normalize_input=True, requires_grad=False): Build pretrained InceptionV3 Parameters ---------- resize_input : ...
Implement the Python class `FIDInceptionV3` described below. Class description: Pretrained InceptionV3 network returning feature maps Method signatures and docstrings: - def __init__(self, resize_input=True, normalize_input=True, requires_grad=False): Build pretrained InceptionV3 Parameters ---------- resize_input : ...
f19abcbedd844a700b2e2596dd817ea80cbb6287
<|skeleton|> class FIDInceptionV3: """Pretrained InceptionV3 network returning feature maps""" def __init__(self, resize_input=True, normalize_input=True, requires_grad=False): """Build pretrained InceptionV3 Parameters ---------- resize_input : bool If true, bilinearly resizes input to width and heigh...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FIDInceptionV3: """Pretrained InceptionV3 network returning feature maps""" def __init__(self, resize_input=True, normalize_input=True, requires_grad=False): """Build pretrained InceptionV3 Parameters ---------- resize_input : bool If true, bilinearly resizes input to width and height 299 before ...
the_stack_v2_python_sparse
horch/legacy/gan/inception.py
sbl1996/pytorch-hrvvi-ext
train
18
9f80b8fce268c87e43adbe8d3abc995e502b2d84
[ "main.clear_collections()\nresult = main.import_data('./data/', 'products', 'customers', 'rentals')\nself.assertEqual(result[1], 1000)\nself.assertEqual(result[2], 0)\nself.assertEqual(result[3], 1000)\nself.assertGreater(result[4], 0)", "function = main.show_available_products()\nproduct_1 = function['prd0018'][...
<|body_start_0|> main.clear_collections() result = main.import_data('./data/', 'products', 'customers', 'rentals') self.assertEqual(result[1], 1000) self.assertEqual(result[2], 0) self.assertEqual(result[3], 1000) self.assertGreater(result[4], 0) <|end_body_0|> <|body_st...
Class for testing HP Norton database
ModuleTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModuleTests: """Class for testing HP Norton database""" def test_import_data(self): """Test CSV import and correct database insertion functionality""" <|body_0|> def test_show_available_products(self): """Test DB to show all available products as a Python diction...
stack_v2_sparse_classes_10k_train_004982
2,469
no_license
[ { "docstring": "Test CSV import and correct database insertion functionality", "name": "test_import_data", "signature": "def test_import_data(self)" }, { "docstring": "Test DB to show all available products as a Python dictionary", "name": "test_show_available_products", "signature": "de...
3
null
Implement the Python class `ModuleTests` described below. Class description: Class for testing HP Norton database Method signatures and docstrings: - def test_import_data(self): Test CSV import and correct database insertion functionality - def test_show_available_products(self): Test DB to show all available product...
Implement the Python class `ModuleTests` described below. Class description: Class for testing HP Norton database Method signatures and docstrings: - def test_import_data(self): Test CSV import and correct database insertion functionality - def test_show_available_products(self): Test DB to show all available product...
5dac60f39e3909ff05b26721d602ed20f14d6be3
<|skeleton|> class ModuleTests: """Class for testing HP Norton database""" def test_import_data(self): """Test CSV import and correct database insertion functionality""" <|body_0|> def test_show_available_products(self): """Test DB to show all available products as a Python diction...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ModuleTests: """Class for testing HP Norton database""" def test_import_data(self): """Test CSV import and correct database insertion functionality""" main.clear_collections() result = main.import_data('./data/', 'products', 'customers', 'rentals') self.assertEqual(result[...
the_stack_v2_python_sparse
students/stellie/lesson07/assignment/test_parallel.py
JavaRod/SP_Python220B_2019
train
1
14324f1ab1f78d59bc0d5d53883d0f1b311fcf5a
[ "self.new_object_name = new_object_name\nself.overwrite = overwrite\nself.restore_time_secs = restore_time_secs", "if dictionary is None:\n return None\nnew_object_name = dictionary.get('newObjectName')\noverwrite = dictionary.get('overwrite')\nrestore_time_secs = dictionary.get('restoreTimeSecs')\nreturn cls(...
<|body_start_0|> self.new_object_name = new_object_name self.overwrite = overwrite self.restore_time_secs = restore_time_secs <|end_body_0|> <|body_start_1|> if dictionary is None: return None new_object_name = dictionary.get('newObjectName') overwrite = dict...
Implementation of the 'UdaRestoreObjectParams' model. TODO: type description here. Attributes: new_object_name (string): The new name of the object, if it is going to be renamed. overwrite (bool): Whether to overwrite or keep the object if the object being recovered already exists in the destination. restore_time_secs ...
UdaRestoreObjectParams
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UdaRestoreObjectParams: """Implementation of the 'UdaRestoreObjectParams' model. TODO: type description here. Attributes: new_object_name (string): The new name of the object, if it is going to be renamed. overwrite (bool): Whether to overwrite or keep the object if the object being recovered alr...
stack_v2_sparse_classes_10k_train_004983
2,230
permissive
[ { "docstring": "Constructor for the UdaRestoreObjectParams class", "name": "__init__", "signature": "def __init__(self, new_object_name=None, overwrite=None, restore_time_secs=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionar...
2
stack_v2_sparse_classes_30k_train_001823
Implement the Python class `UdaRestoreObjectParams` described below. Class description: Implementation of the 'UdaRestoreObjectParams' model. TODO: type description here. Attributes: new_object_name (string): The new name of the object, if it is going to be renamed. overwrite (bool): Whether to overwrite or keep the o...
Implement the Python class `UdaRestoreObjectParams` described below. Class description: Implementation of the 'UdaRestoreObjectParams' model. TODO: type description here. Attributes: new_object_name (string): The new name of the object, if it is going to be renamed. overwrite (bool): Whether to overwrite or keep the o...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class UdaRestoreObjectParams: """Implementation of the 'UdaRestoreObjectParams' model. TODO: type description here. Attributes: new_object_name (string): The new name of the object, if it is going to be renamed. overwrite (bool): Whether to overwrite or keep the object if the object being recovered alr...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UdaRestoreObjectParams: """Implementation of the 'UdaRestoreObjectParams' model. TODO: type description here. Attributes: new_object_name (string): The new name of the object, if it is going to be renamed. overwrite (bool): Whether to overwrite or keep the object if the object being recovered already exists i...
the_stack_v2_python_sparse
cohesity_management_sdk/models/uda_restore_object_params.py
cohesity/management-sdk-python
train
24
025193f000837a77cf88b95b37d345daddd2cfc4
[ "S = S.upper()\nl = len(S)\ndicts = {char: [[], 0] for char in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'}\nfor i, char in enumerate(S):\n dicts[char][0].append(i)\nans = 0\nprint(dicts)\nfor i, char in enumerate(S):\n pos = dicts[char][1]\n if pos - 1 >= 0:\n left = dicts[char][0][pos - 1]\n else:\n le...
<|body_start_0|> S = S.upper() l = len(S) dicts = {char: [[], 0] for char in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'} for i, char in enumerate(S): dicts[char][0].append(i) ans = 0 print(dicts) for i, char in enumerate(S): pos = dicts[char][1] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def uniqueLetterString(self, S): """:type S: str :rtype: int 517 ms""" <|body_0|> def uniqueLetterString_1(self, S): """136ms :param S: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> S = S.upper() l = len(S) dicts...
stack_v2_sparse_classes_10k_train_004984
2,560
no_license
[ { "docstring": ":type S: str :rtype: int 517 ms", "name": "uniqueLetterString", "signature": "def uniqueLetterString(self, S)" }, { "docstring": "136ms :param S: :return:", "name": "uniqueLetterString_1", "signature": "def uniqueLetterString_1(self, S)" } ]
2
stack_v2_sparse_classes_30k_train_003383
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def uniqueLetterString(self, S): :type S: str :rtype: int 517 ms - def uniqueLetterString_1(self, S): 136ms :param S: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def uniqueLetterString(self, S): :type S: str :rtype: int 517 ms - def uniqueLetterString_1(self, S): 136ms :param S: :return: <|skeleton|> class Solution: def uniqueLetter...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def uniqueLetterString(self, S): """:type S: str :rtype: int 517 ms""" <|body_0|> def uniqueLetterString_1(self, S): """136ms :param S: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def uniqueLetterString(self, S): """:type S: str :rtype: int 517 ms""" S = S.upper() l = len(S) dicts = {char: [[], 0] for char in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'} for i, char in enumerate(S): dicts[char][0].append(i) ans = 0 print(dic...
the_stack_v2_python_sparse
UniqueLetterString_HARD_828.py
953250587/leetcode-python
train
2
0a48e14b6b283b777b9041049549529b10dbbe1d
[ "if not quota_max_calls:\n use_rate_limiter = False\nself._groups = None\nself._members = None\nself._users = None\nsuper(AdminDirectoryRepositoryClient, self).__init__(API_NAME, versions=['directory_v1'], credentials=credentials, quota_max_calls=quota_max_calls, quota_period=quota_period, use_rate_limiter=use_r...
<|body_start_0|> if not quota_max_calls: use_rate_limiter = False self._groups = None self._members = None self._users = None super(AdminDirectoryRepositoryClient, self).__init__(API_NAME, versions=['directory_v1'], credentials=credentials, quota_max_calls=quota_max_c...
Admin Directory API Respository Client.
AdminDirectoryRepositoryClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdminDirectoryRepositoryClient: """Admin Directory API Respository Client.""" def __init__(self, credentials, quota_max_calls=None, quota_period=1.0, use_rate_limiter=True): """Constructor. Args: credentials (object): An google.auth credentials object. The admin directory API needs a...
stack_v2_sparse_classes_10k_train_004985
9,750
permissive
[ { "docstring": "Constructor. Args: credentials (object): An google.auth credentials object. The admin directory API needs a service account credential with delegated super admin role. quota_max_calls (int): Allowed requests per <quota_period> for the API. quota_period (float): The time period to track requests ...
4
stack_v2_sparse_classes_30k_train_002210
Implement the Python class `AdminDirectoryRepositoryClient` described below. Class description: Admin Directory API Respository Client. Method signatures and docstrings: - def __init__(self, credentials, quota_max_calls=None, quota_period=1.0, use_rate_limiter=True): Constructor. Args: credentials (object): An google...
Implement the Python class `AdminDirectoryRepositoryClient` described below. Class description: Admin Directory API Respository Client. Method signatures and docstrings: - def __init__(self, credentials, quota_max_calls=None, quota_period=1.0, use_rate_limiter=True): Constructor. Args: credentials (object): An google...
d4421afa50a17ed47cbebe942044ebab3720e0f5
<|skeleton|> class AdminDirectoryRepositoryClient: """Admin Directory API Respository Client.""" def __init__(self, credentials, quota_max_calls=None, quota_period=1.0, use_rate_limiter=True): """Constructor. Args: credentials (object): An google.auth credentials object. The admin directory API needs a...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AdminDirectoryRepositoryClient: """Admin Directory API Respository Client.""" def __init__(self, credentials, quota_max_calls=None, quota_period=1.0, use_rate_limiter=True): """Constructor. Args: credentials (object): An google.auth credentials object. The admin directory API needs a service acco...
the_stack_v2_python_sparse
google/cloud/forseti/common/gcp_api/admin_directory.py
kevensen/forseti-security
train
1
9e37b728d8045726aef7625fccc14111ecb0e1c8
[ "self.size = size\nself.q = collections.deque()\nself.sum_ = 0", "if len(self.q) == self.size:\n a = self.q.popleft()\n self.sum_ -= a\nself.q.append(val)\nself.sum_ += val\nreturn float(self.sum_) / len(self.q)" ]
<|body_start_0|> self.size = size self.q = collections.deque() self.sum_ = 0 <|end_body_0|> <|body_start_1|> if len(self.q) == self.size: a = self.q.popleft() self.sum_ -= a self.q.append(val) self.sum_ += val return float(self.sum_) / len...
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.q = col...
stack_v2_sparse_classes_10k_train_004986
826
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_000122
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: ...
e890bd480de93418ce10867085b52137be2caa7a
<|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.q = collections.deque() self.sum_ = 0 def next(self, val): """:type val: int :rtype: float""" if len(self.q) == self.size: ...
the_stack_v2_python_sparse
python/346.py
LichAmnesia/LeetCode
train
0
83b027bbe9a384bab501f1ad937396ebf4515b3f
[ "logger.info('Checking Appfollow API connection...')\ntry:\n ext_id = config['ext_id']\n cid = config['cid']\n api_secret = config['api_secret']\n response = requests.get(f'https://api.appfollow.io/ratings?ext_id={ext_id}&cid={cid}', auth=HTTPBasicAuth(api_secret, api_secret))\n if response.status_co...
<|body_start_0|> logger.info('Checking Appfollow API connection...') try: ext_id = config['ext_id'] cid = config['cid'] api_secret = config['api_secret'] response = requests.get(f'https://api.appfollow.io/ratings?ext_id={ext_id}&cid={cid}', auth=HTTPBasicA...
SourceAppfollow
[ "MIT", "Apache-2.0", "BSD-3-Clause", "Elastic-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SourceAppfollow: def check_connection(self, logger, config) -> Tuple[bool, any]: """A connection check to validate that the user-provided config can be used to connect to the underlying API :param config: the user-input config object conforming to the connector's spec.yaml :param logger:...
stack_v2_sparse_classes_10k_train_004987
3,806
permissive
[ { "docstring": "A connection check to validate that the user-provided config can be used to connect to the underlying API :param config: the user-input config object conforming to the connector's spec.yaml :param logger: logger object :return Tuple[bool, any]: (True, None) if the input config can be used to con...
2
stack_v2_sparse_classes_30k_train_006111
Implement the Python class `SourceAppfollow` described below. Class description: Implement the SourceAppfollow class. Method signatures and docstrings: - def check_connection(self, logger, config) -> Tuple[bool, any]: A connection check to validate that the user-provided config can be used to connect to the underlyin...
Implement the Python class `SourceAppfollow` described below. Class description: Implement the SourceAppfollow class. Method signatures and docstrings: - def check_connection(self, logger, config) -> Tuple[bool, any]: A connection check to validate that the user-provided config can be used to connect to the underlyin...
8d5f9a2d49ab8f9e85ccf058cb02c2fda287afc6
<|skeleton|> class SourceAppfollow: def check_connection(self, logger, config) -> Tuple[bool, any]: """A connection check to validate that the user-provided config can be used to connect to the underlying API :param config: the user-input config object conforming to the connector's spec.yaml :param logger:...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SourceAppfollow: def check_connection(self, logger, config) -> Tuple[bool, any]: """A connection check to validate that the user-provided config can be used to connect to the underlying API :param config: the user-input config object conforming to the connector's spec.yaml :param logger: logger object...
the_stack_v2_python_sparse
dts/airbyte/airbyte-integrations/connectors/source-appfollow/source_appfollow/source.py
alldatacenter/alldata
train
774
58f65d75ad373949cf0198f5c14d8a296cf06d03
[ "super().__init__(coordinator=coordinator, kind=kind, name=name, icon=icon, item_id=item_id, state_key=state_key)\nself._max_speed = int(coordinator.data[item_id].get('Max-Pump-Speed', 100))\nself._min_speed = int(coordinator.data[item_id].get('Min-Pump-Speed', 0))\nif 'Filter-Type' in coordinator.data[item_id]:\n ...
<|body_start_0|> super().__init__(coordinator=coordinator, kind=kind, name=name, icon=icon, item_id=item_id, state_key=state_key) self._max_speed = int(coordinator.data[item_id].get('Max-Pump-Speed', 100)) self._min_speed = int(coordinator.data[item_id].get('Min-Pump-Speed', 0)) if 'Filt...
Define the OmniLogic Pump Switch Entity.
OmniLogicPumpControl
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OmniLogicPumpControl: """Define the OmniLogic Pump Switch Entity.""" def __init__(self, coordinator: OmniLogicUpdateCoordinator, kind: str, name: str, icon: str, item_id: tuple, state_key: str) -> None: """Initialize entities.""" <|body_0|> async def async_turn_on(self, ...
stack_v2_sparse_classes_10k_train_004988
8,137
permissive
[ { "docstring": "Initialize entities.", "name": "__init__", "signature": "def __init__(self, coordinator: OmniLogicUpdateCoordinator, kind: str, name: str, icon: str, item_id: tuple, state_key: str) -> None" }, { "docstring": "Turn on the pump.", "name": "async_turn_on", "signature": "asy...
4
null
Implement the Python class `OmniLogicPumpControl` described below. Class description: Define the OmniLogic Pump Switch Entity. Method signatures and docstrings: - def __init__(self, coordinator: OmniLogicUpdateCoordinator, kind: str, name: str, icon: str, item_id: tuple, state_key: str) -> None: Initialize entities. ...
Implement the Python class `OmniLogicPumpControl` described below. Class description: Define the OmniLogic Pump Switch Entity. Method signatures and docstrings: - def __init__(self, coordinator: OmniLogicUpdateCoordinator, kind: str, name: str, icon: str, item_id: tuple, state_key: str) -> None: Initialize entities. ...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class OmniLogicPumpControl: """Define the OmniLogic Pump Switch Entity.""" def __init__(self, coordinator: OmniLogicUpdateCoordinator, kind: str, name: str, icon: str, item_id: tuple, state_key: str) -> None: """Initialize entities.""" <|body_0|> async def async_turn_on(self, ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class OmniLogicPumpControl: """Define the OmniLogic Pump Switch Entity.""" def __init__(self, coordinator: OmniLogicUpdateCoordinator, kind: str, name: str, icon: str, item_id: tuple, state_key: str) -> None: """Initialize entities.""" super().__init__(coordinator=coordinator, kind=kind, name=n...
the_stack_v2_python_sparse
homeassistant/components/omnilogic/switch.py
home-assistant/core
train
35,501
e9eadedcbc1992bce435b1d3120e3e81bc3f46f3
[ "for element in brain.getObject().objectValues():\n info = {'title': element.title or ''}\n if element.portal_type == 'PSCFileLink':\n info['url'] = element.externalURL\n else:\n info['url'] = element.absolute_url()\n yield info", "sc = self.context\ncatalog = getToolByName(self.context,...
<|body_start_0|> for element in brain.getObject().objectValues(): info = {'title': element.title or ''} if element.portal_type == 'PSCFileLink': info['url'] = element.externalURL else: info['url'] = element.absolute_url() yield info...
view used for the main index page
PyPISimpleView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PyPISimpleView: """view used for the main index page""" def get_urls_and_titles(self, brain): """returns url and title""" <|body_0|> def get_files(self): """provides the simple view over the projects with links to the published files""" <|body_1|> <|end_...
stack_v2_sparse_classes_10k_train_004989
1,303
no_license
[ { "docstring": "returns url and title", "name": "get_urls_and_titles", "signature": "def get_urls_and_titles(self, brain)" }, { "docstring": "provides the simple view over the projects with links to the published files", "name": "get_files", "signature": "def get_files(self)" } ]
2
null
Implement the Python class `PyPISimpleView` described below. Class description: view used for the main index page Method signatures and docstrings: - def get_urls_and_titles(self, brain): returns url and title - def get_files(self): provides the simple view over the projects with links to the published files
Implement the Python class `PyPISimpleView` described below. Class description: view used for the main index page Method signatures and docstrings: - def get_urls_and_titles(self, brain): returns url and title - def get_files(self): provides the simple view over the projects with links to the published files <|skele...
8a7bdbdb98c3f9fc1073c6061cd2d3a0ec80caf5
<|skeleton|> class PyPISimpleView: """view used for the main index page""" def get_urls_and_titles(self, brain): """returns url and title""" <|body_0|> def get_files(self): """provides the simple view over the projects with links to the published files""" <|body_1|> <|end_...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PyPISimpleView: """view used for the main index page""" def get_urls_and_titles(self, brain): """returns url and title""" for element in brain.getObject().objectValues(): info = {'title': element.title or ''} if element.portal_type == 'PSCFileLink': ...
the_stack_v2_python_sparse
buildout-cache/eggs/Products.PloneSoftwareCenter-1.5-py2.7.egg/Products/PloneSoftwareCenter/browser/pypisimple.py
renansfs/Plone_SP
train
0
4b87ed0ed26a18fa2ef261ce8731e61c4b73eeea
[ "self.system = system\nself.cpu = cpu\nself.memory = memory\nself.gpu = gpu", "system = platform.platform()\ngpu = GPU.from_host()\nmemory = Memory.from_host()\ncpu = CPU.from_host()\nreturn SystemInfo(system=system, cpu=cpu, gpu=gpu, memory=memory)" ]
<|body_start_0|> self.system = system self.cpu = cpu self.memory = memory self.gpu = gpu <|end_body_0|> <|body_start_1|> system = platform.platform() gpu = GPU.from_host() memory = Memory.from_host() cpu = CPU.from_host() return SystemInfo(system=...
System Information data object
SystemInfo
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SystemInfo: """System Information data object""" def __init__(self, system: str, cpu: CPU, memory: Memory, gpu: GPU): """Args: system: name of operating system cpu: CPU info memory: Memory info gpu: GPU info""" <|body_0|> def from_host(): """Create SystemInfo obj...
stack_v2_sparse_classes_10k_train_004990
9,744
permissive
[ { "docstring": "Args: system: name of operating system cpu: CPU info memory: Memory info gpu: GPU info", "name": "__init__", "signature": "def __init__(self, system: str, cpu: CPU, memory: Memory, gpu: GPU)" }, { "docstring": "Create SystemInfo object from host data Returns: SystemInfo object", ...
2
stack_v2_sparse_classes_30k_train_001583
Implement the Python class `SystemInfo` described below. Class description: System Information data object Method signatures and docstrings: - def __init__(self, system: str, cpu: CPU, memory: Memory, gpu: GPU): Args: system: name of operating system cpu: CPU info memory: Memory info gpu: GPU info - def from_host(): ...
Implement the Python class `SystemInfo` described below. Class description: System Information data object Method signatures and docstrings: - def __init__(self, system: str, cpu: CPU, memory: Memory, gpu: GPU): Args: system: name of operating system cpu: CPU info memory: Memory info gpu: GPU info - def from_host(): ...
a5388a45f71a949639b35cc5b990bd130d2d8164
<|skeleton|> class SystemInfo: """System Information data object""" def __init__(self, system: str, cpu: CPU, memory: Memory, gpu: GPU): """Args: system: name of operating system cpu: CPU info memory: Memory info gpu: GPU info""" <|body_0|> def from_host(): """Create SystemInfo obj...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SystemInfo: """System Information data object""" def __init__(self, system: str, cpu: CPU, memory: Memory, gpu: GPU): """Args: system: name of operating system cpu: CPU info memory: Memory info gpu: GPU info""" self.system = system self.cpu = cpu self.memory = memory ...
the_stack_v2_python_sparse
PyTorch/LanguageModeling/BERT/triton/runner/task.py
NVIDIA/DeepLearningExamples
train
11,838
4124c96e23e7b62944f93c83382e3889b63484a6
[ "if not must_contain:\n return\nif isinstance(must_contain, str):\n must_contain = [must_contain]\nregexes = [re.compile(s) for s in must_contain]\nfor i, r in enumerate(regexes):\n match = r.search(output)\n if not match:\n self.fail(f\"Output of command: '{cmd}' contained no match for: '{must_c...
<|body_start_0|> if not must_contain: return if isinstance(must_contain, str): must_contain = [must_contain] regexes = [re.compile(s) for s in must_contain] for i, r in enumerate(regexes): match = r.search(output) if not match: ...
Utility Module for building tests that reliably check if a sub-process ran successfully. Commonly with an integration/system test you want to check a command can be run successfully and gives some expected output. How to use: 1. Make a test case in the normal way but inherit from test_util.SubProcessChecker instead of ...
SubProcessChecker
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubProcessChecker: """Utility Module for building tests that reliably check if a sub-process ran successfully. Commonly with an integration/system test you want to check a command can be run successfully and gives some expected output. How to use: 1. Make a test case in the normal way but inherit...
stack_v2_sparse_classes_10k_train_004991
18,428
permissive
[ { "docstring": "Internal utility used by run_command(...) to check output (Should not need to call this directly from test cases).", "name": "_check_output", "signature": "def _check_output(self, cmd, output: str, must_contain: List[str])" }, { "docstring": "Run a command using subprocess, check...
2
null
Implement the Python class `SubProcessChecker` described below. Class description: Utility Module for building tests that reliably check if a sub-process ran successfully. Commonly with an integration/system test you want to check a command can be run successfully and gives some expected output. How to use: 1. Make a ...
Implement the Python class `SubProcessChecker` described below. Class description: Utility Module for building tests that reliably check if a sub-process ran successfully. Commonly with an integration/system test you want to check a command can be run successfully and gives some expected output. How to use: 1. Make a ...
e2f834dd60e7939672c1795b4ac62e89ad0bca49
<|skeleton|> class SubProcessChecker: """Utility Module for building tests that reliably check if a sub-process ran successfully. Commonly with an integration/system test you want to check a command can be run successfully and gives some expected output. How to use: 1. Make a test case in the normal way but inherit...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SubProcessChecker: """Utility Module for building tests that reliably check if a sub-process ran successfully. Commonly with an integration/system test you want to check a command can be run successfully and gives some expected output. How to use: 1. Make a test case in the normal way but inherit from test_ut...
the_stack_v2_python_sparse
utils/examples_tests/test_util.py
graphcore/examples
train
311
74979e1e8793f43899afbb5ae6a5d64aeed8dd09
[ "url = 'os-services'\nif params:\n url += '?%s' % urllib.urlencode(params)\nresp, body = self.get(url)\nbody = json.loads(body)\nschema = self.get_schema(self.schema_versions_info)\nself.validate_response(schema.list_services, resp, body)\nreturn rest_client.ResponseBody(resp, body)", "put_body = json.dumps(kw...
<|body_start_0|> url = 'os-services' if params: url += '?%s' % urllib.urlencode(params) resp, body = self.get(url) body = json.loads(body) schema = self.get_schema(self.schema_versions_info) self.validate_response(schema.list_services, resp, body) retu...
Client class to send CRUD Volume Services API requests
ServicesClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ServicesClient: """Client class to send CRUD Volume Services API requests""" def list_services(self, **params): """List all Cinder services. For a full list of available parameters, please refer to the official API reference: https://docs.openstack.org/api-ref/block-storage/v3/#list-...
stack_v2_sparse_classes_10k_train_004992
4,477
permissive
[ { "docstring": "List all Cinder services. For a full list of available parameters, please refer to the official API reference: https://docs.openstack.org/api-ref/block-storage/v3/#list-all-cinder-services", "name": "list_services", "signature": "def list_services(self, **params)" }, { "docstring...
6
stack_v2_sparse_classes_30k_train_001126
Implement the Python class `ServicesClient` described below. Class description: Client class to send CRUD Volume Services API requests Method signatures and docstrings: - def list_services(self, **params): List all Cinder services. For a full list of available parameters, please refer to the official API reference: h...
Implement the Python class `ServicesClient` described below. Class description: Client class to send CRUD Volume Services API requests Method signatures and docstrings: - def list_services(self, **params): List all Cinder services. For a full list of available parameters, please refer to the official API reference: h...
3932a799e620a20d7abf7b89e21b520683a1809b
<|skeleton|> class ServicesClient: """Client class to send CRUD Volume Services API requests""" def list_services(self, **params): """List all Cinder services. For a full list of available parameters, please refer to the official API reference: https://docs.openstack.org/api-ref/block-storage/v3/#list-...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ServicesClient: """Client class to send CRUD Volume Services API requests""" def list_services(self, **params): """List all Cinder services. For a full list of available parameters, please refer to the official API reference: https://docs.openstack.org/api-ref/block-storage/v3/#list-all-cinder-se...
the_stack_v2_python_sparse
tempest/lib/services/volume/v3/services_client.py
openstack/tempest
train
270
9512ac65ee120de771f37f2dc6182ea6f5e88231
[ "similarity_calc = region_similarity_calculator.IouSimilarity()\nmatcher = argmax_matcher.ArgMaxMatcher(match_threshold, unmatched_threshold=match_threshold, negatives_lower_than_unmatched=True, force_match_for_each_row=True)\nbox_coder = faster_rcnn_box_coder.FasterRcnnBoxCoder()\nself._target_assigner = target_as...
<|body_start_0|> similarity_calc = region_similarity_calculator.IouSimilarity() matcher = argmax_matcher.ArgMaxMatcher(match_threshold, unmatched_threshold=match_threshold, negatives_lower_than_unmatched=True, force_match_for_each_row=True) box_coder = faster_rcnn_box_coder.FasterRcnnBoxCoder() ...
Labeler for multiscale anchor boxes.
AnchorLabeler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnchorLabeler: """Labeler for multiscale anchor boxes.""" def __init__(self, anchors, num_classes, match_threshold=0.5): """Constructs anchor labeler to assign labels to anchors. Args: anchors: an instance of class Anchors. num_classes: integer number representing number of classes i...
stack_v2_sparse_classes_10k_train_004993
10,735
permissive
[ { "docstring": "Constructs anchor labeler to assign labels to anchors. Args: anchors: an instance of class Anchors. num_classes: integer number representing number of classes in the dataset. match_threshold: float number between 0 and 1 representing the threshold to assign positive labels for anchors.", "na...
3
null
Implement the Python class `AnchorLabeler` described below. Class description: Labeler for multiscale anchor boxes. Method signatures and docstrings: - def __init__(self, anchors, num_classes, match_threshold=0.5): Constructs anchor labeler to assign labels to anchors. Args: anchors: an instance of class Anchors. num...
Implement the Python class `AnchorLabeler` described below. Class description: Labeler for multiscale anchor boxes. Method signatures and docstrings: - def __init__(self, anchors, num_classes, match_threshold=0.5): Constructs anchor labeler to assign labels to anchors. Args: anchors: an instance of class Anchors. num...
a5388a45f71a949639b35cc5b990bd130d2d8164
<|skeleton|> class AnchorLabeler: """Labeler for multiscale anchor boxes.""" def __init__(self, anchors, num_classes, match_threshold=0.5): """Constructs anchor labeler to assign labels to anchors. Args: anchors: an instance of class Anchors. num_classes: integer number representing number of classes i...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AnchorLabeler: """Labeler for multiscale anchor boxes.""" def __init__(self, anchors, num_classes, match_threshold=0.5): """Constructs anchor labeler to assign labels to anchors. Args: anchors: an instance of class Anchors. num_classes: integer number representing number of classes in the dataset...
the_stack_v2_python_sparse
TensorFlow2/Detection/Efficientdet/model/anchors.py
NVIDIA/DeepLearningExamples
train
11,838
98a0e702cc5df157fd32d387767acc8b2f588187
[ "super(NRIModel, self).__init__()\nself.enc = AttENC(dim, n_hid, edge_type, do_prob)\nself.dec = RNNDEC(dim, edge_type, n_hid, n_hid, n_hid, do_prob, skip_first)\nself.gumbel_softmax = GumbelSoftmax()\nself.es = Tensor(es, dtype=ms.int32)\nself.size = size", "logits = self.enc(states_enc, self.es)\nedges = self.g...
<|body_start_0|> super(NRIModel, self).__init__() self.enc = AttENC(dim, n_hid, edge_type, do_prob) self.dec = RNNDEC(dim, edge_type, n_hid, n_hid, n_hid, do_prob, skip_first) self.gumbel_softmax = GumbelSoftmax() self.es = Tensor(es, dtype=ms.int32) self.size = size <|en...
Auto-encoder.
NRIModel
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NRIModel: """Auto-encoder.""" def __init__(self, dim, n_hid, edge_type, do_prob, skip_first, size, es): """Parameters ---------- encoder : nn.Cell an encoder inferring relations. decoder : nn.Cell an decoder predicting future states. es : Tensor edge list. size : int number of nodes....
stack_v2_sparse_classes_10k_train_004994
12,491
permissive
[ { "docstring": "Parameters ---------- encoder : nn.Cell an encoder inferring relations. decoder : nn.Cell an decoder predicting future states. es : Tensor edge list. size : int number of nodes.", "name": "__init__", "signature": "def __init__(self, dim, n_hid, edge_type, do_prob, skip_first, size, es)" ...
2
null
Implement the Python class `NRIModel` described below. Class description: Auto-encoder. Method signatures and docstrings: - def __init__(self, dim, n_hid, edge_type, do_prob, skip_first, size, es): Parameters ---------- encoder : nn.Cell an encoder inferring relations. decoder : nn.Cell an decoder predicting future s...
Implement the Python class `NRIModel` described below. Class description: Auto-encoder. Method signatures and docstrings: - def __init__(self, dim, n_hid, edge_type, do_prob, skip_first, size, es): Parameters ---------- encoder : nn.Cell an encoder inferring relations. decoder : nn.Cell an decoder predicting future s...
eab643f51336dbf7d711f02d27e6516e5affee59
<|skeleton|> class NRIModel: """Auto-encoder.""" def __init__(self, dim, n_hid, edge_type, do_prob, skip_first, size, es): """Parameters ---------- encoder : nn.Cell an encoder inferring relations. decoder : nn.Cell an decoder predicting future states. es : Tensor edge list. size : int number of nodes....
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NRIModel: """Auto-encoder.""" def __init__(self, dim, n_hid, edge_type, do_prob, skip_first, size, es): """Parameters ---------- encoder : nn.Cell an encoder inferring relations. decoder : nn.Cell an decoder predicting future states. es : Tensor edge list. size : int number of nodes.""" s...
the_stack_v2_python_sparse
research/gnn/nri-mpm/models/nri.py
mindspore-ai/models
train
301
8707cb81b2fdeea848921f87af2905db93c48710
[ "predecessors = []\nfor idx in range(len(word)):\n predecessors.append(word[:idx] + word[idx + 1:])\nreturn predecessors", "words.sort(key=lambda word: len(word))\nword_to_chain_length = {}\nmax_chain_length = 1\nfor word in words:\n word_to_chain_length[word] = 1\n predecessors = self.get_predecessors(w...
<|body_start_0|> predecessors = [] for idx in range(len(word)): predecessors.append(word[:idx] + word[idx + 1:]) return predecessors <|end_body_0|> <|body_start_1|> words.sort(key=lambda word: len(word)) word_to_chain_length = {} max_chain_length = 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def get_predecessors(self, word): """Return a list of words with 1 character removed from the provided word""" <|body_0|> def longestStrChain(self, words): """:type words: List[str] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_004995
1,544
no_license
[ { "docstring": "Return a list of words with 1 character removed from the provided word", "name": "get_predecessors", "signature": "def get_predecessors(self, word)" }, { "docstring": ":type words: List[str] :rtype: int", "name": "longestStrChain", "signature": "def longestStrChain(self, ...
2
stack_v2_sparse_classes_30k_train_006488
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def get_predecessors(self, word): Return a list of words with 1 character removed from the provided word - def longestStrChain(self, words): :type words: List[str] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def get_predecessors(self, word): Return a list of words with 1 character removed from the provided word - def longestStrChain(self, words): :type words: List[str] :rtype: int <...
52d71a93de7f002ac887a82c947e1e32a3e7255f
<|skeleton|> class Solution: def get_predecessors(self, word): """Return a list of words with 1 character removed from the provided word""" <|body_0|> def longestStrChain(self, words): """:type words: List[str] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def get_predecessors(self, word): """Return a list of words with 1 character removed from the provided word""" predecessors = [] for idx in range(len(word)): predecessors.append(word[:idx] + word[idx + 1:]) return predecessors def longestStrChain(self...
the_stack_v2_python_sparse
template/solution.py
code-in-public/leetcode
train
3
c235f3fe930ecc07f178311983aad70f6f0706f1
[ "super().__init__(name, instrument, **kwargs)\nself._reference = instrument.root_instrument.reference\nself._dll_get_function = partial(dll_get_function, self._reference)\nself._dll_set_function = partial(dll_set_function, self._reference)", "if hasattr(self.instrument, 'channel_number'):\n instr = cast(Instru...
<|body_start_0|> super().__init__(name, instrument, **kwargs) self._reference = instrument.root_instrument.reference self._dll_get_function = partial(dll_get_function, self._reference) self._dll_set_function = partial(dll_set_function, self._reference) <|end_body_0|> <|body_start_1|> ...
LdaParameter
[ "GPL-2.0-only", "GPL-2.0-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LdaParameter: def __init__(self, name: str, instrument: Union[Vaunix_LDA, LdaChannel], dll_get_function: Callable, dll_set_function: Callable, **kwargs): """Parameter associated with one channel of the LDA. Args: name: parameter name instrument: parent instrument, either LDA or LDA chann...
stack_v2_sparse_classes_10k_train_004996
12,103
permissive
[ { "docstring": "Parameter associated with one channel of the LDA. Args: name: parameter name instrument: parent instrument, either LDA or LDA channel dll_get_function: DLL function that gets the value dll_get_function: DLL function that sets the value", "name": "__init__", "signature": "def __init__(sel...
4
stack_v2_sparse_classes_30k_train_006445
Implement the Python class `LdaParameter` described below. Class description: Implement the LdaParameter class. Method signatures and docstrings: - def __init__(self, name: str, instrument: Union[Vaunix_LDA, LdaChannel], dll_get_function: Callable, dll_set_function: Callable, **kwargs): Parameter associated with one ...
Implement the Python class `LdaParameter` described below. Class description: Implement the LdaParameter class. Method signatures and docstrings: - def __init__(self, name: str, instrument: Union[Vaunix_LDA, LdaChannel], dll_get_function: Callable, dll_set_function: Callable, **kwargs): Parameter associated with one ...
e07c9f23339ab00b0f4c4cc46711593d88f7fc84
<|skeleton|> class LdaParameter: def __init__(self, name: str, instrument: Union[Vaunix_LDA, LdaChannel], dll_get_function: Callable, dll_set_function: Callable, **kwargs): """Parameter associated with one channel of the LDA. Args: name: parameter name instrument: parent instrument, either LDA or LDA chann...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LdaParameter: def __init__(self, name: str, instrument: Union[Vaunix_LDA, LdaChannel], dll_get_function: Callable, dll_set_function: Callable, **kwargs): """Parameter associated with one channel of the LDA. Args: name: parameter name instrument: parent instrument, either LDA or LDA channel dll_get_fun...
the_stack_v2_python_sparse
qcodes_contrib_drivers/drivers/Vaunix/LDA.py
QCoDeS/Qcodes_contrib_drivers
train
32
f1620989ed61be9a21630c9afabc0867551b62e2
[ "self.reporting = reporting\nself.github = GitHubService(ghName, ghToken)\nself.artifacts = ArtifactService()\nself.monitoring = MonitoringService()\nself.idle = True\nself.started = 0", "s = os.statvfs(config.prbuildsRoot)\nfreeSpaceMB = s.f_frsize * s.f_bavail / 1000 / 1000\nhealth = {'has free space': freeSpac...
<|body_start_0|> self.reporting = reporting self.github = GitHubService(ghName, ghToken) self.artifacts = ArtifactService() self.monitoring = MonitoringService() self.idle = True self.started = 0 <|end_body_0|> <|body_start_1|> s = os.statvfs(config.prbuildsRoot)...
Trousers
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Trousers: def __init__(self, reporting, ghName, ghToken): """constructor""" <|body_0|> def is_healthy(self): """we are healthy under these conditions""" <|body_1|> def process(self, action, bucket, metricService): """process a message coming off ...
stack_v2_sparse_classes_10k_train_004997
3,641
no_license
[ { "docstring": "constructor", "name": "__init__", "signature": "def __init__(self, reporting, ghName, ghToken)" }, { "docstring": "we are healthy under these conditions", "name": "is_healthy", "signature": "def is_healthy(self)" }, { "docstring": "process a message coming off the...
4
stack_v2_sparse_classes_30k_val_000193
Implement the Python class `Trousers` described below. Class description: Implement the Trousers class. Method signatures and docstrings: - def __init__(self, reporting, ghName, ghToken): constructor - def is_healthy(self): we are healthy under these conditions - def process(self, action, bucket, metricService): proc...
Implement the Python class `Trousers` described below. Class description: Implement the Trousers class. Method signatures and docstrings: - def __init__(self, reporting, ghName, ghToken): constructor - def is_healthy(self): we are healthy under these conditions - def process(self, action, bucket, metricService): proc...
1dd8f0959fec8a3bb5e06ee0c4acdd43c509765b
<|skeleton|> class Trousers: def __init__(self, reporting, ghName, ghToken): """constructor""" <|body_0|> def is_healthy(self): """we are healthy under these conditions""" <|body_1|> def process(self, action, bucket, metricService): """process a message coming off ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Trousers: def __init__(self, reporting, ghName, ghToken): """constructor""" self.reporting = reporting self.github = GitHubService(ghName, ghToken) self.artifacts = ArtifactService() self.monitoring = MonitoringService() self.idle = True self.started = 0...
the_stack_v2_python_sparse
trousers/trouserlib/trousers.py
guardian/prbuilds
train
6
d6697b69f888aa83ef7cbd034c6a20d4dd7f0745
[ "super(DeepLPFNet, self).__init__()\nself.backbonenet = unet.UNetModel()\nself.deeplpfnet = DeepLPFParameterPrediction()", "feat = self.backbonenet(img)\nimg = self.deeplpfnet(feat)\nreturn img" ]
<|body_start_0|> super(DeepLPFNet, self).__init__() self.backbonenet = unet.UNetModel() self.deeplpfnet = DeepLPFParameterPrediction() <|end_body_0|> <|body_start_1|> feat = self.backbonenet(img) img = self.deeplpfnet(feat) return img <|end_body_1|>
DeepLPFNet
[ "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeepLPFNet: def __init__(self): """Initialisation function :returns: initialises parameters of the neural networ :rtype: N/A""" <|body_0|> def forward(self, img): """Neural network forward function :param img: forward the data img through the network :returns: residu...
stack_v2_sparse_classes_10k_train_004998
38,578
permissive
[ { "docstring": "Initialisation function :returns: initialises parameters of the neural networ :rtype: N/A", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Neural network forward function :param img: forward the data img through the network :returns: residual image :rtyp...
2
stack_v2_sparse_classes_30k_train_003840
Implement the Python class `DeepLPFNet` described below. Class description: Implement the DeepLPFNet class. Method signatures and docstrings: - def __init__(self): Initialisation function :returns: initialises parameters of the neural networ :rtype: N/A - def forward(self, img): Neural network forward function :param...
Implement the Python class `DeepLPFNet` described below. Class description: Implement the DeepLPFNet class. Method signatures and docstrings: - def __init__(self): Initialisation function :returns: initialises parameters of the neural networ :rtype: N/A - def forward(self, img): Neural network forward function :param...
82c49c36b76987a46dec8479793f7cf0150839c6
<|skeleton|> class DeepLPFNet: def __init__(self): """Initialisation function :returns: initialises parameters of the neural networ :rtype: N/A""" <|body_0|> def forward(self, img): """Neural network forward function :param img: forward the data img through the network :returns: residu...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DeepLPFNet: def __init__(self): """Initialisation function :returns: initialises parameters of the neural networ :rtype: N/A""" super(DeepLPFNet, self).__init__() self.backbonenet = unet.UNetModel() self.deeplpfnet = DeepLPFParameterPrediction() def forward(self, img): ...
the_stack_v2_python_sparse
DeepLPF/model.py
huawei-noah/noah-research
train
816
4a8f0e5e1d53827cd43c487ddf3b7f384c341376
[ "if not isinstance(item, Area):\n raise TypeError(f'{item} is not an Area. Only Area objects can be inside Areas.')\nself.data.append(item)", "containing = Areas()\nfor area in self:\n field = rgetattr(area, field_name)\n if field.value == field_value:\n containing.append(area)\nreturn containing"...
<|body_start_0|> if not isinstance(item, Area): raise TypeError(f'{item} is not an Area. Only Area objects can be inside Areas.') self.data.append(item) <|end_body_0|> <|body_start_1|> containing = Areas() for area in self: field = rgetattr(area, field_name) ...
Searchable collection of Areas. Behaves like a list.
Areas
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Areas: """Searchable collection of Areas. Behaves like a list.""" def append(self, item: Area) -> None: """Add a new Area to the container. Raises: TypeError: If a non-Area object is given.""" <|body_0|> def containing(self, field_name: str, field_value: str): ""...
stack_v2_sparse_classes_10k_train_004999
3,005
permissive
[ { "docstring": "Add a new Area to the container. Raises: TypeError: If a non-Area object is given.", "name": "append", "signature": "def append(self, item: Area) -> None" }, { "docstring": "Search for Areas where the Field's value matches the expected value and then returns an Areas object with ...
3
stack_v2_sparse_classes_30k_train_004953
Implement the Python class `Areas` described below. Class description: Searchable collection of Areas. Behaves like a list. Method signatures and docstrings: - def append(self, item: Area) -> None: Add a new Area to the container. Raises: TypeError: If a non-Area object is given. - def containing(self, field_name: st...
Implement the Python class `Areas` described below. Class description: Searchable collection of Areas. Behaves like a list. Method signatures and docstrings: - def append(self, item: Area) -> None: Add a new Area to the container. Raises: TypeError: If a non-Area object is given. - def containing(self, field_name: st...
c9864db2237d63055378c30652f43c84d20b3592
<|skeleton|> class Areas: """Searchable collection of Areas. Behaves like a list.""" def append(self, item: Area) -> None: """Add a new Area to the container. Raises: TypeError: If a non-Area object is given.""" <|body_0|> def containing(self, field_name: str, field_value: str): ""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Areas: """Searchable collection of Areas. Behaves like a list.""" def append(self, item: Area) -> None: """Add a new Area to the container. Raises: TypeError: If a non-Area object is given.""" if not isinstance(item, Area): raise TypeError(f'{item} is not an Area. Only Area ob...
the_stack_v2_python_sparse
stere/areas/areas.py
jsfehler/stere
train
23