blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
0456f52a5aba090e3fce44ca6e21a59434e04914
[ "rest_utils.validate_inputs({'blueprint_id': blueprint_id})\nvisibility = rest_utils.get_visibility_parameter(optional=True, is_argument=True, valid_values=VisibilityState.STATES)\nreturn UploadedBlueprintsManager().receive_uploaded_data(data_id=blueprint_id, visibility=visibility)", "query_args = get_args_and_ve...
<|body_start_0|> rest_utils.validate_inputs({'blueprint_id': blueprint_id}) visibility = rest_utils.get_visibility_parameter(optional=True, is_argument=True, valid_values=VisibilityState.STATES) return UploadedBlueprintsManager().receive_uploaded_data(data_id=blueprint_id, visibility=visibility)...
BlueprintsId
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BlueprintsId: def put(self, blueprint_id, **kwargs): """Upload a blueprint (id specified)""" <|body_0|> def delete(self, blueprint_id, **kwargs): """Delete blueprint by id""" <|body_1|> <|end_skeleton|> <|body_start_0|> rest_utils.validate_inputs({'...
stack_v2_sparse_classes_36k_train_012700
4,110
permissive
[ { "docstring": "Upload a blueprint (id specified)", "name": "put", "signature": "def put(self, blueprint_id, **kwargs)" }, { "docstring": "Delete blueprint by id", "name": "delete", "signature": "def delete(self, blueprint_id, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_002298
Implement the Python class `BlueprintsId` described below. Class description: Implement the BlueprintsId class. Method signatures and docstrings: - def put(self, blueprint_id, **kwargs): Upload a blueprint (id specified) - def delete(self, blueprint_id, **kwargs): Delete blueprint by id
Implement the Python class `BlueprintsId` described below. Class description: Implement the BlueprintsId class. Method signatures and docstrings: - def put(self, blueprint_id, **kwargs): Upload a blueprint (id specified) - def delete(self, blueprint_id, **kwargs): Delete blueprint by id <|skeleton|> class Blueprints...
3e062e8dec16c89d2ab180d0b761cbf76d3f7ddc
<|skeleton|> class BlueprintsId: def put(self, blueprint_id, **kwargs): """Upload a blueprint (id specified)""" <|body_0|> def delete(self, blueprint_id, **kwargs): """Delete blueprint by id""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BlueprintsId: def put(self, blueprint_id, **kwargs): """Upload a blueprint (id specified)""" rest_utils.validate_inputs({'blueprint_id': blueprint_id}) visibility = rest_utils.get_visibility_parameter(optional=True, is_argument=True, valid_values=VisibilityState.STATES) return ...
the_stack_v2_python_sparse
rest-service/manager_rest/rest/resources_v3_1/blueprints.py
TS-at-WS/cloudify-manager
train
0
9601099aeb23c6effaa1c726a3cd6e6a0d2e52be
[ "if x < 0:\n return False\nif x < 10:\n return True\nl = []\nl.append(x % 10)\nx //= 10\nwhile x != 0:\n l.append(x % 10)\n x //= 10\nleft = 0\nright = len(l) - 1\nwhile left <= right:\n if l[left] != l[right]:\n return False\n left += 1\n right -= 1\nreturn True", "if x < 0:\n retu...
<|body_start_0|> if x < 0: return False if x < 10: return True l = [] l.append(x % 10) x //= 10 while x != 0: l.append(x % 10) x //= 10 left = 0 right = len(l) - 1 while left <= right: if ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isPalindrome(self, x): """:type x: int :rtype: bool""" <|body_0|> def isPalindrome0(self, x): """:type x: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> if x < 0: return False if x < 10: ...
stack_v2_sparse_classes_36k_train_012701
1,118
no_license
[ { "docstring": ":type x: int :rtype: bool", "name": "isPalindrome", "signature": "def isPalindrome(self, x)" }, { "docstring": ":type x: int :rtype: bool", "name": "isPalindrome0", "signature": "def isPalindrome0(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_014705
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, x): :type x: int :rtype: bool - def isPalindrome0(self, x): :type x: int :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, x): :type x: int :rtype: bool - def isPalindrome0(self, x): :type x: int :rtype: bool <|skeleton|> class Solution: def isPalindrome(self, x): ...
6e18c5d257840489cc3fb1079ae3804c743982a4
<|skeleton|> class Solution: def isPalindrome(self, x): """:type x: int :rtype: bool""" <|body_0|> def isPalindrome0(self, x): """:type x: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isPalindrome(self, x): """:type x: int :rtype: bool""" if x < 0: return False if x < 10: return True l = [] l.append(x % 10) x //= 10 while x != 0: l.append(x % 10) x //= 10 left = 0 ...
the_stack_v2_python_sparse
9.回文数.py
yangyuxiang1996/leetcode
train
0
69d16ae20e4310f10b9ae804afebc7875377f2a9
[ "logger.debug('Visiting %s', self.novel_url)\nsoup = self.get_soup(self.novel_url)\nself.novel_title = soup.select_one('.desc h5').text\nlogger.info('Novel title: %s', self.novel_title)\nself.novel_cover = self.absolute_url(soup.select_one('.about-author .row img')['src'])\nlogger.info('Novel cover: %s', self.novel...
<|body_start_0|> logger.debug('Visiting %s', self.novel_url) soup = self.get_soup(self.novel_url) self.novel_title = soup.select_one('.desc h5').text logger.info('Novel title: %s', self.novel_title) self.novel_cover = self.absolute_url(soup.select_one('.about-author .row img')['s...
MachineNovelTrans
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MachineNovelTrans: def read_novel_info(self): """Get novel title, autor, cover etc""" <|body_0|> def download_chapter_body(self, chapter): """Download body of a single chapter and return as clean html format.""" <|body_1|> def format_text(self, text): ...
stack_v2_sparse_classes_36k_train_012702
2,664
permissive
[ { "docstring": "Get novel title, autor, cover etc", "name": "read_novel_info", "signature": "def read_novel_info(self)" }, { "docstring": "Download body of a single chapter and return as clean html format.", "name": "download_chapter_body", "signature": "def download_chapter_body(self, c...
3
stack_v2_sparse_classes_30k_train_000818
Implement the Python class `MachineNovelTrans` described below. Class description: Implement the MachineNovelTrans class. Method signatures and docstrings: - def read_novel_info(self): Get novel title, autor, cover etc - def download_chapter_body(self, chapter): Download body of a single chapter and return as clean h...
Implement the Python class `MachineNovelTrans` described below. Class description: Implement the MachineNovelTrans class. Method signatures and docstrings: - def read_novel_info(self): Get novel title, autor, cover etc - def download_chapter_body(self, chapter): Download body of a single chapter and return as clean h...
451e816ab03c8466be90f6f0b3eaa52d799140ce
<|skeleton|> class MachineNovelTrans: def read_novel_info(self): """Get novel title, autor, cover etc""" <|body_0|> def download_chapter_body(self, chapter): """Download body of a single chapter and return as clean html format.""" <|body_1|> def format_text(self, text): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MachineNovelTrans: def read_novel_info(self): """Get novel title, autor, cover etc""" logger.debug('Visiting %s', self.novel_url) soup = self.get_soup(self.novel_url) self.novel_title = soup.select_one('.desc h5').text logger.info('Novel title: %s', self.novel_title) ...
the_stack_v2_python_sparse
lncrawl/sources/machinetrans.py
NNTin/lightnovel-crawler
train
2
1aaddf45d4a3ee8cfe7bdcd7366062735e914f2b
[ "path = app.config['USER_HOME_PATH']\nusers = [o for o in os.listdir(path) if os.path.isdir(path + '/' + o) and (not os.path.islink(path + '/' + o))]\nfor user in users:\n User(user)", "home_path = app.config['USER_HOME_PATH']\ntemp_path = app.config['USER_TEMP_PATH']\nusers = [(o, False) for o in os.listdir(h...
<|body_start_0|> path = app.config['USER_HOME_PATH'] users = [o for o in os.listdir(path) if os.path.isdir(path + '/' + o) and (not os.path.islink(path + '/' + o))] for user in users: User(user) <|end_body_0|> <|body_start_1|> home_path = app.config['USER_HOME_PATH'] ...
User service class
UserService
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserService: """User service class""" def find_users_in_home_path(): """Create a new user for every user in home path""" <|body_0|> def sync_users(): """Create a new index if a new filesystem is found and sync it. Delete the index if the filesystem has been remov...
stack_v2_sparse_classes_36k_train_012703
2,958
permissive
[ { "docstring": "Create a new user for every user in home path", "name": "find_users_in_home_path", "signature": "def find_users_in_home_path()" }, { "docstring": "Create a new index if a new filesystem is found and sync it. Delete the index if the filesystem has been removed.", "name": "sync...
2
stack_v2_sparse_classes_30k_train_015017
Implement the Python class `UserService` described below. Class description: User service class Method signatures and docstrings: - def find_users_in_home_path(): Create a new user for every user in home path - def sync_users(): Create a new index if a new filesystem is found and sync it. Delete the index if the file...
Implement the Python class `UserService` described below. Class description: User service class Method signatures and docstrings: - def find_users_in_home_path(): Create a new user for every user in home path - def sync_users(): Create a new index if a new filesystem is found and sync it. Delete the index if the file...
ed59a95071455abaf53dca5bb999364509fd9fcd
<|skeleton|> class UserService: """User service class""" def find_users_in_home_path(): """Create a new user for every user in home path""" <|body_0|> def sync_users(): """Create a new index if a new filesystem is found and sync it. Delete the index if the filesystem has been remov...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserService: """User service class""" def find_users_in_home_path(): """Create a new user for every user in home path""" path = app.config['USER_HOME_PATH'] users = [o for o in os.listdir(path) if os.path.isdir(path + '/' + o) and (not os.path.islink(path + '/' + o))] for ...
the_stack_v2_python_sparse
services/user_service.py
olavgg/py-sth
train
0
269c9c5f8d21277d3660bbd9fd6d464a19b70b4c
[ "if self.request.method == 'GET':\n return [permissions.IsAuthenticated(), IsCasePatientOrDoctor(self.kwargs['case_id'])]\nif self.request.method == 'POST':\n return (permissions.IsAuthenticated(), IsFollowUpDoctor())\nreturn (permissions.IsAuthenticated(), IsFollowUpDoctor())", "queryset = FollowUp.objects...
<|body_start_0|> if self.request.method == 'GET': return [permissions.IsAuthenticated(), IsCasePatientOrDoctor(self.kwargs['case_id'])] if self.request.method == 'POST': return (permissions.IsAuthenticated(), IsFollowUpDoctor()) return (permissions.IsAuthenticated(), IsFo...
Guidelines CRUD
FollowUpViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FollowUpViewSet: """Guidelines CRUD""" def get_permissions(self): """Patients and doctors can view followup Doctors and Surgeons can create/update/delete followup""" <|body_0|> def get_queryset(self): """queryset returns only case's follow up type filter status f...
stack_v2_sparse_classes_36k_train_012704
15,503
no_license
[ { "docstring": "Patients and doctors can view followup Doctors and Surgeons can create/update/delete followup", "name": "get_permissions", "signature": "def get_permissions(self)" }, { "docstring": "queryset returns only case's follow up type filter status filter", "name": "get_queryset", ...
3
stack_v2_sparse_classes_30k_train_019924
Implement the Python class `FollowUpViewSet` described below. Class description: Guidelines CRUD Method signatures and docstrings: - def get_permissions(self): Patients and doctors can view followup Doctors and Surgeons can create/update/delete followup - def get_queryset(self): queryset returns only case's follow up...
Implement the Python class `FollowUpViewSet` described below. Class description: Guidelines CRUD Method signatures and docstrings: - def get_permissions(self): Patients and doctors can view followup Doctors and Surgeons can create/update/delete followup - def get_queryset(self): queryset returns only case's follow up...
413664d4e77020c8fcb6bf95e31e3ff9908e2b60
<|skeleton|> class FollowUpViewSet: """Guidelines CRUD""" def get_permissions(self): """Patients and doctors can view followup Doctors and Surgeons can create/update/delete followup""" <|body_0|> def get_queryset(self): """queryset returns only case's follow up type filter status f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FollowUpViewSet: """Guidelines CRUD""" def get_permissions(self): """Patients and doctors can view followup Doctors and Surgeons can create/update/delete followup""" if self.request.method == 'GET': return [permissions.IsAuthenticated(), IsCasePatientOrDoctor(self.kwargs['case...
the_stack_v2_python_sparse
noccapp/views/case.py
otto-torino/nocc-server
train
0
d4b2213318342a9176baf7a8f2e8b12dfcdaef31
[ "self.cmp_name = cmp_name\nself.click_element(*self.workflow_manage_loc)\nself.scrollToElement('xpath', self.moveto_newSalesOrderMng_loc)\nself.click_element(*self.newSalesOrderMng_loc)\nself.setWaitTime(10)\nself.switchToOneFrameByXpath(self.salesOrderList_frame_loc)\nself.input_value(self.client_search_loc, cmp_n...
<|body_start_0|> self.cmp_name = cmp_name self.click_element(*self.workflow_manage_loc) self.scrollToElement('xpath', self.moveto_newSalesOrderMng_loc) self.click_element(*self.newSalesOrderMng_loc) self.setWaitTime(10) self.switchToOneFrameByXpath(self.salesOrderList_fra...
SalesBargainPage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SalesBargainPage: def CreateSalesBargainResult(self, cmp_name): """创建销售喜报""" <|body_0|> def inputSalesBarginDetail(self): """弹出窗,填写喜报详情""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.cmp_name = cmp_name self.click_element(*self.workflo...
stack_v2_sparse_classes_36k_train_012705
3,444
no_license
[ { "docstring": "创建销售喜报", "name": "CreateSalesBargainResult", "signature": "def CreateSalesBargainResult(self, cmp_name)" }, { "docstring": "弹出窗,填写喜报详情", "name": "inputSalesBarginDetail", "signature": "def inputSalesBarginDetail(self)" } ]
2
null
Implement the Python class `SalesBargainPage` described below. Class description: Implement the SalesBargainPage class. Method signatures and docstrings: - def CreateSalesBargainResult(self, cmp_name): 创建销售喜报 - def inputSalesBarginDetail(self): 弹出窗,填写喜报详情
Implement the Python class `SalesBargainPage` described below. Class description: Implement the SalesBargainPage class. Method signatures and docstrings: - def CreateSalesBargainResult(self, cmp_name): 创建销售喜报 - def inputSalesBarginDetail(self): 弹出窗,填写喜报详情 <|skeleton|> class SalesBargainPage: def CreateSalesBarg...
a2ae1b26a90f321ea692b716bdeccdd9973331c5
<|skeleton|> class SalesBargainPage: def CreateSalesBargainResult(self, cmp_name): """创建销售喜报""" <|body_0|> def inputSalesBarginDetail(self): """弹出窗,填写喜报详情""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SalesBargainPage: def CreateSalesBargainResult(self, cmp_name): """创建销售喜报""" self.cmp_name = cmp_name self.click_element(*self.workflow_manage_loc) self.scrollToElement('xpath', self.moveto_newSalesOrderMng_loc) self.click_element(*self.newSalesOrderMng_loc) sel...
the_stack_v2_python_sparse
test_case/page_obj/createSalesBragainResultPage.py
ykbfb/DFSS_Auto_Test_BDD
train
0
67495304b0a2d841043606f93e7787b974301a39
[ "ctx.num_sync_devices = num_sync_devices\nctx.num_groups = num_groups\ninput_list = [torch.zeros_like(input) for k in range(du.get_local_size())]\ndist.all_gather(input_list, input, async_op=False, group=du._LOCAL_PROCESS_GROUP)\ninputs = torch.stack(input_list, dim=0)\nif num_groups > 1:\n rank = du.get_local_r...
<|body_start_0|> ctx.num_sync_devices = num_sync_devices ctx.num_groups = num_groups input_list = [torch.zeros_like(input) for k in range(du.get_local_size())] dist.all_gather(input_list, input, async_op=False, group=du._LOCAL_PROCESS_GROUP) inputs = torch.stack(input_list, dim=0...
GroupGather performs all gather on each of the local process/ GPU groups.
GroupGather
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GroupGather: """GroupGather performs all gather on each of the local process/ GPU groups.""" def forward(ctx, input, num_sync_devices, num_groups): """Perform forwarding, gathering the stats across different process/ GPU group.""" <|body_0|> def backward(ctx, grad_output...
stack_v2_sparse_classes_36k_train_012706
7,462
permissive
[ { "docstring": "Perform forwarding, gathering the stats across different process/ GPU group.", "name": "forward", "signature": "def forward(ctx, input, num_sync_devices, num_groups)" }, { "docstring": "Perform backwarding, gathering the gradients across different process/ GPU group.", "name"...
2
stack_v2_sparse_classes_30k_train_015500
Implement the Python class `GroupGather` described below. Class description: GroupGather performs all gather on each of the local process/ GPU groups. Method signatures and docstrings: - def forward(ctx, input, num_sync_devices, num_groups): Perform forwarding, gathering the stats across different process/ GPU group....
Implement the Python class `GroupGather` described below. Class description: GroupGather performs all gather on each of the local process/ GPU groups. Method signatures and docstrings: - def forward(ctx, input, num_sync_devices, num_groups): Perform forwarding, gathering the stats across different process/ GPU group....
03279afc8d16509bf54cd9142304cd2d403f6e93
<|skeleton|> class GroupGather: """GroupGather performs all gather on each of the local process/ GPU groups.""" def forward(ctx, input, num_sync_devices, num_groups): """Perform forwarding, gathering the stats across different process/ GPU group.""" <|body_0|> def backward(ctx, grad_output...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GroupGather: """GroupGather performs all gather on each of the local process/ GPU groups.""" def forward(ctx, input, num_sync_devices, num_groups): """Perform forwarding, gathering the stats across different process/ GPU group.""" ctx.num_sync_devices = num_sync_devices ctx.num_gr...
the_stack_v2_python_sparse
models/SlowFast/slowfast/models/batchnorm_helper.py
artest08/LateTemporalModeling3DCNN
train
171
50108bb4abdbde0a4433781c7ec232b9b8204af7
[ "super(ConstraintSolver, self).__init__(constraint_list, dt)\nself.tolerance = tolerance\nself.maxit = maxit\nself.norm_order = norm_order", "p = dstrip(self.beads.p[0]).copy()\nself.beads.p.hold()\nfor constr in self.constraint_list:\n dg = dstrip(constr.Dg)\n ic = constr.i3_unique\n b = np.dot(dg, p[ic...
<|body_start_0|> super(ConstraintSolver, self).__init__(constraint_list, dt) self.tolerance = tolerance self.maxit = maxit self.norm_order = norm_order <|end_body_0|> <|body_start_1|> p = dstrip(self.beads.p[0]).copy() self.beads.p.hold() for constr in self.const...
An implementation of a constraint solver that uses M-RATTLE to impose constraints onto the momenta and a quasi-Newton method to impose constraints onto the positions. The constraint is applied sparsely, i.e. on each block of constraints separately. For implementation details of M-RATTLE see H. C. Andersen, J. Comput. P...
ConstraintSolver
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConstraintSolver: """An implementation of a constraint solver that uses M-RATTLE to impose constraints onto the momenta and a quasi-Newton method to impose constraints onto the positions. The constraint is applied sparsely, i.e. on each block of constraints separately. For implementation details ...
stack_v2_sparse_classes_36k_train_012707
19,035
no_license
[ { "docstring": "Solver options include a tolerance for the projection on the manifold, maximum number of iterations for the projection, and the order of the norm to estimate the convergence", "name": "__init__", "signature": "def __init__(self, constraint_list, dt=1.0, tolerance=0.001, maxit=1000, norm_...
3
null
Implement the Python class `ConstraintSolver` described below. Class description: An implementation of a constraint solver that uses M-RATTLE to impose constraints onto the momenta and a quasi-Newton method to impose constraints onto the positions. The constraint is applied sparsely, i.e. on each block of constraints ...
Implement the Python class `ConstraintSolver` described below. Class description: An implementation of a constraint solver that uses M-RATTLE to impose constraints onto the momenta and a quasi-Newton method to impose constraints onto the positions. The constraint is applied sparsely, i.e. on each block of constraints ...
57f255266d4668bafef0881d1e7cbf8a27270ddd
<|skeleton|> class ConstraintSolver: """An implementation of a constraint solver that uses M-RATTLE to impose constraints onto the momenta and a quasi-Newton method to impose constraints onto the positions. The constraint is applied sparsely, i.e. on each block of constraints separately. For implementation details ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConstraintSolver: """An implementation of a constraint solver that uses M-RATTLE to impose constraints onto the momenta and a quasi-Newton method to impose constraints onto the positions. The constraint is applied sparsely, i.e. on each block of constraints separately. For implementation details of M-RATTLE s...
the_stack_v2_python_sparse
ipi/engine/motion/constrained_dynamics.py
i-pi/i-pi
train
170
138f5d3aee531861b0bfc2126bb255b214f61d9e
[ "super(ReviewEntry, self).__init__(review.timestamp, collapsed)\nself.request = request\nself.review_request = review_request\nself.review = review\nself.issue_open_count = 0\nself.has_issues = False\nself.comments = {'diff_comments': [], 'screenshot_comments': [], 'file_attachment_comments': [], 'general_comments'...
<|body_start_0|> super(ReviewEntry, self).__init__(review.timestamp, collapsed) self.request = request self.review_request = review_request self.review = review self.issue_open_count = 0 self.has_issues = False self.comments = {'diff_comments': [], 'screenshot_com...
A review box. Attributes: review (reviewboard.reviews.models.Review): The review for this entry. issue_open_count (int): The count of open issues within this review. has_issues (bool): Whether there are any issues (open or not). comments (dict): A dictionary of comments. Each key in this represents a comment type, and ...
ReviewEntry
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReviewEntry: """A review box. Attributes: review (reviewboard.reviews.models.Review): The review for this entry. issue_open_count (int): The count of open issues within this review. has_issues (bool): Whether there are any issues (open or not). comments (dict): A dictionary of comments. Each key ...
stack_v2_sparse_classes_36k_train_012708
27,812
permissive
[ { "docstring": "Initialize the entry. Args: request (django.http.HttpRequest): The request object. review_request (reviewboard.reviews.models.ReviewRequest): The review request that the change is for. review (reviewboard.reviews.models.Review): The review. collapsed (bool): Whether the entry is collapsed by def...
2
null
Implement the Python class `ReviewEntry` described below. Class description: A review box. Attributes: review (reviewboard.reviews.models.Review): The review for this entry. issue_open_count (int): The count of open issues within this review. has_issues (bool): Whether there are any issues (open or not). comments (dic...
Implement the Python class `ReviewEntry` described below. Class description: A review box. Attributes: review (reviewboard.reviews.models.Review): The review for this entry. issue_open_count (int): The count of open issues within this review. has_issues (bool): Whether there are any issues (open or not). comments (dic...
02e1ef3a4e9a8117977b053805234a713c31a699
<|skeleton|> class ReviewEntry: """A review box. Attributes: review (reviewboard.reviews.models.Review): The review for this entry. issue_open_count (int): The count of open issues within this review. has_issues (bool): Whether there are any issues (open or not). comments (dict): A dictionary of comments. Each key ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReviewEntry: """A review box. Attributes: review (reviewboard.reviews.models.Review): The review for this entry. issue_open_count (int): The count of open issues within this review. has_issues (bool): Whether there are any issues (open or not). comments (dict): A dictionary of comments. Each key in this repre...
the_stack_v2_python_sparse
reviewboard/reviews/detail.py
parthyz/reviewboard
train
1
ff40622a9714ab371c06b30e36e211b300d090ea
[ "super(TrainableLayer, self).__init__(name=name)\nself.type_string = look_up_operations(type_string.lower(), SUPPORTED_OP)\nself.acti_func = acti_func\nself.conv_param = {'w_initializer': w_initializer, 'w_regularizer': w_regularizer, 'kernel_size': kernel_size, 'dilation': dilation, 'n_output_chns': n_output_chns}...
<|body_start_0|> super(TrainableLayer, self).__init__(name=name) self.type_string = look_up_operations(type_string.lower(), SUPPORTED_OP) self.acti_func = acti_func self.conv_param = {'w_initializer': w_initializer, 'w_regularizer': w_regularizer, 'kernel_size': kernel_size, 'dilation': ...
ResidualUnit
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResidualUnit: def __init__(self, n_output_chns=1, kernel_size=3, dilation=1, acti_func='relu', w_initializer=None, w_regularizer=None, moving_decay=0.9, eps=1e-05, type_string='bn_acti_conv', name='res-downsample'): """Implementation of residual unit presented in: [1] He et al., Identity...
stack_v2_sparse_classes_36k_train_012709
4,424
permissive
[ { "docstring": "Implementation of residual unit presented in: [1] He et al., Identity mapping in deep residual networks, ECCV 2016 [2] He et al., Deep residual learning for image recognition, CVPR 2016 The possible types of connections are:: 'original': residual unit presented in [2] 'conv_bn_acti': ReLU before...
2
null
Implement the Python class `ResidualUnit` described below. Class description: Implement the ResidualUnit class. Method signatures and docstrings: - def __init__(self, n_output_chns=1, kernel_size=3, dilation=1, acti_func='relu', w_initializer=None, w_regularizer=None, moving_decay=0.9, eps=1e-05, type_string='bn_acti...
Implement the Python class `ResidualUnit` described below. Class description: Implement the ResidualUnit class. Method signatures and docstrings: - def __init__(self, n_output_chns=1, kernel_size=3, dilation=1, acti_func='relu', w_initializer=None, w_regularizer=None, moving_decay=0.9, eps=1e-05, type_string='bn_acti...
84dd0f85c9a1ab8a72f4c55fcf073379acf5ae1b
<|skeleton|> class ResidualUnit: def __init__(self, n_output_chns=1, kernel_size=3, dilation=1, acti_func='relu', w_initializer=None, w_regularizer=None, moving_decay=0.9, eps=1e-05, type_string='bn_acti_conv', name='res-downsample'): """Implementation of residual unit presented in: [1] He et al., Identity...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResidualUnit: def __init__(self, n_output_chns=1, kernel_size=3, dilation=1, acti_func='relu', w_initializer=None, w_regularizer=None, moving_decay=0.9, eps=1e-05, type_string='bn_acti_conv', name='res-downsample'): """Implementation of residual unit presented in: [1] He et al., Identity mapping in de...
the_stack_v2_python_sparse
niftynet/layer/residual_unit.py
12SigmaTechnologies/NiftyNet-1
train
2
392465fc0fd2ba78a674668137ea74c1f7921bd8
[ "if not matrix:\n return 0\nres = 0\nheight = [0 for i in matrix[0]]\nfor i in matrix:\n for index, val in enumerate(i):\n height[index] = height[index] + 1 if val == '1' else 0\n res = max(res, self.largestRectangleArea(height))\nreturn res", "stack = [0 for i in height]\ntop, max_area, index = (...
<|body_start_0|> if not matrix: return 0 res = 0 height = [0 for i in matrix[0]] for i in matrix: for index, val in enumerate(i): height[index] = height[index] + 1 if val == '1' else 0 res = max(res, self.largestRectangleArea(height)) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maximalRectangle(self, matrix): """:type matrix: List[List[str]] :rtype: int""" <|body_0|> def largestRectangleArea(self, height): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not matrix: ...
stack_v2_sparse_classes_36k_train_012710
1,403
no_license
[ { "docstring": ":type matrix: List[List[str]] :rtype: int", "name": "maximalRectangle", "signature": "def maximalRectangle(self, matrix)" }, { "docstring": ":type height: List[int] :rtype: int", "name": "largestRectangleArea", "signature": "def largestRectangleArea(self, height)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maximalRectangle(self, matrix): :type matrix: List[List[str]] :rtype: int - def largestRectangleArea(self, height): :type height: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maximalRectangle(self, matrix): :type matrix: List[List[str]] :rtype: int - def largestRectangleArea(self, height): :type height: List[int] :rtype: int <|skeleton|> class So...
22022f65bd894ca6c3546014b191dc2a33653ac3
<|skeleton|> class Solution: def maximalRectangle(self, matrix): """:type matrix: List[List[str]] :rtype: int""" <|body_0|> def largestRectangleArea(self, height): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maximalRectangle(self, matrix): """:type matrix: List[List[str]] :rtype: int""" if not matrix: return 0 res = 0 height = [0 for i in matrix[0]] for i in matrix: for index, val in enumerate(i): height[index] = height[...
the_stack_v2_python_sparse
Maximal Rectangle.py
txjzwzz/leetCodeJuly
train
0
e24f4bd82ef3a1275d28fb5af427dc9d27c225ce
[ "self.endline = '\\n'\nself.host = host\nself.port = port\nself.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\nself.sock.connect((host, port))\nself.current_data = 0\nself.current_image = 0\nself.is_new_data = False", "total_data = []\nwhile True:\n data = self.sock.recv(65536)\n data = data.deco...
<|body_start_0|> self.endline = '\n' self.host = host self.port = port self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.connect((host, port)) self.current_data = 0 self.current_image = 0 self.is_new_data = False <|end_body_0|> <|bod...
Class which receives data from VideoCamera by built-in 'socket' interface, decodes it from json, utf-8 and base64 and makes it available for user
VideoCameraServer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VideoCameraServer: """Class which receives data from VideoCamera by built-in 'socket' interface, decodes it from json, utf-8 and base64 and makes it available for user""" def __init__(self, host, port): """Initializes socket and opens data stream. :param host: address of a streaming ...
stack_v2_sparse_classes_36k_train_012711
6,070
permissive
[ { "docstring": "Initializes socket and opens data stream. :param host: address of a streaming socket :param port: port on which is the stream", "name": "__init__", "signature": "def __init__(self, host, port)" }, { "docstring": "This method is used to obtain only one object from socket. Sometime...
6
stack_v2_sparse_classes_30k_train_004461
Implement the Python class `VideoCameraServer` described below. Class description: Class which receives data from VideoCamera by built-in 'socket' interface, decodes it from json, utf-8 and base64 and makes it available for user Method signatures and docstrings: - def __init__(self, host, port): Initializes socket an...
Implement the Python class `VideoCameraServer` described below. Class description: Class which receives data from VideoCamera by built-in 'socket' interface, decodes it from json, utf-8 and base64 and makes it available for user Method signatures and docstrings: - def __init__(self, host, port): Initializes socket an...
7115f55799d9a81fdb214e20c4cdd8520dceb48e
<|skeleton|> class VideoCameraServer: """Class which receives data from VideoCamera by built-in 'socket' interface, decodes it from json, utf-8 and base64 and makes it available for user""" def __init__(self, host, port): """Initializes socket and opens data stream. :param host: address of a streaming ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VideoCameraServer: """Class which receives data from VideoCamera by built-in 'socket' interface, decodes it from json, utf-8 and base64 and makes it available for user""" def __init__(self, host, port): """Initializes socket and opens data stream. :param host: address of a streaming socket :param...
the_stack_v2_python_sparse
MORSEProject/classes/video_camera_server.py
Kecz/MORSE-SLAM
train
2
81f5465f85b4d9047c2b66e4a317d4832f0c294f
[ "errors = {}\nif user_input is not None:\n try:\n token = await validate_input(self.hass, user_input)\n await self.async_set_unique_id(user_input['username'])\n return self.async_create_entry(title=user_input['username'], data={'username': user_input['username'], 'token': token})\n except...
<|body_start_0|> errors = {} if user_input is not None: try: token = await validate_input(self.hass, user_input) await self.async_set_unique_id(user_input['username']) return self.async_create_entry(title=user_input['username'], data={'username...
Handle a config flow for Ring.
RingConfigFlow
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RingConfigFlow: """Handle a config flow for Ring.""" async def async_step_user(self, user_input=None): """Handle the initial step.""" <|body_0|> async def async_step_2fa(self, user_input=None): """Handle 2fa step.""" <|body_1|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_36k_train_012712
2,684
permissive
[ { "docstring": "Handle the initial step.", "name": "async_step_user", "signature": "async def async_step_user(self, user_input=None)" }, { "docstring": "Handle 2fa step.", "name": "async_step_2fa", "signature": "async def async_step_2fa(self, user_input=None)" } ]
2
stack_v2_sparse_classes_30k_train_019599
Implement the Python class `RingConfigFlow` described below. Class description: Handle a config flow for Ring. Method signatures and docstrings: - async def async_step_user(self, user_input=None): Handle the initial step. - async def async_step_2fa(self, user_input=None): Handle 2fa step.
Implement the Python class `RingConfigFlow` described below. Class description: Handle a config flow for Ring. Method signatures and docstrings: - async def async_step_user(self, user_input=None): Handle the initial step. - async def async_step_2fa(self, user_input=None): Handle 2fa step. <|skeleton|> class RingConf...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class RingConfigFlow: """Handle a config flow for Ring.""" async def async_step_user(self, user_input=None): """Handle the initial step.""" <|body_0|> async def async_step_2fa(self, user_input=None): """Handle 2fa step.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RingConfigFlow: """Handle a config flow for Ring.""" async def async_step_user(self, user_input=None): """Handle the initial step.""" errors = {} if user_input is not None: try: token = await validate_input(self.hass, user_input) await s...
the_stack_v2_python_sparse
homeassistant/components/ring/config_flow.py
home-assistant/core
train
35,501
0fd910805b1fdac61da121ec6c095cdb95888651
[ "ret = 0\nmn = float('inf')\nfor p in prices:\n ret = max(ret, p - mn)\n mn = min(mn, p)\nreturn ret", "ret = 0\nmn = float('inf')\nfor p in prices:\n ret = max(ret, p - mn)\n mn = min(mn, p)\nreturn ret" ]
<|body_start_0|> ret = 0 mn = float('inf') for p in prices: ret = max(ret, p - mn) mn = min(mn, p) return ret <|end_body_0|> <|body_start_1|> ret = 0 mn = float('inf') for p in prices: ret = max(ret, p - mn) mn = mi...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, prices: List[int]) -> int: """Feb 17, 2022 16:10""" <|body_0|> def maxProfit(self, prices: List[int]) -> int: """Apr 02, 2023 00:28""" <|body_1|> <|end_skeleton|> <|body_start_0|> ret = 0 mn = float('inf') ...
stack_v2_sparse_classes_36k_train_012713
1,719
no_license
[ { "docstring": "Feb 17, 2022 16:10", "name": "maxProfit", "signature": "def maxProfit(self, prices: List[int]) -> int" }, { "docstring": "Apr 02, 2023 00:28", "name": "maxProfit", "signature": "def maxProfit(self, prices: List[int]) -> int" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices: List[int]) -> int: Feb 17, 2022 16:10 - def maxProfit(self, prices: List[int]) -> int: Apr 02, 2023 00:28
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices: List[int]) -> int: Feb 17, 2022 16:10 - def maxProfit(self, prices: List[int]) -> int: Apr 02, 2023 00:28 <|skeleton|> class Solution: def maxPr...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def maxProfit(self, prices: List[int]) -> int: """Feb 17, 2022 16:10""" <|body_0|> def maxProfit(self, prices: List[int]) -> int: """Apr 02, 2023 00:28""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit(self, prices: List[int]) -> int: """Feb 17, 2022 16:10""" ret = 0 mn = float('inf') for p in prices: ret = max(ret, p - mn) mn = min(mn, p) return ret def maxProfit(self, prices: List[int]) -> int: """Apr 02, ...
the_stack_v2_python_sparse
leetcode/solved/121_Best_Time_to_Buy_and_Sell_Stock/solution.py
sungminoh/algorithms
train
0
a39055eae0cb80d7eed2d27804184f21b7c42011
[ "i = 0\nfor num in nums:\n if i < 2 or num > nums[i - 2]:\n nums[i] = num\n i += 1\nreturn i", "i = 0\nfor n in nums:\n if i < k or n > nums[i - k]:\n nums[i] = n\n i += 1\nreturn i" ]
<|body_start_0|> i = 0 for num in nums: if i < 2 or num > nums[i - 2]: nums[i] = num i += 1 return i <|end_body_0|> <|body_start_1|> i = 0 for n in nums: if i < k or n > nums[i - k]: nums[i] = n ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def removeDuplicates(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def removeDuplicates2(self, nums, k): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> i = 0 for num in nums: ...
stack_v2_sparse_classes_36k_train_012714
1,176
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "removeDuplicates", "signature": "def removeDuplicates(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "removeDuplicates2", "signature": "def removeDuplicates2(self, nums, k)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeDuplicates(self, nums): :type nums: List[int] :rtype: int - def removeDuplicates2(self, nums, k): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeDuplicates(self, nums): :type nums: List[int] :rtype: int - def removeDuplicates2(self, nums, k): :type nums: List[int] :rtype: int <|skeleton|> class Solution: d...
89142297559af20cf990a8e40975811b4be36955
<|skeleton|> class Solution: def removeDuplicates(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def removeDuplicates2(self, nums, k): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def removeDuplicates(self, nums): """:type nums: List[int] :rtype: int""" i = 0 for num in nums: if i < 2 or num > nums[i - 2]: nums[i] = num i += 1 return i def removeDuplicates2(self, nums, k): """:type nums: ...
the_stack_v2_python_sparse
ReferenceSolution/80.remove-duplicates-from-sorted-array-ii.143163442.ac.py
DarkAlexWang/leetcode
train
3
a0777a7f04a6eceb6258f7cb8b1c1d4cd078e27e
[ "m = len(nums)\nfor i in range(m - 1, -1, -1):\n for j in range(i):\n if nums[j] > nums[j + 1]:\n nums[j], nums[j + 1] = (nums[j + 1], nums[j])", "m = len(nums)\nfor i in range(m - 1, -1, -1):\n is_sorted = True\n for j in range(i):\n if nums[j] > nums[j + 1]:\n nums[j...
<|body_start_0|> m = len(nums) for i in range(m - 1, -1, -1): for j in range(i): if nums[j] > nums[j + 1]: nums[j], nums[j + 1] = (nums[j + 1], nums[j]) <|end_body_0|> <|body_start_1|> m = len(nums) for i in range(m - 1, -1, -1): ...
冒泡排序
Bubble_sort
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Bubble_sort: """冒泡排序""" def sort(self, nums): """标准版冒泡排序 :type nums: List[int] 要排序的数组""" <|body_0|> def sort_optimize(self, nums): """优化版冒泡排序 :type nums: List[int] 要排序的数组""" <|body_1|> <|end_skeleton|> <|body_start_0|> m = len(nums) for ...
stack_v2_sparse_classes_36k_train_012715
815
no_license
[ { "docstring": "标准版冒泡排序 :type nums: List[int] 要排序的数组", "name": "sort", "signature": "def sort(self, nums)" }, { "docstring": "优化版冒泡排序 :type nums: List[int] 要排序的数组", "name": "sort_optimize", "signature": "def sort_optimize(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_017948
Implement the Python class `Bubble_sort` described below. Class description: 冒泡排序 Method signatures and docstrings: - def sort(self, nums): 标准版冒泡排序 :type nums: List[int] 要排序的数组 - def sort_optimize(self, nums): 优化版冒泡排序 :type nums: List[int] 要排序的数组
Implement the Python class `Bubble_sort` described below. Class description: 冒泡排序 Method signatures and docstrings: - def sort(self, nums): 标准版冒泡排序 :type nums: List[int] 要排序的数组 - def sort_optimize(self, nums): 优化版冒泡排序 :type nums: List[int] 要排序的数组 <|skeleton|> class Bubble_sort: """冒泡排序""" def sort(self, num...
0b3bc77cbfe0e45e62c3c8f244e9e3d2421e6121
<|skeleton|> class Bubble_sort: """冒泡排序""" def sort(self, nums): """标准版冒泡排序 :type nums: List[int] 要排序的数组""" <|body_0|> def sort_optimize(self, nums): """优化版冒泡排序 :type nums: List[int] 要排序的数组""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Bubble_sort: """冒泡排序""" def sort(self, nums): """标准版冒泡排序 :type nums: List[int] 要排序的数组""" m = len(nums) for i in range(m - 1, -1, -1): for j in range(i): if nums[j] > nums[j + 1]: nums[j], nums[j + 1] = (nums[j + 1], nums[j]) def...
the_stack_v2_python_sparse
sort/bubble_sort.py
lailianqi/LeetCodeByPython
train
0
7abe1af354a1bfafcfd00b03325031dba680c060
[ "if len(strs) == 0:\n return ''\nminstrlenghth = 10 ** 9\nfor s in strs:\n if len(s) < minstrlenghth:\n minstrlenghth = len(s)\nprint(minstrlenghth)\nfor i in range(minstrlenghth):\n temp = strs[0][i]\n for j in range(1, len(strs)):\n if strs[j][i] != temp:\n return strs[0][:i]\...
<|body_start_0|> if len(strs) == 0: return '' minstrlenghth = 10 ** 9 for s in strs: if len(s) < minstrlenghth: minstrlenghth = len(s) print(minstrlenghth) for i in range(minstrlenghth): temp = strs[0][i] for j in ra...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestCommonPrefix1(self, strs: List[str]) -> str: """我这里做纵向扫描,也就是从前向后遍历所有字符串的每一列, 比较相同列行的字符是否相同,如果相同则继续对下一列的字符进行比较 如果不相同则当前列不再属于公共前缀,当前列之前的部分为最长公共前缀 复杂度分析: 时间复杂度:O(nm) 其中m为字符串数组的长度,n为列表长度(即字符串的数量) 最坏的情况下,字符串数组中每个字符串的每个字符都要被比较一次 空间复杂度:O(1)""" <|body_0|> def lo...
stack_v2_sparse_classes_36k_train_012716
1,993
no_license
[ { "docstring": "我这里做纵向扫描,也就是从前向后遍历所有字符串的每一列, 比较相同列行的字符是否相同,如果相同则继续对下一列的字符进行比较 如果不相同则当前列不再属于公共前缀,当前列之前的部分为最长公共前缀 复杂度分析: 时间复杂度:O(nm) 其中m为字符串数组的长度,n为列表长度(即字符串的数量) 最坏的情况下,字符串数组中每个字符串的每个字符都要被比较一次 空间复杂度:O(1)", "name": "longestCommonPrefix1", "signature": "def longestCommonPrefix1(self, strs: List[str]) -> str...
2
stack_v2_sparse_classes_30k_train_000385
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestCommonPrefix1(self, strs: List[str]) -> str: 我这里做纵向扫描,也就是从前向后遍历所有字符串的每一列, 比较相同列行的字符是否相同,如果相同则继续对下一列的字符进行比较 如果不相同则当前列不再属于公共前缀,当前列之前的部分为最长公共前缀 复杂度分析: 时间复杂度:O(nm) 其中m为字符串...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestCommonPrefix1(self, strs: List[str]) -> str: 我这里做纵向扫描,也就是从前向后遍历所有字符串的每一列, 比较相同列行的字符是否相同,如果相同则继续对下一列的字符进行比较 如果不相同则当前列不再属于公共前缀,当前列之前的部分为最长公共前缀 复杂度分析: 时间复杂度:O(nm) 其中m为字符串...
51943e2c2c4ec70c7c1d5b53c9fdf0a719428d7a
<|skeleton|> class Solution: def longestCommonPrefix1(self, strs: List[str]) -> str: """我这里做纵向扫描,也就是从前向后遍历所有字符串的每一列, 比较相同列行的字符是否相同,如果相同则继续对下一列的字符进行比较 如果不相同则当前列不再属于公共前缀,当前列之前的部分为最长公共前缀 复杂度分析: 时间复杂度:O(nm) 其中m为字符串数组的长度,n为列表长度(即字符串的数量) 最坏的情况下,字符串数组中每个字符串的每个字符都要被比较一次 空间复杂度:O(1)""" <|body_0|> def lo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestCommonPrefix1(self, strs: List[str]) -> str: """我这里做纵向扫描,也就是从前向后遍历所有字符串的每一列, 比较相同列行的字符是否相同,如果相同则继续对下一列的字符进行比较 如果不相同则当前列不再属于公共前缀,当前列之前的部分为最长公共前缀 复杂度分析: 时间复杂度:O(nm) 其中m为字符串数组的长度,n为列表长度(即字符串的数量) 最坏的情况下,字符串数组中每个字符串的每个字符都要被比较一次 空间复杂度:O(1)""" if len(strs) == 0: retur...
the_stack_v2_python_sparse
LeetCode_practice/0014_LongestCommonPrefix.py
LeBron-Jian/BasicAlgorithmPractice
train
13
88b815a2ff66d997118f4af7319f091518db86ec
[ "collection = lnlink.CollectedNames(['slashdot', 'freshmeat'])\nresult = collection.bind_with_LNQS('http://taoriver.net/tmp/gmail.txt', 'http://services.taoriver.net:9090/')\nassert len(result) == 0, 'still some unresolved names'\nbound = collection.bound\nassert bound['slashdot'] == 'http://www.slashdot.org/'\nass...
<|body_start_0|> collection = lnlink.CollectedNames(['slashdot', 'freshmeat']) result = collection.bind_with_LNQS('http://taoriver.net/tmp/gmail.txt', 'http://services.taoriver.net:9090/') assert len(result) == 0, 'still some unresolved names' bound = collection.bound assert boun...
Test that we can remotely look up names. test1 -- test resolving within one namespace test_namespace_hopping -- test lookups transcending one namespace
RemoteLookupTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RemoteLookupTest: """Test that we can remotely look up names. test1 -- test resolving within one namespace test_namespace_hopping -- test lookups transcending one namespace""" def test1(self): """Make sure bind_with_LNQS resolves names in one namespace. If there's an error, it may be...
stack_v2_sparse_classes_36k_train_012717
3,716
no_license
[ { "docstring": "Make sure bind_with_LNQS resolves names in one namespace. If there's an error, it may be that it actually can't resolve slashdot or freshmeat- you'll have to check it independently, should this fail.", "name": "test1", "signature": "def test1(self)" }, { "docstring": "Make sure b...
2
null
Implement the Python class `RemoteLookupTest` described below. Class description: Test that we can remotely look up names. test1 -- test resolving within one namespace test_namespace_hopping -- test lookups transcending one namespace Method signatures and docstrings: - def test1(self): Make sure bind_with_LNQS resolv...
Implement the Python class `RemoteLookupTest` described below. Class description: Test that we can remotely look up names. test1 -- test resolving within one namespace test_namespace_hopping -- test lookups transcending one namespace Method signatures and docstrings: - def test1(self): Make sure bind_with_LNQS resolv...
da65d948b346d3f455e79168a8753b2b16d8fc5f
<|skeleton|> class RemoteLookupTest: """Test that we can remotely look up names. test1 -- test resolving within one namespace test_namespace_hopping -- test lookups transcending one namespace""" def test1(self): """Make sure bind_with_LNQS resolves names in one namespace. If there's an error, it may be...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RemoteLookupTest: """Test that we can remotely look up names. test1 -- test resolving within one namespace test_namespace_hopping -- test lookups transcending one namespace""" def test1(self): """Make sure bind_with_LNQS resolves names in one namespace. If there's an error, it may be that it actu...
the_stack_v2_python_sparse
pre2007/lnlink/test.py
BackupTheBerlios/onebigsoup-svn
train
0
b944d90d4784de8c2f92b8ac1bae26e5718db186
[ "super(fcEncoderNet, self).__init__()\ndense = []\nfor i in range(num_layers):\n input_dim = np.product(in_dim) if i == 0 else hidden_dim\n dense.extend([nn.Linear(input_dim, hidden_dim), nn.Tanh()])\nself.dense = nn.Sequential(*dense)\nself.reshape_ = hidden_dim\nself.fc11 = nn.Linear(self.reshape_, latent_d...
<|body_start_0|> super(fcEncoderNet, self).__init__() dense = [] for i in range(num_layers): input_dim = np.product(in_dim) if i == 0 else hidden_dim dense.extend([nn.Linear(input_dim, hidden_dim), nn.Tanh()]) self.dense = nn.Sequential(*dense) self.reshap...
Encoder/inference network (for variational autoencoder) Args: in_dim: Input dimensions. For images, it is (height, width) or (height, width, channels). For spectra, it is (length,) latent_dim: number of latent dimensions (the first 3 latent dimensions are angle & translations by default) num_layers: number of NN layers...
fcEncoderNet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class fcEncoderNet: """Encoder/inference network (for variational autoencoder) Args: in_dim: Input dimensions. For images, it is (height, width) or (height, width, channels). For spectra, it is (length,) latent_dim: number of latent dimensions (the first 3 latent dimensions are angle & translations by ...
stack_v2_sparse_classes_36k_train_012718
28,462
permissive
[ { "docstring": "Initializes network parameters", "name": "__init__", "signature": "def __init__(self, in_dim: Tuple[int], latent_dim: int=2, num_layers: int=2, hidden_dim: int=32, **kwargs: bool) -> None" }, { "docstring": "Forward pass", "name": "forward", "signature": "def forward(self...
2
stack_v2_sparse_classes_30k_train_001134
Implement the Python class `fcEncoderNet` described below. Class description: Encoder/inference network (for variational autoencoder) Args: in_dim: Input dimensions. For images, it is (height, width) or (height, width, channels). For spectra, it is (length,) latent_dim: number of latent dimensions (the first 3 latent ...
Implement the Python class `fcEncoderNet` described below. Class description: Encoder/inference network (for variational autoencoder) Args: in_dim: Input dimensions. For images, it is (height, width) or (height, width, channels). For spectra, it is (length,) latent_dim: number of latent dimensions (the first 3 latent ...
6d187296074143d017ca8fc60302364cd946b180
<|skeleton|> class fcEncoderNet: """Encoder/inference network (for variational autoencoder) Args: in_dim: Input dimensions. For images, it is (height, width) or (height, width, channels). For spectra, it is (length,) latent_dim: number of latent dimensions (the first 3 latent dimensions are angle & translations by ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class fcEncoderNet: """Encoder/inference network (for variational autoencoder) Args: in_dim: Input dimensions. For images, it is (height, width) or (height, width, channels). For spectra, it is (length,) latent_dim: number of latent dimensions (the first 3 latent dimensions are angle & translations by default) num_...
the_stack_v2_python_sparse
atomai/nets/ed.py
pycroscopy/atomai
train
157
99694fdcbf0b5db966cd16ee4d3768a6f816561d
[ "TestCommand.finalize_options(self)\nself.test_args = []\nself.test_suite = True", "import pytest\nerrcode = pytest.main(self.test_args)\nsys.exit(errcode)" ]
<|body_start_0|> TestCommand.finalize_options(self) self.test_args = [] self.test_suite = True <|end_body_0|> <|body_start_1|> import pytest errcode = pytest.main(self.test_args) sys.exit(errcode) <|end_body_1|>
PyTest
PyTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PyTest: """PyTest""" def finalize_options(self): """finalize_options""" <|body_0|> def run_tests(self): """run_tests""" <|body_1|> <|end_skeleton|> <|body_start_0|> TestCommand.finalize_options(self) self.test_args = [] self.test...
stack_v2_sparse_classes_36k_train_012719
1,582
permissive
[ { "docstring": "finalize_options", "name": "finalize_options", "signature": "def finalize_options(self)" }, { "docstring": "run_tests", "name": "run_tests", "signature": "def run_tests(self)" } ]
2
null
Implement the Python class `PyTest` described below. Class description: PyTest Method signatures and docstrings: - def finalize_options(self): finalize_options - def run_tests(self): run_tests
Implement the Python class `PyTest` described below. Class description: PyTest Method signatures and docstrings: - def finalize_options(self): finalize_options - def run_tests(self): run_tests <|skeleton|> class PyTest: """PyTest""" def finalize_options(self): """finalize_options""" <|body_0...
56c52702cec4370f551785508d284e5cbe1a744a
<|skeleton|> class PyTest: """PyTest""" def finalize_options(self): """finalize_options""" <|body_0|> def run_tests(self): """run_tests""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PyTest: """PyTest""" def finalize_options(self): """finalize_options""" TestCommand.finalize_options(self) self.test_args = [] self.test_suite = True def run_tests(self): """run_tests""" import pytest errcode = pytest.main(self.test_args) ...
the_stack_v2_python_sparse
setup.py
nutanix/calm-dsl
train
41
473e183c39784c3ac836b2fac5488650bb56e1c6
[ "self.set_sys()\nself.fig = fig\nfrom wigner_normalize import WignerNormalize, WignerSymLogNorm\nimg_params = dict(extent=[self.hybrid_sys.X.min(), self.hybrid_sys.X.max(), self.hybrid_sys.P.min(), self.hybrid_sys.P.max()], origin='lower', cmap='seismic', norm=WignerSymLogNorm(linthresh=1e-07, vmin=-0.01, vmax=0.1)...
<|body_start_0|> self.set_sys() self.fig = fig from wigner_normalize import WignerNormalize, WignerSymLogNorm img_params = dict(extent=[self.hybrid_sys.X.min(), self.hybrid_sys.X.max(), self.hybrid_sys.P.min(), self.hybrid_sys.P.max()], origin='lower', cmap='seismic', norm=WignerSymLogNo...
Class to visualize the phase space dynamics in phase space.
VisualizeHybrid
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VisualizeHybrid: """Class to visualize the phase space dynamics in phase space.""" def __init__(self, fig): """Initialize all propagators and frame :param fig: matplotlib figure object""" <|body_0|> def set_sys(self): """Initialize quantum propagator :param self:...
stack_v2_sparse_classes_36k_train_012720
7,316
no_license
[ { "docstring": "Initialize all propagators and frame :param fig: matplotlib figure object", "name": "__init__", "signature": "def __init__(self, fig)" }, { "docstring": "Initialize quantum propagator :param self: :return:", "name": "set_sys", "signature": "def set_sys(self)" }, { ...
3
stack_v2_sparse_classes_30k_train_001983
Implement the Python class `VisualizeHybrid` described below. Class description: Class to visualize the phase space dynamics in phase space. Method signatures and docstrings: - def __init__(self, fig): Initialize all propagators and frame :param fig: matplotlib figure object - def set_sys(self): Initialize quantum pr...
Implement the Python class `VisualizeHybrid` described below. Class description: Class to visualize the phase space dynamics in phase space. Method signatures and docstrings: - def __init__(self, fig): Initialize all propagators and frame :param fig: matplotlib figure object - def set_sys(self): Initialize quantum pr...
c247a8dc47d38435191f14bc4d71fa64ad98e008
<|skeleton|> class VisualizeHybrid: """Class to visualize the phase space dynamics in phase space.""" def __init__(self, fig): """Initialize all propagators and frame :param fig: matplotlib figure object""" <|body_0|> def set_sys(self): """Initialize quantum propagator :param self:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VisualizeHybrid: """Class to visualize the phase space dynamics in phase space.""" def __init__(self, fig): """Initialize all propagators and frame :param fig: matplotlib figure object""" self.set_sys() self.fig = fig from wigner_normalize import WignerNormalize, WignerSym...
the_stack_v2_python_sparse
hybrid_vs_pauli.py
gharib85/QCHybrid
train
0
b4ecaf76d184aa68e3b715f653dbb78741c8ef69
[ "article = get_object_or_404(Article, slug=self.kwargs['slug'])\ndata = request.data\nserializer = self.serializer_class(data=data)\nif serializer.is_valid():\n serializer.save(author=self.request.user, article=article)\n return Response(serializer.data, status=status.HTTP_201_CREATED)\nreturn Response(serial...
<|body_start_0|> article = get_object_or_404(Article, slug=self.kwargs['slug']) data = request.data serializer = self.serializer_class(data=data) if serializer.is_valid(): serializer.save(author=self.request.user, article=article) return Response(serializer.data, ...
A user can comment on an article
ArticleCommentAPIView
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArticleCommentAPIView: """A user can comment on an article""" def post(self, request, slug=None): """Comment on an article in the application""" <|body_0|> def get(self, request, slug=None): """Get all the comments of an article""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_36k_train_012721
8,748
permissive
[ { "docstring": "Comment on an article in the application", "name": "post", "signature": "def post(self, request, slug=None)" }, { "docstring": "Get all the comments of an article", "name": "get", "signature": "def get(self, request, slug=None)" } ]
2
stack_v2_sparse_classes_30k_train_018542
Implement the Python class `ArticleCommentAPIView` described below. Class description: A user can comment on an article Method signatures and docstrings: - def post(self, request, slug=None): Comment on an article in the application - def get(self, request, slug=None): Get all the comments of an article
Implement the Python class `ArticleCommentAPIView` described below. Class description: A user can comment on an article Method signatures and docstrings: - def post(self, request, slug=None): Comment on an article in the application - def get(self, request, slug=None): Get all the comments of an article <|skeleton|>...
e8438b78b88c52d108520429d0b67cd3d13e0824
<|skeleton|> class ArticleCommentAPIView: """A user can comment on an article""" def post(self, request, slug=None): """Comment on an article in the application""" <|body_0|> def get(self, request, slug=None): """Get all the comments of an article""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ArticleCommentAPIView: """A user can comment on an article""" def post(self, request, slug=None): """Comment on an article in the application""" article = get_object_or_404(Article, slug=self.kwargs['slug']) data = request.data serializer = self.serializer_class(data=data)...
the_stack_v2_python_sparse
authors/apps/comments/views.py
andela/ah-sealteam
train
1
283fd0a2f315f7fa00eada46979467e6cb7631c6
[ "super().__init__(NAME)\nself.num_images = num_images\nself.time_interval_min = time_interval_min\nself.scaling_image = preprocessing.min_max_scaling_images()\nself.scaling_ghi = preprocessing.min_max_scaling_ghi()\nif encoder is None:\n self.encoder = autoencoder.Encoder()\n self.encoder.load(autoencoder.BES...
<|body_start_0|> super().__init__(NAME) self.num_images = num_images self.time_interval_min = time_interval_min self.scaling_image = preprocessing.min_max_scaling_images() self.scaling_ghi = preprocessing.min_max_scaling_ghi() if encoder is None: self.encoder ...
Create GRU Model based on the embeddings created with the encoder.
GRU
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GRU: """Create GRU Model based on the embeddings created with the encoder.""" def __init__(self, encoder=None, num_images=6, time_interval_min=30, dropout=0.2): """Initialize the architecture.""" <|body_0|> def call(self, data: Tuple[tf.Tensor, tf.Tensor], training=False...
stack_v2_sparse_classes_36k_train_012722
3,350
no_license
[ { "docstring": "Initialize the architecture.", "name": "__init__", "signature": "def __init__(self, encoder=None, num_images=6, time_interval_min=30, dropout=0.2)" }, { "docstring": "Performs the forward pass in the neural network. Can use a different pass with the optional training boolean if s...
4
stack_v2_sparse_classes_30k_train_013906
Implement the Python class `GRU` described below. Class description: Create GRU Model based on the embeddings created with the encoder. Method signatures and docstrings: - def __init__(self, encoder=None, num_images=6, time_interval_min=30, dropout=0.2): Initialize the architecture. - def call(self, data: Tuple[tf.Te...
Implement the Python class `GRU` described below. Class description: Create GRU Model based on the embeddings created with the encoder. Method signatures and docstrings: - def __init__(self, encoder=None, num_images=6, time_interval_min=30, dropout=0.2): Initialize the architecture. - def call(self, data: Tuple[tf.Te...
b20d809bff84bb508190be8540a815fb9b8b3f8b
<|skeleton|> class GRU: """Create GRU Model based on the embeddings created with the encoder.""" def __init__(self, encoder=None, num_images=6, time_interval_min=30, dropout=0.2): """Initialize the architecture.""" <|body_0|> def call(self, data: Tuple[tf.Tensor, tf.Tensor], training=False...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GRU: """Create GRU Model based on the embeddings created with the encoder.""" def __init__(self, encoder=None, num_images=6, time_interval_min=30, dropout=0.2): """Initialize the architecture.""" super().__init__(NAME) self.num_images = num_images self.time_interval_min = ...
the_stack_v2_python_sparse
src/model/gru.py
nathanielsimard/Solar-Irradiance-Prediction
train
0
e1587896c664c3c35624d3aada1bcd1059a5410d
[ "params = publication_star_uid_parser.parse_args()\nres, status_code = star_publication(params, publication_id)\nreturn (res, status_code)", "params = publication_star_uid_parser.parse_args()\nres, status_code = unstar_publication(params, publication_id)\nreturn (res, status_code)", "params = publication_star_p...
<|body_start_0|> params = publication_star_uid_parser.parse_args() res, status_code = star_publication(params, publication_id) return (res, status_code) <|end_body_0|> <|body_start_1|> params = publication_star_uid_parser.parse_args() res, status_code = unstar_publication(params...
PublicationStarResource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PublicationStarResource: def post(self, publication_id): """Star a publication.""" <|body_0|> def delete(self, publication_id): """Unstar a publication.""" <|body_1|> def get(self, publication_id): """Get a starring.""" <|body_2|> <|end_...
stack_v2_sparse_classes_36k_train_012723
5,345
no_license
[ { "docstring": "Star a publication.", "name": "post", "signature": "def post(self, publication_id)" }, { "docstring": "Unstar a publication.", "name": "delete", "signature": "def delete(self, publication_id)" }, { "docstring": "Get a starring.", "name": "get", "signature"...
3
stack_v2_sparse_classes_30k_train_002371
Implement the Python class `PublicationStarResource` described below. Class description: Implement the PublicationStarResource class. Method signatures and docstrings: - def post(self, publication_id): Star a publication. - def delete(self, publication_id): Unstar a publication. - def get(self, publication_id): Get a...
Implement the Python class `PublicationStarResource` described below. Class description: Implement the PublicationStarResource class. Method signatures and docstrings: - def post(self, publication_id): Star a publication. - def delete(self, publication_id): Unstar a publication. - def get(self, publication_id): Get a...
30fff71d9cf58dbc9b38bd1cf999a03c51347dfd
<|skeleton|> class PublicationStarResource: def post(self, publication_id): """Star a publication.""" <|body_0|> def delete(self, publication_id): """Unstar a publication.""" <|body_1|> def get(self, publication_id): """Get a starring.""" <|body_2|> <|end_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PublicationStarResource: def post(self, publication_id): """Star a publication.""" params = publication_star_uid_parser.parse_args() res, status_code = star_publication(params, publication_id) return (res, status_code) def delete(self, publication_id): """Unstar a ...
the_stack_v2_python_sparse
bookbnb_middleware/api/endpoints/publications.py
7552-2020C2-grupo5/middleware
train
0
616f8c3a999eda66c7159802e13db85d9d7faf41
[ "try:\n return self.request.user.roster\nexcept AttributeError:\n return None", "context = super(FlashbackAddPostView, self).get_context_data(**kwargs)\nflashback = self.get_object()\nuser = self.request.user\ntry:\n user_is_staff = bool(user.is_staff or user.check_permstring('builders'))\n timeline =...
<|body_start_0|> try: return self.request.user.roster except AttributeError: return None <|end_body_0|> <|body_start_1|> context = super(FlashbackAddPostView, self).get_context_data(**kwargs) flashback = self.get_object() user = self.request.user ...
View for an individual flashback or adding a post to it
FlashbackAddPostView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FlashbackAddPostView: """View for an individual flashback or adding a post to it""" def poster(self): """RosterEntry of user who will be making post""" <|body_0|> def get_context_data(self, **kwargs): """Gets context for template, ensures we have permissions""" ...
stack_v2_sparse_classes_36k_train_012724
34,840
permissive
[ { "docstring": "RosterEntry of user who will be making post", "name": "poster", "signature": "def poster(self)" }, { "docstring": "Gets context for template, ensures we have permissions", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" }, { "docstr...
3
stack_v2_sparse_classes_30k_train_012995
Implement the Python class `FlashbackAddPostView` described below. Class description: View for an individual flashback or adding a post to it Method signatures and docstrings: - def poster(self): RosterEntry of user who will be making post - def get_context_data(self, **kwargs): Gets context for template, ensures we ...
Implement the Python class `FlashbackAddPostView` described below. Class description: View for an individual flashback or adding a post to it Method signatures and docstrings: - def poster(self): RosterEntry of user who will be making post - def get_context_data(self, **kwargs): Gets context for template, ensures we ...
363a1f14fd1a640580a4bf4486a1afe776757557
<|skeleton|> class FlashbackAddPostView: """View for an individual flashback or adding a post to it""" def poster(self): """RosterEntry of user who will be making post""" <|body_0|> def get_context_data(self, **kwargs): """Gets context for template, ensures we have permissions""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FlashbackAddPostView: """View for an individual flashback or adding a post to it""" def poster(self): """RosterEntry of user who will be making post""" try: return self.request.user.roster except AttributeError: return None def get_context_data(self, *...
the_stack_v2_python_sparse
web/character/views.py
Arx-Game/arxcode
train
52
3089a101c3cf3522e5e7043fbfa59efc4b80a792
[ "self.__width = width\nself.__height = height\nself.__score = 0\nself.__food = deque(food)\nself.__snake = deque([(0, 0)])\nself.__direction = {'U': (-1, 0), 'L': (0, -1), 'R': (0, 1), 'D': (1, 0)}", "def valid(x, y):\n return 0 <= x < self.__height and 0 <= y < self.__width and ((x, y) not in self.__snake)\nd...
<|body_start_0|> self.__width = width self.__height = height self.__score = 0 self.__food = deque(food) self.__snake = deque([(0, 0)]) self.__direction = {'U': (-1, 0), 'L': (0, -1), 'R': (0, 1), 'D': (1, 0)} <|end_body_0|> <|body_start_1|> def valid(x, y): ...
SnakeGame
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SnakeGame: def __init__(self, width, height, food): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :typ...
stack_v2_sparse_classes_36k_train_012725
8,150
permissive
[ { "docstring": "Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :type width: int :type height: int :type food: List[List[int]]", ...
2
stack_v2_sparse_classes_30k_train_003820
Implement the Python class `SnakeGame` described below. Class description: Implement the SnakeGame class. Method signatures and docstrings: - def __init__(self, width, height, food): Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E...
Implement the Python class `SnakeGame` described below. Class description: Implement the SnakeGame class. Method signatures and docstrings: - def __init__(self, width, height, food): Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E...
0ba027d9b8bc7c80bc89ce2da3543ce7a49a403c
<|skeleton|> class SnakeGame: def __init__(self, width, height, food): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :typ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SnakeGame: def __init__(self, width, height, food): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :type width: int :...
the_stack_v2_python_sparse
cs15211/DesignSnakeGame.py
JulyKikuAkita/PythonPrac
train
1
a639412340c7c976da22e0ae2f1cb875ddf94df8
[ "r = Round.query.get(round_id)\nif r is not None:\n return {'splits': r.split_options__html(), 'competitions': [c.dancing_class.name for c in r.competition.sorted_qualifications()]}\nabort(404, 'Unknown round_id')", "r = Round.query.get(round_id)\nif r is not None:\n r.split_qualification(api.payload['split...
<|body_start_0|> r = Round.query.get(round_id) if r is not None: return {'splits': r.split_options__html(), 'competitions': [c.dancing_class.name for c in r.competition.sorted_qualifications()]} abort(404, 'Unknown round_id') <|end_body_0|> <|body_start_1|> r = Round.query.g...
RoundAPIProgressCouplesSplit
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RoundAPIProgressCouplesSplit: def get(self, round_id): """Get the possible split options for a qualification round""" <|body_0|> def post(self, round_id): """Split the qualification round""" <|body_1|> <|end_skeleton|> <|body_start_0|> r = Round.que...
stack_v2_sparse_classes_36k_train_012726
25,303
no_license
[ { "docstring": "Get the possible split options for a qualification round", "name": "get", "signature": "def get(self, round_id)" }, { "docstring": "Split the qualification round", "name": "post", "signature": "def post(self, round_id)" } ]
2
null
Implement the Python class `RoundAPIProgressCouplesSplit` described below. Class description: Implement the RoundAPIProgressCouplesSplit class. Method signatures and docstrings: - def get(self, round_id): Get the possible split options for a qualification round - def post(self, round_id): Split the qualification roun...
Implement the Python class `RoundAPIProgressCouplesSplit` described below. Class description: Implement the RoundAPIProgressCouplesSplit class. Method signatures and docstrings: - def get(self, round_id): Get the possible split options for a qualification round - def post(self, round_id): Split the qualification roun...
079b109fd13683a31d1d632faa5ab72cf0e78ddf
<|skeleton|> class RoundAPIProgressCouplesSplit: def get(self, round_id): """Get the possible split options for a qualification round""" <|body_0|> def post(self, round_id): """Split the qualification round""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RoundAPIProgressCouplesSplit: def get(self, round_id): """Get the possible split options for a qualification round""" r = Round.query.get(round_id) if r is not None: return {'splits': r.split_options__html(), 'competitions': [c.dancing_class.name for c in r.competition.sort...
the_stack_v2_python_sparse
backend/apis/round/apis.py
AlenAlic/DANCE
train
0
8cccad9fe52080596f6d8036dec16b0f06e7fd1b
[ "graph = [[] for _ in xrange(numCourses)]\nvisit = [0 for _ in xrange(numCourses)]\nfor x, y in prerequisites:\n graph[x].append(y)\n\ndef dfs(i):\n if visit[i] == -1:\n return False\n if visit[i] == 1:\n return True\n visit[i] = -1\n for j in graph[i]:\n if not dfs(j):\n ...
<|body_start_0|> graph = [[] for _ in xrange(numCourses)] visit = [0 for _ in xrange(numCourses)] for x, y in prerequisites: graph[x].append(y) def dfs(i): if visit[i] == -1: return False if visit[i] == 1: return True ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canFinish(self, numCourses, prerequisites): """:type numCourses: int :type prerequisites: List[List[int]] :rtype: bool""" <|body_0|> def canFinish_2(self, numCourses, prerequisites): """:type numCourses: int :type prerequisites: List[List[int]] :rtype: ...
stack_v2_sparse_classes_36k_train_012727
3,440
no_license
[ { "docstring": ":type numCourses: int :type prerequisites: List[List[int]] :rtype: bool", "name": "canFinish", "signature": "def canFinish(self, numCourses, prerequisites)" }, { "docstring": ":type numCourses: int :type prerequisites: List[List[int]] :rtype: bool", "name": "canFinish_2", ...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canFinish(self, numCourses, prerequisites): :type numCourses: int :type prerequisites: List[List[int]] :rtype: bool - def canFinish_2(self, numCourses, prerequisites): :type ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canFinish(self, numCourses, prerequisites): :type numCourses: int :type prerequisites: List[List[int]] :rtype: bool - def canFinish_2(self, numCourses, prerequisites): :type ...
0e99f9a5226507706b3ee66fd04bae813755ef40
<|skeleton|> class Solution: def canFinish(self, numCourses, prerequisites): """:type numCourses: int :type prerequisites: List[List[int]] :rtype: bool""" <|body_0|> def canFinish_2(self, numCourses, prerequisites): """:type numCourses: int :type prerequisites: List[List[int]] :rtype: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def canFinish(self, numCourses, prerequisites): """:type numCourses: int :type prerequisites: List[List[int]] :rtype: bool""" graph = [[] for _ in xrange(numCourses)] visit = [0 for _ in xrange(numCourses)] for x, y in prerequisites: graph[x].append(y) ...
the_stack_v2_python_sparse
medium/dfsbfs/test_207_Course_Schedule.py
wuxu1019/leetcode_sophia
train
1
48c27873ddd652db728fe3b279a7f8d145ec456e
[ "if parity == 1:\n gamma = (1.0 / mu_t - 1.0 / mu_r) * 0.5\n kappa = 1 - gamma - 1.0 / mu_r\nelif parity == -1:\n gamma = (1.0 / mu_t + 1.0 / mu_r) * 0.5\n kappa = 1 - gamma + 1.0 / mu_r\nelse:\n raise ValueError('%f is not a valid value for the parity of the macromodel. Choose either +1 or -1.' % pa...
<|body_start_0|> if parity == 1: gamma = (1.0 / mu_t - 1.0 / mu_r) * 0.5 kappa = 1 - gamma - 1.0 / mu_r elif parity == -1: gamma = (1.0 / mu_t + 1.0 / mu_r) * 0.5 kappa = 1 - gamma + 1.0 / mu_r else: raise ValueError('%f is not a valid ...
this class implements the macromodel potential of `Diego et al. <https://www.aanda.org/articles/aa/pdf/2019/07/aa35490-19.pdf>`_ Convergence and shear are computed according to `Diego2018 <arXiv:1706.10281v2>`_
ConstMag
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConstMag: """this class implements the macromodel potential of `Diego et al. <https://www.aanda.org/articles/aa/pdf/2019/07/aa35490-19.pdf>`_ Convergence and shear are computed according to `Diego2018 <arXiv:1706.10281v2>`_""" def function(self, x, y, mu_r, mu_t, parity, phi_G, center_x=0, c...
stack_v2_sparse_classes_36k_train_012728
4,987
permissive
[ { "docstring": ":param x: x-coord (in angles) :param y: y-coord (in angles) :param mu_r: radial magnification :param mu_t: tangential magnification :param parity: parity side of the macromodel. Either +1 (positive parity) or -1 (negative parity) :param phi_G: shear orientation angle (relative to the x-axis) :re...
3
stack_v2_sparse_classes_30k_train_010435
Implement the Python class `ConstMag` described below. Class description: this class implements the macromodel potential of `Diego et al. <https://www.aanda.org/articles/aa/pdf/2019/07/aa35490-19.pdf>`_ Convergence and shear are computed according to `Diego2018 <arXiv:1706.10281v2>`_ Method signatures and docstrings:...
Implement the Python class `ConstMag` described below. Class description: this class implements the macromodel potential of `Diego et al. <https://www.aanda.org/articles/aa/pdf/2019/07/aa35490-19.pdf>`_ Convergence and shear are computed according to `Diego2018 <arXiv:1706.10281v2>`_ Method signatures and docstrings:...
73c9645f26f6983fe7961104075ebe8bf7a4b54c
<|skeleton|> class ConstMag: """this class implements the macromodel potential of `Diego et al. <https://www.aanda.org/articles/aa/pdf/2019/07/aa35490-19.pdf>`_ Convergence and shear are computed according to `Diego2018 <arXiv:1706.10281v2>`_""" def function(self, x, y, mu_r, mu_t, parity, phi_G, center_x=0, c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConstMag: """this class implements the macromodel potential of `Diego et al. <https://www.aanda.org/articles/aa/pdf/2019/07/aa35490-19.pdf>`_ Convergence and shear are computed according to `Diego2018 <arXiv:1706.10281v2>`_""" def function(self, x, y, mu_r, mu_t, parity, phi_G, center_x=0, center_y=0): ...
the_stack_v2_python_sparse
lenstronomy/LensModel/Profiles/const_mag.py
lenstronomy/lenstronomy
train
41
39b17239a3a3658044307180c9ddcefa60dca73d
[ "self.__phone_number = phone_number\nself.__password_hash = password_hash\nself.__connection = connection\nself.__first_name = first_name\nself.__middle_name = middle_name\nself.__last_name = last_name\nself.__dob = dob", "try:\n cursor = self.__connection.cursor()\n cursor.execute('insert into neutron_buye...
<|body_start_0|> self.__phone_number = phone_number self.__password_hash = password_hash self.__connection = connection self.__first_name = first_name self.__middle_name = middle_name self.__last_name = last_name self.__dob = dob <|end_body_0|> <|body_start_1|> ...
This class is used to create a new buyer account
BuyerSignUp
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BuyerSignUp: """This class is used to create a new buyer account""" def __init__(self, phone_number, password_hash, first_name, middle_name, last_name, dob, connection): """Constructor to initialize the instance variables. :param phone_number: The phone number of the buyer :param pas...
stack_v2_sparse_classes_36k_train_012729
2,462
no_license
[ { "docstring": "Constructor to initialize the instance variables. :param phone_number: The phone number of the buyer :param password_hash: The sha512 hash of the password of the buyer :param first_name: First Name of the buyer :param last_name: Last Name of the buyer :param middle_name: Middle Name of the buyer...
2
stack_v2_sparse_classes_30k_train_009473
Implement the Python class `BuyerSignUp` described below. Class description: This class is used to create a new buyer account Method signatures and docstrings: - def __init__(self, phone_number, password_hash, first_name, middle_name, last_name, dob, connection): Constructor to initialize the instance variables. :par...
Implement the Python class `BuyerSignUp` described below. Class description: This class is used to create a new buyer account Method signatures and docstrings: - def __init__(self, phone_number, password_hash, first_name, middle_name, last_name, dob, connection): Constructor to initialize the instance variables. :par...
c3b067492b9ffa885323f457a6e101ced8dcef06
<|skeleton|> class BuyerSignUp: """This class is used to create a new buyer account""" def __init__(self, phone_number, password_hash, first_name, middle_name, last_name, dob, connection): """Constructor to initialize the instance variables. :param phone_number: The phone number of the buyer :param pas...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BuyerSignUp: """This class is used to create a new buyer account""" def __init__(self, phone_number, password_hash, first_name, middle_name, last_name, dob, connection): """Constructor to initialize the instance variables. :param phone_number: The phone number of the buyer :param password_hash: T...
the_stack_v2_python_sparse
Neutron/buyer/sign_up.py
VISWESWARAN1998/Neutron
train
6
53749f648fa8110d9eb59f99dab9e8e9ff3ad060
[ "self.platform_id = platform_id\nself.name = name\nself.status = status\nself.source = source\nself.source_id = source_id\nself.file_avatar_thumb = self.find_avatar(platform_id, 'thumb')\nself.file_avatar = self.find_avatar(platform_id)\nif owner:\n self.file_avatar_thumb = self.find_avatar('me', 'thumb')\n f...
<|body_start_0|> self.platform_id = platform_id self.name = name self.status = status self.source = source self.source_id = source_id self.file_avatar_thumb = self.find_avatar(platform_id, 'thumb') self.file_avatar = self.find_avatar(platform_id) if owner:...
Contact object to store contact information
Contact
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Contact: """Contact object to store contact information""" def __init__(self, platform_id, name=None, status=None, source=None, source_id=None, owner=None): """Create a new Contact object. :param platform_id: WhatsApp-ID :param name=None: name of contact :param status=None: user stat...
stack_v2_sparse_classes_36k_train_012730
46,698
permissive
[ { "docstring": "Create a new Contact object. :param platform_id: WhatsApp-ID :param name=None: name of contact :param status=None: user status :param source=None: source of data (database, etc.) :param source_id=None: source id of data (id of entry in database)", "name": "__init__", "signature": "def __...
2
stack_v2_sparse_classes_30k_train_017886
Implement the Python class `Contact` described below. Class description: Contact object to store contact information Method signatures and docstrings: - def __init__(self, platform_id, name=None, status=None, source=None, source_id=None, owner=None): Create a new Contact object. :param platform_id: WhatsApp-ID :param...
Implement the Python class `Contact` described below. Class description: Contact object to store contact information Method signatures and docstrings: - def __init__(self, platform_id, name=None, status=None, source=None, source_id=None, owner=None): Create a new Contact object. :param platform_id: WhatsApp-ID :param...
5ba553fd0eb4c1d80842074a553119486f005822
<|skeleton|> class Contact: """Contact object to store contact information""" def __init__(self, platform_id, name=None, status=None, source=None, source_id=None, owner=None): """Create a new Contact object. :param platform_id: WhatsApp-ID :param name=None: name of contact :param status=None: user stat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Contact: """Contact object to store contact information""" def __init__(self, platform_id, name=None, status=None, source=None, source_id=None, owner=None): """Create a new Contact object. :param platform_id: WhatsApp-ID :param name=None: name of contact :param status=None: user status :param sou...
the_stack_v2_python_sparse
MobileRevelator/python/whatsapp.py
bkerler/MR
train
140
35c779ca407e7070ae7c6a3d4c93b4016be0b8f0
[ "if not root:\n return None\nq = deque([root])\narr = []\nwhile q:\n node = q.popleft()\n if not node:\n arr.append('None')\n continue\n arr.append(str(node.val))\n q.extend([node.left, node.right])\nreturn ' '.join(arr)", "if not data:\n return None\nnodes = deque(data.split(' '))...
<|body_start_0|> if not root: return None q = deque([root]) arr = [] while q: node = q.popleft() if not node: arr.append('None') continue arr.append(str(node.val)) q.extend([node.left, node.right]...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_012731
2,857
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_011011
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:...
fbaae4bdbb2017ee43b0d1a3f23137a75f7ea2c1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return None q = deque([root]) arr = [] while q: node = q.popleft() if not node: arr.append('None'...
the_stack_v2_python_sparse
serialise_deserialise_binary_tree.py
Milan-Chicago/ds-guide
train
0
42e73af0a8a0595994a59e3400f84348ec0959e1
[ "try:\n vaccination = models.Vaccination.create_from_json(data=request.data, patient_profile=request.user.patient_profile)\nexcept custom_exceptions.DataNotProvided as e:\n return response.Response(data=e.get_response_format(), status=status.HTTP_400_BAD_REQUEST)\nserialized_vaccination = serializers.Vaccinat...
<|body_start_0|> try: vaccination = models.Vaccination.create_from_json(data=request.data, patient_profile=request.user.patient_profile) except custom_exceptions.DataNotProvided as e: return response.Response(data=e.get_response_format(), status=status.HTTP_400_BAD_REQUEST) ...
Endpoints for Vaccination objects.
VaccinationsEndpoint
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VaccinationsEndpoint: """Endpoints for Vaccination objects.""" def post(self, request: Request) -> response.Response: """Adds a new vaccination for the user.""" <|body_0|> def put(self, request: Request) -> response.Response: """Updates an existing vaccination.""...
stack_v2_sparse_classes_36k_train_012732
14,860
no_license
[ { "docstring": "Adds a new vaccination for the user.", "name": "post", "signature": "def post(self, request: Request) -> response.Response" }, { "docstring": "Updates an existing vaccination.", "name": "put", "signature": "def put(self, request: Request) -> response.Response" }, { ...
3
stack_v2_sparse_classes_30k_train_014760
Implement the Python class `VaccinationsEndpoint` described below. Class description: Endpoints for Vaccination objects. Method signatures and docstrings: - def post(self, request: Request) -> response.Response: Adds a new vaccination for the user. - def put(self, request: Request) -> response.Response: Updates an ex...
Implement the Python class `VaccinationsEndpoint` described below. Class description: Endpoints for Vaccination objects. Method signatures and docstrings: - def post(self, request: Request) -> response.Response: Adds a new vaccination for the user. - def put(self, request: Request) -> response.Response: Updates an ex...
b6d757895132b9b3c8c6682c11efadf993d5905b
<|skeleton|> class VaccinationsEndpoint: """Endpoints for Vaccination objects.""" def post(self, request: Request) -> response.Response: """Adds a new vaccination for the user.""" <|body_0|> def put(self, request: Request) -> response.Response: """Updates an existing vaccination.""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VaccinationsEndpoint: """Endpoints for Vaccination objects.""" def post(self, request: Request) -> response.Response: """Adds a new vaccination for the user.""" try: vaccination = models.Vaccination.create_from_json(data=request.data, patient_profile=request.user.patient_profi...
the_stack_v2_python_sparse
main/model_api.py
kalolad1/cosmos
train
0
7888c2b1eb20ff56234bb05f494a8abc41294b8a
[ "search = ['أ', 'إ', 'آ', 'ة', '_', '-', '/', '.', '،', ' و ', ' يا ', '\"', 'ـ', \"'\", 'ى', '\\\\', '\\n', '\\t', '&quot;', '?', '؟', '!', ':', '(', ')', '\\x02']\nreplace = ['ا', 'ا', 'ا', 'ه', ' ', ' ', '', '', '', ' و', ' يا', '', '', '', 'ي', '', ' ', ' ', ' ', ' ? ', ' ؟ ', ' ! ', '', '', '', '']\np_tashkeel...
<|body_start_0|> search = ['أ', 'إ', 'آ', 'ة', '_', '-', '/', '.', '،', ' و ', ' يا ', '"', 'ـ', "'", 'ى', '\\', '\n', '\t', '&quot;', '?', '؟', '!', ':', '(', ')', '\x02'] replace = ['ا', 'ا', 'ا', 'ه', ' ', ' ', '', '', '', ' و', ' يا', '', '', '', 'ي', '', ' ', ' ', ' ', ' ? ', ' ؟ ', ' ! ', '', '', ...
Procces the data and embed them using AraVec OR ELMo
Embedding
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Embedding: """Procces the data and embed them using AraVec OR ELMo""" def clean_str(text: str) -> str: """Removing any additional characters found in the TEXT, Based on AraVec. :parameter text in str format as a book :returns str as a preprocessed book""" <|body_0|> def ...
stack_v2_sparse_classes_36k_train_012733
5,959
no_license
[ { "docstring": "Removing any additional characters found in the TEXT, Based on AraVec. :parameter text in str format as a book :returns str as a preprocessed book", "name": "clean_str", "signature": "def clean_str(text: str) -> str" }, { "docstring": "Embed each word in the book into a Vector in...
3
stack_v2_sparse_classes_30k_train_000505
Implement the Python class `Embedding` described below. Class description: Procces the data and embed them using AraVec OR ELMo Method signatures and docstrings: - def clean_str(text: str) -> str: Removing any additional characters found in the TEXT, Based on AraVec. :parameter text in str format as a book :returns s...
Implement the Python class `Embedding` described below. Class description: Procces the data and embed them using AraVec OR ELMo Method signatures and docstrings: - def clean_str(text: str) -> str: Removing any additional characters found in the TEXT, Based on AraVec. :parameter text in str format as a book :returns s...
c7349dd0501e9a0d47a8f1024762ee15b225c6e0
<|skeleton|> class Embedding: """Procces the data and embed them using AraVec OR ELMo""" def clean_str(text: str) -> str: """Removing any additional characters found in the TEXT, Based on AraVec. :parameter text in str format as a book :returns str as a preprocessed book""" <|body_0|> def ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Embedding: """Procces the data and embed them using AraVec OR ELMo""" def clean_str(text: str) -> str: """Removing any additional characters found in the TEXT, Based on AraVec. :parameter text in str format as a book :returns str as a preprocessed book""" search = ['أ', 'إ', 'آ', 'ة', '_'...
the_stack_v2_python_sparse
Algs/Embedding.py
saleems11/Final_Project_B
train
0
a7565767aba273b63778460edc7e99085fe1bbd6
[ "self.x = int(x)\nself.y = int(y)\nself.p = int(p)\nself.ip_address = ip_address", "if self.p > 0:\n return self.p\nelse:\n return TYPICAL_PHYSICAL_VIRTUAL_MAP[0 - self.p]", "result = CORE_RANGE.fullmatch(core_string)\nif result is not None:\n return range(int(result.group(1)), int(result.group(2)) + 1...
<|body_start_0|> self.x = int(x) self.y = int(y) self.p = int(p) self.ip_address = ip_address <|end_body_0|> <|body_start_1|> if self.p > 0: return self.p else: return TYPICAL_PHYSICAL_VIRTUAL_MAP[0 - self.p] <|end_body_1|> <|body_start_2|> ...
Represents a core to be ignored when building a machine.
IgnoreCore
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IgnoreCore: """Represents a core to be ignored when building a machine.""" def __init__(self, x, y, p, ip_address=None): """:param x: X coordinate of a core to ignore :type x: int or str :param y: Y coordinate of a core to ignore :type y: int or str :param p: The virtual core ID of a...
stack_v2_sparse_classes_36k_train_012734
5,810
permissive
[ { "docstring": ":param x: X coordinate of a core to ignore :type x: int or str :param y: Y coordinate of a core to ignore :type y: int or str :param p: The virtual core ID of a core if > 0, or the physical core if <= 0 (actual value will be negated) :type p: int or str :param ip_address: Optional IP address whi...
5
stack_v2_sparse_classes_30k_train_003086
Implement the Python class `IgnoreCore` described below. Class description: Represents a core to be ignored when building a machine. Method signatures and docstrings: - def __init__(self, x, y, p, ip_address=None): :param x: X coordinate of a core to ignore :type x: int or str :param y: Y coordinate of a core to igno...
Implement the Python class `IgnoreCore` described below. Class description: Represents a core to be ignored when building a machine. Method signatures and docstrings: - def __init__(self, x, y, p, ip_address=None): :param x: X coordinate of a core to ignore :type x: int or str :param y: Y coordinate of a core to igno...
7ec4276879249d53ed8153a62b0b344c5f0b99e3
<|skeleton|> class IgnoreCore: """Represents a core to be ignored when building a machine.""" def __init__(self, x, y, p, ip_address=None): """:param x: X coordinate of a core to ignore :type x: int or str :param y: Y coordinate of a core to ignore :type y: int or str :param p: The virtual core ID of a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IgnoreCore: """Represents a core to be ignored when building a machine.""" def __init__(self, x, y, p, ip_address=None): """:param x: X coordinate of a core to ignore :type x: int or str :param y: Y coordinate of a core to ignore :type y: int or str :param p: The virtual core ID of a core if > 0,...
the_stack_v2_python_sparse
spinn_machine/ignores/ignore_core.py
SpiNNakerManchester/SpiNNMachine
train
6
49919c2323266cadcc59c59e708a976a5f266ba7
[ "flags.AddParentFlagsToParser(parser)\nparser.add_argument('--location', metavar='LOCATION', required=True, help='Location')\nparser.add_argument('--insight-type', metavar='INSIGHT_TYPE', required=True, help='Insight type to list insights for. Supported insight-types can be found here: https://cloud.google.com/reco...
<|body_start_0|> flags.AddParentFlagsToParser(parser) parser.add_argument('--location', metavar='LOCATION', required=True, help='Location') parser.add_argument('--insight-type', metavar='INSIGHT_TYPE', required=True, help='Insight type to list insights for. Supported insight-types can be found h...
List insights for a cloud entity. This command lists all insights for a given cloud entity, location and insight type. Supported insight-types can be found here: https://cloud.google.com/recommender/docs/insights/insight-types. Currently the following cloud_entity_types are supported: project, billing_account, folder a...
ListOriginal
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ListOriginal: """List insights for a cloud entity. This command lists all insights for a given cloud entity, location and insight type. Supported insight-types can be found here: https://cloud.google.com/recommender/docs/insights/insight-types. Currently the following cloud_entity_types are suppo...
stack_v2_sparse_classes_36k_train_012735
6,196
permissive
[ { "docstring": "Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command.", "name": "Args", "signature": "def Args(parser)" }, { "docstring": "Run 'gcloud recommender insight...
2
stack_v2_sparse_classes_30k_train_012744
Implement the Python class `ListOriginal` described below. Class description: List insights for a cloud entity. This command lists all insights for a given cloud entity, location and insight type. Supported insight-types can be found here: https://cloud.google.com/recommender/docs/insights/insight-types. Currently the...
Implement the Python class `ListOriginal` described below. Class description: List insights for a cloud entity. This command lists all insights for a given cloud entity, location and insight type. Supported insight-types can be found here: https://cloud.google.com/recommender/docs/insights/insight-types. Currently the...
392abf004b16203030e6efd2f0af24db7c8d669e
<|skeleton|> class ListOriginal: """List insights for a cloud entity. This command lists all insights for a given cloud entity, location and insight type. Supported insight-types can be found here: https://cloud.google.com/recommender/docs/insights/insight-types. Currently the following cloud_entity_types are suppo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ListOriginal: """List insights for a cloud entity. This command lists all insights for a given cloud entity, location and insight type. Supported insight-types can be found here: https://cloud.google.com/recommender/docs/insights/insight-types. Currently the following cloud_entity_types are supported: project...
the_stack_v2_python_sparse
lib/surface/recommender/insights/list.py
google-cloud-sdk-unofficial/google-cloud-sdk
train
9
458a9c1bcfbad838e32131bc43236e48ecb6fd87
[ "with patch('goldstone.core.utils.exception_handler') as exception_handler:\n exception_handler.return_value = \"it's handled\"\n result = custom_exception_handler(None, None)\n self.assertTrue(exception_handler.called)\n self.assertEqual(result, \"it's handled\")", "with patch('goldstone.core.utils.e...
<|body_start_0|> with patch('goldstone.core.utils.exception_handler') as exception_handler: exception_handler.return_value = "it's handled" result = custom_exception_handler(None, None) self.assertTrue(exception_handler.called) self.assertEqual(result, "it's handl...
Tests for DRF custom exception handling.
CustomExceptionHandlerTests
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomExceptionHandlerTests: """Tests for DRF custom exception handling.""" def test_drf_handled_exception(self): """Test that we pass DRF recognized exceptions through unmodified""" <|body_0|> def test_502_error_exceptions(self): """Test ES connection exception ...
stack_v2_sparse_classes_36k_train_012736
22,971
permissive
[ { "docstring": "Test that we pass DRF recognized exceptions through unmodified", "name": "test_drf_handled_exception", "signature": "def test_drf_handled_exception(self)" }, { "docstring": "Test ES connection exception is handled", "name": "test_502_error_exceptions", "signature": "def t...
4
stack_v2_sparse_classes_30k_train_016697
Implement the Python class `CustomExceptionHandlerTests` described below. Class description: Tests for DRF custom exception handling. Method signatures and docstrings: - def test_drf_handled_exception(self): Test that we pass DRF recognized exceptions through unmodified - def test_502_error_exceptions(self): Test ES ...
Implement the Python class `CustomExceptionHandlerTests` described below. Class description: Tests for DRF custom exception handling. Method signatures and docstrings: - def test_drf_handled_exception(self): Test that we pass DRF recognized exceptions through unmodified - def test_502_error_exceptions(self): Test ES ...
73d334a9f0df7c044c06989977a9a22dd2ff9b7a
<|skeleton|> class CustomExceptionHandlerTests: """Tests for DRF custom exception handling.""" def test_drf_handled_exception(self): """Test that we pass DRF recognized exceptions through unmodified""" <|body_0|> def test_502_error_exceptions(self): """Test ES connection exception ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CustomExceptionHandlerTests: """Tests for DRF custom exception handling.""" def test_drf_handled_exception(self): """Test that we pass DRF recognized exceptions through unmodified""" with patch('goldstone.core.utils.exception_handler') as exception_handler: exception_handler.r...
the_stack_v2_python_sparse
goldstone/core/tests.py
bhuvan-rk/goldstone-server
train
0
4e9b8c123a2225ecf7660fbd919f985063439c33
[ "page = page\nper_page = 8\nrecommendations = Recommendation.query.order_by(Recommendation.created_at.desc()).paginate(page, per_page, error_out=False)\nresponse = {'items': recommendations_schema.dump(recommendations.items), 'has_next': recommendations.has_next, 'has_prev': recommendations.has_prev, 'next_num': re...
<|body_start_0|> page = page per_page = 8 recommendations = Recommendation.query.order_by(Recommendation.created_at.desc()).paginate(page, per_page, error_out=False) response = {'items': recommendations_schema.dump(recommendations.items), 'has_next': recommendations.has_next, 'has_prev':...
Recommendations
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Recommendations: def get(self, page): """List Recommendations""" <|body_0|> def post(self): """Add new Recommendation""" <|body_1|> <|end_skeleton|> <|body_start_0|> page = page per_page = 8 recommendations = Recommendation.query.ord...
stack_v2_sparse_classes_36k_train_012737
7,370
no_license
[ { "docstring": "List Recommendations", "name": "get", "signature": "def get(self, page)" }, { "docstring": "Add new Recommendation", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_020142
Implement the Python class `Recommendations` described below. Class description: Implement the Recommendations class. Method signatures and docstrings: - def get(self, page): List Recommendations - def post(self): Add new Recommendation
Implement the Python class `Recommendations` described below. Class description: Implement the Recommendations class. Method signatures and docstrings: - def get(self, page): List Recommendations - def post(self): Add new Recommendation <|skeleton|> class Recommendations: def get(self, page): """List Re...
ae78fff9888b0f68d9403d7f65cba086dabb3802
<|skeleton|> class Recommendations: def get(self, page): """List Recommendations""" <|body_0|> def post(self): """Add new Recommendation""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Recommendations: def get(self, page): """List Recommendations""" page = page per_page = 8 recommendations = Recommendation.query.order_by(Recommendation.created_at.desc()).paginate(page, per_page, error_out=False) response = {'items': recommendations_schema.dump(recomme...
the_stack_v2_python_sparse
api/v1/recommendations.py
mythril-io/flask-api
train
0
7bc476d9def287da9ea035bb6aba2aa17d8691f3
[ "Frame.__init__(self, master)\nself.pack()\nself.createWidgets()", "main_frame = Frame(self)\nLabel(main_frame, text='Please input a county').pack()\nself.text_in = Entry(main_frame)\nself.text_in.insert('end', 'Kent')\nself.text_in.pack()\nself.btn_go = Button(main_frame, text='GO!', command=self.handler)\nself....
<|body_start_0|> Frame.__init__(self, master) self.pack() self.createWidgets() <|end_body_0|> <|body_start_1|> main_frame = Frame(self) Label(main_frame, text='Please input a county').pack() self.text_in = Entry(main_frame) self.text_in.insert('end', 'Kent') ...
Application main window class.
Application
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Application: """Application main window class.""" def __init__(self, master=None): """Main frame initialization (mostly delegated)""" <|body_0|> def createWidgets(self): """Add all the widgets to the main frame.""" <|body_1|> def handler(self): ...
stack_v2_sparse_classes_36k_train_012738
1,927
permissive
[ { "docstring": "Main frame initialization (mostly delegated)", "name": "__init__", "signature": "def __init__(self, master=None)" }, { "docstring": "Add all the widgets to the main frame.", "name": "createWidgets", "signature": "def createWidgets(self)" }, { "docstring": "Runs a ...
3
stack_v2_sparse_classes_30k_train_012615
Implement the Python class `Application` described below. Class description: Application main window class. Method signatures and docstrings: - def __init__(self, master=None): Main frame initialization (mostly delegated) - def createWidgets(self): Add all the widgets to the main frame. - def handler(self): Runs a db...
Implement the Python class `Application` described below. Class description: Application main window class. Method signatures and docstrings: - def __init__(self, master=None): Main frame initialization (mostly delegated) - def createWidgets(self): Add all the widgets to the main frame. - def handler(self): Runs a db...
a9d0dc2eb16ebc4d2fd451c3a3e6f96e37c87675
<|skeleton|> class Application: """Application main window class.""" def __init__(self, master=None): """Main frame initialization (mostly delegated)""" <|body_0|> def createWidgets(self): """Add all the widgets to the main frame.""" <|body_1|> def handler(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Application: """Application main window class.""" def __init__(self, master=None): """Main frame initialization (mostly delegated)""" Frame.__init__(self, master) self.pack() self.createWidgets() def createWidgets(self): """Add all the widgets to the main fram...
the_stack_v2_python_sparse
dkr-py310/docker-student-portal-310/course_files/begin_advanced/solution_python2_chapter07_logging_gui.py
pbarton666/virtual_classroom
train
0
78b760f76448912785e3aecb3cf2f3780ee1ada1
[ "if minfo is None:\n minfo = {}\nsuper(ShutdownMessage, self).__init__(minfo)\nself.NodeList = minfo.get('NodeList', [])\nself.IsSystemMessage = True\nself.IsForward = True\nself.IsReliable = False", "result = super(ShutdownMessage, self).dump()\nresult['NodeList'] = self.NodeList\nreturn result" ]
<|body_start_0|> if minfo is None: minfo = {} super(ShutdownMessage, self).__init__(minfo) self.NodeList = minfo.get('NodeList', []) self.IsSystemMessage = True self.IsForward = True self.IsReliable = False <|end_body_0|> <|body_start_1|> result = sup...
Shutdown messages are sent to a peer node to initiate shutdown. Attributes: ShutdownMessage.MessageType (str): The class name of the message. NodeList (list): The list of nodes to shutdown. IsSystemMessage (bool): Whether or not this is a system message. System messages have special delivery priority rules. IsForward (...
ShutdownMessage
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShutdownMessage: """Shutdown messages are sent to a peer node to initiate shutdown. Attributes: ShutdownMessage.MessageType (str): The class name of the message. NodeList (list): The list of nodes to shutdown. IsSystemMessage (bool): Whether or not this is a system message. System messages have s...
stack_v2_sparse_classes_36k_train_012739
4,179
permissive
[ { "docstring": "Constructor for the ShutdownMessage class. Args: minfo (dict): Dictionary of values for message fields.", "name": "__init__", "signature": "def __init__(self, minfo=None)" }, { "docstring": "Dumps a dict containing object attributes. Returns: dict: A mapping of object attribute n...
2
stack_v2_sparse_classes_30k_train_010321
Implement the Python class `ShutdownMessage` described below. Class description: Shutdown messages are sent to a peer node to initiate shutdown. Attributes: ShutdownMessage.MessageType (str): The class name of the message. NodeList (list): The list of nodes to shutdown. IsSystemMessage (bool): Whether or not this is a...
Implement the Python class `ShutdownMessage` described below. Class description: Shutdown messages are sent to a peer node to initiate shutdown. Attributes: ShutdownMessage.MessageType (str): The class name of the message. NodeList (list): The list of nodes to shutdown. IsSystemMessage (bool): Whether or not this is a...
8f4ca1aab54ef420a0db10c8ca822ec8686cd423
<|skeleton|> class ShutdownMessage: """Shutdown messages are sent to a peer node to initiate shutdown. Attributes: ShutdownMessage.MessageType (str): The class name of the message. NodeList (list): The list of nodes to shutdown. IsSystemMessage (bool): Whether or not this is a system message. System messages have s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ShutdownMessage: """Shutdown messages are sent to a peer node to initiate shutdown. Attributes: ShutdownMessage.MessageType (str): The class name of the message. NodeList (list): The list of nodes to shutdown. IsSystemMessage (bool): Whether or not this is a system message. System messages have special delive...
the_stack_v2_python_sparse
validator/gossip/messages/shutdown_message.py
aludvik/sawtooth-core
train
0
015dcf019daa518cea756c0b30993eb52246411b
[ "if len(prices) < 2:\n return 0\ndp = [[[0 for _ in range(2)] for _ in range(k + 1)] for _ in range(len(prices))]\nfor i in range(1, k + 1):\n dp[0][i][0] = 0\n dp[0][i][1] = -prices[0]\nfor i in range(1, len(prices)):\n for j in range(1, k + 1):\n dp[i][j][0] = max(dp[i - 1][j][0], dp[i - 1][j][...
<|body_start_0|> if len(prices) < 2: return 0 dp = [[[0 for _ in range(2)] for _ in range(k + 1)] for _ in range(len(prices))] for i in range(1, k + 1): dp[0][i][0] = 0 dp[0][i][1] = -prices[0] for i in range(1, len(prices)): for j in range...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, k: int, prices: List[int]) -> int: """动态规划 方程为 dp[i][k][j] 0 <= i < len(prices) 表示天数 dp[i][k][0] 表示当前天未持股,有以下两种情况: 1. 昨天未持股今天也未持股 2. 昨天持股,今天卖出 dp[i][k][0] = max(dp[i - 1][k][0], dp[i - 1][k][1] + prices[i]) dp[i][k][1] 表示当前天持股,有以下两种情况: 1. 昨天持股,今天也持股 2. 昨天未持股...
stack_v2_sparse_classes_36k_train_012740
2,774
no_license
[ { "docstring": "动态规划 方程为 dp[i][k][j] 0 <= i < len(prices) 表示天数 dp[i][k][0] 表示当前天未持股,有以下两种情况: 1. 昨天未持股今天也未持股 2. 昨天持股,今天卖出 dp[i][k][0] = max(dp[i - 1][k][0], dp[i - 1][k][1] + prices[i]) dp[i][k][1] 表示当前天持股,有以下两种情况: 1. 昨天持股,今天也持股 2. 昨天未持股,今天买入 dp[i][k][1] = max(dp[i - 1][k][1], dp[i - 1][k - 1][0] - prices[i]) :p...
2
stack_v2_sparse_classes_30k_train_001502
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, k: int, prices: List[int]) -> int: 动态规划 方程为 dp[i][k][j] 0 <= i < len(prices) 表示天数 dp[i][k][0] 表示当前天未持股,有以下两种情况: 1. 昨天未持股今天也未持股 2. 昨天持股,今天卖出 dp[i][k][0] = max(...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, k: int, prices: List[int]) -> int: 动态规划 方程为 dp[i][k][j] 0 <= i < len(prices) 表示天数 dp[i][k][0] 表示当前天未持股,有以下两种情况: 1. 昨天未持股今天也未持股 2. 昨天持股,今天卖出 dp[i][k][0] = max(...
9acba92695c06406f12f997a720bfe1deb9464a8
<|skeleton|> class Solution: def maxProfit(self, k: int, prices: List[int]) -> int: """动态规划 方程为 dp[i][k][j] 0 <= i < len(prices) 表示天数 dp[i][k][0] 表示当前天未持股,有以下两种情况: 1. 昨天未持股今天也未持股 2. 昨天持股,今天卖出 dp[i][k][0] = max(dp[i - 1][k][0], dp[i - 1][k][1] + prices[i]) dp[i][k][1] 表示当前天持股,有以下两种情况: 1. 昨天持股,今天也持股 2. 昨天未持股...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit(self, k: int, prices: List[int]) -> int: """动态规划 方程为 dp[i][k][j] 0 <= i < len(prices) 表示天数 dp[i][k][0] 表示当前天未持股,有以下两种情况: 1. 昨天未持股今天也未持股 2. 昨天持股,今天卖出 dp[i][k][0] = max(dp[i - 1][k][0], dp[i - 1][k][1] + prices[i]) dp[i][k][1] 表示当前天持股,有以下两种情况: 1. 昨天持股,今天也持股 2. 昨天未持股,今天买入 dp[i][k]...
the_stack_v2_python_sparse
datastructure/dp_exercise/MaxProfit5.py
yinhuax/leet_code
train
0
75455841030bdbb9160abe2cfd88a463c92783b3
[ "ret = [1] * len(nums)\naccum = 1\nfor i, n in enumerate(nums):\n ret[i] *= accum\n accum *= n\naccum = 1\nfor i, n in enumerate(nums[-1::-1]):\n ret[len(nums) - 1 - i] *= accum\n accum *= n\nreturn ret", "if not nums:\n return []\nprefix = [1]\nfor i in range(len(nums)):\n prefix.append(prefix[...
<|body_start_0|> ret = [1] * len(nums) accum = 1 for i, n in enumerate(nums): ret[i] *= accum accum *= n accum = 1 for i, n in enumerate(nums[-1::-1]): ret[len(nums) - 1 - i] *= accum accum *= n return ret <|end_body_0|> <|...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def productExceptSelf(self, nums: List[int]) -> List[int]: """08/25/2019 19:56""" <|body_0|> def productExceptSelf(self, nums: List[int]) -> List[int]: """12/03/2021 20:57""" <|body_1|> <|end_skeleton|> <|body_start_0|> ret = [1] * len(num...
stack_v2_sparse_classes_36k_train_012741
2,089
no_license
[ { "docstring": "08/25/2019 19:56", "name": "productExceptSelf", "signature": "def productExceptSelf(self, nums: List[int]) -> List[int]" }, { "docstring": "12/03/2021 20:57", "name": "productExceptSelf", "signature": "def productExceptSelf(self, nums: List[int]) -> List[int]" } ]
2
stack_v2_sparse_classes_30k_train_009873
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def productExceptSelf(self, nums: List[int]) -> List[int]: 08/25/2019 19:56 - def productExceptSelf(self, nums: List[int]) -> List[int]: 12/03/2021 20:57
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def productExceptSelf(self, nums: List[int]) -> List[int]: 08/25/2019 19:56 - def productExceptSelf(self, nums: List[int]) -> List[int]: 12/03/2021 20:57 <|skeleton|> class Solu...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def productExceptSelf(self, nums: List[int]) -> List[int]: """08/25/2019 19:56""" <|body_0|> def productExceptSelf(self, nums: List[int]) -> List[int]: """12/03/2021 20:57""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def productExceptSelf(self, nums: List[int]) -> List[int]: """08/25/2019 19:56""" ret = [1] * len(nums) accum = 1 for i, n in enumerate(nums): ret[i] *= accum accum *= n accum = 1 for i, n in enumerate(nums[-1::-1]): ...
the_stack_v2_python_sparse
leetcode/solved/238_Product_of_Array_Except_Self/solution.py
sungminoh/algorithms
train
0
db0e904737fdef2468c5bd5147e13e427330e691
[ "if n < 0:\n return 0\nif n == 0:\n return 1\nsum = 0\nsum += self.climbStairsRecur(n - 1)\nsum += self.climbStairsRecur(n - 2)\nreturn sum", "memo = [0] * (n + 1)\nmemo[0] = 1\nmemo[1] = 1\nfor i in range(2, n + 1):\n j = 1\n while j <= 2 and j <= i:\n memo[i] += memo[i - j]\n j += 1\nr...
<|body_start_0|> if n < 0: return 0 if n == 0: return 1 sum = 0 sum += self.climbStairsRecur(n - 1) sum += self.climbStairsRecur(n - 2) return sum <|end_body_0|> <|body_start_1|> memo = [0] * (n + 1) memo[0] = 1 memo[1] = 1...
Stairs
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Stairs: def climbStairsRecur(self, n): """:type n: int :rtype: int""" <|body_0|> def climbStairs(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if n < 0: return 0 if n == 0: retu...
stack_v2_sparse_classes_36k_train_012742
618
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "climbStairsRecur", "signature": "def climbStairsRecur(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "climbStairs", "signature": "def climbStairs(self, n)" } ]
2
null
Implement the Python class `Stairs` described below. Class description: Implement the Stairs class. Method signatures and docstrings: - def climbStairsRecur(self, n): :type n: int :rtype: int - def climbStairs(self, n): :type n: int :rtype: int
Implement the Python class `Stairs` described below. Class description: Implement the Stairs class. Method signatures and docstrings: - def climbStairsRecur(self, n): :type n: int :rtype: int - def climbStairs(self, n): :type n: int :rtype: int <|skeleton|> class Stairs: def climbStairsRecur(self, n): "...
e7f486114df17918e49d6452c7047c9d90e8aef2
<|skeleton|> class Stairs: def climbStairsRecur(self, n): """:type n: int :rtype: int""" <|body_0|> def climbStairs(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Stairs: def climbStairsRecur(self, n): """:type n: int :rtype: int""" if n < 0: return 0 if n == 0: return 1 sum = 0 sum += self.climbStairsRecur(n - 1) sum += self.climbStairsRecur(n - 2) return sum def climbStairs(self, n):...
the_stack_v2_python_sparse
tranquil-beach/dp/stairs.py
yokolet/tranquil-beach-python
train
0
c481ad15d87ebb2a2781147cc29366163b036161
[ "self.absdatadir = os.path.abspath(datadir)\nvalid_datadir(self.absdatadir)\ntemp = create_unique_file(self.absdatadir)\nos.remove(temp)\nself.hostname = socket.gethostname()\nself.sequence_number = 0\nself.last_process_most_recent = most_recent_unique_file(self.absdatadir)\nif self.last_process_most_recent:\n s...
<|body_start_0|> self.absdatadir = os.path.abspath(datadir) valid_datadir(self.absdatadir) temp = create_unique_file(self.absdatadir) os.remove(temp) self.hostname = socket.gethostname() self.sequence_number = 0 self.last_process_most_recent = most_recent_unique_f...
BoardData holds state required to write records to a simple database. Records are stored one at a time and stored in individual files in a data directory. Records consist of any Python data structure that can be represented with JSON. The records are stored in a header structure which provides meta-information. Files i...
BoardData
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BoardData: """BoardData holds state required to write records to a simple database. Records are stored one at a time and stored in individual files in a data directory. Records consist of any Python data structure that can be represented with JSON. The records are stored in a header structure whi...
stack_v2_sparse_classes_36k_train_012743
19,539
permissive
[ { "docstring": "Initialize the BoardData instance using datadir as the directory to store data.", "name": "__init__", "signature": "def __init__(self, datadir)" }, { "docstring": "Stores payload conforming to schema.", "name": "Store", "signature": "def Store(self, payload, schema)" } ...
2
stack_v2_sparse_classes_30k_train_013483
Implement the Python class `BoardData` described below. Class description: BoardData holds state required to write records to a simple database. Records are stored one at a time and stored in individual files in a data directory. Records consist of any Python data structure that can be represented with JSON. The recor...
Implement the Python class `BoardData` described below. Class description: BoardData holds state required to write records to a simple database. Records are stored one at a time and stored in individual files in a data directory. Records consist of any Python data structure that can be represented with JSON. The recor...
9617691ac997f12085b688c3ecc6746e8510976d
<|skeleton|> class BoardData: """BoardData holds state required to write records to a simple database. Records are stored one at a time and stored in individual files in a data directory. Records consist of any Python data structure that can be represented with JSON. The records are stored in a header structure whi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BoardData: """BoardData holds state required to write records to a simple database. Records are stored one at a time and stored in individual files in a data directory. Records consist of any Python data structure that can be represented with JSON. The records are stored in a header structure which provides m...
the_stack_v2_python_sparse
hf/boardlib/boardlib.py
Thireus/hashfast-tools
train
0
81f363368eb9da41b4414fd7151288444367e500
[ "def dfs(i):\n if visited[i]:\n return 0\n visited[i] = True\n count = 1\n for j in range(len(M[i])):\n if M[i][j] == 1 and i != j:\n count += dfs(j)\n return count\ncount = 0\nvisited = [False] * len(M)\nfor i in range(len(M)):\n if dfs(i) > 0:\n count += 1\nreturn...
<|body_start_0|> def dfs(i): if visited[i]: return 0 visited[i] = True count = 1 for j in range(len(M[i])): if M[i][j] == 1 and i != j: count += dfs(j) return count count = 0 visited =...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findCircleNum(self, M): """:type M: List[List[int]] :rtype: int""" <|body_0|> def findCircleNum_unionfind(self, M): """:type M: List[List[int]] :rtype: int""" <|body_1|> def findCircleNum_wrong(self, M): """:type M: List[List[int]] ...
stack_v2_sparse_classes_36k_train_012744
24,866
no_license
[ { "docstring": ":type M: List[List[int]] :rtype: int", "name": "findCircleNum", "signature": "def findCircleNum(self, M)" }, { "docstring": ":type M: List[List[int]] :rtype: int", "name": "findCircleNum_unionfind", "signature": "def findCircleNum_unionfind(self, M)" }, { "docstri...
4
stack_v2_sparse_classes_30k_train_005058
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findCircleNum(self, M): :type M: List[List[int]] :rtype: int - def findCircleNum_unionfind(self, M): :type M: List[List[int]] :rtype: int - def findCircleNum_wrong(self, M): ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findCircleNum(self, M): :type M: List[List[int]] :rtype: int - def findCircleNum_unionfind(self, M): :type M: List[List[int]] :rtype: int - def findCircleNum_wrong(self, M): ...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def findCircleNum(self, M): """:type M: List[List[int]] :rtype: int""" <|body_0|> def findCircleNum_unionfind(self, M): """:type M: List[List[int]] :rtype: int""" <|body_1|> def findCircleNum_wrong(self, M): """:type M: List[List[int]] ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findCircleNum(self, M): """:type M: List[List[int]] :rtype: int""" def dfs(i): if visited[i]: return 0 visited[i] = True count = 1 for j in range(len(M[i])): if M[i][j] == 1 and i != j: ...
the_stack_v2_python_sparse
src/lt_547.py
oxhead/CodingYourWay
train
0
1e4aa5f9f632274a0d6750c981aaaa07fc9a2930
[ "if not nums:\n return 0\nmemo = [0] * (len(nums) + 1)\nmemo[1] = nums[0]\nfor i in range(1, len(nums)):\n memo[i + 1] = max(memo[i], memo[i - 1] + nums[i])\nreturn memo[-1]", "prevMax = 0\ncurrMax = 0\nfor i in nums:\n temp = currMax\n currMax = max(prevMax + i, currMax)\n prevMax = temp\nreturn c...
<|body_start_0|> if not nums: return 0 memo = [0] * (len(nums) + 1) memo[1] = nums[0] for i in range(1, len(nums)): memo[i + 1] = max(memo[i], memo[i - 1] + nums[i]) return memo[-1] <|end_body_0|> <|body_start_1|> prevMax = 0 currMax = 0 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rob(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def rob2(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not nums: return 0 memo = [0] * (len(...
stack_v2_sparse_classes_36k_train_012745
808
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "rob", "signature": "def rob(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "rob2", "signature": "def rob2(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rob(self, nums): :type nums: List[int] :rtype: int - def rob2(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 rob(self, nums): :type nums: List[int] :rtype: int - def rob2(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def rob(self, nums): "...
28219fbc5e2e96f59e9d2b9d1da18f05187898c8
<|skeleton|> class Solution: def rob(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def rob2(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rob(self, nums): """:type nums: List[int] :rtype: int""" if not nums: return 0 memo = [0] * (len(nums) + 1) memo[1] = nums[0] for i in range(1, len(nums)): memo[i + 1] = max(memo[i], memo[i - 1] + nums[i]) return memo[-1] ...
the_stack_v2_python_sparse
2019/go/198-house-robber.py
the-potato-man/lc
train
0
663058f58bcb7d19c05c3ee2b5f758bf6c919e72
[ "super(_SoilWateringPollWorker, self).__init__(scheduler, record_queue, mqtt_client, soil_moisture_sensor)\nself._drain_sensor = drain_sensor\nself._pump_manager = pump_manager", "time.sleep(SOIL_WATERING_POLL_DELAY)\nsoil_moisture = self._sensor.soil_moisture()\nwater_present = self._drain_sensor.water_present()...
<|body_start_0|> super(_SoilWateringPollWorker, self).__init__(scheduler, record_queue, mqtt_client, soil_moisture_sensor) self._drain_sensor = drain_sensor self._pump_manager = pump_manager <|end_body_0|> <|body_start_1|> time.sleep(SOIL_WATERING_POLL_DELAY) soil_moisture = sel...
Polls for and records watering event data. Polls soil moisture sensor and oversees a water pump based to add water when the moisture drops too low. Records both soil moisture and watering events.
_SoilWateringPollWorker
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _SoilWateringPollWorker: """Polls for and records watering event data. Polls soil moisture sensor and oversees a water pump based to add water when the moisture drops too low. Records both soil moisture and watering events.""" def __init__(self, scheduler, record_queue, mqtt_client, soil_moi...
stack_v2_sparse_classes_36k_train_012746
12,545
permissive
[ { "docstring": "Creates a new SoilWateringPoller object. Args: scheduler: Poll time scheduler. record_queue: Queue on which to place soil moisture records and watering event records for storage. soil_moisture_sensor: An interface for reading the soil moisture level. drain_sensor: An interface for reading the dr...
2
stack_v2_sparse_classes_30k_train_011440
Implement the Python class `_SoilWateringPollWorker` described below. Class description: Polls for and records watering event data. Polls soil moisture sensor and oversees a water pump based to add water when the moisture drops too low. Records both soil moisture and watering events. Method signatures and docstrings:...
Implement the Python class `_SoilWateringPollWorker` described below. Class description: Polls for and records watering event data. Polls soil moisture sensor and oversees a water pump based to add water when the moisture drops too low. Records both soil moisture and watering events. Method signatures and docstrings:...
3cfb27b3fc08692fe7d190f9c4b3cf82eb262edc
<|skeleton|> class _SoilWateringPollWorker: """Polls for and records watering event data. Polls soil moisture sensor and oversees a water pump based to add water when the moisture drops too low. Records both soil moisture and watering events.""" def __init__(self, scheduler, record_queue, mqtt_client, soil_moi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _SoilWateringPollWorker: """Polls for and records watering event data. Polls soil moisture sensor and oversees a water pump based to add water when the moisture drops too low. Records both soil moisture and watering events.""" def __init__(self, scheduler, record_queue, mqtt_client, soil_moisture_sensor,...
the_stack_v2_python_sparse
greenpithumb/poller.py
masterhui/GreenPiThumb
train
0
dcad7b62a01dbd960e6b9c3695f7816dd4e8aebe
[ "if self.request.version == 'v6':\n return QueueStatusSerializerV6\nelif self.request.version == 'v7':\n return QueueStatusSerializerV6", "queue_statuses = Queue.objects.get_queue_status()\npage = self.paginate_queryset(queue_statuses)\nserializer = self.get_serializer(page, many=True)\nreturn self.get_pagi...
<|body_start_0|> if self.request.version == 'v6': return QueueStatusSerializerV6 elif self.request.version == 'v7': return QueueStatusSerializerV6 <|end_body_0|> <|body_start_1|> queue_statuses = Queue.objects.get_queue_status() page = self.paginate_queryset(queu...
This view is the endpoint for retrieving the queue status.
QueueStatusView
[ "LicenseRef-scancode-free-unknown", "Apache-2.0", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QueueStatusView: """This view is the endpoint for retrieving the queue status.""" def get_serializer_class(self): """Returns the appropriate serializer based off the requests version of the REST API.""" <|body_0|> def list(self, request): """Retrieves the current...
stack_v2_sparse_classes_36k_train_012747
2,758
permissive
[ { "docstring": "Returns the appropriate serializer based off the requests version of the REST API.", "name": "get_serializer_class", "signature": "def get_serializer_class(self)" }, { "docstring": "Retrieves the current status of the queue and returns it in JSON form :param request: the HTTP GET...
2
null
Implement the Python class `QueueStatusView` described below. Class description: This view is the endpoint for retrieving the queue status. Method signatures and docstrings: - def get_serializer_class(self): Returns the appropriate serializer based off the requests version of the REST API. - def list(self, request): ...
Implement the Python class `QueueStatusView` described below. Class description: This view is the endpoint for retrieving the queue status. Method signatures and docstrings: - def get_serializer_class(self): Returns the appropriate serializer based off the requests version of the REST API. - def list(self, request): ...
28618aee07ceed9e4a6eb7b8d0e6f05b31d8fd6b
<|skeleton|> class QueueStatusView: """This view is the endpoint for retrieving the queue status.""" def get_serializer_class(self): """Returns the appropriate serializer based off the requests version of the REST API.""" <|body_0|> def list(self, request): """Retrieves the current...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QueueStatusView: """This view is the endpoint for retrieving the queue status.""" def get_serializer_class(self): """Returns the appropriate serializer based off the requests version of the REST API.""" if self.request.version == 'v6': return QueueStatusSerializerV6 el...
the_stack_v2_python_sparse
scale/queue/views.py
kfconsultant/scale
train
0
7366fb7bb893ff649f7d292e9a5a7b51cec0985d
[ "self.structures = proteins\nself.reference_ligand = reference_ligand\nself.ligand_radius = ligand_radius\nself.ensemble_name = ensemble_name", "binding_sites = []\nfor i, s in enumerate(self.structures):\n s.detect_ligand_bonds()\n sbinding_site = Protein.BindingSiteFromMolecule(s, self.reference_ligand)\n...
<|body_start_0|> self.structures = proteins self.reference_ligand = reference_ligand self.ligand_radius = ligand_radius self.ensemble_name = ensemble_name <|end_body_0|> <|body_start_1|> binding_sites = [] for i, s in enumerate(self.structures): s.detect_liga...
Experimental class. Please do not use. Given a list of protein structures for the same target, will output an estimate of the quality of structures and ligands within the ensemble.
EnsembleQC
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EnsembleQC: """Experimental class. Please do not use. Given a list of protein structures for the same target, will output an estimate of the quality of structures and ligands within the ensemble.""" def __init__(self, proteins, reference_ligand, ligand_radius=6.0, ensemble_name=None): ...
stack_v2_sparse_classes_36k_train_012748
22,715
permissive
[ { "docstring": ":param proteins: list of ccdc.protein.Protein objects :param reference_ligand: ccdc.molecule.Molecule: a bound ligand (with appropriate 3D coordinates) to be used to define the binding site of interest :param ligand_radius: the radius around the bound ligand used to define binding site residues....
5
stack_v2_sparse_classes_30k_train_011222
Implement the Python class `EnsembleQC` described below. Class description: Experimental class. Please do not use. Given a list of protein structures for the same target, will output an estimate of the quality of structures and ligands within the ensemble. Method signatures and docstrings: - def __init__(self, protei...
Implement the Python class `EnsembleQC` described below. Class description: Experimental class. Please do not use. Given a list of protein structures for the same target, will output an estimate of the quality of structures and ligands within the ensemble. Method signatures and docstrings: - def __init__(self, protei...
a6dbd7f650d28a867594ca48597f7e1b3a131168
<|skeleton|> class EnsembleQC: """Experimental class. Please do not use. Given a list of protein structures for the same target, will output an estimate of the quality of structures and ligands within the ensemble.""" def __init__(self, proteins, reference_ligand, ligand_radius=6.0, ensemble_name=None): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EnsembleQC: """Experimental class. Please do not use. Given a list of protein structures for the same target, will output an estimate of the quality of structures and ligands within the ensemble.""" def __init__(self, proteins, reference_ligand, ligand_radius=6.0, ensemble_name=None): """:param p...
the_stack_v2_python_sparse
hotspots/hs_ensembles.py
shiyx409/hotspots
train
0
b92683a12163d0187bfaff6a88eadd8b02cecf3a
[ "if fs is None:\n self.ObjectType = 0\n self.Element = 0\n self.OffsetToValue = vtOffset\nelse:\n self.PopulateFromFileStream(fs, vtOffset)\nerrorMessage = 'Reserved2 not fully supported'\nif STRICT is True:\n raise Exception(errorMessage)", "if fs is None:\n raise Exception('Invalid File stream...
<|body_start_0|> if fs is None: self.ObjectType = 0 self.Element = 0 self.OffsetToValue = vtOffset else: self.PopulateFromFileStream(fs, vtOffset) errorMessage = 'Reserved2 not fully supported' if STRICT is True: raise Exception...
Class for managing Reserved2 structures. For testing non-firmware, legacy policies Implementation can do basic parsing of rules but not values For test purposes only
Reserved2
[ "BSD-2-Clause-Patent" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Reserved2: """Class for managing Reserved2 structures. For testing non-firmware, legacy policies Implementation can do basic parsing of rules but not values For test purposes only""" def __init__(self, fs: BinaryIO=None, vtOffset: int=0): """Initializes the Reserved2 structure. Args:...
stack_v2_sparse_classes_36k_train_012749
33,094
permissive
[ { "docstring": "Initializes the Reserved2 structure. Args: fs (:obj:`BinaryIO`, optional): initialize with a filestream vtOffset (:obj:`int`, optional): used if populating from a filestream", "name": "__init__", "signature": "def __init__(self, fs: BinaryIO=None, vtOffset: int=0)" }, { "docstrin...
4
stack_v2_sparse_classes_30k_train_010337
Implement the Python class `Reserved2` described below. Class description: Class for managing Reserved2 structures. For testing non-firmware, legacy policies Implementation can do basic parsing of rules but not values For test purposes only Method signatures and docstrings: - def __init__(self, fs: BinaryIO=None, vtO...
Implement the Python class `Reserved2` described below. Class description: Class for managing Reserved2 structures. For testing non-firmware, legacy policies Implementation can do basic parsing of rules but not values For test purposes only Method signatures and docstrings: - def __init__(self, fs: BinaryIO=None, vtO...
78295929b37af62a8cfc4c28eab72ed0c468f350
<|skeleton|> class Reserved2: """Class for managing Reserved2 structures. For testing non-firmware, legacy policies Implementation can do basic parsing of rules but not values For test purposes only""" def __init__(self, fs: BinaryIO=None, vtOffset: int=0): """Initializes the Reserved2 structure. Args:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Reserved2: """Class for managing Reserved2 structures. For testing non-firmware, legacy policies Implementation can do basic parsing of rules but not values For test purposes only""" def __init__(self, fs: BinaryIO=None, vtOffset: int=0): """Initializes the Reserved2 structure. Args: fs (:obj:`Bi...
the_stack_v2_python_sparse
edk2toollib/windows/policy/firmware_policy.py
tianocore/edk2-pytool-library
train
47
00aebdf3dfd86c7ea7580ca6118a1db55fb135ab
[ "self.A, self.w, self.p, self.c = 4 * [-1.0]\nself._func = lambda t, A, w, p, c: A * np.sin(w * t + p) + c\nself._fit_func = lambda t: self.A * np.sin(self.w * t + self.p) + self.c\nself.random_state = random_state\nself.opt_initial_guess = opt_initial_guess\nself._fitted = False", "if self.opt_initial_guess:\n ...
<|body_start_0|> self.A, self.w, self.p, self.c = 4 * [-1.0] self._func = lambda t, A, w, p, c: A * np.sin(w * t + p) + c self._fit_func = lambda t: self.A * np.sin(self.w * t + self.p) + self.c self.random_state = random_state self.opt_initial_guess = opt_initial_guess s...
Sine forecasting model. The sine model is in the form by y(t) = A * sin(w * t + p) + c, where `A`, `w`, `p` and `c` are parameters to be optimized from the fitted data.
TSSine
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TSSine: """Sine forecasting model. The sine model is in the form by y(t) = A * sin(w * t + p) + c, where `A`, `w`, `p` and `c` are parameters to be optimized from the fitted data.""" def __init__(self, random_state: t.Optional[int]=None, opt_initial_guess: bool=True): """Init the sin...
stack_v2_sparse_classes_36k_train_012750
12,299
permissive
[ { "docstring": "Init the sine forecasting model. Parameters ---------- random_state : int, optional Random seed, to keep the optimization process deterministic. opt_initial_guess : bool, optional (default=True) If True, make an informed choice of the initial parameters before the optimization process.", "na...
4
stack_v2_sparse_classes_30k_train_003407
Implement the Python class `TSSine` described below. Class description: Sine forecasting model. The sine model is in the form by y(t) = A * sin(w * t + p) + c, where `A`, `w`, `p` and `c` are parameters to be optimized from the fitted data. Method signatures and docstrings: - def __init__(self, random_state: t.Option...
Implement the Python class `TSSine` described below. Class description: Sine forecasting model. The sine model is in the form by y(t) = A * sin(w * t + p) + c, where `A`, `w`, `p` and `c` are parameters to be optimized from the fitted data. Method signatures and docstrings: - def __init__(self, random_state: t.Option...
61cc1f63fa055c7466151cfefa7baff8df1702b7
<|skeleton|> class TSSine: """Sine forecasting model. The sine model is in the form by y(t) = A * sin(w * t + p) + c, where `A`, `w`, `p` and `c` are parameters to be optimized from the fitted data.""" def __init__(self, random_state: t.Optional[int]=None, opt_initial_guess: bool=True): """Init the sin...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TSSine: """Sine forecasting model. The sine model is in the form by y(t) = A * sin(w * t + p) + c, where `A`, `w`, `p` and `c` are parameters to be optimized from the fitted data.""" def __init__(self, random_state: t.Optional[int]=None, opt_initial_guess: bool=True): """Init the sine forecasting...
the_stack_v2_python_sparse
tspymfe/_models.py
FelSiq/ts-pymfe
train
9
461a3e101962bf0a72ae45eb440c488237e1b07e
[ "if not matrix:\n self.matrix = []\n return\nn = len(matrix)\nm = len(matrix[0])\nfor i in range(n):\n for j in range(m):\n if i == 0 and j == 0:\n continue\n elif i == 0:\n matrix[i][j] += matrix[i][j - 1]\n elif j == 0:\n matrix[i][j] += matrix[i - 1]...
<|body_start_0|> if not matrix: self.matrix = [] return n = len(matrix) m = len(matrix[0]) for i in range(n): for j in range(m): if i == 0 and j == 0: continue elif i == 0: matrix[...
NumMatrix
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumMatrix: def __init__(self, matrix): """initialize your data structure here. :type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """sum of elements matrix[(row1,col1)..(row2,col2)], inclusive. :type row1: int :type col1: int :ty...
stack_v2_sparse_classes_36k_train_012751
1,688
no_license
[ { "docstring": "initialize your data structure here. :type matrix: List[List[int]]", "name": "__init__", "signature": "def __init__(self, matrix)" }, { "docstring": "sum of elements matrix[(row1,col1)..(row2,col2)], inclusive. :type row1: int :type col1: int :type row2: int :type col2: int :rtyp...
2
stack_v2_sparse_classes_30k_train_016349
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): initialize your data structure here. :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): sum of elements matrix[(row1,col1)...
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): initialize your data structure here. :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): sum of elements matrix[(row1,col1)...
b6328e726c8d986d6b85e2d41c7e678e29dc1153
<|skeleton|> class NumMatrix: def __init__(self, matrix): """initialize your data structure here. :type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """sum of elements matrix[(row1,col1)..(row2,col2)], inclusive. :type row1: int :type col1: int :ty...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NumMatrix: def __init__(self, matrix): """initialize your data structure here. :type matrix: List[List[int]]""" if not matrix: self.matrix = [] return n = len(matrix) m = len(matrix[0]) for i in range(n): for j in range(m): ...
the_stack_v2_python_sparse
Range Sum Query 2D - Immutable.py
dragonlee8/leetcode
train
0
79855f7a675baf76e5c312e40149a428df882736
[ "self.multi_stage_restore_options = multi_stage_restore_options\nself.sync_size_bytes = sync_size_bytes\nself.sync_time_usecs = sync_time_usecs", "if dictionary is None:\n return None\nmulti_stage_restore_options = cohesity_management_sdk.models.update_restore_task_options.UpdateRestoreTaskOptions.from_diction...
<|body_start_0|> self.multi_stage_restore_options = multi_stage_restore_options self.sync_size_bytes = sync_size_bytes self.sync_time_usecs = sync_time_usecs <|end_body_0|> <|body_start_1|> if dictionary is None: return None multi_stage_restore_options = cohesity_man...
Implementation of the 'MultiStageRestoreTaskStateProto' model. TODO: type description here. Attributes: multi_stage_restore_options (UpdateRestoreTaskOptions): Captures the options(parameters) corresponding to the multi-stage restore task. sync_size_bytes (long|int): Captures the size of the data being synced to the ta...
MultiStageRestoreTaskStateProto
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiStageRestoreTaskStateProto: """Implementation of the 'MultiStageRestoreTaskStateProto' model. TODO: type description here. Attributes: multi_stage_restore_options (UpdateRestoreTaskOptions): Captures the options(parameters) corresponding to the multi-stage restore task. sync_size_bytes (long...
stack_v2_sparse_classes_36k_train_012752
2,858
permissive
[ { "docstring": "Constructor for the MultiStageRestoreTaskStateProto class", "name": "__init__", "signature": "def __init__(self, multi_stage_restore_options=None, sync_size_bytes=None, sync_time_usecs=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary ...
2
null
Implement the Python class `MultiStageRestoreTaskStateProto` described below. Class description: Implementation of the 'MultiStageRestoreTaskStateProto' model. TODO: type description here. Attributes: multi_stage_restore_options (UpdateRestoreTaskOptions): Captures the options(parameters) corresponding to the multi-st...
Implement the Python class `MultiStageRestoreTaskStateProto` described below. Class description: Implementation of the 'MultiStageRestoreTaskStateProto' model. TODO: type description here. Attributes: multi_stage_restore_options (UpdateRestoreTaskOptions): Captures the options(parameters) corresponding to the multi-st...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class MultiStageRestoreTaskStateProto: """Implementation of the 'MultiStageRestoreTaskStateProto' model. TODO: type description here. Attributes: multi_stage_restore_options (UpdateRestoreTaskOptions): Captures the options(parameters) corresponding to the multi-stage restore task. sync_size_bytes (long...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiStageRestoreTaskStateProto: """Implementation of the 'MultiStageRestoreTaskStateProto' model. TODO: type description here. Attributes: multi_stage_restore_options (UpdateRestoreTaskOptions): Captures the options(parameters) corresponding to the multi-stage restore task. sync_size_bytes (long|int): Captur...
the_stack_v2_python_sparse
cohesity_management_sdk/models/multi_stage_restore_task_state_proto.py
cohesity/management-sdk-python
train
24
aac6252addba670c62f15a789416785e19be7ce9
[ "super(MeshUnpooling, self).__init__()\nself.cached = cached\nself.matrix = matrix\nself.face = face", "if self.matrix is None or not self.cached:\n self.face, self.matrix = subdivide(x.pos, x.face)[1:]\n self.matrix.requires_grad = False\nx.pos = torch.matmul(self.matrix, x.pos)\nx.norm = torch.matmul(self...
<|body_start_0|> super(MeshUnpooling, self).__init__() self.cached = cached self.matrix = matrix self.face = face <|end_body_0|> <|body_start_1|> if self.matrix is None or not self.cached: self.face, self.matrix = subdivide(x.pos, x.face)[1:] self.matrix....
A class representing a mesh unpooling layer. Attributes ---------- cached : bool if True caches the pooling data, otherwise computes it at every input matrix : Tensor the pooling matrix face : LongTensor the topology tensor Methods ------- forward(x, *args) unpools the input data
MeshUnpooling
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MeshUnpooling: """A class representing a mesh unpooling layer. Attributes ---------- cached : bool if True caches the pooling data, otherwise computes it at every input matrix : Tensor the pooling matrix face : LongTensor the topology tensor Methods ------- forward(x, *args) unpools the input dat...
stack_v2_sparse_classes_36k_train_012753
1,789
permissive
[ { "docstring": "Parameters ---------- matrix : Tensor (optional) the unpool matrix (default is None) face : LongTensor (optional) the topology tensor (default is None) cached : bool (optional) if True caches the unpooling data, otherwise computes it at every input (default is True)", "name": "__init__", ...
2
null
Implement the Python class `MeshUnpooling` described below. Class description: A class representing a mesh unpooling layer. Attributes ---------- cached : bool if True caches the pooling data, otherwise computes it at every input matrix : Tensor the pooling matrix face : LongTensor the topology tensor Methods ------- ...
Implement the Python class `MeshUnpooling` described below. Class description: A class representing a mesh unpooling layer. Attributes ---------- cached : bool if True caches the pooling data, otherwise computes it at every input matrix : Tensor the pooling matrix face : LongTensor the topology tensor Methods ------- ...
2615b66dd4addfd5c03d9d91a24c7da414294308
<|skeleton|> class MeshUnpooling: """A class representing a mesh unpooling layer. Attributes ---------- cached : bool if True caches the pooling data, otherwise computes it at every input matrix : Tensor the pooling matrix face : LongTensor the topology tensor Methods ------- forward(x, *args) unpools the input dat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MeshUnpooling: """A class representing a mesh unpooling layer. Attributes ---------- cached : bool if True caches the pooling data, otherwise computes it at every input matrix : Tensor the pooling matrix face : LongTensor the topology tensor Methods ------- forward(x, *args) unpools the input data""" def...
the_stack_v2_python_sparse
ACME/layer/MeshUnpooling.py
mauriziokovacic/ACME
train
3
f8ae240497f8b672335581c378632cd63f513426
[ "allnode = []\nself.findAllNode(root, allnode)\nerror1 = allnode[0]\nfor i in range(len(allnode) - 1):\n if allnode[i].val > allnode[i + 1].val:\n error1 = allnode[i]\n break\nerror2 = allnode[len(allnode) - 1]\nfor i in range(len(allnode) - 1, 0, -1):\n if allnode[i].val < allnode[i - 1].val:\n...
<|body_start_0|> allnode = [] self.findAllNode(root, allnode) error1 = allnode[0] for i in range(len(allnode) - 1): if allnode[i].val > allnode[i + 1].val: error1 = allnode[i] break error2 = allnode[len(allnode) - 1] for i in ra...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def recoverTree(self, root): """:type root: TreeNode :rtype: void Do not return anything, modify root in-place instead.""" <|body_0|> def findAllNode(self, root, res): """找错误点 :param root: :param res: :return:""" <|body_1|> <|end_skeleton|> <|body...
stack_v2_sparse_classes_36k_train_012754
1,513
no_license
[ { "docstring": ":type root: TreeNode :rtype: void Do not return anything, modify root in-place instead.", "name": "recoverTree", "signature": "def recoverTree(self, root)" }, { "docstring": "找错误点 :param root: :param res: :return:", "name": "findAllNode", "signature": "def findAllNode(sel...
2
stack_v2_sparse_classes_30k_train_016645
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def recoverTree(self, root): :type root: TreeNode :rtype: void Do not return anything, modify root in-place instead. - def findAllNode(self, root, res): 找错误点 :param root: :param ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def recoverTree(self, root): :type root: TreeNode :rtype: void Do not return anything, modify root in-place instead. - def findAllNode(self, root, res): 找错误点 :param root: :param ...
beabfd31379f44ffd767fc676912db5022495b53
<|skeleton|> class Solution: def recoverTree(self, root): """:type root: TreeNode :rtype: void Do not return anything, modify root in-place instead.""" <|body_0|> def findAllNode(self, root, res): """找错误点 :param root: :param res: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def recoverTree(self, root): """:type root: TreeNode :rtype: void Do not return anything, modify root in-place instead.""" allnode = [] self.findAllNode(root, allnode) error1 = allnode[0] for i in range(len(allnode) - 1): if allnode[i].val > allnod...
the_stack_v2_python_sparse
leetCode/tree/099recoverTree.py
fatezy/Algorithm
train
1
236a368e7134bd6b4bbe643076ef60f205b6ac36
[ "self.instance = instance\nsuper(AbstractModelInstanceUpdateForm, self).__init__(*args, instance=instance, **kwargs)\nself._set_save_fields(*args)\nsave_fields_dict = dict(zip(self.save_fields, [True] * len(self.save_fields)))\nif args or kwargs:\n for name, field in self.fields.items():\n if name not in ...
<|body_start_0|> self.instance = instance super(AbstractModelInstanceUpdateForm, self).__init__(*args, instance=instance, **kwargs) self._set_save_fields(*args) save_fields_dict = dict(zip(self.save_fields, [True] * len(self.save_fields))) if args or kwargs: for name,...
An abstract class for manipulating Model instances Since this is an abstract class, it is meant to be extended Features: All fields that aren't passed in request.POST or request.FILES are optional (required=False) Only limited fields are saved This is limited-update mechanism is useful for API endpoints that only updat...
AbstractModelInstanceUpdateForm
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AbstractModelInstanceUpdateForm: """An abstract class for manipulating Model instances Since this is an abstract class, it is meant to be extended Features: All fields that aren't passed in request.POST or request.FILES are optional (required=False) Only limited fields are saved This is limited-u...
stack_v2_sparse_classes_36k_train_012755
3,013
permissive
[ { "docstring": "Overrides forms.ModelForm.__init__() Unlike forms.ModelForm, instance is required", "name": "__init__", "signature": "def __init__(self, instance, *args, **kwargs)" }, { "docstring": "Determine the subset of fields that we want to save Called by self.__init__()", "name": "_se...
3
stack_v2_sparse_classes_30k_train_008924
Implement the Python class `AbstractModelInstanceUpdateForm` described below. Class description: An abstract class for manipulating Model instances Since this is an abstract class, it is meant to be extended Features: All fields that aren't passed in request.POST or request.FILES are optional (required=False) Only lim...
Implement the Python class `AbstractModelInstanceUpdateForm` described below. Class description: An abstract class for manipulating Model instances Since this is an abstract class, it is meant to be extended Features: All fields that aren't passed in request.POST or request.FILES are optional (required=False) Only lim...
fcb39285be552629a09aa3bee03d08da4016809b
<|skeleton|> class AbstractModelInstanceUpdateForm: """An abstract class for manipulating Model instances Since this is an abstract class, it is meant to be extended Features: All fields that aren't passed in request.POST or request.FILES are optional (required=False) Only limited fields are saved This is limited-u...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AbstractModelInstanceUpdateForm: """An abstract class for manipulating Model instances Since this is an abstract class, it is meant to be extended Features: All fields that aren't passed in request.POST or request.FILES are optional (required=False) Only limited fields are saved This is limited-update mechani...
the_stack_v2_python_sparse
forms/classes.py
davidvtran/django-htk
train
0
512f7c1dc3816cce5fab4b977b2ca1a6cefde202
[ "_ = language\nlanguage = 'th'\ntry:\n from thai_segmenter import tokenize as thai_tokenize\n self._thai_tokenize = thai_tokenize\nexcept ImportError:\n raise ImportError('Please install Thai tokenizer with: pip install thai-segmenter')\nself._thai_tokenize('')\nsuper(ThaiTokenizer, self).__init__(language...
<|body_start_0|> _ = language language = 'th' try: from thai_segmenter import tokenize as thai_tokenize self._thai_tokenize = thai_tokenize except ImportError: raise ImportError('Please install Thai tokenizer with: pip install thai-segmenter') ...
ThaiTokenizer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ThaiTokenizer: def __init__(self, language='th', glossaries=None): """Initializes.""" <|body_0|> def tokenize(self, text, return_str=False): """Tokenize a text.""" <|body_1|> def detokenize(self, words, return_str=True): """Recovers the result of...
stack_v2_sparse_classes_36k_train_012756
1,913
permissive
[ { "docstring": "Initializes.", "name": "__init__", "signature": "def __init__(self, language='th', glossaries=None)" }, { "docstring": "Tokenize a text.", "name": "tokenize", "signature": "def tokenize(self, text, return_str=False)" }, { "docstring": "Recovers the result of `toke...
3
null
Implement the Python class `ThaiTokenizer` described below. Class description: Implement the ThaiTokenizer class. Method signatures and docstrings: - def __init__(self, language='th', glossaries=None): Initializes. - def tokenize(self, text, return_str=False): Tokenize a text. - def detokenize(self, words, return_str...
Implement the Python class `ThaiTokenizer` described below. Class description: Implement the ThaiTokenizer class. Method signatures and docstrings: - def __init__(self, language='th', glossaries=None): Initializes. - def tokenize(self, text, return_str=False): Tokenize a text. - def detokenize(self, words, return_str...
06613a99305f02312a0e64ee3c3c50e7b00dcf0e
<|skeleton|> class ThaiTokenizer: def __init__(self, language='th', glossaries=None): """Initializes.""" <|body_0|> def tokenize(self, text, return_str=False): """Tokenize a text.""" <|body_1|> def detokenize(self, words, return_str=True): """Recovers the result of...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ThaiTokenizer: def __init__(self, language='th', glossaries=None): """Initializes.""" _ = language language = 'th' try: from thai_segmenter import tokenize as thai_tokenize self._thai_tokenize = thai_tokenize except ImportError: raise...
the_stack_v2_python_sparse
neurst/neurst/data/text/thai_tokenizer.py
ohlionel/Prune-Tune
train
12
7e603bc83e2f4a647876b23b6d570edec12ec6f4
[ "self.model = model\nself.file_manager = file_manager\nself.signatures = signatures\nself.options = options", "export_dir = self.file_manager.next_name()\ntf.saved_model.save(self.model, export_dir, self.signatures, self.options)\nself.file_manager.clean_up()" ]
<|body_start_0|> self.model = model self.file_manager = file_manager self.signatures = signatures self.options = options <|end_body_0|> <|body_start_1|> export_dir = self.file_manager.next_name() tf.saved_model.save(self.model, export_dir, self.signatures, self.options) ...
Action that exports the given model as a SavedModel.
ExportSavedModel
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExportSavedModel: """Action that exports the given model as a SavedModel.""" def __init__(self, model: tf.Module, file_manager: ExportFileManager, signatures, options: Optional[tf.saved_model.SaveOptions]=None): """Initializes the instance. Args: model: The model to export. file_mana...
stack_v2_sparse_classes_36k_train_012757
5,540
permissive
[ { "docstring": "Initializes the instance. Args: model: The model to export. file_manager: An instance of `ExportFileManager` (or a subclass), that provides file naming and cleanup functionality. signatures: The signatures to forward to `tf.saved_model.save()`. options: Optional options to forward to `tf.saved_m...
2
stack_v2_sparse_classes_30k_train_014786
Implement the Python class `ExportSavedModel` described below. Class description: Action that exports the given model as a SavedModel. Method signatures and docstrings: - def __init__(self, model: tf.Module, file_manager: ExportFileManager, signatures, options: Optional[tf.saved_model.SaveOptions]=None): Initializes ...
Implement the Python class `ExportSavedModel` described below. Class description: Action that exports the given model as a SavedModel. Method signatures and docstrings: - def __init__(self, model: tf.Module, file_manager: ExportFileManager, signatures, options: Optional[tf.saved_model.SaveOptions]=None): Initializes ...
d3507b550a3ade40cade60a79eb5b8978b56c7ae
<|skeleton|> class ExportSavedModel: """Action that exports the given model as a SavedModel.""" def __init__(self, model: tf.Module, file_manager: ExportFileManager, signatures, options: Optional[tf.saved_model.SaveOptions]=None): """Initializes the instance. Args: model: The model to export. file_mana...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExportSavedModel: """Action that exports the given model as a SavedModel.""" def __init__(self, model: tf.Module, file_manager: ExportFileManager, signatures, options: Optional[tf.saved_model.SaveOptions]=None): """Initializes the instance. Args: model: The model to export. file_manager: An insta...
the_stack_v2_python_sparse
orbit/actions/export_saved_model.py
jianzhnie/models
train
2
2e18b9c369764b6268f7adadde215a45fcc4ab1a
[ "close_time = deserialize_timestamp_from_date(date=csv_row['transactTime'], formatstr=timestamp_format, location='Bitmex Wallet History Import')\nrealised_pnl = AssetAmount(satoshis_to_btc(deserialize_asset_amount(csv_row['amount'])))\nfee = deserialize_fee(csv_row['fee']) if csv_row['fee'] != 'null' else Fee(ZERO)...
<|body_start_0|> close_time = deserialize_timestamp_from_date(date=csv_row['transactTime'], formatstr=timestamp_format, location='Bitmex Wallet History Import') realised_pnl = AssetAmount(satoshis_to_btc(deserialize_asset_amount(csv_row['amount']))) fee = deserialize_fee(csv_row['fee']) if csv_r...
BitMEXImporter
[ "AGPL-3.0-only", "AGPL-3.0-or-later", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BitMEXImporter: def _consume_realised_pnl(csv_row: dict[str, Any], timestamp_format: str='%m/%d/%Y, %H:%M:%S %p') -> MarginPosition: """Use entries resulting from Realised PnL to generate a MarginPosition object. May raise: - KeyError - DeserializationError""" <|body_0|> def...
stack_v2_sparse_classes_36k_train_012758
5,939
permissive
[ { "docstring": "Use entries resulting from Realised PnL to generate a MarginPosition object. May raise: - KeyError - DeserializationError", "name": "_consume_realised_pnl", "signature": "def _consume_realised_pnl(csv_row: dict[str, Any], timestamp_format: str='%m/%d/%Y, %H:%M:%S %p') -> MarginPosition" ...
3
null
Implement the Python class `BitMEXImporter` described below. Class description: Implement the BitMEXImporter class. Method signatures and docstrings: - def _consume_realised_pnl(csv_row: dict[str, Any], timestamp_format: str='%m/%d/%Y, %H:%M:%S %p') -> MarginPosition: Use entries resulting from Realised PnL to genera...
Implement the Python class `BitMEXImporter` described below. Class description: Implement the BitMEXImporter class. Method signatures and docstrings: - def _consume_realised_pnl(csv_row: dict[str, Any], timestamp_format: str='%m/%d/%Y, %H:%M:%S %p') -> MarginPosition: Use entries resulting from Realised PnL to genera...
496948458b89afc41458f19d1cba0e971ab67c8b
<|skeleton|> class BitMEXImporter: def _consume_realised_pnl(csv_row: dict[str, Any], timestamp_format: str='%m/%d/%Y, %H:%M:%S %p') -> MarginPosition: """Use entries resulting from Realised PnL to generate a MarginPosition object. May raise: - KeyError - DeserializationError""" <|body_0|> def...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BitMEXImporter: def _consume_realised_pnl(csv_row: dict[str, Any], timestamp_format: str='%m/%d/%Y, %H:%M:%S %p') -> MarginPosition: """Use entries resulting from Realised PnL to generate a MarginPosition object. May raise: - KeyError - DeserializationError""" close_time = deserialize_timestam...
the_stack_v2_python_sparse
rotkehlchen/data_import/importers/bitmex.py
LefterisJP/rotkehlchen
train
0
00463ef5bf7a318bfe7bcf4ddaf69cb8dac74afb
[ "if SuperUserPermission().can():\n registry_size = get_registry_size()\n if registry_size is not None:\n return {'size_bytes': registry_size.size_bytes, 'last_ran': registry_size.completed_ms, 'queued': registry_size.queued, 'running': registry_size.running}\n else:\n return {'size_bytes': 0,...
<|body_start_0|> if SuperUserPermission().can(): registry_size = get_registry_size() if registry_size is not None: return {'size_bytes': registry_size.size_bytes, 'last_ran': registry_size.completed_ms, 'queued': registry_size.queued, 'running': registry_size.running} ...
Resource for the current registry size.
SuperUserRegistrySize
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SuperUserRegistrySize: """Resource for the current registry size.""" def get(self): """Returns size of the registry""" <|body_0|> def post(self): """Queues registry size calculation""" <|body_1|> <|end_skeleton|> <|body_start_0|> if SuperUserPer...
stack_v2_sparse_classes_36k_train_012759
40,556
permissive
[ { "docstring": "Returns size of the registry", "name": "get", "signature": "def get(self)" }, { "docstring": "Queues registry size calculation", "name": "post", "signature": "def post(self)" } ]
2
null
Implement the Python class `SuperUserRegistrySize` described below. Class description: Resource for the current registry size. Method signatures and docstrings: - def get(self): Returns size of the registry - def post(self): Queues registry size calculation
Implement the Python class `SuperUserRegistrySize` described below. Class description: Resource for the current registry size. Method signatures and docstrings: - def get(self): Returns size of the registry - def post(self): Queues registry size calculation <|skeleton|> class SuperUserRegistrySize: """Resource f...
e400a0c22c5f89dd35d571654b13d262b1f6e3b3
<|skeleton|> class SuperUserRegistrySize: """Resource for the current registry size.""" def get(self): """Returns size of the registry""" <|body_0|> def post(self): """Queues registry size calculation""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SuperUserRegistrySize: """Resource for the current registry size.""" def get(self): """Returns size of the registry""" if SuperUserPermission().can(): registry_size = get_registry_size() if registry_size is not None: return {'size_bytes': registry_s...
the_stack_v2_python_sparse
endpoints/api/superuser.py
quay/quay
train
2,363
91397f7ddc1e148835a57ddbc130e7cb8464f66f
[ "self.instance = instance\nself.schema = None\nif self.instance:\n self.schema = SurveySchema(self.instance.survey)", "for name, field in self.fields.items():\n yield (field.verbose_name, getattr(self.instance, name))\nif self.schema:\n for field in self.schema:\n field_id = field.getFieldName()\n...
<|body_start_0|> self.instance = instance self.schema = None if self.instance: self.schema = SurveySchema(self.instance.survey) <|end_body_0|> <|body_start_1|> for name, field in self.fields.items(): yield (field.verbose_name, getattr(self.instance, name)) ...
A base class that constructs the readonly template for given survey record. This uses the same notion that is used to build the model based readonly templates but the schema read from the survey schema rather than the model.
SurveyRecordReadOnlyTemplate
[ "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SurveyRecordReadOnlyTemplate: """A base class that constructs the readonly template for given survey record. This uses the same notion that is used to build the model based readonly templates but the schema read from the survey schema rather than the model.""" def __init__(self, instance=Non...
stack_v2_sparse_classes_36k_train_012760
6,916
permissive
[ { "docstring": "Constructor to initialize the model instance. The readonly template will be rendered for the data in this model instance.", "name": "__init__", "signature": "def __init__(self, instance=None)" }, { "docstring": "Iterator yielding groups of record instance's properties to be rende...
3
stack_v2_sparse_classes_30k_train_008690
Implement the Python class `SurveyRecordReadOnlyTemplate` described below. Class description: A base class that constructs the readonly template for given survey record. This uses the same notion that is used to build the model based readonly templates but the schema read from the survey schema rather than the model. ...
Implement the Python class `SurveyRecordReadOnlyTemplate` described below. Class description: A base class that constructs the readonly template for given survey record. This uses the same notion that is used to build the model based readonly templates but the schema read from the survey schema rather than the model. ...
6bbd1674c99fe285596e46e738856a82afe036af
<|skeleton|> class SurveyRecordReadOnlyTemplate: """A base class that constructs the readonly template for given survey record. This uses the same notion that is used to build the model based readonly templates but the schema read from the survey schema rather than the model.""" def __init__(self, instance=Non...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SurveyRecordReadOnlyTemplate: """A base class that constructs the readonly template for given survey record. This uses the same notion that is used to build the model based readonly templates but the schema read from the survey schema rather than the model.""" def __init__(self, instance=None): "...
the_stack_v2_python_sparse
app/soc/views/readonly_template.py
adviti/melange
train
0
873eda56637a7f687a7dc874145ec3d7dfe8c609
[ "if self.asignacion_id:\n self.asignacion_id.state = 'descartado'\n self.asignacion_id.fechahora_ar = datetime.now()\nself.asignacion_id = False\nself.asignadoa_id = False\nself.asignadoi_id = False\nself.asignadoa_id = False", "if self.asignadoa_id:\n if self.asignadoa_id.id != self.env.user.id:\n ...
<|body_start_0|> if self.asignacion_id: self.asignacion_id.state = 'descartado' self.asignacion_id.fechahora_ar = datetime.now() self.asignacion_id = False self.asignadoa_id = False self.asignadoi_id = False self.asignadoa_id = False <|end_body_0|> <|body...
TrafitecContrarecibo
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TrafitecContrarecibo: def action_asignar_quitar(self): """Quita la asignacion incondicionalmente.""" <|body_0|> def action_asignar_asignar(self): """Asignación.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if self.asignacion_id: self....
stack_v2_sparse_classes_36k_train_012761
2,037
no_license
[ { "docstring": "Quita la asignacion incondicionalmente.", "name": "action_asignar_quitar", "signature": "def action_asignar_quitar(self)" }, { "docstring": "Asignación.", "name": "action_asignar_asignar", "signature": "def action_asignar_asignar(self)" } ]
2
null
Implement the Python class `TrafitecContrarecibo` described below. Class description: Implement the TrafitecContrarecibo class. Method signatures and docstrings: - def action_asignar_quitar(self): Quita la asignacion incondicionalmente. - def action_asignar_asignar(self): Asignación.
Implement the Python class `TrafitecContrarecibo` described below. Class description: Implement the TrafitecContrarecibo class. Method signatures and docstrings: - def action_asignar_quitar(self): Quita la asignacion incondicionalmente. - def action_asignar_asignar(self): Asignación. <|skeleton|> class TrafitecContr...
cd226c4519157ffeab2f85a3a9ccff5e1d8143b0
<|skeleton|> class TrafitecContrarecibo: def action_asignar_quitar(self): """Quita la asignacion incondicionalmente.""" <|body_0|> def action_asignar_asignar(self): """Asignación.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TrafitecContrarecibo: def action_asignar_quitar(self): """Quita la asignacion incondicionalmente.""" if self.asignacion_id: self.asignacion_id.state = 'descartado' self.asignacion_id.fechahora_ar = datetime.now() self.asignacion_id = False self.asignadoa...
the_stack_v2_python_sparse
sli_documentos/models/trafitec_contrarecibo.py
RLJO/SLI
train
0
31ba6dbd9b5fc8f2c579e3ed5b955384fefbc457
[ "if not t:\n return [None]\nreturn [t.val] + self.preorderTraversal(t.left) + self.preorderTraversal(t.right)", "list_s, list_t = (self.preorderTraversal(s), self.preorderTraversal(t))\nlen_s, len_t = (len(list_s), len(list_t))\nfor i in range(0, len_s - len_t + 1):\n if list_s[i:i + len_t] == list_t:\n ...
<|body_start_0|> if not t: return [None] return [t.val] + self.preorderTraversal(t.left) + self.preorderTraversal(t.right) <|end_body_0|> <|body_start_1|> list_s, list_t = (self.preorderTraversal(s), self.preorderTraversal(t)) len_s, len_t = (len(list_s), len(list_t)) ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def preorderTraversal(self, t): """return a flat list of the binary tree including None""" <|body_0|> def isSubtree(self, s: TreeNode, t: TreeNode) -> bool: """check if preorderTraversal(t) is a sublist of preorderTraversal(s)""" <|body_1|> <|end_s...
stack_v2_sparse_classes_36k_train_012762
2,483
permissive
[ { "docstring": "return a flat list of the binary tree including None", "name": "preorderTraversal", "signature": "def preorderTraversal(self, t)" }, { "docstring": "check if preorderTraversal(t) is a sublist of preorderTraversal(s)", "name": "isSubtree", "signature": "def isSubtree(self,...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def preorderTraversal(self, t): return a flat list of the binary tree including None - def isSubtree(self, s: TreeNode, t: TreeNode) -> bool: check if preorderTraversal(t) is a s...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def preorderTraversal(self, t): return a flat list of the binary tree including None - def isSubtree(self, s: TreeNode, t: TreeNode) -> bool: check if preorderTraversal(t) is a s...
143422321cbc3715ca08f6c3af8f960a55887ced
<|skeleton|> class Solution: def preorderTraversal(self, t): """return a flat list of the binary tree including None""" <|body_0|> def isSubtree(self, s: TreeNode, t: TreeNode) -> bool: """check if preorderTraversal(t) is a sublist of preorderTraversal(s)""" <|body_1|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def preorderTraversal(self, t): """return a flat list of the binary tree including None""" if not t: return [None] return [t.val] + self.preorderTraversal(t.left) + self.preorderTraversal(t.right) def isSubtree(self, s: TreeNode, t: TreeNode) -> bool: ...
the_stack_v2_python_sparse
LeetCode/LC572_subtree_of_another_tree.py
jxie0755/Learning_Python
train
0
cbfd4e0a26c7ee55e146a5ad1631b7c3a5e34d7c
[ "writer = metadata_writer.MetadataWriter(model_buffer)\nwriter.add_general_info(_MODEL_NAME, _MODEL_DESCRIPTION)\nwriter.add_regex_text_input(regex_tokenizer)\nwriter.add_classification_output(labels)\nreturn cls(writer)", "writer = metadata_writer.MetadataWriter(model_buffer)\nwriter.add_general_info(_MODEL_NAME...
<|body_start_0|> writer = metadata_writer.MetadataWriter(model_buffer) writer.add_general_info(_MODEL_NAME, _MODEL_DESCRIPTION) writer.add_regex_text_input(regex_tokenizer) writer.add_classification_output(labels) return cls(writer) <|end_body_0|> <|body_start_1|> writer...
MetadataWriter to write the metadata into the text classifier.
MetadataWriter
[ "Apache-2.0", "dtoa" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MetadataWriter: """MetadataWriter to write the metadata into the text classifier.""" def create_for_regex_model(cls, model_buffer: bytearray, regex_tokenizer: metadata_writer.RegexTokenizer, labels: metadata_writer.Labels) -> 'MetadataWriter': """Creates MetadataWriter for TFLite mod...
stack_v2_sparse_classes_36k_train_012763
5,558
permissive
[ { "docstring": "Creates MetadataWriter for TFLite model with regex tokentizer. The parameters required in this method are mandatory when using MediaPipe Tasks. Note that only the output TFLite is used for deployment. The output JSON content is used to interpret the metadata content. Args: model_buffer: A valid ...
2
null
Implement the Python class `MetadataWriter` described below. Class description: MetadataWriter to write the metadata into the text classifier. Method signatures and docstrings: - def create_for_regex_model(cls, model_buffer: bytearray, regex_tokenizer: metadata_writer.RegexTokenizer, labels: metadata_writer.Labels) -...
Implement the Python class `MetadataWriter` described below. Class description: MetadataWriter to write the metadata into the text classifier. Method signatures and docstrings: - def create_for_regex_model(cls, model_buffer: bytearray, regex_tokenizer: metadata_writer.RegexTokenizer, labels: metadata_writer.Labels) -...
007824594bf1d07c7c1467df03a43886f8a4b3ad
<|skeleton|> class MetadataWriter: """MetadataWriter to write the metadata into the text classifier.""" def create_for_regex_model(cls, model_buffer: bytearray, regex_tokenizer: metadata_writer.RegexTokenizer, labels: metadata_writer.Labels) -> 'MetadataWriter': """Creates MetadataWriter for TFLite mod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MetadataWriter: """MetadataWriter to write the metadata into the text classifier.""" def create_for_regex_model(cls, model_buffer: bytearray, regex_tokenizer: metadata_writer.RegexTokenizer, labels: metadata_writer.Labels) -> 'MetadataWriter': """Creates MetadataWriter for TFLite model with regex...
the_stack_v2_python_sparse
mediapipe/tasks/python/metadata/metadata_writers/text_classifier.py
google/mediapipe
train
23,940
ad65870af378c1a9402e1bf010eb13d8abf34a44
[ "self.kwargs = kwargs.copy()\nself.mass_bins = [[9.7, 10.1], [10.1, 10.5], [10.5, 10.9], [10.9, 11.3]]\nself.ssfr_range = [-13.0, -7.0]\nself.ssfr_nbin = 40\nself.ssfr_dist = None\nself.ssfr_bin_edges = None\nself.ssfr_bin_mid = None", "if len(mass) != len(ssfr):\n raise ValueError\nself.ssfr_dist = []\nself.s...
<|body_start_0|> self.kwargs = kwargs.copy() self.mass_bins = [[9.7, 10.1], [10.1, 10.5], [10.5, 10.9], [10.9, 11.3]] self.ssfr_range = [-13.0, -7.0] self.ssfr_nbin = 40 self.ssfr_dist = None self.ssfr_bin_edges = None self.ssfr_bin_mid = None <|end_body_0|> <|bo...
Ssfr
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Ssfr: def __init__(self, **kwargs): """Class object that describes the sSFR distribution of a galaxy population""" <|body_0|> def Calculate(self, mass, ssfr): """Calculate the SSFR distribution for the four hardcoded mass bins from the mass and ssfr values""" ...
stack_v2_sparse_classes_36k_train_012764
15,116
no_license
[ { "docstring": "Class object that describes the sSFR distribution of a galaxy population", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "Calculate the SSFR distribution for the four hardcoded mass bins from the mass and ssfr values", "name": "Calculate", ...
2
null
Implement the Python class `Ssfr` described below. Class description: Implement the Ssfr class. Method signatures and docstrings: - def __init__(self, **kwargs): Class object that describes the sSFR distribution of a galaxy population - def Calculate(self, mass, ssfr): Calculate the SSFR distribution for the four har...
Implement the Python class `Ssfr` described below. Class description: Implement the Ssfr class. Method signatures and docstrings: - def __init__(self, **kwargs): Class object that describes the sSFR distribution of a galaxy population - def Calculate(self, mass, ssfr): Calculate the SSFR distribution for the four har...
0afc55f7c4b2e8a76ec8ee69b4d0e3f4742a3f93
<|skeleton|> class Ssfr: def __init__(self, **kwargs): """Class object that describes the sSFR distribution of a galaxy population""" <|body_0|> def Calculate(self, mass, ssfr): """Calculate the SSFR distribution for the four hardcoded mass bins from the mass and ssfr values""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Ssfr: def __init__(self, **kwargs): """Class object that describes the sSFR distribution of a galaxy population""" self.kwargs = kwargs.copy() self.mass_bins = [[9.7, 10.1], [10.1, 10.5], [10.5, 10.9], [10.9, 11.3]] self.ssfr_range = [-13.0, -7.0] self.ssfr_nbin = 40 ...
the_stack_v2_python_sparse
CenQue/gal_prop.py
changhoonhahn/central_quenching
train
0
176c0080fda8414ca1ca820cddbc5d7f1ed8950c
[ "super(GeonamesTestCase, self).setUp()\nself._admin = self.model('user').createUser('admin', 'password', 'admin', 'user', 'admin@example.com', admin=True)\nself._user = self.model('user').createUser('minervauser', 'password', 'minerva', 'user', 'minervauser@example.com')", "params = {'parentType': 'user', 'parent...
<|body_start_0|> super(GeonamesTestCase, self).setUp() self._admin = self.model('user').createUser('admin', 'password', 'admin', 'user', 'admin@example.com', admin=True) self._user = self.model('user').createUser('minervauser', 'password', 'minerva', 'user', 'minervauser@example.com') <|end_body...
Tests of the minerva geonames API endpoints.
GeonamesTestCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GeonamesTestCase: """Tests of the minerva geonames API endpoints.""" def setUp(self): """Set up the test case with a user.""" <|body_0|> def test_geocode(self): """Test importing the geonames database and geocoding.""" <|body_1|> <|end_skeleton|> <|body...
stack_v2_sparse_classes_36k_train_012765
4,048
no_license
[ { "docstring": "Set up the test case with a user.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test importing the geonames database and geocoding.", "name": "test_geocode", "signature": "def test_geocode(self)" } ]
2
stack_v2_sparse_classes_30k_train_000463
Implement the Python class `GeonamesTestCase` described below. Class description: Tests of the minerva geonames API endpoints. Method signatures and docstrings: - def setUp(self): Set up the test case with a user. - def test_geocode(self): Test importing the geonames database and geocoding.
Implement the Python class `GeonamesTestCase` described below. Class description: Tests of the minerva geonames API endpoints. Method signatures and docstrings: - def setUp(self): Set up the test case with a user. - def test_geocode(self): Test importing the geonames database and geocoding. <|skeleton|> class Geonam...
878d3aa26781439914871a54bbb27412a7a4719e
<|skeleton|> class GeonamesTestCase: """Tests of the minerva geonames API endpoints.""" def setUp(self): """Set up the test case with a user.""" <|body_0|> def test_geocode(self): """Test importing the geonames database and geocoding.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GeonamesTestCase: """Tests of the minerva geonames API endpoints.""" def setUp(self): """Set up the test case with a user.""" super(GeonamesTestCase, self).setUp() self._admin = self.model('user').createUser('admin', 'password', 'admin', 'user', 'admin@example.com', admin=True) ...
the_stack_v2_python_sparse
plugin_tests/geonames_test.py
justincampbell/minerva
train
0
a5948168972f42dccf896a7f81528cbd5a4f3ae9
[ "self.gov = request.args.get('gov', '')\nself.dep = request.args.get('govtype', '')\nself.relation = request.args.get('dep', '')\nself.govtype = request.args.get('deptype', 'word')\nself.deptype = request.args.get('relation', 'word')\ntry:\n self.phrases = json.loads(str(request.args['phrases']))\n self.metad...
<|body_start_0|> self.gov = request.args.get('gov', '') self.dep = request.args.get('govtype', '') self.relation = request.args.get('dep', '') self.govtype = request.args.get('deptype', 'word') self.deptype = request.args.get('relation', 'word') try: self.phra...
Return adjectives, nouns, and verbs with high TF-IDF scores that tend to occur within 10 sentences of the given word. The expected url arguments are documented below. Keyword Arguments: phrases (str): govtype (str): dep (str): deptype (str): relation (str): phrases (JSON): Required. metadata (JSON): Required. searches ...
GetAssociatedWords
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetAssociatedWords: """Return adjectives, nouns, and verbs with high TF-IDF scores that tend to occur within 10 sentences of the given word. The expected url arguments are documented below. Keyword Arguments: phrases (str): govtype (str): dep (str): deptype (str): relation (str): phrases (JSON): ...
stack_v2_sparse_classes_36k_train_012766
3,365
no_license
[ { "docstring": "Initialize variables necessary for the GetAssociatedUsers view.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Create a JSON response to the request.", "name": "dispatch_request", "signature": "def dispatch_request(self)" }, { "docstrin...
3
stack_v2_sparse_classes_30k_train_018986
Implement the Python class `GetAssociatedWords` described below. Class description: Return adjectives, nouns, and verbs with high TF-IDF scores that tend to occur within 10 sentences of the given word. The expected url arguments are documented below. Keyword Arguments: phrases (str): govtype (str): dep (str): deptype ...
Implement the Python class `GetAssociatedWords` described below. Class description: Return adjectives, nouns, and verbs with high TF-IDF scores that tend to occur within 10 sentences of the given word. The expected url arguments are documented below. Keyword Arguments: phrases (str): govtype (str): dep (str): deptype ...
93b90e6a8592a26c6efa09ea5f5aa4fab044f9d7
<|skeleton|> class GetAssociatedWords: """Return adjectives, nouns, and verbs with high TF-IDF scores that tend to occur within 10 sentences of the given word. The expected url arguments are documented below. Keyword Arguments: phrases (str): govtype (str): dep (str): deptype (str): relation (str): phrases (JSON): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GetAssociatedWords: """Return adjectives, nouns, and verbs with high TF-IDF scores that tend to occur within 10 sentences of the given word. The expected url arguments are documented below. Keyword Arguments: phrases (str): govtype (str): dep (str): deptype (str): relation (str): phrases (JSON): Required. met...
the_stack_v2_python_sparse
app/wordseer/views/getassociatedwords.py
xiaobaozi34/wordseer
train
0
d7bd925d86bc94029018158283007d12061bbb81
[ "if max_iter < 0:\n raise ValueError('Argument, max_iter must be positive')\nif min_change < 0:\n raise ValueError('Arguement: min_change must be positive')\nself._max_iter = max_iter\nself._min_change = min_change\nsuper().__init__()", "if gradients is None:\n raise TypeError('Argument: gradients must b...
<|body_start_0|> if max_iter < 0: raise ValueError('Argument, max_iter must be positive') if min_change < 0: raise ValueError('Arguement: min_change must be positive') self._max_iter = max_iter self._min_change = min_change super().__init__() <|end_body_0|...
FrankWolfeSolver class. Inherits from the COPSolver class. FrankWolfeSolver is used to calculate the numerical solutions for the QCOP for 2 or more gradients Attributes: max_iter: max number of iterations for the algorithm min_change: minimum change stopping criterion. The algorithms stop when the difference between it...
FrankWolfeSolver
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FrankWolfeSolver: """FrankWolfeSolver class. Inherits from the COPSolver class. FrankWolfeSolver is used to calculate the numerical solutions for the QCOP for 2 or more gradients Attributes: max_iter: max number of iterations for the algorithm min_change: minimum change stopping criterion. The al...
stack_v2_sparse_classes_36k_train_012767
4,848
permissive
[ { "docstring": "Inits FrankWolfeSolver with hyperparameters values Args: max_iter: maximum number of iterations. Must be <= 1. default value is 100. min_change: minimum change stopping criterion. Must be < 0 default value is 1e-3", "name": "__init__", "signature": "def __init__(self, max_iter=100, min_c...
3
stack_v2_sparse_classes_30k_val_000528
Implement the Python class `FrankWolfeSolver` described below. Class description: FrankWolfeSolver class. Inherits from the COPSolver class. FrankWolfeSolver is used to calculate the numerical solutions for the QCOP for 2 or more gradients Attributes: max_iter: max number of iterations for the algorithm min_change: mi...
Implement the Python class `FrankWolfeSolver` described below. Class description: FrankWolfeSolver class. Inherits from the COPSolver class. FrankWolfeSolver is used to calculate the numerical solutions for the QCOP for 2 or more gradients Attributes: max_iter: max number of iterations for the algorithm min_change: mi...
26d6a08c8c7e7d33ad60d7e6896b0ffeede41bc1
<|skeleton|> class FrankWolfeSolver: """FrankWolfeSolver class. Inherits from the COPSolver class. FrankWolfeSolver is used to calculate the numerical solutions for the QCOP for 2 or more gradients Attributes: max_iter: max number of iterations for the algorithm min_change: minimum change stopping criterion. The al...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FrankWolfeSolver: """FrankWolfeSolver class. Inherits from the COPSolver class. FrankWolfeSolver is used to calculate the numerical solutions for the QCOP for 2 or more gradients Attributes: max_iter: max number of iterations for the algorithm min_change: minimum change stopping criterion. The algorithms stop...
the_stack_v2_python_sparse
copsolver/frank_wolfe_solver.py
swisscom/ai-research-mamo-framework
train
30
887cc014f6ea3f57abd3d0350894f93c11a21a13
[ "args = self.args\nif args and (not args[0] in [\"'\", ',', ':']):\n args = ' %s' % args.strip()\nself.args = args", "if not self.args:\n msg = 'What do you want to do?'\n self.caller.msg(msg)\nelse:\n msg = f'{self.caller.name}{self.args}'\n self.caller.location.msg_contents(text=(msg, {'type': 'p...
<|body_start_0|> args = self.args if args and (not args[0] in ["'", ',', ':']): args = ' %s' % args.strip() self.args = args <|end_body_0|> <|body_start_1|> if not self.args: msg = 'What do you want to do?' self.caller.msg(msg) else: ...
strike a pose Usage: pose <pose text> pose's <pose text> Example: pose is standing by the wall, smiling. -> others will see: Tom is standing by the wall, smiling. Describe an action being taken. The pose text will automatically begin with your name.
CmdPose
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CmdPose: """strike a pose Usage: pose <pose text> pose's <pose text> Example: pose is standing by the wall, smiling. -> others will see: Tom is standing by the wall, smiling. Describe an action being taken. The pose text will automatically begin with your name.""" def parse(self): ""...
stack_v2_sparse_classes_36k_train_012768
22,494
permissive
[ { "docstring": "Custom parse the cases where the emote starts with some special letter, such as 's, at which we don't want to separate the caller's name and the emote with a space.", "name": "parse", "signature": "def parse(self)" }, { "docstring": "Hook function", "name": "func", "signa...
2
stack_v2_sparse_classes_30k_train_006379
Implement the Python class `CmdPose` described below. Class description: strike a pose Usage: pose <pose text> pose's <pose text> Example: pose is standing by the wall, smiling. -> others will see: Tom is standing by the wall, smiling. Describe an action being taken. The pose text will automatically begin with your na...
Implement the Python class `CmdPose` described below. Class description: strike a pose Usage: pose <pose text> pose's <pose text> Example: pose is standing by the wall, smiling. -> others will see: Tom is standing by the wall, smiling. Describe an action being taken. The pose text will automatically begin with your na...
b3ca58b5c1325a3bf57051dfe23560a08d2947b7
<|skeleton|> class CmdPose: """strike a pose Usage: pose <pose text> pose's <pose text> Example: pose is standing by the wall, smiling. -> others will see: Tom is standing by the wall, smiling. Describe an action being taken. The pose text will automatically begin with your name.""" def parse(self): ""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CmdPose: """strike a pose Usage: pose <pose text> pose's <pose text> Example: pose is standing by the wall, smiling. -> others will see: Tom is standing by the wall, smiling. Describe an action being taken. The pose text will automatically begin with your name.""" def parse(self): """Custom parse...
the_stack_v2_python_sparse
evennia/commands/default/general.py
evennia/evennia
train
1,781
a071ae6dc0156217830ddfd3789d3b86e824d90e
[ "engine = MainEngine()\nqubits = engine.allocate_qureg(3)\nH | qubits[0]\nengine.flush()\nprint(engine.backend.cheat())\nX | qubits[2]\nengine.flush()\nprint(engine.backend.cheat())\nCNOT | (qubits[0], qubits[1])\nengine.flush()\nprint(engine.backend.cheat())", "drawer = CircuitDrawer()\nengine = MainEngine(drawe...
<|body_start_0|> engine = MainEngine() qubits = engine.allocate_qureg(3) H | qubits[0] engine.flush() print(engine.backend.cheat()) X | qubits[2] engine.flush() print(engine.backend.cheat()) CNOT | (qubits[0], qubits[1]) engine.flush() ...
This class contains demonstrations of ProjectQ's debugging and diagnostic features.
DebuggingFeatures
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DebuggingFeatures: """This class contains demonstrations of ProjectQ's debugging and diagnostic features.""" def test_step_by_step_circuit_inspection(self): """This function demonstrates how to use ProjectQ to print the state vector of every step (moment) in a circuit. It also shows ...
stack_v2_sparse_classes_36k_train_012769
3,023
permissive
[ { "docstring": "This function demonstrates how to use ProjectQ to print the state vector of every step (moment) in a circuit. It also shows how to get the state vector at each step, and how to print it in ket notation.", "name": "test_step_by_step_circuit_inspection", "signature": "def test_step_by_step...
3
stack_v2_sparse_classes_30k_train_012810
Implement the Python class `DebuggingFeatures` described below. Class description: This class contains demonstrations of ProjectQ's debugging and diagnostic features. Method signatures and docstrings: - def test_step_by_step_circuit_inspection(self): This function demonstrates how to use ProjectQ to print the state v...
Implement the Python class `DebuggingFeatures` described below. Class description: This class contains demonstrations of ProjectQ's debugging and diagnostic features. Method signatures and docstrings: - def test_step_by_step_circuit_inspection(self): This function demonstrates how to use ProjectQ to print the state v...
941488f8f8a81a4b7d7fe28414ce14fa478a692a
<|skeleton|> class DebuggingFeatures: """This class contains demonstrations of ProjectQ's debugging and diagnostic features.""" def test_step_by_step_circuit_inspection(self): """This function demonstrates how to use ProjectQ to print the state vector of every step (moment) in a circuit. It also shows ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DebuggingFeatures: """This class contains demonstrations of ProjectQ's debugging and diagnostic features.""" def test_step_by_step_circuit_inspection(self): """This function demonstrates how to use ProjectQ to print the state vector of every step (moment) in a circuit. It also shows how to get th...
the_stack_v2_python_sparse
ProjectQ/ProjectQDebugging/debugging_features.py
taibah/qsfe
train
0
baf3d85d06ee3df698f558f1b5390abe8bedec11
[ "super(RelaxListType, self).__init__()\nself.list_name = 'relax_list'\nself.list_desc = 'relax list container'\nself.element_name = 'relax_list_element'\nself.element_desc = 'relax container'\nself.blacklist = []", "xml_to_object(super_node, self, file_version=file_version, blacklist=self.blacklist)\nnodes = supe...
<|body_start_0|> super(RelaxListType, self).__init__() self.list_name = 'relax_list' self.list_desc = 'relax list container' self.element_name = 'relax_list_element' self.element_desc = 'relax container' self.blacklist = [] <|end_body_0|> <|body_start_1|> xml_to_...
An empty list type container.
RelaxListType
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RelaxListType: """An empty list type container.""" def __init__(self): """Initialise some class variables.""" <|body_0|> def from_xml(self, super_node, file_version=1): """Recreate the data structure from the XML node. @param super_node: The XML nodes. @type supe...
stack_v2_sparse_classes_36k_train_012770
10,046
no_license
[ { "docstring": "Initialise some class variables.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Recreate the data structure from the XML node. @param super_node: The XML nodes. @type super_node: xml.dom.minicompat.Element instance @keyword file_version: The relax XML ...
3
stack_v2_sparse_classes_30k_train_018819
Implement the Python class `RelaxListType` described below. Class description: An empty list type container. Method signatures and docstrings: - def __init__(self): Initialise some class variables. - def from_xml(self, super_node, file_version=1): Recreate the data structure from the XML node. @param super_node: The ...
Implement the Python class `RelaxListType` described below. Class description: An empty list type container. Method signatures and docstrings: - def __init__(self): Initialise some class variables. - def from_xml(self, super_node, file_version=1): Recreate the data structure from the XML node. @param super_node: The ...
c317326ddeacd1a1c608128769676899daeae531
<|skeleton|> class RelaxListType: """An empty list type container.""" def __init__(self): """Initialise some class variables.""" <|body_0|> def from_xml(self, super_node, file_version=1): """Recreate the data structure from the XML node. @param super_node: The XML nodes. @type supe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RelaxListType: """An empty list type container.""" def __init__(self): """Initialise some class variables.""" super(RelaxListType, self).__init__() self.list_name = 'relax_list' self.list_desc = 'relax list container' self.element_name = 'relax_list_element' ...
the_stack_v2_python_sparse
data_store/data_classes.py
jlec/relax
train
4
10f3f42991c5e58b5eea8c5cf0f3e204f6230789
[ "list_controls = self._device.CallOutput(['amixer', '-c%d' % int(card), 'controls'])\nre_control = re.compile(self._CONTROL_RE_STR % name)\nnumid = 0\nfor ctl in list_controls.splitlines():\n m = re_control.match(ctl)\n if m:\n numid = int(m.group(1))\n break\nelse:\n logging.info(\"Unable to...
<|body_start_0|> list_controls = self._device.CallOutput(['amixer', '-c%d' % int(card), 'controls']) re_control = re.compile(self._CONTROL_RE_STR % name) numid = 0 for ctl in list_controls.splitlines(): m = re_control.match(ctl) if m: numid = int(m...
Mixer controller for alsa.
AlsaMixerController
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlsaMixerController: """Mixer controller for alsa.""" def GetMixerControls(self, name, card='0'): """See BaseMixerController.GetMixerControls""" <|body_0|> def SetMixerControls(self, mixer_settings, card='0', store=True): """See BaseMixerController.SetMixerContro...
stack_v2_sparse_classes_36k_train_012771
9,957
permissive
[ { "docstring": "See BaseMixerController.GetMixerControls", "name": "GetMixerControls", "signature": "def GetMixerControls(self, name, card='0')" }, { "docstring": "See BaseMixerController.SetMixerControls", "name": "SetMixerControls", "signature": "def SetMixerControls(self, mixer_settin...
3
null
Implement the Python class `AlsaMixerController` described below. Class description: Mixer controller for alsa. Method signatures and docstrings: - def GetMixerControls(self, name, card='0'): See BaseMixerController.GetMixerControls - def SetMixerControls(self, mixer_settings, card='0', store=True): See BaseMixerCont...
Implement the Python class `AlsaMixerController` described below. Class description: Mixer controller for alsa. Method signatures and docstrings: - def GetMixerControls(self, name, card='0'): See BaseMixerController.GetMixerControls - def SetMixerControls(self, mixer_settings, card='0', store=True): See BaseMixerCont...
a1b0fccd68987d8cd9c89710adc3c04b868347ec
<|skeleton|> class AlsaMixerController: """Mixer controller for alsa.""" def GetMixerControls(self, name, card='0'): """See BaseMixerController.GetMixerControls""" <|body_0|> def SetMixerControls(self, mixer_settings, card='0', store=True): """See BaseMixerController.SetMixerContro...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AlsaMixerController: """Mixer controller for alsa.""" def GetMixerControls(self, name, card='0'): """See BaseMixerController.GetMixerControls""" list_controls = self._device.CallOutput(['amixer', '-c%d' % int(card), 'controls']) re_control = re.compile(self._CONTROL_RE_STR % name)...
the_stack_v2_python_sparse
py/device/audio/alsa.py
bridder/factory
train
0
46a57b7429bfa95fed9b004173c0cc7b34df941c
[ "n = len(searchString)\nmin_window_size = sys.maxsize\nmin_window = ''\nfor left in range(0, n):\n for right in range(left, n):\n window_snippet = searchString[left:right + 1]\n window_contains_all = self.contains_all(window_snippet, t)\n if window_contains_all and len(window_snippet) < min_...
<|body_start_0|> n = len(searchString) min_window_size = sys.maxsize min_window = '' for left in range(0, n): for right in range(left, n): window_snippet = searchString[left:right + 1] window_contains_all = self.contains_all(window_snippet, t) ...
BruteForceSolution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BruteForceSolution: def minWindow(self, searchString, t): """Interface ---- :type searchString: str :type t: str :rtype: str Approach ---- 1. Plant the left pointer and scan the window 2. Find all substrings that contain all of the target 3. Take the smallest Complexity ---- M = target s...
stack_v2_sparse_classes_36k_train_012772
6,464
no_license
[ { "docstring": "Interface ---- :type searchString: str :type t: str :rtype: str Approach ---- 1. Plant the left pointer and scan the window 2. Find all substrings that contain all of the target 3. Take the smallest Complexity ---- M = target string N = length of query string Time : O(N^2) Space : O(1)", "na...
2
stack_v2_sparse_classes_30k_train_015982
Implement the Python class `BruteForceSolution` described below. Class description: Implement the BruteForceSolution class. Method signatures and docstrings: - def minWindow(self, searchString, t): Interface ---- :type searchString: str :type t: str :rtype: str Approach ---- 1. Plant the left pointer and scan the win...
Implement the Python class `BruteForceSolution` described below. Class description: Implement the BruteForceSolution class. Method signatures and docstrings: - def minWindow(self, searchString, t): Interface ---- :type searchString: str :type t: str :rtype: str Approach ---- 1. Plant the left pointer and scan the win...
c0d49423885832b616ae3c7cd58e8f24c17cfd4d
<|skeleton|> class BruteForceSolution: def minWindow(self, searchString, t): """Interface ---- :type searchString: str :type t: str :rtype: str Approach ---- 1. Plant the left pointer and scan the window 2. Find all substrings that contain all of the target 3. Take the smallest Complexity ---- M = target s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BruteForceSolution: def minWindow(self, searchString, t): """Interface ---- :type searchString: str :type t: str :rtype: str Approach ---- 1. Plant the left pointer and scan the window 2. Find all substrings that contain all of the target 3. Take the smallest Complexity ---- M = target string N = leng...
the_stack_v2_python_sparse
Hashtables/minimumWindowSubstring.py
miaviles/Data-Structures-Algorithms-Python
train
0
069f365118e68e3ed1d3fadc30529f41e5028933
[ "\"\"\"\n review a short tutorial video: \n heap and priority queue https://www.youtube.com/watch?v=hj9lOSJCy-U\n this problem can be solved by priority queue\n since priority queues normal are implemented by heap tree.\n the insertion and removal of heap tree is O(logn)\n ...
<|body_start_0|> """ review a short tutorial video: heap and priority queue https://www.youtube.com/watch?v=hj9lOSJCy-U this problem can be solved by priority queue since priority queues normal are implemented by heap tree. the ins...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mergeKLists_heap_priority_queue(self, lists): """:type lists: List[ListNode] :rtype: ListNode""" <|body_0|> def mergeKLists(self, lists): """divide and conquer method the time complexity is O(nklogk), space complexity is O(1) k*n + k/2*2n + k/4*4n + ......
stack_v2_sparse_classes_36k_train_012773
3,053
no_license
[ { "docstring": ":type lists: List[ListNode] :rtype: ListNode", "name": "mergeKLists_heap_priority_queue", "signature": "def mergeKLists_heap_priority_queue(self, lists)" }, { "docstring": "divide and conquer method the time complexity is O(nklogk), space complexity is O(1) k*n + k/2*2n + k/4*4n ...
3
stack_v2_sparse_classes_30k_test_000819
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeKLists_heap_priority_queue(self, lists): :type lists: List[ListNode] :rtype: ListNode - def mergeKLists(self, lists): divide and conquer method the time complexity is O(...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeKLists_heap_priority_queue(self, lists): :type lists: List[ListNode] :rtype: ListNode - def mergeKLists(self, lists): divide and conquer method the time complexity is O(...
5532195d25a32474aeb13b5564f26a8d2b0759db
<|skeleton|> class Solution: def mergeKLists_heap_priority_queue(self, lists): """:type lists: List[ListNode] :rtype: ListNode""" <|body_0|> def mergeKLists(self, lists): """divide and conquer method the time complexity is O(nklogk), space complexity is O(1) k*n + k/2*2n + k/4*4n + ......
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def mergeKLists_heap_priority_queue(self, lists): """:type lists: List[ListNode] :rtype: ListNode""" """ review a short tutorial video: heap and priority queue https://www.youtube.com/watch?v=hj9lOSJCy-U this problem can be solved by p...
the_stack_v2_python_sparse
leetcode/23_merge_k_sorted_lists/solution.py
stenliao/coding_practice
train
0
6083020295890c697cfa3823c5109d759eb49eb4
[ "if type(data) is not np.ndarray:\n raise TypeError('data must be a 2D numpy.ndarray')\nif len(data.shape) != 2:\n raise TypeError('data must be a 2D numpy.ndarray')\nn = data.shape[1]\nif n < 2:\n raise ValueError('data must contain multiple data points')\nself.mean = data.mean(axis=1, keepdims=True)\nsel...
<|body_start_0|> if type(data) is not np.ndarray: raise TypeError('data must be a 2D numpy.ndarray') if len(data.shape) != 2: raise TypeError('data must be a 2D numpy.ndarray') n = data.shape[1] if n < 2: raise ValueError('data must contain multiple da...
MultiNormal Class
MultiNormal
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiNormal: """MultiNormal Class""" def __init__(self, data): """Multinormal Class""" <|body_0|> def pdf(self, x): """Multinormal Class""" <|body_1|> <|end_skeleton|> <|body_start_0|> if type(data) is not np.ndarray: raise TypeError...
stack_v2_sparse_classes_36k_train_012774
1,330
no_license
[ { "docstring": "Multinormal Class", "name": "__init__", "signature": "def __init__(self, data)" }, { "docstring": "Multinormal Class", "name": "pdf", "signature": "def pdf(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_015401
Implement the Python class `MultiNormal` described below. Class description: MultiNormal Class Method signatures and docstrings: - def __init__(self, data): Multinormal Class - def pdf(self, x): Multinormal Class
Implement the Python class `MultiNormal` described below. Class description: MultiNormal Class Method signatures and docstrings: - def __init__(self, data): Multinormal Class - def pdf(self, x): Multinormal Class <|skeleton|> class MultiNormal: """MultiNormal Class""" def __init__(self, data): """Mu...
8761eb876046ad3c0c3f85d98dbdca4007d93cd1
<|skeleton|> class MultiNormal: """MultiNormal Class""" def __init__(self, data): """Multinormal Class""" <|body_0|> def pdf(self, x): """Multinormal Class""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiNormal: """MultiNormal Class""" def __init__(self, data): """Multinormal Class""" if type(data) is not np.ndarray: raise TypeError('data must be a 2D numpy.ndarray') if len(data.shape) != 2: raise TypeError('data must be a 2D numpy.ndarray') n ...
the_stack_v2_python_sparse
math/0x06-multivariate_prob/multinormal.py
oran2527/holbertonschool-machine_learning
train
0
bfddf40cb678c98d2b73767b34afb4259402e163
[ "user = request.user\nnotifications = Notification.objects.all()\ndata = {}\nfor notification in notifications:\n if user in notification.notified.all():\n serializer = self.serializer_class(notification, context={'request': request})\n data[notification.id] = serializer.data\nreturn Response(data,...
<|body_start_0|> user = request.user notifications = Notification.objects.all() data = {} for notification in notifications: if user in notification.notified.all(): serializer = self.serializer_class(notification, context={'request': request}) ...
get:
NotificationAPIView
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NotificationAPIView: """get:""" def get(self, request): """Retrieve all notifications from the database for a specific user. :returns notifications: a json data for the notifications""" <|body_0|> def put(self, request): """Mark all notifications as read.""" ...
stack_v2_sparse_classes_36k_train_012775
7,717
permissive
[ { "docstring": "Retrieve all notifications from the database for a specific user. :returns notifications: a json data for the notifications", "name": "get", "signature": "def get(self, request)" }, { "docstring": "Mark all notifications as read.", "name": "put", "signature": "def put(sel...
2
stack_v2_sparse_classes_30k_train_018792
Implement the Python class `NotificationAPIView` described below. Class description: get: Method signatures and docstrings: - def get(self, request): Retrieve all notifications from the database for a specific user. :returns notifications: a json data for the notifications - def put(self, request): Mark all notificat...
Implement the Python class `NotificationAPIView` described below. Class description: get: Method signatures and docstrings: - def get(self, request): Retrieve all notifications from the database for a specific user. :returns notifications: a json data for the notifications - def put(self, request): Mark all notificat...
daf55ce4819f57cec8510c5726e86a0b1e78e3e1
<|skeleton|> class NotificationAPIView: """get:""" def get(self, request): """Retrieve all notifications from the database for a specific user. :returns notifications: a json data for the notifications""" <|body_0|> def put(self, request): """Mark all notifications as read.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NotificationAPIView: """get:""" def get(self, request): """Retrieve all notifications from the database for a specific user. :returns notifications: a json data for the notifications""" user = request.user notifications = Notification.objects.all() data = {} for no...
the_stack_v2_python_sparse
authors/apps/notifications/views.py
andela/ah-magnificent6
train
0
5c65113d8fe3bf75317e6aaf727dbade145e3641
[ "if not itvls:\n return []\nitvls.sort(key=lambda x: x.start)\nret = [itvls[0]]\nfor cur in itvls[1:]:\n pre = ret[-1]\n if cur.start <= pre.end:\n pre.end = max(pre.end, cur.end)\n else:\n ret.append(cur)\nreturn ret", "if not itvls:\n return []\nret = [itvls[0]]\nfor interval in itv...
<|body_start_0|> if not itvls: return [] itvls.sort(key=lambda x: x.start) ret = [itvls[0]] for cur in itvls[1:]: pre = ret[-1] if cur.start <= pre.end: pre.end = max(pre.end, cur.end) else: ret.append(cur) ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def merge(self, itvls): """scanning. No algorithm math :param itvls: a list of Interval :return: a list of Interval""" <|body_0|> def merge_error(self, itvls): """scanning. No algorithm math :param itvls: a list of Interval :return: a list of Interval""" ...
stack_v2_sparse_classes_36k_train_012776
2,093
permissive
[ { "docstring": "scanning. No algorithm math :param itvls: a list of Interval :return: a list of Interval", "name": "merge", "signature": "def merge(self, itvls)" }, { "docstring": "scanning. No algorithm math :param itvls: a list of Interval :return: a list of Interval", "name": "merge_error...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def merge(self, itvls): scanning. No algorithm math :param itvls: a list of Interval :return: a list of Interval - def merge_error(self, itvls): scanning. No algorithm math :para...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def merge(self, itvls): scanning. No algorithm math :param itvls: a list of Interval :return: a list of Interval - def merge_error(self, itvls): scanning. No algorithm math :para...
cbbd4a67ab342ada2421e13f82d660b1d47d4d20
<|skeleton|> class Solution: def merge(self, itvls): """scanning. No algorithm math :param itvls: a list of Interval :return: a list of Interval""" <|body_0|> def merge_error(self, itvls): """scanning. No algorithm math :param itvls: a list of Interval :return: a list of Interval""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def merge(self, itvls): """scanning. No algorithm math :param itvls: a list of Interval :return: a list of Interval""" if not itvls: return [] itvls.sort(key=lambda x: x.start) ret = [itvls[0]] for cur in itvls[1:]: pre = ret[-1] ...
the_stack_v2_python_sparse
055 Merge Intervals.py
Aminaba123/LeetCode
train
1
d2bdf00c6ea36704e7032d866c502c3b02e5976d
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn AccessReviewStageSettings()", "from .access_review_recommendation_insight_setting import AccessReviewRecommendationInsightSetting\nfrom .access_review_reviewer_scope import AccessReviewReviewerScope\nfrom .access_review_recommendation_...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return AccessReviewStageSettings() <|end_body_0|> <|body_start_1|> from .access_review_recommendation_insight_setting import AccessReviewRecommendationInsightSetting from .access_review_reviewe...
AccessReviewStageSettings
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccessReviewStageSettings: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessReviewStageSettings: """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_36k_train_012777
7,044
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: AccessReviewStageSettings", "name": "create_from_discriminator_value", "signature": "def create_from_discrim...
3
stack_v2_sparse_classes_30k_train_013119
Implement the Python class `AccessReviewStageSettings` described below. Class description: Implement the AccessReviewStageSettings class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessReviewStageSettings: Creates a new instance of the appropriat...
Implement the Python class `AccessReviewStageSettings` described below. Class description: Implement the AccessReviewStageSettings class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessReviewStageSettings: Creates a new instance of the appropriat...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class AccessReviewStageSettings: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessReviewStageSettings: """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_36k
data/stack_v2_sparse_classes_30k
class AccessReviewStageSettings: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessReviewStageSettings: """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/access_review_stage_settings.py
microsoftgraph/msgraph-sdk-python
train
135
96334f3a232b0bb91b1f4dff25f965c29912bd96
[ "if model_output_transform is None and transforms is None:\n model_output_transform = SameSize(resize_target=False, interpolation=self.DEFAULT_MASK_INTERPOLATION)\nif transforms is not None:\n transforms_wt_device: Compose = Compose([OnBothSides(ToDevice(device)), transforms])\nelse:\n transforms_wt_device...
<|body_start_0|> if model_output_transform is None and transforms is None: model_output_transform = SameSize(resize_target=False, interpolation=self.DEFAULT_MASK_INTERPOLATION) if transforms is not None: transforms_wt_device: Compose = Compose([OnBothSides(ToDevice(device)), tran...
Train test handle for concept localization models. Takes the concept data of the concept model's concept, and automatically converts it appropriately for the concept model (see :py:meth:`data_from_concept`).
ConceptDetection2DTrainTestHandle
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConceptDetection2DTrainTestHandle: """Train test handle for concept localization models. Takes the concept data of the concept model's concept, and automatically converts it appropriately for the concept model (see :py:meth:`data_from_concept`).""" def __init__(self, concept_model: ConceptDe...
stack_v2_sparse_classes_36k_train_012778
27,601
permissive
[ { "docstring": "Init. For further parameter descriptions see ``__init__()`` of :py:class:`~hybrid_learning.concepts.models.base_handles.train_test_handle.TrainEvalHandle`. :param concept_model: the concept localization model to work on with concept. :param act_map_filepath_fns: dictionary of ``{split: func}`` w...
3
stack_v2_sparse_classes_30k_test_000962
Implement the Python class `ConceptDetection2DTrainTestHandle` described below. Class description: Train test handle for concept localization models. Takes the concept data of the concept model's concept, and automatically converts it appropriately for the concept model (see :py:meth:`data_from_concept`). Method sign...
Implement the Python class `ConceptDetection2DTrainTestHandle` described below. Class description: Train test handle for concept localization models. Takes the concept data of the concept model's concept, and automatically converts it appropriately for the concept model (see :py:meth:`data_from_concept`). Method sign...
37b9fc83d7b14902dfe92e0c45071c150bcf3779
<|skeleton|> class ConceptDetection2DTrainTestHandle: """Train test handle for concept localization models. Takes the concept data of the concept model's concept, and automatically converts it appropriately for the concept model (see :py:meth:`data_from_concept`).""" def __init__(self, concept_model: ConceptDe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConceptDetection2DTrainTestHandle: """Train test handle for concept localization models. Takes the concept data of the concept model's concept, and automatically converts it appropriately for the concept model (see :py:meth:`data_from_concept`).""" def __init__(self, concept_model: ConceptDetectionModel2...
the_stack_v2_python_sparse
hybrid_learning/concepts/models/concept_detection.py
JohnnyZhang917/hybrid_learning
train
0
f071908d6b373e03e4f1505fda56c51775cae8b4
[ "if root is None:\n return None\nif root.left is None and root.right is None:\n return [[root.val]]\nlevel_order = []\nlevel_limit = 0\ntmp_stack = [root]\ntmp_level = []\ncur_node = root\nwhile tmp_stack:\n level_limit = len(tmp_stack)\n while level_limit != 0:\n cur_node = tmp_stack.pop(0)\n ...
<|body_start_0|> if root is None: return None if root.left is None and root.right is None: return [[root.val]] level_order = [] level_limit = 0 tmp_stack = [root] tmp_level = [] cur_node = root while tmp_stack: level_lim...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def levelOrder(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_0|> def levelOrder1(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> if root is None: ...
stack_v2_sparse_classes_36k_train_012779
2,776
no_license
[ { "docstring": ":type root: TreeNode :rtype: List[List[int]]", "name": "levelOrder", "signature": "def levelOrder(self, root)" }, { "docstring": ":type root: TreeNode :rtype: List[List[int]]", "name": "levelOrder1", "signature": "def levelOrder1(self, root)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def levelOrder(self, root): :type root: TreeNode :rtype: List[List[int]] - def levelOrder1(self, root): :type root: TreeNode :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def levelOrder(self, root): :type root: TreeNode :rtype: List[List[int]] - def levelOrder1(self, root): :type root: TreeNode :rtype: List[List[int]] <|skeleton|> class Solution:...
233d12deca34f51c3bb0406831cc07f3b72b50cf
<|skeleton|> class Solution: def levelOrder(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_0|> def levelOrder1(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def levelOrder(self, root): """:type root: TreeNode :rtype: List[List[int]]""" if root is None: return None if root.left is None and root.right is None: return [[root.val]] level_order = [] level_limit = 0 tmp_stack = [root] ...
the_stack_v2_python_sparse
Python/Binary Tree Level Order Traversal/main.py
briansu2004/MyLeet
train
1
bd5da5c516f3a0003478b4d0713baf58782e5b5a
[ "current_user = g.user\nmeal = Meal.find_meal(meal_id, current_user)\nif not meal['status']:\n abort(http_status_code=400, message=meal['message'])\nmeal['meal'].delete_meal()\nreturn make_response(jsonify({'message': 'Meal deleted succesfully'}), 200)", "parser = reqparse.RequestParser()\nparser.add_argument(...
<|body_start_0|> current_user = g.user meal = Meal.find_meal(meal_id, current_user) if not meal['status']: abort(http_status_code=400, message=meal['message']) meal['meal'].delete_meal() return make_response(jsonify({'message': 'Meal deleted succesfully'}), 200) <|end...
mealone class
MealOne
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MealOne: """mealone class""" def delete(meal_id): """Deletes a meal from the database if it exists token is required to get admin Id""" <|body_0|> def put(meal_id): """Allows admin to edit the meal details from the meals_list if it exists. token is required to ge...
stack_v2_sparse_classes_36k_train_012780
4,258
no_license
[ { "docstring": "Deletes a meal from the database if it exists token is required to get admin Id", "name": "delete", "signature": "def delete(meal_id)" }, { "docstring": "Allows admin to edit the meal details from the meals_list if it exists. token is required to get admin Id", "name": "put",...
3
stack_v2_sparse_classes_30k_train_002702
Implement the Python class `MealOne` described below. Class description: mealone class Method signatures and docstrings: - def delete(meal_id): Deletes a meal from the database if it exists token is required to get admin Id - def put(meal_id): Allows admin to edit the meal details from the meals_list if it exists. to...
Implement the Python class `MealOne` described below. Class description: mealone class Method signatures and docstrings: - def delete(meal_id): Deletes a meal from the database if it exists token is required to get admin Id - def put(meal_id): Allows admin to edit the meal details from the meals_list if it exists. to...
eef5f2802c94e428412e2f9814a5dac85575ed8e
<|skeleton|> class MealOne: """mealone class""" def delete(meal_id): """Deletes a meal from the database if it exists token is required to get admin Id""" <|body_0|> def put(meal_id): """Allows admin to edit the meal details from the meals_list if it exists. token is required to ge...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MealOne: """mealone class""" def delete(meal_id): """Deletes a meal from the database if it exists token is required to get admin Id""" current_user = g.user meal = Meal.find_meal(meal_id, current_user) if not meal['status']: abort(http_status_code=400, message...
the_stack_v2_python_sparse
api/views/meal_views.py
magicmarie/book_a_meal
train
1
a58e738b54028b4973ded0540cf875ed30a7399d
[ "config = super(VarnishStatusCollector, self).get_default_config()\nconfig.update({'path': 'availability', 'bin': '/usr/bin/varnishtop'})\nreturn config", "group_by_type = {'2xx': 0, '3xx': 0, '4xx': 0, '5xx': 0}\ntotal = 0\nlines = self.poll()\nfor line in lines:\n parts = line.split()\n if len(parts) == 3...
<|body_start_0|> config = super(VarnishStatusCollector, self).get_default_config() config.update({'path': 'availability', 'bin': '/usr/bin/varnishtop'}) return config <|end_body_0|> <|body_start_1|> group_by_type = {'2xx': 0, '3xx': 0, '4xx': 0, '5xx': 0} total = 0 lines...
VarnishStatusCollector
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VarnishStatusCollector: def get_default_config(self): """Returns the default collector settings""" <|body_0|> def collect(self): """Publishes stats to the configured path. e.g. /deployment-prep/hostname/availability/# with one # for each http status code""" <...
stack_v2_sparse_classes_36k_train_012781
2,622
no_license
[ { "docstring": "Returns the default collector settings", "name": "get_default_config", "signature": "def get_default_config(self)" }, { "docstring": "Publishes stats to the configured path. e.g. /deployment-prep/hostname/availability/# with one # for each http status code", "name": "collect"...
3
null
Implement the Python class `VarnishStatusCollector` described below. Class description: Implement the VarnishStatusCollector class. Method signatures and docstrings: - def get_default_config(self): Returns the default collector settings - def collect(self): Publishes stats to the configured path. e.g. /deployment-pre...
Implement the Python class `VarnishStatusCollector` described below. Class description: Implement the VarnishStatusCollector class. Method signatures and docstrings: - def get_default_config(self): Returns the default collector settings - def collect(self): Publishes stats to the configured path. e.g. /deployment-pre...
75e0dd3698efa8e7cf95f6ef1348d16a299faa82
<|skeleton|> class VarnishStatusCollector: def get_default_config(self): """Returns the default collector settings""" <|body_0|> def collect(self): """Publishes stats to the configured path. e.g. /deployment-prep/hostname/availability/# with one # for each http status code""" <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VarnishStatusCollector: def get_default_config(self): """Returns the default collector settings""" config = super(VarnishStatusCollector, self).get_default_config() config.update({'path': 'availability', 'bin': '/usr/bin/varnishtop'}) return config def collect(self): ...
the_stack_v2_python_sparse
modules/diamond/files/collector/varnishstatus.py
dkuspawono/puppet
train
0
cb8fccecfb6c6a499dd7ae3fb7d5eeb30333f589
[ "if mec_controller.MecController.check_deployment(service_mec_server, extracted_service):\n mec_controller.MecController.deploy_service(service_mec_server, extracted_service)\nelse:\n mec_controller.MecController.deploy_service(service_mec_server, extracted_service)\n if not migration.service_migration(bas...
<|body_start_0|> if mec_controller.MecController.check_deployment(service_mec_server, extracted_service): mec_controller.MecController.deploy_service(service_mec_server, extracted_service) else: mec_controller.MecController.deploy_service(service_mec_server, extracted_service) ...
WorkloadController
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkloadController: def check_migration_demand(base_station_set: Dict[str, 'BaseStation'], mec_set: Dict[str, 'Mec'], hmds_set: Dict[str, 'VrHMD'], graph: 'Graph', service: 'VrService', extracted_service: 'VrService', service_mec_server: 'Mec', quota_copy: str, migration: 'Migration') -> None: ...
stack_v2_sparse_classes_36k_train_012782
5,608
no_license
[ { "docstring": "Checks whether a service fits on a mec server, otherwise, it checks the migration. If migration is not possible, it will revert the service to the previous service quota.", "name": "check_migration_demand", "signature": "def check_migration_demand(base_station_set: Dict[str, 'BaseStation...
3
null
Implement the Python class `WorkloadController` described below. Class description: Implement the WorkloadController class. Method signatures and docstrings: - def check_migration_demand(base_station_set: Dict[str, 'BaseStation'], mec_set: Dict[str, 'Mec'], hmds_set: Dict[str, 'VrHMD'], graph: 'Graph', service: 'VrSe...
Implement the Python class `WorkloadController` described below. Class description: Implement the WorkloadController class. Method signatures and docstrings: - def check_migration_demand(base_station_set: Dict[str, 'BaseStation'], mec_set: Dict[str, 'Mec'], hmds_set: Dict[str, 'VrHMD'], graph: 'Graph', service: 'VrSe...
e3e022a14058936619f1d79d11dbbb4f6f48d531
<|skeleton|> class WorkloadController: def check_migration_demand(base_station_set: Dict[str, 'BaseStation'], mec_set: Dict[str, 'Mec'], hmds_set: Dict[str, 'VrHMD'], graph: 'Graph', service: 'VrService', extracted_service: 'VrService', service_mec_server: 'Mec', quota_copy: str, migration: 'Migration') -> None: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WorkloadController: def check_migration_demand(base_station_set: Dict[str, 'BaseStation'], mec_set: Dict[str, 'Mec'], hmds_set: Dict[str, 'VrHMD'], graph: 'Graph', service: 'VrService', extracted_service: 'VrService', service_mec_server: 'Mec', quota_copy: str, migration: 'Migration') -> None: """Chec...
the_stack_v2_python_sparse
controllers/workload_controller.py
alissonpmedeiros/scg
train
0
521b86c34acf5b9486dd2c3ad8a7fc57cc2b664b
[ "if num_packs <= 0:\n raise ValueError('num_packs must be greater than zero.')\nself.num_packs = num_packs", "self.grouped_grads_and_vars = grouped_grads_and_vars\nself.all_tower_shapes = []\nself.all_tower_sizes = []\ndevice_grad_packs = []\nfor tower_grads_and_vars in grouped_grads_and_vars:\n with ops.co...
<|body_start_0|> if num_packs <= 0: raise ValueError('num_packs must be greater than zero.') self.num_packs = num_packs <|end_body_0|> <|body_start_1|> self.grouped_grads_and_vars = grouped_grads_and_vars self.all_tower_shapes = [] self.all_tower_sizes = [] d...
Concatenate and split tensors for reduction.
ConcatAndSplitPacker
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConcatAndSplitPacker: """Concatenate and split tensors for reduction.""" def __init__(self, num_packs=1): """Initialize the ConcatAndSplitPacker object. Args: num_packs: specifies the number of split packs that will be formed. Raises: ValueError: if num_packs is not greater than 0.""...
stack_v2_sparse_classes_36k_train_012783
22,363
permissive
[ { "docstring": "Initialize the ConcatAndSplitPacker object. Args: num_packs: specifies the number of split packs that will be formed. Raises: ValueError: if num_packs is not greater than 0.", "name": "__init__", "signature": "def __init__(self, num_packs=1)" }, { "docstring": "Pack tensors.", ...
3
stack_v2_sparse_classes_30k_train_015022
Implement the Python class `ConcatAndSplitPacker` described below. Class description: Concatenate and split tensors for reduction. Method signatures and docstrings: - def __init__(self, num_packs=1): Initialize the ConcatAndSplitPacker object. Args: num_packs: specifies the number of split packs that will be formed. ...
Implement the Python class `ConcatAndSplitPacker` described below. Class description: Concatenate and split tensors for reduction. Method signatures and docstrings: - def __init__(self, num_packs=1): Initialize the ConcatAndSplitPacker object. Args: num_packs: specifies the number of split packs that will be formed. ...
cabf6e4f1970dc14302f87414f170de19944bac2
<|skeleton|> class ConcatAndSplitPacker: """Concatenate and split tensors for reduction.""" def __init__(self, num_packs=1): """Initialize the ConcatAndSplitPacker object. Args: num_packs: specifies the number of split packs that will be formed. Raises: ValueError: if num_packs is not greater than 0.""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConcatAndSplitPacker: """Concatenate and split tensors for reduction.""" def __init__(self, num_packs=1): """Initialize the ConcatAndSplitPacker object. Args: num_packs: specifies the number of split packs that will be formed. Raises: ValueError: if num_packs is not greater than 0.""" if ...
the_stack_v2_python_sparse
Keras_tensorflow_nightly/source2.7/tensorflow/contrib/distribute/python/cross_tower_ops.py
ryfeus/lambda-packs
train
1,283
119116554190346cc09b8a920d32915a28fc52f2
[ "OutputPanelHandler.hide_panel()\noutput = ''\nworkspace_file = File.search('WORKSPACE', TreeSearchScope(path.dirname(view.file_name())))\nif not workspace_file:\n return None\ncmd = [path.join(PKG_FOLDER, 'external', 'bazel-compilation-database', 'generate.sh')]\noutput = Tools.run_command(cmd, cwd=workspace_fi...
<|body_start_0|> OutputPanelHandler.hide_panel() output = '' workspace_file = File.search('WORKSPACE', TreeSearchScope(path.dirname(view.file_name()))) if not workspace_file: return None cmd = [path.join(PKG_FOLDER, 'external', 'bazel-compilation-database', 'generate....
Collection of methods to generate a compilation database.
Bazel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Bazel: """Collection of methods to generate a compilation database.""" def generate_compdb(view): """Generate the compilation database.""" <|body_0|> def compdb_generated(future): """Generate a compilation database.""" <|body_1|> <|end_skeleton|> <|body...
stack_v2_sparse_classes_36k_train_012784
1,614
permissive
[ { "docstring": "Generate the compilation database.", "name": "generate_compdb", "signature": "def generate_compdb(view)" }, { "docstring": "Generate a compilation database.", "name": "compdb_generated", "signature": "def compdb_generated(future)" } ]
2
stack_v2_sparse_classes_30k_train_017379
Implement the Python class `Bazel` described below. Class description: Collection of methods to generate a compilation database. Method signatures and docstrings: - def generate_compdb(view): Generate the compilation database. - def compdb_generated(future): Generate a compilation database.
Implement the Python class `Bazel` described below. Class description: Collection of methods to generate a compilation database. Method signatures and docstrings: - def generate_compdb(view): Generate the compilation database. - def compdb_generated(future): Generate a compilation database. <|skeleton|> class Bazel:...
c2e8913052f4c9f11433f0a421fbbc4b78699fd6
<|skeleton|> class Bazel: """Collection of methods to generate a compilation database.""" def generate_compdb(view): """Generate the compilation database.""" <|body_0|> def compdb_generated(future): """Generate a compilation database.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Bazel: """Collection of methods to generate a compilation database.""" def generate_compdb(view): """Generate the compilation database.""" OutputPanelHandler.hide_panel() output = '' workspace_file = File.search('WORKSPACE', TreeSearchScope(path.dirname(view.file_name())))...
the_stack_v2_python_sparse
plugin/flags_sources/bazel.py
niosus/EasyClangComplete
train
677
a83fa557f878fa922738032bdcdccbc0f8d7e364
[ "if gr_pin not in [PMOD_GROVE_G1, PMOD_GROVE_G2, PMOD_GROVE_G3, PMOD_GROVE_G4]:\n raise ValueError('Group number can only be G1 - G4.')\nself.microblaze = Pmod(mb_info, PMOD_GROVE_EAR_HR_PROGRAM)\nself.microblaze.write_mailbox(0, gr_pin[0])\nself.microblaze.write_blocking_command(CONFIG_IOP_SWITCH)", "beats, i...
<|body_start_0|> if gr_pin not in [PMOD_GROVE_G1, PMOD_GROVE_G2, PMOD_GROVE_G3, PMOD_GROVE_G4]: raise ValueError('Group number can only be G1 - G4.') self.microblaze = Pmod(mb_info, PMOD_GROVE_EAR_HR_PROGRAM) self.microblaze.write_mailbox(0, gr_pin[0]) self.microblaze.write_b...
This class controls the Grove ear clip heart rate sensor. Sensor model: MED03212P. Attributes ---------- microblaze : Pmod Microblaze processor instance used by this module.
Grove_EarHR
[ "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Grove_EarHR: """This class controls the Grove ear clip heart rate sensor. Sensor model: MED03212P. Attributes ---------- microblaze : Pmod Microblaze processor instance used by this module.""" def __init__(self, mb_info, gr_pin): """Return a new instance of an Grove_EarHR object. Par...
stack_v2_sparse_classes_36k_train_012785
3,981
permissive
[ { "docstring": "Return a new instance of an Grove_EarHR object. Parameters ---------- mb_info : dict A dictionary storing Microblaze information, such as the IP name and the reset name. gr_pin: list A group of pins on pmod-grove adapter.", "name": "__init__", "signature": "def __init__(self, mb_info, gr...
3
stack_v2_sparse_classes_30k_val_000092
Implement the Python class `Grove_EarHR` described below. Class description: This class controls the Grove ear clip heart rate sensor. Sensor model: MED03212P. Attributes ---------- microblaze : Pmod Microblaze processor instance used by this module. Method signatures and docstrings: - def __init__(self, mb_info, gr_...
Implement the Python class `Grove_EarHR` described below. Class description: This class controls the Grove ear clip heart rate sensor. Sensor model: MED03212P. Attributes ---------- microblaze : Pmod Microblaze processor instance used by this module. Method signatures and docstrings: - def __init__(self, mb_info, gr_...
38e9fcee46f0839e83e123cf22af76b13671a574
<|skeleton|> class Grove_EarHR: """This class controls the Grove ear clip heart rate sensor. Sensor model: MED03212P. Attributes ---------- microblaze : Pmod Microblaze processor instance used by this module.""" def __init__(self, mb_info, gr_pin): """Return a new instance of an Grove_EarHR object. Par...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Grove_EarHR: """This class controls the Grove ear clip heart rate sensor. Sensor model: MED03212P. Attributes ---------- microblaze : Pmod Microblaze processor instance used by this module.""" def __init__(self, mb_info, gr_pin): """Return a new instance of an Grove_EarHR object. Parameters -----...
the_stack_v2_python_sparse
pynq/lib/pmod/pmod_grove_ear_hr.py
yunqu/PYNQ
train
8
dc88a450b52fcb40e235a7d2d8c0a9f1559b1732
[ "try:\n job = Job.objects.get(identifier=context.identifier)\n job.status = Job.STARTED\n job.started = datetime.now(utc)\n job.save()\n context.logger.info('Job started after %.3gs waiting.', (job.started - job.created).total_seconds())\nexcept Job.DoesNotExist:\n context.logger.warning('Failed t...
<|body_start_0|> try: job = Job.objects.get(identifier=context.identifier) job.status = Job.STARTED job.started = datetime.now(utc) job.save() context.logger.info('Job started after %.3gs waiting.', (job.started - job.created).total_seconds()) ...
Base asynchronous WPS process class.
AsyncProcessBase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AsyncProcessBase: """Base asynchronous WPS process class.""" def on_started(context, progress, message): """Callback executed when an asynchronous Job gets started.""" <|body_0|> def on_succeeded(context, outputs): """Callback executed when an asynchronous Job fi...
stack_v2_sparse_classes_36k_train_012786
22,253
no_license
[ { "docstring": "Callback executed when an asynchronous Job gets started.", "name": "on_started", "signature": "def on_started(context, progress, message)" }, { "docstring": "Callback executed when an asynchronous Job finishes.", "name": "on_succeeded", "signature": "def on_succeeded(cont...
5
stack_v2_sparse_classes_30k_train_013122
Implement the Python class `AsyncProcessBase` described below. Class description: Base asynchronous WPS process class. Method signatures and docstrings: - def on_started(context, progress, message): Callback executed when an asynchronous Job gets started. - def on_succeeded(context, outputs): Callback executed when a...
Implement the Python class `AsyncProcessBase` described below. Class description: Base asynchronous WPS process class. Method signatures and docstrings: - def on_started(context, progress, message): Callback executed when an asynchronous Job gets started. - def on_succeeded(context, outputs): Callback executed when a...
e75048c8607532d43e717d2a1d79a17fe9b0d1a1
<|skeleton|> class AsyncProcessBase: """Base asynchronous WPS process class.""" def on_started(context, progress, message): """Callback executed when an asynchronous Job gets started.""" <|body_0|> def on_succeeded(context, outputs): """Callback executed when an asynchronous Job fi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AsyncProcessBase: """Base asynchronous WPS process class.""" def on_started(context, progress, message): """Callback executed when an asynchronous Job gets started.""" try: job = Job.objects.get(identifier=context.identifier) job.status = Job.STARTED jo...
the_stack_v2_python_sparse
aeolus/processes/util/base.py
ESA-VirES/Aeolus-Server
train
2
68c8fb5e47ded6387ccdda8fbac0572394565315
[ "if k == len(num):\n return '0'\nfor _ in range(k):\n i, j = (0, 0)\n while j + 1 < len(num) and num[j + 1] >= num[j]:\n j += 1\n if num[i] > num[j]:\n num = num[i + 1:]\n else:\n num = num[:j] + num[j + 1:]\nnum = num.lstrip('0')\nreturn '0' if not num else num", "stk = []\ni ...
<|body_start_0|> if k == len(num): return '0' for _ in range(k): i, j = (0, 0) while j + 1 < len(num) and num[j + 1] >= num[j]: j += 1 if num[i] > num[j]: num = num[i + 1:] else: num = num[:j] + n...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def removeKdigits(self, num, k): """:type num: str :type k: int :rtype: str""" <|body_0|> def removeKdigits_stk_way(self, num, k): """:type num: str :type k: int :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> if k == len(num):...
stack_v2_sparse_classes_36k_train_012787
1,714
no_license
[ { "docstring": ":type num: str :type k: int :rtype: str", "name": "removeKdigits", "signature": "def removeKdigits(self, num, k)" }, { "docstring": ":type num: str :type k: int :rtype: str", "name": "removeKdigits_stk_way", "signature": "def removeKdigits_stk_way(self, num, k)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeKdigits(self, num, k): :type num: str :type k: int :rtype: str - def removeKdigits_stk_way(self, num, k): :type num: str :type k: int :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeKdigits(self, num, k): :type num: str :type k: int :rtype: str - def removeKdigits_stk_way(self, num, k): :type num: str :type k: int :rtype: str <|skeleton|> class So...
0e99f9a5226507706b3ee66fd04bae813755ef40
<|skeleton|> class Solution: def removeKdigits(self, num, k): """:type num: str :type k: int :rtype: str""" <|body_0|> def removeKdigits_stk_way(self, num, k): """:type num: str :type k: int :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def removeKdigits(self, num, k): """:type num: str :type k: int :rtype: str""" if k == len(num): return '0' for _ in range(k): i, j = (0, 0) while j + 1 < len(num) and num[j + 1] >= num[j]: j += 1 if num[i] > num...
the_stack_v2_python_sparse
medium/heapstack/test_402_Remove_K_Digits.py
wuxu1019/leetcode_sophia
train
1
4a65127aa2c7e14766a2aafc7c85c90b26793c55
[ "super(BehaviorAttackRanged, self).__init__(_move_cost)\nself.strength = _strength\nself.range = _range", "zap_x, zap_y = _level_view.ent_coords(_target_eid)\nadv_x, adv_y = _user.get_coords()\nin_los = Z_ALGS.check_los(zap_x, zap_y, adv_x, adv_y, self.range + 1, _level_view.cell_is_transparent)\nin_rng = Z_ALGS....
<|body_start_0|> super(BehaviorAttackRanged, self).__init__(_move_cost) self.strength = _strength self.range = _range <|end_body_0|> <|body_start_1|> zap_x, zap_y = _level_view.ent_coords(_target_eid) adv_x, adv_y = _user.get_coords() in_los = Z_ALGS.check_los(zap_x, zap...
BehaviorAttackRanged
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BehaviorAttackRanged: def __init__(self, _move_cost=1, _strength=1, _range=5): """:type _move_cost: int :type _strength: int :type _range: int""" <|body_0|> def _special_can_execute(self, _target_eid, _level_view, _user): """:type _target_eid: int :type _level_view: ...
stack_v2_sparse_classes_36k_train_012788
1,805
no_license
[ { "docstring": ":type _move_cost: int :type _strength: int :type _range: int", "name": "__init__", "signature": "def __init__(self, _move_cost=1, _strength=1, _range=5)" }, { "docstring": ":type _target_eid: int :type _level_view: level.LevelView.LevelView :type _user: entity.actor.Adversary.Adv...
3
stack_v2_sparse_classes_30k_train_007436
Implement the Python class `BehaviorAttackRanged` described below. Class description: Implement the BehaviorAttackRanged class. Method signatures and docstrings: - def __init__(self, _move_cost=1, _strength=1, _range=5): :type _move_cost: int :type _strength: int :type _range: int - def _special_can_execute(self, _ta...
Implement the Python class `BehaviorAttackRanged` described below. Class description: Implement the BehaviorAttackRanged class. Method signatures and docstrings: - def __init__(self, _move_cost=1, _strength=1, _range=5): :type _move_cost: int :type _strength: int :type _range: int - def _special_can_execute(self, _ta...
0342700b0edfeedd8e3a8c1fea9bd790d2b8a042
<|skeleton|> class BehaviorAttackRanged: def __init__(self, _move_cost=1, _strength=1, _range=5): """:type _move_cost: int :type _strength: int :type _range: int""" <|body_0|> def _special_can_execute(self, _target_eid, _level_view, _user): """:type _target_eid: int :type _level_view: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BehaviorAttackRanged: def __init__(self, _move_cost=1, _strength=1, _range=5): """:type _move_cost: int :type _strength: int :type _range: int""" super(BehaviorAttackRanged, self).__init__(_move_cost) self.strength = _strength self.range = _range def _special_can_execute(s...
the_stack_v2_python_sparse
Python_Zappy/entity/actor/behaviors/BehaviorAttackRanged.py
MoyTW/Zappy
train
0
b84ab33b94ac6099b0dcc0f00f9916f379d65306
[ "if type(data) is not np.ndarray or len(data.shape) != 2:\n raise TypeError('data must be a 2D numpy.ndarray')\nd, n = data.shape\nif n < 2:\n raise ValueError('data must contain multiple data points')\nself.mean = np.mean(data, axis=1, keepdims=True)\nself.n = n\nself.d = d\nself.data = data\nself.stdev = np...
<|body_start_0|> if type(data) is not np.ndarray or len(data.shape) != 2: raise TypeError('data must be a 2D numpy.ndarray') d, n = data.shape if n < 2: raise ValueError('data must contain multiple data points') self.mean = np.mean(data, axis=1, keepdims=True) ...
Represents multivariate normal distribution
MultiNormal
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiNormal: """Represents multivariate normal distribution""" def __init__(self, data): """data ndarray (d, n) n # data points, d # dims""" <|body_0|> def pdf(self, x): """calculates pdf at data point x ndarray (d, 1) data point to calculate pdf d # dims of mult...
stack_v2_sparse_classes_36k_train_012789
2,245
no_license
[ { "docstring": "data ndarray (d, n) n # data points, d # dims", "name": "__init__", "signature": "def __init__(self, data)" }, { "docstring": "calculates pdf at data point x ndarray (d, 1) data point to calculate pdf d # dims of multinomial instance Returns: value of pdf", "name": "pdf", ...
2
null
Implement the Python class `MultiNormal` described below. Class description: Represents multivariate normal distribution Method signatures and docstrings: - def __init__(self, data): data ndarray (d, n) n # data points, d # dims - def pdf(self, x): calculates pdf at data point x ndarray (d, 1) data point to calculate...
Implement the Python class `MultiNormal` described below. Class description: Represents multivariate normal distribution Method signatures and docstrings: - def __init__(self, data): data ndarray (d, n) n # data points, d # dims - def pdf(self, x): calculates pdf at data point x ndarray (d, 1) data point to calculate...
5114f884241b3406940b00450d8c71f55d5d6a70
<|skeleton|> class MultiNormal: """Represents multivariate normal distribution""" def __init__(self, data): """data ndarray (d, n) n # data points, d # dims""" <|body_0|> def pdf(self, x): """calculates pdf at data point x ndarray (d, 1) data point to calculate pdf d # dims of mult...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiNormal: """Represents multivariate normal distribution""" def __init__(self, data): """data ndarray (d, n) n # data points, d # dims""" if type(data) is not np.ndarray or len(data.shape) != 2: raise TypeError('data must be a 2D numpy.ndarray') d, n = data.shape ...
the_stack_v2_python_sparse
math/0x06-multivariate_prob/multinormal.py
icculp/holbertonschool-machine_learning
train
0
df9c6379631b6ece15592df0ac426a797e1e9478
[ "self.ai_settings = ai_settings\ntry:\n with open('high_score.txt') as f:\n high_score = f.read()\n self.high_score = int(high_score) if high_score else 0\nexcept FileNotFoundError:\n self.high_score = 0\nself.reset_stats()\nself.game_active = False", "self.ships_left = self.ai_settings.ship_l...
<|body_start_0|> self.ai_settings = ai_settings try: with open('high_score.txt') as f: high_score = f.read() self.high_score = int(high_score) if high_score else 0 except FileNotFoundError: self.high_score = 0 self.reset_stats() ...
跟踪游戏的统计信息
GameStats
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GameStats: """跟踪游戏的统计信息""" def __init__(self, ai_settings): """初始化统计信息""" <|body_0|> def reset_stats(self): """初始化在游戏运行期间可能变化的统计信息""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.ai_settings = ai_settings try: with open(...
stack_v2_sparse_classes_36k_train_012790
670
no_license
[ { "docstring": "初始化统计信息", "name": "__init__", "signature": "def __init__(self, ai_settings)" }, { "docstring": "初始化在游戏运行期间可能变化的统计信息", "name": "reset_stats", "signature": "def reset_stats(self)" } ]
2
null
Implement the Python class `GameStats` described below. Class description: 跟踪游戏的统计信息 Method signatures and docstrings: - def __init__(self, ai_settings): 初始化统计信息 - def reset_stats(self): 初始化在游戏运行期间可能变化的统计信息
Implement the Python class `GameStats` described below. Class description: 跟踪游戏的统计信息 Method signatures and docstrings: - def __init__(self, ai_settings): 初始化统计信息 - def reset_stats(self): 初始化在游戏运行期间可能变化的统计信息 <|skeleton|> class GameStats: """跟踪游戏的统计信息""" def __init__(self, ai_settings): """初始化统计信息""" ...
916a3269cb3946f33bc87b289c5f20f26c265436
<|skeleton|> class GameStats: """跟踪游戏的统计信息""" def __init__(self, ai_settings): """初始化统计信息""" <|body_0|> def reset_stats(self): """初始化在游戏运行期间可能变化的统计信息""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GameStats: """跟踪游戏的统计信息""" def __init__(self, ai_settings): """初始化统计信息""" self.ai_settings = ai_settings try: with open('high_score.txt') as f: high_score = f.read() self.high_score = int(high_score) if high_score else 0 except F...
the_stack_v2_python_sparse
Python编程从入门到实践/alien_invasion/game_stats.py
daedalaus/practice
train
0
1702641cb99fbc8e9025526995d600323caa8558
[ "if not args:\n args = ('',)\napps = self.catalog_apps(cherrypy.tree.apps, args[0] == 'all')\nif cherrypy.request.wants == 'org':\n checklist = (f'- [ ] {name}' for name, _, _ in apps)\n return '\\n'.join(checklist).encode()\nreturn cherrypy.engine.publish('jinja:render', 'apps/homepage/homepage.jinja.html...
<|body_start_0|> if not args: args = ('',) apps = self.catalog_apps(cherrypy.tree.apps, args[0] == 'all') if cherrypy.request.wants == 'org': checklist = (f'- [ ] {name}' for name, _, _ in apps) return '\n'.join(checklist).encode() return cherrypy.engi...
Controller
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Controller: def GET(self, *args: str, **_kwargs: str) -> bytes: """List all available applications. Apps can be excluded from this list by setting show_on_homepage to False.""" <|body_0|> def catalog_apps(apps: Dict[str, cherrypy.Application], show_all: bool=True) -> List[Tu...
stack_v2_sparse_classes_36k_train_012791
2,402
no_license
[ { "docstring": "List all available applications. Apps can be excluded from this list by setting show_on_homepage to False.", "name": "GET", "signature": "def GET(self, *args: str, **_kwargs: str) -> bytes" }, { "docstring": "Extract app summaries from module docstrings.", "name": "catalog_ap...
2
null
Implement the Python class `Controller` described below. Class description: Implement the Controller class. Method signatures and docstrings: - def GET(self, *args: str, **_kwargs: str) -> bytes: List all available applications. Apps can be excluded from this list by setting show_on_homepage to False. - def catalog_a...
Implement the Python class `Controller` described below. Class description: Implement the Controller class. Method signatures and docstrings: - def GET(self, *args: str, **_kwargs: str) -> bytes: List all available applications. Apps can be excluded from this list by setting show_on_homepage to False. - def catalog_a...
7129415303b94d5d10b2c29ec432f0c7d41cc651
<|skeleton|> class Controller: def GET(self, *args: str, **_kwargs: str) -> bytes: """List all available applications. Apps can be excluded from this list by setting show_on_homepage to False.""" <|body_0|> def catalog_apps(apps: Dict[str, cherrypy.Application], show_all: bool=True) -> List[Tu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Controller: def GET(self, *args: str, **_kwargs: str) -> bytes: """List all available applications. Apps can be excluded from this list by setting show_on_homepage to False.""" if not args: args = ('',) apps = self.catalog_apps(cherrypy.tree.apps, args[0] == 'all') ...
the_stack_v2_python_sparse
apps/homepage/main.py
lovett/medley
train
6
f96a5f183c0fc2c46190ada3e960a5908db37d6b
[ "name = 'rc_wiki.preprocessed'\ndescription = _RC_DESCRIPTION\nsuper(BigBirdTriviaQAConfig, self).__init__(name=name, description=description, version=tfds.core.Version('1.1.1'), **kwargs)\nself.unfiltered = False\nself.exclude_context = False", "self.sentencepiece_model_path = sentencepiece_model_path\nself.sequ...
<|body_start_0|> name = 'rc_wiki.preprocessed' description = _RC_DESCRIPTION super(BigBirdTriviaQAConfig, self).__init__(name=name, description=description, version=tfds.core.Version('1.1.1'), **kwargs) self.unfiltered = False self.exclude_context = False <|end_body_0|> <|body_s...
BuilderConfig for TriviaQA.
BigBirdTriviaQAConfig
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BigBirdTriviaQAConfig: """BuilderConfig for TriviaQA.""" def __init__(self, **kwargs): """BuilderConfig for TriviaQA. Args: **kwargs: keyword arguments forwarded to super.""" <|body_0|> def configure(self, sentencepiece_model_path, sequence_length, stride, global_sequenc...
stack_v2_sparse_classes_36k_train_012792
16,324
permissive
[ { "docstring": "BuilderConfig for TriviaQA. Args: **kwargs: keyword arguments forwarded to super.", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "Configures additional user-specified arguments.", "name": "configure", "signature": "def configure(self, ...
3
stack_v2_sparse_classes_30k_train_007581
Implement the Python class `BigBirdTriviaQAConfig` described below. Class description: BuilderConfig for TriviaQA. Method signatures and docstrings: - def __init__(self, **kwargs): BuilderConfig for TriviaQA. Args: **kwargs: keyword arguments forwarded to super. - def configure(self, sentencepiece_model_path, sequenc...
Implement the Python class `BigBirdTriviaQAConfig` described below. Class description: BuilderConfig for TriviaQA. Method signatures and docstrings: - def __init__(self, **kwargs): BuilderConfig for TriviaQA. Args: **kwargs: keyword arguments forwarded to super. - def configure(self, sentencepiece_model_path, sequenc...
6fc53292b1d3ce3c0340ce724c2c11c77e663d27
<|skeleton|> class BigBirdTriviaQAConfig: """BuilderConfig for TriviaQA.""" def __init__(self, **kwargs): """BuilderConfig for TriviaQA. Args: **kwargs: keyword arguments forwarded to super.""" <|body_0|> def configure(self, sentencepiece_model_path, sequence_length, stride, global_sequenc...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BigBirdTriviaQAConfig: """BuilderConfig for TriviaQA.""" def __init__(self, **kwargs): """BuilderConfig for TriviaQA. Args: **kwargs: keyword arguments forwarded to super.""" name = 'rc_wiki.preprocessed' description = _RC_DESCRIPTION super(BigBirdTriviaQAConfig, self).__i...
the_stack_v2_python_sparse
models/official/nlp/projects/triviaqa/dataset.py
aboerzel/German_License_Plate_Recognition
train
34
a47037dcdc96c63b2f885c7750f80f258c15760c
[ "self._data = data\nself._attr_name = name\nself._attr_native_value = None\nself._type = sensor_type\nself._attr_native_unit_of_measurement = sensor_unit\nself._attr_device_class = device_class\nself._attr_state_class = state_class", "self._data.update()\nself._attr_native_value = self._data.get_value(self._type)...
<|body_start_0|> self._data = data self._attr_name = name self._attr_native_value = None self._type = sensor_type self._attr_native_unit_of_measurement = sensor_unit self._attr_device_class = device_class self._attr_state_class = state_class <|end_body_0|> <|body...
Representation of a Sensor.
DanfossAir
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DanfossAir: """Representation of a Sensor.""" def __init__(self, data, name, sensor_unit, sensor_type, device_class, state_class): """Initialize the sensor.""" <|body_0|> def update(self) -> None: """Update the new state of the sensor. This is done through the Da...
stack_v2_sparse_classes_36k_train_012793
3,911
permissive
[ { "docstring": "Initialize the sensor.", "name": "__init__", "signature": "def __init__(self, data, name, sensor_unit, sensor_type, device_class, state_class)" }, { "docstring": "Update the new state of the sensor. This is done through the DanfossAir object that does the actual communication wit...
2
null
Implement the Python class `DanfossAir` described below. Class description: Representation of a Sensor. Method signatures and docstrings: - def __init__(self, data, name, sensor_unit, sensor_type, device_class, state_class): Initialize the sensor. - def update(self) -> None: Update the new state of the sensor. This i...
Implement the Python class `DanfossAir` described below. Class description: Representation of a Sensor. Method signatures and docstrings: - def __init__(self, data, name, sensor_unit, sensor_type, device_class, state_class): Initialize the sensor. - def update(self) -> None: Update the new state of the sensor. This i...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class DanfossAir: """Representation of a Sensor.""" def __init__(self, data, name, sensor_unit, sensor_type, device_class, state_class): """Initialize the sensor.""" <|body_0|> def update(self) -> None: """Update the new state of the sensor. This is done through the Da...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DanfossAir: """Representation of a Sensor.""" def __init__(self, data, name, sensor_unit, sensor_type, device_class, state_class): """Initialize the sensor.""" self._data = data self._attr_name = name self._attr_native_value = None self._type = sensor_type ...
the_stack_v2_python_sparse
homeassistant/components/danfoss_air/sensor.py
home-assistant/core
train
35,501
963bb5e374f6f7d04809626b0bfa6e55f2daa0fc
[ "self.raidus = radius\nself.x = x_center\nself.y = y_center", "r = self.raidus * math.sqrt(random.random())\ntheta = 2 * math.pi * random.random()\nreturn [self.x + r * math.cos(theta), self.y + r * math.sin(theta)]" ]
<|body_start_0|> self.raidus = radius self.x = x_center self.y = y_center <|end_body_0|> <|body_start_1|> r = self.raidus * math.sqrt(random.random()) theta = 2 * math.pi * random.random() return [self.x + r * math.cos(theta), self.y + r * math.sin(theta)] <|end_body_1|>...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, radius, x_center, y_center): """:type radius: float :type x_center: float :type y_center: float""" <|body_0|> def randPoint(self): """:rtype: List[float]""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.raidus = radi...
stack_v2_sparse_classes_36k_train_012794
2,360
no_license
[ { "docstring": ":type radius: float :type x_center: float :type y_center: float", "name": "__init__", "signature": "def __init__(self, radius, x_center, y_center)" }, { "docstring": ":rtype: List[float]", "name": "randPoint", "signature": "def randPoint(self)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, radius, x_center, y_center): :type radius: float :type x_center: float :type y_center: float - def randPoint(self): :rtype: List[float]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, radius, x_center, y_center): :type radius: float :type x_center: float :type y_center: float - def randPoint(self): :rtype: List[float] <|skeleton|> class Sol...
8595b04cf5a024c2cd8a97f750d890a818568401
<|skeleton|> class Solution: def __init__(self, radius, x_center, y_center): """:type radius: float :type x_center: float :type y_center: float""" <|body_0|> def randPoint(self): """:rtype: List[float]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, radius, x_center, y_center): """:type radius: float :type x_center: float :type y_center: float""" self.raidus = radius self.x = x_center self.y = y_center def randPoint(self): """:rtype: List[float]""" r = self.raidus * math.sq...
the_stack_v2_python_sparse
python/478.generate-random-point-in-a-circle.py
tainenko/Leetcode2019
train
5
e485d15ba9140bb22e30b9c72e18bd6fd5a8b19a
[ "super(LayerNorm, self).__init__()\nself.weight = self.set_parameters('gamma', ones(hidden_size))\nself.bias = self.set_parameters('beta', zeros(hidden_size))\nself.variance_epsilon = eps", "u = x.mean(-1, keepdim=True)\ns = (x - u).pow(2).mean(-1, keepdim=True)\nx = (x - u) / sqrt(s + self.variance_epsilon)\nret...
<|body_start_0|> super(LayerNorm, self).__init__() self.weight = self.set_parameters('gamma', ones(hidden_size)) self.bias = self.set_parameters('beta', zeros(hidden_size)) self.variance_epsilon = eps <|end_body_0|> <|body_start_1|> u = x.mean(-1, keepdim=True) s = (x - ...
Layer Norm module.
LayerNorm
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LayerNorm: """Layer Norm module.""" def __init__(self, hidden_size, eps=1e-12): """Construct a layernorm module in the TF style (epsilon inside the square root).""" <|body_0|> def call(self, x): """Call LayerNorm.""" <|body_1|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_36k_train_012795
25,894
permissive
[ { "docstring": "Construct a layernorm module in the TF style (epsilon inside the square root).", "name": "__init__", "signature": "def __init__(self, hidden_size, eps=1e-12)" }, { "docstring": "Call LayerNorm.", "name": "call", "signature": "def call(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_007045
Implement the Python class `LayerNorm` described below. Class description: Layer Norm module. Method signatures and docstrings: - def __init__(self, hidden_size, eps=1e-12): Construct a layernorm module in the TF style (epsilon inside the square root). - def call(self, x): Call LayerNorm.
Implement the Python class `LayerNorm` described below. Class description: Layer Norm module. Method signatures and docstrings: - def __init__(self, hidden_size, eps=1e-12): Construct a layernorm module in the TF style (epsilon inside the square root). - def call(self, x): Call LayerNorm. <|skeleton|> class LayerNor...
e4ef3a1c92d19d1d08c3ef0e2156b6fecefdbe04
<|skeleton|> class LayerNorm: """Layer Norm module.""" def __init__(self, hidden_size, eps=1e-12): """Construct a layernorm module in the TF style (epsilon inside the square root).""" <|body_0|> def call(self, x): """Call LayerNorm.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LayerNorm: """Layer Norm module.""" def __init__(self, hidden_size, eps=1e-12): """Construct a layernorm module in the TF style (epsilon inside the square root).""" super(LayerNorm, self).__init__() self.weight = self.set_parameters('gamma', ones(hidden_size)) self.bias = ...
the_stack_v2_python_sparse
zeus/modules/operators/functions/pytorch_fn.py
huawei-noah/xingtian
train
308
e49fa94a3b9a59cf82ec296590b2156bf9e74624
[ "self.username = ''\nself.password = ''\nself.baseUrl = 'http://{0}:{1}/'.format(hostname, port)", "api = self.baseUrl + 'init'\ntry:\n return self._http_request(api, 'GET', timeout=30)\nexcept ServerUnavailableException:\n print('Dashboard is not available... bypassing.')\n return (False, None)", "api...
<|body_start_0|> self.username = '' self.password = '' self.baseUrl = 'http://{0}:{1}/'.format(hostname, port) <|end_body_0|> <|body_start_1|> api = self.baseUrl + 'init' try: return self._http_request(api, 'GET', timeout=30) except ServerUnavailableException...
Performance dashboard (cbkarma) REST API
CbKarmaClient
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CbKarmaClient: """Performance dashboard (cbkarma) REST API""" def __init__(self, hostname, port='80'): """Create REST API client. Keyword arguments: hostname -- dashboard hostname/ip address port -- dashboard port""" <|body_0|> def init(self): """Get initial test...
stack_v2_sparse_classes_36k_train_012796
2,862
permissive
[ { "docstring": "Create REST API client. Keyword arguments: hostname -- dashboard hostname/ip address port -- dashboard port", "name": "__init__", "signature": "def __init__(self, hostname, port='80')" }, { "docstring": "Get initial test id (optional)", "name": "init", "signature": "def i...
5
stack_v2_sparse_classes_30k_train_011738
Implement the Python class `CbKarmaClient` described below. Class description: Performance dashboard (cbkarma) REST API Method signatures and docstrings: - def __init__(self, hostname, port='80'): Create REST API client. Keyword arguments: hostname -- dashboard hostname/ip address port -- dashboard port - def init(se...
Implement the Python class `CbKarmaClient` described below. Class description: Performance dashboard (cbkarma) REST API Method signatures and docstrings: - def __init__(self, hostname, port='80'): Create REST API client. Keyword arguments: hostname -- dashboard hostname/ip address port -- dashboard port - def init(se...
9d8220a0925327bddf0e10887e22b57c5d6adb37
<|skeleton|> class CbKarmaClient: """Performance dashboard (cbkarma) REST API""" def __init__(self, hostname, port='80'): """Create REST API client. Keyword arguments: hostname -- dashboard hostname/ip address port -- dashboard port""" <|body_0|> def init(self): """Get initial test...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CbKarmaClient: """Performance dashboard (cbkarma) REST API""" def __init__(self, hostname, port='80'): """Create REST API client. Keyword arguments: hostname -- dashboard hostname/ip address port -- dashboard port""" self.username = '' self.password = '' self.baseUrl = 'ht...
the_stack_v2_python_sparse
lib/cbkarma/rest_client.py
couchbase/testrunner
train
18
732e8bc2fa1a8d8fafffd9ec5afce24978bf6fe4
[ "if numRows == 1 or numRows >= len(s):\n return s\ndelta = -1\nrow = 0\nres = [[] for i in range(numRows)]\nfor c in s:\n res[row].append(c)\n if row == 0 or row == numRows - 1:\n delta *= -1\n row += delta\nfor i in range(len(res)):\n res[i] = ''.join(res[i])\nreturn ''.join(res)", "if numR...
<|body_start_0|> if numRows == 1 or numRows >= len(s): return s delta = -1 row = 0 res = [[] for i in range(numRows)] for c in s: res[row].append(c) if row == 0 or row == numRows - 1: delta *= -1 row += delta ...
Solution1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution1: def convert(self, s: str, numRows: int) -> str: """Approach 1 : Time: O( n+k < n+n <2n ) = O(n) Space: O(n) :type s: str :type numRows: int :rtype: str""" <|body_0|> def convert2(self, s: str, numRows: int) -> str: """Approach 2 : if numRows=4 row 0 ==> 0 ...
stack_v2_sparse_classes_36k_train_012797
1,659
no_license
[ { "docstring": "Approach 1 : Time: O( n+k < n+n <2n ) = O(n) Space: O(n) :type s: str :type numRows: int :rtype: str", "name": "convert", "signature": "def convert(self, s: str, numRows: int) -> str" }, { "docstring": "Approach 2 : if numRows=4 row 0 ==> 0 6 12 ... 0 +6 +6 row 1 ==> 1 5 7 13 ......
2
stack_v2_sparse_classes_30k_train_013720
Implement the Python class `Solution1` described below. Class description: Implement the Solution1 class. Method signatures and docstrings: - def convert(self, s: str, numRows: int) -> str: Approach 1 : Time: O( n+k < n+n <2n ) = O(n) Space: O(n) :type s: str :type numRows: int :rtype: str - def convert2(self, s: str...
Implement the Python class `Solution1` described below. Class description: Implement the Solution1 class. Method signatures and docstrings: - def convert(self, s: str, numRows: int) -> str: Approach 1 : Time: O( n+k < n+n <2n ) = O(n) Space: O(n) :type s: str :type numRows: int :rtype: str - def convert2(self, s: str...
f1b466a5f2ffc9ff00a0d9895bda145eb3c7db54
<|skeleton|> class Solution1: def convert(self, s: str, numRows: int) -> str: """Approach 1 : Time: O( n+k < n+n <2n ) = O(n) Space: O(n) :type s: str :type numRows: int :rtype: str""" <|body_0|> def convert2(self, s: str, numRows: int) -> str: """Approach 2 : if numRows=4 row 0 ==> 0 ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution1: def convert(self, s: str, numRows: int) -> str: """Approach 1 : Time: O( n+k < n+n <2n ) = O(n) Space: O(n) :type s: str :type numRows: int :rtype: str""" if numRows == 1 or numRows >= len(s): return s delta = -1 row = 0 res = [[] for i in range(n...
the_stack_v2_python_sparse
LeetCode_exercises/ex0006_zigZag_conversion.py
msjithin/LeetCode_exercises
train
0
eac5417971633ce3a2982c832dd850dc619b8617
[ "super().__init__(coordinator)\nself._attr_device_info = DeviceInfo(entry_type=DeviceEntryType.SERVICE, identifiers={(DOMAIN, f'{coordinator.latitude}-{coordinator.longitude}')}, manufacturer=MANUFACTURER, name=name, configuration_url=URL.format(latitude=coordinator.latitude, longitude=coordinator.longitude))\nself...
<|body_start_0|> super().__init__(coordinator) self._attr_device_info = DeviceInfo(entry_type=DeviceEntryType.SERVICE, identifiers={(DOMAIN, f'{coordinator.latitude}-{coordinator.longitude}')}, manufacturer=MANUFACTURER, name=name, configuration_url=URL.format(latitude=coordinator.latitude, longitude=co...
Define an Airly sensor.
AirlySensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AirlySensor: """Define an Airly sensor.""" def __init__(self, coordinator: AirlyDataUpdateCoordinator, name: str, description: AirlySensorEntityDescription) -> None: """Initialize.""" <|body_0|> def _handle_coordinator_update(self) -> None: """Handle updated data...
stack_v2_sparse_classes_36k_train_012798
7,989
permissive
[ { "docstring": "Initialize.", "name": "__init__", "signature": "def __init__(self, coordinator: AirlyDataUpdateCoordinator, name: str, description: AirlySensorEntityDescription) -> None" }, { "docstring": "Handle updated data from the coordinator.", "name": "_handle_coordinator_update", ...
2
stack_v2_sparse_classes_30k_train_013912
Implement the Python class `AirlySensor` described below. Class description: Define an Airly sensor. Method signatures and docstrings: - def __init__(self, coordinator: AirlyDataUpdateCoordinator, name: str, description: AirlySensorEntityDescription) -> None: Initialize. - def _handle_coordinator_update(self) -> None...
Implement the Python class `AirlySensor` described below. Class description: Define an Airly sensor. Method signatures and docstrings: - def __init__(self, coordinator: AirlyDataUpdateCoordinator, name: str, description: AirlySensorEntityDescription) -> None: Initialize. - def _handle_coordinator_update(self) -> None...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class AirlySensor: """Define an Airly sensor.""" def __init__(self, coordinator: AirlyDataUpdateCoordinator, name: str, description: AirlySensorEntityDescription) -> None: """Initialize.""" <|body_0|> def _handle_coordinator_update(self) -> None: """Handle updated data...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AirlySensor: """Define an Airly sensor.""" def __init__(self, coordinator: AirlyDataUpdateCoordinator, name: str, description: AirlySensorEntityDescription) -> None: """Initialize.""" super().__init__(coordinator) self._attr_device_info = DeviceInfo(entry_type=DeviceEntryType.SERV...
the_stack_v2_python_sparse
homeassistant/components/airly/sensor.py
home-assistant/core
train
35,501
69dc2a79424eeff834d1ab01797bba91455f5304
[ "super().__init__(parent)\nself.parent = parent\nself.setViewMode(QListView.ViewMode.IconMode)\nself.setTextElideMode(Qt.TextElideMode.ElideMiddle)\nself.setResizeMode(QListView.ResizeMode.Adjust)\nself.setGridSize(QSize(110, 110))\nself.setLayoutMode(QListView.LayoutMode.Batched)\nself.setBatchSize(20)\nself.setSe...
<|body_start_0|> super().__init__(parent) self.parent = parent self.setViewMode(QListView.ViewMode.IconMode) self.setTextElideMode(Qt.TextElideMode.ElideMiddle) self.setResizeMode(QListView.ResizeMode.Adjust) self.setGridSize(QSize(110, 110)) self.setLayoutMode(QL...
ImageViewerListWidget
[ "GPL-3.0-only", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageViewerListWidget: def __init__(self, parent): """Subclassed QListWidget that displays images""" <|body_0|> def contextMenuEvent(self, event): """A simple context menu for managing images.""" <|body_1|> <|end_skeleton|> <|body_start_0|> super()....
stack_v2_sparse_classes_36k_train_012799
1,542
permissive
[ { "docstring": "Subclassed QListWidget that displays images", "name": "__init__", "signature": "def __init__(self, parent)" }, { "docstring": "A simple context menu for managing images.", "name": "contextMenuEvent", "signature": "def contextMenuEvent(self, event)" } ]
2
stack_v2_sparse_classes_30k_train_015644
Implement the Python class `ImageViewerListWidget` described below. Class description: Implement the ImageViewerListWidget class. Method signatures and docstrings: - def __init__(self, parent): Subclassed QListWidget that displays images - def contextMenuEvent(self, event): A simple context menu for managing images.
Implement the Python class `ImageViewerListWidget` described below. Class description: Implement the ImageViewerListWidget class. Method signatures and docstrings: - def __init__(self, parent): Subclassed QListWidget that displays images - def contextMenuEvent(self, event): A simple context menu for managing images. ...
6edbecdb422b10881216c310e70796c5cc3c9d04
<|skeleton|> class ImageViewerListWidget: def __init__(self, parent): """Subclassed QListWidget that displays images""" <|body_0|> def contextMenuEvent(self, event): """A simple context menu for managing images.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImageViewerListWidget: def __init__(self, parent): """Subclassed QListWidget that displays images""" super().__init__(parent) self.parent = parent self.setViewMode(QListView.ViewMode.IconMode) self.setTextElideMode(Qt.TextElideMode.ElideMiddle) self.setResizeMod...
the_stack_v2_python_sparse
Chapter02/ImageManager/image_manager/widgets/image_viewer.py
ralex1975/Building-Custom-UIs-with-PyQt
train
1