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
19c9d6670c6470200754dd4162626f3fa2074e1f
[ "document = upload_file(self.request)\ndocument.author = self.request.authenticated_role\nself.context.documents.append(document)\nif save_tender(self.request):\n self.LOGGER.info('Created tender complaint document {}'.format(document.id), extra=context_unpack(self.request, {'MESSAGE_ID': 'tender_complaint_docum...
<|body_start_0|> document = upload_file(self.request) document.author = self.request.authenticated_role self.context.documents.append(document) if save_tender(self.request): self.LOGGER.info('Created tender complaint document {}'.format(document.id), extra=context_unpack(self...
TenderUaComplaintDocumentResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TenderUaComplaintDocumentResource: def collection_post(self): """Tender Complaint Document Upload""" <|body_0|> def put(self): """Tender Complaint Document Update""" <|body_1|> def patch(self): """Tender Complaint Document Update""" <|bod...
stack_v2_sparse_classes_36k_train_021700
4,121
permissive
[ { "docstring": "Tender Complaint Document Upload", "name": "collection_post", "signature": "def collection_post(self)" }, { "docstring": "Tender Complaint Document Update", "name": "put", "signature": "def put(self)" }, { "docstring": "Tender Complaint Document Update", "name...
3
stack_v2_sparse_classes_30k_train_010979
Implement the Python class `TenderUaComplaintDocumentResource` described below. Class description: Implement the TenderUaComplaintDocumentResource class. Method signatures and docstrings: - def collection_post(self): Tender Complaint Document Upload - def put(self): Tender Complaint Document Update - def patch(self):...
Implement the Python class `TenderUaComplaintDocumentResource` described below. Class description: Implement the TenderUaComplaintDocumentResource class. Method signatures and docstrings: - def collection_post(self): Tender Complaint Document Upload - def put(self): Tender Complaint Document Update - def patch(self):...
5afdd3a62a8e562cf77e2d963d88f1a26613d16a
<|skeleton|> class TenderUaComplaintDocumentResource: def collection_post(self): """Tender Complaint Document Upload""" <|body_0|> def put(self): """Tender Complaint Document Update""" <|body_1|> def patch(self): """Tender Complaint Document Update""" <|bod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TenderUaComplaintDocumentResource: def collection_post(self): """Tender Complaint Document Upload""" document = upload_file(self.request) document.author = self.request.authenticated_role self.context.documents.append(document) if save_tender(self.request): ...
the_stack_v2_python_sparse
src/openprocurement/tender/openua/views/complaint_document.py
pontostroy/api
train
0
bbbb5df67869c761153f14db40245224156b974a
[ "result = empty_result()\nresult['data'] = {'mgmtdomains': []}\nwith sqla_session() as session:\n instance = session.query(Mgmtdomain).filter(Mgmtdomain.id == mgmtdomain_id).one_or_none()\n if instance:\n result['data']['mgmtdomains'].append(instance.as_dict())\n else:\n return (empty_result(...
<|body_start_0|> result = empty_result() result['data'] = {'mgmtdomains': []} with sqla_session() as session: instance = session.query(Mgmtdomain).filter(Mgmtdomain.id == mgmtdomain_id).one_or_none() if instance: result['data']['mgmtdomains'].append(instan...
MgmtdomainByIdApi
[ "BSD-2-Clause-Views", "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MgmtdomainByIdApi: def get(self, mgmtdomain_id): """Get management domain by ID""" <|body_0|> def delete(self, mgmtdomain_id): """Remove management domain""" <|body_1|> def put(self, mgmtdomain_id): """Modify management domain""" <|body_2...
stack_v2_sparse_classes_36k_train_021701
9,692
permissive
[ { "docstring": "Get management domain by ID", "name": "get", "signature": "def get(self, mgmtdomain_id)" }, { "docstring": "Remove management domain", "name": "delete", "signature": "def delete(self, mgmtdomain_id)" }, { "docstring": "Modify management domain", "name": "put",...
3
null
Implement the Python class `MgmtdomainByIdApi` described below. Class description: Implement the MgmtdomainByIdApi class. Method signatures and docstrings: - def get(self, mgmtdomain_id): Get management domain by ID - def delete(self, mgmtdomain_id): Remove management domain - def put(self, mgmtdomain_id): Modify man...
Implement the Python class `MgmtdomainByIdApi` described below. Class description: Implement the MgmtdomainByIdApi class. Method signatures and docstrings: - def get(self, mgmtdomain_id): Get management domain by ID - def delete(self, mgmtdomain_id): Remove management domain - def put(self, mgmtdomain_id): Modify man...
d755dfed69bebe0c7bea66ad1802cba2cd89fec8
<|skeleton|> class MgmtdomainByIdApi: def get(self, mgmtdomain_id): """Get management domain by ID""" <|body_0|> def delete(self, mgmtdomain_id): """Remove management domain""" <|body_1|> def put(self, mgmtdomain_id): """Modify management domain""" <|body_2...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MgmtdomainByIdApi: def get(self, mgmtdomain_id): """Get management domain by ID""" result = empty_result() result['data'] = {'mgmtdomains': []} with sqla_session() as session: instance = session.query(Mgmtdomain).filter(Mgmtdomain.id == mgmtdomain_id).one_or_none() ...
the_stack_v2_python_sparse
src/cnaas_nms/api/mgmtdomain.py
SUNET/cnaas-nms
train
67
976bad63fe79aa3184435b7999e5382e94b02648
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn DelegatedAdminRelationshipOperation()", "from .delegated_admin_relationship_operation_type import DelegatedAdminRelationshipOperationType\nfrom .entity import Entity\nfrom .long_running_operation_status import LongRunningOperationStatu...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return DelegatedAdminRelationshipOperation() <|end_body_0|> <|body_start_1|> from .delegated_admin_relationship_operation_type import DelegatedAdminRelationshipOperationType from .entity import...
DelegatedAdminRelationshipOperation
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DelegatedAdminRelationshipOperation: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DelegatedAdminRelationshipOperation: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discr...
stack_v2_sparse_classes_36k_train_021702
3,868
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: DelegatedAdminRelationshipOperation", "name": "create_from_discriminator_value", "signature": "def create_fr...
3
null
Implement the Python class `DelegatedAdminRelationshipOperation` described below. Class description: Implement the DelegatedAdminRelationshipOperation class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DelegatedAdminRelationshipOperation: Creates a ...
Implement the Python class `DelegatedAdminRelationshipOperation` described below. Class description: Implement the DelegatedAdminRelationshipOperation class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DelegatedAdminRelationshipOperation: Creates a ...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class DelegatedAdminRelationshipOperation: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DelegatedAdminRelationshipOperation: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DelegatedAdminRelationshipOperation: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DelegatedAdminRelationshipOperation: """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...
the_stack_v2_python_sparse
msgraph/generated/models/delegated_admin_relationship_operation.py
microsoftgraph/msgraph-sdk-python
train
135
f01a313de49ad3a2f5f0df3a973925dad7e35169
[ "if len(s) < k:\n return 0\nfor c in set(s):\n if s.count(c) < k:\n return max((self.longestSubstring(z, k) for z in s.split(c)))\nreturn len(s)", "ans = 0\nstack = [s]\nwhile stack:\n s = stack.pop()\n for c in set(s):\n if s.count(c) < k:\n stack.extend([z for z in s.split(c...
<|body_start_0|> if len(s) < k: return 0 for c in set(s): if s.count(c) < k: return max((self.longestSubstring(z, k) for z in s.split(c))) return len(s) <|end_body_0|> <|body_start_1|> ans = 0 stack = [s] while stack: s...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestSubstring(self, s: str, k: int) -> int: """Recursive""" <|body_0|> def longestSubstring(self, s: str, k: int) -> int: """Iterative""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(s) < k: return 0 for c...
stack_v2_sparse_classes_36k_train_021703
846
no_license
[ { "docstring": "Recursive", "name": "longestSubstring", "signature": "def longestSubstring(self, s: str, k: int) -> int" }, { "docstring": "Iterative", "name": "longestSubstring", "signature": "def longestSubstring(self, s: str, k: int) -> int" } ]
2
stack_v2_sparse_classes_30k_train_016451
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestSubstring(self, s: str, k: int) -> int: Recursive - def longestSubstring(self, s: str, k: int) -> int: Iterative
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestSubstring(self, s: str, k: int) -> int: Recursive - def longestSubstring(self, s: str, k: int) -> int: Iterative <|skeleton|> class Solution: def longestSubstrin...
e50dc0642f087f37ab3234390be3d8a0ed48fe62
<|skeleton|> class Solution: def longestSubstring(self, s: str, k: int) -> int: """Recursive""" <|body_0|> def longestSubstring(self, s: str, k: int) -> int: """Iterative""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestSubstring(self, s: str, k: int) -> int: """Recursive""" if len(s) < k: return 0 for c in set(s): if s.count(c) < k: return max((self.longestSubstring(z, k) for z in s.split(c))) return len(s) def longestSubstring...
the_stack_v2_python_sparse
Leetcode/395. Longest Substring with At Least K Repeating Characters.py
brlala/Educative-Grokking-Coding-Exercise
train
3
16fd1b38302bbcb9547712a4072d97a8ac63fe77
[ "super().__init__(freq, **kwargs)\nself.username = username\nself.apikey = apikey", "link = '{url}?apiKey={apikey}&type=day&date={year}-{month}-{day}'\nlink = link.format(url=API, apikey=self.apikey, year=date.year, month=date.month, day=date.day)\nresponse = requests.get(link)\nresponse_json = response.json()['c...
<|body_start_0|> super().__init__(freq, **kwargs) self.username = username self.apikey = apikey <|end_body_0|> <|body_start_1|> link = '{url}?apiKey={apikey}&type=day&date={year}-{month}-{day}' link = link.format(url=API, apikey=self.apikey, year=date.year, month=date.month, day...
ProviderMeteoControl
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProviderMeteoControl: def __init__(self, username, apikey, freq=FREQ, **kwargs): """Arguments: username {string} -- The login username apikey {string} -- The apikey Keyword Arguments: freq {int} -- Frequency of datapoints (default: {FREQ}) name {string} -- The name of this project""" ...
stack_v2_sparse_classes_36k_train_021704
1,735
permissive
[ { "docstring": "Arguments: username {string} -- The login username apikey {string} -- The apikey Keyword Arguments: freq {int} -- Frequency of datapoints (default: {FREQ}) name {string} -- The name of this project", "name": "__init__", "signature": "def __init__(self, username, apikey, freq=FREQ, **kwar...
2
stack_v2_sparse_classes_30k_train_014754
Implement the Python class `ProviderMeteoControl` described below. Class description: Implement the ProviderMeteoControl class. Method signatures and docstrings: - def __init__(self, username, apikey, freq=FREQ, **kwargs): Arguments: username {string} -- The login username apikey {string} -- The apikey Keyword Argume...
Implement the Python class `ProviderMeteoControl` described below. Class description: Implement the ProviderMeteoControl class. Method signatures and docstrings: - def __init__(self, username, apikey, freq=FREQ, **kwargs): Arguments: username {string} -- The login username apikey {string} -- The apikey Keyword Argume...
c4f47444369151c606a4597aed5562503842e2f3
<|skeleton|> class ProviderMeteoControl: def __init__(self, username, apikey, freq=FREQ, **kwargs): """Arguments: username {string} -- The login username apikey {string} -- The apikey Keyword Arguments: freq {int} -- Frequency of datapoints (default: {FREQ}) name {string} -- The name of this project""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProviderMeteoControl: def __init__(self, username, apikey, freq=FREQ, **kwargs): """Arguments: username {string} -- The login username apikey {string} -- The apikey Keyword Arguments: freq {int} -- Frequency of datapoints (default: {FREQ}) name {string} -- The name of this project""" super()._...
the_stack_v2_python_sparse
heg/meteocontrol.py
morris-frank/heg-plant-monitor
train
0
0d49af452ac936f3acb174a66bb142321e0a67e3
[ "self.k = n_splits\nself.test_frac = test_frac\nif n_test is not None:\n self.test_frac = None\n self.n_test = n_test\nelse:\n self.n_test = None", "n = X.shape[0]\ninds = X.index\nn_additional_per_fold = n // self.k\nout = []\nfor fold in range(self.k):\n n_split = (fold + 1) * n_additional_per_fold ...
<|body_start_0|> self.k = n_splits self.test_frac = test_frac if n_test is not None: self.test_frac = None self.n_test = n_test else: self.n_test = None <|end_body_0|> <|body_start_1|> n = X.shape[0] inds = X.index n_additional...
K-Folds for time-series data: splits into <n_splits> cross-validation folds, such that the test data are future of training data, and each fold is larger than the previous. E.g., |-All Data-------------------------------------------| Fold 1: |-Train-|-Test-| Fold 2: |---Train---|-Test-| Fold 3: |-----Train-----|-Test-|...
KFoldForward
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KFoldForward: """K-Folds for time-series data: splits into <n_splits> cross-validation folds, such that the test data are future of training data, and each fold is larger than the previous. E.g., |-All Data-------------------------------------------| Fold 1: |-Train-|-Test-| Fold 2: |---Train---|...
stack_v2_sparse_classes_36k_train_021705
2,312
no_license
[ { "docstring": "Args: - n_splits (int): number of folds (\"k\") - test_frac (float on [0, 1]): fraction of fold to hold out for test set OR - n_test (int): fixed number of records to use in each test set", "name": "__init__", "signature": "def __init__(self, n_splits, test_frac=0.2, n_test=None)" }, ...
2
null
Implement the Python class `KFoldForward` described below. Class description: K-Folds for time-series data: splits into <n_splits> cross-validation folds, such that the test data are future of training data, and each fold is larger than the previous. E.g., |-All Data-------------------------------------------| Fold 1:...
Implement the Python class `KFoldForward` described below. Class description: K-Folds for time-series data: splits into <n_splits> cross-validation folds, such that the test data are future of training data, and each fold is larger than the previous. E.g., |-All Data-------------------------------------------| Fold 1:...
3f5e2f14d79c93df5147b82d901190c054535158
<|skeleton|> class KFoldForward: """K-Folds for time-series data: splits into <n_splits> cross-validation folds, such that the test data are future of training data, and each fold is larger than the previous. E.g., |-All Data-------------------------------------------| Fold 1: |-Train-|-Test-| Fold 2: |---Train---|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KFoldForward: """K-Folds for time-series data: splits into <n_splits> cross-validation folds, such that the test data are future of training data, and each fold is larger than the previous. E.g., |-All Data-------------------------------------------| Fold 1: |-Train-|-Test-| Fold 2: |---Train---|-Test-| Fold ...
the_stack_v2_python_sparse
common/causal_inference/model_selection.py
damiansp/completePython
train
0
e56b1cf13574e362df8cd5785b9816c1507793f6
[ "log_as_info('\\nBookmarkDirective.run')\nnode = BookmarkNode('')\njinja2_value = self.arguments[0].replace('<', '{{ ').replace('>', ' }}')\nnode.markup = create_post_processing_markup('HTML_TITLE', jinja2_value)\nreturn [node]", "for node in doctree.traverse(BookmarkNode):\n replacement_node = docutils.nodes....
<|body_start_0|> log_as_info('\nBookmarkDirective.run') node = BookmarkNode('') jinja2_value = self.arguments[0].replace('<', '{{ ').replace('>', ' }}') node.markup = create_post_processing_markup('HTML_TITLE', jinja2_value) return [node] <|end_body_0|> <|body_start_1|> ...
Implements the .\\. astutus_dyn_bookmark:: directive. This directive allows customizing the title tag in the head section of the HTML tag. This tag is used in labeling browser tabs and suggested values for browser book marks. The one required argument specifies replacement bookmark text. The argument can contain values...
BookmarkDirective
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BookmarkDirective: """Implements the .\\. astutus_dyn_bookmark:: directive. This directive allows customizing the title tag in the head section of the HTML tag. This tag is used in labeling browser tabs and suggested values for browser book marks. The one required argument specifies replacement b...
stack_v2_sparse_classes_36k_train_021706
16,710
permissive
[ { "docstring": "Replaces the directive in the \\\\*.rst file with a BookMarkNode.", "name": "run", "signature": "def run(self) -> List[BookmarkNode]" }, { "docstring": "Handle title modification by inserting post processing markup in the doctree.", "name": "handle_insert_markup", "signat...
2
stack_v2_sparse_classes_30k_train_003799
Implement the Python class `BookmarkDirective` described below. Class description: Implements the .\\. astutus_dyn_bookmark:: directive. This directive allows customizing the title tag in the head section of the HTML tag. This tag is used in labeling browser tabs and suggested values for browser book marks. The one re...
Implement the Python class `BookmarkDirective` described below. Class description: Implements the .\\. astutus_dyn_bookmark:: directive. This directive allows customizing the title tag in the head section of the HTML tag. This tag is used in labeling browser tabs and suggested values for browser book marks. The one re...
46a11295394093de3a23cb8dec1e2e76eac752e8
<|skeleton|> class BookmarkDirective: """Implements the .\\. astutus_dyn_bookmark:: directive. This directive allows customizing the title tag in the head section of the HTML tag. This tag is used in labeling browser tabs and suggested values for browser book marks. The one required argument specifies replacement b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BookmarkDirective: """Implements the .\\. astutus_dyn_bookmark:: directive. This directive allows customizing the title tag in the head section of the HTML tag. This tag is used in labeling browser tabs and suggested values for browser book marks. The one required argument specifies replacement bookmark text....
the_stack_v2_python_sparse
src/astutus/sphinx/dyn_pages.py
rich-dobbs-13440/astutus
train
0
3eec6a63eae35684791a7b190eaede3522ecea72
[ "res = []\noffsets = self.start_positions(text)\nfor offset in offsets:\n res.append(super().parse(text, offset))\nreturn res", "offsets = []\nfor m in re.finditer(self.tag_pattern, line):\n offsets.append(m.start())\nreturn offsets" ]
<|body_start_0|> res = [] offsets = self.start_positions(text) for offset in offsets: res.append(super().parse(text, offset)) return res <|end_body_0|> <|body_start_1|> offsets = [] for m in re.finditer(self.tag_pattern, line): offsets.append(m.st...
ISDAdditionalData
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ISDAdditionalData: def parse(self, text): """:type text: str :rtype: list[AttrDict]""" <|body_0|> def start_positions(self, line): """:type line: str :rtype: list[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> res = [] offsets = self.s...
stack_v2_sparse_classes_36k_train_021707
38,334
no_license
[ { "docstring": ":type text: str :rtype: list[AttrDict]", "name": "parse", "signature": "def parse(self, text)" }, { "docstring": ":type line: str :rtype: list[int]", "name": "start_positions", "signature": "def start_positions(self, line)" } ]
2
null
Implement the Python class `ISDAdditionalData` described below. Class description: Implement the ISDAdditionalData class. Method signatures and docstrings: - def parse(self, text): :type text: str :rtype: list[AttrDict] - def start_positions(self, line): :type line: str :rtype: list[int]
Implement the Python class `ISDAdditionalData` described below. Class description: Implement the ISDAdditionalData class. Method signatures and docstrings: - def parse(self, text): :type text: str :rtype: list[AttrDict] - def start_positions(self, line): :type line: str :rtype: list[int] <|skeleton|> class ISDAdditi...
4935d82ffe5f51284f08749b27f48491a62d9968
<|skeleton|> class ISDAdditionalData: def parse(self, text): """:type text: str :rtype: list[AttrDict]""" <|body_0|> def start_positions(self, line): """:type line: str :rtype: list[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ISDAdditionalData: def parse(self, text): """:type text: str :rtype: list[AttrDict]""" res = [] offsets = self.start_positions(text) for offset in offsets: res.append(super().parse(text, offset)) return res def start_positions(self, line): """:t...
the_stack_v2_python_sparse
Server/src/pyticas_noaa/isd/isdtypes.py
mnit-rtmc/tetres
train
3
6278ae14986da91332ae6d88beacbf8d54dc5818
[ "if not head:\n return head\ntotal = 0\nroot = head\nwhile root:\n root = root.next\n total += 1\nres = ListNode(-1)\nres.next = head\nroot = res\nnum = 0\nwhile res and num < total - n:\n res = res.next\n num += 1\nres.next = res.next.next\nreturn root.next", "dummy = ListNode(-1, head)\nfast = he...
<|body_start_0|> if not head: return head total = 0 root = head while root: root = root.next total += 1 res = ListNode(-1) res.next = head root = res num = 0 while res and num < total - n: res = res.n...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: """这里使用的是遍历的方式同步状态 1. 计算链表节点个数 2. 遍历数据 3. 需要注意的是边界条件,因为可能会直接过滤 :param head: :param n: :return:""" <|body_0|> def removeNthFromEndMethod1(self, head: ListNode, n: int) -> ListNode: """快指针 比 慢指针 ...
stack_v2_sparse_classes_36k_train_021708
2,460
no_license
[ { "docstring": "这里使用的是遍历的方式同步状态 1. 计算链表节点个数 2. 遍历数据 3. 需要注意的是边界条件,因为可能会直接过滤 :param head: :param n: :return:", "name": "removeNthFromEnd", "signature": "def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode" }, { "docstring": "快指针 比 慢指针 多走 N-1 步,当快指针到 结尾的时候,说明 慢指针已经在需要删除的节点之前 :param head...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: 这里使用的是遍历的方式同步状态 1. 计算链表节点个数 2. 遍历数据 3. 需要注意的是边界条件,因为可能会直接过滤 :param head: :param n: :return: - def removeNthFromEnd...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: 这里使用的是遍历的方式同步状态 1. 计算链表节点个数 2. 遍历数据 3. 需要注意的是边界条件,因为可能会直接过滤 :param head: :param n: :return: - def removeNthFromEnd...
af13162360a28a0bcd71918fd8bff77c41ddcc2a
<|skeleton|> class Solution: def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: """这里使用的是遍历的方式同步状态 1. 计算链表节点个数 2. 遍历数据 3. 需要注意的是边界条件,因为可能会直接过滤 :param head: :param n: :return:""" <|body_0|> def removeNthFromEndMethod1(self, head: ListNode, n: int) -> ListNode: """快指针 比 慢指针 ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: """这里使用的是遍历的方式同步状态 1. 计算链表节点个数 2. 遍历数据 3. 需要注意的是边界条件,因为可能会直接过滤 :param head: :param n: :return:""" if not head: return head total = 0 root = head while root: root = root.nex...
the_stack_v2_python_sparse
算法分析和归类/链表/删除链表的倒数第N个节点.py
Carmenliukang/leetcode
train
4
dd8cb901314d01bc94555425be18fac77e4339af
[ "if not s:\n return ''\nn, length, start, end = (len(s), 0, 0, 0)\nmemo = {}\nfor j in range(n):\n for i in range(j, -1, -1):\n memo[i, j] = i == j or (s[i] == s[j] and (i + 1 == j or memo[i + 1, j - 1]))\n if memo[i, j] and j - i >= length:\n start, end = (i, j)\n length =...
<|body_start_0|> if not s: return '' n, length, start, end = (len(s), 0, 0, 0) memo = {} for j in range(n): for i in range(j, -1, -1): memo[i, j] = i == j or (s[i] == s[j] and (i + 1 == j or memo[i + 1, j - 1])) if memo[i, j] and j ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" <|body_0|> def longestPalindrome2(self, s): """:type s: str :rtype: str""" <|body_1|> def longestPalindrome3(self, s): """:type s: str :rtype: str""" <|body_2|> ...
stack_v2_sparse_classes_36k_train_021709
3,483
permissive
[ { "docstring": ":type s: str :rtype: str", "name": "longestPalindrome", "signature": "def longestPalindrome(self, s)" }, { "docstring": ":type s: str :rtype: str", "name": "longestPalindrome2", "signature": "def longestPalindrome2(self, s)" }, { "docstring": ":type s: str :rtype:...
4
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s): :type s: str :rtype: str - def longestPalindrome2(self, s): :type s: str :rtype: str - def longestPalindrome3(self, s): :type s: str :rtype: str -...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s): :type s: str :rtype: str - def longestPalindrome2(self, s): :type s: str :rtype: str - def longestPalindrome3(self, s): :type s: str :rtype: str -...
fb8cf0e64606a2a76a6141bb0e9ccd143c30f07c
<|skeleton|> class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" <|body_0|> def longestPalindrome2(self, s): """:type s: str :rtype: str""" <|body_1|> def longestPalindrome3(self, s): """:type s: str :rtype: str""" <|body_2|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" if not s: return '' n, length, start, end = (len(s), 0, 0, 0) memo = {} for j in range(n): for i in range(j, -1, -1): memo[i, j] = i == j or (s[i] == s[j] an...
the_stack_v2_python_sparse
leetcode/M0005_Longest_Palindromic_Substring.py
jjmoo/daily
train
1
6a817d3061c2b7c75b9dfb4d4249feee5868f68d
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Missing associated documentation comment in .proto file.
FTPStorageServiceServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FTPStorageServiceServicer: """Missing associated documentation comment in .proto file.""" def listFTPStorage(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def getFTPStorage(self, request, context): """Missing a...
stack_v2_sparse_classes_36k_train_021710
9,639
permissive
[ { "docstring": "Missing associated documentation comment in .proto file.", "name": "listFTPStorage", "signature": "def listFTPStorage(self, request, context)" }, { "docstring": "Missing associated documentation comment in .proto file.", "name": "getFTPStorage", "signature": "def getFTPSt...
5
stack_v2_sparse_classes_30k_train_009927
Implement the Python class `FTPStorageServiceServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def listFTPStorage(self, request, context): Missing associated documentation comment in .proto file. - def getFTPStorage(self, request...
Implement the Python class `FTPStorageServiceServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def listFTPStorage(self, request, context): Missing associated documentation comment in .proto file. - def getFTPStorage(self, request...
c69e14b409add099d151434b9add711e41f41b20
<|skeleton|> class FTPStorageServiceServicer: """Missing associated documentation comment in .proto file.""" def listFTPStorage(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def getFTPStorage(self, request, context): """Missing a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FTPStorageServiceServicer: """Missing associated documentation comment in .proto file.""" def listFTPStorage(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not impl...
the_stack_v2_python_sparse
python-sdk/src/airavata_mft_sdk/ftp/FTPStorageService_pb2_grpc.py
apache/airavata-mft
train
23
9c241f79983ac279ab284914368fc9ac6c83c872
[ "super(WeightModel, self).__init__()\nself._obs_dim = obs_dim\nself._cond_dim = cond_dim\nself._rnn = nn.GRU(obs_dim + cond_dim, num_submodels, 1)\nself._num_submodels = num_submodels", "if cond is None:\n rnn_input = y_hist\nelse:\n assert self._cond_dim == cond.shape[-1]\n if len(cond.shape) > 2:\n ...
<|body_start_0|> super(WeightModel, self).__init__() self._obs_dim = obs_dim self._cond_dim = cond_dim self._rnn = nn.GRU(obs_dim + cond_dim, num_submodels, 1) self._num_submodels = num_submodels <|end_body_0|> <|body_start_1|> if cond is None: rnn_input = y_...
Nonlinear weight model.
WeightModel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WeightModel: """Nonlinear weight model.""" def __init__(self, num_submodels: int, obs_dim: int, cond_dim: int=0) -> None: """Initialize the weight model.""" <|body_0|> def forward(self, y_hist: torch.Tensor, cond: Optional[torch.Tensor]=None, full_seq: bool=False) -> tor...
stack_v2_sparse_classes_36k_train_021711
19,607
permissive
[ { "docstring": "Initialize the weight model.", "name": "__init__", "signature": "def __init__(self, num_submodels: int, obs_dim: int, cond_dim: int=0) -> None" }, { "docstring": "Takes sequence of observations and outputs weights. Parameters ---------- y_hist : torch.Tensor, shape=(T, B, p) Sequ...
2
stack_v2_sparse_classes_30k_train_001786
Implement the Python class `WeightModel` described below. Class description: Nonlinear weight model. Method signatures and docstrings: - def __init__(self, num_submodels: int, obs_dim: int, cond_dim: int=0) -> None: Initialize the weight model. - def forward(self, y_hist: torch.Tensor, cond: Optional[torch.Tensor]=No...
Implement the Python class `WeightModel` described below. Class description: Nonlinear weight model. Method signatures and docstrings: - def __init__(self, num_submodels: int, obs_dim: int, cond_dim: int=0) -> None: Initialize the weight model. - def forward(self, y_hist: torch.Tensor, cond: Optional[torch.Tensor]=No...
184b1537c22ebc2f614677be8fe171de785bda42
<|skeleton|> class WeightModel: """Nonlinear weight model.""" def __init__(self, num_submodels: int, obs_dim: int, cond_dim: int=0) -> None: """Initialize the weight model.""" <|body_0|> def forward(self, y_hist: torch.Tensor, cond: Optional[torch.Tensor]=None, full_seq: bool=False) -> tor...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WeightModel: """Nonlinear weight model.""" def __init__(self, num_submodels: int, obs_dim: int, cond_dim: int=0) -> None: """Initialize the weight model.""" super(WeightModel, self).__init__() self._obs_dim = obs_dim self._cond_dim = cond_dim self._rnn = nn.GRU(obs...
the_stack_v2_python_sparse
dynamics_learning/networks/kalman/le_ekf.py
cristovaoiglesias/replay-overshooting
train
0
4ae8860b465affd7ad23dad0192080657d756186
[ "self.type_renamings = type_renamings\nself.reverse_name_map = {}\nself.type_name_conflicts = {}\nself.type_renamed_to_builtin_scalar_conflicts = {}\nself.invalid_type_names = {}\nself.query_type = query_type\nself.custom_scalar_names = frozenset(custom_scalar_names)\nself.suppressed_type_names = set()", "type_na...
<|body_start_0|> self.type_renamings = type_renamings self.reverse_name_map = {} self.type_name_conflicts = {} self.type_renamed_to_builtin_scalar_conflicts = {} self.invalid_type_names = {} self.query_type = query_type self.custom_scalar_names = frozenset(custom_...
Traverse a Document AST, editing the names of nodes.
RenameSchemaTypesVisitor
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RenameSchemaTypesVisitor: """Traverse a Document AST, editing the names of nodes.""" def __init__(self, type_renamings: TypeRenamingMapping, query_type: str, custom_scalar_names: AbstractSet[str]) -> None: """Create a visitor for renaming types in a schema AST. Args: type_renamings: ...
stack_v2_sparse_classes_36k_train_021712
44,550
permissive
[ { "docstring": "Create a visitor for renaming types in a schema AST. Args: type_renamings: maps original type name to renamed name or None (for type suppression). A type named \"Foo\" will be unchanged iff type_renamings does not map \"Foo\" to anything, i.e. type_renamings.get(\"Foo\", \"Foo\") returns \"Foo\"...
3
null
Implement the Python class `RenameSchemaTypesVisitor` described below. Class description: Traverse a Document AST, editing the names of nodes. Method signatures and docstrings: - def __init__(self, type_renamings: TypeRenamingMapping, query_type: str, custom_scalar_names: AbstractSet[str]) -> None: Create a visitor f...
Implement the Python class `RenameSchemaTypesVisitor` described below. Class description: Traverse a Document AST, editing the names of nodes. Method signatures and docstrings: - def __init__(self, type_renamings: TypeRenamingMapping, query_type: str, custom_scalar_names: AbstractSet[str]) -> None: Create a visitor f...
4e68d592fc97855ca043dc20bdf59be4298647ab
<|skeleton|> class RenameSchemaTypesVisitor: """Traverse a Document AST, editing the names of nodes.""" def __init__(self, type_renamings: TypeRenamingMapping, query_type: str, custom_scalar_names: AbstractSet[str]) -> None: """Create a visitor for renaming types in a schema AST. Args: type_renamings: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RenameSchemaTypesVisitor: """Traverse a Document AST, editing the names of nodes.""" def __init__(self, type_renamings: TypeRenamingMapping, query_type: str, custom_scalar_names: AbstractSet[str]) -> None: """Create a visitor for renaming types in a schema AST. Args: type_renamings: maps original...
the_stack_v2_python_sparse
graphql_compiler/schema_transformation/rename_schema.py
justinaustin/graphql-compiler
train
0
db6e8bdb8d82b836c8a049dd6d528ae5162c29da
[ "d = dict()\neven_num = 0\nodd_num = 0\nfor i in s:\n count = d.get(i, 0)\n count = count + 1\n if count == 2:\n d[i] = 0\n even_num = even_num + 1\n odd_num = odd_num - 1\n else:\n d[i] = count\n odd_num = odd_num + 1\nif odd_num == 0:\n return even_num * 2\nelse:\...
<|body_start_0|> d = dict() even_num = 0 odd_num = 0 for i in s: count = d.get(i, 0) count = count + 1 if count == 2: d[i] = 0 even_num = even_num + 1 odd_num = odd_num - 1 else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestPalindrome(self, s): """:type s: str :rtype: int""" <|body_0|> def longestPalindrome2(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> d = dict() even_num = 0 odd_num = 0 ...
stack_v2_sparse_classes_36k_train_021713
1,417
no_license
[ { "docstring": ":type s: str :rtype: int", "name": "longestPalindrome", "signature": "def longestPalindrome(self, s)" }, { "docstring": ":type s: str :rtype: int", "name": "longestPalindrome2", "signature": "def longestPalindrome2(self, s)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s): :type s: str :rtype: int - def longestPalindrome2(self, s): :type s: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s): :type s: str :rtype: int - def longestPalindrome2(self, s): :type s: str :rtype: int <|skeleton|> class Solution: def longestPalindrome(self...
e3fa905ea46f03b56cde662d1d7a03c4af82773a
<|skeleton|> class Solution: def longestPalindrome(self, s): """:type s: str :rtype: int""" <|body_0|> def longestPalindrome2(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestPalindrome(self, s): """:type s: str :rtype: int""" d = dict() even_num = 0 odd_num = 0 for i in s: count = d.get(i, 0) count = count + 1 if count == 2: d[i] = 0 even_num = even_num...
the_stack_v2_python_sparse
pyPractice/algoproblem/Longest_palindrome_409.py
bing1zhi2/algorithmPractice
train
0
60fba693126af2e4ae103716c347f5abe768a1ca
[ "with gzip.open(filename, 'rb') as f:\n content = f.read()\n if codec:\n return codecs.decode(content, codec)\n else:\n return content", "assert filename != output\nfile_util.ensure_file_dir(output)\nwith gzip.open(filename, 'rb') as fin:\n with open(output, 'wb') as fout:\n fout....
<|body_start_0|> with gzip.open(filename, 'rb') as f: content = f.read() if codec: return codecs.decode(content, codec) else: return content <|end_body_0|> <|body_start_1|> assert filename != output file_util.ensure_file_dir(ou...
compressed_file
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class compressed_file: def read(clazz, filename, codec=None): """Read a comprssed file into a string.""" <|body_0|> def uncompress(clazz, filename, output): """Uncompress a gzipped file to another file.""" <|body_1|> def compress(clazz, filename, output): ...
stack_v2_sparse_classes_36k_train_021714
1,026
permissive
[ { "docstring": "Read a comprssed file into a string.", "name": "read", "signature": "def read(clazz, filename, codec=None)" }, { "docstring": "Uncompress a gzipped file to another file.", "name": "uncompress", "signature": "def uncompress(clazz, filename, output)" }, { "docstring...
3
null
Implement the Python class `compressed_file` described below. Class description: Implement the compressed_file class. Method signatures and docstrings: - def read(clazz, filename, codec=None): Read a comprssed file into a string. - def uncompress(clazz, filename, output): Uncompress a gzipped file to another file. - ...
Implement the Python class `compressed_file` described below. Class description: Implement the compressed_file class. Method signatures and docstrings: - def read(clazz, filename, codec=None): Read a comprssed file into a string. - def uncompress(clazz, filename, output): Uncompress a gzipped file to another file. - ...
b9dd35b518848cea82e43d5016e425cc7dac32e5
<|skeleton|> class compressed_file: def read(clazz, filename, codec=None): """Read a comprssed file into a string.""" <|body_0|> def uncompress(clazz, filename, output): """Uncompress a gzipped file to another file.""" <|body_1|> def compress(clazz, filename, output): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class compressed_file: def read(clazz, filename, codec=None): """Read a comprssed file into a string.""" with gzip.open(filename, 'rb') as f: content = f.read() if codec: return codecs.decode(content, codec) else: return content ...
the_stack_v2_python_sparse
lib/bes/fs/compressed_file.py
reconstruir/bes
train
0
c1e501d6003b620182bb4793e4aeff503e4edd5c
[ "parms = np.array(self.params)\nd_parms = np.array(self.xerror)\nprint(parms)\nprint('\\n')\nprint(d_parms)\nn_dec = np.floor(np.log10(np.abs(parms))) - np.floor(np.log10(np.abs(d_parms))) + 1\nn_dec[n_dec < 1] = 2\nn_dec = n_dec.astype('int')\nstr_out = ''\nif function_str is not None:\n str_out = str_out + fun...
<|body_start_0|> parms = np.array(self.params) d_parms = np.array(self.xerror) print(parms) print('\n') print(d_parms) n_dec = np.floor(np.log10(np.abs(parms))) - np.floor(np.log10(np.abs(d_parms))) + 1 n_dec[n_dec < 1] = 2 n_dec = n_dec.astype('int') ...
class containing fit plotting methods Methods ------- build_param_table plot
PlotFit
[ "MIT", "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PlotFit: """class containing fit plotting methods Methods ------- build_param_table plot""" def build_param_table(self, function_str=None): """Builds a table of parameters for including in a plot or for use with print Parameters ========== function_str : string A string that describe...
stack_v2_sparse_classes_36k_train_021715
2,987
permissive
[ { "docstring": "Builds a table of parameters for including in a plot or for use with print Parameters ========== function_str : string A string that describes the fitting function", "name": "build_param_table", "signature": "def build_param_table(self, function_str=None)" }, { "docstring": "Plot...
2
stack_v2_sparse_classes_30k_train_015929
Implement the Python class `PlotFit` described below. Class description: class containing fit plotting methods Methods ------- build_param_table plot Method signatures and docstrings: - def build_param_table(self, function_str=None): Builds a table of parameters for including in a plot or for use with print Parameter...
Implement the Python class `PlotFit` described below. Class description: class containing fit plotting methods Methods ------- build_param_table plot Method signatures and docstrings: - def build_param_table(self, function_str=None): Builds a table of parameters for including in a plot or for use with print Parameter...
03dbb058d50118c7a9fe5a1fc8b28eaed82932ab
<|skeleton|> class PlotFit: """class containing fit plotting methods Methods ------- build_param_table plot""" def build_param_table(self, function_str=None): """Builds a table of parameters for including in a plot or for use with print Parameters ========== function_str : string A string that describe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PlotFit: """class containing fit plotting methods Methods ------- build_param_table plot""" def build_param_table(self, function_str=None): """Builds a table of parameters for including in a plot or for use with print Parameters ========== function_str : string A string that describes the fitting...
the_stack_v2_python_sparse
neutronpy/lsfit/plot.py
me2d09/neutronpy
train
0
4909c750b1d561336fa7b7ae8b4b65e5dacd27f4
[ "if not p and (not q):\n return True\nif not p or not q:\n return False\ncurr_is_same = p.val == q.val\nleft_is_same = self.isSameTree(p.left, q.left)\nright_is_same = self.isSameTree(p.right, q.right)\nreturn curr_is_same and left_is_same and right_is_same", "stack = deque([(p, q)])\nwhile stack:\n node...
<|body_start_0|> if not p and (not q): return True if not p or not q: return False curr_is_same = p.val == q.val left_is_same = self.isSameTree(p.left, q.left) right_is_same = self.isSameTree(p.right, q.right) return curr_is_same and left_is_same a...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isSameTree(self, p: Optional[TreeNode], q: Optional[TreeNode]) -> bool: """Recursive DFS Time complexity: O(min(p, q)) == O(n) Space complexity: O(min(p, q)) == O(n)""" <|body_0|> def isSameTreeIterativeDFS(self, p: Optional[TreeNode], q: Optional[TreeNode]) ->...
stack_v2_sparse_classes_36k_train_021716
2,240
permissive
[ { "docstring": "Recursive DFS Time complexity: O(min(p, q)) == O(n) Space complexity: O(min(p, q)) == O(n)", "name": "isSameTree", "signature": "def isSameTree(self, p: Optional[TreeNode], q: Optional[TreeNode]) -> bool" }, { "docstring": "Iterative DFS Time complexity: O(min(p, q)) == O(n) Spac...
3
stack_v2_sparse_classes_30k_train_000379
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isSameTree(self, p: Optional[TreeNode], q: Optional[TreeNode]) -> bool: Recursive DFS Time complexity: O(min(p, q)) == O(n) Space complexity: O(min(p, q)) == O(n) - def isSam...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isSameTree(self, p: Optional[TreeNode], q: Optional[TreeNode]) -> bool: Recursive DFS Time complexity: O(min(p, q)) == O(n) Space complexity: O(min(p, q)) == O(n) - def isSam...
32b0878f63e5edd19a1fbe13bfa4c518a4261e23
<|skeleton|> class Solution: def isSameTree(self, p: Optional[TreeNode], q: Optional[TreeNode]) -> bool: """Recursive DFS Time complexity: O(min(p, q)) == O(n) Space complexity: O(min(p, q)) == O(n)""" <|body_0|> def isSameTreeIterativeDFS(self, p: Optional[TreeNode], q: Optional[TreeNode]) ->...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isSameTree(self, p: Optional[TreeNode], q: Optional[TreeNode]) -> bool: """Recursive DFS Time complexity: O(min(p, q)) == O(n) Space complexity: O(min(p, q)) == O(n)""" if not p and (not q): return True if not p or not q: return False curr_...
the_stack_v2_python_sparse
leetcode/Trees/100. Same Tree.py
danielfsousa/algorithms-solutions
train
2
cc7eab3ddd1c6a50cf63a9241fa388b3e61acf2f
[ "input_signals = []\nsignal_out = Signal(intbv(0)[32:])\nself.assertRaisesRegex(ValueError, 'combined_signal_assigner: input_signals should contain at least one signal.', combined_signal_assigner, input_signals, signal_out)", "input_signals, total_input_bitwidth = generate_random_input_signals(2, 11, 129)\ninput_...
<|body_start_0|> input_signals = [] signal_out = Signal(intbv(0)[32:]) self.assertRaisesRegex(ValueError, 'combined_signal_assigner: input_signals should contain at least one signal.', combined_signal_assigner, input_signals, signal_out) <|end_body_0|> <|body_start_1|> input_signals, to...
The combined_signal_assigner should reject incompatible interfaces and arguments.
TestCombinedSignalAssignerInterface
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCombinedSignalAssignerInterface: """The combined_signal_assigner should reject incompatible interfaces and arguments.""" def test_empty_input_signals(self): """The `combined_signal_assigner` should raise an error if the `input_signals` is an empty list.""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_021717
10,899
permissive
[ { "docstring": "The `combined_signal_assigner` should raise an error if the `input_signals` is an empty list.", "name": "test_empty_input_signals", "signature": "def test_empty_input_signals(self)" }, { "docstring": "The `combined_signal_assigner` should raise an error if the `input_signals` con...
3
null
Implement the Python class `TestCombinedSignalAssignerInterface` described below. Class description: The combined_signal_assigner should reject incompatible interfaces and arguments. Method signatures and docstrings: - def test_empty_input_signals(self): The `combined_signal_assigner` should raise an error if the `in...
Implement the Python class `TestCombinedSignalAssignerInterface` described below. Class description: The combined_signal_assigner should reject incompatible interfaces and arguments. Method signatures and docstrings: - def test_empty_input_signals(self): The `combined_signal_assigner` should raise an error if the `in...
0b5e015cd62ba14d8d8a29b6c23d886044154572
<|skeleton|> class TestCombinedSignalAssignerInterface: """The combined_signal_assigner should reject incompatible interfaces and arguments.""" def test_empty_input_signals(self): """The `combined_signal_assigner` should raise an error if the `input_signals` is an empty list.""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestCombinedSignalAssignerInterface: """The combined_signal_assigner should reject incompatible interfaces and arguments.""" def test_empty_input_signals(self): """The `combined_signal_assigner` should raise an error if the `input_signals` is an empty list.""" input_signals = [] s...
the_stack_v2_python_sparse
kea/utils/test_combined_signal_assigner.py
SmartAcoustics/Kea
train
5
ae0b12ca5a30d06d3dde154d582283965b497a69
[ "if len(matrix) == 0:\n return\nm, n = (len(matrix), len(matrix[0]))\nfor i in xrange(m):\n for j in xrange(1, n):\n matrix[i][j] += matrix[i][j - 1]\nself.matrix = matrix", "result = 0\nfor i in xrange(row1, row2 + 1):\n result += self.matrix[i][col2] - self.matrix[i][col1 - 1] if col1 != 0 else ...
<|body_start_0|> if len(matrix) == 0: return m, n = (len(matrix), len(matrix[0])) for i in xrange(m): for j in xrange(1, n): matrix[i][j] += matrix[i][j - 1] self.matrix = matrix <|end_body_0|> <|body_start_1|> result = 0 for i in ...
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_021718
2,398
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
null
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)...
ee79d3437cf47b26a4bca0ec798dc54d7b623453
<|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 len(matrix) == 0: return m, n = (len(matrix), len(matrix[0])) for i in xrange(m): for j in xrange(1, n): matrix[i][j] += ma...
the_stack_v2_python_sparse
Algorithm/Python/304. Range Sum Query 2D - Immutable.py
WuLC/LeetCode
train
29
fc7ed525c3d53aaa0867fdcdd4b37c384a589d4d
[ "if None == l1:\n return l2\nif None == l2:\n return l1\nnode1 = l1\nnode2 = l2\nif node1.val <= node2.val:\n head = node1\n node1 = node1.next\nelse:\n head = node2\n node2 = node2.next\nnode = head\nwhile node1 and node2:\n if node1.val <= node2.val:\n node.next = node1\n node1 ...
<|body_start_0|> if None == l1: return l2 if None == l2: return l1 node1 = l1 node2 = l2 if node1.val <= node2.val: head = node1 node1 = node1.next else: head = node2 node2 = node2.next node =...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: """遍历 :param l1: :param l2: :return:""" <|body_0|> def mergeTwoLists2(self, l1: ListNode, l2: ListNode) -> ListNode: """递归 :param l1: :param l2: :return:""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k_train_021719
2,067
no_license
[ { "docstring": "遍历 :param l1: :param l2: :return:", "name": "mergeTwoLists", "signature": "def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode" }, { "docstring": "递归 :param l1: :param l2: :return:", "name": "mergeTwoLists2", "signature": "def mergeTwoLists2(self, l1: ListNode...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: 遍历 :param l1: :param l2: :return: - def mergeTwoLists2(self, l1: ListNode, l2: ListNode) -> ListNode: 递归 :param l...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: 遍历 :param l1: :param l2: :return: - def mergeTwoLists2(self, l1: ListNode, l2: ListNode) -> ListNode: 递归 :param l...
837957ea22aa07ce28a6c23ea0419bd2011e1f88
<|skeleton|> class Solution: def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: """遍历 :param l1: :param l2: :return:""" <|body_0|> def mergeTwoLists2(self, l1: ListNode, l2: ListNode) -> ListNode: """递归 :param l1: :param l2: :return:""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: """遍历 :param l1: :param l2: :return:""" if None == l1: return l2 if None == l2: return l1 node1 = l1 node2 = l2 if node1.val <= node2.val: head = node1...
the_stack_v2_python_sparse
华为题库/合并两个有序链表.py
2226171237/Algorithmpractice
train
0
7bb344b9b119a62489a4f58f87557407aaf0dd86
[ "output = [0]\nfor i in range(1, num + 1):\n output.append((i & 1) + output[i >> 1])\nreturn output", "output = [0]\nwhile len(output) < num + 1:\n output += [1 + x for x in output]\nreturn output[:num + 1]", "def count_bits(n):\n count = 0\n while n > 0:\n count += n & 1\n n >>= 1\n ...
<|body_start_0|> output = [0] for i in range(1, num + 1): output.append((i & 1) + output[i >> 1]) return output <|end_body_0|> <|body_start_1|> output = [0] while len(output) < num + 1: output += [1 + x for x in output] return output[:num + 1] <|e...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countBits(self, num): """:type num: int :rtype: List[int]""" <|body_0|> def countBits_v2(self, num): """:type num: int :rtype: List[int]""" <|body_1|> def countBits_naive(self, num): """:type num: int :rtype: List[int]""" <|...
stack_v2_sparse_classes_36k_train_021720
2,054
no_license
[ { "docstring": ":type num: int :rtype: List[int]", "name": "countBits", "signature": "def countBits(self, num)" }, { "docstring": ":type num: int :rtype: List[int]", "name": "countBits_v2", "signature": "def countBits_v2(self, num)" }, { "docstring": ":type num: int :rtype: List[...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countBits(self, num): :type num: int :rtype: List[int] - def countBits_v2(self, num): :type num: int :rtype: List[int] - def countBits_naive(self, num): :type num: int :rtype...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countBits(self, num): :type num: int :rtype: List[int] - def countBits_v2(self, num): :type num: int :rtype: List[int] - def countBits_naive(self, num): :type num: int :rtype...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def countBits(self, num): """:type num: int :rtype: List[int]""" <|body_0|> def countBits_v2(self, num): """:type num: int :rtype: List[int]""" <|body_1|> def countBits_naive(self, num): """:type num: int :rtype: List[int]""" <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def countBits(self, num): """:type num: int :rtype: List[int]""" output = [0] for i in range(1, num + 1): output.append((i & 1) + output[i >> 1]) return output def countBits_v2(self, num): """:type num: int :rtype: List[int]""" output ...
the_stack_v2_python_sparse
src/lt_338.py
oxhead/CodingYourWay
train
0
ef716077ed8d0f4996831f3124ca620cb7fe01af
[ "driver = webdriver.Firefox()\nwait = WebDriverWait(driver, 10)\ndriver.get(cls.LOGIN_URL)\ncls._fill_username_and_password(driver, username, password)\ncls._submit(driver)\nwhile True:\n try:\n wait.until(expected_conditions.title_is('新浪通行证'))\n break\n except:\n cls._fill_username_and_p...
<|body_start_0|> driver = webdriver.Firefox() wait = WebDriverWait(driver, 10) driver.get(cls.LOGIN_URL) cls._fill_username_and_password(driver, username, password) cls._submit(driver) while True: try: wait.until(expected_conditions.title_is('新...
@brief: Login to weibo.cn and return cookies.
GUIBasedLogin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GUIBasedLogin: """@brief: Login to weibo.cn and return cookies.""" def _get_login_raw_cookies(cls, username, password): """@brief: Login base on GUI, with consideration of vetification. @return: A browser driver was successfully logined.""" <|body_0|> def get_login_cooki...
stack_v2_sparse_classes_36k_train_021721
12,248
no_license
[ { "docstring": "@brief: Login base on GUI, with consideration of vetification. @return: A browser driver was successfully logined.", "name": "_get_login_raw_cookies", "signature": "def _get_login_raw_cookies(cls, username, password)" }, { "docstring": "@return: A dict contains key/value pairs of...
3
stack_v2_sparse_classes_30k_train_004218
Implement the Python class `GUIBasedLogin` described below. Class description: @brief: Login to weibo.cn and return cookies. Method signatures and docstrings: - def _get_login_raw_cookies(cls, username, password): @brief: Login base on GUI, with consideration of vetification. @return: A browser driver was successfull...
Implement the Python class `GUIBasedLogin` described below. Class description: @brief: Login to weibo.cn and return cookies. Method signatures and docstrings: - def _get_login_raw_cookies(cls, username, password): @brief: Login base on GUI, with consideration of vetification. @return: A browser driver was successfull...
71a63240d5f6b2e3a0feb2f5c3eea22cd4f63d12
<|skeleton|> class GUIBasedLogin: """@brief: Login to weibo.cn and return cookies.""" def _get_login_raw_cookies(cls, username, password): """@brief: Login base on GUI, with consideration of vetification. @return: A browser driver was successfully logined.""" <|body_0|> def get_login_cooki...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GUIBasedLogin: """@brief: Login to weibo.cn and return cookies.""" def _get_login_raw_cookies(cls, username, password): """@brief: Login base on GUI, with consideration of vetification. @return: A browser driver was successfully logined.""" driver = webdriver.Firefox() wait = WebD...
the_stack_v2_python_sparse
spider/weibo_com/utils.py
huntzhan/WeiboTopic
train
0
496d56bfeec56ae36f50fad13f3af4b999631b93
[ "rs = self.ns_create_cmd(self.ns_leader, 't1', '0', str(8), str(3), '')\nself.assertIn('Create table ok', rs)\nrs1 = self.ns_put_kv(self.ns_leader, 't1', 'testkey0', '11', 'testvalue0')\nself.assertIn('Put ok', rs1)\nrs2 = self.ns_put_kv(self.ns_leader, 't1', 'testkey0', '22', 'testvalue1')\nself.assertIn('Put ok',...
<|body_start_0|> rs = self.ns_create_cmd(self.ns_leader, 't1', '0', str(8), str(3), '') self.assertIn('Create table ok', rs) rs1 = self.ns_put_kv(self.ns_leader, 't1', 'testkey0', '11', 'testvalue0') self.assertIn('Put ok', rs1) rs2 = self.ns_put_kv(self.ns_leader, 't1', 'testkey...
TestPreview
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestPreview: def test_preview_kv(self): """预览kv表 :return:""" <|body_0|> def test_preview_schema(self): """预览schema表 :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> rs = self.ns_create_cmd(self.ns_leader, 't1', '0', str(8), str(3), '') ...
stack_v2_sparse_classes_36k_train_021722
4,253
permissive
[ { "docstring": "预览kv表 :return:", "name": "test_preview_kv", "signature": "def test_preview_kv(self)" }, { "docstring": "预览schema表 :return:", "name": "test_preview_schema", "signature": "def test_preview_schema(self)" } ]
2
stack_v2_sparse_classes_30k_train_010453
Implement the Python class `TestPreview` described below. Class description: Implement the TestPreview class. Method signatures and docstrings: - def test_preview_kv(self): 预览kv表 :return: - def test_preview_schema(self): 预览schema表 :return:
Implement the Python class `TestPreview` described below. Class description: Implement the TestPreview class. Method signatures and docstrings: - def test_preview_kv(self): 预览kv表 :return: - def test_preview_schema(self): 预览schema表 :return: <|skeleton|> class TestPreview: def test_preview_kv(self): """预览...
14f662558880f0784699eb8339677e5afa6df6cf
<|skeleton|> class TestPreview: def test_preview_kv(self): """预览kv表 :return:""" <|body_0|> def test_preview_schema(self): """预览schema表 :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestPreview: def test_preview_kv(self): """预览kv表 :return:""" rs = self.ns_create_cmd(self.ns_leader, 't1', '0', str(8), str(3), '') self.assertIn('Create table ok', rs) rs1 = self.ns_put_kv(self.ns_leader, 't1', 'testkey0', '11', 'testvalue0') self.assertIn('Put ok', rs...
the_stack_v2_python_sparse
test-common/integrationtest/testcase/test_ns_client_preview.py
RhnSharma/OpenMLDB
train
1
09d707a2eb39c19aa1b140514f7446f8baf7f4c0
[ "for i, (k, hero_id) in enumerate(asdict(self).items()):\n if hero_id == -1:\n continue\n if i < 5:\n faction = 'Radiant'\n else:\n faction = 'Dire'\n if i >= 10:\n faction = ''\n print(f\"{faction:>7} {k}: {const.HERO_LOOKUP.from_offset(hero_id)['pretty_name']}\")", "dr...
<|body_start_0|> for i, (k, hero_id) in enumerate(asdict(self).items()): if hero_id == -1: continue if i < 5: faction = 'Radiant' else: faction = 'Dire' if i >= 10: faction = '' print(f"{f...
Draft struct which represent the drafting state of the game
DraftStatus
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DraftStatus: """Draft struct which represent the drafting state of the game""" def summary(self): """Examples -------- >>> draft = DraftStatus() >>> draft.Pick4 = 1 >>> draft.Ban01 = 2 >>> draft.Pick5 = 3 >>> draft.summary() Radiant Pick4: Axe Dire Pick5: Bloodseeker Dire Ban01: Bane...
stack_v2_sparse_classes_36k_train_021723
9,052
permissive
[ { "docstring": "Examples -------- >>> draft = DraftStatus() >>> draft.Pick4 = 1 >>> draft.Ban01 = 2 >>> draft.Pick5 = 3 >>> draft.summary() Radiant Pick4: Axe Dire Pick5: Bloodseeker Dire Ban01: Bane", "name": "summary", "signature": "def summary(self)" }, { "docstring": "Generate a one-hot enco...
2
null
Implement the Python class `DraftStatus` described below. Class description: Draft struct which represent the drafting state of the game Method signatures and docstrings: - def summary(self): Examples -------- >>> draft = DraftStatus() >>> draft.Pick4 = 1 >>> draft.Ban01 = 2 >>> draft.Pick5 = 3 >>> draft.summary() Ra...
Implement the Python class `DraftStatus` described below. Class description: Draft struct which represent the drafting state of the game Method signatures and docstrings: - def summary(self): Examples -------- >>> draft = DraftStatus() >>> draft.Pick4 = 1 >>> draft.Ban01 = 2 >>> draft.Pick5 = 3 >>> draft.summary() Ra...
bd0efd8fc2b064d6bf58993e59a6ad4ac6713b39
<|skeleton|> class DraftStatus: """Draft struct which represent the drafting state of the game""" def summary(self): """Examples -------- >>> draft = DraftStatus() >>> draft.Pick4 = 1 >>> draft.Ban01 = 2 >>> draft.Pick5 = 3 >>> draft.summary() Radiant Pick4: Axe Dire Pick5: Bloodseeker Dire Ban01: Bane...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DraftStatus: """Draft struct which represent the drafting state of the game""" def summary(self): """Examples -------- >>> draft = DraftStatus() >>> draft.Pick4 = 1 >>> draft.Ban01 = 2 >>> draft.Pick5 = 3 >>> draft.summary() Radiant Pick4: Axe Dire Pick5: Bloodseeker Dire Ban01: Bane""" f...
the_stack_v2_python_sparse
luafun/draft.py
Delaunay/dota2env
train
3
bf1ad1fec18ab092c20aeb76ec0fe0576564e33b
[ "self.gamma = gamma\nself.means_ = None\nself.covariances_ = None", "X_sorted = X[np.argsort(-y)]\nif X.shape[0] < 4:\n gaussian_high = GaussianMixture().fit(X_sorted)\n gaussian_low = gaussian_high\nelse:\n point_segmentation = max(2, int(self.gamma * X.shape[0]))\n gaussian_high = GaussianMixture()....
<|body_start_0|> self.gamma = gamma self.means_ = None self.covariances_ = None <|end_body_0|> <|body_start_1|> X_sorted = X[np.argsort(-y)] if X.shape[0] < 4: gaussian_high = GaussianMixture().fit(X_sorted) gaussian_low = gaussian_high else: ...
Gaussian Process. :param gamma: gamma. :type gamma: int
DoubleMultiGaussian
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DoubleMultiGaussian: """Gaussian Process. :param gamma: gamma. :type gamma: int""" def __init__(self, gamma=0.25): """Init TunerModel.""" <|body_0|> def fit(self, X, y): """Divide X according to y and get two Gaussian model.""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k_train_021724
1,680
permissive
[ { "docstring": "Init TunerModel.", "name": "__init__", "signature": "def __init__(self, gamma=0.25)" }, { "docstring": "Divide X according to y and get two Gaussian model.", "name": "fit", "signature": "def fit(self, X, y)" } ]
2
null
Implement the Python class `DoubleMultiGaussian` described below. Class description: Gaussian Process. :param gamma: gamma. :type gamma: int Method signatures and docstrings: - def __init__(self, gamma=0.25): Init TunerModel. - def fit(self, X, y): Divide X according to y and get two Gaussian model.
Implement the Python class `DoubleMultiGaussian` described below. Class description: Gaussian Process. :param gamma: gamma. :type gamma: int Method signatures and docstrings: - def __init__(self, gamma=0.25): Init TunerModel. - def fit(self, X, y): Divide X according to y and get two Gaussian model. <|skeleton|> cla...
12e37a1991eb6771a2999fe0a46ddda920c47948
<|skeleton|> class DoubleMultiGaussian: """Gaussian Process. :param gamma: gamma. :type gamma: int""" def __init__(self, gamma=0.25): """Init TunerModel.""" <|body_0|> def fit(self, X, y): """Divide X according to y and get two Gaussian model.""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DoubleMultiGaussian: """Gaussian Process. :param gamma: gamma. :type gamma: int""" def __init__(self, gamma=0.25): """Init TunerModel.""" self.gamma = gamma self.means_ = None self.covariances_ = None def fit(self, X, y): """Divide X according to y and get two...
the_stack_v2_python_sparse
vega/algorithms/hpo/sha_base/tuner/double_gaussian.py
huawei-noah/vega
train
850
1f7802519af3f1943de6b8e63fa05a687568bdaa
[ "try:\n order = OrderInfo.objects.get(order_id=order_id, user=request.user, pay_method=OrderInfo.PAY_METHODS_ENUM['ALIPAY'], status=OrderInfo.ORDER_STATUS_ENUM['UNPAID'])\nexcept OrderInfo.DoesNotExist:\n return Response({'message': '订单信息有误'}, status=status.HTTP_400_BAD_REQUEST)\nalipay = AliPay(appid=setting...
<|body_start_0|> try: order = OrderInfo.objects.get(order_id=order_id, user=request.user, pay_method=OrderInfo.PAY_METHODS_ENUM['ALIPAY'], status=OrderInfo.ORDER_STATUS_ENUM['UNPAID']) except OrderInfo.DoesNotExist: return Response({'message': '订单信息有误'}, status=status.HTTP_400_BA...
支付接口 -- 跳转阿里支付 GET payment/alipay/(?P<order_id>\\d+)/
AliPaymentView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AliPaymentView: """支付接口 -- 跳转阿里支付 GET payment/alipay/(?P<order_id>\\d+)/""" def get(self, request, order_id): """获取阿里支付url""" <|body_0|> def put(self, request): """处理支付结果 -- 如果url带有查询参数的请求是同步支付返回请求, 否则是异步支付返回请求 1. 修改订单状态: 待支付 -> 待发货 2. payment表保存支付成功的订单id,支付宝id""...
stack_v2_sparse_classes_36k_train_021725
5,500
no_license
[ { "docstring": "获取阿里支付url", "name": "get", "signature": "def get(self, request, order_id)" }, { "docstring": "处理支付结果 -- 如果url带有查询参数的请求是同步支付返回请求, 否则是异步支付返回请求 1. 修改订单状态: 待支付 -> 待发货 2. payment表保存支付成功的订单id,支付宝id", "name": "put", "signature": "def put(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_013253
Implement the Python class `AliPaymentView` described below. Class description: 支付接口 -- 跳转阿里支付 GET payment/alipay/(?P<order_id>\\d+)/ Method signatures and docstrings: - def get(self, request, order_id): 获取阿里支付url - def put(self, request): 处理支付结果 -- 如果url带有查询参数的请求是同步支付返回请求, 否则是异步支付返回请求 1. 修改订单状态: 待支付 -> 待发货 2. paymen...
Implement the Python class `AliPaymentView` described below. Class description: 支付接口 -- 跳转阿里支付 GET payment/alipay/(?P<order_id>\\d+)/ Method signatures and docstrings: - def get(self, request, order_id): 获取阿里支付url - def put(self, request): 处理支付结果 -- 如果url带有查询参数的请求是同步支付返回请求, 否则是异步支付返回请求 1. 修改订单状态: 待支付 -> 待发货 2. paymen...
c841e7d1aa0616b070b10924f44b2c418f222cd8
<|skeleton|> class AliPaymentView: """支付接口 -- 跳转阿里支付 GET payment/alipay/(?P<order_id>\\d+)/""" def get(self, request, order_id): """获取阿里支付url""" <|body_0|> def put(self, request): """处理支付结果 -- 如果url带有查询参数的请求是同步支付返回请求, 否则是异步支付返回请求 1. 修改订单状态: 待支付 -> 待发货 2. payment表保存支付成功的订单id,支付宝id""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AliPaymentView: """支付接口 -- 跳转阿里支付 GET payment/alipay/(?P<order_id>\\d+)/""" def get(self, request, order_id): """获取阿里支付url""" try: order = OrderInfo.objects.get(order_id=order_id, user=request.user, pay_method=OrderInfo.PAY_METHODS_ENUM['ALIPAY'], status=OrderInfo.ORDER_STATUS...
the_stack_v2_python_sparse
meiduo_mall/meiduo_mall/apps/payment/views.py
Echo-xie/meiduo_mall
train
0
1a5b18a9d8518fce73b3dcacc0e3f01e85f1b0d7
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\ntry:\n mapping_value = parse_node.get_child_node('@odata.type').get_str_value()\nexcept AttributeError:\n mapping_value = None\nif mapping_value and mapping_value.casefold() == '#microsoft.graph.security.ediscoveryCase'.casefold():\n f...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') try: mapping_value = parse_node.get_child_node('@odata.type').get_str_value() except AttributeError: mapping_value = None if mapping_value and mapping_value.casefold() ==...
Case
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Case: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Case: """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: Case""" ...
stack_v2_sparse_classes_36k_train_021726
4,007
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: Case", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value(parse_no...
3
null
Implement the Python class `Case` described below. Class description: Implement the Case class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Case: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The pars...
Implement the Python class `Case` described below. Class description: Implement the Case class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Case: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The pars...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class Case: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Case: """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: Case""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Case: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Case: """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: Case""" if not parse_n...
the_stack_v2_python_sparse
msgraph/generated/models/security/case.py
microsoftgraph/msgraph-sdk-python
train
135
d9007df6a3ea20c6591014f0df5c7994796f9da5
[ "thousand_g = info_dict.get('1000GAF')\nif thousand_g:\n logger.debug('Updating thousand_g to: {0}'.format(thousand_g))\n variant_obj.thousand_g = float(thousand_g)\n variant_obj.add_frequency('1000GAF', variant_obj.get('thousand_g'))", "for transcript in variant_obj.transcripts:\n gmaf_raw = transcri...
<|body_start_0|> thousand_g = info_dict.get('1000GAF') if thousand_g: logger.debug('Updating thousand_g to: {0}'.format(thousand_g)) variant_obj.thousand_g = float(thousand_g) variant_obj.add_frequency('1000GAF', variant_obj.get('thousand_g')) <|end_body_0|> <|body_s...
Methods for adding frequencies
FrequenciesExtras
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FrequenciesExtras: """Methods for adding frequencies""" def _add_thousand_g(self, variant_obj, info_dict): """Add the thousand genomes frequency Args: variant_obj (puzzle.models.Variant) info_dict (dict): A info dictionary""" <|body_0|> def _add_gmaf(self, variant_obj, i...
stack_v2_sparse_classes_36k_train_021727
2,040
permissive
[ { "docstring": "Add the thousand genomes frequency Args: variant_obj (puzzle.models.Variant) info_dict (dict): A info dictionary", "name": "_add_thousand_g", "signature": "def _add_thousand_g(self, variant_obj, info_dict)" }, { "docstring": "Add the gmaf frequency Args: variant_obj (puzzle.model...
3
stack_v2_sparse_classes_30k_train_003322
Implement the Python class `FrequenciesExtras` described below. Class description: Methods for adding frequencies Method signatures and docstrings: - def _add_thousand_g(self, variant_obj, info_dict): Add the thousand genomes frequency Args: variant_obj (puzzle.models.Variant) info_dict (dict): A info dictionary - de...
Implement the Python class `FrequenciesExtras` described below. Class description: Methods for adding frequencies Method signatures and docstrings: - def _add_thousand_g(self, variant_obj, info_dict): Add the thousand genomes frequency Args: variant_obj (puzzle.models.Variant) info_dict (dict): A info dictionary - de...
9476f05b416d3a5135d25492cb31411fdf831c58
<|skeleton|> class FrequenciesExtras: """Methods for adding frequencies""" def _add_thousand_g(self, variant_obj, info_dict): """Add the thousand genomes frequency Args: variant_obj (puzzle.models.Variant) info_dict (dict): A info dictionary""" <|body_0|> def _add_gmaf(self, variant_obj, i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FrequenciesExtras: """Methods for adding frequencies""" def _add_thousand_g(self, variant_obj, info_dict): """Add the thousand genomes frequency Args: variant_obj (puzzle.models.Variant) info_dict (dict): A info dictionary""" thousand_g = info_dict.get('1000GAF') if thousand_g: ...
the_stack_v2_python_sparse
puzzle/plugins/vcf/mixins/variant_extras/frequencies.py
haoziyeung/puzzle
train
0
c7832914b90dc8456aa4978a9b2241af7038cd2d
[ "self.webservername = webservername\nself.processToFileMap = {}\nself._backend = backend\nself.registerdProcesses = []\nself.cacheCapacity = 5\nself.cache = defaultdict(list)", "self.cacheCapacity = cacheCapacity\nprint('Initializing the cache and processNames are : {}'.format(processList))\nfor key in processLis...
<|body_start_0|> self.webservername = webservername self.processToFileMap = {} self._backend = backend self.registerdProcesses = [] self.cacheCapacity = 5 self.cache = defaultdict(list) <|end_body_0|> <|body_start_1|> self.cacheCapacity = cacheCapacity pr...
FrontEnd
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FrontEnd: def __init__(self, backend, webservername): """Front End class which manages cache operations and accesses backend to write into database. :param backend: :param webservername:""" <|body_0|> def initializeCache(self, cacheCapacity, processList): """Initiali...
stack_v2_sparse_classes_36k_train_021728
4,922
no_license
[ { "docstring": "Front End class which manages cache operations and accesses backend to write into database. :param backend: :param webservername:", "name": "__init__", "signature": "def __init__(self, backend, webservername)" }, { "docstring": "Initialize the cache. Cache is write-through. :para...
6
stack_v2_sparse_classes_30k_train_011347
Implement the Python class `FrontEnd` described below. Class description: Implement the FrontEnd class. Method signatures and docstrings: - def __init__(self, backend, webservername): Front End class which manages cache operations and accesses backend to write into database. :param backend: :param webservername: - de...
Implement the Python class `FrontEnd` described below. Class description: Implement the FrontEnd class. Method signatures and docstrings: - def __init__(self, backend, webservername): Front End class which manages cache operations and accesses backend to write into database. :param backend: :param webservername: - de...
f36779ce2f1a1071391ffcd32f695d6d8cd7ff92
<|skeleton|> class FrontEnd: def __init__(self, backend, webservername): """Front End class which manages cache operations and accesses backend to write into database. :param backend: :param webservername:""" <|body_0|> def initializeCache(self, cacheCapacity, processList): """Initiali...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FrontEnd: def __init__(self, backend, webservername): """Front End class which manages cache operations and accesses backend to write into database. :param backend: :param webservername:""" self.webservername = webservername self.processToFileMap = {} self._backend = backend ...
the_stack_v2_python_sparse
src/webServer/FrontEnd.py
nehay06/Internet-of-Things-Part-2
train
0
ded654f8afa4c0d6808422abb18728a61bc7b4c6
[ "self.is_negligible = False\nself.is_incomplete = False\nself.is_conflicting = False\nself.tree = tree\nself.reconstructed_tree = None\nself.epsilon = epsilon\nself.ordered_names = [node.get_name() for node in tree.gen_tips()]\nD = tree.get_distance_matrix(self.ordered_names)\nG = MatrixUtil.double_centered(np.arra...
<|body_start_0|> self.is_negligible = False self.is_incomplete = False self.is_conflicting = False self.tree = tree self.reconstructed_tree = None self.epsilon = epsilon self.ordered_names = [node.get_name() for node in tree.gen_tips()] D = tree.get_distan...
Attempt to reconstruct a tree from the eigendecomposition of the doubly centered distance matrix. Report what happens when this is done.
AnalysisResult
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnalysisResult: """Attempt to reconstruct a tree from the eigendecomposition of the doubly centered distance matrix. Report what happens when this is done.""" def __init__(self, tree, epsilon): """@param tree: a newick tree in the felsenstein-inspired format @param epsilon: determine...
stack_v2_sparse_classes_36k_train_021729
8,708
no_license
[ { "docstring": "@param tree: a newick tree in the felsenstein-inspired format @param epsilon: determines whether loadings are considered negligible", "name": "__init__", "signature": "def __init__(self, tree, epsilon)" }, { "docstring": "@param indices: a set of indices of taxa in the current su...
3
null
Implement the Python class `AnalysisResult` described below. Class description: Attempt to reconstruct a tree from the eigendecomposition of the doubly centered distance matrix. Report what happens when this is done. Method signatures and docstrings: - def __init__(self, tree, epsilon): @param tree: a newick tree in ...
Implement the Python class `AnalysisResult` described below. Class description: Attempt to reconstruct a tree from the eigendecomposition of the doubly centered distance matrix. Report what happens when this is done. Method signatures and docstrings: - def __init__(self, tree, epsilon): @param tree: a newick tree in ...
91c6f8331f18c914eb3dfc51bc166915998c5081
<|skeleton|> class AnalysisResult: """Attempt to reconstruct a tree from the eigendecomposition of the doubly centered distance matrix. Report what happens when this is done.""" def __init__(self, tree, epsilon): """@param tree: a newick tree in the felsenstein-inspired format @param epsilon: determine...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AnalysisResult: """Attempt to reconstruct a tree from the eigendecomposition of the doubly centered distance matrix. Report what happens when this is done.""" def __init__(self, tree, epsilon): """@param tree: a newick tree in the felsenstein-inspired format @param epsilon: determines whether loa...
the_stack_v2_python_sparse
20081201a.py
argriffing/xgcode
train
1
f37b5c32a812d5101b89c304aa72b5a7cd677016
[ "self.row = 0\nself.col = 0\nself.vec2d = vec2d", "result = self.vec2d[self.row][self.col]\nself.col += 1\nreturn result", "while self.row < len(self.vec2d):\n if self.col < len(self.vec2d[self.row]):\n return True\n else:\n self.row += 1\n self.col = 0\nreturn False" ]
<|body_start_0|> self.row = 0 self.col = 0 self.vec2d = vec2d <|end_body_0|> <|body_start_1|> result = self.vec2d[self.row][self.col] self.col += 1 return result <|end_body_1|> <|body_start_2|> while self.row < len(self.vec2d): if self.col < len(self...
Vector2D
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Vector2D: def __init__(self, vec2d): """Initialize your data structure here. :type vec2d: List[List[int]]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end_skeleton|> <|bod...
stack_v2_sparse_classes_36k_train_021730
867
permissive
[ { "docstring": "Initialize your data structure here. :type vec2d: List[List[int]]", "name": "__init__", "signature": "def __init__(self, vec2d)" }, { "docstring": ":rtype: int", "name": "next", "signature": "def next(self)" }, { "docstring": ":rtype: bool", "name": "hasNext",...
3
stack_v2_sparse_classes_30k_train_015234
Implement the Python class `Vector2D` described below. Class description: Implement the Vector2D class. Method signatures and docstrings: - def __init__(self, vec2d): Initialize your data structure here. :type vec2d: List[List[int]] - def next(self): :rtype: int - def hasNext(self): :rtype: bool
Implement the Python class `Vector2D` described below. Class description: Implement the Vector2D class. Method signatures and docstrings: - def __init__(self, vec2d): Initialize your data structure here. :type vec2d: List[List[int]] - def next(self): :rtype: int - def hasNext(self): :rtype: bool <|skeleton|> class V...
2cb4b45dd14a230aa0e800042e893f8dfb23beda
<|skeleton|> class Vector2D: def __init__(self, vec2d): """Initialize your data structure here. :type vec2d: List[List[int]]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Vector2D: def __init__(self, vec2d): """Initialize your data structure here. :type vec2d: List[List[int]]""" self.row = 0 self.col = 0 self.vec2d = vec2d def next(self): """:rtype: int""" result = self.vec2d[self.row][self.col] self.col += 1 ...
the_stack_v2_python_sparse
MY_REPOS/INTERVIEW-PREP-COMPLETE/Leetcode/251.py
bgoonz/UsefulResourceRepo2.0
train
10
6f322bd029936e8cb282e83087fb61feca09a95d
[ "self.similar_stock = kwargs['similar_stock']\nself.n_top = g_pick_similar_n_top\nif 'n_top' in kwargs:\n self.n_top = kwargs['n_top']\nself.threshold_similar_min = -np.inf\nif 'threshold_similar_min' in kwargs:\n self.threshold_similar_min = kwargs['threshold_similar_min']\nself.threshold_similar_max = np.in...
<|body_start_0|> self.similar_stock = kwargs['similar_stock'] self.n_top = g_pick_similar_n_top if 'n_top' in kwargs: self.n_top = kwargs['n_top'] self.threshold_similar_min = -np.inf if 'threshold_similar_min' in kwargs: self.threshold_similar_min = kwarg...
相似度选股因子示例类
AbuPickSimilarNTop
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AbuPickSimilarNTop: """相似度选股因子示例类""" def _init_self(self, **kwargs): """通过kwargs设置相似度选股边际条件,相似度计算方法,返回目标数量等,配置因子参数""" <|body_0|> def fit_pick(self, kl_pd, target_symbol): """开始根据自定义相似度边际条件进行选股""" <|body_1|> def fit_first_choice(self, pick_worker, cho...
stack_v2_sparse_classes_36k_train_021731
4,344
permissive
[ { "docstring": "通过kwargs设置相似度选股边际条件,相似度计算方法,返回目标数量等,配置因子参数", "name": "_init_self", "signature": "def _init_self(self, **kwargs)" }, { "docstring": "开始根据自定义相似度边际条件进行选股", "name": "fit_pick", "signature": "def fit_pick(self, kl_pd, target_symbol)" }, { "docstring": "因子相似度批量选股接口 :par...
3
null
Implement the Python class `AbuPickSimilarNTop` described below. Class description: 相似度选股因子示例类 Method signatures and docstrings: - def _init_self(self, **kwargs): 通过kwargs设置相似度选股边际条件,相似度计算方法,返回目标数量等,配置因子参数 - def fit_pick(self, kl_pd, target_symbol): 开始根据自定义相似度边际条件进行选股 - def fit_first_choice(self, pick_worker, choice_...
Implement the Python class `AbuPickSimilarNTop` described below. Class description: 相似度选股因子示例类 Method signatures and docstrings: - def _init_self(self, **kwargs): 通过kwargs设置相似度选股边际条件,相似度计算方法,返回目标数量等,配置因子参数 - def fit_pick(self, kl_pd, target_symbol): 开始根据自定义相似度边际条件进行选股 - def fit_first_choice(self, pick_worker, choice_...
2e5ab17f2d20deb3c68c927f6208ea89db7c639d
<|skeleton|> class AbuPickSimilarNTop: """相似度选股因子示例类""" def _init_self(self, **kwargs): """通过kwargs设置相似度选股边际条件,相似度计算方法,返回目标数量等,配置因子参数""" <|body_0|> def fit_pick(self, kl_pd, target_symbol): """开始根据自定义相似度边际条件进行选股""" <|body_1|> def fit_first_choice(self, pick_worker, cho...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AbuPickSimilarNTop: """相似度选股因子示例类""" def _init_self(self, **kwargs): """通过kwargs设置相似度选股边际条件,相似度计算方法,返回目标数量等,配置因子参数""" self.similar_stock = kwargs['similar_stock'] self.n_top = g_pick_similar_n_top if 'n_top' in kwargs: self.n_top = kwargs['n_top'] self....
the_stack_v2_python_sparse
abupy/PickStockBu/ABuPickSimilarNTop.py
luqin/firefly
train
1
323c56fb489c6d5a38ea5175a9e60296df711200
[ "self.vocab_size = int(config['dict_size'])\nself.emb_size = int(config['net']['embedding_dim'])\nself.lstm_dim = int(config['net']['lstm_dim'])\nself.kernel_size = int(config['net']['num_filters'])\nself.win_size1 = int(config['net']['window_size_left'])\nself.win_size2 = int(config['net']['window_size_right'])\ns...
<|body_start_0|> self.vocab_size = int(config['dict_size']) self.emb_size = int(config['net']['embedding_dim']) self.lstm_dim = int(config['net']['lstm_dim']) self.kernel_size = int(config['net']['num_filters']) self.win_size1 = int(config['net']['window_size_left']) self...
MMDNN
MMDNN
[ "Apache-2.0", "LicenseRef-scancode-unknown", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MMDNN: """MMDNN""" def __init__(self, config): """initialize""" <|body_0|> def embedding_layer(self, input, zero_pad=True, scale=True): """embedding layer""" <|body_1|> def bi_dynamic_lstm(self, input, hidden_size): """bi_lstm layer""" ...
stack_v2_sparse_classes_36k_train_021732
6,921
permissive
[ { "docstring": "initialize", "name": "__init__", "signature": "def __init__(self, config)" }, { "docstring": "embedding layer", "name": "embedding_layer", "signature": "def embedding_layer(self, input, zero_pad=True, scale=True)" }, { "docstring": "bi_lstm layer", "name": "bi...
6
null
Implement the Python class `MMDNN` described below. Class description: MMDNN Method signatures and docstrings: - def __init__(self, config): initialize - def embedding_layer(self, input, zero_pad=True, scale=True): embedding layer - def bi_dynamic_lstm(self, input, hidden_size): bi_lstm layer - def conv_pool_relu_lay...
Implement the Python class `MMDNN` described below. Class description: MMDNN Method signatures and docstrings: - def __init__(self, config): initialize - def embedding_layer(self, input, zero_pad=True, scale=True): embedding layer - def bi_dynamic_lstm(self, input, hidden_size): bi_lstm layer - def conv_pool_relu_lay...
a60babdf382aba71fe447b3259441b4bed947414
<|skeleton|> class MMDNN: """MMDNN""" def __init__(self, config): """initialize""" <|body_0|> def embedding_layer(self, input, zero_pad=True, scale=True): """embedding layer""" <|body_1|> def bi_dynamic_lstm(self, input, hidden_size): """bi_lstm layer""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MMDNN: """MMDNN""" def __init__(self, config): """initialize""" self.vocab_size = int(config['dict_size']) self.emb_size = int(config['net']['embedding_dim']) self.lstm_dim = int(config['net']['lstm_dim']) self.kernel_size = int(config['net']['num_filters']) ...
the_stack_v2_python_sparse
PaddleNLP/shared_modules/models/matching/mm_dnn.py
littletomatodonkey/models
train
5
f2fc648c16704b6083370eb063c9d458fa79ef77
[ "try:\n import pybind11\nexcept ImportError:\n raise ImportError('Requires pybind11 to be installed.')\nself.module_name = module_name\nself.cflags = flags['cflags']\nself.ldflags = flags['ldflags']\nself.file_name = file_name\nresult = self.compile_cpp()\nif result.returncode:\n raise RuntimeError('Callin...
<|body_start_0|> try: import pybind11 except ImportError: raise ImportError('Requires pybind11 to be installed.') self.module_name = module_name self.cflags = flags['cflags'] self.ldflags = flags['ldflags'] self.file_name = file_name result...
Class to compile the C++ file into a shared object. This class will simply compile the program into a shared object based on Pybind11 binding. The file name and module name has to be consistent; i.e., file name should be `<module_name>.cpp`.
Pybind11Compile
[ "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Pybind11Compile: """Class to compile the C++ file into a shared object. This class will simply compile the program into a shared object based on Pybind11 binding. The file name and module name has to be consistent; i.e., file name should be `<module_name>.cpp`.""" def __init__(self, module_n...
stack_v2_sparse_classes_36k_train_021733
4,494
permissive
[ { "docstring": "Instantiate Pybind11Program instance. The program will be compiled during instantiation. The shared object after compilation will be copied to `lib<module_name>.so` so it can be linked by other C++ program. Parameters ---------- module_name : str The name of the python module. flags : dict Optio...
2
null
Implement the Python class `Pybind11Compile` described below. Class description: Class to compile the C++ file into a shared object. This class will simply compile the program into a shared object based on Pybind11 binding. The file name and module name has to be consistent; i.e., file name should be `<module_name>.cp...
Implement the Python class `Pybind11Compile` described below. Class description: Class to compile the C++ file into a shared object. This class will simply compile the program into a shared object based on Pybind11 binding. The file name and module name has to be consistent; i.e., file name should be `<module_name>.cp...
38e9fcee46f0839e83e123cf22af76b13671a574
<|skeleton|> class Pybind11Compile: """Class to compile the C++ file into a shared object. This class will simply compile the program into a shared object based on Pybind11 binding. The file name and module name has to be consistent; i.e., file name should be `<module_name>.cpp`.""" def __init__(self, module_n...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Pybind11Compile: """Class to compile the C++ file into a shared object. This class will simply compile the program into a shared object based on Pybind11 binding. The file name and module name has to be consistent; i.e., file name should be `<module_name>.cpp`.""" def __init__(self, module_name, flags, f...
the_stack_v2_python_sparse
pynq/lib/pybind11/compile.py
yunqu/PYNQ
train
8
ded24f83861f5c19caa14e6f605e277e09f0a1fa
[ "if self.product_name:\n product_name_lst = regex_replace.sub(' ', self.product_name.lower()).split(' ')\n product_name_lst = [x for x in product_name_lst if x and len(x) > 2]\n self.partial_strings = product_name_lst", "words = text_query.lower().split(' ')\nwords = [w for w in words if w]\nquery = cls....
<|body_start_0|> if self.product_name: product_name_lst = regex_replace.sub(' ', self.product_name.lower()).split(' ') product_name_lst = [x for x in product_name_lst if x and len(x) > 2] self.partial_strings = product_name_lst <|end_body_0|> <|body_start_1|> words =...
Datastore model representing product
Product
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Product: """Datastore model representing product""" def _pre_put_hook(self): """Before save, parse product name into strings""" <|body_0|> def search(cls, text_query): """Execute search query""" <|body_1|> def create(cls, item): """Create obj...
stack_v2_sparse_classes_36k_train_021734
1,286
no_license
[ { "docstring": "Before save, parse product name into strings", "name": "_pre_put_hook", "signature": "def _pre_put_hook(self)" }, { "docstring": "Execute search query", "name": "search", "signature": "def search(cls, text_query)" }, { "docstring": "Create object (doesn't save)", ...
3
stack_v2_sparse_classes_30k_train_005358
Implement the Python class `Product` described below. Class description: Datastore model representing product Method signatures and docstrings: - def _pre_put_hook(self): Before save, parse product name into strings - def search(cls, text_query): Execute search query - def create(cls, item): Create object (doesn't sa...
Implement the Python class `Product` described below. Class description: Datastore model representing product Method signatures and docstrings: - def _pre_put_hook(self): Before save, parse product name into strings - def search(cls, text_query): Execute search query - def create(cls, item): Create object (doesn't sa...
1cf559996e972d1c963996fe6aab65ac021dab31
<|skeleton|> class Product: """Datastore model representing product""" def _pre_put_hook(self): """Before save, parse product name into strings""" <|body_0|> def search(cls, text_query): """Execute search query""" <|body_1|> def create(cls, item): """Create obj...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Product: """Datastore model representing product""" def _pre_put_hook(self): """Before save, parse product name into strings""" if self.product_name: product_name_lst = regex_replace.sub(' ', self.product_name.lower()).split(' ') product_name_lst = [x for x in prod...
the_stack_v2_python_sparse
cloud_datastore/webapp/models.py
zdenulo/gcp-search
train
4
fc81fb393f4f7f5882c899edf6023835c1620716
[ "databases = self.process(path)\nqafile = os.path.join(path, 'questions.db')\ndb2qa = DB2QA()\ndb2qa(databases, qafile)", "for source in Execute.SOURCES:\n spath = os.path.join(path, source)\n decompress = Decompress()\n decompress(spath)\n posts = os.path.join(spath, 'Posts.xml')\n filtered = os.p...
<|body_start_0|> databases = self.process(path) qafile = os.path.join(path, 'questions.db') db2qa = DB2QA() db2qa(databases, qafile) <|end_body_0|> <|body_start_1|> for source in Execute.SOURCES: spath = os.path.join(path, source) decompress = Decompress(...
Main execution method to build a consolidated questions.db file from Stack Exchange Data Dumps.
Execute
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Execute: """Main execution method to build a consolidated questions.db file from Stack Exchange Data Dumps.""" def __call__(self, path): """Converts a directory of raw sources to a single output questions database. Args: path: base directory path""" <|body_0|> def proces...
stack_v2_sparse_classes_36k_train_021735
2,735
permissive
[ { "docstring": "Converts a directory of raw sources to a single output questions database. Args: path: base directory path", "name": "__call__", "signature": "def __call__(self, path)" }, { "docstring": "Iterates through each source and converts raw xml to SQLite databases. Returns a list of out...
2
stack_v2_sparse_classes_30k_train_005882
Implement the Python class `Execute` described below. Class description: Main execution method to build a consolidated questions.db file from Stack Exchange Data Dumps. Method signatures and docstrings: - def __call__(self, path): Converts a directory of raw sources to a single output questions database. Args: path: ...
Implement the Python class `Execute` described below. Class description: Main execution method to build a consolidated questions.db file from Stack Exchange Data Dumps. Method signatures and docstrings: - def __call__(self, path): Converts a directory of raw sources to a single output questions database. Args: path: ...
f398344a4d4bb9dc196a34a504b3d728f71a53ac
<|skeleton|> class Execute: """Main execution method to build a consolidated questions.db file from Stack Exchange Data Dumps.""" def __call__(self, path): """Converts a directory of raw sources to a single output questions database. Args: path: base directory path""" <|body_0|> def proces...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Execute: """Main execution method to build a consolidated questions.db file from Stack Exchange Data Dumps.""" def __call__(self, path): """Converts a directory of raw sources to a single output questions database. Args: path: base directory path""" databases = self.process(path) ...
the_stack_v2_python_sparse
src/python/codequestion/etl/stackexchange/execute.py
neuml/codequestion
train
458
7e30246aeaa7aeef0f86fd60e942dd6e0a2644c4
[ "super(VanillaLstmEncDec, self).__init__()\nself.embedding_dim = embedding_dim\nself.h_dim = h_dim\nself.num_layers = num_layers\nself.dropout = dropout\nself.discard_zeros = discard_zeros\nself.extra_info = extra_info\nself.encoder = Encoder(embedding_dim, h_dim, num_layers, dropout, activation_on_input_embedding,...
<|body_start_0|> super(VanillaLstmEncDec, self).__init__() self.embedding_dim = embedding_dim self.h_dim = h_dim self.num_layers = num_layers self.dropout = dropout self.discard_zeros = discard_zeros self.extra_info = extra_info self.encoder = Encoder(embe...
Model similar to VanillaLSTM. The big difference here is the use of a encoder-decoder architecture. This means that there is are two separate LSTM networks (each one has their own weights). The Encoder processes the past trajectory, and the Decoder outputs the predicted trajectory.
VanillaLstmEncDec
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VanillaLstmEncDec: """Model similar to VanillaLSTM. The big difference here is the use of a encoder-decoder architecture. This means that there is are two separate LSTM networks (each one has their own weights). The Encoder processes the past trajectory, and the Decoder outputs the predicted traj...
stack_v2_sparse_classes_36k_train_021736
25,802
permissive
[ { "docstring": "For definition on the fields and parameters, refer to class VanillaLSTM :param extra_info: equivalent to history_on_pred parameter, but this one can have a different meaning in classes extending this one.", "name": "__init__", "signature": "def __init__(self, embedding_dim=64, h_dim=64, ...
2
stack_v2_sparse_classes_30k_test_001092
Implement the Python class `VanillaLstmEncDec` described below. Class description: Model similar to VanillaLSTM. The big difference here is the use of a encoder-decoder architecture. This means that there is are two separate LSTM networks (each one has their own weights). The Encoder processes the past trajectory, and...
Implement the Python class `VanillaLstmEncDec` described below. Class description: Model similar to VanillaLSTM. The big difference here is the use of a encoder-decoder architecture. This means that there is are two separate LSTM networks (each one has their own weights). The Encoder processes the past trajectory, and...
1b9fbe6c89c74dc706fd8d3b11ea08977ba2c1d3
<|skeleton|> class VanillaLstmEncDec: """Model similar to VanillaLSTM. The big difference here is the use of a encoder-decoder architecture. This means that there is are two separate LSTM networks (each one has their own weights). The Encoder processes the past trajectory, and the Decoder outputs the predicted traj...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VanillaLstmEncDec: """Model similar to VanillaLSTM. The big difference here is the use of a encoder-decoder architecture. This means that there is are two separate LSTM networks (each one has their own weights). The Encoder processes the past trajectory, and the Decoder outputs the predicted trajectory.""" ...
the_stack_v2_python_sparse
models/lstm/lstm.py
pedro-mgb/pedestrian-arc-lstm-smf
train
4
48ae7f1459a40334c51947dbf3f0cd530c6ff262
[ "fileGroups = {}\nfoundFiles = []\nfor mergeableFile in mergeableFiles:\n if mergeableFile['file_lfn'] not in foundFiles:\n foundFiles.append(mergeableFile['file_lfn'])\n else:\n continue\n if mergeableFile['pnn'] not in fileGroups:\n if self.mergeAcrossRuns:\n fileGroups[me...
<|body_start_0|> fileGroups = {} foundFiles = [] for mergeableFile in mergeableFiles: if mergeableFile['file_lfn'] not in foundFiles: foundFiles.append(mergeableFile['file_lfn']) else: continue if mergeableFile['pnn'] not in fil...
ParentlessMergeBySize
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ParentlessMergeBySize: def defineFileGroups(self, mergeableFiles): """_defineFileGroups_ Group mergeable files by their SE name and run number so that we don't try to merge together files on different SEs. Merging against across run boundaries is configurable.""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_021737
8,076
permissive
[ { "docstring": "_defineFileGroups_ Group mergeable files by their SE name and run number so that we don't try to merge together files on different SEs. Merging against across run boundaries is configurable.", "name": "defineFileGroups", "signature": "def defineFileGroups(self, mergeableFiles)" }, { ...
4
stack_v2_sparse_classes_30k_train_008553
Implement the Python class `ParentlessMergeBySize` described below. Class description: Implement the ParentlessMergeBySize class. Method signatures and docstrings: - def defineFileGroups(self, mergeableFiles): _defineFileGroups_ Group mergeable files by their SE name and run number so that we don't try to merge toget...
Implement the Python class `ParentlessMergeBySize` described below. Class description: Implement the ParentlessMergeBySize class. Method signatures and docstrings: - def defineFileGroups(self, mergeableFiles): _defineFileGroups_ Group mergeable files by their SE name and run number so that we don't try to merge toget...
de110ccf6fc63ef5589b4e871ef4d51d5bce7a25
<|skeleton|> class ParentlessMergeBySize: def defineFileGroups(self, mergeableFiles): """_defineFileGroups_ Group mergeable files by their SE name and run number so that we don't try to merge together files on different SEs. Merging against across run boundaries is configurable.""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ParentlessMergeBySize: def defineFileGroups(self, mergeableFiles): """_defineFileGroups_ Group mergeable files by their SE name and run number so that we don't try to merge together files on different SEs. Merging against across run boundaries is configurable.""" fileGroups = {} foundF...
the_stack_v2_python_sparse
src/python/WMCore/JobSplitting/ParentlessMergeBySize.py
vkuznet/WMCore
train
0
6cccdd0fc8c6402e5fcfcc96508f6a519c582342
[ "relevant_items = [item for item in self.contents.get_content_items() if isinstance(item, PictureItem) or isinstance(item, OEmbedItem)]\nitem = relevant_items.pop(0)\nif isinstance(item, PictureItem):\n request = kwargs.get('request')\n location = item.image.url\n absolute_uri = request.build_absolute_uri(...
<|body_start_0|> relevant_items = [item for item in self.contents.get_content_items() if isinstance(item, PictureItem) or isinstance(item, OEmbedItem)] item = relevant_items.pop(0) if isinstance(item, PictureItem): request = kwargs.get('request') location = item.image.url...
This is a model purely for MetaData testing in the API.
MetaDataModel
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MetaDataModel: """This is a model purely for MetaData testing in the API.""" def get_first_image(self, **kwargs): """Get all the content items and filter out those that are pictures. Return the url of the first picture.""" <|body_0|> def get_image_without_is_url(self, **...
stack_v2_sparse_classes_36k_train_021738
5,001
permissive
[ { "docstring": "Get all the content items and filter out those that are pictures. Return the url of the first picture.", "name": "get_first_image", "signature": "def get_first_image(self, **kwargs)" }, { "docstring": "Return an image to be serialized", "name": "get_image_without_is_url", ...
2
stack_v2_sparse_classes_30k_train_001141
Implement the Python class `MetaDataModel` described below. Class description: This is a model purely for MetaData testing in the API. Method signatures and docstrings: - def get_first_image(self, **kwargs): Get all the content items and filter out those that are pictures. Return the url of the first picture. - def g...
Implement the Python class `MetaDataModel` described below. Class description: This is a model purely for MetaData testing in the API. Method signatures and docstrings: - def get_first_image(self, **kwargs): Get all the content items and filter out those that are pictures. Return the url of the first picture. - def g...
6812a376a48272fcb03fd5c9ea2ab9a6d4bf0fd8
<|skeleton|> class MetaDataModel: """This is a model purely for MetaData testing in the API.""" def get_first_image(self, **kwargs): """Get all the content items and filter out those that are pictures. Return the url of the first picture.""" <|body_0|> def get_image_without_is_url(self, **...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MetaDataModel: """This is a model purely for MetaData testing in the API.""" def get_first_image(self, **kwargs): """Get all the content items and filter out those that are pictures. Return the url of the first picture.""" relevant_items = [item for item in self.contents.get_content_items...
the_stack_v2_python_sparse
bluebottle/utils/models.py
jfterpstra/bluebottle
train
0
f33491474921323d9182841d1ea478dc790a3a00
[ "self.best_acc = {}\nself.acc_metric = ACC(num_class=num_class)\nself.log = logging.getLogger('avalanche')", "acc, accs = self.acc_metric.compute(y, y_hat)\nif train_t not in self.best_acc.keys() and train_t == test_t:\n self.best_acc[train_t] = acc\nif test_t not in self.best_acc.keys():\n cf = np.NAN\nels...
<|body_start_0|> self.best_acc = {} self.acc_metric = ACC(num_class=num_class) self.log = logging.getLogger('avalanche') <|end_body_0|> <|body_start_1|> acc, accs = self.acc_metric.compute(y, y_hat) if train_t not in self.best_acc.keys() and train_t == test_t: self.b...
CF
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CF: def __init__(self, num_class=None): """Catastrophic Forgetting metric.""" <|body_0|> def compute(self, y, y_hat, train_t, test_t): """:param y (tensor list or tensor): true labels for each mini-batch :param y_hat (tensor list or tensor): predicted labels for each...
stack_v2_sparse_classes_36k_train_021739
14,483
permissive
[ { "docstring": "Catastrophic Forgetting metric.", "name": "__init__", "signature": "def __init__(self, num_class=None)" }, { "docstring": ":param y (tensor list or tensor): true labels for each mini-batch :param y_hat (tensor list or tensor): predicted labels for each mini-batch", "name": "c...
2
stack_v2_sparse_classes_30k_train_015750
Implement the Python class `CF` described below. Class description: Implement the CF class. Method signatures and docstrings: - def __init__(self, num_class=None): Catastrophic Forgetting metric. - def compute(self, y, y_hat, train_t, test_t): :param y (tensor list or tensor): true labels for each mini-batch :param y...
Implement the Python class `CF` described below. Class description: Implement the CF class. Method signatures and docstrings: - def __init__(self, num_class=None): Catastrophic Forgetting metric. - def compute(self, y, y_hat, train_t, test_t): :param y (tensor list or tensor): true labels for each mini-batch :param y...
897bde82471ef92ded396aa31d91ec19826d4ce2
<|skeleton|> class CF: def __init__(self, num_class=None): """Catastrophic Forgetting metric.""" <|body_0|> def compute(self, y, y_hat, train_t, test_t): """:param y (tensor list or tensor): true labels for each mini-batch :param y_hat (tensor list or tensor): predicted labels for each...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CF: def __init__(self, num_class=None): """Catastrophic Forgetting metric.""" self.best_acc = {} self.acc_metric = ACC(num_class=num_class) self.log = logging.getLogger('avalanche') def compute(self, y, y_hat, train_t, test_t): """:param y (tensor list or tensor): ...
the_stack_v2_python_sparse
CL_metrics_CLAIR.py
samuilstoychev/research_project
train
0
bfc0dcb519744aeb476b1ddcbe22a553eb746aa7
[ "self.conf = gkeep_conf\nself.keep = gkeepapi.Keep()\nself.keep.resume(gkeep_conf['api_username'], keyring.get_password('gkeep-key', gkeep_conf['api_username']))\nself.keep.sync()", "for course, course_params in courses.items():\n if len((course_note_list := list(self.keep.find(course_params['nickname'])))) ==...
<|body_start_0|> self.conf = gkeep_conf self.keep = gkeepapi.Keep() self.keep.resume(gkeep_conf['api_username'], keyring.get_password('gkeep-key', gkeep_conf['api_username'])) self.keep.sync() <|end_body_0|> <|body_start_1|> for course, course_params in courses.items(): ...
Google Keep class, used to interface with Google Keep
GKeep
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GKeep: """Google Keep class, used to interface with Google Keep""" def __init__(self, gkeep_conf: Dict): """Initialize google keep object Parameters ---------- gkeep_conf : Dict google keep configuration""" <|body_0|> def post_todo_state(self, update_dict: Dict[int, Dict...
stack_v2_sparse_classes_36k_train_021740
4,309
permissive
[ { "docstring": "Initialize google keep object Parameters ---------- gkeep_conf : Dict google keep configuration", "name": "__init__", "signature": "def __init__(self, gkeep_conf: Dict)" }, { "docstring": "Posts state to API to match with new changes Parameters ---------- update_dict : Dict[int, ...
4
stack_v2_sparse_classes_30k_train_012675
Implement the Python class `GKeep` described below. Class description: Google Keep class, used to interface with Google Keep Method signatures and docstrings: - def __init__(self, gkeep_conf: Dict): Initialize google keep object Parameters ---------- gkeep_conf : Dict google keep configuration - def post_todo_state(s...
Implement the Python class `GKeep` described below. Class description: Google Keep class, used to interface with Google Keep Method signatures and docstrings: - def __init__(self, gkeep_conf: Dict): Initialize google keep object Parameters ---------- gkeep_conf : Dict google keep configuration - def post_todo_state(s...
ec37cb06c03fe942a8c57b98bc7b9f0086c6e661
<|skeleton|> class GKeep: """Google Keep class, used to interface with Google Keep""" def __init__(self, gkeep_conf: Dict): """Initialize google keep object Parameters ---------- gkeep_conf : Dict google keep configuration""" <|body_0|> def post_todo_state(self, update_dict: Dict[int, Dict...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GKeep: """Google Keep class, used to interface with Google Keep""" def __init__(self, gkeep_conf: Dict): """Initialize google keep object Parameters ---------- gkeep_conf : Dict google keep configuration""" self.conf = gkeep_conf self.keep = gkeepapi.Keep() self.keep.resum...
the_stack_v2_python_sparse
canvas_todo/todo/gkeep.py
ryansingman/canvas-todo
train
0
0d6e5ee3cc02ede6de613b9c96492372e087416d
[ "self.pr = pr\nself.retEvent = False if events is None else True\nself.events = events", "res = random.random() < self.pr\nif self.retEvent:\n res = self.events[0] if res else self.events[1]\nreturn res" ]
<|body_start_0|> self.pr = pr self.retEvent = False if events is None else True self.events = events <|end_body_0|> <|body_start_1|> res = random.random() < self.pr if self.retEvent: res = self.events[0] if res else self.events[1] return res <|end_body_1|>
bernoulli trial sampler return True or False
BernoulliTrialSampler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BernoulliTrialSampler: """bernoulli trial sampler return True or False""" def __init__(self, pr, events=None): """initializer Parameters pr : probability events : event values""" <|body_0|> def sample(self): """samples value""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k_train_021741
32,264
permissive
[ { "docstring": "initializer Parameters pr : probability events : event values", "name": "__init__", "signature": "def __init__(self, pr, events=None)" }, { "docstring": "samples value", "name": "sample", "signature": "def sample(self)" } ]
2
stack_v2_sparse_classes_30k_train_010193
Implement the Python class `BernoulliTrialSampler` described below. Class description: bernoulli trial sampler return True or False Method signatures and docstrings: - def __init__(self, pr, events=None): initializer Parameters pr : probability events : event values - def sample(self): samples value
Implement the Python class `BernoulliTrialSampler` described below. Class description: bernoulli trial sampler return True or False Method signatures and docstrings: - def __init__(self, pr, events=None): initializer Parameters pr : probability events : event values - def sample(self): samples value <|skeleton|> cla...
861fd06b6b7abaffe5e8ca795136ab0fbb2234b5
<|skeleton|> class BernoulliTrialSampler: """bernoulli trial sampler return True or False""" def __init__(self, pr, events=None): """initializer Parameters pr : probability events : event values""" <|body_0|> def sample(self): """samples value""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BernoulliTrialSampler: """bernoulli trial sampler return True or False""" def __init__(self, pr, events=None): """initializer Parameters pr : probability events : event values""" self.pr = pr self.retEvent = False if events is None else True self.events = events def s...
the_stack_v2_python_sparse
matumizi/matumizi/sampler.py
pranab/whakapai
train
18
3dd0d8edb17023d24740181a00f06d6ec22ff317
[ "visit_func = getattr(self, f'visit_{type(node).__name__}', None)\nif visit_func is not None:\n retval = visit_func(node)\nelse:\n retval = True\nreturn False if retval is False else True", "leave_func = getattr(self, f'leave_{type(original_node).__name__}', None)\nif leave_func is not None:\n leave_func...
<|body_start_0|> visit_func = getattr(self, f'visit_{type(node).__name__}', None) if visit_func is not None: retval = visit_func(node) else: retval = True return False if retval is False else True <|end_body_0|> <|body_start_1|> leave_func = getattr(self,...
The low-level base visitor class for traversing a CST. This should be used in conjunction with the :func:`~libcst.CSTNode.visit` method on a :class:`~libcst.CSTNode` to visit each element in a tree starting with that node. Unlike :class:`CSTTransformer`, instances of this class cannot modify the tree. When visiting nod...
CSTVisitor
[ "Python-2.0", "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CSTVisitor: """The low-level base visitor class for traversing a CST. This should be used in conjunction with the :func:`~libcst.CSTNode.visit` method on a :class:`~libcst.CSTNode` to visit each element in a tree starting with that node. Unlike :class:`CSTTransformer`, instances of this class can...
stack_v2_sparse_classes_36k_train_021742
6,835
permissive
[ { "docstring": "Called every time a node is visited, before we've visited its children. Returns ``True`` if children should be visited, and returns ``False`` otherwise.", "name": "on_visit", "signature": "def on_visit(self, node: 'CSTNode') -> bool" }, { "docstring": "Called every time we leave ...
4
stack_v2_sparse_classes_30k_train_009337
Implement the Python class `CSTVisitor` described below. Class description: The low-level base visitor class for traversing a CST. This should be used in conjunction with the :func:`~libcst.CSTNode.visit` method on a :class:`~libcst.CSTNode` to visit each element in a tree starting with that node. Unlike :class:`CSTTr...
Implement the Python class `CSTVisitor` described below. Class description: The low-level base visitor class for traversing a CST. This should be used in conjunction with the :func:`~libcst.CSTNode.visit` method on a :class:`~libcst.CSTNode` to visit each element in a tree starting with that node. Unlike :class:`CSTTr...
9286446f889f1778b8f11451a68107052b2930b3
<|skeleton|> class CSTVisitor: """The low-level base visitor class for traversing a CST. This should be used in conjunction with the :func:`~libcst.CSTNode.visit` method on a :class:`~libcst.CSTNode` to visit each element in a tree starting with that node. Unlike :class:`CSTTransformer`, instances of this class can...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CSTVisitor: """The low-level base visitor class for traversing a CST. This should be used in conjunction with the :func:`~libcst.CSTNode.visit` method on a :class:`~libcst.CSTNode` to visit each element in a tree starting with that node. Unlike :class:`CSTTransformer`, instances of this class cannot modify th...
the_stack_v2_python_sparse
libcst/_visitors.py
Instagram/LibCST
train
1,300
31a3a2f3b0aa37231e4880d27899c4807f2ae911
[ "super().__init__()\nself.start = tf.keras.layers.Conv1D(hiddens, 1)\nself.end = tf.keras.layers.Conv1D(channels, 1, kernel_initializer='zeros')\nself.nonlinear = nonlinear", "x = self.start(inputs) * mask[..., None]\nx = self.nonlinear(x, mask)\nbias, logscale = tf.split(self.end(x), 2, axis=-1)\nreturn (bias, l...
<|body_start_0|> super().__init__() self.start = tf.keras.layers.Conv1D(hiddens, 1) self.end = tf.keras.layers.Conv1D(channels, 1, kernel_initializer='zeros') self.nonlinear = nonlinear <|end_body_0|> <|body_start_1|> x = self.start(inputs) * mask[..., None] x = self.non...
Affine coupling layer.
AffineCoupling
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AffineCoupling: """Affine coupling layer.""" def __init__(self, channels: int, hiddens: int, nonlinear: tf.keras.Model): """Initializer. Args: channels: size of the input/output channels. hiddens: size of the hidden channels. nonlinear: nonlinear transformer.""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_021743
2,835
permissive
[ { "docstring": "Initializer. Args: channels: size of the input/output channels. hiddens: size of the hidden channels. nonlinear: nonlinear transformer.", "name": "__init__", "signature": "def __init__(self, channels: int, hiddens: int, nonlinear: tf.keras.Model)" }, { "docstring": "Generate affi...
4
stack_v2_sparse_classes_30k_train_004939
Implement the Python class `AffineCoupling` described below. Class description: Affine coupling layer. Method signatures and docstrings: - def __init__(self, channels: int, hiddens: int, nonlinear: tf.keras.Model): Initializer. Args: channels: size of the input/output channels. hiddens: size of the hidden channels. n...
Implement the Python class `AffineCoupling` described below. Class description: Affine coupling layer. Method signatures and docstrings: - def __init__(self, channels: int, hiddens: int, nonlinear: tf.keras.Model): Initializer. Args: channels: size of the input/output channels. hiddens: size of the hidden channels. n...
c9df591d339eb998daf4f1e5a922a61309b6363d
<|skeleton|> class AffineCoupling: """Affine coupling layer.""" def __init__(self, channels: int, hiddens: int, nonlinear: tf.keras.Model): """Initializer. Args: channels: size of the input/output channels. hiddens: size of the hidden channels. nonlinear: nonlinear transformer.""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AffineCoupling: """Affine coupling layer.""" def __init__(self, channels: int, hiddens: int, nonlinear: tf.keras.Model): """Initializer. Args: channels: size of the input/output channels. hiddens: size of the hidden channels. nonlinear: nonlinear transformer.""" super().__init__() ...
the_stack_v2_python_sparse
glowtts/flow/coupling.py
ishine/tf-glow-tts
train
0
15b7308e19114c2849f55f477f4bc4ace2e14e93
[ "holidays = get_holidays(start_date, end_date, include_weekends=False)\nint_holidays = [self.yyyymmdd_date(h) for h in holidays]\nreturn int_holidays", "int_holidays = self.generate_holidays(start, end)\nmon = self.gen_calendars_mongo_coll()\ntry:\n mon.update_many({'code': 'SH000001', 'ok': False, 'date_int':...
<|body_start_0|> holidays = get_holidays(start_date, end_date, include_weekends=False) int_holidays = [self.yyyymmdd_date(h) for h in holidays] return int_holidays <|end_body_0|> <|body_start_1|> int_holidays = self.generate_holidays(start, end) mon = self.gen_calendars_mongo_co...
混入标记法定节假日的功能
HolidaysMixin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HolidaysMixin: """混入标记法定节假日的功能""" def generate_holidays(self, start_date, end_date): """利用 chinese-calendar 的第三方库生成起止时间段内的法定节假日列表 并将其转换为 date_int 的格式 :param start_date: :param end_date: :return:""" <|body_0|> def add_holiday_field(self, start, end): """为指定时间段内的数据...
stack_v2_sparse_classes_36k_train_021744
2,660
no_license
[ { "docstring": "利用 chinese-calendar 的第三方库生成起止时间段内的法定节假日列表 并将其转换为 date_int 的格式 :param start_date: :param end_date: :return:", "name": "generate_holidays", "signature": "def generate_holidays(self, start_date, end_date)" }, { "docstring": "为指定时间段内的数据根据 holidays 列表添加 holiday 字段 :param start: :param...
4
stack_v2_sparse_classes_30k_val_000580
Implement the Python class `HolidaysMixin` described below. Class description: 混入标记法定节假日的功能 Method signatures and docstrings: - def generate_holidays(self, start_date, end_date): 利用 chinese-calendar 的第三方库生成起止时间段内的法定节假日列表 并将其转换为 date_int 的格式 :param start_date: :param end_date: :return: - def add_holiday_field(self, st...
Implement the Python class `HolidaysMixin` described below. Class description: 混入标记法定节假日的功能 Method signatures and docstrings: - def generate_holidays(self, start_date, end_date): 利用 chinese-calendar 的第三方库生成起止时间段内的法定节假日列表 并将其转换为 date_int 的格式 :param start_date: :param end_date: :return: - def add_holiday_field(self, st...
6693011428ba020b1e5490bd4b7be72abd6ec082
<|skeleton|> class HolidaysMixin: """混入标记法定节假日的功能""" def generate_holidays(self, start_date, end_date): """利用 chinese-calendar 的第三方库生成起止时间段内的法定节假日列表 并将其转换为 date_int 的格式 :param start_date: :param end_date: :return:""" <|body_0|> def add_holiday_field(self, start, end): """为指定时间段内的数据...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HolidaysMixin: """混入标记法定节假日的功能""" def generate_holidays(self, start_date, end_date): """利用 chinese-calendar 的第三方库生成起止时间段内的法定节假日列表 并将其转换为 date_int 的格式 :param start_date: :param end_date: :return:""" holidays = get_holidays(start_date, end_date, include_weekends=False) int_holidays ...
the_stack_v2_python_sparse
jz_calendar/holiday_days.py
furuiyang0715/sync_process
train
0
67fc9579458ee8f14dacf7fad3660eb88aa8cef7
[ "self.rects = rects\nself.weight = []\ns = 0\nfor rect in rects:\n area = (rect[2] - rect[0] + 1) * (rect[3] - rect[1] + 1)\n s += area\n self.weight.append(s)", "index = bisect_left(self.weight, randint(1, self.weight[-1]))\nrect = self.rects[index]\nreturn [randint(rect[0], rect[2]), randint(rect[1], r...
<|body_start_0|> self.rects = rects self.weight = [] s = 0 for rect in rects: area = (rect[2] - rect[0] + 1) * (rect[3] - rect[1] + 1) s += area self.weight.append(s) <|end_body_0|> <|body_start_1|> index = bisect_left(self.weight, randint(1, ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, rects): """:type rects: List[List[int]]""" <|body_0|> def pick(self): """:rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.rects = rects self.weight = [] s = 0 for rect in rec...
stack_v2_sparse_classes_36k_train_021745
1,307
no_license
[ { "docstring": ":type rects: List[List[int]]", "name": "__init__", "signature": "def __init__(self, rects)" }, { "docstring": ":rtype: List[int]", "name": "pick", "signature": "def pick(self)" } ]
2
stack_v2_sparse_classes_30k_train_005894
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, rects): :type rects: List[List[int]] - def pick(self): :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, rects): :type rects: List[List[int]] - def pick(self): :rtype: List[int] <|skeleton|> class Solution: def __init__(self, rects): """:type rects: ...
d156c6a13c89727f80ed6244cae40574395ecf34
<|skeleton|> class Solution: def __init__(self, rects): """:type rects: List[List[int]]""" <|body_0|> def pick(self): """:rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, rects): """:type rects: List[List[int]]""" self.rects = rects self.weight = [] s = 0 for rect in rects: area = (rect[2] - rect[0] + 1) * (rect[3] - rect[1] + 1) s += area self.weight.append(s) def pic...
the_stack_v2_python_sparse
normal/497.py
longhao54/leetcode
train
0
61342fcaafdd97dc1562bd3ecee3ca66e57e0bc5
[ "super(ActorCriticAgent, self).__init__()\nself.device: DeviceTopology = device\nself.actor_model = torch.nn.Sequential(torch.nn.Linear(len(self.device) ** 2, 128), torch.nn.ReLU(), torch.nn.Linear(128, 32), torch.nn.ReLU(), torch.nn.Linear(32, 32), torch.nn.ReLU(), torch.nn.Linear(32, len(self.device.edges) + (1 i...
<|body_start_0|> super(ActorCriticAgent, self).__init__() self.device: DeviceTopology = device self.actor_model = torch.nn.Sequential(torch.nn.Linear(len(self.device) ** 2, 128), torch.nn.ReLU(), torch.nn.Linear(128, 32), torch.nn.ReLU(), torch.nn.Linear(32, 32), torch.nn.ReLU(), torch.nn.Linear...
ActorCriticAgent
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ActorCriticAgent: def __init__(self, device: DeviceTopology, stop_move: bool=False): """Initializes the graph network as a torch module and makes the architecture and the graph. :param device: the Topology to which the agent is mapping to""" <|body_0|> def forward(self, curr...
stack_v2_sparse_classes_36k_train_021746
3,719
permissive
[ { "docstring": "Initializes the graph network as a torch module and makes the architecture and the graph. :param device: the Topology to which the agent is mapping to", "name": "__init__", "signature": "def __init__(self, device: DeviceTopology, stop_move: bool=False)" }, { "docstring": "Get the...
4
stack_v2_sparse_classes_30k_train_021431
Implement the Python class `ActorCriticAgent` described below. Class description: Implement the ActorCriticAgent class. Method signatures and docstrings: - def __init__(self, device: DeviceTopology, stop_move: bool=False): Initializes the graph network as a torch module and makes the architecture and the graph. :para...
Implement the Python class `ActorCriticAgent` described below. Class description: Implement the ActorCriticAgent class. Method signatures and docstrings: - def __init__(self, device: DeviceTopology, stop_move: bool=False): Initializes the graph network as a torch module and makes the architecture and the graph. :para...
56ef1b6c08e721011e1f73a04b0b0229f7bdff1b
<|skeleton|> class ActorCriticAgent: def __init__(self, device: DeviceTopology, stop_move: bool=False): """Initializes the graph network as a torch module and makes the architecture and the graph. :param device: the Topology to which the agent is mapping to""" <|body_0|> def forward(self, curr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ActorCriticAgent: def __init__(self, device: DeviceTopology, stop_move: bool=False): """Initializes the graph network as a torch module and makes the architecture and the graph. :param device: the Topology to which the agent is mapping to""" super(ActorCriticAgent, self).__init__() sel...
the_stack_v2_python_sparse
qroute/models/actor_critic.py
AnimeshSinha1309/qroute-router
train
6
277dd2c2997935969ff24de53b6f84f65d796bd9
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')" ]
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Proto file describing the Ad service. Service to manage ads.
AdServiceServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdServiceServicer: """Proto file describing the Ad service. Service to manage ads.""" def GetAd(self, request, context): """Returns the requested ad in full detail.""" <|body_0|> def MutateAds(self, request, context): """Updates ads. Operation statuses are return...
stack_v2_sparse_classes_36k_train_021747
2,941
permissive
[ { "docstring": "Returns the requested ad in full detail.", "name": "GetAd", "signature": "def GetAd(self, request, context)" }, { "docstring": "Updates ads. Operation statuses are returned.", "name": "MutateAds", "signature": "def MutateAds(self, request, context)" } ]
2
stack_v2_sparse_classes_30k_val_000956
Implement the Python class `AdServiceServicer` described below. Class description: Proto file describing the Ad service. Service to manage ads. Method signatures and docstrings: - def GetAd(self, request, context): Returns the requested ad in full detail. - def MutateAds(self, request, context): Updates ads. Operatio...
Implement the Python class `AdServiceServicer` described below. Class description: Proto file describing the Ad service. Service to manage ads. Method signatures and docstrings: - def GetAd(self, request, context): Returns the requested ad in full detail. - def MutateAds(self, request, context): Updates ads. Operatio...
a5b6cede64f4d9912ae6ad26927a54e40448c9fe
<|skeleton|> class AdServiceServicer: """Proto file describing the Ad service. Service to manage ads.""" def GetAd(self, request, context): """Returns the requested ad in full detail.""" <|body_0|> def MutateAds(self, request, context): """Updates ads. Operation statuses are return...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdServiceServicer: """Proto file describing the Ad service. Service to manage ads.""" def GetAd(self, request, context): """Returns the requested ad in full detail.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotI...
the_stack_v2_python_sparse
google/ads/google_ads/v3/proto/services/ad_service_pb2_grpc.py
fiboknacky/google-ads-python
train
0
0a9edc9ca7188db1fa1fefb0b1ce63e19662f702
[ "newMessage = ''\nanimalType = toon.getStyle().getType()\nif ToonChatGarbler.animalSounds.has_key(animalType):\n wordlist = ToonChatGarbler.animalSounds[animalType]\nelse:\n wordlist = ToonChatGarbler.animalSounds['default']\nnumWords = random.randint(1, 7)\nfor i in range(1, numWords + 1):\n wordIndex = r...
<|body_start_0|> newMessage = '' animalType = toon.getStyle().getType() if ToonChatGarbler.animalSounds.has_key(animalType): wordlist = ToonChatGarbler.animalSounds[animalType] else: wordlist = ToonChatGarbler.animalSounds['default'] numWords = random.rand...
ToonChatGarbler class: contains methods to convert chat messages to animal sounds
ToonChatGarbler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ToonChatGarbler: """ToonChatGarbler class: contains methods to convert chat messages to animal sounds""" def garble(self, toon, message): """garble(self, Avatar, string) Replace a chat message with a series of animal sounds based on the toon's animal type Algorithm completely disrega...
stack_v2_sparse_classes_36k_train_021748
2,635
no_license
[ { "docstring": "garble(self, Avatar, string) Replace a chat message with a series of animal sounds based on the toon's animal type Algorithm completely disregards original message to prohibit any sort of meaningful communication", "name": "garble", "signature": "def garble(self, toon, message)" }, {...
2
stack_v2_sparse_classes_30k_train_011127
Implement the Python class `ToonChatGarbler` described below. Class description: ToonChatGarbler class: contains methods to convert chat messages to animal sounds Method signatures and docstrings: - def garble(self, toon, message): garble(self, Avatar, string) Replace a chat message with a series of animal sounds bas...
Implement the Python class `ToonChatGarbler` described below. Class description: ToonChatGarbler class: contains methods to convert chat messages to animal sounds Method signatures and docstrings: - def garble(self, toon, message): garble(self, Avatar, string) Replace a chat message with a series of animal sounds bas...
0e7bfc1fe29fd595df0b982e40f94c30befb1ec7
<|skeleton|> class ToonChatGarbler: """ToonChatGarbler class: contains methods to convert chat messages to animal sounds""" def garble(self, toon, message): """garble(self, Avatar, string) Replace a chat message with a series of animal sounds based on the toon's animal type Algorithm completely disrega...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ToonChatGarbler: """ToonChatGarbler class: contains methods to convert chat messages to animal sounds""" def garble(self, toon, message): """garble(self, Avatar, string) Replace a chat message with a series of animal sounds based on the toon's animal type Algorithm completely disregards original ...
the_stack_v2_python_sparse
toontown/src/chat/ToonChatGarbler.py
satire6/Anesidora
train
89
91b6f562d8058a2b569f1b7b7736b02e24d6348d
[ "supercategorys = []\ncategories_id = {}\nfor item in categories:\n supercategory = item['supercategory']\n name = item['name']\n id = item['id']\n categories_id[name] = id\nreturn categories_id", "annotations_id = []\nfor item in annotations:\n id = item['id']\n annotations_id.append(id)\nretur...
<|body_start_0|> supercategorys = [] categories_id = {} for item in categories: supercategory = item['supercategory'] name = item['name'] id = item['id'] categories_id[name] = id return categories_id <|end_body_0|> <|body_start_1|> ...
COCO Tools
COCOTools
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class COCOTools: """COCO Tools""" def get_categories_id(categories): """get categories id dict :param categories: :return: dict:{name:id}""" <|body_0|> def get_annotations_id(annotations): """get annotations id list :param annotations: :return: annotations id list""" ...
stack_v2_sparse_classes_36k_train_021749
11,741
no_license
[ { "docstring": "get categories id dict :param categories: :return: dict:{name:id}", "name": "get_categories_id", "signature": "def get_categories_id(categories)" }, { "docstring": "get annotations id list :param annotations: :return: annotations id list", "name": "get_annotations_id", "s...
5
stack_v2_sparse_classes_30k_train_003042
Implement the Python class `COCOTools` described below. Class description: COCO Tools Method signatures and docstrings: - def get_categories_id(categories): get categories id dict :param categories: :return: dict:{name:id} - def get_annotations_id(annotations): get annotations id list :param annotations: :return: ann...
Implement the Python class `COCOTools` described below. Class description: COCO Tools Method signatures and docstrings: - def get_categories_id(categories): get categories id dict :param categories: :return: dict:{name:id} - def get_annotations_id(annotations): get annotations id list :param annotations: :return: ann...
f45f0879cc70eb59de67a270a6ec8dbb2cf8e742
<|skeleton|> class COCOTools: """COCO Tools""" def get_categories_id(categories): """get categories id dict :param categories: :return: dict:{name:id}""" <|body_0|> def get_annotations_id(annotations): """get annotations id list :param annotations: :return: annotations id list""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class COCOTools: """COCO Tools""" def get_categories_id(categories): """get categories id dict :param categories: :return: dict:{name:id}""" supercategorys = [] categories_id = {} for item in categories: supercategory = item['supercategory'] name = item['...
the_stack_v2_python_sparse
modules/dataset_tool/coco_tools/convert_voc2coco.py
zuiyueyin/python-learning-notes
train
0
330fc34c8959c24418587a35f9aa937640d777bf
[ "if head_1 is None or head_2 is None:\n return None\nloop_1 = FindFirstIntersectNode.get_loop_node(head_1)\nloop_2 = FindFirstIntersectNode.get_loop_node(head_2)\nif loop_1 is None and loop_2 is None:\n return FindFirstIntersectNode.no_loop(head_1, head_2)\nelif loop_1 is not None and loop_2 is not None:\n ...
<|body_start_0|> if head_1 is None or head_2 is None: return None loop_1 = FindFirstIntersectNode.get_loop_node(head_1) loop_2 = FindFirstIntersectNode.get_loop_node(head_2) if loop_1 is None and loop_2 is None: return FindFirstIntersectNode.no_loop(head_1, head_2...
FindFirstIntersectNode
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FindFirstIntersectNode: def get_intersect_node(head_1, head_2): """:param head_1: 第一个链表的头节点 :param head_2: 第二个链表的头节点 :return: 返回相交节点""" <|body_0|> def get_loop_node(head): """get loop node of linked list :param head: :return: 1、创建一个慢指针,一个快指针, 慢指针一次走一步, 快指针一次走两步 2、快、慢...
stack_v2_sparse_classes_36k_train_021750
8,372
no_license
[ { "docstring": ":param head_1: 第一个链表的头节点 :param head_2: 第二个链表的头节点 :return: 返回相交节点", "name": "get_intersect_node", "signature": "def get_intersect_node(head_1, head_2)" }, { "docstring": "get loop node of linked list :param head: :return: 1、创建一个慢指针,一个快指针, 慢指针一次走一步, 快指针一次走两步 2、快、慢指针同时走,第一次相遇后, 快指针...
4
stack_v2_sparse_classes_30k_val_000409
Implement the Python class `FindFirstIntersectNode` described below. Class description: Implement the FindFirstIntersectNode class. Method signatures and docstrings: - def get_intersect_node(head_1, head_2): :param head_1: 第一个链表的头节点 :param head_2: 第二个链表的头节点 :return: 返回相交节点 - def get_loop_node(head): get loop node of ...
Implement the Python class `FindFirstIntersectNode` described below. Class description: Implement the FindFirstIntersectNode class. Method signatures and docstrings: - def get_intersect_node(head_1, head_2): :param head_1: 第一个链表的头节点 :param head_2: 第二个链表的头节点 :return: 返回相交节点 - def get_loop_node(head): get loop node of ...
9767977c8c79a3b294003bdb3d9ef578a38508b6
<|skeleton|> class FindFirstIntersectNode: def get_intersect_node(head_1, head_2): """:param head_1: 第一个链表的头节点 :param head_2: 第二个链表的头节点 :return: 返回相交节点""" <|body_0|> def get_loop_node(head): """get loop node of linked list :param head: :return: 1、创建一个慢指针,一个快指针, 慢指针一次走一步, 快指针一次走两步 2、快、慢...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FindFirstIntersectNode: def get_intersect_node(head_1, head_2): """:param head_1: 第一个链表的头节点 :param head_2: 第二个链表的头节点 :return: 返回相交节点""" if head_1 is None or head_2 is None: return None loop_1 = FindFirstIntersectNode.get_loop_node(head_1) loop_2 = FindFirstIntersect...
the_stack_v2_python_sparse
link/find_first_intersect_node.py
TaylorWizard/python-learning
train
0
d562ee4215c89b2ac9ced30826927d9397982690
[ "parsed_time = self.parse_natural_time(remind_time)\nnatural_datetime = self.to_natural_day_and_time(parsed_time)\nif to_string:\n formatted_to_string = to_string\nelse:\n formatted_to_string = ''\nformatted_reminder_text = '%(mention_handle)s, you asked me to remind you%(to_string)s %(reminder_text)s' % {'me...
<|body_start_0|> parsed_time = self.parse_natural_time(remind_time) natural_datetime = self.to_natural_day_and_time(parsed_time) if to_string: formatted_to_string = to_string else: formatted_to_string = '' formatted_reminder_text = '%(mention_handle)s, you...
RemindPlugin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RemindPlugin: def remind_me_at(self, message, reminder_text=None, remind_time=None, to_string=''): """remind me to ___ at ___: Set a reminder for a thing, at a time.""" <|body_0|> def remind_somebody_at(self, message, reminder_recipient=None, reminder_text=None, remind_time=...
stack_v2_sparse_classes_36k_train_021751
2,377
permissive
[ { "docstring": "remind me to ___ at ___: Set a reminder for a thing, at a time.", "name": "remind_me_at", "signature": "def remind_me_at(self, message, reminder_text=None, remind_time=None, to_string='')" }, { "docstring": "remind ___ to ___ at ___: Set a reminder for a thing, at a time for some...
2
null
Implement the Python class `RemindPlugin` described below. Class description: Implement the RemindPlugin class. Method signatures and docstrings: - def remind_me_at(self, message, reminder_text=None, remind_time=None, to_string=''): remind me to ___ at ___: Set a reminder for a thing, at a time. - def remind_somebody...
Implement the Python class `RemindPlugin` described below. Class description: Implement the RemindPlugin class. Method signatures and docstrings: - def remind_me_at(self, message, reminder_text=None, remind_time=None, to_string=''): remind me to ___ at ___: Set a reminder for a thing, at a time. - def remind_somebody...
27a23ce47e3ec11b94f3355c2d2ee94c1958679c
<|skeleton|> class RemindPlugin: def remind_me_at(self, message, reminder_text=None, remind_time=None, to_string=''): """remind me to ___ at ___: Set a reminder for a thing, at a time.""" <|body_0|> def remind_somebody_at(self, message, reminder_recipient=None, reminder_text=None, remind_time=...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RemindPlugin: def remind_me_at(self, message, reminder_text=None, remind_time=None, to_string=''): """remind me to ___ at ___: Set a reminder for a thing, at a time.""" parsed_time = self.parse_natural_time(remind_time) natural_datetime = self.to_natural_day_and_time(parsed_time) ...
the_stack_v2_python_sparse
will/plugins/productivity/remind.py
skoczen/will
train
359
3e0e022c89da5c79a917c23d87c8d8d8474e5577
[ "to_return = []\nfor attr in self.__dict__:\n obj = getattr(self, attr)\n if isinstance(obj, AbstractStat):\n if predicate and predicate(attr) or not predicate:\n to_return.append(obj)\n if recursive:\n to_return = to_return + obj.children(predicate=predicate, recursive=Tru...
<|body_start_0|> to_return = [] for attr in self.__dict__: obj = getattr(self, attr) if isinstance(obj, AbstractStat): if predicate and predicate(attr) or not predicate: to_return.append(obj) if recursive: to...
An abstract class which all PyStats inherit from. All PyStats are JsonSerializable.
AbstractStat
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license", "LGPL-2.0-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AbstractStat: """An abstract class which all PyStats inherit from. All PyStats are JsonSerializable.""" def children(self, predicate: Optional[Callable[[str], bool]]=None, recursive: bool=False) -> List['AbstractStat']: """Iterate through all of the children, optionally with a predic...
stack_v2_sparse_classes_36k_train_021752
3,596
permissive
[ { "docstring": "Iterate through all of the children, optionally with a predicate ``` >>> system.children(lambda _name: 'cpu' in name) [cpu0, cpu1, cpu2] ``` :param: predicate(str) -> bool: Optional. Each child's name is passed to this function. If it returns true, then the child is yielded. Otherwise, the child...
2
null
Implement the Python class `AbstractStat` described below. Class description: An abstract class which all PyStats inherit from. All PyStats are JsonSerializable. Method signatures and docstrings: - def children(self, predicate: Optional[Callable[[str], bool]]=None, recursive: bool=False) -> List['AbstractStat']: Iter...
Implement the Python class `AbstractStat` described below. Class description: An abstract class which all PyStats inherit from. All PyStats are JsonSerializable. Method signatures and docstrings: - def children(self, predicate: Optional[Callable[[str], bool]]=None, recursive: bool=False) -> List['AbstractStat']: Iter...
48a40cf2f5182a82de360b7efa497d82e06b1631
<|skeleton|> class AbstractStat: """An abstract class which all PyStats inherit from. All PyStats are JsonSerializable.""" def children(self, predicate: Optional[Callable[[str], bool]]=None, recursive: bool=False) -> List['AbstractStat']: """Iterate through all of the children, optionally with a predic...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AbstractStat: """An abstract class which all PyStats inherit from. All PyStats are JsonSerializable.""" def children(self, predicate: Optional[Callable[[str], bool]]=None, recursive: bool=False) -> List['AbstractStat']: """Iterate through all of the children, optionally with a predicate ``` >>> s...
the_stack_v2_python_sparse
src/python/m5/ext/pystats/abstract_stat.py
gem5/gem5
train
1,185
9db9c6ede86ef18c24db358b013922ed15ea4d84
[ "Parametre.__init__(self, 'liste', 'list')\nself.schema = '(<cle>)'\nself.aide_courte = 'affiche les structures'\nself.aide_longue = 'Sans argument, cette commande affiche tous les groupes de structure définis, ainsi que le nombre de structures de chaque groupe. Vous pouvez également préciser en paramètre une clé d...
<|body_start_0|> Parametre.__init__(self, 'liste', 'list') self.schema = '(<cle>)' self.aide_courte = 'affiche les structures' self.aide_longue = 'Sans argument, cette commande affiche tous les groupes de structure définis, ainsi que le nombre de structures de chaque groupe. Vous pouvez ...
Commande 'structures liste'
PrmListe
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrmListe: """Commande 'structures liste'""" def __init__(self): """Constructeur du paramètre.""" <|body_0|> def interpreter(self, personnage, dic_masques): """Méthode d'interprétation de commande.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_021753
3,685
permissive
[ { "docstring": "Constructeur du paramètre.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Méthode d'interprétation de commande.", "name": "interpreter", "signature": "def interpreter(self, personnage, dic_masques)" } ]
2
null
Implement the Python class `PrmListe` described below. Class description: Commande 'structures liste' Method signatures and docstrings: - def __init__(self): Constructeur du paramètre. - def interpreter(self, personnage, dic_masques): Méthode d'interprétation de commande.
Implement the Python class `PrmListe` described below. Class description: Commande 'structures liste' Method signatures and docstrings: - def __init__(self): Constructeur du paramètre. - def interpreter(self, personnage, dic_masques): Méthode d'interprétation de commande. <|skeleton|> class PrmListe: """Commande...
7e93bff08cdf891352efba587e89c40f3b4a2301
<|skeleton|> class PrmListe: """Commande 'structures liste'""" def __init__(self): """Constructeur du paramètre.""" <|body_0|> def interpreter(self, personnage, dic_masques): """Méthode d'interprétation de commande.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PrmListe: """Commande 'structures liste'""" def __init__(self): """Constructeur du paramètre.""" Parametre.__init__(self, 'liste', 'list') self.schema = '(<cle>)' self.aide_courte = 'affiche les structures' self.aide_longue = 'Sans argument, cette commande affiche ...
the_stack_v2_python_sparse
src/primaires/scripting/commandes/structure/liste.py
vincent-lg/tsunami
train
5
14093f241d4ba36355ea7f0a2ca34dcf95790402
[ "l = 0\nr = len(nums) - 1\nwhile l <= r:\n m = l + (r - l) // 2\n if nums[m] == target:\n return True\n while l < m and nums[l] == nums[m]:\n l += 1\n if nums[l] == nums[m]:\n l = m + 1\n elif nums[l] < nums[m]:\n if nums[l] <= target < nums[m]:\n r = m - 1\n ...
<|body_start_0|> l = 0 r = len(nums) - 1 while l <= r: m = l + (r - l) // 2 if nums[m] == target: return True while l < m and nums[l] == nums[m]: l += 1 if nums[l] == nums[m]: l = m + 1 el...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def search(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_0|> def search(self, nums: List[int], target: int) -> bool: """:type nums: List[int] :type target: int :rtype: int""" <|body_1|> <|end_skeleton|> <|bo...
stack_v2_sparse_classes_36k_train_021754
2,053
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: int", "name": "search", "signature": "def search(self, nums, target)" }, { "docstring": ":type nums: List[int] :type target: int :rtype: int", "name": "search", "signature": "def search(self, nums: List[int], target: int) ->...
2
stack_v2_sparse_classes_30k_train_006159
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def search(self, nums, target): :type nums: List[int] :type target: int :rtype: int - def search(self, nums: List[int], target: int) -> bool: :type nums: List[int] :type target: ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def search(self, nums, target): :type nums: List[int] :type target: int :rtype: int - def search(self, nums: List[int], target: int) -> bool: :type nums: List[int] :type target: ...
2ecaeed38178819480388b5742bc2ea12009ae16
<|skeleton|> class Solution: def search(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_0|> def search(self, nums: List[int], target: int) -> bool: """:type nums: List[int] :type target: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def search(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" l = 0 r = len(nums) - 1 while l <= r: m = l + (r - l) // 2 if nums[m] == target: return True while l < m and nums[l] == nums[m...
the_stack_v2_python_sparse
81.search-in-rotated-sorted-array-ii.py
LouisYLWang/leetcode_python
train
0
0138a77c06865245c98d99bfcf47fb0b1ce9d11e
[ "super().__init__(device=device)\nxyz = _handle_input(x, y, z, dtype, device, 'scale', allow_singleton=True)\nN = xyz.shape[0]\nmat = torch.eye(4, dtype=dtype, device=device)\nmat = mat.view(1, 4, 4).repeat(N, 1, 1)\nmat[:, 0, 0] = xyz[:, 0]\nmat[:, 1, 1] = xyz[:, 1]\nmat[:, 2, 2] = xyz[:, 2]\nself._matrix = mat", ...
<|body_start_0|> super().__init__(device=device) xyz = _handle_input(x, y, z, dtype, device, 'scale', allow_singleton=True) N = xyz.shape[0] mat = torch.eye(4, dtype=dtype, device=device) mat = mat.view(1, 4, 4).repeat(N, 1, 1) mat[:, 0, 0] = xyz[:, 0] mat[:, 1, 1...
Scale
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Scale: def __init__(self, x, y=None, z=None, dtype=torch.float32, device='cpu'): """A Transform3d representing a scaling operation, with different scale factors along each coordinate axis. Option I: Scale(s, dtype=torch.float32, device='cpu') s can be one of - Python scalar or torch scal...
stack_v2_sparse_classes_36k_train_021755
43,607
permissive
[ { "docstring": "A Transform3d representing a scaling operation, with different scale factors along each coordinate axis. Option I: Scale(s, dtype=torch.float32, device='cpu') s can be one of - Python scalar or torch scalar: Single uniform scale - 1D torch tensor of shape (N,): A batch of uniform scale - 2D torc...
2
stack_v2_sparse_classes_30k_train_016382
Implement the Python class `Scale` described below. Class description: Implement the Scale class. Method signatures and docstrings: - def __init__(self, x, y=None, z=None, dtype=torch.float32, device='cpu'): A Transform3d representing a scaling operation, with different scale factors along each coordinate axis. Optio...
Implement the Python class `Scale` described below. Class description: Implement the Scale class. Method signatures and docstrings: - def __init__(self, x, y=None, z=None, dtype=torch.float32, device='cpu'): A Transform3d representing a scaling operation, with different scale factors along each coordinate axis. Optio...
1d240f60a99682e8409363c5829aba14869ba140
<|skeleton|> class Scale: def __init__(self, x, y=None, z=None, dtype=torch.float32, device='cpu'): """A Transform3d representing a scaling operation, with different scale factors along each coordinate axis. Option I: Scale(s, dtype=torch.float32, device='cpu') s can be one of - Python scalar or torch scal...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Scale: def __init__(self, x, y=None, z=None, dtype=torch.float32, device='cpu'): """A Transform3d representing a scaling operation, with different scale factors along each coordinate axis. Option I: Scale(s, dtype=torch.float32, device='cpu') s can be one of - Python scalar or torch scalar: Single uni...
the_stack_v2_python_sparse
soft_intro_vae_3d/datasets/transforms3d.py
LearnerLYH/soft-intro-vae-pytorch
train
1
6b89c8951d9b2f069360e3b7272da12da1cb98e9
[ "self.keys = {}\nself.keysOrder = []\nself.keysPosition = {}\nself.deviation = 0", "if key in self.keys:\n self.keys[key] += 1\n i = self.keysPosition[key] + self.deviation\n while i < len(self.keysOrder) - 1 and self.keys[self.keysOrder[i]] > self.keys[self.keysOrder[i + 1]]:\n self.keysOrder[i],...
<|body_start_0|> self.keys = {} self.keysOrder = [] self.keysPosition = {} self.deviation = 0 <|end_body_0|> <|body_start_1|> if key in self.keys: self.keys[key] += 1 i = self.keysPosition[key] + self.deviation while i < len(self.keysOrder) - ...
AllOne
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AllOne: def __init__(self): """Initialize your data structure here.""" <|body_0|> def inc(self, key): """Inserts a new key <Key> with value 1. Or increments an existing key by 1. :type key: str :rtype: void""" <|body_1|> def dec(self, key): """De...
stack_v2_sparse_classes_36k_train_021756
2,721
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Inserts a new key <Key> with value 1. Or increments an existing key by 1. :type key: str :rtype: void", "name": "inc", "signature": "def inc(self, key)" }, ...
5
stack_v2_sparse_classes_30k_train_004524
Implement the Python class `AllOne` described below. Class description: Implement the AllOne class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def inc(self, key): Inserts a new key <Key> with value 1. Or increments an existing key by 1. :type key: str :rtype: void -...
Implement the Python class `AllOne` described below. Class description: Implement the AllOne class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def inc(self, key): Inserts a new key <Key> with value 1. Or increments an existing key by 1. :type key: str :rtype: void -...
15f012927dc34b5d751af6633caa5e8882d26ff7
<|skeleton|> class AllOne: def __init__(self): """Initialize your data structure here.""" <|body_0|> def inc(self, key): """Inserts a new key <Key> with value 1. Or increments an existing key by 1. :type key: str :rtype: void""" <|body_1|> def dec(self, key): """De...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AllOne: def __init__(self): """Initialize your data structure here.""" self.keys = {} self.keysOrder = [] self.keysPosition = {} self.deviation = 0 def inc(self, key): """Inserts a new key <Key> with value 1. Or increments an existing key by 1. :type key: s...
the_stack_v2_python_sparse
python/432.AllO`OneDataStructure.py
MaxPoon/Leetcode
train
15
d5545ef4c14a64e270322d54020cb0e931776ac4
[ "conn, cursor = get_db_cursor()\nbuild = 'toy_build'\ntranscript_dict = init_refs.make_transcript_dict(cursor, build)\nconn.close()\nedges = (100, 200, 300)\nmatches = talon.search_for_ISM(edges, transcript_dict)\nassert matches == None", "conn, cursor = get_db_cursor()\nbuild = 'toy_build'\ntranscript_dict = ini...
<|body_start_0|> conn, cursor = get_db_cursor() build = 'toy_build' transcript_dict = init_refs.make_transcript_dict(cursor, build) conn.close() edges = (100, 200, 300) matches = talon.search_for_ISM(edges, transcript_dict) assert matches == None <|end_body_0|> <...
TestSearchForISM
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestSearchForISM: def test_find_no_match(self): """Example where the toy transcript database contains no matches for the edge set.""" <|body_0|> def test_find_match(self): """Example where the toy transcript database contains exactly one ISM match for the transcript....
stack_v2_sparse_classes_36k_train_021757
1,789
permissive
[ { "docstring": "Example where the toy transcript database contains no matches for the edge set.", "name": "test_find_no_match", "signature": "def test_find_no_match(self)" }, { "docstring": "Example where the toy transcript database contains exactly one ISM match for the transcript.", "name"...
3
stack_v2_sparse_classes_30k_train_007539
Implement the Python class `TestSearchForISM` described below. Class description: Implement the TestSearchForISM class. Method signatures and docstrings: - def test_find_no_match(self): Example where the toy transcript database contains no matches for the edge set. - def test_find_match(self): Example where the toy t...
Implement the Python class `TestSearchForISM` described below. Class description: Implement the TestSearchForISM class. Method signatures and docstrings: - def test_find_no_match(self): Example where the toy transcript database contains no matches for the edge set. - def test_find_match(self): Example where the toy t...
8014faed5f982e5e106ec05239e47d65878e76c3
<|skeleton|> class TestSearchForISM: def test_find_no_match(self): """Example where the toy transcript database contains no matches for the edge set.""" <|body_0|> def test_find_match(self): """Example where the toy transcript database contains exactly one ISM match for the transcript....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestSearchForISM: def test_find_no_match(self): """Example where the toy transcript database contains no matches for the edge set.""" conn, cursor = get_db_cursor() build = 'toy_build' transcript_dict = init_refs.make_transcript_dict(cursor, build) conn.close() ...
the_stack_v2_python_sparse
testing_suite/test_search_for_ISM_match.py
kopardev/TALON
train
0
79128029b138dd4d1e365c5350b50ef8bd3b30f6
[ "if value is None:\n return None\nvalue = super(UTCDateTimeField, self).to_python(value)\nif value.tzinfo:\n return value\nif not isinstance(value, datetime.datetime):\n raise ValueError(\"value '%s' is of type '%s'. should be datetime.datetime\" % (value, type(value)))\nreturn value.replace(tzinfo=TZ_INFO...
<|body_start_0|> if value is None: return None value = super(UTCDateTimeField, self).to_python(value) if value.tzinfo: return value if not isinstance(value, datetime.datetime): raise ValueError("value '%s' is of type '%s'. should be datetime.datetime" ...
A time zone aware DateTime field. On read from db converts the naive date to UTC and then to the specified timezone One write to db converts the tz aware date to UTC
UTCDateTimeField
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UTCDateTimeField: """A time zone aware DateTime field. On read from db converts the naive date to UTC and then to the specified timezone One write to db converts the tz aware date to UTC""" def to_python(self, value): """convert the naive date to a tz aware date, uses settings.TIME_Z...
stack_v2_sparse_classes_36k_train_021758
5,538
no_license
[ { "docstring": "convert the naive date to a tz aware date, uses settings.TIME_ZONE for conversion", "name": "to_python", "signature": "def to_python(self, value)" }, { "docstring": "convert a tz aware date into a naive date, after converting to UTC timezone", "name": "get_prep_value", "s...
2
null
Implement the Python class `UTCDateTimeField` described below. Class description: A time zone aware DateTime field. On read from db converts the naive date to UTC and then to the specified timezone One write to db converts the tz aware date to UTC Method signatures and docstrings: - def to_python(self, value): conver...
Implement the Python class `UTCDateTimeField` described below. Class description: A time zone aware DateTime field. On read from db converts the naive date to UTC and then to the specified timezone One write to db converts the tz aware date to UTC Method signatures and docstrings: - def to_python(self, value): conver...
2e3f1bdce124738e1bed2e648826ca819e0bcc57
<|skeleton|> class UTCDateTimeField: """A time zone aware DateTime field. On read from db converts the naive date to UTC and then to the specified timezone One write to db converts the tz aware date to UTC""" def to_python(self, value): """convert the naive date to a tz aware date, uses settings.TIME_Z...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UTCDateTimeField: """A time zone aware DateTime field. On read from db converts the naive date to UTC and then to the specified timezone One write to db converts the tz aware date to UTC""" def to_python(self, value): """convert the naive date to a tz aware date, uses settings.TIME_ZONE for conve...
the_stack_v2_python_sparse
common/tz_support.py
WAYbetter/waybetter
train
2
9a4c00d619d82d844d635139998715ae767075af
[ "self.grid_size_z = grid_size_z\nself.grid_size_y = grid_size_y\nself.grid_size_x = grid_size_x\nself.x_range = x_range\nself.y_range = x_range * (grid_size_y / grid_size_x)\nself.z_range = x_range * (grid_size_z / grid_size_x)\nself.dx = real_t(x_range / grid_size_x)\nself.num_threads = num_threads\nself.real_t = ...
<|body_start_0|> self.grid_size_z = grid_size_z self.grid_size_y = grid_size_y self.grid_size_x = grid_size_x self.x_range = x_range self.y_range = x_range * (grid_size_y / grid_size_x) self.z_range = x_range * (grid_size_z / grid_size_x) self.dx = real_t(x_range ...
Class for solving unbounded Poisson in 3D via PyFFTW.
UnboundedPoissonSolverPYFFTW3D
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UnboundedPoissonSolverPYFFTW3D: """Class for solving unbounded Poisson in 3D via PyFFTW.""" def __init__(self, grid_size_z: int, grid_size_y: int, grid_size_x: int, x_range: float=1.0, num_threads: int=1, real_t: type=np.float64) -> None: """Class initialiser.""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_021759
6,969
permissive
[ { "docstring": "Class initialiser.", "name": "__init__", "signature": "def __init__(self, grid_size_z: int, grid_size_y: int, grid_size_x: int, x_range: float=1.0, num_threads: int=1, real_t: type=np.float64) -> None" }, { "docstring": "Construct the unbounded Greens function.", "name": "_co...
5
stack_v2_sparse_classes_30k_train_002531
Implement the Python class `UnboundedPoissonSolverPYFFTW3D` described below. Class description: Class for solving unbounded Poisson in 3D via PyFFTW. Method signatures and docstrings: - def __init__(self, grid_size_z: int, grid_size_y: int, grid_size_x: int, x_range: float=1.0, num_threads: int=1, real_t: type=np.flo...
Implement the Python class `UnboundedPoissonSolverPYFFTW3D` described below. Class description: Class for solving unbounded Poisson in 3D via PyFFTW. Method signatures and docstrings: - def __init__(self, grid_size_z: int, grid_size_y: int, grid_size_x: int, x_range: float=1.0, num_threads: int=1, real_t: type=np.flo...
99a094e0d6e635e5b2385a69bdee239a4d1fb530
<|skeleton|> class UnboundedPoissonSolverPYFFTW3D: """Class for solving unbounded Poisson in 3D via PyFFTW.""" def __init__(self, grid_size_z: int, grid_size_y: int, grid_size_x: int, x_range: float=1.0, num_threads: int=1, real_t: type=np.float64) -> None: """Class initialiser.""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UnboundedPoissonSolverPYFFTW3D: """Class for solving unbounded Poisson in 3D via PyFFTW.""" def __init__(self, grid_size_z: int, grid_size_y: int, grid_size_x: int, x_range: float=1.0, num_threads: int=1, real_t: type=np.float64) -> None: """Class initialiser.""" self.grid_size_z = grid_s...
the_stack_v2_python_sparse
sopht/numeric/eulerian_grid_ops/poisson_solver_3d/UnboundedPoissonSolverPYFFTW3D.py
SophT-Team/SophT
train
2
166340735e012a724b1f8ee84a9bac335fac8e0e
[ "self.main_url = url\nself.main_config = configuration\nself._session = requests.Session()\nself._session.verify = False\nurllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)\nreturn", "token = str(self.main_config['creds'][tokenId])\nself._session.auth = (token, '')\nurl = str(self.main_url) + api...
<|body_start_0|> self.main_url = url self.main_config = configuration self._session = requests.Session() self._session.verify = False urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) return <|end_body_0|> <|body_start_1|> token = str(self.main_...
SonarAPIClient
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SonarAPIClient: def __init__(self, url, configuration): """Constructor :param url: to generate http-connection to""" <|body_0|> def make_apicall(self, method, apistring, tokenId): """Call Rest API of SONAR for report. :param method: :param apistring: :return: respons...
stack_v2_sparse_classes_36k_train_021760
3,812
no_license
[ { "docstring": "Constructor :param url: to generate http-connection to", "name": "__init__", "signature": "def __init__(self, url, configuration)" }, { "docstring": "Call Rest API of SONAR for report. :param method: :param apistring: :return: response as JSON Object", "name": "make_apicall",...
5
stack_v2_sparse_classes_30k_train_013047
Implement the Python class `SonarAPIClient` described below. Class description: Implement the SonarAPIClient class. Method signatures and docstrings: - def __init__(self, url, configuration): Constructor :param url: to generate http-connection to - def make_apicall(self, method, apistring, tokenId): Call Rest API of ...
Implement the Python class `SonarAPIClient` described below. Class description: Implement the SonarAPIClient class. Method signatures and docstrings: - def __init__(self, url, configuration): Constructor :param url: to generate http-connection to - def make_apicall(self, method, apistring, tokenId): Call Rest API of ...
c734ab9f467f6d882406b9ac8a94c475d4a00465
<|skeleton|> class SonarAPIClient: def __init__(self, url, configuration): """Constructor :param url: to generate http-connection to""" <|body_0|> def make_apicall(self, method, apistring, tokenId): """Call Rest API of SONAR for report. :param method: :param apistring: :return: respons...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SonarAPIClient: def __init__(self, url, configuration): """Constructor :param url: to generate http-connection to""" self.main_url = url self.main_config = configuration self._session = requests.Session() self._session.verify = False urllib3.disable_warnings(url...
the_stack_v2_python_sparse
metric/Sonarqube/SonarAPIClient.py
mmiedaner/security
train
2
918624b0e762815cbdbedc94996682749b7805c1
[ "self.N = N\nself.A = zeros((3, 3), float64)\nself.B = zeros((3, 3), float64)", "num_calcs = 0\nfor i in range(self.N):\n for j in range(3):\n for k in range(3):\n self.A[j, k] = uniform(0, 1)\n self.B[j, k] = uniform(0, 1)\n dot(self.A, self.B)\n num_calcs += 1\nprocessor.re...
<|body_start_0|> self.N = N self.A = zeros((3, 3), float64) self.B = zeros((3, 3), float64) <|end_body_0|> <|body_start_1|> num_calcs = 0 for i in range(self.N): for j in range(3): for k in range(3): self.A[j, k] = uniform(0, 1) ...
The slave command for use by the slave processor.
Test_slave_command
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_slave_command: """The slave command for use by the slave processor.""" def __init__(self, N=0): """Set up the slave command object for the slave processor. @keyword N: The number of calculations for the slave to perform. @type N: int""" <|body_0|> def run(self, proc...
stack_v2_sparse_classes_36k_train_021761
7,704
no_license
[ { "docstring": "Set up the slave command object for the slave processor. @keyword N: The number of calculations for the slave to perform. @type N: int", "name": "__init__", "signature": "def __init__(self, N=0)" }, { "docstring": "Essential method for performing calculations on the slave process...
2
null
Implement the Python class `Test_slave_command` described below. Class description: The slave command for use by the slave processor. Method signatures and docstrings: - def __init__(self, N=0): Set up the slave command object for the slave processor. @keyword N: The number of calculations for the slave to perform. @...
Implement the Python class `Test_slave_command` described below. Class description: The slave command for use by the slave processor. Method signatures and docstrings: - def __init__(self, N=0): Set up the slave command object for the slave processor. @keyword N: The number of calculations for the slave to perform. @...
c317326ddeacd1a1c608128769676899daeae531
<|skeleton|> class Test_slave_command: """The slave command for use by the slave processor.""" def __init__(self, N=0): """Set up the slave command object for the slave processor. @keyword N: The number of calculations for the slave to perform. @type N: int""" <|body_0|> def run(self, proc...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test_slave_command: """The slave command for use by the slave processor.""" def __init__(self, N=0): """Set up the slave command object for the slave processor. @keyword N: The number of calculations for the slave to perform. @type N: int""" self.N = N self.A = zeros((3, 3), float...
the_stack_v2_python_sparse
multi/test_implementation.py
jlec/relax
train
4
e109662757d377062b2111b7a9003d7beea81f75
[ "pre = None\ncur = head\nwhile cur:\n tmp = cur.next\n cur.next = pre\n pre = cur\n cur = tmp\nreturn pre", "if head is None or head.next is None:\n return head\ncur = self.reverseList_2(head.next)\nhead.next.next = head\nhead.next = None\nreturn cur" ]
<|body_start_0|> pre = None cur = head while cur: tmp = cur.next cur.next = pre pre = cur cur = tmp return pre <|end_body_0|> <|body_start_1|> if head is None or head.next is None: return head cur = self.reverse...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseList_1(self, head): """双指针迭代 时间复杂度:O(N),N 为链表节点的个数 空间复杂度:O(1) :type head: ListNode :rtype: ListNode""" <|body_0|> def reverseList_2(self, head): """递归解法 时间复杂度:O(N),N 为链表节点的个数 空间复杂度:O(N),递归系统栈 :type head: ListNode :rtype: ListNode""" <|bod...
stack_v2_sparse_classes_36k_train_021762
2,179
no_license
[ { "docstring": "双指针迭代 时间复杂度:O(N),N 为链表节点的个数 空间复杂度:O(1) :type head: ListNode :rtype: ListNode", "name": "reverseList_1", "signature": "def reverseList_1(self, head)" }, { "docstring": "递归解法 时间复杂度:O(N),N 为链表节点的个数 空间复杂度:O(N),递归系统栈 :type head: ListNode :rtype: ListNode", "name": "reverseList_2",...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList_1(self, head): 双指针迭代 时间复杂度:O(N),N 为链表节点的个数 空间复杂度:O(1) :type head: ListNode :rtype: ListNode - def reverseList_2(self, head): 递归解法 时间复杂度:O(N),N 为链表节点的个数 空间复杂度:O(N)...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList_1(self, head): 双指针迭代 时间复杂度:O(N),N 为链表节点的个数 空间复杂度:O(1) :type head: ListNode :rtype: ListNode - def reverseList_2(self, head): 递归解法 时间复杂度:O(N),N 为链表节点的个数 空间复杂度:O(N)...
62419b49000e79962bcdc99cd98afd2fb82ea345
<|skeleton|> class Solution: def reverseList_1(self, head): """双指针迭代 时间复杂度:O(N),N 为链表节点的个数 空间复杂度:O(1) :type head: ListNode :rtype: ListNode""" <|body_0|> def reverseList_2(self, head): """递归解法 时间复杂度:O(N),N 为链表节点的个数 空间复杂度:O(N),递归系统栈 :type head: ListNode :rtype: ListNode""" <|bod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reverseList_1(self, head): """双指针迭代 时间复杂度:O(N),N 为链表节点的个数 空间复杂度:O(1) :type head: ListNode :rtype: ListNode""" pre = None cur = head while cur: tmp = cur.next cur.next = pre pre = cur cur = tmp return pre ...
the_stack_v2_python_sparse
软件开发岗刷题(华为笔试准备)/链表/reverseList.py
MaoningGuan/LeetCode
train
3
5729638ee0d2d12ffb7528294cad599457f19958
[ "super().__init__(client, api_object_id=api_object_id, api_object_prefix=self.__API_OBJECT_PREFIX, retry_opts=retry_opts, cache_opts=cache_opts)\nself.cpu_count = None\nself.created = None\nself.description = None\nself.memory_count = None\nself.vdi = None\nself.nodes_count = None", "url = self.api_object_url + '...
<|body_start_0|> super().__init__(client, api_object_id=api_object_id, api_object_prefix=self.__API_OBJECT_PREFIX, retry_opts=retry_opts, cache_opts=cache_opts) self.cpu_count = None self.created = None self.description = None self.memory_count = None self.vdi = None ...
Veil cluster entity. Attributes: client: https_client instance. api_object_id: VeiL cluster id(uuid).
VeilCluster
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VeilCluster: """Veil cluster entity. Attributes: client: https_client instance. api_object_id: VeiL cluster id(uuid).""" def __init__(self, client, api_object_id: Optional[str]=None, retry_opts: Optional[VeilRetryConfiguration]=None, cache_opts: Optional[VeilCacheConfiguration]=None) -> None...
stack_v2_sparse_classes_36k_train_021763
1,353
permissive
[ { "docstring": "Please see help(VeilCluster) for more info.", "name": "__init__", "signature": "def __init__(self, client, api_object_id: Optional[str]=None, retry_opts: Optional[VeilRetryConfiguration]=None, cache_opts: Optional[VeilCacheConfiguration]=None) -> None" }, { "docstring": "Get mini...
2
stack_v2_sparse_classes_30k_train_000052
Implement the Python class `VeilCluster` described below. Class description: Veil cluster entity. Attributes: client: https_client instance. api_object_id: VeiL cluster id(uuid). Method signatures and docstrings: - def __init__(self, client, api_object_id: Optional[str]=None, retry_opts: Optional[VeilRetryConfigurati...
Implement the Python class `VeilCluster` described below. Class description: Veil cluster entity. Attributes: client: https_client instance. api_object_id: VeiL cluster id(uuid). Method signatures and docstrings: - def __init__(self, client, api_object_id: Optional[str]=None, retry_opts: Optional[VeilRetryConfigurati...
65c7adf3280217c9f9523a7dd7664d7d4d3f46fe
<|skeleton|> class VeilCluster: """Veil cluster entity. Attributes: client: https_client instance. api_object_id: VeiL cluster id(uuid).""" def __init__(self, client, api_object_id: Optional[str]=None, retry_opts: Optional[VeilRetryConfiguration]=None, cache_opts: Optional[VeilCacheConfiguration]=None) -> None...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VeilCluster: """Veil cluster entity. Attributes: client: https_client instance. api_object_id: VeiL cluster id(uuid).""" def __init__(self, client, api_object_id: Optional[str]=None, retry_opts: Optional[VeilRetryConfiguration]=None, cache_opts: Optional[VeilCacheConfiguration]=None) -> None: """...
the_stack_v2_python_sparse
veil_api_client/api_objects/cluster.py
devalv/veil-api-client
train
1
7e62e6c49f8f2778fee55552069eed9614fe3032
[ "def int_to_str(num):\n sb = [chr(num >> i * 8 & 255) for i in range(4)]\n sb.reverse()\n return ''.join(sb)\npreorder = []\n\ndef helper(node):\n if node:\n preorder.append(int_to_str(node.val))\n helper(node.left)\n helper(node.right)\nhelper(root)\nreturn ''.join(preorder)", "d...
<|body_start_0|> def int_to_str(num): sb = [chr(num >> i * 8 & 255) for i in range(4)] sb.reverse() return ''.join(sb) preorder = [] def helper(node): if node: preorder.append(int_to_str(node.val)) helper(node.left)...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|> <|body_start_0|> def int_to_str...
stack_v2_sparse_classes_36k_train_021764
4,762
no_license
[ { "docstring": "Encodes a tree to a single string.", "name": "serialize", "signature": "def serialize(self, root: TreeNode) -> str" }, { "docstring": "Decodes your encoded data to tree.", "name": "deserialize", "signature": "def deserialize(self, data: str) -> TreeNode" } ]
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree.
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree. <|skeleton|> class Co...
59f70dc4466e15df591ba285317e4a1fe808ed60
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" def int_to_str(num): sb = [chr(num >> i * 8 & 255) for i in range(4)] sb.reverse() return ''.join(sb) preorder = [] def helper(node): if ...
the_stack_v2_python_sparse
leet/amazon/trees_and_graphs/449_serialize_and_deserialize_BST.py
arsamigullin/problem_solving_python
train
0
02774c1261595edc12f3a21ea68dcdbe2bf3c05f
[ "identities = {'identity-uuid': {'uuid': 'identity-uuid'}}\ntimestamp = datetime.datetime(2020, 1, 1)\nprocess_subscription(identities, 'identity-uuid', 'momconnect', timestamp)\nself.assertEqual(identities, {'identity-uuid': {'uuid': 'identity-uuid', 'channel': 'SMS'}})\nprocess_subscription(identities, 'identity-...
<|body_start_0|> identities = {'identity-uuid': {'uuid': 'identity-uuid'}} timestamp = datetime.datetime(2020, 1, 1) process_subscription(identities, 'identity-uuid', 'momconnect', timestamp) self.assertEqual(identities, {'identity-uuid': {'uuid': 'identity-uuid', 'channel': 'SMS'}}) ...
ProcessSubscriptionTests
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProcessSubscriptionTests: def test_channel_prefer_whatsapp(self): """Should set the channel, but never overwrite WhatsApp with SMS""" <|body_0|> def test_subscription_types(self): """Should add to the subscription list depending on the name""" <|body_1|> <|e...
stack_v2_sparse_classes_36k_train_021765
17,808
permissive
[ { "docstring": "Should set the channel, but never overwrite WhatsApp with SMS", "name": "test_channel_prefer_whatsapp", "signature": "def test_channel_prefer_whatsapp(self)" }, { "docstring": "Should add to the subscription list depending on the name", "name": "test_subscription_types", ...
2
stack_v2_sparse_classes_30k_train_011136
Implement the Python class `ProcessSubscriptionTests` described below. Class description: Implement the ProcessSubscriptionTests class. Method signatures and docstrings: - def test_channel_prefer_whatsapp(self): Should set the channel, but never overwrite WhatsApp with SMS - def test_subscription_types(self): Should ...
Implement the Python class `ProcessSubscriptionTests` described below. Class description: Implement the ProcessSubscriptionTests class. Method signatures and docstrings: - def test_channel_prefer_whatsapp(self): Should set the channel, but never overwrite WhatsApp with SMS - def test_subscription_types(self): Should ...
e1ea0beaf079f4f4d5f9562fb9d9a4f0670f459f
<|skeleton|> class ProcessSubscriptionTests: def test_channel_prefer_whatsapp(self): """Should set the channel, but never overwrite WhatsApp with SMS""" <|body_0|> def test_subscription_types(self): """Should add to the subscription list depending on the name""" <|body_1|> <|e...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProcessSubscriptionTests: def test_channel_prefer_whatsapp(self): """Should set the channel, but never overwrite WhatsApp with SMS""" identities = {'identity-uuid': {'uuid': 'identity-uuid'}} timestamp = datetime.datetime(2020, 1, 1) process_subscription(identities, 'identity-u...
the_stack_v2_python_sparse
scripts/migrate_to_rapidpro/test_collect_information.py
praekeltfoundation/ndoh-hub
train
0
851b9bc37be675536dfe9e48832ff31179ba7434
[ "e = ConsoleEvent()\ne.copyin(self)\nreturn e", "if not input:\n raise NoInput()\nself.bot = bot\nself.console = console\nself.nick = getpass.getuser()\nself.auth = self.nick + '@' + bot.uuid\nself.userhost = self.auth\nself.origin = self.userhost\nself.txt = input\nself.usercmnd = input.split()[0]\nself.chann...
<|body_start_0|> e = ConsoleEvent() e.copyin(self) return e <|end_body_0|> <|body_start_1|> if not input: raise NoInput() self.bot = bot self.console = console self.nick = getpass.getuser() self.auth = self.nick + '@' + bot.uuid self.u...
ConsoleEvent
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConsoleEvent: def __deepcopy__(self, a): """deepcopy an console event.""" <|body_0|> def parse(self, bot, input, console, *args, **kwargs): """overload this.""" <|body_1|> <|end_skeleton|> <|body_start_0|> e = ConsoleEvent() e.copyin(self) ...
stack_v2_sparse_classes_36k_train_021766
1,009
permissive
[ { "docstring": "deepcopy an console event.", "name": "__deepcopy__", "signature": "def __deepcopy__(self, a)" }, { "docstring": "overload this.", "name": "parse", "signature": "def parse(self, bot, input, console, *args, **kwargs)" } ]
2
null
Implement the Python class `ConsoleEvent` described below. Class description: Implement the ConsoleEvent class. Method signatures and docstrings: - def __deepcopy__(self, a): deepcopy an console event. - def parse(self, bot, input, console, *args, **kwargs): overload this.
Implement the Python class `ConsoleEvent` described below. Class description: Implement the ConsoleEvent class. Method signatures and docstrings: - def __deepcopy__(self, a): deepcopy an console event. - def parse(self, bot, input, console, *args, **kwargs): overload this. <|skeleton|> class ConsoleEvent: def _...
4d9ba385555da03f881f6c4354c062f7f3c9949c
<|skeleton|> class ConsoleEvent: def __deepcopy__(self, a): """deepcopy an console event.""" <|body_0|> def parse(self, bot, input, console, *args, **kwargs): """overload this.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConsoleEvent: def __deepcopy__(self, a): """deepcopy an console event.""" e = ConsoleEvent() e.copyin(self) return e def parse(self, bot, input, console, *args, **kwargs): """overload this.""" if not input: raise NoInput() self.bot = bot...
the_stack_v2_python_sparse
jsb/lib/console/event.py
melmothx/jsonbot
train
9
dcc445e08fc0864770c17a36497834d7fdc08330
[ "max_score = sum((ch.score for ch in self.subcategory.challenges.all()))\ncompletion_percentage = self.user_score / max_score * 100\nnext_proficiency = self.proficiency.fetch_next_proficiency()\nreturn next_proficiency is not None and next_proficiency.needed_percentage <= completion_percentage", "from social.mode...
<|body_start_0|> max_score = sum((ch.score for ch in self.subcategory.challenges.all())) completion_percentage = self.user_score / max_score * 100 next_proficiency = self.proficiency.fetch_next_proficiency() return next_proficiency is not None and next_proficiency.needed_percentage <= co...
Holds each user's proficiency in a given subcategory
UserSubcategoryProficiency
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserSubcategoryProficiency: """Holds each user's proficiency in a given subcategory""" def to_update_proficiency(self) -> bool: """Returns a boolean indicating if the user has passed the current proficiency bounds and should update his proficiency to the next""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_021767
13,737
no_license
[ { "docstring": "Returns a boolean indicating if the user has passed the current proficiency bounds and should update his proficiency to the next", "name": "to_update_proficiency", "signature": "def to_update_proficiency(self) -> bool" }, { "docstring": "Updates the user's proficiency if he has r...
2
null
Implement the Python class `UserSubcategoryProficiency` described below. Class description: Holds each user's proficiency in a given subcategory Method signatures and docstrings: - def to_update_proficiency(self) -> bool: Returns a boolean indicating if the user has passed the current proficiency bounds and should up...
Implement the Python class `UserSubcategoryProficiency` described below. Class description: Holds each user's proficiency in a given subcategory Method signatures and docstrings: - def to_update_proficiency(self) -> bool: Returns a boolean indicating if the user has passed the current proficiency bounds and should up...
d32a534a5ab248ffaae3697a25a453108c8d3f53
<|skeleton|> class UserSubcategoryProficiency: """Holds each user's proficiency in a given subcategory""" def to_update_proficiency(self) -> bool: """Returns a boolean indicating if the user has passed the current proficiency bounds and should update his proficiency to the next""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserSubcategoryProficiency: """Holds each user's proficiency in a given subcategory""" def to_update_proficiency(self) -> bool: """Returns a boolean indicating if the user has passed the current proficiency bounds and should update his proficiency to the next""" max_score = sum((ch.score ...
the_stack_v2_python_sparse
deadline_/challenges/models.py
two-man-army/deadline
train
18
9eb6c1dae0d3fa4a63d952654441af02a645f4aa
[ "self._dropout_rate = dropout_rate\nself._norm_epsilon = norm_epsilon\nself._conv3x1 = transformer_layers.Conv1DLayer(filter_size=3, output_size=int(d_model / 2), activation='relu')\nself._sep_conv9x1 = transformer_layers.SeparableConv1DLayer(min_relative_pos=-4, max_relative_pos=4, output_size=int(d_model / 2), de...
<|body_start_0|> self._dropout_rate = dropout_rate self._norm_epsilon = norm_epsilon self._conv3x1 = transformer_layers.Conv1DLayer(filter_size=3, output_size=int(d_model / 2), activation='relu') self._sep_conv9x1 = transformer_layers.SeparableConv1DLayer(min_relative_pos=-4, max_relativ...
The convolutional layers custom to the evolved transformer encoder. The input is projected to 4 times the model dimension size followed by a ReLU on the left branch while it goes through a 3x1 convolution on the right branch. The outputs of the branches are summed and then passed through a layer norm. The output of the...
EncoderConvolutionalLayer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncoderConvolutionalLayer: """The convolutional layers custom to the evolved transformer encoder. The input is projected to 4 times the model dimension size followed by a ReLU on the left branch while it goes through a 3x1 convolution on the right branch. The outputs of the branches are summed an...
stack_v2_sparse_classes_36k_train_021768
8,851
permissive
[ { "docstring": "Create an EncoderConvolutionalLayer. Args: d_model: a positive integer, the dimension of the model dim. dropout_rate: a float between 0 and 1. initializer_scale: a positive float, the scale for the initializers of the separable convolutional filters. norm_epsilon: a small positive float, the eps...
2
stack_v2_sparse_classes_30k_train_007705
Implement the Python class `EncoderConvolutionalLayer` described below. Class description: The convolutional layers custom to the evolved transformer encoder. The input is projected to 4 times the model dimension size followed by a ReLU on the left branch while it goes through a 3x1 convolution on the right branch. Th...
Implement the Python class `EncoderConvolutionalLayer` described below. Class description: The convolutional layers custom to the evolved transformer encoder. The input is projected to 4 times the model dimension size followed by a ReLU on the left branch while it goes through a 3x1 convolution on the right branch. Th...
fbf7b1e547e8b8cb134e81e1cd350c312c0b5a16
<|skeleton|> class EncoderConvolutionalLayer: """The convolutional layers custom to the evolved transformer encoder. The input is projected to 4 times the model dimension size followed by a ReLU on the left branch while it goes through a 3x1 convolution on the right branch. The outputs of the branches are summed an...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EncoderConvolutionalLayer: """The convolutional layers custom to the evolved transformer encoder. The input is projected to 4 times the model dimension size followed by a ReLU on the left branch while it goes through a 3x1 convolution on the right branch. The outputs of the branches are summed and then passed...
the_stack_v2_python_sparse
mesh_tensorflow/transformer/evolved_transformer.py
tensorflow/mesh
train
1,508
f81468dd4ab0c156e5b11c3c8f20f2dfae846e8f
[ "image = np.asfarray(image)\nself.image = color.rgb2gray(image)\nself.image = dwi.util.flip_minmax(self.image)\nself.voxel_size = voxel_size\nself.set_kwargs(**kwargs)", "mm = 1 / self.voxel_size\nself.blob_ka = dict(min_sigma=5 * mm, max_sigma=12 * mm, overlap=0.5)\nself.log_ka = dict(num_sigma=5, threshold=0.1,...
<|body_start_0|> image = np.asfarray(image) self.image = color.rgb2gray(image) self.image = dwi.util.flip_minmax(self.image) self.voxel_size = voxel_size self.set_kwargs(**kwargs) <|end_body_0|> <|body_start_1|> mm = 1 / self.voxel_size self.blob_ka = dict(min_si...
...
BlobDetector
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BlobDetector: """...""" def __init__(self, image, voxel_size, **kwargs): """...""" <|body_0|> def set_kwargs(self, blob_ka={}, log_ka={}, dog_ka={}, doh_ka={}): """Set keyword arguments for blob detection functions.""" <|body_1|> def log(self): ...
stack_v2_sparse_classes_36k_train_021769
13,518
permissive
[ { "docstring": "...", "name": "__init__", "signature": "def __init__(self, image, voxel_size, **kwargs)" }, { "docstring": "Set keyword arguments for blob detection functions.", "name": "set_kwargs", "signature": "def set_kwargs(self, blob_ka={}, log_ka={}, dog_ka={}, doh_ka={})" }, ...
6
stack_v2_sparse_classes_30k_train_005837
Implement the Python class `BlobDetector` described below. Class description: ... Method signatures and docstrings: - def __init__(self, image, voxel_size, **kwargs): ... - def set_kwargs(self, blob_ka={}, log_ka={}, dog_ka={}, doh_ka={}): Set keyword arguments for blob detection functions. - def log(self): Laplacian...
Implement the Python class `BlobDetector` described below. Class description: ... Method signatures and docstrings: - def __init__(self, image, voxel_size, **kwargs): ... - def set_kwargs(self, blob_ka={}, log_ka={}, dog_ka={}, doh_ka={}): Set keyword arguments for blob detection functions. - def log(self): Laplacian...
6655eea21037977ed528b992b3a8471393127b77
<|skeleton|> class BlobDetector: """...""" def __init__(self, image, voxel_size, **kwargs): """...""" <|body_0|> def set_kwargs(self, blob_ka={}, log_ka={}, dog_ka={}, doh_ka={}): """Set keyword arguments for blob detection functions.""" <|body_1|> def log(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BlobDetector: """...""" def __init__(self, image, voxel_size, **kwargs): """...""" image = np.asfarray(image) self.image = color.rgb2gray(image) self.image = dwi.util.flip_minmax(self.image) self.voxel_size = voxel_size self.set_kwargs(**kwargs) def se...
the_stack_v2_python_sparse
dwi/detectlesion.py
AdamWu1979/dwilib
train
0
3f3b557399b6aaee829faea65beccdd9b7b53a13
[ "if root == None:\n return []\npath = self.inorderTraversal(root.left)\npath.append(root.val)\npath.extend(self.inorderTraversal(root.right))\nreturn path", "path = self.inorderTraversal(root)\nfor i in xrange(1, len(path)):\n if path[i] <= path[i - 1]:\n return False\nreturn True" ]
<|body_start_0|> if root == None: return [] path = self.inorderTraversal(root.left) path.append(root.val) path.extend(self.inorderTraversal(root.right)) return path <|end_body_0|> <|body_start_1|> path = self.inorderTraversal(root) for i in xrange(1, ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def inorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_0|> def isValidBST(self, root): """:type root: TreeNode :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> if root == None: return ...
stack_v2_sparse_classes_36k_train_021770
784
no_license
[ { "docstring": ":type root: TreeNode :rtype: List[int]", "name": "inorderTraversal", "signature": "def inorderTraversal(self, root)" }, { "docstring": ":type root: TreeNode :rtype: bool", "name": "isValidBST", "signature": "def isValidBST(self, root)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def inorderTraversal(self, root): :type root: TreeNode :rtype: List[int] - def isValidBST(self, root): :type root: TreeNode :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def inorderTraversal(self, root): :type root: TreeNode :rtype: List[int] - def isValidBST(self, root): :type root: TreeNode :rtype: bool <|skeleton|> class Solution: def in...
c767e3794455c5105ca34714a3e15101f4962f4d
<|skeleton|> class Solution: def inorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_0|> def isValidBST(self, root): """:type root: TreeNode :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def inorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" if root == None: return [] path = self.inorderTraversal(root.left) path.append(root.val) path.extend(self.inorderTraversal(root.right)) return path def isVa...
the_stack_v2_python_sparse
098/ValidateBinarySearchTree.py
basto11/leetcode
train
0
150526e2268e028666be9eed2338ff75ac2e6966
[ "expected_obj = self.resize_prep_end_obj\nactual_json = json.dumps(self.instance_resize_prep_end_dict)\nactual_obj = InstanceResizePrepEnd.deserialize(actual_json, 'json')\nself.assertEqual(expected_obj, actual_obj)\nself.assertFalse(actual_obj.is_empty())", "modified_dict = self.instance_resize_prep_end_dict.cop...
<|body_start_0|> expected_obj = self.resize_prep_end_obj actual_json = json.dumps(self.instance_resize_prep_end_dict) actual_obj = InstanceResizePrepEnd.deserialize(actual_json, 'json') self.assertEqual(expected_obj, actual_obj) self.assertFalse(actual_obj.is_empty()) <|end_body_...
InstanceResizePrepEndTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InstanceResizePrepEndTest: def test_instance_resize_prep_end_valid_json(self): """Verify that the valid event deserialized correctly""" <|body_0|> def test_instance_resize_prep_end_missing_attribute_json(self): """Verify event missing expected attribute does not dese...
stack_v2_sparse_classes_36k_train_021771
5,720
permissive
[ { "docstring": "Verify that the valid event deserialized correctly", "name": "test_instance_resize_prep_end_valid_json", "signature": "def test_instance_resize_prep_end_valid_json(self)" }, { "docstring": "Verify event missing expected attribute does not deserialize", "name": "test_instance_...
3
stack_v2_sparse_classes_30k_train_007264
Implement the Python class `InstanceResizePrepEndTest` described below. Class description: Implement the InstanceResizePrepEndTest class. Method signatures and docstrings: - def test_instance_resize_prep_end_valid_json(self): Verify that the valid event deserialized correctly - def test_instance_resize_prep_end_missi...
Implement the Python class `InstanceResizePrepEndTest` described below. Class description: Implement the InstanceResizePrepEndTest class. Method signatures and docstrings: - def test_instance_resize_prep_end_valid_json(self): Verify that the valid event deserialized correctly - def test_instance_resize_prep_end_missi...
7d49cf6bfd7e1a6e5b739e7de52f2e18e5ccf924
<|skeleton|> class InstanceResizePrepEndTest: def test_instance_resize_prep_end_valid_json(self): """Verify that the valid event deserialized correctly""" <|body_0|> def test_instance_resize_prep_end_missing_attribute_json(self): """Verify event missing expected attribute does not dese...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InstanceResizePrepEndTest: def test_instance_resize_prep_end_valid_json(self): """Verify that the valid event deserialized correctly""" expected_obj = self.resize_prep_end_obj actual_json = json.dumps(self.instance_resize_prep_end_dict) actual_obj = InstanceResizePrepEnd.deseri...
the_stack_v2_python_sparse
metatests/events/models/compute/test_instance_resize_prep.py
kurhula/cloudcafe
train
0
74740fad7b96eeb46118e5d97bf81abef5df8f6e
[ "super().__init__(coordinator, device, 'power', 'Energy usage', f'power_{dev_type}')\nself._device = device\nself._type = dev_type\nself._attr_name = f'Energy {dev_type}'\nself._attr_state_class = state_class", "if self.coordinator.data.power_meter is None:\n return None\nreturn getattr(self.coordinator.data.p...
<|body_start_0|> super().__init__(coordinator, device, 'power', 'Energy usage', f'power_{dev_type}') self._device = device self._type = dev_type self._attr_name = f'Energy {dev_type}' self._attr_state_class = state_class <|end_body_0|> <|body_start_1|> if self.coordinato...
The Youless low meter value sensor.
EnergyMeterSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EnergyMeterSensor: """The Youless low meter value sensor.""" def __init__(self, coordinator: DataUpdateCoordinator[YoulessAPI], device: str, dev_type: str, state_class: SensorStateClass) -> None: """Instantiate a energy meter sensor.""" <|body_0|> def get_sensor(self) ->...
stack_v2_sparse_classes_36k_train_021772
11,812
permissive
[ { "docstring": "Instantiate a energy meter sensor.", "name": "__init__", "signature": "def __init__(self, coordinator: DataUpdateCoordinator[YoulessAPI], device: str, dev_type: str, state_class: SensorStateClass) -> None" }, { "docstring": "Get the sensor for providing the value.", "name": "...
2
null
Implement the Python class `EnergyMeterSensor` described below. Class description: The Youless low meter value sensor. Method signatures and docstrings: - def __init__(self, coordinator: DataUpdateCoordinator[YoulessAPI], device: str, dev_type: str, state_class: SensorStateClass) -> None: Instantiate a energy meter s...
Implement the Python class `EnergyMeterSensor` described below. Class description: The Youless low meter value sensor. Method signatures and docstrings: - def __init__(self, coordinator: DataUpdateCoordinator[YoulessAPI], device: str, dev_type: str, state_class: SensorStateClass) -> None: Instantiate a energy meter s...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class EnergyMeterSensor: """The Youless low meter value sensor.""" def __init__(self, coordinator: DataUpdateCoordinator[YoulessAPI], device: str, dev_type: str, state_class: SensorStateClass) -> None: """Instantiate a energy meter sensor.""" <|body_0|> def get_sensor(self) ->...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EnergyMeterSensor: """The Youless low meter value sensor.""" def __init__(self, coordinator: DataUpdateCoordinator[YoulessAPI], device: str, dev_type: str, state_class: SensorStateClass) -> None: """Instantiate a energy meter sensor.""" super().__init__(coordinator, device, 'power', 'Ener...
the_stack_v2_python_sparse
homeassistant/components/youless/sensor.py
home-assistant/core
train
35,501
f2ceb1d69ca97399d8b0d8c3666eeb6df4794570
[ "self.keyword = keyword\n' CRYSTAL keyword. '\nsuper(GeometryOpt, self).__init__(value=value)", "super(GeometryOpt, self).__set__(instance, value)\nif self.value:\n if instance.maxcycle is not None and instance.maxcycle < 1:\n instance.maxcycle = 100\n if self.keyword != 'fulloptg':\n instance...
<|body_start_0|> self.keyword = keyword ' CRYSTAL keyword. ' super(GeometryOpt, self).__init__(value=value) <|end_body_0|> <|body_start_1|> super(GeometryOpt, self).__set__(instance, value) if self.value: if instance.maxcycle is not None and instance.maxcycle < 1: ...
Geometry optimization keyword. When set to True, makes sure that: 1. MAXCYCLE is non-zero. If it is, sets it to 100. 2. only one of FULLOPTG, ITATOCELL, ITREDUN, CELLONLY is True. 3. CVOLOPT is False unless this is a FULLOPTG or CELLONLY calculation. \\(2\\) and (3) are decided by the keyword argument in input.
GeometryOpt
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GeometryOpt: """Geometry optimization keyword. When set to True, makes sure that: 1. MAXCYCLE is non-zero. If it is, sets it to 100. 2. only one of FULLOPTG, ITATOCELL, ITREDUN, CELLONLY is True. 3. CVOLOPT is False unless this is a FULLOPTG or CELLONLY calculation. \\(2\\) and (3) are decided by...
stack_v2_sparse_classes_36k_train_021773
13,160
no_license
[ { "docstring": "Initializes a geometry optimization keyword.", "name": "__init__", "signature": "def __init__(self, keyword, value=False)" }, { "docstring": "Sets keyword to appear or not. Also clears attendant conditions described in :py:class:`GeometryOpt`.", "name": "__set__", "signat...
2
null
Implement the Python class `GeometryOpt` described below. Class description: Geometry optimization keyword. When set to True, makes sure that: 1. MAXCYCLE is non-zero. If it is, sets it to 100. 2. only one of FULLOPTG, ITATOCELL, ITREDUN, CELLONLY is True. 3. CVOLOPT is False unless this is a FULLOPTG or CELLONLY calc...
Implement the Python class `GeometryOpt` described below. Class description: Geometry optimization keyword. When set to True, makes sure that: 1. MAXCYCLE is non-zero. If it is, sets it to 100. 2. only one of FULLOPTG, ITATOCELL, ITREDUN, CELLONLY is True. 3. CVOLOPT is False unless this is a FULLOPTG or CELLONLY calc...
9c0ab667f94dc4629404a8ec99cbeaa323f0c8b3
<|skeleton|> class GeometryOpt: """Geometry optimization keyword. When set to True, makes sure that: 1. MAXCYCLE is non-zero. If it is, sets it to 100. 2. only one of FULLOPTG, ITATOCELL, ITREDUN, CELLONLY is True. 3. CVOLOPT is False unless this is a FULLOPTG or CELLONLY calculation. \\(2\\) and (3) are decided by...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GeometryOpt: """Geometry optimization keyword. When set to True, makes sure that: 1. MAXCYCLE is non-zero. If it is, sets it to 100. 2. only one of FULLOPTG, ITATOCELL, ITREDUN, CELLONLY is True. 3. CVOLOPT is False unless this is a FULLOPTG or CELLONLY calculation. \\(2\\) and (3) are decided by the keyword ...
the_stack_v2_python_sparse
dftcrystal/optgeom.py
Shibu778/LaDa
train
0
8d2cf070062a347629481fbc9009d84af0b427ea
[ "g = defaultdict(set)\npre = [-1] * n\nlow = [-1] * n\ncnt = [0]\nfor c in connections:\n g[c[0]].add(c[1])\n g[c[1]].add(c[0])\nans = []\n\ndef dfs(edge):\n v, w = edge\n pre[w] = cnt[0]\n low[w] = pre[w]\n cnt[0] += 1\n for i in g[w]:\n if i == v:\n continue\n if pre[...
<|body_start_0|> g = defaultdict(set) pre = [-1] * n low = [-1] * n cnt = [0] for c in connections: g[c[0]].add(c[1]) g[c[1]].add(c[0]) ans = [] def dfs(edge): v, w = edge pre[w] = cnt[0] low[w] = pre[w]...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def criticalConnections(self, n, connections): """:type n: int :type connections: List[List[int]] :rtype: List[List[int]]""" <|body_0|> def criticalConnections2(self, n, connections): """:type n: int :type connections: List[List[int]] :rtype: List[List[int]...
stack_v2_sparse_classes_36k_train_021774
3,980
no_license
[ { "docstring": ":type n: int :type connections: List[List[int]] :rtype: List[List[int]]", "name": "criticalConnections", "signature": "def criticalConnections(self, n, connections)" }, { "docstring": ":type n: int :type connections: List[List[int]] :rtype: List[List[int]]", "name": "critical...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def criticalConnections(self, n, connections): :type n: int :type connections: List[List[int]] :rtype: List[List[int]] - def criticalConnections2(self, n, connections): :type n: ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def criticalConnections(self, n, connections): :type n: int :type connections: List[List[int]] :rtype: List[List[int]] - def criticalConnections2(self, n, connections): :type n: ...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def criticalConnections(self, n, connections): """:type n: int :type connections: List[List[int]] :rtype: List[List[int]]""" <|body_0|> def criticalConnections2(self, n, connections): """:type n: int :type connections: List[List[int]] :rtype: List[List[int]...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def criticalConnections(self, n, connections): """:type n: int :type connections: List[List[int]] :rtype: List[List[int]]""" g = defaultdict(set) pre = [-1] * n low = [-1] * n cnt = [0] for c in connections: g[c[0]].add(c[1]) g[...
the_stack_v2_python_sparse
C/CriticalConnectionsInANetwork.py
bssrdf/pyleet
train
2
b2aaabb7f50141c641bfe37c688ef0453cb27676
[ "lo = 0\nhi = len(nums) - 1\nk = 0\nwhile k <= hi:\n print(k, lo, hi)\n if nums[k] == 0:\n nums[lo], nums[k] = (nums[k], nums[lo])\n k += 1\n lo += 1\n elif nums[k] == 2:\n nums[hi], nums[k] = (nums[k], nums[hi])\n hi -= 1\n else:\n k += 1", "count = [0] * 3\n...
<|body_start_0|> lo = 0 hi = len(nums) - 1 k = 0 while k <= hi: print(k, lo, hi) if nums[k] == 0: nums[lo], nums[k] = (nums[k], nums[lo]) k += 1 lo += 1 elif nums[k] == 2: nums[hi], nums[k...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def sortColors(self, nums): """Do not return anything, modify nums in-place instead.""" <|body_0|> def sortColors_2(self, nums: List[int]) -> None: """Do not return anything, modify nums in-place instead.""" <|body_1|> <|end_skeleton|> <|body_star...
stack_v2_sparse_classes_36k_train_021775
1,154
no_license
[ { "docstring": "Do not return anything, modify nums in-place instead.", "name": "sortColors", "signature": "def sortColors(self, nums)" }, { "docstring": "Do not return anything, modify nums in-place instead.", "name": "sortColors_2", "signature": "def sortColors_2(self, nums: List[int])...
2
stack_v2_sparse_classes_30k_train_011366
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortColors(self, nums): Do not return anything, modify nums in-place instead. - def sortColors_2(self, nums: List[int]) -> None: Do not return anything, modify nums in-place ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortColors(self, nums): Do not return anything, modify nums in-place instead. - def sortColors_2(self, nums: List[int]) -> None: Do not return anything, modify nums in-place ...
20a48021be5e5348d681e910c843e734df98b596
<|skeleton|> class Solution: def sortColors(self, nums): """Do not return anything, modify nums in-place instead.""" <|body_0|> def sortColors_2(self, nums: List[int]) -> None: """Do not return anything, modify nums in-place instead.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def sortColors(self, nums): """Do not return anything, modify nums in-place instead.""" lo = 0 hi = len(nums) - 1 k = 0 while k <= hi: print(k, lo, hi) if nums[k] == 0: nums[lo], nums[k] = (nums[k], nums[lo]) ...
the_stack_v2_python_sparse
sort_colors/sort_colors.py
narnat/leetcode
train
0
9f423f1dae654510eebf5c8c5455900a33f7ccd9
[ "try:\n r = requests.get(url, stream=True)\n if r.status_code == 200:\n try:\n if r.headers['Content-Type'] in acceptable_content_types:\n filename = self.make_filename(url, r.headers)\n filepath = '%s%s' % (self.path, filename)\n with open(filepa...
<|body_start_0|> try: r = requests.get(url, stream=True) if r.status_code == 200: try: if r.headers['Content-Type'] in acceptable_content_types: filename = self.make_filename(url, r.headers) filepath = '%...
For downloading a file from a URL and saving it into /tmp/. Use like: from ditto.core.utils.downloader import filedownloader filepath = filedownloader.download(my_url, ['image/jpg']) filepath would be like '/tmp/image.jpg'
FileDownloader
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileDownloader: """For downloading a file from a URL and saving it into /tmp/. Use like: from ditto.core.utils.downloader import filedownloader filepath = filedownloader.download(my_url, ['image/jpg']) filepath would be like '/tmp/image.jpg'""" def download(self, url, acceptable_content_type...
stack_v2_sparse_classes_36k_train_021776
3,509
permissive
[ { "docstring": "Downloads a file from a URL and saves it into /tmp/. Returns the filepath. Expects: url -- The URL of the file to fetch. acceptable_content_types -- A list of MIME types the request must match. eg:['image/jpeg', 'image/jpg', 'image/png', 'image/gif'] Raises DownloadException if something goes wr...
2
null
Implement the Python class `FileDownloader` described below. Class description: For downloading a file from a URL and saving it into /tmp/. Use like: from ditto.core.utils.downloader import filedownloader filepath = filedownloader.download(my_url, ['image/jpg']) filepath would be like '/tmp/image.jpg' Method signatur...
Implement the Python class `FileDownloader` described below. Class description: For downloading a file from a URL and saving it into /tmp/. Use like: from ditto.core.utils.downloader import filedownloader filepath = filedownloader.download(my_url, ['image/jpg']) filepath would be like '/tmp/image.jpg' Method signatur...
57ee6f6657b41705af71ef67924d8ef06c60ae4f
<|skeleton|> class FileDownloader: """For downloading a file from a URL and saving it into /tmp/. Use like: from ditto.core.utils.downloader import filedownloader filepath = filedownloader.download(my_url, ['image/jpg']) filepath would be like '/tmp/image.jpg'""" def download(self, url, acceptable_content_type...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FileDownloader: """For downloading a file from a URL and saving it into /tmp/. Use like: from ditto.core.utils.downloader import filedownloader filepath = filedownloader.download(my_url, ['image/jpg']) filepath would be like '/tmp/image.jpg'""" def download(self, url, acceptable_content_types): "...
the_stack_v2_python_sparse
ditto/core/utils/downloader.py
philgyford/django-ditto
train
59
04f8483b32b6b1415dd121fb42fbf1db974b75be
[ "context = Context()\nif parent is None:\n settings_object = NotificationSettings.objects.get_for_lang(self.language)\nelse:\n settings_object = NotificationSettings.objects.get(pk=parent)\ncontext['main_content'] = self.html_to_empty_template()\ntemplate_object = settings_object.default_notification_template...
<|body_start_0|> context = Context() if parent is None: settings_object = NotificationSettings.objects.get_for_lang(self.language) else: settings_object = NotificationSettings.objects.get(pk=parent) context['main_content'] = self.html_to_empty_template() t...
Notification
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Notification: def preview(self, parent=None): """Shows preview of the notification as html :param parent: id of the notification parent template if None used current language :return: Html of the faceless notification""" <|body_0|> def html_to_empty_template(self): "...
stack_v2_sparse_classes_36k_train_021777
16,219
no_license
[ { "docstring": "Shows preview of the notification as html :param parent: id of the notification parent template if None used current language :return: Html of the faceless notification", "name": "preview", "signature": "def preview(self, parent=None)" }, { "docstring": "Makes template from self....
2
null
Implement the Python class `Notification` described below. Class description: Implement the Notification class. Method signatures and docstrings: - def preview(self, parent=None): Shows preview of the notification as html :param parent: id of the notification parent template if None used current language :return: Htm...
Implement the Python class `Notification` described below. Class description: Implement the Notification class. Method signatures and docstrings: - def preview(self, parent=None): Shows preview of the notification as html :param parent: id of the notification parent template if None used current language :return: Htm...
302324dccc135f55d92fb705c58314c55fed22aa
<|skeleton|> class Notification: def preview(self, parent=None): """Shows preview of the notification as html :param parent: id of the notification parent template if None used current language :return: Html of the faceless notification""" <|body_0|> def html_to_empty_template(self): "...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Notification: def preview(self, parent=None): """Shows preview of the notification as html :param parent: id of the notification parent template if None used current language :return: Html of the faceless notification""" context = Context() if parent is None: settings_objec...
the_stack_v2_python_sparse
django-shared/notification/models.py
riyanhax/a-demo
train
0
9e481592acbedbf5562c66300c2bc5187c443b31
[ "self.sum = sum(w)\nself.len = len(w)\nfor i in range(1, len(w)):\n w[i] += w[i - 1]\nself.cum_sum = w", "r = random.randint(1, self.sum)\nlow, high = (0, self.len - 1)\nwhile low < high:\n mid = low + (high - low) // 2\n if r > self.cum_sum[mid]:\n low = mid + 1\n else:\n high = mid\nre...
<|body_start_0|> self.sum = sum(w) self.len = len(w) for i in range(1, len(w)): w[i] += w[i - 1] self.cum_sum = w <|end_body_0|> <|body_start_1|> r = random.randint(1, self.sum) low, high = (0, self.len - 1) while low < high: mid = low + (...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.sum = sum(w) self.len = len(w) for i in range(1, len(w)): w[i] ...
stack_v2_sparse_classes_36k_train_021778
615
no_license
[ { "docstring": ":type w: List[int]", "name": "__init__", "signature": "def __init__(self, w)" }, { "docstring": ":rtype: int", "name": "pickIndex", "signature": "def pickIndex(self)" } ]
2
stack_v2_sparse_classes_30k_train_012905
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int <|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|...
e197436bf160096848d52c1c6c1d1af720d3d10c
<|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, w): """:type w: List[int]""" self.sum = sum(w) self.len = len(w) for i in range(1, len(w)): w[i] += w[i - 1] self.cum_sum = w def pickIndex(self): """:rtype: int""" r = random.randint(1, self.sum) low...
the_stack_v2_python_sparse
528.py
Kathy961225/My_LeetCode_Practice
train
0
241644597f6ad0d8b581fbdaec17bea8d735bce2
[ "bitarray = 0\nfor c in s:\n char_num = self.get_letter_num(c)\n if char_num is not None:\n bitarray ^= 1 << char_num\nnon_even_chars = 0\nwhile bitarray > 0:\n non_even_chars += bitarray & 1\n if non_even_chars > 1:\n return False\n bitarray >>= 1\nreturn True", "char = char.lower()\...
<|body_start_0|> bitarray = 0 for c in s: char_num = self.get_letter_num(c) if char_num is not None: bitarray ^= 1 << char_num non_even_chars = 0 while bitarray > 0: non_even_chars += bitarray & 1 if non_even_chars > 1: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def palindrome_permutation(self, s): """Check if string is a permutation of a palindrome. Ignore case and non-letter characters. There can be, at most, one odd count of a letter. Keep track of odd/even counts using a bit array. :param s: input string :return: True if s is permu...
stack_v2_sparse_classes_36k_train_021779
1,877
no_license
[ { "docstring": "Check if string is a permutation of a palindrome. Ignore case and non-letter characters. There can be, at most, one odd count of a letter. Keep track of odd/even counts using a bit array. :param s: input string :return: True if s is permutation of a palindrome", "name": "palindrome_permutati...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def palindrome_permutation(self, s): Check if string is a permutation of a palindrome. Ignore case and non-letter characters. There can be, at most, one odd count of a letter. Ke...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def palindrome_permutation(self, s): Check if string is a permutation of a palindrome. Ignore case and non-letter characters. There can be, at most, one odd count of a letter. Ke...
9cfc663c5bb382f9983eb82e60344bd290e7284b
<|skeleton|> class Solution: def palindrome_permutation(self, s): """Check if string is a permutation of a palindrome. Ignore case and non-letter characters. There can be, at most, one odd count of a letter. Keep track of odd/even counts using a bit array. :param s: input string :return: True if s is permu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def palindrome_permutation(self, s): """Check if string is a permutation of a palindrome. Ignore case and non-letter characters. There can be, at most, one odd count of a letter. Keep track of odd/even counts using a bit array. :param s: input string :return: True if s is permutation of a pa...
the_stack_v2_python_sparse
c1/1_4_palindrome_permutation.py
ltn100/ctci
train
0
5f252570411540b0b71662f845169d8b9454ae95
[ "if type(capacity) != int or capacity <= 0:\n raise Exception('Capacity Error')\n'@helpDescription(When the CircularQueue class is initialized, a list is initalized which acts as the queue. The capacity, count (number of items in the queue), head (index of the first item in the queue) and tail (index of the last...
<|body_start_0|> if type(capacity) != int or capacity <= 0: raise Exception('Capacity Error') '@helpDescription(When the CircularQueue class is initialized, a list is initalized which acts as the queue. The capacity, count (number of items in the queue), head (index of the first item in the ...
@helpDescription(The capacity, or the maximum length allowed in the queue, is passed in as an integer when the CircularQueue class is initialized.)
CircularQueue
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CircularQueue: """@helpDescription(The capacity, or the maximum length allowed in the queue, is passed in as an integer when the CircularQueue class is initialized.)""" def __init__(self, capacity): """@helpDescription(The value passed in for capacity of a queue must be a positive in...
stack_v2_sparse_classes_36k_train_021780
6,664
no_license
[ { "docstring": "@helpDescription(The value passed in for capacity of a queue must be a positive integer. If the value is not, an exception with the line 'Capacity Error' is rasied.)", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": "@helpDescription(If the queue...
5
stack_v2_sparse_classes_30k_train_013913
Implement the Python class `CircularQueue` described below. Class description: @helpDescription(The capacity, or the maximum length allowed in the queue, is passed in as an integer when the CircularQueue class is initialized.) Method signatures and docstrings: - def __init__(self, capacity): @helpDescription(The valu...
Implement the Python class `CircularQueue` described below. Class description: @helpDescription(The capacity, or the maximum length allowed in the queue, is passed in as an integer when the CircularQueue class is initialized.) Method signatures and docstrings: - def __init__(self, capacity): @helpDescription(The valu...
688638f6c3fa3d31c4f8be6391147d773e1aa9dd
<|skeleton|> class CircularQueue: """@helpDescription(The capacity, or the maximum length allowed in the queue, is passed in as an integer when the CircularQueue class is initialized.)""" def __init__(self, capacity): """@helpDescription(The value passed in for capacity of a queue must be a positive in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CircularQueue: """@helpDescription(The capacity, or the maximum length allowed in the queue, is passed in as an integer when the CircularQueue class is initialized.)""" def __init__(self, capacity): """@helpDescription(The value passed in for capacity of a queue must be a positive integer. If the...
the_stack_v2_python_sparse
python/py_queue_class/queue_class.py
cskamil/PcExParser
train
1
79b88cfb0013cfe3ff89046b6315c677f120f59b
[ "def root_left_right(r):\n if not r:\n return []\n return [r.val] + root_left_right(r.left) + root_left_right(r.right)\nreturn str(root_left_right(root))", "def _deserialize(_li):\n if not _li:\n return\n root = TreeNode(_li[0])\n left = 0\n right = len(_li)\n while left < right...
<|body_start_0|> def root_left_right(r): if not r: return [] return [r.val] + root_left_right(r.left) + root_left_right(r.right) return str(root_left_right(root)) <|end_body_0|> <|body_start_1|> def _deserialize(_li): if not _li: ...
Codec2
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec2: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|> <|body_start_0|> def root_left...
stack_v2_sparse_classes_36k_train_021781
3,000
no_license
[ { "docstring": "Encodes a tree to a single string.", "name": "serialize", "signature": "def serialize(self, root: TreeNode) -> str" }, { "docstring": "Decodes your encoded data to tree.", "name": "deserialize", "signature": "def deserialize(self, data: str) -> TreeNode" } ]
2
stack_v2_sparse_classes_30k_train_009279
Implement the Python class `Codec2` described below. Class description: Implement the Codec2 class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree.
Implement the Python class `Codec2` described below. Class description: Implement the Codec2 class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree. <|skeleton|> class ...
6dc5b8968b6bef0186d3806e4aa35ee7b5d75ff2
<|skeleton|> class Codec2: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec2: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" def root_left_right(r): if not r: return [] return [r.val] + root_left_right(r.left) + root_left_right(r.right) return str(root_left_right(root)) de...
the_stack_v2_python_sparse
letecode/361-480/441-460/449.py
hshrimp/letecode_for_me
train
1
2f6587ebab7cdefe199aa9036e8992aa4c02047e
[ "if 'statuses' in data:\n if 'active' in data.get('statuses'):\n if 'directive' in data.get('statuses').get('active'):\n data['status_active'] = data['statuses']['active']['directive']\n if 'suspended' in data.get('statuses'):\n if 'directive' in data.get('statuses').get('suspended'):...
<|body_start_0|> if 'statuses' in data: if 'active' in data.get('statuses'): if 'directive' in data.get('statuses').get('active'): data['status_active'] = data['statuses']['active']['directive'] if 'suspended' in data.get('statuses'): i...
Single Constraints Schema.
ConstraintsSchema
[ "LicenseRef-scancode-dco-1.1", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConstraintsSchema: """Single Constraints Schema.""" def extract_info(self, data, **kwargs): """Support deserialization of statuses according to DIF spec.""" <|body_0|> def reformat_data(self, data, **kwargs): """Support serialization of statuses according to DIF ...
stack_v2_sparse_classes_36k_train_021782
27,273
permissive
[ { "docstring": "Support deserialization of statuses according to DIF spec.", "name": "extract_info", "signature": "def extract_info(self, data, **kwargs)" }, { "docstring": "Support serialization of statuses according to DIF spec.", "name": "reformat_data", "signature": "def reformat_dat...
2
null
Implement the Python class `ConstraintsSchema` described below. Class description: Single Constraints Schema. Method signatures and docstrings: - def extract_info(self, data, **kwargs): Support deserialization of statuses according to DIF spec. - def reformat_data(self, data, **kwargs): Support serialization of statu...
Implement the Python class `ConstraintsSchema` described below. Class description: Single Constraints Schema. Method signatures and docstrings: - def extract_info(self, data, **kwargs): Support deserialization of statuses according to DIF spec. - def reformat_data(self, data, **kwargs): Support serialization of statu...
39cac36d8937ce84a9307ce100aaefb8bc05ec04
<|skeleton|> class ConstraintsSchema: """Single Constraints Schema.""" def extract_info(self, data, **kwargs): """Support deserialization of statuses according to DIF spec.""" <|body_0|> def reformat_data(self, data, **kwargs): """Support serialization of statuses according to DIF ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConstraintsSchema: """Single Constraints Schema.""" def extract_info(self, data, **kwargs): """Support deserialization of statuses according to DIF spec.""" if 'statuses' in data: if 'active' in data.get('statuses'): if 'directive' in data.get('statuses').get('...
the_stack_v2_python_sparse
aries_cloudagent/protocols/present_proof/dif/pres_exch.py
hyperledger/aries-cloudagent-python
train
370
33ca131b36d4bb5ee80b4bf7eba1dcda19b4f842
[ "dims = 5\nspecturm = np.linspace(1.0, 2.0, dims).astype(np.float32)\nA_dist = quadratic_helper.FixedEigenSpectrumMatrixDistribution(specturm)\ns = A_dist.sample()\nwith self.test_session() as sess:\n mat = sess.run(s)\n sum_square_not_diag = np.sum(np.square(mat - np.eye(dims) * mat))\n self.assertGreater...
<|body_start_0|> dims = 5 specturm = np.linspace(1.0, 2.0, dims).astype(np.float32) A_dist = quadratic_helper.FixedEigenSpectrumMatrixDistribution(specturm) s = A_dist.sample() with self.test_session() as sess: mat = sess.run(s) sum_square_not_diag = np.su...
QuadraticHelperTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuadraticHelperTest: def test_eigen_spectrum_matrix_distribution(self): """Ensures that the sampled matrix has the correct eigen spectrum.""" <|body_0|> def test_fixed_dim_sample_quadratic(self): """Ensures that not passing `seed` produces different losses.""" ...
stack_v2_sparse_classes_36k_train_021783
3,540
permissive
[ { "docstring": "Ensures that the sampled matrix has the correct eigen spectrum.", "name": "test_eigen_spectrum_matrix_distribution", "signature": "def test_eigen_spectrum_matrix_distribution(self)" }, { "docstring": "Ensures that not passing `seed` produces different losses.", "name": "test_...
3
null
Implement the Python class `QuadraticHelperTest` described below. Class description: Implement the QuadraticHelperTest class. Method signatures and docstrings: - def test_eigen_spectrum_matrix_distribution(self): Ensures that the sampled matrix has the correct eigen spectrum. - def test_fixed_dim_sample_quadratic(sel...
Implement the Python class `QuadraticHelperTest` described below. Class description: Implement the QuadraticHelperTest class. Method signatures and docstrings: - def test_eigen_spectrum_matrix_distribution(self): Ensures that the sampled matrix has the correct eigen spectrum. - def test_fixed_dim_sample_quadratic(sel...
727ec399ad17b4dd1f71ce69a26fc3b0371d9fa7
<|skeleton|> class QuadraticHelperTest: def test_eigen_spectrum_matrix_distribution(self): """Ensures that the sampled matrix has the correct eigen spectrum.""" <|body_0|> def test_fixed_dim_sample_quadratic(self): """Ensures that not passing `seed` produces different losses.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QuadraticHelperTest: def test_eigen_spectrum_matrix_distribution(self): """Ensures that the sampled matrix has the correct eigen spectrum.""" dims = 5 specturm = np.linspace(1.0, 2.0, dims).astype(np.float32) A_dist = quadratic_helper.FixedEigenSpectrumMatrixDistribution(spectu...
the_stack_v2_python_sparse
task_set/tasks/quadratic_helper_test.py
Ayoob7/google-research
train
2
dae8cfb6761fb0abdeef102872f1442dda84417d
[ "super(UI, self).__init__(parent)\nself.statusBar().showMessage('Statusbar')\nmenubar = self.menuBar()\nfileMenu = menubar.addMenu('&File')\nhelpMenu = menubar.addMenu('&Help')\nexitAction = PyQt5.QtWidgets.QAction('&Exit', self)\nexitAction.setShortcut('Ctrl+Q')\nexitAction.setStatusTip('Exit application')\nexitAc...
<|body_start_0|> super(UI, self).__init__(parent) self.statusBar().showMessage('Statusbar') menubar = self.menuBar() fileMenu = menubar.addMenu('&File') helpMenu = menubar.addMenu('&Help') exitAction = PyQt5.QtWidgets.QAction('&Exit', self) exitAction.setShortcut(...
UI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UI: def __init__(self, parent=None): """Our constructor. This function sets up the main UI elements and the connections""" <|body_0|> def buttonClickedConnect(self): """This is an example of a callback action on a connection for a button being clicked""" <|bo...
stack_v2_sparse_classes_36k_train_021784
1,719
permissive
[ { "docstring": "Our constructor. This function sets up the main UI elements and the connections", "name": "__init__", "signature": "def __init__(self, parent=None)" }, { "docstring": "This is an example of a callback action on a connection for a button being clicked", "name": "buttonClickedC...
2
stack_v2_sparse_classes_30k_train_004375
Implement the Python class `UI` described below. Class description: Implement the UI class. Method signatures and docstrings: - def __init__(self, parent=None): Our constructor. This function sets up the main UI elements and the connections - def buttonClickedConnect(self): This is an example of a callback action on ...
Implement the Python class `UI` described below. Class description: Implement the UI class. Method signatures and docstrings: - def __init__(self, parent=None): Our constructor. This function sets up the main UI elements and the connections - def buttonClickedConnect(self): This is an example of a callback action on ...
a3159226982ec9656bb0f81f6997687da22f4466
<|skeleton|> class UI: def __init__(self, parent=None): """Our constructor. This function sets up the main UI elements and the connections""" <|body_0|> def buttonClickedConnect(self): """This is an example of a callback action on a connection for a button being clicked""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UI: def __init__(self, parent=None): """Our constructor. This function sets up the main UI elements and the connections""" super(UI, self).__init__(parent) self.statusBar().showMessage('Statusbar') menubar = self.menuBar() fileMenu = menubar.addMenu('&File') hel...
the_stack_v2_python_sparse
PyQT5/template/UI.py
ptracton/ExperimentalPython
train
0
1dc9a3e41471eb4cd6f15b81860fa6dfd0aeeea3
[ "resource_args.AddAttachedClusterResourceArg(parser, 'to generate install manifest')\nattached_flags.AddPlatformVersion(parser)\nflags.AddOutputFile(parser, 'to store manifest')", "location = resource_args.ParseAttachedClusterResourceArg(args).locationsId\nwith endpoint_util.GkemulticloudEndpointOverride(location...
<|body_start_0|> resource_args.AddAttachedClusterResourceArg(parser, 'to generate install manifest') attached_flags.AddPlatformVersion(parser) flags.AddOutputFile(parser, 'to store manifest') <|end_body_0|> <|body_start_1|> location = resource_args.ParseAttachedClusterResourceArg(args)....
Generate Install Manifest for an Attached cluster.
Describe
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Describe: """Generate Install Manifest for an Attached cluster.""" def Args(parser): """Registers flags for this command.""" <|body_0|> def Run(self, args): """Runs the generate-install-manifest command.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_021785
2,763
permissive
[ { "docstring": "Registers flags for this command.", "name": "Args", "signature": "def Args(parser)" }, { "docstring": "Runs the generate-install-manifest command.", "name": "Run", "signature": "def Run(self, args)" } ]
2
null
Implement the Python class `Describe` described below. Class description: Generate Install Manifest for an Attached cluster. Method signatures and docstrings: - def Args(parser): Registers flags for this command. - def Run(self, args): Runs the generate-install-manifest command.
Implement the Python class `Describe` described below. Class description: Generate Install Manifest for an Attached cluster. Method signatures and docstrings: - def Args(parser): Registers flags for this command. - def Run(self, args): Runs the generate-install-manifest command. <|skeleton|> class Describe: """G...
392abf004b16203030e6efd2f0af24db7c8d669e
<|skeleton|> class Describe: """Generate Install Manifest for an Attached cluster.""" def Args(parser): """Registers flags for this command.""" <|body_0|> def Run(self, args): """Runs the generate-install-manifest command.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Describe: """Generate Install Manifest for an Attached cluster.""" def Args(parser): """Registers flags for this command.""" resource_args.AddAttachedClusterResourceArg(parser, 'to generate install manifest') attached_flags.AddPlatformVersion(parser) flags.AddOutputFile(pa...
the_stack_v2_python_sparse
lib/surface/container/attached/clusters/generate_install_manifest.py
google-cloud-sdk-unofficial/google-cloud-sdk
train
9
93c118d07aca89ade452a6f1dae898e4b8a4de75
[ "if name is None:\n name = self.__class__.__name__\nsuper(sppasBaseSclite, self).__init__(name)\nself.software = 'SCTK'\nself._accept_multi_tiers = True\nself._accept_no_tiers = True\nself._accept_metadata = False\nself._accept_ctrl_vocab = False\nself._accept_media = True\nself._accept_hierarchy = False\nself._...
<|body_start_0|> if name is None: name = self.__class__.__name__ super(sppasBaseSclite, self).__init__(name) self.software = 'SCTK' self._accept_multi_tiers = True self._accept_no_tiers = True self._accept_metadata = False self._accept_ctrl_vocab = Fal...
SPPAS base Sclite reader and writer. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi * * * * * Current version does not fully support alternations. * * * * *
sppasBaseSclite
[ "MIT", "GFDL-1.1-or-later", "GPL-3.0-only", "GPL-3.0-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class sppasBaseSclite: """SPPAS base Sclite reader and writer. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi * * * * * Current version does not fully support al...
stack_v2_sparse_classes_36k_train_021786
28,430
permissive
[ { "docstring": "Initialize a new sppasBaseSclite instance. :param name: (str) This transcription name.", "name": "__init__", "signature": "def __init__(self, name=None)" }, { "docstring": "The localization is a time value, so always a float.", "name": "make_point", "signature": "def make...
2
null
Implement the Python class `sppasBaseSclite` described below. Class description: SPPAS base Sclite reader and writer. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi * * * * * Cu...
Implement the Python class `sppasBaseSclite` described below. Class description: SPPAS base Sclite reader and writer. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi * * * * * Cu...
3167b65f576abcc27a8767d24c274a04712bd948
<|skeleton|> class sppasBaseSclite: """SPPAS base Sclite reader and writer. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi * * * * * Current version does not fully support al...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class sppasBaseSclite: """SPPAS base Sclite reader and writer. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi * * * * * Current version does not fully support alternations. *...
the_stack_v2_python_sparse
sppas/sppas/src/anndata/aio/sclite.py
mirfan899/MTTS
train
0
7584510b406b01a1d94b454c29bc7b276501072a
[ "w = ['i', 'love', 'you', 'i', 'i', 'you']\nresult = topKFrequent(w, 2)\nself.assertEqual(result, ['i', 'you'])", "w = ['if', 'you', 'read', 'this', 'dm', 'me', 'if', 'you', 'want', 'this', 'if', 'this']\nresult = topKFrequent(w, 5)\nself.assertEqual(result, ['if', 'this', 'you', 'dm', 'me'])" ]
<|body_start_0|> w = ['i', 'love', 'you', 'i', 'i', 'you'] result = topKFrequent(w, 2) self.assertEqual(result, ['i', 'you']) <|end_body_0|> <|body_start_1|> w = ['if', 'you', 'read', 'this', 'dm', 'me', 'if', 'you', 'want', 'this', 'if', 'this'] result = topKFrequent(w, 5) ...
TestTopKFrequent
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestTopKFrequent: def test_returns_correct_words_in_order_short_list(self): """Takes in a short list of words and returns the correct response in order""" <|body_0|> def test_returns_correct_words_for_long_list(self): """Takes in a long list of words and returns the ...
stack_v2_sparse_classes_36k_train_021787
779
permissive
[ { "docstring": "Takes in a short list of words and returns the correct response in order", "name": "test_returns_correct_words_in_order_short_list", "signature": "def test_returns_correct_words_in_order_short_list(self)" }, { "docstring": "Takes in a long list of words and returns the correct re...
2
null
Implement the Python class `TestTopKFrequent` described below. Class description: Implement the TestTopKFrequent class. Method signatures and docstrings: - def test_returns_correct_words_in_order_short_list(self): Takes in a short list of words and returns the correct response in order - def test_returns_correct_word...
Implement the Python class `TestTopKFrequent` described below. Class description: Implement the TestTopKFrequent class. Method signatures and docstrings: - def test_returns_correct_words_in_order_short_list(self): Takes in a short list of words and returns the correct response in order - def test_returns_correct_word...
27ffb6b32d6d18d279c51cfa45bf305a409be5c2
<|skeleton|> class TestTopKFrequent: def test_returns_correct_words_in_order_short_list(self): """Takes in a short list of words and returns the correct response in order""" <|body_0|> def test_returns_correct_words_for_long_list(self): """Takes in a long list of words and returns the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestTopKFrequent: def test_returns_correct_words_in_order_short_list(self): """Takes in a short list of words and returns the correct response in order""" w = ['i', 'love', 'you', 'i', 'i', 'you'] result = topKFrequent(w, 2) self.assertEqual(result, ['i', 'you']) def test_...
the_stack_v2_python_sparse
src/leetcode/medium/top-k-frequent-words/test_top_k_frequent_words.py
nwthomas/code-challenges
train
2
8730d3e1b6dfef1fcbd2adfda165902a4367bae6
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')" ]
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Missing associated documentation comment in .proto file.
LegoCaptureServicer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LegoCaptureServicer: """Missing associated documentation comment in .proto file.""" def CollectImages(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def CollectCroppedImages(self, request, context): """Missing a...
stack_v2_sparse_classes_36k_train_021788
4,069
no_license
[ { "docstring": "Missing associated documentation comment in .proto file.", "name": "CollectImages", "signature": "def CollectImages(self, request, context)" }, { "docstring": "Missing associated documentation comment in .proto file.", "name": "CollectCroppedImages", "signature": "def Col...
2
stack_v2_sparse_classes_30k_train_003139
Implement the Python class `LegoCaptureServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def CollectImages(self, request, context): Missing associated documentation comment in .proto file. - def CollectCroppedImages(self, request...
Implement the Python class `LegoCaptureServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def CollectImages(self, request, context): Missing associated documentation comment in .proto file. - def CollectCroppedImages(self, request...
2fca34564d865bbf28c4cddc7665d0276f7e0cf2
<|skeleton|> class LegoCaptureServicer: """Missing associated documentation comment in .proto file.""" def CollectImages(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def CollectCroppedImages(self, request, context): """Missing a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LegoCaptureServicer: """Missing associated documentation comment in .proto file.""" def CollectImages(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented...
the_stack_v2_python_sparse
lego_sorter_server/generated/LegoCapture_pb2_grpc.py
etusien/LegoSorterServer
train
0
5ebe65b817f45591f73dd180c6b937bc9ff7a824
[ "m = len(X) + 1\nn = len(Y) + 1\nb = [[0] * n for _ in range(m)]\nc = [[0] * n for _ in range(m)]\nfor i in range(1, m):\n for j in range(1, n):\n if X[i - 1] == Y[j - 1]:\n c[i][j] = c[i - 1][j - 1] + 1\n b[i][j] = 'upper left'\n elif c[i - 1][j] >= c[i][j - 1]:\n ...
<|body_start_0|> m = len(X) + 1 n = len(Y) + 1 b = [[0] * n for _ in range(m)] c = [[0] * n for _ in range(m)] for i in range(1, m): for j in range(1, n): if X[i - 1] == Y[j - 1]: c[i][j] = c[i - 1][j - 1] + 1 b[...
Solution1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution1: def lcs_length(self, X, Y): """自底向上的动态规划""" <|body_0|> def lcs_length_boost(self, X, Y): """改进算法:只使用内存大小为2 * min(m, n)""" <|body_1|> def lcs_length_boost2(self, X, Y): """改进算法:只使用内存大小为min(m, n)""" <|body_2|> def print_lcs(...
stack_v2_sparse_classes_36k_train_021789
4,796
no_license
[ { "docstring": "自底向上的动态规划", "name": "lcs_length", "signature": "def lcs_length(self, X, Y)" }, { "docstring": "改进算法:只使用内存大小为2 * min(m, n)", "name": "lcs_length_boost", "signature": "def lcs_length_boost(self, X, Y)" }, { "docstring": "改进算法:只使用内存大小为min(m, n)", "name": "lcs_len...
5
stack_v2_sparse_classes_30k_train_007954
Implement the Python class `Solution1` described below. Class description: Implement the Solution1 class. Method signatures and docstrings: - def lcs_length(self, X, Y): 自底向上的动态规划 - def lcs_length_boost(self, X, Y): 改进算法:只使用内存大小为2 * min(m, n) - def lcs_length_boost2(self, X, Y): 改进算法:只使用内存大小为min(m, n) - def print_lcs...
Implement the Python class `Solution1` described below. Class description: Implement the Solution1 class. Method signatures and docstrings: - def lcs_length(self, X, Y): 自底向上的动态规划 - def lcs_length_boost(self, X, Y): 改进算法:只使用内存大小为2 * min(m, n) - def lcs_length_boost2(self, X, Y): 改进算法:只使用内存大小为min(m, n) - def print_lcs...
9fdc4b1a2b59b7aed22ddfe92aade487b4c19b71
<|skeleton|> class Solution1: def lcs_length(self, X, Y): """自底向上的动态规划""" <|body_0|> def lcs_length_boost(self, X, Y): """改进算法:只使用内存大小为2 * min(m, n)""" <|body_1|> def lcs_length_boost2(self, X, Y): """改进算法:只使用内存大小为min(m, n)""" <|body_2|> def print_lcs(...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution1: def lcs_length(self, X, Y): """自底向上的动态规划""" m = len(X) + 1 n = len(Y) + 1 b = [[0] * n for _ in range(m)] c = [[0] * n for _ in range(m)] for i in range(1, m): for j in range(1, n): if X[i - 1] == Y[j - 1]: ...
the_stack_v2_python_sparse
introduction_to_algorithms/15.4_LCS.py
MemoryForSky/Data-Structures-and-Algorithms
train
0
901129522cc3a85bd4e23a8cd08ff7e9184bc8f0
[ "self._dist = dist\nself._p = dist.pmf\nself._domain = np.stack(domain)\nself._domain_inv = np.linalg.pinv(self._domain)", "q = np.dot(x, self._domain)\nq /= q.sum()\nreturn q", "q = self._q(x)\ndkl = relative_entropy(self._p, q)\nreturn dkl", "x0 = np.dot(self._p, self._domain_inv)\nbounds = [(0, 1)] * x0.si...
<|body_start_0|> self._dist = dist self._p = dist.pmf self._domain = np.stack(domain) self._domain_inv = np.linalg.pinv(self._domain) <|end_body_0|> <|body_start_1|> q = np.dot(x, self._domain) q /= q.sum() return q <|end_body_1|> <|body_start_2|> q = se...
An optimizer to find the minimum D_KL(p||q) given p and a restriction on the domain of q.
MinDKLOptimizer
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MinDKLOptimizer: """An optimizer to find the minimum D_KL(p||q) given p and a restriction on the domain of q.""" def __init__(self, dist, domain): """Initialize the optimizer. Parameters ---------- dist : Distribution The distribution `p`. domain : list of lists The pmfs defining the...
stack_v2_sparse_classes_36k_train_021790
5,557
permissive
[ { "docstring": "Initialize the optimizer. Parameters ---------- dist : Distribution The distribution `p`. domain : list of lists The pmfs defining the domain over which `q` is optimized.", "name": "__init__", "signature": "def __init__(self, dist, domain)" }, { "docstring": "Transform `x` into a...
5
null
Implement the Python class `MinDKLOptimizer` described below. Class description: An optimizer to find the minimum D_KL(p||q) given p and a restriction on the domain of q. Method signatures and docstrings: - def __init__(self, dist, domain): Initialize the optimizer. Parameters ---------- dist : Distribution The distr...
Implement the Python class `MinDKLOptimizer` described below. Class description: An optimizer to find the minimum D_KL(p||q) given p and a restriction on the domain of q. Method signatures and docstrings: - def __init__(self, dist, domain): Initialize the optimizer. Parameters ---------- dist : Distribution The distr...
b13c5020a2b8524527a4a0db5a81d8549142228c
<|skeleton|> class MinDKLOptimizer: """An optimizer to find the minimum D_KL(p||q) given p and a restriction on the domain of q.""" def __init__(self, dist, domain): """Initialize the optimizer. Parameters ---------- dist : Distribution The distribution `p`. domain : list of lists The pmfs defining the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MinDKLOptimizer: """An optimizer to find the minimum D_KL(p||q) given p and a restriction on the domain of q.""" def __init__(self, dist, domain): """Initialize the optimizer. Parameters ---------- dist : Distribution The distribution `p`. domain : list of lists The pmfs defining the domain over ...
the_stack_v2_python_sparse
dit/pid/measures/iproj.py
dit/dit
train
468
a72cf1bd69b4cc5115247c01cb45db7465c52a90
[ "my_stack = []\nfor c in S:\n if not my_stack or c != my_stack[-1]:\n my_stack.append(c)\n elif c == my_stack[-1]:\n my_stack.pop()\nreturn ''.join(my_stack)", "my_dict = set((2 * c for c in ascii_lowercase))\nn = float('inf')\nwhile n != len(S):\n n = len(S)\n for cc in my_dict:\n ...
<|body_start_0|> my_stack = [] for c in S: if not my_stack or c != my_stack[-1]: my_stack.append(c) elif c == my_stack[-1]: my_stack.pop() return ''.join(my_stack) <|end_body_0|> <|body_start_1|> my_dict = set((2 * c for c in ascii...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def removeDuplicates0(self, S: str) -> str: """Purpose: Removes all duplicate characters in a string until there are none. Example: 'abbaccd' -> 'aaccd' -> 'ccd' -> 'd'. Time Complexity: O(n) Space Complexity: O(n - d), n is length of S, d is length of all duplicates, hence d <...
stack_v2_sparse_classes_36k_train_021791
1,003
no_license
[ { "docstring": "Purpose: Removes all duplicate characters in a string until there are none. Example: 'abbaccd' -> 'aaccd' -> 'ccd' -> 'd'. Time Complexity: O(n) Space Complexity: O(n - d), n is length of S, d is length of all duplicates, hence d < n for all d. Very beautiful example of when stacks are helpful!"...
2
stack_v2_sparse_classes_30k_train_012330
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeDuplicates0(self, S: str) -> str: Purpose: Removes all duplicate characters in a string until there are none. Example: 'abbaccd' -> 'aaccd' -> 'ccd' -> 'd'. Time Comple...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeDuplicates0(self, S: str) -> str: Purpose: Removes all duplicate characters in a string until there are none. Example: 'abbaccd' -> 'aaccd' -> 'ccd' -> 'd'. Time Comple...
95a86cbbca28d0c0f6d72d28a2f1cb5a86327934
<|skeleton|> class Solution: def removeDuplicates0(self, S: str) -> str: """Purpose: Removes all duplicate characters in a string until there are none. Example: 'abbaccd' -> 'aaccd' -> 'ccd' -> 'd'. Time Complexity: O(n) Space Complexity: O(n - d), n is length of S, d is length of all duplicates, hence d <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def removeDuplicates0(self, S: str) -> str: """Purpose: Removes all duplicate characters in a string until there are none. Example: 'abbaccd' -> 'aaccd' -> 'ccd' -> 'd'. Time Complexity: O(n) Space Complexity: O(n - d), n is length of S, d is length of all duplicates, hence d < n for all d. ...
the_stack_v2_python_sparse
remove_dupes.py
tashakim/puzzles_python
train
8
269ba99a390e75b418d98b96a29b1ca822c2b974
[ "file_pickle = open(pickle_path, 'wb')\nlocker.lock(file_pickle, locker.LOCK_EX)\npickle.dump(value, file_pickle)\nfile_pickle.close()", "if os.path.exists(pickle_path):\n file_pickle = open(pickle_path, 'rb')\n locker.lock(file_pickle, locker.LOCK_EX)\n return_value = pickle.load(file_pickle)\n file_...
<|body_start_0|> file_pickle = open(pickle_path, 'wb') locker.lock(file_pickle, locker.LOCK_EX) pickle.dump(value, file_pickle) file_pickle.close() <|end_body_0|> <|body_start_1|> if os.path.exists(pickle_path): file_pickle = open(pickle_path, 'rb') locke...
PickleUtils
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PickleUtils: def save_pickle(pickle_path, value): """Save value to pickle file >>> PickleUtils().save_pickle(r'test/doctest_sample.pkl', "Sample Pickle")""" <|body_0|> def read_pickle(pickle_path, default=None): """Read a pickle file Test along with save_pickle >>> P...
stack_v2_sparse_classes_36k_train_021792
25,930
no_license
[ { "docstring": "Save value to pickle file >>> PickleUtils().save_pickle(r'test/doctest_sample.pkl', \"Sample Pickle\")", "name": "save_pickle", "signature": "def save_pickle(pickle_path, value)" }, { "docstring": "Read a pickle file Test along with save_pickle >>> PickleUtils().read_pickle(r'tes...
2
stack_v2_sparse_classes_30k_train_015476
Implement the Python class `PickleUtils` described below. Class description: Implement the PickleUtils class. Method signatures and docstrings: - def save_pickle(pickle_path, value): Save value to pickle file >>> PickleUtils().save_pickle(r'test/doctest_sample.pkl', "Sample Pickle") - def read_pickle(pickle_path, def...
Implement the Python class `PickleUtils` described below. Class description: Implement the PickleUtils class. Method signatures and docstrings: - def save_pickle(pickle_path, value): Save value to pickle file >>> PickleUtils().save_pickle(r'test/doctest_sample.pkl', "Sample Pickle") - def read_pickle(pickle_path, def...
0f97af4e110b0e8de8d1b9f18fcd3f69c69b54cc
<|skeleton|> class PickleUtils: def save_pickle(pickle_path, value): """Save value to pickle file >>> PickleUtils().save_pickle(r'test/doctest_sample.pkl', "Sample Pickle")""" <|body_0|> def read_pickle(pickle_path, default=None): """Read a pickle file Test along with save_pickle >>> P...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PickleUtils: def save_pickle(pickle_path, value): """Save value to pickle file >>> PickleUtils().save_pickle(r'test/doctest_sample.pkl', "Sample Pickle")""" file_pickle = open(pickle_path, 'wb') locker.lock(file_pickle, locker.LOCK_EX) pickle.dump(value, file_pickle) fi...
the_stack_v2_python_sparse
src/utils.py
duongle98/Face-Rec
train
1
163a1de5bb7e874af870924f3dfd5f87e533ae85
[ "self.name = ''\nself.title = ''\nself.cols = []\nself.rows = []", "cols = {col[0]: col[1] for col in self.cols}\nrows = [{self.cols[j][0]: r for j, r in enumerate(row)} for row in self.rows]\nreturn {'title': self.title, 'cols': cols, 'rows': rows}", "rows = [[col[1] for col in self.cols]]\nfor i, row in enume...
<|body_start_0|> self.name = '' self.title = '' self.cols = [] self.rows = [] <|end_body_0|> <|body_start_1|> cols = {col[0]: col[1] for col in self.cols} rows = [{self.cols[j][0]: r for j, r in enumerate(row)} for row in self.rows] return {'title': self.title, '...
A class to represent a table
Table
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Table: """A class to represent a table""" def __init__(self): """Initialize the table""" <|body_0|> def as_dict(self): """Return as a dictionary :return: The dictionary""" <|body_1|> def as_str(self, prefix=''): """Return the table as a strin...
stack_v2_sparse_classes_36k_train_021793
4,736
permissive
[ { "docstring": "Initialize the table", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Return as a dictionary :return: The dictionary", "name": "as_dict", "signature": "def as_dict(self)" }, { "docstring": "Return the table as a string :return: The string...
3
null
Implement the Python class `Table` described below. Class description: A class to represent a table Method signatures and docstrings: - def __init__(self): Initialize the table - def as_dict(self): Return as a dictionary :return: The dictionary - def as_str(self, prefix=''): Return the table as a string :return: The ...
Implement the Python class `Table` described below. Class description: A class to represent a table Method signatures and docstrings: - def __init__(self): Initialize the table - def as_dict(self): Return as a dictionary :return: The dictionary - def as_str(self, prefix=''): Return the table as a string :return: The ...
88bf7f7c5ac44defc046ebf0719cde748092cfff
<|skeleton|> class Table: """A class to represent a table""" def __init__(self): """Initialize the table""" <|body_0|> def as_dict(self): """Return as a dictionary :return: The dictionary""" <|body_1|> def as_str(self, prefix=''): """Return the table as a strin...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Table: """A class to represent a table""" def __init__(self): """Initialize the table""" self.name = '' self.title = '' self.cols = [] self.rows = [] def as_dict(self): """Return as a dictionary :return: The dictionary""" cols = {col[0]: col[1]...
the_stack_v2_python_sparse
src/dials/util/report.py
dials/dials
train
71
2c963adcdfddf12a0837eda7e7676b6221e3cfd5
[ "super().__init__()\nself.authorName: str = None\nself.authorBio: str = None\nself.fieldTitle1: str = None\nself.fieldTitle2: str = None\nself.fieldTitle3: str = None\nself.fieldTitle4: str = None\nself.wordTarget: int = None\nself.wordCountStart: int = None\nself.wordTarget: int = None\nself.chapters: dict[str, Ch...
<|body_start_0|> super().__init__() self.authorName: str = None self.authorBio: str = None self.fieldTitle1: str = None self.fieldTitle2: str = None self.fieldTitle3: str = None self.fieldTitle4: str = None self.wordTarget: int = None self.wordCoun...
Novel representation. This class represents a novel with additional attributes and structural information (a full set or a subset of the information included in an yWriter project file). Public methods: get_languages() -- Determine the languages used in the document. check_locale() -- Check the document's locale (langu...
Novel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Novel: """Novel representation. This class represents a novel with additional attributes and structural information (a full set or a subset of the information included in an yWriter project file). Public methods: get_languages() -- Determine the languages used in the document. check_locale() -- C...
stack_v2_sparse_classes_36k_train_021794
7,820
permissive
[ { "docstring": "Initialize instance variables. Extends the superclass constructor.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Determine the languages used in the document. Populate the self.languages list with all language codes found in the scene contents. Exampl...
3
null
Implement the Python class `Novel` described below. Class description: Novel representation. This class represents a novel with additional attributes and structural information (a full set or a subset of the information included in an yWriter project file). Public methods: get_languages() -- Determine the languages us...
Implement the Python class `Novel` described below. Class description: Novel representation. This class represents a novel with additional attributes and structural information (a full set or a subset of the information included in an yWriter project file). Public methods: get_languages() -- Determine the languages us...
33a868daed653c3371f5991d243a034668a80884
<|skeleton|> class Novel: """Novel representation. This class represents a novel with additional attributes and structural information (a full set or a subset of the information included in an yWriter project file). Public methods: get_languages() -- Determine the languages used in the document. check_locale() -- C...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Novel: """Novel representation. This class represents a novel with additional attributes and structural information (a full set or a subset of the information included in an yWriter project file). Public methods: get_languages() -- Determine the languages used in the document. check_locale() -- Check the docu...
the_stack_v2_python_sparse
src/pywriter/model/novel.py
peter88213/PyWriter
train
3
b47ca7caa3847499cb1f3993517032eba9ba9071
[ "super(Recorder, self).__init__()\nself.symbols = symbols\nself.timer_frequency = SNAPSHOT_RATE\nself.workers = dict()\nself.current_time = dt.now()\nself.daemon = False", "coinbase, bitfinex = self.symbols\nself.workers[coinbase], self.workers[bitfinex] = (CoinbaseClient(coinbase), BitfinexClient(bitfinex))\n(se...
<|body_start_0|> super(Recorder, self).__init__() self.symbols = symbols self.timer_frequency = SNAPSHOT_RATE self.workers = dict() self.current_time = dt.now() self.daemon = False <|end_body_0|> <|body_start_1|> coinbase, bitfinex = self.symbols self.wor...
Recorder
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Recorder: def __init__(self, symbols): """Constructor of Recorder. :param symbols: basket of securities to record... Example: symbols = [('BTC-USD, 'tBTCUSD')]""" <|body_0|> def run(self): """New process created to instantiate limit order books for (1) Coinbase Pro, ...
stack_v2_sparse_classes_36k_train_021795
3,420
permissive
[ { "docstring": "Constructor of Recorder. :param symbols: basket of securities to record... Example: symbols = [('BTC-USD, 'tBTCUSD')]", "name": "__init__", "signature": "def __init__(self, symbols)" }, { "docstring": "New process created to instantiate limit order books for (1) Coinbase Pro, and...
3
stack_v2_sparse_classes_30k_train_018016
Implement the Python class `Recorder` described below. Class description: Implement the Recorder class. Method signatures and docstrings: - def __init__(self, symbols): Constructor of Recorder. :param symbols: basket of securities to record... Example: symbols = [('BTC-USD, 'tBTCUSD')] - def run(self): New process cr...
Implement the Python class `Recorder` described below. Class description: Implement the Recorder class. Method signatures and docstrings: - def __init__(self, symbols): Constructor of Recorder. :param symbols: basket of securities to record... Example: symbols = [('BTC-USD, 'tBTCUSD')] - def run(self): New process cr...
945f0a83d6b94282c547bb6f4805f3381ad9c16a
<|skeleton|> class Recorder: def __init__(self, symbols): """Constructor of Recorder. :param symbols: basket of securities to record... Example: symbols = [('BTC-USD, 'tBTCUSD')]""" <|body_0|> def run(self): """New process created to instantiate limit order books for (1) Coinbase Pro, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Recorder: def __init__(self, symbols): """Constructor of Recorder. :param symbols: basket of securities to record... Example: symbols = [('BTC-USD, 'tBTCUSD')]""" super(Recorder, self).__init__() self.symbols = symbols self.timer_frequency = SNAPSHOT_RATE self.workers =...
the_stack_v2_python_sparse
crypto-rl/recorder.py
webclinic017/ml_monorepo
train
0
e11cc663cecfeb1406046dc1ecc53f4b2a29fb8b
[ "self.broker = broker\nself.port = port\nself.client = Client(client_id='FakeThermometer')", "self.client.connect(host=self.broker, port=self.port)\nprint(f'[{time.ctime()}] CONNECTED to broker: {self.broker} on port: {self.port}')\nself._temperature_thread = Timer(1, self.send_temperature)\nself._temperature_thr...
<|body_start_0|> self.broker = broker self.port = port self.client = Client(client_id='FakeThermometer') <|end_body_0|> <|body_start_1|> self.client.connect(host=self.broker, port=self.port) print(f'[{time.ctime()}] CONNECTED to broker: {self.broker} on port: {self.port}') ...
Simulate a MQTT thermometer
Thermometer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Thermometer: """Simulate a MQTT thermometer""" def __init__(self, broker: str, port: int): """Instantiate the device :param broker: MQTT broker :param port: Port of the broker""" <|body_0|> def start(self): """Start the fake thermometer""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_021796
5,341
permissive
[ { "docstring": "Instantiate the device :param broker: MQTT broker :param port: Port of the broker", "name": "__init__", "signature": "def __init__(self, broker: str, port: int)" }, { "docstring": "Start the fake thermometer", "name": "start", "signature": "def start(self)" }, { "...
5
stack_v2_sparse_classes_30k_val_000362
Implement the Python class `Thermometer` described below. Class description: Simulate a MQTT thermometer Method signatures and docstrings: - def __init__(self, broker: str, port: int): Instantiate the device :param broker: MQTT broker :param port: Port of the broker - def start(self): Start the fake thermometer - def...
Implement the Python class `Thermometer` described below. Class description: Simulate a MQTT thermometer Method signatures and docstrings: - def __init__(self, broker: str, port: int): Instantiate the device :param broker: MQTT broker :param port: Port of the broker - def start(self): Start the fake thermometer - def...
d1119ba1775ea5a41c9cf4b222075bd11ec666b8
<|skeleton|> class Thermometer: """Simulate a MQTT thermometer""" def __init__(self, broker: str, port: int): """Instantiate the device :param broker: MQTT broker :param port: Port of the broker""" <|body_0|> def start(self): """Start the fake thermometer""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Thermometer: """Simulate a MQTT thermometer""" def __init__(self, broker: str, port: int): """Instantiate the device :param broker: MQTT broker :param port: Port of the broker""" self.broker = broker self.port = port self.client = Client(client_id='FakeThermometer') d...
the_stack_v2_python_sparse
SW_lab/sw_lab_part3/exercise2/fake_device_main.py
claudiotancredi/Tecnologie-per-IoT
train
1
44460dd64af5de55a8c65cde7035a0b96d3b8d63
[ "next_index = next_object_key(self)\nmoment = Moment(type, node, member, position, x_mag, y_mag, z_mag, load_group)\nsetattr(self, str(next_index), moment)\nreturn next_index", "found_id = None\nelements = []\nfor k, v in vars(self).items():\n if v.type == type:\n elements.append(k)\nkey = 'node'\nif ty...
<|body_start_0|> next_index = next_object_key(self) moment = Moment(type, node, member, position, x_mag, y_mag, z_mag, load_group) setattr(self, str(next_index), moment) return next_index <|end_body_0|> <|body_start_1|> found_id = None elements = [] for k, v in v...
Creates an instance of the SkyCiv Moments class.
Moments
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Moments: """Creates an instance of the SkyCiv Moments class.""" def add(self, type: Literal['n', 'm'], node: int=None, member: int=None, position: float=None, x_mag: float=0, y_mag: float=0, z_mag: float=0, load_group: str=None) -> int: """Create a moment with the next available ID. ...
stack_v2_sparse_classes_36k_train_021797
3,645
permissive
[ { "docstring": "Create a moment with the next available ID. Args: type (str): The type of object to which the load is applied. node, member. {\"n\" | \"m\"}. node (int, optional): The node ID which the moment is located. If type is \"m\", provide value None. Defaults to None. member (int, optional): The member ...
3
stack_v2_sparse_classes_30k_train_003273
Implement the Python class `Moments` described below. Class description: Creates an instance of the SkyCiv Moments class. Method signatures and docstrings: - def add(self, type: Literal['n', 'm'], node: int=None, member: int=None, position: float=None, x_mag: float=0, y_mag: float=0, z_mag: float=0, load_group: str=N...
Implement the Python class `Moments` described below. Class description: Creates an instance of the SkyCiv Moments class. Method signatures and docstrings: - def add(self, type: Literal['n', 'm'], node: int=None, member: int=None, position: float=None, x_mag: float=0, y_mag: float=0, z_mag: float=0, load_group: str=N...
1cf3dad7f8d451760df02886df41684add72a4eb
<|skeleton|> class Moments: """Creates an instance of the SkyCiv Moments class.""" def add(self, type: Literal['n', 'm'], node: int=None, member: int=None, position: float=None, x_mag: float=0, y_mag: float=0, z_mag: float=0, load_group: str=None) -> int: """Create a moment with the next available ID. ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Moments: """Creates an instance of the SkyCiv Moments class.""" def add(self, type: Literal['n', 'm'], node: int=None, member: int=None, position: float=None, x_mag: float=0, y_mag: float=0, z_mag: float=0, load_group: str=None) -> int: """Create a moment with the next available ID. Args: type (s...
the_stack_v2_python_sparse
src/skyciv/classes/model/components/moments/moments.py
osasanchezme/skyciv-pip
train
0
81fe0c2d78c15d720ee804244b5f002e2edfb10b
[ "super().__init__(4, 3)\nwith open(join(dirname(__file__), 'iris.csv'), 'r') as dataset_file:\n self.dataset = [[float(x) for x in line.rstrip().split(',')] for line in dataset_file.readlines()]", "fitness = 0\nfor datapoint in self.dataset:\n output = individual.evaluate(datapoint[:-1])\n result = outpu...
<|body_start_0|> super().__init__(4, 3) with open(join(dirname(__file__), 'iris.csv'), 'r') as dataset_file: self.dataset = [[float(x) for x in line.rstrip().split(',')] for line in dataset_file.readlines()] <|end_body_0|> <|body_start_1|> fitness = 0 for datapoint in self.d...
Iris Flower Classification Evaluator
IrisFlowerEvaluator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IrisFlowerEvaluator: """Iris Flower Classification Evaluator""" def __init__(self): """Initialize the evaluator""" <|body_0|> def evaluate(self, individual): """Evaluate the individual on the whole dataset""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_36k_train_021798
937
no_license
[ { "docstring": "Initialize the evaluator", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Evaluate the individual on the whole dataset", "name": "evaluate", "signature": "def evaluate(self, individual)" } ]
2
stack_v2_sparse_classes_30k_train_011295
Implement the Python class `IrisFlowerEvaluator` described below. Class description: Iris Flower Classification Evaluator Method signatures and docstrings: - def __init__(self): Initialize the evaluator - def evaluate(self, individual): Evaluate the individual on the whole dataset
Implement the Python class `IrisFlowerEvaluator` described below. Class description: Iris Flower Classification Evaluator Method signatures and docstrings: - def __init__(self): Initialize the evaluator - def evaluate(self, individual): Evaluate the individual on the whole dataset <|skeleton|> class IrisFlowerEvalua...
30d87754ed22aa5aab7103d912c414f5a6150a34
<|skeleton|> class IrisFlowerEvaluator: """Iris Flower Classification Evaluator""" def __init__(self): """Initialize the evaluator""" <|body_0|> def evaluate(self, individual): """Evaluate the individual on the whole dataset""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IrisFlowerEvaluator: """Iris Flower Classification Evaluator""" def __init__(self): """Initialize the evaluator""" super().__init__(4, 3) with open(join(dirname(__file__), 'iris.csv'), 'r') as dataset_file: self.dataset = [[float(x) for x in line.rstrip().split(',')] f...
the_stack_v2_python_sparse
evaluators/iris/iris_flower.py
Yabk/SF-Evolution
train
0
25c3030403c1a4adeaec41c47c9125f60f9e2c3d
[ "super().__init__(device)\nself.n_classes = n_classes\nself.base = base\nself.head = head\nself.pretrained = pretrained\nself.multi_gpus = multi_gpus\nself.build_model()", "if is_features_extracter:\n for param in self.model.parameters():\n param.requires_grad = False", "if self.base == 'resnet101':\n...
<|body_start_0|> super().__init__(device) self.n_classes = n_classes self.base = base self.head = head self.pretrained = pretrained self.multi_gpus = multi_gpus self.build_model() <|end_body_0|> <|body_start_1|> if is_features_extracter: for p...
TripletNet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TripletNet: def __init__(self, device, base, pretrained=True, n_classes=230, multi_gpus=False, head=None): """Initialize the model Args: device: the device (cpu/gpu) to place the tensors base: (str) name of base model n_classes: (int) number of classes""" <|body_0|> def set_...
stack_v2_sparse_classes_36k_train_021799
3,331
permissive
[ { "docstring": "Initialize the model Args: device: the device (cpu/gpu) to place the tensors base: (str) name of base model n_classes: (int) number of classes", "name": "__init__", "signature": "def __init__(self, device, base, pretrained=True, n_classes=230, multi_gpus=False, head=None)" }, { "...
4
stack_v2_sparse_classes_30k_train_005220
Implement the Python class `TripletNet` described below. Class description: Implement the TripletNet class. Method signatures and docstrings: - def __init__(self, device, base, pretrained=True, n_classes=230, multi_gpus=False, head=None): Initialize the model Args: device: the device (cpu/gpu) to place the tensors ba...
Implement the Python class `TripletNet` described below. Class description: Implement the TripletNet class. Method signatures and docstrings: - def __init__(self, device, base, pretrained=True, n_classes=230, multi_gpus=False, head=None): Initialize the model Args: device: the device (cpu/gpu) to place the tensors ba...
c4f12e96695bd51281033e503a34f1b66ea641ef
<|skeleton|> class TripletNet: def __init__(self, device, base, pretrained=True, n_classes=230, multi_gpus=False, head=None): """Initialize the model Args: device: the device (cpu/gpu) to place the tensors base: (str) name of base model n_classes: (int) number of classes""" <|body_0|> def set_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TripletNet: def __init__(self, device, base, pretrained=True, n_classes=230, multi_gpus=False, head=None): """Initialize the model Args: device: the device (cpu/gpu) to place the tensors base: (str) name of base model n_classes: (int) number of classes""" super().__init__(device) self....
the_stack_v2_python_sparse
track2-vehicle-reid/src/models/re_identification/triplet_net.py
lopezbec/AI_City_2020_iTaskT4
train
0