blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
467
8.64k
id
stringlengths
40
40
length_bytes
int64
515
49.7k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
160
3.93k
prompted_full_text
stringlengths
681
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.09k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
331
8.3k
source
stringclasses
1 value
source_path
stringlengths
5
177
source_repo
stringlengths
6
88
split
stringclasses
1 value
star_events_count
int64
0
209k
122b0681a25c45b66b89c7f99c1b562d6e44ffbd
[ "if not email:\n raise ValueError('Users must have an email address')\nuser = self.model(email=MyUserManager.normalize_email(email), date_of_birth=date_of_birth or timezone.now(), first_name=first_name or '', last_name=last_name or '')\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user", "if ...
<|body_start_0|> if not email: raise ValueError('Users must have an email address') user = self.model(email=MyUserManager.normalize_email(email), date_of_birth=date_of_birth or timezone.now(), first_name=first_name or '', last_name=last_name or '') user.set_password(password) ...
MyUserManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyUserManager: def create_user(self, email, first_name=None, last_name=None, date_of_birth=None, password=None): """Creates and saves a User with the given email, date of birth and password.""" <|body_0|> def create_superuser(self, email, date_of_birth, first_name, last_name...
stack_v2_sparse_classes_10k_train_003000
1,411
no_license
[ { "docstring": "Creates and saves a User with the given email, date of birth and password.", "name": "create_user", "signature": "def create_user(self, email, first_name=None, last_name=None, date_of_birth=None, password=None)" }, { "docstring": "Creates and saves a superuser with the given emai...
2
stack_v2_sparse_classes_30k_train_006783
Implement the Python class `MyUserManager` described below. Class description: Implement the MyUserManager class. Method signatures and docstrings: - def create_user(self, email, first_name=None, last_name=None, date_of_birth=None, password=None): Creates and saves a User with the given email, date of birth and passw...
Implement the Python class `MyUserManager` described below. Class description: Implement the MyUserManager class. Method signatures and docstrings: - def create_user(self, email, first_name=None, last_name=None, date_of_birth=None, password=None): Creates and saves a User with the given email, date of birth and passw...
42654f6c058de095ac6ff540bdd89854b7f864f9
<|skeleton|> class MyUserManager: def create_user(self, email, first_name=None, last_name=None, date_of_birth=None, password=None): """Creates and saves a User with the given email, date of birth and password.""" <|body_0|> def create_superuser(self, email, date_of_birth, first_name, last_name...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MyUserManager: def create_user(self, email, first_name=None, last_name=None, date_of_birth=None, password=None): """Creates and saves a User with the given email, date of birth and password.""" if not email: raise ValueError('Users must have an email address') user = self.m...
the_stack_v2_python_sparse
thesis/DavideCrestini/tesi-crestini/Piattaforma/services/managers.py
lbedogni/iot
train
0
50d5841ee894fff16f008ede12fe243370a5cb00
[ "if self.Briefcase:\n from cs.workflow.processes import Process\n if self.Briefcase.Process and self.Briefcase.Process.status in [Process.COMPLETED.status, Process.FAILED.status]:\n raise ue.Exception('cdbwf_process_already_closed')", "if self.Briefcase:\n if not self.Briefcase.CheckAccess('edit s...
<|body_start_0|> if self.Briefcase: from cs.workflow.processes import Process if self.Briefcase.Process and self.Briefcase.Process.status in [Process.COMPLETED.status, Process.FAILED.status]: raise ue.Exception('cdbwf_process_already_closed') <|end_body_0|> <|body_start_...
FolderContent
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FolderContent: def check_process_status(self, ctx): """Check that the briefcase process is not closed""" <|body_0|> def check_briefcase_rights(self, ctx): """Check that the current user has the necessary access rights""" <|body_1|> def check_briefcase_co...
stack_v2_sparse_classes_10k_train_003001
20,066
no_license
[ { "docstring": "Check that the briefcase process is not closed", "name": "check_process_status", "signature": "def check_process_status(self, ctx)" }, { "docstring": "Check that the current user has the necessary access rights", "name": "check_briefcase_rights", "signature": "def check_b...
5
null
Implement the Python class `FolderContent` described below. Class description: Implement the FolderContent class. Method signatures and docstrings: - def check_process_status(self, ctx): Check that the briefcase process is not closed - def check_briefcase_rights(self, ctx): Check that the current user has the necessa...
Implement the Python class `FolderContent` described below. Class description: Implement the FolderContent class. Method signatures and docstrings: - def check_process_status(self, ctx): Check that the briefcase process is not closed - def check_briefcase_rights(self, ctx): Check that the current user has the necessa...
6bc932c67bc8d93b873838ae6d9fb8d33c72234d
<|skeleton|> class FolderContent: def check_process_status(self, ctx): """Check that the briefcase process is not closed""" <|body_0|> def check_briefcase_rights(self, ctx): """Check that the current user has the necessary access rights""" <|body_1|> def check_briefcase_co...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FolderContent: def check_process_status(self, ctx): """Check that the briefcase process is not closed""" if self.Briefcase: from cs.workflow.processes import Process if self.Briefcase.Process and self.Briefcase.Process.status in [Process.COMPLETED.status, Process.FAILED...
the_stack_v2_python_sparse
site-packages/cs.workflow-15.4.1.3-py2.7.egg/cs/workflow/briefcases.py
prachipainuly-rbei/devops-poc
train
0
6364968a8d0c1cb2c18f1c467261b272386e1e38
[ "if request.version != 'v1':\n return Response(status=status.HTTP_505_HTTP_VERSION_NOT_SUPPORTED)\nserializer = SearchNotRequiredSerializer(data={'service': 'all', 'types': 'coming_soon'}, context={'request': request, 'kwargs': kwargs})\nserializer.is_valid(raise_exception=True)\nreturn Response(data=serializer....
<|body_start_0|> if request.version != 'v1': return Response(status=status.HTTP_505_HTTP_VERSION_NOT_SUPPORTED) serializer = SearchNotRequiredSerializer(data={'service': 'all', 'types': 'coming_soon'}, context={'request': request, 'kwargs': kwargs}) serializer.is_valid(raise_exceptio...
Releases view.
ReleasesView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReleasesView: """Releases view.""" def get(self, request, *args, **kwargs): """GET request""" <|body_0|> def post(self, request, *args, **kwargs): """POST request.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if request.version != 'v1': ...
stack_v2_sparse_classes_10k_train_003002
12,742
no_license
[ { "docstring": "GET request", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "POST request.", "name": "post", "signature": "def post(self, request, *args, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_003286
Implement the Python class `ReleasesView` described below. Class description: Releases view. Method signatures and docstrings: - def get(self, request, *args, **kwargs): GET request - def post(self, request, *args, **kwargs): POST request.
Implement the Python class `ReleasesView` described below. Class description: Releases view. Method signatures and docstrings: - def get(self, request, *args, **kwargs): GET request - def post(self, request, *args, **kwargs): POST request. <|skeleton|> class ReleasesView: """Releases view.""" def get(self, ...
cd8767b5eeaef3a09d77c936781b4126fd8591de
<|skeleton|> class ReleasesView: """Releases view.""" def get(self, request, *args, **kwargs): """GET request""" <|body_0|> def post(self, request, *args, **kwargs): """POST request.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ReleasesView: """Releases view.""" def get(self, request, *args, **kwargs): """GET request""" if request.version != 'v1': return Response(status=status.HTTP_505_HTTP_VERSION_NOT_SUPPORTED) serializer = SearchNotRequiredSerializer(data={'service': 'all', 'types': 'comin...
the_stack_v2_python_sparse
api/services/views.py
ignite7/backproject
train
0
860f137d1e13cc74c627e4ed4df8ede91e3abcec
[ "self.interface_name = interface_name\nself.ip_family = ip_family\nself.ips = ips\nself.node_ids = node_ids\nself.role = role\nself.subnet_gateway = subnet_gateway\nself.subnet_mask_bits = subnet_mask_bits", "if dictionary is None:\n return None\ninterface_name = dictionary.get('interfaceName')\nip_family = di...
<|body_start_0|> self.interface_name = interface_name self.ip_family = ip_family self.ips = ips self.node_ids = node_ids self.role = role self.subnet_gateway = subnet_gateway self.subnet_mask_bits = subnet_mask_bits <|end_body_0|> <|body_start_1|> if dict...
Implementation of the 'IpConfig' model. Specifies the configuration of an IP. Attributes: interface_name (string): The interface name. Specifies which interface to assign IP to. ip_family (int): IpFamily of this config. ips (list of string): The interface ips. node_ids (list of long|int): Node ids. role (string): The i...
IpConfig
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IpConfig: """Implementation of the 'IpConfig' model. Specifies the configuration of an IP. Attributes: interface_name (string): The interface name. Specifies which interface to assign IP to. ip_family (int): IpFamily of this config. ips (list of string): The interface ips. node_ids (list of long|...
stack_v2_sparse_classes_10k_train_003003
2,714
permissive
[ { "docstring": "Constructor for the IpConfig class", "name": "__init__", "signature": "def __init__(self, interface_name=None, ip_family=None, ips=None, node_ids=None, role=None, subnet_gateway=None, subnet_mask_bits=None)" }, { "docstring": "Creates an instance of this model from a dictionary A...
2
null
Implement the Python class `IpConfig` described below. Class description: Implementation of the 'IpConfig' model. Specifies the configuration of an IP. Attributes: interface_name (string): The interface name. Specifies which interface to assign IP to. ip_family (int): IpFamily of this config. ips (list of string): The...
Implement the Python class `IpConfig` described below. Class description: Implementation of the 'IpConfig' model. Specifies the configuration of an IP. Attributes: interface_name (string): The interface name. Specifies which interface to assign IP to. ip_family (int): IpFamily of this config. ips (list of string): The...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class IpConfig: """Implementation of the 'IpConfig' model. Specifies the configuration of an IP. Attributes: interface_name (string): The interface name. Specifies which interface to assign IP to. ip_family (int): IpFamily of this config. ips (list of string): The interface ips. node_ids (list of long|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class IpConfig: """Implementation of the 'IpConfig' model. Specifies the configuration of an IP. Attributes: interface_name (string): The interface name. Specifies which interface to assign IP to. ip_family (int): IpFamily of this config. ips (list of string): The interface ips. node_ids (list of long|int): Node id...
the_stack_v2_python_sparse
cohesity_management_sdk/models/ip_config.py
cohesity/management-sdk-python
train
24
ca22dfd51b35f33ad9fce95942d9d774abd8cbda
[ "res = []\nstack = []\ncur = root\nwhile cur or stack:\n while cur:\n stack.append(cur)\n cur = cur.left\n cur = stack.pop()\n if cur:\n res.append(cur.val)\n cur = cur.right\nreturn res[len(res) - k]", "res = []\nstack = []\ncur = root\nwhile cur or stack:\n if cur:\n ...
<|body_start_0|> res = [] stack = [] cur = root while cur or stack: while cur: stack.append(cur) cur = cur.left cur = stack.pop() if cur: res.append(cur.val) cur = cur.right return...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def kthLargest0(self, root, k): """:type root: TreeNode :type k: int :rtype: int""" <|body_0|> def kthLargest1(self, root, k): """:type root: TreeNode :type k: int :rtype: int""" <|body_1|> def kthLargest1(self, root, k): """:type root:...
stack_v2_sparse_classes_10k_train_003004
1,990
no_license
[ { "docstring": ":type root: TreeNode :type k: int :rtype: int", "name": "kthLargest0", "signature": "def kthLargest0(self, root, k)" }, { "docstring": ":type root: TreeNode :type k: int :rtype: int", "name": "kthLargest1", "signature": "def kthLargest1(self, root, k)" }, { "docst...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def kthLargest0(self, root, k): :type root: TreeNode :type k: int :rtype: int - def kthLargest1(self, root, k): :type root: TreeNode :type k: int :rtype: int - def kthLargest1(se...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def kthLargest0(self, root, k): :type root: TreeNode :type k: int :rtype: int - def kthLargest1(self, root, k): :type root: TreeNode :type k: int :rtype: int - def kthLargest1(se...
6e18c5d257840489cc3fb1079ae3804c743982a4
<|skeleton|> class Solution: def kthLargest0(self, root, k): """:type root: TreeNode :type k: int :rtype: int""" <|body_0|> def kthLargest1(self, root, k): """:type root: TreeNode :type k: int :rtype: int""" <|body_1|> def kthLargest1(self, root, k): """:type root:...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def kthLargest0(self, root, k): """:type root: TreeNode :type k: int :rtype: int""" res = [] stack = [] cur = root while cur or stack: while cur: stack.append(cur) cur = cur.left cur = stack.pop() ...
the_stack_v2_python_sparse
剑指 Offer 54. 二叉搜索树的第k大节点.py
yangyuxiang1996/leetcode
train
0
2f0cfa672d6a1069d0647c0dd3593ccaa8527330
[ "self.InitAttr(node, bool, IES_IMPORT_PRINT_TO_CONSOLE)\nnode[IES_IMPORT_PRINT_TO_CONSOLE] = True\nreturn True", "if 'txt' in name[-3:]:\n if bytes(probe[0:17]).decode().upper() == 'IES Meta Exporter'.upper():\n return True\nreturn False", "dialogAllowed = bool(filterflags & c4d.SCENEFILTER_DIALOGSALL...
<|body_start_0|> self.InitAttr(node, bool, IES_IMPORT_PRINT_TO_CONSOLE) node[IES_IMPORT_PRINT_TO_CONSOLE] = True return True <|end_body_0|> <|body_start_1|> if 'txt' in name[-3:]: if bytes(probe[0:17]).decode().upper() == 'IES Meta Exporter'.upper(): return T...
IESMeta Loader
IESMetaLoader
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IESMetaLoader: """IESMeta Loader""" def Init(self, node): """Called when a new instance of this object is created. In this context, this allow to define the option by default for the SceneLoaderPlugin that will be displayed to the user. Returns: bool: False if there was an error, oth...
stack_v2_sparse_classes_10k_train_003005
7,074
permissive
[ { "docstring": "Called when a new instance of this object is created. In this context, this allow to define the option by default for the SceneLoaderPlugin that will be displayed to the user. Returns: bool: False if there was an error, otherwise True.", "name": "Init", "signature": "def Init(self, node)...
3
stack_v2_sparse_classes_30k_train_002602
Implement the Python class `IESMetaLoader` described below. Class description: IESMeta Loader Method signatures and docstrings: - def Init(self, node): Called when a new instance of this object is created. In this context, this allow to define the option by default for the SceneLoaderPlugin that will be displayed to ...
Implement the Python class `IESMetaLoader` described below. Class description: IESMeta Loader Method signatures and docstrings: - def Init(self, node): Called when a new instance of this object is created. In this context, this allow to define the option by default for the SceneLoaderPlugin that will be displayed to ...
b1ea3fce533df34094bc3d0bd6460dfb84306e53
<|skeleton|> class IESMetaLoader: """IESMeta Loader""" def Init(self, node): """Called when a new instance of this object is created. In this context, this allow to define the option by default for the SceneLoaderPlugin that will be displayed to the user. Returns: bool: False if there was an error, oth...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class IESMetaLoader: """IESMeta Loader""" def Init(self, node): """Called when a new instance of this object is created. In this context, this allow to define the option by default for the SceneLoaderPlugin that will be displayed to the user. Returns: bool: False if there was an error, otherwise True."...
the_stack_v2_python_sparse
plugins/py-ies_meta_r12/py-ies-meta_loader.pyp
PluginCafe/cinema4d_py_sdk_extended
train
112
66f4852fd4f4ffadd33f36f25760bfa23338c89c
[ "sketch = Sketch.query.get_with_acl(sketch_id)\nif not sketch:\n abort(HTTP_STATUS_CODE_NOT_FOUND, 'No sketch found with this ID')\nquestion = InvestigativeQuestion.query.get(question_id)\nif not question:\n abort(HTTP_STATUS_CODE_NOT_FOUND, 'No question found with this ID')\nconclusion = InvestigativeQuestio...
<|body_start_0|> sketch = Sketch.query.get_with_acl(sketch_id) if not sketch: abort(HTTP_STATUS_CODE_NOT_FOUND, 'No sketch found with this ID') question = InvestigativeQuestion.query.get(question_id) if not question: abort(HTTP_STATUS_CODE_NOT_FOUND, 'No question ...
Resource for investigative question conclusion.
QuestionConclusionResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuestionConclusionResource: """Resource for investigative question conclusion.""" def put(self, sketch_id, question_id, conclusion_id): """Handles PUT request to the resource. Edit a conclusion. Returns: A JSON representation of the conclusion.""" <|body_0|> def delete(s...
stack_v2_sparse_classes_10k_train_003006
15,391
permissive
[ { "docstring": "Handles PUT request to the resource. Edit a conclusion. Returns: A JSON representation of the conclusion.", "name": "put", "signature": "def put(self, sketch_id, question_id, conclusion_id)" }, { "docstring": "Handles DELETE request to the resource. Deletes a conclusion.", "n...
2
null
Implement the Python class `QuestionConclusionResource` described below. Class description: Resource for investigative question conclusion. Method signatures and docstrings: - def put(self, sketch_id, question_id, conclusion_id): Handles PUT request to the resource. Edit a conclusion. Returns: A JSON representation o...
Implement the Python class `QuestionConclusionResource` described below. Class description: Resource for investigative question conclusion. Method signatures and docstrings: - def put(self, sketch_id, question_id, conclusion_id): Handles PUT request to the resource. Edit a conclusion. Returns: A JSON representation o...
24f471b58ca4a87cb053961b5f05c07a544ca7b8
<|skeleton|> class QuestionConclusionResource: """Resource for investigative question conclusion.""" def put(self, sketch_id, question_id, conclusion_id): """Handles PUT request to the resource. Edit a conclusion. Returns: A JSON representation of the conclusion.""" <|body_0|> def delete(s...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class QuestionConclusionResource: """Resource for investigative question conclusion.""" def put(self, sketch_id, question_id, conclusion_id): """Handles PUT request to the resource. Edit a conclusion. Returns: A JSON representation of the conclusion.""" sketch = Sketch.query.get_with_acl(sketch...
the_stack_v2_python_sparse
timesketch/api/v1/resources/scenarios.py
google/timesketch
train
2,263
a6c53500d7c4a8c3ca60da77dee6bbd3a0bfaa94
[ "self.capacity_gib = capacity_gib\nself.expiry_time = expiry_time\nself.feature_name = feature_name\nself.license_type = license_type\nself.num_vm = num_vm\nself.product_description = product_description\nself.product_info = product_info", "if dictionary is None:\n return None\ncapacity_gib = dictionary.get('c...
<|body_start_0|> self.capacity_gib = capacity_gib self.expiry_time = expiry_time self.feature_name = feature_name self.license_type = license_type self.num_vm = num_vm self.product_description = product_description self.product_info = product_info <|end_body_0|> ...
Implementation of the 'LicensedUsage' model. TODO: type description here. Attributes: capacity_gib (long|int): Feature usage by the cluster. expiry_time (long|int): Expiry time(epoch) of each feature. There could be multiple expiry time for the given SKU. feature_name (string): Name of feature. license_type (string): T...
LicensedUsage
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LicensedUsage: """Implementation of the 'LicensedUsage' model. TODO: type description here. Attributes: capacity_gib (long|int): Feature usage by the cluster. expiry_time (long|int): Expiry time(epoch) of each feature. There could be multiple expiry time for the given SKU. feature_name (string): ...
stack_v2_sparse_classes_10k_train_003007
2,906
permissive
[ { "docstring": "Constructor for the LicensedUsage class", "name": "__init__", "signature": "def __init__(self, capacity_gib=None, expiry_time=None, feature_name=None, license_type=None, num_vm=None, product_description=None, product_info=None)" }, { "docstring": "Creates an instance of this mode...
2
stack_v2_sparse_classes_30k_train_000826
Implement the Python class `LicensedUsage` described below. Class description: Implementation of the 'LicensedUsage' model. TODO: type description here. Attributes: capacity_gib (long|int): Feature usage by the cluster. expiry_time (long|int): Expiry time(epoch) of each feature. There could be multiple expiry time for...
Implement the Python class `LicensedUsage` described below. Class description: Implementation of the 'LicensedUsage' model. TODO: type description here. Attributes: capacity_gib (long|int): Feature usage by the cluster. expiry_time (long|int): Expiry time(epoch) of each feature. There could be multiple expiry time for...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class LicensedUsage: """Implementation of the 'LicensedUsage' model. TODO: type description here. Attributes: capacity_gib (long|int): Feature usage by the cluster. expiry_time (long|int): Expiry time(epoch) of each feature. There could be multiple expiry time for the given SKU. feature_name (string): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LicensedUsage: """Implementation of the 'LicensedUsage' model. TODO: type description here. Attributes: capacity_gib (long|int): Feature usage by the cluster. expiry_time (long|int): Expiry time(epoch) of each feature. There could be multiple expiry time for the given SKU. feature_name (string): Name of featu...
the_stack_v2_python_sparse
cohesity_management_sdk/models/licensed_usage.py
cohesity/management-sdk-python
train
24
e5c5e3f8175b285b3729e3fd770fef3b3d5c278d
[ "super(GitPush, self).__init__(path, ssh_key=ssh_key)\nself.path = path\nself.remote = remote\nself.src_branch = src_branch\nself.dest_branch = dest_branch\nself.debug = []\nos.chdir(path)", "current_branch_results = self._get_current_branch()\nif current_branch_results['results'] == self.src_branch:\n return ...
<|body_start_0|> super(GitPush, self).__init__(path, ssh_key=ssh_key) self.path = path self.remote = remote self.src_branch = src_branch self.dest_branch = dest_branch self.debug = [] os.chdir(path) <|end_body_0|> <|body_start_1|> current_branch_results =...
Class to wrap the git merge line tools
GitPush
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GitPush: """Class to wrap the git merge line tools""" def __init__(self, path, remote, src_branch, dest_branch, ssh_key=None): """Constructor for GitPush""" <|body_0|> def checkout_branch(self): """check out the desired branch""" <|body_1|> def remot...
stack_v2_sparse_classes_10k_train_003008
2,595
permissive
[ { "docstring": "Constructor for GitPush", "name": "__init__", "signature": "def __init__(self, path, remote, src_branch, dest_branch, ssh_key=None)" }, { "docstring": "check out the desired branch", "name": "checkout_branch", "signature": "def checkout_branch(self)" }, { "docstri...
5
stack_v2_sparse_classes_30k_train_004541
Implement the Python class `GitPush` described below. Class description: Class to wrap the git merge line tools Method signatures and docstrings: - def __init__(self, path, remote, src_branch, dest_branch, ssh_key=None): Constructor for GitPush - def checkout_branch(self): check out the desired branch - def remote_up...
Implement the Python class `GitPush` described below. Class description: Class to wrap the git merge line tools Method signatures and docstrings: - def __init__(self, path, remote, src_branch, dest_branch, ssh_key=None): Constructor for GitPush - def checkout_branch(self): check out the desired branch - def remote_up...
e342f6659a4ef1a188ff403e2fc6b06ac6d119c7
<|skeleton|> class GitPush: """Class to wrap the git merge line tools""" def __init__(self, path, remote, src_branch, dest_branch, ssh_key=None): """Constructor for GitPush""" <|body_0|> def checkout_branch(self): """check out the desired branch""" <|body_1|> def remot...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GitPush: """Class to wrap the git merge line tools""" def __init__(self, path, remote, src_branch, dest_branch, ssh_key=None): """Constructor for GitPush""" super(GitPush, self).__init__(path, ssh_key=ssh_key) self.path = path self.remote = remote self.src_branch =...
the_stack_v2_python_sparse
ansible/roles/lib_git/build/src/git_push.py
openshift/openshift-tools
train
170
36fc53231495a15fdcc0b146b1c1c985bbb400f3
[ "self.list_file = list_file\nself.paths_list = []\nself.paths = {}\nself.load()", "with open(self.list_file) as f:\n lines = f.read().splitlines()\npath_index = [i for i, item in enumerate(lines) if 'path:' in item]\nsubmodel_name = ''\ncomponents = ''\nself.paths_list = []\nself.paths = {}\nfor i, p in enumer...
<|body_start_0|> self.list_file = list_file self.paths_list = [] self.paths = {} self.load() <|end_body_0|> <|body_start_1|> with open(self.list_file) as f: lines = f.read().splitlines() path_index = [i for i, item in enumerate(lines) if 'path:' in item] ...
Class representing an Easy5 schematic mapped out in desired order.
EZMAP
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EZMAP: """Class representing an Easy5 schematic mapped out in desired order.""" def __init__(self, list_file): """Method to initialize object.""" <|body_0|> def load(self): """Method to load the ezmap list file.""" <|body_1|> <|end_skeleton|> <|body_sta...
stack_v2_sparse_classes_10k_train_003009
1,824
no_license
[ { "docstring": "Method to initialize object.", "name": "__init__", "signature": "def __init__(self, list_file)" }, { "docstring": "Method to load the ezmap list file.", "name": "load", "signature": "def load(self)" } ]
2
stack_v2_sparse_classes_30k_train_001488
Implement the Python class `EZMAP` described below. Class description: Class representing an Easy5 schematic mapped out in desired order. Method signatures and docstrings: - def __init__(self, list_file): Method to initialize object. - def load(self): Method to load the ezmap list file.
Implement the Python class `EZMAP` described below. Class description: Class representing an Easy5 schematic mapped out in desired order. Method signatures and docstrings: - def __init__(self, list_file): Method to initialize object. - def load(self): Method to load the ezmap list file. <|skeleton|> class EZMAP: ...
6b37842203ff4318a48dbf0258cbe2b253436e7d
<|skeleton|> class EZMAP: """Class representing an Easy5 schematic mapped out in desired order.""" def __init__(self, list_file): """Method to initialize object.""" <|body_0|> def load(self): """Method to load the ezmap list file.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EZMAP: """Class representing an Easy5 schematic mapped out in desired order.""" def __init__(self, list_file): """Method to initialize object.""" self.list_file = list_file self.paths_list = [] self.paths = {} self.load() def load(self): """Method to l...
the_stack_v2_python_sparse
easy5/ezmap.py
tslowery78/PyLnD
train
0
f32605b74df2add152512bfc2667d212b9a724d6
[ "self.hass = hass\nself.config_entry = entry\nself.host: str = entry.data[CONF_HOST]\nself.api = api\nsuper().__init__(hass, _LOGGER, name=f'{DOMAIN} - {self.host}', update_interval=DEFAULT_SCAN_INTERVAL)", "try:\n return await self.api.get_ha_sensor_data()\nexcept exceptions.GlancesApiError as err:\n raise...
<|body_start_0|> self.hass = hass self.config_entry = entry self.host: str = entry.data[CONF_HOST] self.api = api super().__init__(hass, _LOGGER, name=f'{DOMAIN} - {self.host}', update_interval=DEFAULT_SCAN_INTERVAL) <|end_body_0|> <|body_start_1|> try: retur...
Get the latest data from Glances api.
GlancesDataUpdateCoordinator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GlancesDataUpdateCoordinator: """Get the latest data from Glances api.""" def __init__(self, hass: HomeAssistant, entry: ConfigEntry, api: Glances) -> None: """Initialize the Glances data.""" <|body_0|> async def _async_update_data(self) -> dict[str, Any]: """Get...
stack_v2_sparse_classes_10k_train_003010
1,309
permissive
[ { "docstring": "Initialize the Glances data.", "name": "__init__", "signature": "def __init__(self, hass: HomeAssistant, entry: ConfigEntry, api: Glances) -> None" }, { "docstring": "Get the latest data from the Glances REST API.", "name": "_async_update_data", "signature": "async def _a...
2
null
Implement the Python class `GlancesDataUpdateCoordinator` described below. Class description: Get the latest data from Glances api. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, entry: ConfigEntry, api: Glances) -> None: Initialize the Glances data. - async def _async_update_data(self) -...
Implement the Python class `GlancesDataUpdateCoordinator` described below. Class description: Get the latest data from Glances api. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, entry: ConfigEntry, api: Glances) -> None: Initialize the Glances data. - async def _async_update_data(self) -...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class GlancesDataUpdateCoordinator: """Get the latest data from Glances api.""" def __init__(self, hass: HomeAssistant, entry: ConfigEntry, api: Glances) -> None: """Initialize the Glances data.""" <|body_0|> async def _async_update_data(self) -> dict[str, Any]: """Get...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GlancesDataUpdateCoordinator: """Get the latest data from Glances api.""" def __init__(self, hass: HomeAssistant, entry: ConfigEntry, api: Glances) -> None: """Initialize the Glances data.""" self.hass = hass self.config_entry = entry self.host: str = entry.data[CONF_HOST]...
the_stack_v2_python_sparse
homeassistant/components/glances/coordinator.py
home-assistant/core
train
35,501
5a1f619715fe8aa4dbed410b83d63e008bb246ad
[ "for i in range(n):\n nums1[m + i] = nums2[i]\nnums1.sort()", "if n == 0:\n return None\nfor i in range(n):\n nums1[m + i] = nums2[i]\n for j in range(m + i, 0, -1):\n if nums1[j] < nums1[j - 1]:\n nums1[j], nums1[j - 1] = (nums1[j - 1], nums1[j])\n else:\n break" ]
<|body_start_0|> for i in range(n): nums1[m + i] = nums2[i] nums1.sort() <|end_body_0|> <|body_start_1|> if n == 0: return None for i in range(n): nums1[m + i] = nums2[i] for j in range(m + i, 0, -1): if nums1[j] < nums1[j ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: """Do not return anything, modify nums1 in-place instead.""" <|body_0|> def merge2(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: """双指针(插入排序思想)。 首先选择 nums2 第 1...
stack_v2_sparse_classes_10k_train_003011
5,205
no_license
[ { "docstring": "Do not return anything, modify nums1 in-place instead.", "name": "merge", "signature": "def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None" }, { "docstring": "双指针(插入排序思想)。 首先选择 nums2 第 1 个元素,将其插入到 nums1 中正确的位置; 然后再从 nums2 选择第 2 位元素,沿着 nums1 中上次插入的位置,向右寻找合...
2
stack_v2_sparse_classes_30k_train_002518
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: Do not return anything, modify nums1 in-place instead. - def merge2(self, nums1: List[int], m: int, n...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: Do not return anything, modify nums1 in-place instead. - def merge2(self, nums1: List[int], m: int, n...
6932d69353b94ec824dd0ddc86a92453f6673232
<|skeleton|> class Solution: def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: """Do not return anything, modify nums1 in-place instead.""" <|body_0|> def merge2(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: """双指针(插入排序思想)。 首先选择 nums2 第 1...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: """Do not return anything, modify nums1 in-place instead.""" for i in range(n): nums1[m + i] = nums2[i] nums1.sort() def merge2(self, nums1: List[int], m: int, nums2: List[int], n: i...
the_stack_v2_python_sparse
0088_merge-sorted-array.py
Nigirimeshi/leetcode
train
0
9689eeca03569387815b68344597f6e1c00654f0
[ "self.mtm = mtm\nself.rf = riskfreeRate\npReturns = AnnualReturn(self.mtm)\nself.portfolioReturn = pReturns.getValue()\nvolatility = Volatility(self.mtm.shift() / self.mtm - riskfreeRate)\nself.volatility = volatility.getValue()", "improvement = (self.portfolioReturn - self.rf).fillna(0)\nvolatility = self.volati...
<|body_start_0|> self.mtm = mtm self.rf = riskfreeRate pReturns = AnnualReturn(self.mtm) self.portfolioReturn = pReturns.getValue() volatility = Volatility(self.mtm.shift() / self.mtm - riskfreeRate) self.volatility = volatility.getValue() <|end_body_0|> <|body_start_1|>...
Sharpe ratio of the data.
SharpeRatio
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SharpeRatio: """Sharpe ratio of the data.""" def __init__(self, mtm, riskfreeRate): """Initialize a sharpe ratio calculator. Parameters ---------- mtm : pandas.Series daily mark-to-market indexed by trading date as strings in the format %Y%m%d; riskfreeRate : float risk-free interest...
stack_v2_sparse_classes_10k_train_003012
10,010
permissive
[ { "docstring": "Initialize a sharpe ratio calculator. Parameters ---------- mtm : pandas.Series daily mark-to-market indexed by trading date as strings in the format %Y%m%d; riskfreeRate : float risk-free interest rate.", "name": "__init__", "signature": "def __init__(self, mtm, riskfreeRate)" }, { ...
2
stack_v2_sparse_classes_30k_train_000682
Implement the Python class `SharpeRatio` described below. Class description: Sharpe ratio of the data. Method signatures and docstrings: - def __init__(self, mtm, riskfreeRate): Initialize a sharpe ratio calculator. Parameters ---------- mtm : pandas.Series daily mark-to-market indexed by trading date as strings in t...
Implement the Python class `SharpeRatio` described below. Class description: Sharpe ratio of the data. Method signatures and docstrings: - def __init__(self, mtm, riskfreeRate): Initialize a sharpe ratio calculator. Parameters ---------- mtm : pandas.Series daily mark-to-market indexed by trading date as strings in t...
139d604177da3855503643e0fcfa87711ba7e588
<|skeleton|> class SharpeRatio: """Sharpe ratio of the data.""" def __init__(self, mtm, riskfreeRate): """Initialize a sharpe ratio calculator. Parameters ---------- mtm : pandas.Series daily mark-to-market indexed by trading date as strings in the format %Y%m%d; riskfreeRate : float risk-free interest...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SharpeRatio: """Sharpe ratio of the data.""" def __init__(self, mtm, riskfreeRate): """Initialize a sharpe ratio calculator. Parameters ---------- mtm : pandas.Series daily mark-to-market indexed by trading date as strings in the format %Y%m%d; riskfreeRate : float risk-free interest rate.""" ...
the_stack_v2_python_sparse
analytics/riskMeasurement/riskMetric.py
WinQuant/arsenal
train
0
df292b649fb33d2812388ad9a3634022996c8cf6
[ "try:\n validate_email(value)\n return True\nexcept ValidationError:\n return False", "row_chunks = slice_iterable_into_chunks(rows, self.consent_page_size)\nfor chunk in row_chunks:\n '\\n Loop over the chunks and extract the email and item.\\n Save the item because the iterator...
<|body_start_0|> try: validate_email(value) return True except ValidationError: return False <|end_body_0|> <|body_start_1|> row_chunks = slice_iterable_into_chunks(rows, self.consent_page_size) for chunk in row_chunks: '\n Loop...
Company search export view.
SearchContactExportAPIView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SearchContactExportAPIView: """Company search export view.""" def _is_valid_email(self, value): """Validate if emails are valid and return a boolean flag.""" <|body_0|> def _add_consent_response(self, rows): """Transforms iterable to add user consent from the con...
stack_v2_sparse_classes_10k_train_003013
6,797
permissive
[ { "docstring": "Validate if emails are valid and return a boolean flag.", "name": "_is_valid_email", "signature": "def _is_valid_email(self, value)" }, { "docstring": "Transforms iterable to add user consent from the consent service. The consent lookup makes an external API call to return consen...
3
stack_v2_sparse_classes_30k_train_001390
Implement the Python class `SearchContactExportAPIView` described below. Class description: Company search export view. Method signatures and docstrings: - def _is_valid_email(self, value): Validate if emails are valid and return a boolean flag. - def _add_consent_response(self, rows): Transforms iterable to add user...
Implement the Python class `SearchContactExportAPIView` described below. Class description: Company search export view. Method signatures and docstrings: - def _is_valid_email(self, value): Validate if emails are valid and return a boolean flag. - def _add_consent_response(self, rows): Transforms iterable to add user...
a92faabf73fb93b5bfd94fd465eafc3e29aa6d8e
<|skeleton|> class SearchContactExportAPIView: """Company search export view.""" def _is_valid_email(self, value): """Validate if emails are valid and return a boolean flag.""" <|body_0|> def _add_consent_response(self, rows): """Transforms iterable to add user consent from the con...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SearchContactExportAPIView: """Company search export view.""" def _is_valid_email(self, value): """Validate if emails are valid and return a boolean flag.""" try: validate_email(value) return True except ValidationError: return False def _a...
the_stack_v2_python_sparse
datahub/search/contact/views.py
cgsunkel/data-hub-api
train
0
41b1620c3c9de9a2de26b7ff9e7a41a6f47ab0ba
[ "self.files_and_folders_info = files_and_folders_info\nself.name = name\nself.source_object_info = source_object_info", "if dictionary is None:\n return None\nfiles_and_folders_info = None\nif dictionary.get('filesAndFoldersInfo') != None:\n files_and_folders_info = list()\n for structure in dictionary.g...
<|body_start_0|> self.files_and_folders_info = files_and_folders_info self.name = name self.source_object_info = source_object_info <|end_body_0|> <|body_start_1|> if dictionary is None: return None files_and_folders_info = None if dictionary.get('filesAndFol...
Implementation of the 'DownloadFilesAndFoldersParams' model. DownloadFilesAndFoldersParams holds the information to create a task for downloading list of files or folders Attributes: files_and_folders_info (list of FilesAndFoldersInfo): Specifies the absolute paths for list of files and folders to download. name (strin...
DownloadFilesAndFoldersParams
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DownloadFilesAndFoldersParams: """Implementation of the 'DownloadFilesAndFoldersParams' model. DownloadFilesAndFoldersParams holds the information to create a task for downloading list of files or folders Attributes: files_and_folders_info (list of FilesAndFoldersInfo): Specifies the absolute pat...
stack_v2_sparse_classes_10k_train_003014
2,863
permissive
[ { "docstring": "Constructor for the DownloadFilesAndFoldersParams class", "name": "__init__", "signature": "def __init__(self, files_and_folders_info=None, name=None, source_object_info=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A...
2
null
Implement the Python class `DownloadFilesAndFoldersParams` described below. Class description: Implementation of the 'DownloadFilesAndFoldersParams' model. DownloadFilesAndFoldersParams holds the information to create a task for downloading list of files or folders Attributes: files_and_folders_info (list of FilesAndF...
Implement the Python class `DownloadFilesAndFoldersParams` described below. Class description: Implementation of the 'DownloadFilesAndFoldersParams' model. DownloadFilesAndFoldersParams holds the information to create a task for downloading list of files or folders Attributes: files_and_folders_info (list of FilesAndF...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class DownloadFilesAndFoldersParams: """Implementation of the 'DownloadFilesAndFoldersParams' model. DownloadFilesAndFoldersParams holds the information to create a task for downloading list of files or folders Attributes: files_and_folders_info (list of FilesAndFoldersInfo): Specifies the absolute pat...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DownloadFilesAndFoldersParams: """Implementation of the 'DownloadFilesAndFoldersParams' model. DownloadFilesAndFoldersParams holds the information to create a task for downloading list of files or folders Attributes: files_and_folders_info (list of FilesAndFoldersInfo): Specifies the absolute paths for list o...
the_stack_v2_python_sparse
cohesity_management_sdk/models/download_files_and_folders_params.py
cohesity/management-sdk-python
train
24
e654c31a5d0f0947ddfbd53ec68de3df613fa569
[ "self.min_alias_length: Optional[int]\nself.max_alias_length: Optional[int]\nassert context.segment.is_type('select_statement')\nchildren = FunctionalContext(context).segment.children()\nfrom_expression_elements = children.recursive_crawl('from_expression_element')\nreturn self._lint_aliases(from_expression_element...
<|body_start_0|> self.min_alias_length: Optional[int] self.max_alias_length: Optional[int] assert context.segment.is_type('select_statement') children = FunctionalContext(context).segment.children() from_expression_elements = children.recursive_crawl('from_expression_element') ...
Enforce table alias lengths in from clauses and join conditions. **Anti-pattern** In this example, alias ``o`` is used for the orders table. .. code-block:: sql SELECT SUM(o.amount) as order_amount, FROM orders as o **Best practice** Avoid aliases. Avoid short aliases when aliases are necessary. See also: :class:`Rule_...
Rule_AL06
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Rule_AL06: """Enforce table alias lengths in from clauses and join conditions. **Anti-pattern** In this example, alias ``o`` is used for the orders table. .. code-block:: sql SELECT SUM(o.amount) as order_amount, FROM orders as o **Best practice** Avoid aliases. Avoid short aliases when aliases a...
stack_v2_sparse_classes_10k_train_003015
4,131
permissive
[ { "docstring": "Identify aliases in from clause and join conditions. Find base table, table expressions in join, and other expressions in select clause and decide if it's needed to report them.", "name": "_eval", "signature": "def _eval(self, context: RuleContext) -> Optional[List[LintResult]]" }, {...
2
stack_v2_sparse_classes_30k_train_007321
Implement the Python class `Rule_AL06` described below. Class description: Enforce table alias lengths in from clauses and join conditions. **Anti-pattern** In this example, alias ``o`` is used for the orders table. .. code-block:: sql SELECT SUM(o.amount) as order_amount, FROM orders as o **Best practice** Avoid alia...
Implement the Python class `Rule_AL06` described below. Class description: Enforce table alias lengths in from clauses and join conditions. **Anti-pattern** In this example, alias ``o`` is used for the orders table. .. code-block:: sql SELECT SUM(o.amount) as order_amount, FROM orders as o **Best practice** Avoid alia...
a66da908907ee1eaf09d88a731025da29e7fca07
<|skeleton|> class Rule_AL06: """Enforce table alias lengths in from clauses and join conditions. **Anti-pattern** In this example, alias ``o`` is used for the orders table. .. code-block:: sql SELECT SUM(o.amount) as order_amount, FROM orders as o **Best practice** Avoid aliases. Avoid short aliases when aliases a...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Rule_AL06: """Enforce table alias lengths in from clauses and join conditions. **Anti-pattern** In this example, alias ``o`` is used for the orders table. .. code-block:: sql SELECT SUM(o.amount) as order_amount, FROM orders as o **Best practice** Avoid aliases. Avoid short aliases when aliases are necessary....
the_stack_v2_python_sparse
src/sqlfluff/rules/aliasing/AL06.py
sqlfluff/sqlfluff
train
5,931
d6f06dfa0aaf9a05a28434ec6d1be871c6690a2a
[ "if sport not in self.sports.keys():\n err_msg = 'update sports.game_status.GameStatus for sport: %s' % sport\n raise self.InvalidSportException(err_msg)\nself.status_map = self.sports.get(sport)", "if status not in self.status_map.keys():\n err_msg = '%s does not exist and therefore cant have a primary ...
<|body_start_0|> if sport not in self.sports.keys(): err_msg = 'update sports.game_status.GameStatus for sport: %s' % sport raise self.InvalidSportException(err_msg) self.status_map = self.sports.get(sport) <|end_body_0|> <|body_start_1|> if status not in self.status_map...
for discrepencies with the values returned by this class, please refer to the source extended documentation found on the SportRadar website: https://developer.sportradar.us/ this object is in charge of making sense of granular boxscore game statuses. given an MLB boxscore game status like 'odelay', the method get_prima...
GameStatus
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GameStatus: """for discrepencies with the values returned by this class, please refer to the source extended documentation found on the SportRadar website: https://developer.sportradar.us/ this object is in charge of making sense of granular boxscore game statuses. given an MLB boxscore game stat...
stack_v2_sparse_classes_10k_train_003016
6,302
no_license
[ { "docstring": ":param sport: string name of the sport you want to use the GameStatus object for. :raise InvalidSportException: if the 'sport' arg not found among top-level keys in the status map", "name": "__init__", "signature": "def __init__(self, sport)" }, { "docstring": "given a granular b...
2
null
Implement the Python class `GameStatus` described below. Class description: for discrepencies with the values returned by this class, please refer to the source extended documentation found on the SportRadar website: https://developer.sportradar.us/ this object is in charge of making sense of granular boxscore game st...
Implement the Python class `GameStatus` described below. Class description: for discrepencies with the values returned by this class, please refer to the source extended documentation found on the SportRadar website: https://developer.sportradar.us/ this object is in charge of making sense of granular boxscore game st...
4796fa9d88b56f80def011e2b043ce595bfce8c4
<|skeleton|> class GameStatus: """for discrepencies with the values returned by this class, please refer to the source extended documentation found on the SportRadar website: https://developer.sportradar.us/ this object is in charge of making sense of granular boxscore game statuses. given an MLB boxscore game stat...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GameStatus: """for discrepencies with the values returned by this class, please refer to the source extended documentation found on the SportRadar website: https://developer.sportradar.us/ this object is in charge of making sense of granular boxscore game statuses. given an MLB boxscore game status like 'odel...
the_stack_v2_python_sparse
sports/game_status.py
nakamotohideyoshi/draftboard-web
train
0
13faae550a4f408fcabffbe45a858c3803a2f863
[ "title = request.POST['title']\nnew_properties = json.loads(request.POST.get('newProperties', '[]'))\ntemplate = mall_models.ProductPropertyTemplate.objects.create(owner=request.manager, name=title)\nfor property in new_properties:\n if property['id'] < 0:\n mall_models.TemplateProperty.objects.create(own...
<|body_start_0|> title = request.POST['title'] new_properties = json.loads(request.POST.get('newProperties', '[]')) template = mall_models.ProductPropertyTemplate.objects.create(owner=request.manager, name=title) for property in new_properties: if property['id'] < 0: ...
Property
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Property: def api_put(request): """创建属性模板 Args: title: 属性模板标题 newProperties 属性模板中需要新建的property信息的json字符串 Example: { 'title': 'aaa', 'newProperties':[ { id: -1, //id=-1, 代表需要新建的属性 name: "属性1", value: "属性1的描述" }, ... ] }""" <|body_0|> def api_post(request): """更新属性模板 A...
stack_v2_sparse_classes_10k_train_003017
5,912
no_license
[ { "docstring": "创建属性模板 Args: title: 属性模板标题 newProperties 属性模板中需要新建的property信息的json字符串 Example: { 'title': 'aaa', 'newProperties':[ { id: -1, //id=-1, 代表需要新建的属性 name: \"属性1\", value: \"属性1的描述\" }, ... ] }", "name": "api_put", "signature": "def api_put(request)" }, { "docstring": "更新属性模板 Args: id:...
3
stack_v2_sparse_classes_30k_train_004158
Implement the Python class `Property` described below. Class description: Implement the Property class. Method signatures and docstrings: - def api_put(request): 创建属性模板 Args: title: 属性模板标题 newProperties 属性模板中需要新建的property信息的json字符串 Example: { 'title': 'aaa', 'newProperties':[ { id: -1, //id=-1, 代表需要新建的属性 name: "属性1",...
Implement the Python class `Property` described below. Class description: Implement the Property class. Method signatures and docstrings: - def api_put(request): 创建属性模板 Args: title: 属性模板标题 newProperties 属性模板中需要新建的property信息的json字符串 Example: { 'title': 'aaa', 'newProperties':[ { id: -1, //id=-1, 代表需要新建的属性 name: "属性1",...
8b2f7befe92841bcc35e0e60cac5958ef3f3af54
<|skeleton|> class Property: def api_put(request): """创建属性模板 Args: title: 属性模板标题 newProperties 属性模板中需要新建的property信息的json字符串 Example: { 'title': 'aaa', 'newProperties':[ { id: -1, //id=-1, 代表需要新建的属性 name: "属性1", value: "属性1的描述" }, ... ] }""" <|body_0|> def api_post(request): """更新属性模板 A...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Property: def api_put(request): """创建属性模板 Args: title: 属性模板标题 newProperties 属性模板中需要新建的property信息的json字符串 Example: { 'title': 'aaa', 'newProperties':[ { id: -1, //id=-1, 代表需要新建的属性 name: "属性1", value: "属性1的描述" }, ... ] }""" title = request.POST['title'] new_properties = json.loads(reques...
the_stack_v2_python_sparse
weapp/mall/product/properties.py
chengdg/weizoom
train
1
4509f180ef7bf4824c3b1b75f3778c87553dce86
[ "super(AdaptiveLossFunction, self).__init__(name=name)\n_check_scale(scale_lo, scale_init)\nif not np.isscalar(alpha_lo):\n raise ValueError('`alpha_lo` must be a scalar, but is of type {}'.format(type(alpha_lo)))\nif not np.isscalar(alpha_hi):\n raise ValueError('`alpha_hi` must be a scalar, but is of type {...
<|body_start_0|> super(AdaptiveLossFunction, self).__init__(name=name) _check_scale(scale_lo, scale_init) if not np.isscalar(alpha_lo): raise ValueError('`alpha_lo` must be a scalar, but is of type {}'.format(type(alpha_lo))) if not np.isscalar(alpha_hi): raise Va...
Implements the adaptive form of the general loss for matrix inputs. This loss behaves differently from general.lossfun() and distribution.nllfun(), which are "stateless", allow the caller to specify the shape and scale of the loss, and allow for arbitrary sized inputs. This loss only allows for rank-2 inputs, and expec...
AdaptiveLossFunction
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdaptiveLossFunction: """Implements the adaptive form of the general loss for matrix inputs. This loss behaves differently from general.lossfun() and distribution.nllfun(), which are "stateless", allow the caller to specify the shape and scale of the loss, and allow for arbitrary sized inputs. Th...
stack_v2_sparse_classes_10k_train_003018
23,679
permissive
[ { "docstring": "Constructs the loss function. Args: num_channels: the number of different \"channels\" for the adaptive loss function, where each channel will be assigned its own shape (alpha) and scale parameters that are constructed as variables and can be optimized over. float_dtype: The expected numerical p...
4
null
Implement the Python class `AdaptiveLossFunction` described below. Class description: Implements the adaptive form of the general loss for matrix inputs. This loss behaves differently from general.lossfun() and distribution.nllfun(), which are "stateless", allow the caller to specify the shape and scale of the loss, a...
Implement the Python class `AdaptiveLossFunction` described below. Class description: Implements the adaptive form of the general loss for matrix inputs. This loss behaves differently from general.lossfun() and distribution.nllfun(), which are "stateless", allow the caller to specify the shape and scale of the loss, a...
727ec399ad17b4dd1f71ce69a26fc3b0371d9fa7
<|skeleton|> class AdaptiveLossFunction: """Implements the adaptive form of the general loss for matrix inputs. This loss behaves differently from general.lossfun() and distribution.nllfun(), which are "stateless", allow the caller to specify the shape and scale of the loss, and allow for arbitrary sized inputs. Th...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AdaptiveLossFunction: """Implements the adaptive form of the general loss for matrix inputs. This loss behaves differently from general.lossfun() and distribution.nllfun(), which are "stateless", allow the caller to specify the shape and scale of the loss, and allow for arbitrary sized inputs. This loss only ...
the_stack_v2_python_sparse
robust_loss/adaptive.py
Ayoob7/google-research
train
2
7e167a83a753673e77c7d125af15ea7570ac3edb
[ "if not is_exe(exe_path):\n msg = '{0} is not an executable'.format(exe_path)\n raise NotExecutableError(msg)\nself._exe_path = exe_path", "self.__build_cmd(infname)\npipe = subprocess.run(self._cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True)\nresults = Results(self._cmd, self._...
<|body_start_0|> if not is_exe(exe_path): msg = '{0} is not an executable'.format(exe_path) raise NotExecutableError(msg) self._exe_path = exe_path <|end_body_0|> <|body_start_1|> self.__build_cmd(infname) pipe = subprocess.run(self._cmd, shell=True, stdout=subpr...
Class for working with Samtools_index
Samtools_Index
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Samtools_Index: """Class for working with Samtools_index""" def __init__(self, exe_path): """Instantiate with location of executable""" <|body_0|> def run(self, infname): """Run Samtools_index on the passed file""" <|body_1|> def __build_cmd(self, in...
stack_v2_sparse_classes_10k_train_003019
1,843
permissive
[ { "docstring": "Instantiate with location of executable", "name": "__init__", "signature": "def __init__(self, exe_path)" }, { "docstring": "Run Samtools_index on the passed file", "name": "run", "signature": "def run(self, infname)" }, { "docstring": "Build a command-line for Sa...
3
stack_v2_sparse_classes_30k_train_002765
Implement the Python class `Samtools_Index` described below. Class description: Class for working with Samtools_index Method signatures and docstrings: - def __init__(self, exe_path): Instantiate with location of executable - def run(self, infname): Run Samtools_index on the passed file - def __build_cmd(self, infnam...
Implement the Python class `Samtools_Index` described below. Class description: Class for working with Samtools_index Method signatures and docstrings: - def __init__(self, exe_path): Instantiate with location of executable - def run(self, infname): Run Samtools_index on the passed file - def __build_cmd(self, infnam...
a3c64198aad3709a5c4d969f48ae0af11fdc25db
<|skeleton|> class Samtools_Index: """Class for working with Samtools_index""" def __init__(self, exe_path): """Instantiate with location of executable""" <|body_0|> def run(self, infname): """Run Samtools_index on the passed file""" <|body_1|> def __build_cmd(self, in...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Samtools_Index: """Class for working with Samtools_index""" def __init__(self, exe_path): """Instantiate with location of executable""" if not is_exe(exe_path): msg = '{0} is not an executable'.format(exe_path) raise NotExecutableError(msg) self._exe_path =...
the_stack_v2_python_sparse
metapy/pycits/samtools_index.py
peterthorpe5/public_scripts
train
35
3632abcc7439085ef88503d6add1e4a6ed58b512
[ "self.n = 0\nself.snapshotnr = -np.ones(nelements, dtype=np.int)\nself.redshift = -np.ones(nelements, dtype=np.float)\nself.clumpids = -np.ones(nelements, dtype=np.int)\nself.mass = np.zeros(nelements, dtype=np.float)\nself.mergermass = np.zeros(nelements, dtype=np.float)\nself.mass_to_remove = np.zeros(nelements, ...
<|body_start_0|> self.n = 0 self.snapshotnr = -np.ones(nelements, dtype=np.int) self.redshift = -np.ones(nelements, dtype=np.float) self.clumpids = -np.ones(nelements, dtype=np.int) self.mass = np.zeros(nelements, dtype=np.float) self.mergermass = np.zeros(nelements, dtyp...
Holds tree result data. It's not really a tree, it's just the values along the main branch, but let's call it a tree anyway. Sue me.
tree
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class tree: """Holds tree result data. It's not really a tree, it's just the values along the main branch, but let's call it a tree anyway. Sue me.""" def __init__(self, nelements): """nelements: extimate for how many snapshots you need to allocate space for""" <|body_0|> def ...
stack_v2_sparse_classes_10k_train_003020
36,252
no_license
[ { "docstring": "nelements: extimate for how many snapshots you need to allocate space for", "name": "__init__", "signature": "def __init__(self, nelements)" }, { "docstring": "Add new result.", "name": "add_snap", "signature": "def add_snap(self, nr, z, ID, m, mm, mdel)" }, { "do...
3
stack_v2_sparse_classes_30k_train_007131
Implement the Python class `tree` described below. Class description: Holds tree result data. It's not really a tree, it's just the values along the main branch, but let's call it a tree anyway. Sue me. Method signatures and docstrings: - def __init__(self, nelements): nelements: extimate for how many snapshots you n...
Implement the Python class `tree` described below. Class description: Holds tree result data. It's not really a tree, it's just the values along the main branch, but let's call it a tree anyway. Sue me. Method signatures and docstrings: - def __init__(self, nelements): nelements: extimate for how many snapshots you n...
f1bd65ef106dbf5e4cefefd7d386643a6fc0ac52
<|skeleton|> class tree: """Holds tree result data. It's not really a tree, it's just the values along the main branch, but let's call it a tree anyway. Sue me.""" def __init__(self, nelements): """nelements: extimate for how many snapshots you need to allocate space for""" <|body_0|> def ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class tree: """Holds tree result data. It's not really a tree, it's just the values along the main branch, but let's call it a tree anyway. Sue me.""" def __init__(self, nelements): """nelements: extimate for how many snapshots you need to allocate space for""" self.n = 0 self.snapshotn...
the_stack_v2_python_sparse
utils/py/mergertree-extract.py
ALaDyn/ramses
train
6
01adba14499d24e53c38eef3f27e9fe5ad9ac5f5
[ "self.k = k\nself.queue = nums\nheapq.heapify(self.queue)", "heapq.heappush(self.queue, val)\nwhile len(self.queue) > self.k:\n heapq.heappop(self.queue)\nreturn self.queue[0]" ]
<|body_start_0|> self.k = k self.queue = nums heapq.heapify(self.queue) <|end_body_0|> <|body_start_1|> heapq.heappush(self.queue, val) while len(self.queue) > self.k: heapq.heappop(self.queue) return self.queue[0] <|end_body_1|>
KthLargest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.k = k self.queue = nums heapq.heapify...
stack_v2_sparse_classes_10k_train_003021
648
no_license
[ { "docstring": ":type k: int :type nums: List[int]", "name": "__init__", "signature": "def __init__(self, k, nums)" }, { "docstring": ":type val: int :rtype: int", "name": "add", "signature": "def add(self, val)" } ]
2
null
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int <|skeleton|> class KthLargest: def __init__(self, k, nu...
82ece6ed353235dcd36face80f5d87df12d56a2c
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" self.k = k self.queue = nums heapq.heapify(self.queue) def add(self, val): """:type val: int :rtype: int""" heapq.heappush(self.queue, val) while len(self.queue) > sel...
the_stack_v2_python_sparse
排序/703. 数据流中的第 K 大元素.py
pulinghao/LeetCode_Python
train
2
0b69e1c98d2ab57b44a3c5e019f41c3f7aebba3f
[ "super().__init__()\nself.mem_length = 1\nself.grudged = False\nself.grudge_memory = 1", "if self.grudge_memory >= self.mem_length:\n self.grudge_memory = 0\n self.grudged = False\nif self.grudged:\n self.grudge_memory += 1\n return D\nelif D in opponent.history[-1:]:\n self.mem_length = opponent.d...
<|body_start_0|> super().__init__() self.mem_length = 1 self.grudged = False self.grudge_memory = 1 <|end_body_0|> <|body_start_1|> if self.grudge_memory >= self.mem_length: self.grudge_memory = 0 self.grudged = False if self.grudged: ...
A player starts by cooperating however will defect if at any point the opponent has defected, but forgets after meme_length matches, with 1<=mem_length<=20 proportional to the amount of time the opponent has played D, punishing that player for playing D too often. Names: - Punisher: Original name by Geraint Palmer
Punisher
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Punisher: """A player starts by cooperating however will defect if at any point the opponent has defected, but forgets after meme_length matches, with 1<=mem_length<=20 proportional to the amount of time the opponent has played D, punishing that player for playing D too often. Names: - Punisher: ...
stack_v2_sparse_classes_10k_train_003022
5,234
permissive
[ { "docstring": "Initialised the player", "name": "__init__", "signature": "def __init__(self) -> None" }, { "docstring": "Begins by playing C, then plays D for an amount of rounds proportional to the opponents historical '%' of playing D if the opponent ever plays D", "name": "strategy", ...
2
stack_v2_sparse_classes_30k_train_002000
Implement the Python class `Punisher` described below. Class description: A player starts by cooperating however will defect if at any point the opponent has defected, but forgets after meme_length matches, with 1<=mem_length<=20 proportional to the amount of time the opponent has played D, punishing that player for p...
Implement the Python class `Punisher` described below. Class description: A player starts by cooperating however will defect if at any point the opponent has defected, but forgets after meme_length matches, with 1<=mem_length<=20 proportional to the amount of time the opponent has played D, punishing that player for p...
fa748627cd4f0333bb2dbfcb1454372a78a9098a
<|skeleton|> class Punisher: """A player starts by cooperating however will defect if at any point the opponent has defected, but forgets after meme_length matches, with 1<=mem_length<=20 proportional to the amount of time the opponent has played D, punishing that player for playing D too often. Names: - Punisher: ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Punisher: """A player starts by cooperating however will defect if at any point the opponent has defected, but forgets after meme_length matches, with 1<=mem_length<=20 proportional to the amount of time the opponent has played D, punishing that player for playing D too often. Names: - Punisher: Original name...
the_stack_v2_python_sparse
axelrod/strategies/punisher.py
Axelrod-Python/Axelrod
train
673
4e839ba3808743ba8c8785079521bbfa02a0e34f
[ "data = JSONParser().parse(request)['detailed_requirements']\ndetailed_requirements = DetailedRequirement.objects.filter(id__in=[d['id'] for d in data])\nserializer = DetailedRequirementSerializer(detailed_requirements, many=True)\nreturn JsonResponse({'detailed_requirements': serializer.data}, safe=False)", "res...
<|body_start_0|> data = JSONParser().parse(request)['detailed_requirements'] detailed_requirements = DetailedRequirement.objects.filter(id__in=[d['id'] for d in data]) serializer = DetailedRequirementSerializer(detailed_requirements, many=True) return JsonResponse({'detailed_requirements...
指标点view
DetailedRequirements
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DetailedRequirements: """指标点view""" def get(self, request): """查询指标点""" <|body_0|> def put(self, request): """修改指标点""" <|body_1|> def post(self, request): """增加指标点""" <|body_2|> def delete(self, request): """删除指标点""" ...
stack_v2_sparse_classes_10k_train_003023
15,061
permissive
[ { "docstring": "查询指标点", "name": "get", "signature": "def get(self, request)" }, { "docstring": "修改指标点", "name": "put", "signature": "def put(self, request)" }, { "docstring": "增加指标点", "name": "post", "signature": "def post(self, request)" }, { "docstring": "删除指标点"...
4
stack_v2_sparse_classes_30k_train_004858
Implement the Python class `DetailedRequirements` described below. Class description: 指标点view Method signatures and docstrings: - def get(self, request): 查询指标点 - def put(self, request): 修改指标点 - def post(self, request): 增加指标点 - def delete(self, request): 删除指标点
Implement the Python class `DetailedRequirements` described below. Class description: 指标点view Method signatures and docstrings: - def get(self, request): 查询指标点 - def put(self, request): 修改指标点 - def post(self, request): 增加指标点 - def delete(self, request): 删除指标点 <|skeleton|> class DetailedRequirements: """指标点view""...
7aaa1be773718de1beb3ce0080edca7c4114b7ad
<|skeleton|> class DetailedRequirements: """指标点view""" def get(self, request): """查询指标点""" <|body_0|> def put(self, request): """修改指标点""" <|body_1|> def post(self, request): """增加指标点""" <|body_2|> def delete(self, request): """删除指标点""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DetailedRequirements: """指标点view""" def get(self, request): """查询指标点""" data = JSONParser().parse(request)['detailed_requirements'] detailed_requirements = DetailedRequirement.objects.filter(id__in=[d['id'] for d in data]) serializer = DetailedRequirementSerializer(detaile...
the_stack_v2_python_sparse
plan/views.py
MIXISAMA/MIS-backend
train
0
7660bc1ded61b97d305e35ac17ce9bcf33faf71c
[ "self.handler = handler\nself.db = DB(handler.application)\npass", "for item in res:\n item['img_url'] = self.db.get_article_img_list(item['id'], num)\nreturn res", "if isinstance(db_res, list):\n for i in xrange(0, len(db_res)):\n db_res[i] = self.filter_db_res(db_res[i])\nelif isinstance(db_res, ...
<|body_start_0|> self.handler = handler self.db = DB(handler.application) pass <|end_body_0|> <|body_start_1|> for item in res: item['img_url'] = self.db.get_article_img_list(item['id'], num) return res <|end_body_1|> <|body_start_2|> if isinstance(db_res, l...
Base class for all account process modules 初始化数据库,缓存,短信服务
Processor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Processor: """Base class for all account process modules 初始化数据库,缓存,短信服务""" def __init__(self, handler): """Constructor""" <|body_0|> def add_img(self, res, num=0): """Add img_url to solr result""" <|body_1|> def filter_db_res(self, db_res): "...
stack_v2_sparse_classes_10k_train_003024
1,612
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, handler)" }, { "docstring": "Add img_url to solr result", "name": "add_img", "signature": "def add_img(self, res, num=0)" }, { "docstring": "判断是否是list,分解为dict, 将dict中不能变为json的部分过滤或做处理", "name":...
3
stack_v2_sparse_classes_30k_train_002345
Implement the Python class `Processor` described below. Class description: Base class for all account process modules 初始化数据库,缓存,短信服务 Method signatures and docstrings: - def __init__(self, handler): Constructor - def add_img(self, res, num=0): Add img_url to solr result - def filter_db_res(self, db_res): 判断是否是list,分解为...
Implement the Python class `Processor` described below. Class description: Base class for all account process modules 初始化数据库,缓存,短信服务 Method signatures and docstrings: - def __init__(self, handler): Constructor - def add_img(self, res, num=0): Add img_url to solr result - def filter_db_res(self, db_res): 判断是否是list,分解为...
62d5d8201d4b19d55f7ba0c33f9a91badacc7fbe
<|skeleton|> class Processor: """Base class for all account process modules 初始化数据库,缓存,短信服务""" def __init__(self, handler): """Constructor""" <|body_0|> def add_img(self, res, num=0): """Add img_url to solr result""" <|body_1|> def filter_db_res(self, db_res): "...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Processor: """Base class for all account process modules 初始化数据库,缓存,短信服务""" def __init__(self, handler): """Constructor""" self.handler = handler self.db = DB(handler.application) pass def add_img(self, res, num=0): """Add img_url to solr result""" for ...
the_stack_v2_python_sparse
module/base_processor.py
giphub/gip
train
1
529abcb1262ec20cdf3047bc678ff7e13774d26c
[ "want_dynamic_group = self.is_audio_group\nhave_dynamic_group = self.is_dynamic_group is not None\nhave_all_except_dynamic_group = all(attr.astuple(self, filter=attr.filters.exclude(attr.fields(ChromecastInfo).is_dynamic_group)))\nreturn have_all_except_dynamic_group and (not want_dynamic_group or have_dynamic_grou...
<|body_start_0|> want_dynamic_group = self.is_audio_group have_dynamic_group = self.is_dynamic_group is not None have_all_except_dynamic_group = all(attr.astuple(self, filter=attr.filters.exclude(attr.fields(ChromecastInfo).is_dynamic_group))) return have_all_except_dynamic_group and (no...
Class to hold all data about a chromecast for creating connections. This also has the same attributes as the mDNS fields by zeroconf.
ChromecastInfo
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChromecastInfo: """Class to hold all data about a chromecast for creating connections. This also has the same attributes as the mDNS fields by zeroconf.""" def is_information_complete(self) -> bool: """Return if all information is filled out.""" <|body_0|> def manufactur...
stack_v2_sparse_classes_10k_train_003025
6,736
permissive
[ { "docstring": "Return if all information is filled out.", "name": "is_information_complete", "signature": "def is_information_complete(self) -> bool" }, { "docstring": "Return the manufacturer.", "name": "manufacturer", "signature": "def manufacturer(self) -> str | None" }, { "d...
3
null
Implement the Python class `ChromecastInfo` described below. Class description: Class to hold all data about a chromecast for creating connections. This also has the same attributes as the mDNS fields by zeroconf. Method signatures and docstrings: - def is_information_complete(self) -> bool: Return if all information...
Implement the Python class `ChromecastInfo` described below. Class description: Class to hold all data about a chromecast for creating connections. This also has the same attributes as the mDNS fields by zeroconf. Method signatures and docstrings: - def is_information_complete(self) -> bool: Return if all information...
2fee32fce03bc49e86cf2e7b741a15621a97cce5
<|skeleton|> class ChromecastInfo: """Class to hold all data about a chromecast for creating connections. This also has the same attributes as the mDNS fields by zeroconf.""" def is_information_complete(self) -> bool: """Return if all information is filled out.""" <|body_0|> def manufactur...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ChromecastInfo: """Class to hold all data about a chromecast for creating connections. This also has the same attributes as the mDNS fields by zeroconf.""" def is_information_complete(self) -> bool: """Return if all information is filled out.""" want_dynamic_group = self.is_audio_group ...
the_stack_v2_python_sparse
homeassistant/components/cast/helpers.py
BenWoodford/home-assistant
train
11
dc453d1892cdb5a0459c1274388b9bdb5820eb02
[ "super(GGCNN, self).__init__()\nself.conv1 = Conv2D(input_channels, filter_sizes[0], kernel_sizes[0], stride=strides[0], padding=3, act='relu', param_attr=fluid.initializer.Xavier(uniform=False))\nself.conv2 = Conv2D(filter_sizes[0], filter_sizes[1], kernel_sizes[1], stride=strides[1], padding=2, act='relu', param_...
<|body_start_0|> super(GGCNN, self).__init__() self.conv1 = Conv2D(input_channels, filter_sizes[0], kernel_sizes[0], stride=strides[0], padding=3, act='relu', param_attr=fluid.initializer.Xavier(uniform=False)) self.conv2 = Conv2D(filter_sizes[0], filter_sizes[1], kernel_sizes[1], stride=strides...
GGCNN
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GGCNN: def __init__(self, input_channels=1): """:功能 :类初始化函数 :参数 input_channels :int,输入数据的通道数,1或3或4 :返回 :None""" <|body_0|> def forward(self, x): """:功能 :前向传播函数 :参数 x :tensors,一次网络输入 :返回 :tensors,各参数的预测结果""" <|body_1|> def compute_loss(self, xc, yc): ...
stack_v2_sparse_classes_10k_train_003026
4,477
no_license
[ { "docstring": ":功能 :类初始化函数 :参数 input_channels :int,输入数据的通道数,1或3或4 :返回 :None", "name": "__init__", "signature": "def __init__(self, input_channels=1)" }, { "docstring": ":功能 :前向传播函数 :参数 x :tensors,一次网络输入 :返回 :tensors,各参数的预测结果", "name": "forward", "signature": "def forward(self, x)" }, ...
3
stack_v2_sparse_classes_30k_train_001598
Implement the Python class `GGCNN` described below. Class description: Implement the GGCNN class. Method signatures and docstrings: - def __init__(self, input_channels=1): :功能 :类初始化函数 :参数 input_channels :int,输入数据的通道数,1或3或4 :返回 :None - def forward(self, x): :功能 :前向传播函数 :参数 x :tensors,一次网络输入 :返回 :tensors,各参数的预测结果 - def...
Implement the Python class `GGCNN` described below. Class description: Implement the GGCNN class. Method signatures and docstrings: - def __init__(self, input_channels=1): :功能 :类初始化函数 :参数 input_channels :int,输入数据的通道数,1或3或4 :返回 :None - def forward(self, x): :功能 :前向传播函数 :参数 x :tensors,一次网络输入 :返回 :tensors,各参数的预测结果 - def...
d0b7b14fa8b76ba95118c8b1af53fbd627860c00
<|skeleton|> class GGCNN: def __init__(self, input_channels=1): """:功能 :类初始化函数 :参数 input_channels :int,输入数据的通道数,1或3或4 :返回 :None""" <|body_0|> def forward(self, x): """:功能 :前向传播函数 :参数 x :tensors,一次网络输入 :返回 :tensors,各参数的预测结果""" <|body_1|> def compute_loss(self, xc, yc): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GGCNN: def __init__(self, input_channels=1): """:功能 :类初始化函数 :参数 input_channels :int,输入数据的通道数,1或3或4 :返回 :None""" super(GGCNN, self).__init__() self.conv1 = Conv2D(input_channels, filter_sizes[0], kernel_sizes[0], stride=strides[0], padding=3, act='relu', param_attr=fluid.initializer.Xav...
the_stack_v2_python_sparse
10.pdpd/ggcnn_fluid.py
Nhiemth1985/ggcnn_cornell_dataset
train
0
58483fd26ded2eef48506baf01f41c8d30f8086e
[ "self.done = False\nself.th_lim = 10.0\nself.sign = 1 if positive else -1\nself.u_max = 0.8\nself.cnt = 0\nself.cnt_done = cnt_done", "th = meas[0].item()\nif abs(th - self.th_lim) > 1e-08:\n self.cnt = 0\n self.th_lim = th\nelse:\n self.cnt += 1\nself.done = self.cnt >= self.cnt_done\nreturn to.tensor([...
<|body_start_0|> self.done = False self.th_lim = 10.0 self.sign = 1 if positive else -1 self.u_max = 0.8 self.cnt = 0 self.cnt_done = cnt_done <|end_body_0|> <|body_start_1|> th = meas[0].item() if abs(th - self.th_lim) > 1e-08: self.cnt = 0 ...
Controller for going to one of the joint limits (part of the calibration routine)
GoToLimCtrl
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GoToLimCtrl: """Controller for going to one of the joint limits (part of the calibration routine)""" def __init__(self, positive: bool=True, cnt_done: int=250): """Constructor :param positive: direction switch""" <|body_0|> def __call__(self, meas: to.Tensor) -> to.Tenso...
stack_v2_sparse_classes_10k_train_003027
25,612
permissive
[ { "docstring": "Constructor :param positive: direction switch", "name": "__init__", "signature": "def __init__(self, positive: bool=True, cnt_done: int=250)" }, { "docstring": "Go to joint limits by applying u_max and save limit value in th_lim. :param meas: sensor measurement :return: action", ...
2
null
Implement the Python class `GoToLimCtrl` described below. Class description: Controller for going to one of the joint limits (part of the calibration routine) Method signatures and docstrings: - def __init__(self, positive: bool=True, cnt_done: int=250): Constructor :param positive: direction switch - def __call__(se...
Implement the Python class `GoToLimCtrl` described below. Class description: Controller for going to one of the joint limits (part of the calibration routine) Method signatures and docstrings: - def __init__(self, positive: bool=True, cnt_done: int=250): Constructor :param positive: direction switch - def __call__(se...
a6c982862e2ab39a9f65d1c09aa59d9a8b7ac6c5
<|skeleton|> class GoToLimCtrl: """Controller for going to one of the joint limits (part of the calibration routine)""" def __init__(self, positive: bool=True, cnt_done: int=250): """Constructor :param positive: direction switch""" <|body_0|> def __call__(self, meas: to.Tensor) -> to.Tenso...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GoToLimCtrl: """Controller for going to one of the joint limits (part of the calibration routine)""" def __init__(self, positive: bool=True, cnt_done: int=250): """Constructor :param positive: direction switch""" self.done = False self.th_lim = 10.0 self.sign = 1 if positi...
the_stack_v2_python_sparse
Pyrado/pyrado/policies/environment_specific.py
jacarvalho/SimuRLacra
train
0
4daa02e84d42b8e83e5775b4360c825f68aa1b12
[ "res = [[]]\nfor i in nums:\n temp = []\n for j in res:\n temp.append(j + [i])\n res += temp\nreturn res", "nums.sort()\nres = []\nn = len(nums)\n\ndef dfs(cur, path):\n res.append(path)\n for i in range(cur, n):\n if i > cur and nums[i] == nums[i - 1]:\n continue\n ...
<|body_start_0|> res = [[]] for i in nums: temp = [] for j in res: temp.append(j + [i]) res += temp return res <|end_body_0|> <|body_start_1|> nums.sort() res = [] n = len(nums) def dfs(cur, path): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def subsetsWithDup78(self, nums: List[int]) -> List[List[int]]: """78. 子集 数组元素互不相同""" <|body_0|> def subsetsWithDup(self, nums: List[int]) -> List[List[int]]: """90. 子集 II 存在重复元素 看成 n叉树,去重只去同一层的相同元素,同一树分支的元素不去重。 对于数组[2,2,3]比如第一层取2;3,2的下一层取2,3;3没有下一层""" ...
stack_v2_sparse_classes_10k_train_003028
1,688
no_license
[ { "docstring": "78. 子集 数组元素互不相同", "name": "subsetsWithDup78", "signature": "def subsetsWithDup78(self, nums: List[int]) -> List[List[int]]" }, { "docstring": "90. 子集 II 存在重复元素 看成 n叉树,去重只去同一层的相同元素,同一树分支的元素不去重。 对于数组[2,2,3]比如第一层取2;3,2的下一层取2,3;3没有下一层", "name": "subsetsWithDup", "signature": ...
2
stack_v2_sparse_classes_30k_train_005127
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subsetsWithDup78(self, nums: List[int]) -> List[List[int]]: 78. 子集 数组元素互不相同 - def subsetsWithDup(self, nums: List[int]) -> List[List[int]]: 90. 子集 II 存在重复元素 看成 n叉树,去重只去同一层的相同...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subsetsWithDup78(self, nums: List[int]) -> List[List[int]]: 78. 子集 数组元素互不相同 - def subsetsWithDup(self, nums: List[int]) -> List[List[int]]: 90. 子集 II 存在重复元素 看成 n叉树,去重只去同一层的相同...
3fd69b85f52af861ff7e2c74d8aacc515b192615
<|skeleton|> class Solution: def subsetsWithDup78(self, nums: List[int]) -> List[List[int]]: """78. 子集 数组元素互不相同""" <|body_0|> def subsetsWithDup(self, nums: List[int]) -> List[List[int]]: """90. 子集 II 存在重复元素 看成 n叉树,去重只去同一层的相同元素,同一树分支的元素不去重。 对于数组[2,2,3]比如第一层取2;3,2的下一层取2,3;3没有下一层""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def subsetsWithDup78(self, nums: List[int]) -> List[List[int]]: """78. 子集 数组元素互不相同""" res = [[]] for i in nums: temp = [] for j in res: temp.append(j + [i]) res += temp return res def subsetsWithDup(self, nums: ...
the_stack_v2_python_sparse
Array/Array_Subset_78_90.py
helloprogram6/leetcode_Cookbook_python
train
0
131112e81e163f00c063859972a8530cacee8fe3
[ "def back_track(left=1, curr=[]):\n if len(curr) == k:\n output.append(curr[:])\n for i in range(left, n + 1):\n curr.append(i)\n back_track(i + 1, curr)\n curr.pop()\noutput = []\nback_track()\nreturn output", "nums = list(range(1, k + 1)) + [n + 1]\nleft, output = (0, [])\nwhil...
<|body_start_0|> def back_track(left=1, curr=[]): if len(curr) == k: output.append(curr[:]) for i in range(left, n + 1): curr.append(i) back_track(i + 1, curr) curr.pop() output = [] back_track() retu...
Combination
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Combination: def combine(self, n: int, k: int) -> List[List[int]]: """Approach: Back Tracking (Recursion) Time Complexity: O(k * c`k ,n) Space Complexity: O(C`k ,n) :param n: :param k: :return:""" <|body_0|> def combine_(self, n: int, k: int) -> List[List[int]]: """A...
stack_v2_sparse_classes_10k_train_003029
1,490
no_license
[ { "docstring": "Approach: Back Tracking (Recursion) Time Complexity: O(k * c`k ,n) Space Complexity: O(C`k ,n) :param n: :param k: :return:", "name": "combine", "signature": "def combine(self, n: int, k: int) -> List[List[int]]" }, { "docstring": "Approach: Lexicographic (binary) sorted combinat...
2
null
Implement the Python class `Combination` described below. Class description: Implement the Combination class. Method signatures and docstrings: - def combine(self, n: int, k: int) -> List[List[int]]: Approach: Back Tracking (Recursion) Time Complexity: O(k * c`k ,n) Space Complexity: O(C`k ,n) :param n: :param k: :re...
Implement the Python class `Combination` described below. Class description: Implement the Combination class. Method signatures and docstrings: - def combine(self, n: int, k: int) -> List[List[int]]: Approach: Back Tracking (Recursion) Time Complexity: O(k * c`k ,n) Space Complexity: O(C`k ,n) :param n: :param k: :re...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class Combination: def combine(self, n: int, k: int) -> List[List[int]]: """Approach: Back Tracking (Recursion) Time Complexity: O(k * c`k ,n) Space Complexity: O(C`k ,n) :param n: :param k: :return:""" <|body_0|> def combine_(self, n: int, k: int) -> List[List[int]]: """A...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Combination: def combine(self, n: int, k: int) -> List[List[int]]: """Approach: Back Tracking (Recursion) Time Complexity: O(k * c`k ,n) Space Complexity: O(C`k ,n) :param n: :param k: :return:""" def back_track(left=1, curr=[]): if len(curr) == k: output.append(cur...
the_stack_v2_python_sparse
data_structures/combinations.py
Shiv2157k/leet_code
train
1
a322709883ba2162eda57f91394f82336c53fa2e
[ "cur = 0\ncount = 1\nwhile cur < len(chars) - 1:\n if chars[cur] == chars[cur + 1]:\n chars.pop(cur + 1)\n count += 1\n elif count > 1:\n tmp = list(str(count))\n for i in range(len(tmp)):\n chars.insert(cur + 1 + i, tmp[i])\n cur += len(tmp) + 1\n count = ...
<|body_start_0|> cur = 0 count = 1 while cur < len(chars) - 1: if chars[cur] == chars[cur + 1]: chars.pop(cur + 1) count += 1 elif count > 1: tmp = list(str(count)) for i in range(len(tmp)): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def compress(self, chars): """1个字符保持不动 2个以上连续字符以字符,出现次数代替 :type chars: List[str] :rtype: int""" <|body_0|> def compress2(self, chars): """1个字符保持不动 2个以上连续字符以字符,出现次数代替 :type chars: List[str] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_10k_train_003030
2,481
no_license
[ { "docstring": "1个字符保持不动 2个以上连续字符以字符,出现次数代替 :type chars: List[str] :rtype: int", "name": "compress", "signature": "def compress(self, chars)" }, { "docstring": "1个字符保持不动 2个以上连续字符以字符,出现次数代替 :type chars: List[str] :rtype: int", "name": "compress2", "signature": "def compress2(self, chars)"...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def compress(self, chars): 1个字符保持不动 2个以上连续字符以字符,出现次数代替 :type chars: List[str] :rtype: int - def compress2(self, chars): 1个字符保持不动 2个以上连续字符以字符,出现次数代替 :type chars: List[str] :rtype:...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def compress(self, chars): 1个字符保持不动 2个以上连续字符以字符,出现次数代替 :type chars: List[str] :rtype: int - def compress2(self, chars): 1个字符保持不动 2个以上连续字符以字符,出现次数代替 :type chars: List[str] :rtype:...
5d3574ccd282d0146c83c286ae28d8baaabd4910
<|skeleton|> class Solution: def compress(self, chars): """1个字符保持不动 2个以上连续字符以字符,出现次数代替 :type chars: List[str] :rtype: int""" <|body_0|> def compress2(self, chars): """1个字符保持不动 2个以上连续字符以字符,出现次数代替 :type chars: List[str] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def compress(self, chars): """1个字符保持不动 2个以上连续字符以字符,出现次数代替 :type chars: List[str] :rtype: int""" cur = 0 count = 1 while cur < len(chars) - 1: if chars[cur] == chars[cur + 1]: chars.pop(cur + 1) count += 1 elif co...
the_stack_v2_python_sparse
443_压缩字符串.py
lovehhf/LeetCode
train
0
f7d6686031f610de07d5bb71ea5e0ab711b20d2b
[ "if not is_administrator(self.context['request'].user):\n raise serializers.ValidationError(constants.PERMISSION_ADMINISTRATOR_REQUIRED)\nreturn data", "if is_vendors(user):\n raise serializers.ValidationError('User already has vendors permissions')\nreturn user" ]
<|body_start_0|> if not is_administrator(self.context['request'].user): raise serializers.ValidationError(constants.PERMISSION_ADMINISTRATOR_REQUIRED) return data <|end_body_0|> <|body_start_1|> if is_vendors(user): raise serializers.ValidationError('User already has ven...
ModeratorSerializerCreate
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModeratorSerializerCreate: def validate(self, data): """Administrator permissions needed""" <|body_0|> def validate_user(self, user): """Ensure user is not already moderator or higher""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not is_adminis...
stack_v2_sparse_classes_10k_train_003031
1,137
no_license
[ { "docstring": "Administrator permissions needed", "name": "validate", "signature": "def validate(self, data)" }, { "docstring": "Ensure user is not already moderator or higher", "name": "validate_user", "signature": "def validate_user(self, user)" } ]
2
stack_v2_sparse_classes_30k_train_007336
Implement the Python class `ModeratorSerializerCreate` described below. Class description: Implement the ModeratorSerializerCreate class. Method signatures and docstrings: - def validate(self, data): Administrator permissions needed - def validate_user(self, user): Ensure user is not already moderator or higher
Implement the Python class `ModeratorSerializerCreate` described below. Class description: Implement the ModeratorSerializerCreate class. Method signatures and docstrings: - def validate(self, data): Administrator permissions needed - def validate_user(self, user): Ensure user is not already moderator or higher <|sk...
d17fcc79b175831bae9c2e0a3a536a384b1a562b
<|skeleton|> class ModeratorSerializerCreate: def validate(self, data): """Administrator permissions needed""" <|body_0|> def validate_user(self, user): """Ensure user is not already moderator or higher""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ModeratorSerializerCreate: def validate(self, data): """Administrator permissions needed""" if not is_administrator(self.context['request'].user): raise serializers.ValidationError(constants.PERMISSION_ADMINISTRATOR_REQUIRED) return data def validate_user(self, user): ...
the_stack_v2_python_sparse
app/users/serializers/vendors.py
Empire-Synergy-Solutions/Altaviz_Backend
train
0
3d7e2b462da93f154c994a3fa4ef3ebe2f4a3ae8
[ "self.stored = None\nself.indexed = None\nself.description = None\nself.data_type = None\nself.name = None\nreplace_names = {'stored': 'stored', 'indexed': 'indexed', 'description': 'description', 'dataType': 'data_type', 'name': 'name'}\nif kwargs is not None:\n for key in kwargs:\n if key in replace_nam...
<|body_start_0|> self.stored = None self.indexed = None self.description = None self.data_type = None self.name = None replace_names = {'stored': 'stored', 'indexed': 'indexed', 'description': 'description', 'dataType': 'data_type', 'name': 'name'} if kwargs is no...
Implementation of the 'Occurrence_indexed_fields_Response' model. Occurrence_indexed_fields_Response Attributes: stored (bool): stored indexed (bool): indexed description (string): description data_type (string): dataType name (string): name
OccurrenceIndexedFieldsResponse
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OccurrenceIndexedFieldsResponse: """Implementation of the 'Occurrence_indexed_fields_Response' model. Occurrence_indexed_fields_Response Attributes: stored (bool): stored indexed (bool): indexed description (string): description data_type (string): dataType name (string): name""" def __init_...
stack_v2_sparse_classes_10k_train_003032
3,103
no_license
[ { "docstring": "Constructor for the OccurrenceIndexedFieldsResponse class Args: **kwargs: Keyword Arguments in order to initialise the object. Any of the attributes in this object are able to be set through the **kwargs of the constructor. The values that can be supplied and their types are as follows:: stored ...
2
stack_v2_sparse_classes_30k_train_005895
Implement the Python class `OccurrenceIndexedFieldsResponse` described below. Class description: Implementation of the 'Occurrence_indexed_fields_Response' model. Occurrence_indexed_fields_Response Attributes: stored (bool): stored indexed (bool): indexed description (string): description data_type (string): dataType ...
Implement the Python class `OccurrenceIndexedFieldsResponse` described below. Class description: Implementation of the 'Occurrence_indexed_fields_Response' model. Occurrence_indexed_fields_Response Attributes: stored (bool): stored indexed (bool): indexed description (string): description data_type (string): dataType ...
a9f803ea42bef4eb3720d5dd92a53dc98e8f2678
<|skeleton|> class OccurrenceIndexedFieldsResponse: """Implementation of the 'Occurrence_indexed_fields_Response' model. Occurrence_indexed_fields_Response Attributes: stored (bool): stored indexed (bool): indexed description (string): description data_type (string): dataType name (string): name""" def __init_...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class OccurrenceIndexedFieldsResponse: """Implementation of the 'Occurrence_indexed_fields_Response' model. Occurrence_indexed_fields_Response Attributes: stored (bool): stored indexed (bool): indexed description (string): description data_type (string): dataType name (string): name""" def __init__(self, **kwa...
the_stack_v2_python_sparse
AtlasOfLivingAustraliaOccurrencesLib/Models/OccurrenceIndexedFieldsResponse.py
chm052/naturehack
train
2
554b788837ee12faadfb83dbfd911477862c8604
[ "super().__init__()\ntext = text or PADDING_TEXT\nself.text_tokens = text.split()\nif special_end_token is not None:\n self.text_tokens.append(special_end_token)\nself.text_len = len(self.text_tokens)", "transformed_sentences = []\ntransformed_target_ids = []\nfor sentence, target_id in zip(sentences, target_i...
<|body_start_0|> super().__init__() text = text or PADDING_TEXT self.text_tokens = text.split() if special_end_token is not None: self.text_tokens.append(special_end_token) self.text_len = len(self.text_tokens) <|end_body_0|> <|body_start_1|> transformed_sent...
PadTextPreprocessor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PadTextPreprocessor: def __init__(self, text: Optional[str]=None, special_end_token: Optional[str]=None): """Preprocessor that pads original sentence with some pre-defined text. Args: text: text that would be padded to the original sentence. special_end_token: this token would be added r...
stack_v2_sparse_classes_10k_train_003033
9,230
permissive
[ { "docstring": "Preprocessor that pads original sentence with some pre-defined text. Args: text: text that would be padded to the original sentence. special_end_token: this token would be added right at the end of a tokenized text, e.g. <eod> for XLNet.", "name": "__init__", "signature": "def __init__(s...
2
stack_v2_sparse_classes_30k_train_005244
Implement the Python class `PadTextPreprocessor` described below. Class description: Implement the PadTextPreprocessor class. Method signatures and docstrings: - def __init__(self, text: Optional[str]=None, special_end_token: Optional[str]=None): Preprocessor that pads original sentence with some pre-defined text. Ar...
Implement the Python class `PadTextPreprocessor` described below. Class description: Implement the PadTextPreprocessor class. Method signatures and docstrings: - def __init__(self, text: Optional[str]=None, special_end_token: Optional[str]=None): Preprocessor that pads original sentence with some pre-defined text. Ar...
c87f67e5fe51fc8307b5d5ff8f404f202f17ab5e
<|skeleton|> class PadTextPreprocessor: def __init__(self, text: Optional[str]=None, special_end_token: Optional[str]=None): """Preprocessor that pads original sentence with some pre-defined text. Args: text: text that would be padded to the original sentence. special_end_token: this token would be added r...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PadTextPreprocessor: def __init__(self, text: Optional[str]=None, special_end_token: Optional[str]=None): """Preprocessor that pads original sentence with some pre-defined text. Args: text: text that would be padded to the original sentence. special_end_token: this token would be added right at the en...
the_stack_v2_python_sparse
lexsubgen/pre_processors/base_preprocessors.py
agoel00/LexSubGen
train
0
0361320c7de07ad261f2fea08a05f3f5cb605d02
[ "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.
FederatedLearningServicer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FederatedLearningServicer: """Missing associated documentation comment in .proto file.""" def GetJob(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def GetTensorRecord(self, request, context): """Missing associa...
stack_v2_sparse_classes_10k_train_003034
7,291
permissive
[ { "docstring": "Missing associated documentation comment in .proto file.", "name": "GetJob", "signature": "def GetJob(self, request, context)" }, { "docstring": "Missing associated documentation comment in .proto file.", "name": "GetTensorRecord", "signature": "def GetTensorRecord(self, ...
4
stack_v2_sparse_classes_30k_train_000083
Implement the Python class `FederatedLearningServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def GetJob(self, request, context): Missing associated documentation comment in .proto file. - def GetTensorRecord(self, request, cont...
Implement the Python class `FederatedLearningServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def GetJob(self, request, context): Missing associated documentation comment in .proto file. - def GetTensorRecord(self, request, cont...
1223619661f82733b5d66f8901cac7f16002c610
<|skeleton|> class FederatedLearningServicer: """Missing associated documentation comment in .proto file.""" def GetJob(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def GetTensorRecord(self, request, context): """Missing associa...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FederatedLearningServicer: """Missing associated documentation comment in .proto file.""" def GetJob(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
src/appfl/protos/federated_learning_pb2_grpc.py
APPFL/APPFL
train
39
4a0dc7be60ff96c3a52cde3d05cd70679b6f8b20
[ "self.domain = domain\nself.ip = ip\nself.ucenter = ucenter\nself.user = user\nself.password = password\nself.server = Server(self.ip, get_info=ALL)\nself.conn = Connection(self.server, user=self.domain + '\\\\' + self.user, password=self.password, auto_bind=True, authentication=NTLM)", "att_list = ['displayName'...
<|body_start_0|> self.domain = domain self.ip = ip self.ucenter = ucenter self.user = user self.password = password self.server = Server(self.ip, get_info=ALL) self.conn = Connection(self.server, user=self.domain + '\\' + self.user, password=self.password, auto_bi...
AD域操作
Adoper
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Adoper: """AD域操作""" def __init__(self, domain, ip, ucenter, user, password): """:param domain:域名,格式为xxx.xxx.xxx :param ip:服务器地址,格式为域名xxx.xxx.xxx :param user:管理账户 :param password:密码 :param basedn:""" <|body_0|> def searchuser(self, orgunit): """:param orgunit: 组织单...
stack_v2_sparse_classes_10k_train_003035
4,132
no_license
[ { "docstring": ":param domain:域名,格式为xxx.xxx.xxx :param ip:服务器地址,格式为域名xxx.xxx.xxx :param user:管理账户 :param password:密码 :param basedn:", "name": "__init__", "signature": "def __init__(self, domain, ip, ucenter, user, password)" }, { "docstring": ":param orgunit: 组织单元名,格式为aaa.bbb 即bbb组织下的aaa组织,不包含域地...
4
stack_v2_sparse_classes_30k_train_006960
Implement the Python class `Adoper` described below. Class description: AD域操作 Method signatures and docstrings: - def __init__(self, domain, ip, ucenter, user, password): :param domain:域名,格式为xxx.xxx.xxx :param ip:服务器地址,格式为域名xxx.xxx.xxx :param user:管理账户 :param password:密码 :param basedn: - def searchuser(self, orgunit)...
Implement the Python class `Adoper` described below. Class description: AD域操作 Method signatures and docstrings: - def __init__(self, domain, ip, ucenter, user, password): :param domain:域名,格式为xxx.xxx.xxx :param ip:服务器地址,格式为域名xxx.xxx.xxx :param user:管理账户 :param password:密码 :param basedn: - def searchuser(self, orgunit)...
2a733b34f337d4497051660f473a4cfb977fc15b
<|skeleton|> class Adoper: """AD域操作""" def __init__(self, domain, ip, ucenter, user, password): """:param domain:域名,格式为xxx.xxx.xxx :param ip:服务器地址,格式为域名xxx.xxx.xxx :param user:管理账户 :param password:密码 :param basedn:""" <|body_0|> def searchuser(self, orgunit): """:param orgunit: 组织单...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Adoper: """AD域操作""" def __init__(self, domain, ip, ucenter, user, password): """:param domain:域名,格式为xxx.xxx.xxx :param ip:服务器地址,格式为域名xxx.xxx.xxx :param user:管理账户 :param password:密码 :param basedn:""" self.domain = domain self.ip = ip self.ucenter = ucenter self.user...
the_stack_v2_python_sparse
VMwareAutoApi/kdldapapi/ldaptool/adoper.py
vkhaibao/PyProject
train
1
e51ea1e9cd9459421b9e5b847dc1dee6ceae7584
[ "count = [0] * 32\nfor num in nums:\n k = 0\n while k < 32:\n count[k] += num >> k & 1\n k += 1\nres = 0\nfor i in range(32):\n res += count[i] % 3 * 2 ** i\nreturn res", "ones, twos = (0, 0)\nfor num in nums:\n ones = (ones ^ num) & ~twos\n twos = (twos ^ num) & ~ones\nreturn ones" ]
<|body_start_0|> count = [0] * 32 for num in nums: k = 0 while k < 32: count[k] += num >> k & 1 k += 1 res = 0 for i in range(32): res += count[i] % 3 * 2 ** i return res <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findNumberAppearingOnce(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def findNumberAppearingOnce_2(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> count = [0] * 32 ...
stack_v2_sparse_classes_10k_train_003036
1,038
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "findNumberAppearingOnce", "signature": "def findNumberAppearingOnce(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "findNumberAppearingOnce_2", "signature": "def findNumberAppearingOnce_2(self, nums...
2
stack_v2_sparse_classes_30k_train_005698
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findNumberAppearingOnce(self, nums): :type nums: List[int] :rtype: int - def findNumberAppearingOnce_2(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findNumberAppearingOnce(self, nums): :type nums: List[int] :rtype: int - def findNumberAppearingOnce_2(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solu...
967b0fbb40ae491b552bc3365a481e66324cb6f2
<|skeleton|> class Solution: def findNumberAppearingOnce(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def findNumberAppearingOnce_2(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def findNumberAppearingOnce(self, nums): """:type nums: List[int] :rtype: int""" count = [0] * 32 for num in nums: k = 0 while k < 32: count[k] += num >> k & 1 k += 1 res = 0 for i in range(32): ...
the_stack_v2_python_sparse
jianzhi_offer/52_数组中唯一只出现一次的数字.py
ryanatgz/data_structure_and_algorithm
train
0
0f6b7d1c823356ec6c03f157a711a2d26bc7a735
[ "if not quota_max_calls:\n use_rate_limiter = False\nself._billing_accounts = None\nself._projects = None\nsuper(CloudBillingRepositoryClient, self).__init__(API_NAME, versions=['v1'], quota_max_calls=quota_max_calls, quota_period=quota_period, use_rate_limiter=use_rate_limiter)", "if not self._billing_account...
<|body_start_0|> if not quota_max_calls: use_rate_limiter = False self._billing_accounts = None self._projects = None super(CloudBillingRepositoryClient, self).__init__(API_NAME, versions=['v1'], quota_max_calls=quota_max_calls, quota_period=quota_period, use_rate_limiter=use...
Cloud Billing API Respository.
CloudBillingRepositoryClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CloudBillingRepositoryClient: """Cloud Billing API Respository.""" def __init__(self, quota_max_calls=None, quota_period=60.0, use_rate_limiter=True): """Constructor. Args: quota_max_calls (int): Allowed requests per <quota_period> for the API. quota_period (float): The time period t...
stack_v2_sparse_classes_10k_train_003037
10,503
permissive
[ { "docstring": "Constructor. Args: quota_max_calls (int): Allowed requests per <quota_period> for the API. quota_period (float): The time period to track requests over. use_rate_limiter (bool): Set to false to disable the use of a rate limiter for this service.", "name": "__init__", "signature": "def __...
3
stack_v2_sparse_classes_30k_train_005796
Implement the Python class `CloudBillingRepositoryClient` described below. Class description: Cloud Billing API Respository. Method signatures and docstrings: - def __init__(self, quota_max_calls=None, quota_period=60.0, use_rate_limiter=True): Constructor. Args: quota_max_calls (int): Allowed requests per <quota_per...
Implement the Python class `CloudBillingRepositoryClient` described below. Class description: Cloud Billing API Respository. Method signatures and docstrings: - def __init__(self, quota_max_calls=None, quota_period=60.0, use_rate_limiter=True): Constructor. Args: quota_max_calls (int): Allowed requests per <quota_per...
d4421afa50a17ed47cbebe942044ebab3720e0f5
<|skeleton|> class CloudBillingRepositoryClient: """Cloud Billing API Respository.""" def __init__(self, quota_max_calls=None, quota_period=60.0, use_rate_limiter=True): """Constructor. Args: quota_max_calls (int): Allowed requests per <quota_period> for the API. quota_period (float): The time period t...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CloudBillingRepositoryClient: """Cloud Billing API Respository.""" def __init__(self, quota_max_calls=None, quota_period=60.0, use_rate_limiter=True): """Constructor. Args: quota_max_calls (int): Allowed requests per <quota_period> for the API. quota_period (float): The time period to track reque...
the_stack_v2_python_sparse
google/cloud/forseti/common/gcp_api/cloudbilling.py
kevensen/forseti-security
train
1
43f4401333a2c6925e613b0fb2670df654547cc2
[ "self.offer_listing_id = offer_listing_id\nself.price = price\nself.sale_price = sale_price\nself.amount_saved = amount_saved\nself.percentage_saved = percentage_saved\nself.availability = availability\nself.availability_attributes = availability_attributes\nself.is_eligible_for_super_saver_shipping = is_eligible_f...
<|body_start_0|> self.offer_listing_id = offer_listing_id self.price = price self.sale_price = sale_price self.amount_saved = amount_saved self.percentage_saved = percentage_saved self.availability = availability self.availability_attributes = availability_attribu...
Implementation of the 'OfferListing' model. TODO: type model description here. Attributes: offer_listing_id (string): TODO: type description here. price (Price): TODO: type description here. sale_price (Price): TODO: type description here. amount_saved (Price): TODO: type description here. percentage_saved (int): TODO:...
OfferListing
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OfferListing: """Implementation of the 'OfferListing' model. TODO: type model description here. Attributes: offer_listing_id (string): TODO: type description here. price (Price): TODO: type description here. sale_price (Price): TODO: type description here. amount_saved (Price): TODO: type descrip...
stack_v2_sparse_classes_10k_train_003038
4,415
permissive
[ { "docstring": "Constructor for the OfferListing class", "name": "__init__", "signature": "def __init__(self, offer_listing_id=None, price=None, sale_price=None, amount_saved=None, percentage_saved=None, availability=None, availability_attributes=None, is_eligible_for_super_saver_shipping=None, is_eligi...
2
stack_v2_sparse_classes_30k_train_003542
Implement the Python class `OfferListing` described below. Class description: Implementation of the 'OfferListing' model. TODO: type model description here. Attributes: offer_listing_id (string): TODO: type description here. price (Price): TODO: type description here. sale_price (Price): TODO: type description here. a...
Implement the Python class `OfferListing` described below. Class description: Implementation of the 'OfferListing' model. TODO: type model description here. Attributes: offer_listing_id (string): TODO: type description here. price (Price): TODO: type description here. sale_price (Price): TODO: type description here. a...
26ea1019115a1de3b1b37a4b830525e164ac55ce
<|skeleton|> class OfferListing: """Implementation of the 'OfferListing' model. TODO: type model description here. Attributes: offer_listing_id (string): TODO: type description here. price (Price): TODO: type description here. sale_price (Price): TODO: type description here. amount_saved (Price): TODO: type descrip...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class OfferListing: """Implementation of the 'OfferListing' model. TODO: type model description here. Attributes: offer_listing_id (string): TODO: type description here. price (Price): TODO: type description here. sale_price (Price): TODO: type description here. amount_saved (Price): TODO: type description here. pe...
the_stack_v2_python_sparse
awsecommerceservice/models/offer_listing.py
nidaizamir/Test-PY
train
0
26248d8cfa9c6560e0d2d720c690751411c8fe8d
[ "if obj == cls.OFF:\n return dataset_options_pb2.AutoShardPolicy.OFF\nif obj == cls.FILE:\n return dataset_options_pb2.AutoShardPolicy.FILE\nif obj == cls.DATA:\n return dataset_options_pb2.AutoShardPolicy.DATA\nif obj == cls.AUTO:\n return dataset_options_pb2.AutoShardPolicy.AUTO\nif obj == cls.HINT:\n...
<|body_start_0|> if obj == cls.OFF: return dataset_options_pb2.AutoShardPolicy.OFF if obj == cls.FILE: return dataset_options_pb2.AutoShardPolicy.FILE if obj == cls.DATA: return dataset_options_pb2.AutoShardPolicy.DATA if obj == cls.AUTO: r...
Represents the type of auto-sharding to use. OFF: No sharding will be performed. AUTO: Attempts FILE-based sharding, falling back to DATA-based sharding. FILE: Shards by input files (i.e. each worker will get a set of files to process). When this option is selected, make sure that there is at least as many files as wor...
AutoShardPolicy
[ "MIT", "Apache-2.0", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AutoShardPolicy: """Represents the type of auto-sharding to use. OFF: No sharding will be performed. AUTO: Attempts FILE-based sharding, falling back to DATA-based sharding. FILE: Shards by input files (i.e. each worker will get a set of files to process). When this option is selected, make sure ...
stack_v2_sparse_classes_10k_train_003039
6,002
permissive
[ { "docstring": "Convert enum to proto.", "name": "_to_proto", "signature": "def _to_proto(cls, obj)" }, { "docstring": "Convert proto to enum.", "name": "_from_proto", "signature": "def _from_proto(cls, pb)" } ]
2
null
Implement the Python class `AutoShardPolicy` described below. Class description: Represents the type of auto-sharding to use. OFF: No sharding will be performed. AUTO: Attempts FILE-based sharding, falling back to DATA-based sharding. FILE: Shards by input files (i.e. each worker will get a set of files to process). W...
Implement the Python class `AutoShardPolicy` described below. Class description: Represents the type of auto-sharding to use. OFF: No sharding will be performed. AUTO: Attempts FILE-based sharding, falling back to DATA-based sharding. FILE: Shards by input files (i.e. each worker will get a set of files to process). W...
085b20a4b6287eff8c0b792425d52422ab8cbab3
<|skeleton|> class AutoShardPolicy: """Represents the type of auto-sharding to use. OFF: No sharding will be performed. AUTO: Attempts FILE-based sharding, falling back to DATA-based sharding. FILE: Shards by input files (i.e. each worker will get a set of files to process). When this option is selected, make sure ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AutoShardPolicy: """Represents the type of auto-sharding to use. OFF: No sharding will be performed. AUTO: Attempts FILE-based sharding, falling back to DATA-based sharding. FILE: Shards by input files (i.e. each worker will get a set of files to process). When this option is selected, make sure that there is...
the_stack_v2_python_sparse
tensorflow/python/data/experimental/ops/distribute_options.py
graphcore/tensorflow
train
84
3545980521045371b3059e93e736b3eff2fec254
[ "program, _ = create_program()\ncourse = program.course_set.first()\nenrollment = ProgramEnrollmentFactory.create(program=program)\ncurrent_run = ExamRunFactory.create(course=course, authorized=authorized)\npast_run = ExamRunFactory.create(course=course, scheduling_future=True, authorized=authorized)\nfuture_run = ...
<|body_start_0|> program, _ = create_program() course = program.course_set.first() enrollment = ProgramEnrollmentFactory.create(program=program) current_run = ExamRunFactory.create(course=course, authorized=authorized) past_run = ExamRunFactory.create(course=course, scheduling_fu...
Tests for ExamRun tasks
ExamRunTasksTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExamRunTasksTest: """Tests for ExamRun tasks""" def test_authorize_exam_runs(self, authorized, authorize_for_latest_passed_course_mock): """Test authorize_exam_runs()""" <|body_0|> def test_authorize_enrollment_for_exam_run(self, authorize_for_latest_passed_course_mock):...
stack_v2_sparse_classes_10k_train_003040
2,615
permissive
[ { "docstring": "Test authorize_exam_runs()", "name": "test_authorize_exam_runs", "signature": "def test_authorize_exam_runs(self, authorized, authorize_for_latest_passed_course_mock)" }, { "docstring": "Test authorize_enrollment_for_exam_run()", "name": "test_authorize_enrollment_for_exam_ru...
2
stack_v2_sparse_classes_30k_train_002694
Implement the Python class `ExamRunTasksTest` described below. Class description: Tests for ExamRun tasks Method signatures and docstrings: - def test_authorize_exam_runs(self, authorized, authorize_for_latest_passed_course_mock): Test authorize_exam_runs() - def test_authorize_enrollment_for_exam_run(self, authorize...
Implement the Python class `ExamRunTasksTest` described below. Class description: Tests for ExamRun tasks Method signatures and docstrings: - def test_authorize_exam_runs(self, authorized, authorize_for_latest_passed_course_mock): Test authorize_exam_runs() - def test_authorize_enrollment_for_exam_run(self, authorize...
d6564caca0b7bbfd31e67a751564107fd17d6eb0
<|skeleton|> class ExamRunTasksTest: """Tests for ExamRun tasks""" def test_authorize_exam_runs(self, authorized, authorize_for_latest_passed_course_mock): """Test authorize_exam_runs()""" <|body_0|> def test_authorize_enrollment_for_exam_run(self, authorize_for_latest_passed_course_mock):...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ExamRunTasksTest: """Tests for ExamRun tasks""" def test_authorize_exam_runs(self, authorized, authorize_for_latest_passed_course_mock): """Test authorize_exam_runs()""" program, _ = create_program() course = program.course_set.first() enrollment = ProgramEnrollmentFactory...
the_stack_v2_python_sparse
exams/tasks_test.py
mitodl/micromasters
train
35
ba3c984ded47887d4138f67bc8ba372b6dcc271c
[ "max_steps = max_steps or 0\nmax_episodes = max_episodes or 0\nif max_steps < 1 and max_episodes < 1:\n raise ValueError('Either `max_steps` or `max_episodes` should be greater than 0.')\nsuper(PyDriver, self).__init__(env, policy, observers, transition_observers, info_observers)\nself._max_steps = max_steps or ...
<|body_start_0|> max_steps = max_steps or 0 max_episodes = max_episodes or 0 if max_steps < 1 and max_episodes < 1: raise ValueError('Either `max_steps` or `max_episodes` should be greater than 0.') super(PyDriver, self).__init__(env, policy, observers, transition_observers, ...
A driver that runs a python policy in a python environment.
PyDriver
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PyDriver: """A driver that runs a python policy in a python environment.""" def __init__(self, env: py_environment.PyEnvironment, policy: py_policy.PyPolicy, observers: Sequence[Callable[[trajectory.Trajectory], Any]], transition_observers: Optional[Sequence[Callable[[trajectory.Transition],...
stack_v2_sparse_classes_10k_train_003041
6,250
permissive
[ { "docstring": "A driver that runs a python policy in a python environment. **Note** about bias when using batched environments with `max_episodes`: When using `max_episodes != None`, a `run` step \"finishes\" when `max_episodes` have been completely collected (hit a boundary). When used in conjunction with env...
2
null
Implement the Python class `PyDriver` described below. Class description: A driver that runs a python policy in a python environment. Method signatures and docstrings: - def __init__(self, env: py_environment.PyEnvironment, policy: py_policy.PyPolicy, observers: Sequence[Callable[[trajectory.Trajectory], Any]], trans...
Implement the Python class `PyDriver` described below. Class description: A driver that runs a python policy in a python environment. Method signatures and docstrings: - def __init__(self, env: py_environment.PyEnvironment, policy: py_policy.PyPolicy, observers: Sequence[Callable[[trajectory.Trajectory], Any]], trans...
eca1093d3a047e538f17f6ab92ab4d8144284f23
<|skeleton|> class PyDriver: """A driver that runs a python policy in a python environment.""" def __init__(self, env: py_environment.PyEnvironment, policy: py_policy.PyPolicy, observers: Sequence[Callable[[trajectory.Trajectory], Any]], transition_observers: Optional[Sequence[Callable[[trajectory.Transition],...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PyDriver: """A driver that runs a python policy in a python environment.""" def __init__(self, env: py_environment.PyEnvironment, policy: py_policy.PyPolicy, observers: Sequence[Callable[[trajectory.Trajectory], Any]], transition_observers: Optional[Sequence[Callable[[trajectory.Transition], Any]]]=None,...
the_stack_v2_python_sparse
tf_agents/drivers/py_driver.py
tensorflow/agents
train
2,755
8bc93f26d98afe5eeb1033d318cf01e700104187
[ "s1, t1 = (Counter(s), Counter(t))\ninter = t1 - s1\nreturn ''.join(inter.keys())", "s = ''.join(sorted(s))\nt = ''.join(sorted(t))\nfor i in range(len(s)):\n if s[i] != t[i]:\n return t[i]\nreturn t[-1]", "ans = 0\nfor c in s + t:\n ans ^= ord(c)\nreturn chr(ans)" ]
<|body_start_0|> s1, t1 = (Counter(s), Counter(t)) inter = t1 - s1 return ''.join(inter.keys()) <|end_body_0|> <|body_start_1|> s = ''.join(sorted(s)) t = ''.join(sorted(t)) for i in range(len(s)): if s[i] != t[i]: return t[i] return t...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findTheDifference(self, s, t): """:type s: str :type t: str :rtype: str""" <|body_0|> def findTheDifference2(self, s, t): """:type s: str :type t: str :rtype: str""" <|body_1|> def findTheDifference2(self, s, t): """:type s: str :ty...
stack_v2_sparse_classes_10k_train_003042
1,091
no_license
[ { "docstring": ":type s: str :type t: str :rtype: str", "name": "findTheDifference", "signature": "def findTheDifference(self, s, t)" }, { "docstring": ":type s: str :type t: str :rtype: str", "name": "findTheDifference2", "signature": "def findTheDifference2(self, s, t)" }, { "d...
3
stack_v2_sparse_classes_30k_train_004266
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findTheDifference(self, s, t): :type s: str :type t: str :rtype: str - def findTheDifference2(self, s, t): :type s: str :type t: str :rtype: str - def findTheDifference2(self...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findTheDifference(self, s, t): :type s: str :type t: str :rtype: str - def findTheDifference2(self, s, t): :type s: str :type t: str :rtype: str - def findTheDifference2(self...
0fc4c7af59246e3064db41989a45d9db413a624b
<|skeleton|> class Solution: def findTheDifference(self, s, t): """:type s: str :type t: str :rtype: str""" <|body_0|> def findTheDifference2(self, s, t): """:type s: str :type t: str :rtype: str""" <|body_1|> def findTheDifference2(self, s, t): """:type s: str :ty...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def findTheDifference(self, s, t): """:type s: str :type t: str :rtype: str""" s1, t1 = (Counter(s), Counter(t)) inter = t1 - s1 return ''.join(inter.keys()) def findTheDifference2(self, s, t): """:type s: str :type t: str :rtype: str""" s = ''.jo...
the_stack_v2_python_sparse
389. Find the Difference/difference.py
Macielyoung/LeetCode
train
1
2f100a8f47a6ef7bec868f944c9126b5b7ece87c
[ "assert len(phases) == len(components), 'phases and components should be of same length'\nself.phases = phases\nself.components = components\nself.t_pres = t_pres\nself.t_posts = t_posts\nself.fmin = fmin\nself.fmax = fmax\nself.zerophase = zerophase\nself.dt = dt\nself.tstars = tstars\nself.sigmas = sigmas\nself.b...
<|body_start_0|> assert len(phases) == len(components), 'phases and components should be of same length' self.phases = phases self.components = components self.t_pres = t_pres self.t_posts = t_posts self.fmin = fmin self.fmax = fmax self.zerophase = zeroph...
This class does source (SRC) and structure (STR) inversion
SRC_STR
[ "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SRC_STR: """This class does source (SRC) and structure (STR) inversion""" def __init__(self, binary_file_path: str, prior_dat_filepath: str, save_folder: str, phases: [str], components: [str], t_pres: [float], t_posts: [float], vpvs: bool, depth: bool, dt: [float], sigmas: [float], tstars: [...
stack_v2_sparse_classes_10k_train_003043
22,015
permissive
[ { "docstring": "If vpvs and depth are both True (depth and vpvs are both inverted) :param binary_path: path to reflectivity code binary file :param prior_dat_filepath: path to your initial (prior) crfl.dat file :param save_folder: save folder :param phases: phases to be windowed :param components: on which comp...
3
stack_v2_sparse_classes_30k_train_004798
Implement the Python class `SRC_STR` described below. Class description: This class does source (SRC) and structure (STR) inversion Method signatures and docstrings: - def __init__(self, binary_file_path: str, prior_dat_filepath: str, save_folder: str, phases: [str], components: [str], t_pres: [float], t_posts: [floa...
Implement the Python class `SRC_STR` described below. Class description: This class does source (SRC) and structure (STR) inversion Method signatures and docstrings: - def __init__(self, binary_file_path: str, prior_dat_filepath: str, save_folder: str, phases: [str], components: [str], t_pres: [float], t_posts: [floa...
2632214f7df9caaa53d33432193ba0602470d21a
<|skeleton|> class SRC_STR: """This class does source (SRC) and structure (STR) inversion""" def __init__(self, binary_file_path: str, prior_dat_filepath: str, save_folder: str, phases: [str], components: [str], t_pres: [float], t_posts: [float], vpvs: bool, depth: bool, dt: [float], sigmas: [float], tstars: [...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SRC_STR: """This class does source (SRC) and structure (STR) inversion""" def __init__(self, binary_file_path: str, prior_dat_filepath: str, save_folder: str, phases: [str], components: [str], t_pres: [float], t_posts: [float], vpvs: bool, depth: bool, dt: [float], sigmas: [float], tstars: [float]=None, ...
the_stack_v2_python_sparse
SS_MTI/Gradient.py
nienkebrinkman/SS_MTI
train
0
9d6d95f62b7b9f14d0b42b2f7b90d8d9224c1446
[ "self._config = config\nself._optimizer_config = config.optimizer.get()\nself._optimizer_type = config.optimizer.type\nif self._optimizer_config is None:\n raise ValueError('Optimizer type must be specified')\nself._lr_config = config.learning_rate.get()\nself._lr_type = config.learning_rate.type\nself._warmup_c...
<|body_start_0|> self._config = config self._optimizer_config = config.optimizer.get() self._optimizer_type = config.optimizer.type if self._optimizer_config is None: raise ValueError('Optimizer type must be specified') self._lr_config = config.learning_rate.get() ...
Optimizer factory class. This class builds learning rate and optimizer based on an optimization config. To use this class, you need to do the following: (1) Define optimization config, this includes optimizer, and learning rate schedule. (2) Initialize the class using the optimization config. (3) Build learning rate. (...
OptimizerFactory
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OptimizerFactory: """Optimizer factory class. This class builds learning rate and optimizer based on an optimization config. To use this class, you need to do the following: (1) Define optimization config, this includes optimizer, and learning rate schedule. (2) Initialize the class using the opt...
stack_v2_sparse_classes_10k_train_003044
4,835
permissive
[ { "docstring": "Initializing OptimizerFactory. Args: config: OptimizationConfig instance contain optimization config.", "name": "__init__", "signature": "def __init__(self, config: opt_cfg.OptimizationConfig)" }, { "docstring": "Build learning rate. Builds learning rate from config. Learning rat...
3
stack_v2_sparse_classes_30k_train_003616
Implement the Python class `OptimizerFactory` described below. Class description: Optimizer factory class. This class builds learning rate and optimizer based on an optimization config. To use this class, you need to do the following: (1) Define optimization config, this includes optimizer, and learning rate schedule....
Implement the Python class `OptimizerFactory` described below. Class description: Optimizer factory class. This class builds learning rate and optimizer based on an optimization config. To use this class, you need to do the following: (1) Define optimization config, this includes optimizer, and learning rate schedule....
ad48842549b61e171254cf4a895239022ef509d4
<|skeleton|> class OptimizerFactory: """Optimizer factory class. This class builds learning rate and optimizer based on an optimization config. To use this class, you need to do the following: (1) Define optimization config, this includes optimizer, and learning rate schedule. (2) Initialize the class using the opt...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class OptimizerFactory: """Optimizer factory class. This class builds learning rate and optimizer based on an optimization config. To use this class, you need to do the following: (1) Define optimization config, this includes optimizer, and learning rate schedule. (2) Initialize the class using the optimization con...
the_stack_v2_python_sparse
ImageClassification-Resnet_50/TensorFlow2/source/resnet/include/modeling/optimization/optimizer_factory.py
tbd-ai/tbd-suite
train
51
d11d8dcf65bca64afdb191aa0f74f6bb242330fd
[ "DebugObject.__init__(self, 'AntialiasingManager')\nself.pipeline = pipeline\nself.jitter = False\nself.jitterOffsets = []\nself.jitterIndex = 0\nself.jitterPTA = PTAVecBase2f.emptyArray(1)\nself.create()", "technique = self.pipeline.settings.antialiasingTechnique\nif technique not in self.availableTechniques:\n ...
<|body_start_0|> DebugObject.__init__(self, 'AntialiasingManager') self.pipeline = pipeline self.jitter = False self.jitterOffsets = [] self.jitterIndex = 0 self.jitterPTA = PTAVecBase2f.emptyArray(1) self.create() <|end_body_0|> <|body_start_1|> techniqu...
The Antialiasing Manager handles the setup of the antialiasing passes, if antialiasing is defined in the settings. It also handles jittering when using a temporal antialiasing technique like SMAA. When jittering is enabled, the frame is moved by half a pixel up/down every second frame, and then merged with the previous...
AntialiasingManager
[ "WTFPL" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AntialiasingManager: """The Antialiasing Manager handles the setup of the antialiasing passes, if antialiasing is defined in the settings. It also handles jittering when using a temporal antialiasing technique like SMAA. When jittering is enabled, the frame is moved by half a pixel up/down every ...
stack_v2_sparse_classes_10k_train_003045
3,455
permissive
[ { "docstring": "Creates the manager and directly setups the passes", "name": "__init__", "signature": "def __init__(self, pipeline)" }, { "docstring": "Setups the antialiasing passes, and also computes the jitter offsets", "name": "create", "signature": "def create(self)" }, { "d...
3
stack_v2_sparse_classes_30k_train_000080
Implement the Python class `AntialiasingManager` described below. Class description: The Antialiasing Manager handles the setup of the antialiasing passes, if antialiasing is defined in the settings. It also handles jittering when using a temporal antialiasing technique like SMAA. When jittering is enabled, the frame ...
Implement the Python class `AntialiasingManager` described below. Class description: The Antialiasing Manager handles the setup of the antialiasing passes, if antialiasing is defined in the settings. It also handles jittering when using a temporal antialiasing technique like SMAA. When jittering is enabled, the frame ...
12131b115775f97927633d71832af65b99eebd09
<|skeleton|> class AntialiasingManager: """The Antialiasing Manager handles the setup of the antialiasing passes, if antialiasing is defined in the settings. It also handles jittering when using a temporal antialiasing technique like SMAA. When jittering is enabled, the frame is moved by half a pixel up/down every ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AntialiasingManager: """The Antialiasing Manager handles the setup of the antialiasing passes, if antialiasing is defined in the settings. It also handles jittering when using a temporal antialiasing technique like SMAA. When jittering is enabled, the frame is moved by half a pixel up/down every second frame,...
the_stack_v2_python_sparse
Code/AntialiasingManager.py
2lost4u/RenderPipeline
train
1
6f91d47659a9ec242d4cb42f02a6de6f1b296116
[ "table_object = Tag.query.get_or_404(int_id)\nform = TagForm(obj=table_object)\ntemplate_return = flask.render_template('edit.html', form=form)\nreturn template_return", "table_object = Tag.query.get_or_404(int_id)\nform = TagForm(obj=table_object)\nif form.validate_on_submit():\n form.populate_obj(table_objec...
<|body_start_0|> table_object = Tag.query.get_or_404(int_id) form = TagForm(obj=table_object) template_return = flask.render_template('edit.html', form=form) return template_return <|end_body_0|> <|body_start_1|> table_object = Tag.query.get_or_404(int_id) form = TagForm...
EditTagResource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EditTagResource: def get(self, int_id): """Args: int_id: Returns:""" <|body_0|> def post(self, int_id): """Args: int_id: Returns:""" <|body_1|> <|end_skeleton|> <|body_start_0|> table_object = Tag.query.get_or_404(int_id) form = TagForm(obj=...
stack_v2_sparse_classes_10k_train_003046
3,873
no_license
[ { "docstring": "Args: int_id: Returns:", "name": "get", "signature": "def get(self, int_id)" }, { "docstring": "Args: int_id: Returns:", "name": "post", "signature": "def post(self, int_id)" } ]
2
stack_v2_sparse_classes_30k_train_004223
Implement the Python class `EditTagResource` described below. Class description: Implement the EditTagResource class. Method signatures and docstrings: - def get(self, int_id): Args: int_id: Returns: - def post(self, int_id): Args: int_id: Returns:
Implement the Python class `EditTagResource` described below. Class description: Implement the EditTagResource class. Method signatures and docstrings: - def get(self, int_id): Args: int_id: Returns: - def post(self, int_id): Args: int_id: Returns: <|skeleton|> class EditTagResource: def get(self, int_id): ...
865403e3b1717226b25c9d64aeb4c35c7220e7e3
<|skeleton|> class EditTagResource: def get(self, int_id): """Args: int_id: Returns:""" <|body_0|> def post(self, int_id): """Args: int_id: Returns:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EditTagResource: def get(self, int_id): """Args: int_id: Returns:""" table_object = Tag.query.get_or_404(int_id) form = TagForm(obj=table_object) template_return = flask.render_template('edit.html', form=form) return template_return def post(self, int_id): ...
the_stack_v2_python_sparse
things_organizer/web_app/tags/resources.py
yeyeto2788/Things-Organizer
train
11
863692089d6ba0188cd989751005fa26eef018b4
[ "self.detector = detector\nself.learner = ObjectTracking2DDeepSortLearner(device=device, temp_path=temp_dir)\nif not os.path.exists(os.path.join(temp_dir, model_name)):\n ObjectTracking2DDeepSortLearner.download(model_name, temp_dir)\nself.learner.load(os.path.join(temp_dir, model_name), verbose=True)\nself.brid...
<|body_start_0|> self.detector = detector self.learner = ObjectTracking2DDeepSortLearner(device=device, temp_path=temp_dir) if not os.path.exists(os.path.join(temp_dir, model_name)): ObjectTracking2DDeepSortLearner.download(model_name, temp_dir) self.learner.load(os.path.join...
ObjectTracking2DDeepSortNode
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObjectTracking2DDeepSortNode: def __init__(self, detector=None, input_rgb_image_topic='/usb_cam/image_raw', output_detection_topic='/opendr/objects', output_tracking_id_topic='/opendr/objects_tracking_id', output_rgb_image_topic='/opendr/image_objects_annotated', device='cuda:0', model_name='dee...
stack_v2_sparse_classes_10k_train_003047
9,139
permissive
[ { "docstring": "Creates a ROS Node for 2D object tracking :param detector: Learner to generate object detections :type detector: Learner :param input_rgb_image_topic: Topic from which we are reading the input image :type input_rgb_image_topic: str :param output_rgb_image_topic: Topic to which we are publishing ...
3
stack_v2_sparse_classes_30k_train_001382
Implement the Python class `ObjectTracking2DDeepSortNode` described below. Class description: Implement the ObjectTracking2DDeepSortNode class. Method signatures and docstrings: - def __init__(self, detector=None, input_rgb_image_topic='/usb_cam/image_raw', output_detection_topic='/opendr/objects', output_tracking_id...
Implement the Python class `ObjectTracking2DDeepSortNode` described below. Class description: Implement the ObjectTracking2DDeepSortNode class. Method signatures and docstrings: - def __init__(self, detector=None, input_rgb_image_topic='/usb_cam/image_raw', output_detection_topic='/opendr/objects', output_tracking_id...
b3d6ce670cdf63469fc5766630eb295d67b3d788
<|skeleton|> class ObjectTracking2DDeepSortNode: def __init__(self, detector=None, input_rgb_image_topic='/usb_cam/image_raw', output_detection_topic='/opendr/objects', output_tracking_id_topic='/opendr/objects_tracking_id', output_rgb_image_topic='/opendr/image_objects_annotated', device='cuda:0', model_name='dee...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ObjectTracking2DDeepSortNode: def __init__(self, detector=None, input_rgb_image_topic='/usb_cam/image_raw', output_detection_topic='/opendr/objects', output_tracking_id_topic='/opendr/objects_tracking_id', output_rgb_image_topic='/opendr/image_objects_annotated', device='cuda:0', model_name='deep_sort', temp_...
the_stack_v2_python_sparse
projects/opendr_ws/src/opendr_perception/scripts/object_tracking_2d_deep_sort_node.py
opendr-eu/opendr
train
535
0be55e10dd20e645863071bdfb339a9200d36bd2
[ "general_mapping_payload = request.data\nassert_valid(general_mapping_payload is not None, 'Request body is empty')\nmapping_utils = MappingUtils(kwargs['workspace_id'])\ngeneral_mapping = mapping_utils.create_or_update_general_mapping(general_mapping_payload)\nreturn Response(data=self.serializer_class(general_map...
<|body_start_0|> general_mapping_payload = request.data assert_valid(general_mapping_payload is not None, 'Request body is empty') mapping_utils = MappingUtils(kwargs['workspace_id']) general_mapping = mapping_utils.create_or_update_general_mapping(general_mapping_payload) return...
General mappings
GeneralMappingView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GeneralMappingView: """General mappings""" def post(self, request, *args, **kwargs): """Create general mappings""" <|body_0|> def get(self, request, *args, **kwargs): """Get general mappings""" <|body_1|> <|end_skeleton|> <|body_start_0|> genera...
stack_v2_sparse_classes_10k_train_003048
5,203
permissive
[ { "docstring": "Create general mappings", "name": "post", "signature": "def post(self, request, *args, **kwargs)" }, { "docstring": "Get general mappings", "name": "get", "signature": "def get(self, request, *args, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_000468
Implement the Python class `GeneralMappingView` described below. Class description: General mappings Method signatures and docstrings: - def post(self, request, *args, **kwargs): Create general mappings - def get(self, request, *args, **kwargs): Get general mappings
Implement the Python class `GeneralMappingView` described below. Class description: General mappings Method signatures and docstrings: - def post(self, request, *args, **kwargs): Create general mappings - def get(self, request, *args, **kwargs): Get general mappings <|skeleton|> class GeneralMappingView: """Gene...
53f595170a073f245b9930bfce2ca07bdf998ce3
<|skeleton|> class GeneralMappingView: """General mappings""" def post(self, request, *args, **kwargs): """Create general mappings""" <|body_0|> def get(self, request, *args, **kwargs): """Get general mappings""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GeneralMappingView: """General mappings""" def post(self, request, *args, **kwargs): """Create general mappings""" general_mapping_payload = request.data assert_valid(general_mapping_payload is not None, 'Request body is empty') mapping_utils = MappingUtils(kwargs['workspa...
the_stack_v2_python_sparse
apps/mappings/views.py
Sravanksk/fyle-qbo-api
train
0
d978676738ed1f4974790da615d016fce2b1a497
[ "if n == 0:\n return list()\nreturn [self.gen_triangle_level(i) for i in range(1, n + 1, 1)]", "if i == 1:\n return list([1])\nt = self.gen_triangle_level(i - 1)\nm = len(t) + 1\nreturn [1 if j == 0 or j == m - 1 else t[j - 1] + t[j] for j in range(0, m, 1)]" ]
<|body_start_0|> if n == 0: return list() return [self.gen_triangle_level(i) for i in range(1, n + 1, 1)] <|end_body_0|> <|body_start_1|> if i == 1: return list([1]) t = self.gen_triangle_level(i - 1) m = len(t) + 1 return [1 if j == 0 or j == m -...
Pythonic iteration over all Pascal triangle depths and node values. Implements memoization algorithm (top-down dynamic programming). Time complexity: O(n ** m) - Iterate over all triangle depths and values Space complexity: O(n ** m) - Store all intermediate triangle values
Solution
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """Pythonic iteration over all Pascal triangle depths and node values. Implements memoization algorithm (top-down dynamic programming). Time complexity: O(n ** m) - Iterate over all triangle depths and values Space complexity: O(n ** m) - Store all intermediate triangle values""" d...
stack_v2_sparse_classes_10k_train_003049
3,716
permissive
[ { "docstring": "Creates Pascal triangle to specified depth \"n\". :param int n: max depth of target Pascal triangle :return: array of all triangle levels to max depth \"n\" (inclusive) :rtype: list[list[int]]", "name": "create_pascal_triangle", "signature": "def create_pascal_triangle(self, n)" }, {...
2
stack_v2_sparse_classes_30k_train_003928
Implement the Python class `Solution` described below. Class description: Pythonic iteration over all Pascal triangle depths and node values. Implements memoization algorithm (top-down dynamic programming). Time complexity: O(n ** m) - Iterate over all triangle depths and values Space complexity: O(n ** m) - Store all...
Implement the Python class `Solution` described below. Class description: Pythonic iteration over all Pascal triangle depths and node values. Implements memoization algorithm (top-down dynamic programming). Time complexity: O(n ** m) - Iterate over all triangle depths and values Space complexity: O(n ** m) - Store all...
69f90877c5466927e8b081c4268cbcda074813ec
<|skeleton|> class Solution: """Pythonic iteration over all Pascal triangle depths and node values. Implements memoization algorithm (top-down dynamic programming). Time complexity: O(n ** m) - Iterate over all triangle depths and values Space complexity: O(n ** m) - Store all intermediate triangle values""" d...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: """Pythonic iteration over all Pascal triangle depths and node values. Implements memoization algorithm (top-down dynamic programming). Time complexity: O(n ** m) - Iterate over all triangle depths and values Space complexity: O(n ** m) - Store all intermediate triangle values""" def create_pas...
the_stack_v2_python_sparse
0118_pascals_triangle/python_source.py
arthurdysart/LeetCode
train
0
06187c02b36039b69d67b96df26d6161fbd02248
[ "n = len(ratings)\nres = [1] * n\nmin_index = ratings.index(min(ratings))\nfor i in range(min_index + 1, n):\n if ratings[i] > ratings[i - 1]:\n res[i] = res[i - 1] + 1\n else:\n j = i\n while ratings[j] < ratings[j - 1]:\n res[j - 1] = max(res[j - 1], res[j] + 1)\n ...
<|body_start_0|> n = len(ratings) res = [1] * n min_index = ratings.index(min(ratings)) for i in range(min_index + 1, n): if ratings[i] > ratings[i - 1]: res[i] = res[i - 1] + 1 else: j = i while ratings[j] < ratings...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def candy(self, ratings): """和字节跳动2019春招第一轮笔试第三题基本一样 还是要多刷leetcode 要是笔试做过这个就不拿到题的时候一脸懵逼了Orz :type ratings: List[int] :rtype: int""" <|body_0|> def candy3(self, ratings): """先给每个人一个糖,初始化tmp数组为额外糖果。 从左向右遍历,如果i+1分数高,tmp[i+1]=tmp[i]+1。 再从后往前遍历,如果i比i+1分数高,那么比较tm...
stack_v2_sparse_classes_10k_train_003050
2,881
no_license
[ { "docstring": "和字节跳动2019春招第一轮笔试第三题基本一样 还是要多刷leetcode 要是笔试做过这个就不拿到题的时候一脸懵逼了Orz :type ratings: List[int] :rtype: int", "name": "candy", "signature": "def candy(self, ratings)" }, { "docstring": "先给每个人一个糖,初始化tmp数组为额外糖果。 从左向右遍历,如果i+1分数高,tmp[i+1]=tmp[i]+1。 再从后往前遍历,如果i比i+1分数高,那么比较tmp[i]和tmp[i+1]+1,如果...
2
stack_v2_sparse_classes_30k_val_000291
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def candy(self, ratings): 和字节跳动2019春招第一轮笔试第三题基本一样 还是要多刷leetcode 要是笔试做过这个就不拿到题的时候一脸懵逼了Orz :type ratings: List[int] :rtype: int - def candy3(self, ratings): 先给每个人一个糖,初始化tmp数组为额外糖果。...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def candy(self, ratings): 和字节跳动2019春招第一轮笔试第三题基本一样 还是要多刷leetcode 要是笔试做过这个就不拿到题的时候一脸懵逼了Orz :type ratings: List[int] :rtype: int - def candy3(self, ratings): 先给每个人一个糖,初始化tmp数组为额外糖果。...
5d3574ccd282d0146c83c286ae28d8baaabd4910
<|skeleton|> class Solution: def candy(self, ratings): """和字节跳动2019春招第一轮笔试第三题基本一样 还是要多刷leetcode 要是笔试做过这个就不拿到题的时候一脸懵逼了Orz :type ratings: List[int] :rtype: int""" <|body_0|> def candy3(self, ratings): """先给每个人一个糖,初始化tmp数组为额外糖果。 从左向右遍历,如果i+1分数高,tmp[i+1]=tmp[i]+1。 再从后往前遍历,如果i比i+1分数高,那么比较tm...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def candy(self, ratings): """和字节跳动2019春招第一轮笔试第三题基本一样 还是要多刷leetcode 要是笔试做过这个就不拿到题的时候一脸懵逼了Orz :type ratings: List[int] :rtype: int""" n = len(ratings) res = [1] * n min_index = ratings.index(min(ratings)) for i in range(min_index + 1, n): if ratings[...
the_stack_v2_python_sparse
135_分发糖果.py
lovehhf/LeetCode
train
0
593463b05855cb3ebffac5c7ec4c9ca85eaba891
[ "super().__init__()\nself._name = name\nself._cities = cities\nself._overhead_queue = queue", "for i, city in enumerate(self._cities, start=1):\n overhead_time = city_processor.ISSDataRequest.get_overhead_pass(city)\n logging.info('Producer %d is adding to the queue', self._name)\n self._overhead_queue.p...
<|body_start_0|> super().__init__() self._name = name self._cities = cities self._overhead_queue = queue <|end_body_0|> <|body_start_1|> for i, city in enumerate(self._cities, start=1): overhead_time = city_processor.ISSDataRequest.get_overhead_pass(city) ...
ProducerThread
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProducerThread: def __init__(self, cities: list, queue: CityOverheadTimeQueue, name: int): """This method initializes the class with a list of City Objects as well as a CityOverheadTimeQueue. :param cities: list(City) :param queue: CityOverheadTimeQueue :return: None""" <|body_0|...
stack_v2_sparse_classes_10k_train_003051
5,647
no_license
[ { "docstring": "This method initializes the class with a list of City Objects as well as a CityOverheadTimeQueue. :param cities: list(City) :param queue: CityOverheadTimeQueue :return: None", "name": "__init__", "signature": "def __init__(self, cities: list, queue: CityOverheadTimeQueue, name: int)" }...
2
stack_v2_sparse_classes_30k_train_004860
Implement the Python class `ProducerThread` described below. Class description: Implement the ProducerThread class. Method signatures and docstrings: - def __init__(self, cities: list, queue: CityOverheadTimeQueue, name: int): This method initializes the class with a list of City Objects as well as a CityOverheadTime...
Implement the Python class `ProducerThread` described below. Class description: Implement the ProducerThread class. Method signatures and docstrings: - def __init__(self, cities: list, queue: CityOverheadTimeQueue, name: int): This method initializes the class with a list of City Objects as well as a CityOverheadTime...
5fbc92a7ddd9103076a7095124b5ae108b002f03
<|skeleton|> class ProducerThread: def __init__(self, cities: list, queue: CityOverheadTimeQueue, name: int): """This method initializes the class with a list of City Objects as well as a CityOverheadTimeQueue. :param cities: list(City) :param queue: CityOverheadTimeQueue :return: None""" <|body_0|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ProducerThread: def __init__(self, cities: list, queue: CityOverheadTimeQueue, name: int): """This method initializes the class with a list of City Objects as well as a CityOverheadTimeQueue. :param cities: list(City) :param queue: CityOverheadTimeQueue :return: None""" super().__init__() ...
the_stack_v2_python_sparse
Labs/Lab10/producer_consumer.py
pyopoly/3522_A00699267
train
0
fc27da7ef49611c0fca60abbda49fe7d11d60a84
[ "if retry_on_exception is None:\n retry_on_exception = (Exception,)\n\ndef decorator(func):\n\n @functools.wraps(func)\n async def wrapper(*args, **kwargs):\n attempt = 0\n result = None\n while attempt <= stop_max_attempt_number:\n try:\n result = await func(...
<|body_start_0|> if retry_on_exception is None: retry_on_exception = (Exception,) def decorator(func): @functools.wraps(func) async def wrapper(*args, **kwargs): attempt = 0 result = None while attempt <= stop_max_atte...
Utility class for async functions.
AsyncUtils
[ "Python-2.0", "GPL-1.0-or-later", "MPL-2.0", "MIT", "LicenseRef-scancode-python-cwi", "BSD-3-Clause", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-free-unknown", "Apache-2.0", "MIT-0", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AsyncUtils: """Utility class for async functions.""" def async_retry(stop_max_attempt_number=5, wait_fixed=1, retry_on_exception=None): """Decorate an async coroutine function to retry its execution when an exception is risen. :param stop_max_attempt_number: Max number of retries. :p...
stack_v2_sparse_classes_10k_train_003052
19,599
permissive
[ { "docstring": "Decorate an async coroutine function to retry its execution when an exception is risen. :param stop_max_attempt_number: Max number of retries. :param wait_fixed: Wait time (in seconds) between retries. :param retry_on_exception: Exception to retry on. :return:", "name": "async_retry", "s...
3
stack_v2_sparse_classes_30k_train_004958
Implement the Python class `AsyncUtils` described below. Class description: Utility class for async functions. Method signatures and docstrings: - def async_retry(stop_max_attempt_number=5, wait_fixed=1, retry_on_exception=None): Decorate an async coroutine function to retry its execution when an exception is risen. ...
Implement the Python class `AsyncUtils` described below. Class description: Utility class for async functions. Method signatures and docstrings: - def async_retry(stop_max_attempt_number=5, wait_fixed=1, retry_on_exception=None): Decorate an async coroutine function to retry its execution when an exception is risen. ...
a213978a09ea7fc80855bf55c539861ea95259f9
<|skeleton|> class AsyncUtils: """Utility class for async functions.""" def async_retry(stop_max_attempt_number=5, wait_fixed=1, retry_on_exception=None): """Decorate an async coroutine function to retry its execution when an exception is risen. :param stop_max_attempt_number: Max number of retries. :p...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AsyncUtils: """Utility class for async functions.""" def async_retry(stop_max_attempt_number=5, wait_fixed=1, retry_on_exception=None): """Decorate an async coroutine function to retry its execution when an exception is risen. :param stop_max_attempt_number: Max number of retries. :param wait_fix...
the_stack_v2_python_sparse
cli/src/pcluster/utils.py
aws/aws-parallelcluster
train
520
ac4e1a8e084b67d2eefc85e10b532c49ddf7ea3d
[ "client_id = current_token.get('azp') or None\nuser_id = current_token['sub']\nusername = current_token.get('context', {}).get('user', {}).get('name')\nwith GoogleCloudManager() as g_cloud_manager:\n proxy_group_id = get_or_create_proxy_group_id()\n service_account = get_or_create_service_account(client_id=cl...
<|body_start_0|> client_id = current_token.get('azp') or None user_id = current_token['sub'] username = current_token.get('context', {}).get('user', {}).get('name') with GoogleCloudManager() as g_cloud_manager: proxy_group_id = get_or_create_proxy_group_id() servi...
For ``/credentials/google`` endpoint.
GoogleCredentialsList
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GoogleCredentialsList: """For ``/credentials/google`` endpoint.""" def get(self): """List access keys for user **Example:** .. code-block:: http POST /credentials/apis/ HTTP/1.1 Content-Type: application/json Accept: application/json Info from Google API /serviceAccounts/<account>/ke...
stack_v2_sparse_classes_10k_train_003053
12,068
permissive
[ { "docstring": "List access keys for user **Example:** .. code-block:: http POST /credentials/apis/ HTTP/1.1 Content-Type: application/json Accept: application/json Info from Google API /serviceAccounts/<account>/keys endpoint but get the expiration time from our DB .. code-block:: JavaScript { \"access_keys\":...
4
stack_v2_sparse_classes_30k_train_004078
Implement the Python class `GoogleCredentialsList` described below. Class description: For ``/credentials/google`` endpoint. Method signatures and docstrings: - def get(self): List access keys for user **Example:** .. code-block:: http POST /credentials/apis/ HTTP/1.1 Content-Type: application/json Accept: applicatio...
Implement the Python class `GoogleCredentialsList` described below. Class description: For ``/credentials/google`` endpoint. Method signatures and docstrings: - def get(self): List access keys for user **Example:** .. code-block:: http POST /credentials/apis/ HTTP/1.1 Content-Type: application/json Accept: applicatio...
ea885f0e882d8e6bb5db7670c4025bb8e282cdfc
<|skeleton|> class GoogleCredentialsList: """For ``/credentials/google`` endpoint.""" def get(self): """List access keys for user **Example:** .. code-block:: http POST /credentials/apis/ HTTP/1.1 Content-Type: application/json Accept: application/json Info from Google API /serviceAccounts/<account>/ke...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GoogleCredentialsList: """For ``/credentials/google`` endpoint.""" def get(self): """List access keys for user **Example:** .. code-block:: http POST /credentials/apis/ HTTP/1.1 Content-Type: application/json Accept: application/json Info from Google API /serviceAccounts/<account>/keys endpoint b...
the_stack_v2_python_sparse
fence/blueprints/storage_creds/google.py
uc-cdis/fence
train
42
8a942f92372390414918a4d9efc95f4952995b68
[ "res = cur = 0\nfor i, v in sorted((x for i, j in intervals for x in [[i, 1], [j, -1]])):\n cur += v\n res = max(res, cur)\nreturn res", "l = []\nfor start, end in sorted(intervals):\n if l and l[0] <= start:\n heapq.heapreplace(l, end)\n else:\n heapq.heappush(l, end)\nreturn len(l)", ...
<|body_start_0|> res = cur = 0 for i, v in sorted((x for i, j in intervals for x in [[i, 1], [j, -1]])): cur += v res = max(res, cur) return res <|end_body_0|> <|body_start_1|> l = [] for start, end in sorted(intervals): if l and l[0] <= start...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minMeetingRooms(self, intervals): """골때리는 풀이. [start, 1], [end,-1] 로 만들어서 전체를 sorting한후 진행.""" <|body_0|> def minMeetingRooms(self, intervals: List[List[int]]) -> int: """start range를 기준으로 sorting. heapq를 써서 진행. 처음 풀었던 방법과 다르게, start 값을 순서대로 소팅하면, 항상 맨 ...
stack_v2_sparse_classes_10k_train_003054
1,766
no_license
[ { "docstring": "골때리는 풀이. [start, 1], [end,-1] 로 만들어서 전체를 sorting한후 진행.", "name": "minMeetingRooms", "signature": "def minMeetingRooms(self, intervals)" }, { "docstring": "start range를 기준으로 sorting. heapq를 써서 진행. 처음 풀었던 방법과 다르게, start 값을 순서대로 소팅하면, 항상 맨 앞 값을 꺼내서 비교해도 그게 최선의 방법이 된다.", "name": ...
3
stack_v2_sparse_classes_30k_train_005273
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minMeetingRooms(self, intervals): 골때리는 풀이. [start, 1], [end,-1] 로 만들어서 전체를 sorting한후 진행. - def minMeetingRooms(self, intervals: List[List[int]]) -> int: start range를 기준으로 sor...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minMeetingRooms(self, intervals): 골때리는 풀이. [start, 1], [end,-1] 로 만들어서 전체를 sorting한후 진행. - def minMeetingRooms(self, intervals: List[List[int]]) -> int: start range를 기준으로 sor...
c26aef2a59e5cc2d9b0658b9c7386a43267ff8a1
<|skeleton|> class Solution: def minMeetingRooms(self, intervals): """골때리는 풀이. [start, 1], [end,-1] 로 만들어서 전체를 sorting한후 진행.""" <|body_0|> def minMeetingRooms(self, intervals: List[List[int]]) -> int: """start range를 기준으로 sorting. heapq를 써서 진행. 처음 풀었던 방법과 다르게, start 값을 순서대로 소팅하면, 항상 맨 ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def minMeetingRooms(self, intervals): """골때리는 풀이. [start, 1], [end,-1] 로 만들어서 전체를 sorting한후 진행.""" res = cur = 0 for i, v in sorted((x for i, j in intervals for x in [[i, 1], [j, -1]])): cur += v res = max(res, cur) return res def minMeeti...
the_stack_v2_python_sparse
Leetcode/253.py
hanwgyu/algorithm_problem_solving
train
5
aad76427e9121e75b08a41e78999e58238f29674
[ "n = len(arr)\ndp = [1] * n\nnums = [(num, i) for i, num in enumerate(arr)]\nnums.sort()\nfor num, i in nums:\n pre = num\n for j in range(i + 1, min(n, i + d + 1)):\n if pre >= arr[j]:\n continue\n pre = arr[j]\n dp[j] = max(dp[j], dp[i] + 1)\n pre = num\n for j in range...
<|body_start_0|> n = len(arr) dp = [1] * n nums = [(num, i) for i, num in enumerate(arr)] nums.sort() for num, i in nums: pre = num for j in range(i + 1, min(n, i + d + 1)): if pre >= arr[j]: continue pre...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxJumps1(self, arr: List[int], d: int) -> int: """思路:动态规划 类似最长上升子序列子序列的,每次用最矮的去更新旁边的高度 @param arr: @param d: @return:""" <|body_0|> def maxJumps2(self, arr: List[int], d: int) -> int: """思路:动态规划 类似最长上升子序列子序列的,每次用最矮的去更新旁边的高度 @param arr: @param d: @retur...
stack_v2_sparse_classes_10k_train_003055
3,389
no_license
[ { "docstring": "思路:动态规划 类似最长上升子序列子序列的,每次用最矮的去更新旁边的高度 @param arr: @param d: @return:", "name": "maxJumps1", "signature": "def maxJumps1(self, arr: List[int], d: int) -> int" }, { "docstring": "思路:动态规划 类似最长上升子序列子序列的,每次用最矮的去更新旁边的高度 @param arr: @param d: @return:", "name": "maxJumps2", "sign...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxJumps1(self, arr: List[int], d: int) -> int: 思路:动态规划 类似最长上升子序列子序列的,每次用最矮的去更新旁边的高度 @param arr: @param d: @return: - def maxJumps2(self, arr: List[int], d: int) -> int: 思路:动...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxJumps1(self, arr: List[int], d: int) -> int: 思路:动态规划 类似最长上升子序列子序列的,每次用最矮的去更新旁边的高度 @param arr: @param d: @return: - def maxJumps2(self, arr: List[int], d: int) -> int: 思路:动...
e43ee86c5a8cdb808da09b4b6138e10275abadb5
<|skeleton|> class Solution: def maxJumps1(self, arr: List[int], d: int) -> int: """思路:动态规划 类似最长上升子序列子序列的,每次用最矮的去更新旁边的高度 @param arr: @param d: @return:""" <|body_0|> def maxJumps2(self, arr: List[int], d: int) -> int: """思路:动态规划 类似最长上升子序列子序列的,每次用最矮的去更新旁边的高度 @param arr: @param d: @retur...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maxJumps1(self, arr: List[int], d: int) -> int: """思路:动态规划 类似最长上升子序列子序列的,每次用最矮的去更新旁边的高度 @param arr: @param d: @return:""" n = len(arr) dp = [1] * n nums = [(num, i) for i, num in enumerate(arr)] nums.sort() for num, i in nums: pre = num...
the_stack_v2_python_sparse
LeetCode/跳跃游戏/1340. 跳跃游戏 V.py
yiming1012/MyLeetCode
train
2
460e74a392f8586e88a120885f7cfe6c1400c525
[ "\"\"\"\n Idea (direactly with extra spaces):\n 1. scan the matrix and store indexes of zeroes.\n 2. set rows and columns zeroes.\n \"\"\"\nm = len(matrix)\nn = len(matrix[0])\nif n == 0 or m == 0:\n return\nindexes = []\nfor i, row in enumerate(matrix):\n for j, element in enumera...
<|body_start_0|> """ Idea (direactly with extra spaces): 1. scan the matrix and store indexes of zeroes. 2. set rows and columns zeroes. """ m = len(matrix) n = len(matrix[0]) if n == 0 or m == 0: return ...
Solution
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def setZeroes(self, matrix) -> None: """Do not return anything, modify matrix in-place instead.""" <|body_0|> def setZeroes_v2(self, matrix) -> None: """Idea (a constant space solution): 1. Scan the matrix. 2. If meet a zero, label the head elements of this...
stack_v2_sparse_classes_10k_train_003056
2,957
permissive
[ { "docstring": "Do not return anything, modify matrix in-place instead.", "name": "setZeroes", "signature": "def setZeroes(self, matrix) -> None" }, { "docstring": "Idea (a constant space solution): 1. Scan the matrix. 2. If meet a zero, label the head elements of this row and this column. For e...
2
stack_v2_sparse_classes_30k_train_000961
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def setZeroes(self, matrix) -> None: Do not return anything, modify matrix in-place instead. - def setZeroes_v2(self, matrix) -> None: Idea (a constant space solution): 1. Scan t...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def setZeroes(self, matrix) -> None: Do not return anything, modify matrix in-place instead. - def setZeroes_v2(self, matrix) -> None: Idea (a constant space solution): 1. Scan t...
226cecde136531341ce23cdf88529345be1912fc
<|skeleton|> class Solution: def setZeroes(self, matrix) -> None: """Do not return anything, modify matrix in-place instead.""" <|body_0|> def setZeroes_v2(self, matrix) -> None: """Idea (a constant space solution): 1. Scan the matrix. 2. If meet a zero, label the head elements of this...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def setZeroes(self, matrix) -> None: """Do not return anything, modify matrix in-place instead.""" """ Idea (direactly with extra spaces): 1. scan the matrix and store indexes of zeroes. 2. set rows and columns zeroes. "...
the_stack_v2_python_sparse
Leetcode/Intermediate/Array_and_string/73_Set_Matrix_Zeroes.py
ZR-Huang/AlgorithmsPractices
train
1
1aa9346fa138c7829dddd1202f8af83899087106
[ "try:\n return_data = ''\n return Response(json.dumps(return_data))\nexcept Exception as e:\n return_data = {'status': '404', 'result': str(e)}\n return Response(json.dumps(return_data))", "try:\n return_data = ''\n if type == 'log':\n return_data = RunManagerMoniter().get_view_obj_log(id...
<|body_start_0|> try: return_data = '' return Response(json.dumps(return_data)) except Exception as e: return_data = {'status': '404', 'result': str(e)} return Response(json.dumps(return_data)) <|end_body_0|> <|body_start_1|> try: retu...
RunManagerCelery
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RunManagerCelery: def post(self, request, nnid): """CRUD of workflow information --- # Class Name : RunManagerWorkFlow # Description: CRUD of workflow information (not implemented yet)""" <|body_0|> def get(self, request, type, id, line): """CRUD of workflow informat...
stack_v2_sparse_classes_10k_train_003057
2,345
permissive
[ { "docstring": "CRUD of workflow information --- # Class Name : RunManagerWorkFlow # Description: CRUD of workflow information (not implemented yet)", "name": "post", "signature": "def post(self, request, nnid)" }, { "docstring": "CRUD of workflow information --- # Class Name : RunManagerWorkFlo...
4
null
Implement the Python class `RunManagerCelery` described below. Class description: Implement the RunManagerCelery class. Method signatures and docstrings: - def post(self, request, nnid): CRUD of workflow information --- # Class Name : RunManagerWorkFlow # Description: CRUD of workflow information (not implemented yet...
Implement the Python class `RunManagerCelery` described below. Class description: Implement the RunManagerCelery class. Method signatures and docstrings: - def post(self, request, nnid): CRUD of workflow information --- # Class Name : RunManagerWorkFlow # Description: CRUD of workflow information (not implemented yet...
6ad2fbc7384e4dbe7e3e63bdb44c8ce0387f4b7f
<|skeleton|> class RunManagerCelery: def post(self, request, nnid): """CRUD of workflow information --- # Class Name : RunManagerWorkFlow # Description: CRUD of workflow information (not implemented yet)""" <|body_0|> def get(self, request, type, id, line): """CRUD of workflow informat...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RunManagerCelery: def post(self, request, nnid): """CRUD of workflow information --- # Class Name : RunManagerWorkFlow # Description: CRUD of workflow information (not implemented yet)""" try: return_data = '' return Response(json.dumps(return_data)) except Exce...
the_stack_v2_python_sparse
api/views/runmanager_celery.py
yurimkoo/tensormsa
train
1
f53e8d47c874f62e63b8b4e7a2f1b6c2e94f4df6
[ "results = None\ntry:\n with datastore_services.get_ndb_context():\n results = exp_services.regenerate_missing_stats_for_exploration(exp_id)\nexcept Exception as e:\n logging.exception(e)\n return result.Err((exp_id, e))\nreturn result.Ok((exp_id, results))", "unmigrated_exploration_models = self....
<|body_start_0|> results = None try: with datastore_services.get_ndb_context(): results = exp_services.regenerate_missing_stats_for_exploration(exp_id) except Exception as e: logging.exception(e) return result.Err((exp_id, e)) return re...
Job that regenerates missing exploration stats models.
RegenerateMissingExplorationStatsModelsJob
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegenerateMissingExplorationStatsModelsJob: """Job that regenerates missing exploration stats models.""" def _regenerate_stats_models(exp_id: str, unused_exp_model: exp_models.ExplorationModel) -> result.Result[Tuple[str, exp_domain.Exploration], Tuple[str, Exception]]: """Regenerate...
stack_v2_sparse_classes_10k_train_003058
28,752
permissive
[ { "docstring": "Regenerates missing exploration stats models. Args: exp_id: str. The ID of the exploration. unused_exp_model: ExplorationModel. Exploration model. Returns: Result((str, Exploration), (str, Exception)). Result containing tuple that consists of exploration ID and either Exploration object or Excep...
2
null
Implement the Python class `RegenerateMissingExplorationStatsModelsJob` described below. Class description: Job that regenerates missing exploration stats models. Method signatures and docstrings: - def _regenerate_stats_models(exp_id: str, unused_exp_model: exp_models.ExplorationModel) -> result.Result[Tuple[str, ex...
Implement the Python class `RegenerateMissingExplorationStatsModelsJob` described below. Class description: Job that regenerates missing exploration stats models. Method signatures and docstrings: - def _regenerate_stats_models(exp_id: str, unused_exp_model: exp_models.ExplorationModel) -> result.Result[Tuple[str, ex...
d16fdf23d790eafd63812bd7239532256e30a21d
<|skeleton|> class RegenerateMissingExplorationStatsModelsJob: """Job that regenerates missing exploration stats models.""" def _regenerate_stats_models(exp_id: str, unused_exp_model: exp_models.ExplorationModel) -> result.Result[Tuple[str, exp_domain.Exploration], Tuple[str, Exception]]: """Regenerate...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RegenerateMissingExplorationStatsModelsJob: """Job that regenerates missing exploration stats models.""" def _regenerate_stats_models(exp_id: str, unused_exp_model: exp_models.ExplorationModel) -> result.Result[Tuple[str, exp_domain.Exploration], Tuple[str, Exception]]: """Regenerates missing exp...
the_stack_v2_python_sparse
core/jobs/batch_jobs/exp_migration_jobs.py
oppia/oppia
train
6,172
e1a26068dc36d530a8f438911f57a4c1742df913
[ "Block.__init__(self, scenario, args)\nself.to = None\nself.path = None\nself.add_to_name = None\nif 'to' in args:\n self.to = args['to']\nelif 'path' in args:\n self.path = args['path']\nelif 'add_to_name' in args:\n self.add_to_name = args['add_to_name']", "if self.to:\n return self.to\nif self.path...
<|body_start_0|> Block.__init__(self, scenario, args) self.to = None self.path = None self.add_to_name = None if 'to' in args: self.to = args['to'] elif 'path' in args: self.path = args['path'] elif 'add_to_name' in args: self.a...
Base block for output writing.
BaseWriter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseWriter: """Base block for output writing.""" def __init__(self, scenario, args): """Empty constructor (just call the base constructor)""" <|body_0|> def get_output_file_name(self, doc): """Create an output file name for the given document.""" <|body_1...
stack_v2_sparse_classes_10k_train_003059
1,836
permissive
[ { "docstring": "Empty constructor (just call the base constructor)", "name": "__init__", "signature": "def __init__(self, scenario, args)" }, { "docstring": "Create an output file name for the given document.", "name": "get_output_file_name", "signature": "def get_output_file_name(self, ...
2
stack_v2_sparse_classes_30k_train_007122
Implement the Python class `BaseWriter` described below. Class description: Base block for output writing. Method signatures and docstrings: - def __init__(self, scenario, args): Empty constructor (just call the base constructor) - def get_output_file_name(self, doc): Create an output file name for the given document...
Implement the Python class `BaseWriter` described below. Class description: Base block for output writing. Method signatures and docstrings: - def __init__(self, scenario, args): Empty constructor (just call the base constructor) - def get_output_file_name(self, doc): Create an output file name for the given document...
73af644ec35c8a1cd0c37cd478c2afc1db717e0b
<|skeleton|> class BaseWriter: """Base block for output writing.""" def __init__(self, scenario, args): """Empty constructor (just call the base constructor)""" <|body_0|> def get_output_file_name(self, doc): """Create an output file name for the given document.""" <|body_1...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BaseWriter: """Base block for output writing.""" def __init__(self, scenario, args): """Empty constructor (just call the base constructor)""" Block.__init__(self, scenario, args) self.to = None self.path = None self.add_to_name = None if 'to' in args: ...
the_stack_v2_python_sparse
alex/components/nlg/tectotpl/block/write/basewriter.py
oplatek/alex
train
0
bab1fe6877936cafc715e912e4bb3274e57f362a
[ "s, h = common.service_json_request(self.ipaddr, self.port, 'GET', self.URI_VPOOL_SHOW.format(vpooltype, uri), None)\no = common.json_decode(s)\nif o['inactive']:\n return None\nreturn o", "if common.is_uri(name):\n return name\ns, h = common.service_json_request(self.ipaddr, self.port, 'GET', self.URI_VPOO...
<|body_start_0|> s, h = common.service_json_request(self.ipaddr, self.port, 'GET', self.URI_VPOOL_SHOW.format(vpooltype, uri), None) o = common.json_decode(s) if o['inactive']: return None return o <|end_body_0|> <|body_start_1|> if common.is_uri(name): r...
VirtualPool
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VirtualPool: def vpool_show_uri(self, vpooltype, uri): """Makes REST API call and retrieves vpool details based on UUID. This function will take uri as input and returns with all parameters of VPOOL like label, urn and type. :param vpooltype : Type of virtual pool {'block'} :param uri : ...
stack_v2_sparse_classes_10k_train_003060
2,887
permissive
[ { "docstring": "Makes REST API call and retrieves vpool details based on UUID. This function will take uri as input and returns with all parameters of VPOOL like label, urn and type. :param vpooltype : Type of virtual pool {'block'} :param uri : unique resource identifier of the vpool :returns: object containin...
2
stack_v2_sparse_classes_30k_test_000266
Implement the Python class `VirtualPool` described below. Class description: Implement the VirtualPool class. Method signatures and docstrings: - def vpool_show_uri(self, vpooltype, uri): Makes REST API call and retrieves vpool details based on UUID. This function will take uri as input and returns with all parameter...
Implement the Python class `VirtualPool` described below. Class description: Implement the VirtualPool class. Method signatures and docstrings: - def vpool_show_uri(self, vpooltype, uri): Makes REST API call and retrieves vpool details based on UUID. This function will take uri as input and returns with all parameter...
f8f1a4fe4a6da6e77d5dbff4f96eb123ec445230
<|skeleton|> class VirtualPool: def vpool_show_uri(self, vpooltype, uri): """Makes REST API call and retrieves vpool details based on UUID. This function will take uri as input and returns with all parameters of VPOOL like label, urn and type. :param vpooltype : Type of virtual pool {'block'} :param uri : ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class VirtualPool: def vpool_show_uri(self, vpooltype, uri): """Makes REST API call and retrieves vpool details based on UUID. This function will take uri as input and returns with all parameters of VPOOL like label, urn and type. :param vpooltype : Type of virtual pool {'block'} :param uri : unique resourc...
the_stack_v2_python_sparse
cinder/volume/drivers/coprhd/helpers/virtualpool.py
Nexenta/cinder
train
3
ca0956cc76016c6774af349bf4816c1a06b735a6
[ "Inventory.__init__(self, inventory_info)\nself.brand = brand\nself.voltage = voltage", "output_dict = Inventory.return_as_dictionary(self)\noutput_dict['brand'] = self.brand\noutput_dict['voltage'] = self.voltage\nreturn output_dict" ]
<|body_start_0|> Inventory.__init__(self, inventory_info) self.brand = brand self.voltage = voltage <|end_body_0|> <|body_start_1|> output_dict = Inventory.return_as_dictionary(self) output_dict['brand'] = self.brand output_dict['voltage'] = self.voltage return o...
Creates a class that handles data on electric appliances
ElectricAppliances
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ElectricAppliances: """Creates a class that handles data on electric appliances""" def __init__(self, inventory_info, brand, voltage): """Initializes the class info""" <|body_0|> def return_as_dictionary(self): """Returns a dictionary of the appliance information...
stack_v2_sparse_classes_10k_train_003061
724
no_license
[ { "docstring": "Initializes the class info", "name": "__init__", "signature": "def __init__(self, inventory_info, brand, voltage)" }, { "docstring": "Returns a dictionary of the appliance information", "name": "return_as_dictionary", "signature": "def return_as_dictionary(self)" } ]
2
stack_v2_sparse_classes_30k_train_007000
Implement the Python class `ElectricAppliances` described below. Class description: Creates a class that handles data on electric appliances Method signatures and docstrings: - def __init__(self, inventory_info, brand, voltage): Initializes the class info - def return_as_dictionary(self): Returns a dictionary of the ...
Implement the Python class `ElectricAppliances` described below. Class description: Creates a class that handles data on electric appliances Method signatures and docstrings: - def __init__(self, inventory_info, brand, voltage): Initializes the class info - def return_as_dictionary(self): Returns a dictionary of the ...
5dac60f39e3909ff05b26721d602ed20f14d6be3
<|skeleton|> class ElectricAppliances: """Creates a class that handles data on electric appliances""" def __init__(self, inventory_info, brand, voltage): """Initializes the class info""" <|body_0|> def return_as_dictionary(self): """Returns a dictionary of the appliance information...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ElectricAppliances: """Creates a class that handles data on electric appliances""" def __init__(self, inventory_info, brand, voltage): """Initializes the class info""" Inventory.__init__(self, inventory_info) self.brand = brand self.voltage = voltage def return_as_dic...
the_stack_v2_python_sparse
students/dfspray/Lesson01/inventory_management/electric_appliances_class.py
JavaRod/SP_Python220B_2019
train
1
61c4a7646c8cc0c477a84dc3446ee4e6df7d488e
[ "try:\n response = super(APIBaseView, self).dispatch_request(request, *args, **kwargs)\n if isawaitable(response):\n response = await response\nexcept Exception as exception:\n response = await self.handle_exception(exception)\nreturn response", "if isinstance(exception, ValidationError):\n res...
<|body_start_0|> try: response = super(APIBaseView, self).dispatch_request(request, *args, **kwargs) if isawaitable(response): response = await response except Exception as exception: response = await self.handle_exception(exception) return res...
扩展 class based view, 增加异常处理
APIBaseView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class APIBaseView: """扩展 class based view, 增加异常处理""" async def dispatch_request(self, request, *args, **kwargs): """扩展 http 请求的分发, 添加错误处理""" <|body_0|> async def handle_exception(self, exception): """处理异常 ValidationError, APIException: 返回适当的错误信息 else: 重新抛出异常""" ...
stack_v2_sparse_classes_10k_train_003062
3,695
no_license
[ { "docstring": "扩展 http 请求的分发, 添加错误处理", "name": "dispatch_request", "signature": "async def dispatch_request(self, request, *args, **kwargs)" }, { "docstring": "处理异常 ValidationError, APIException: 返回适当的错误信息 else: 重新抛出异常", "name": "handle_exception", "signature": "async def handle_excepti...
2
stack_v2_sparse_classes_30k_train_003416
Implement the Python class `APIBaseView` described below. Class description: 扩展 class based view, 增加异常处理 Method signatures and docstrings: - async def dispatch_request(self, request, *args, **kwargs): 扩展 http 请求的分发, 添加错误处理 - async def handle_exception(self, exception): 处理异常 ValidationError, APIException: 返回适当的错误信息 el...
Implement the Python class `APIBaseView` described below. Class description: 扩展 class based view, 增加异常处理 Method signatures and docstrings: - async def dispatch_request(self, request, *args, **kwargs): 扩展 http 请求的分发, 添加错误处理 - async def handle_exception(self, exception): 处理异常 ValidationError, APIException: 返回适当的错误信息 el...
8b8a0684de8e7fcdf0c229b05816cf7cbd5909f2
<|skeleton|> class APIBaseView: """扩展 class based view, 增加异常处理""" async def dispatch_request(self, request, *args, **kwargs): """扩展 http 请求的分发, 添加错误处理""" <|body_0|> async def handle_exception(self, exception): """处理异常 ValidationError, APIException: 返回适当的错误信息 else: 重新抛出异常""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class APIBaseView: """扩展 class based view, 增加异常处理""" async def dispatch_request(self, request, *args, **kwargs): """扩展 http 请求的分发, 添加错误处理""" try: response = super(APIBaseView, self).dispatch_request(request, *args, **kwargs) if isawaitable(response): resp...
the_stack_v2_python_sparse
src/views/utils.py
Kingvast/qrcode_web
train
1
6b6035f266aa5ace5cd2f7ec54030f257c50eded
[ "for i in range(1, len(s)):\n if s[i] != '1':\n return set(s[i:]) == {'0'}\nreturn True", "sum_ = abs(goal - sum(nums))\nif sum_ == 0:\n return 0\nn = sum_ // limit\nm = sum_ % limit\nif m == 0:\n return n\nelse:\n return 1 + n" ]
<|body_start_0|> for i in range(1, len(s)): if s[i] != '1': return set(s[i:]) == {'0'} return True <|end_body_0|> <|body_start_1|> sum_ = abs(goal - sum(nums)) if sum_ == 0: return 0 n = sum_ // limit m = sum_ % limit if m ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def checkOnesSegment(self, s: str) -> bool: """给你一个二进制字符串 s ,该字符串 不含前导零 。 如果 s 最多包含 一个由连续的 '1' 组成的字段 ,返回 true​​​ 。否则,返回 false 。 :param s: :return:""" <|body_0|> def minElements(self, nums: List[int], limit: int, goal: int) -> int: """给你一个整数数组 nums ,和两个整数 li...
stack_v2_sparse_classes_10k_train_003063
2,524
no_license
[ { "docstring": "给你一个二进制字符串 s ,该字符串 不含前导零 。 如果 s 最多包含 一个由连续的 '1' 组成的字段 ,返回 true​​​ 。否则,返回 false 。 :param s: :return:", "name": "checkOnesSegment", "signature": "def checkOnesSegment(self, s: str) -> bool" }, { "docstring": "给你一个整数数组 nums ,和两个整数 limit 与 goal 。数组 nums 有一条重要属性:abs(nums[i]) <= limit ...
2
stack_v2_sparse_classes_30k_train_003465
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def checkOnesSegment(self, s: str) -> bool: 给你一个二进制字符串 s ,该字符串 不含前导零 。 如果 s 最多包含 一个由连续的 '1' 组成的字段 ,返回 true​​​ 。否则,返回 false 。 :param s: :return: - def minElements(self, nums: List...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def checkOnesSegment(self, s: str) -> bool: 给你一个二进制字符串 s ,该字符串 不含前导零 。 如果 s 最多包含 一个由连续的 '1' 组成的字段 ,返回 true​​​ 。否则,返回 false 。 :param s: :return: - def minElements(self, nums: List...
330330ef6bc42eeb17f4dea53c30d230506b4e8f
<|skeleton|> class Solution: def checkOnesSegment(self, s: str) -> bool: """给你一个二进制字符串 s ,该字符串 不含前导零 。 如果 s 最多包含 一个由连续的 '1' 组成的字段 ,返回 true​​​ 。否则,返回 false 。 :param s: :return:""" <|body_0|> def minElements(self, nums: List[int], limit: int, goal: int) -> int: """给你一个整数数组 nums ,和两个整数 li...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def checkOnesSegment(self, s: str) -> bool: """给你一个二进制字符串 s ,该字符串 不含前导零 。 如果 s 最多包含 一个由连续的 '1' 组成的字段 ,返回 true​​​ 。否则,返回 false 。 :param s: :return:""" for i in range(1, len(s)): if s[i] != '1': return set(s[i:]) == {'0'} return True def minElem...
the_stack_v2_python_sparse
Code/weekly_contest/Week_231.py
NiceToMeeetU/ToGetReady
train
0
774802594ebff12fd1bd1818c2d74cf7e8c32f7f
[ "if left == right:\n if self.nums[self.new_index(left)] == self.target:\n print(left, self.new_index(left))\n return self.new_index(left)\n print(-1)\n return -1\nmid = left + right >> 1\nif self.nums[self.new_index(mid)] == self.target:\n print(mid, self.new_index(mid))\n return self.n...
<|body_start_0|> if left == right: if self.nums[self.new_index(left)] == self.target: print(left, self.new_index(left)) return self.new_index(left) print(-1) return -1 mid = left + right >> 1 if self.nums[self.new_index(mid)] ==...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def bin_search(self, left, right): """:param left: int :param right: int :return: int""" <|body_0|> def search(self, nums, target): """:type nums: list[int] :type target: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if l...
stack_v2_sparse_classes_10k_train_003064
2,399
no_license
[ { "docstring": ":param left: int :param right: int :return: int", "name": "bin_search", "signature": "def bin_search(self, left, right)" }, { "docstring": ":type nums: list[int] :type target: int :rtype: int", "name": "search", "signature": "def search(self, nums, target)" } ]
2
stack_v2_sparse_classes_30k_train_001413
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def bin_search(self, left, right): :param left: int :param right: int :return: int - def search(self, nums, target): :type nums: list[int] :type target: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def bin_search(self, left, right): :param left: int :param right: int :return: int - def search(self, nums, target): :type nums: list[int] :type target: int :rtype: int <|skelet...
f8f3b0cdb47ee6bb4bf9bdc7c2a983f4a882d9dd
<|skeleton|> class Solution: def bin_search(self, left, right): """:param left: int :param right: int :return: int""" <|body_0|> def search(self, nums, target): """:type nums: list[int] :type target: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def bin_search(self, left, right): """:param left: int :param right: int :return: int""" if left == right: if self.nums[self.new_index(left)] == self.target: print(left, self.new_index(left)) return self.new_index(left) print(-1...
the_stack_v2_python_sparse
solutions/033-search-in-rotated-sorted-array/main.py
CallMeNP/leetcode
train
0
9bab21a1131de0de8332b76fa0c72b086c3f92d3
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn UserExperienceAnalyticsAppHealthApplicationPerformance()", "from .entity import Entity\nfrom .entity import Entity\nfields: Dict[str, Callable[[Any], None]] = {'activeDeviceCount': lambda n: setattr(self, 'active_device_count', n.get_i...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return UserExperienceAnalyticsAppHealthApplicationPerformance() <|end_body_0|> <|body_start_1|> from .entity import Entity from .entity import Entity fields: Dict[str, Callable[[Any], N...
The user experience analytics application performance entity contains application performance details.
UserExperienceAnalyticsAppHealthApplicationPerformance
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserExperienceAnalyticsAppHealthApplicationPerformance: """The user experience analytics application performance entity contains application performance details.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserExperienceAnalyticsAppHealthApplicationPerform...
stack_v2_sparse_classes_10k_train_003065
5,222
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: UserExperienceAnalyticsAppHealthApplicationPerformance", "name": "create_from_discriminator_value", "signatu...
3
null
Implement the Python class `UserExperienceAnalyticsAppHealthApplicationPerformance` described below. Class description: The user experience analytics application performance entity contains application performance details. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[Pa...
Implement the Python class `UserExperienceAnalyticsAppHealthApplicationPerformance` described below. Class description: The user experience analytics application performance entity contains application performance details. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[Pa...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class UserExperienceAnalyticsAppHealthApplicationPerformance: """The user experience analytics application performance entity contains application performance details.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserExperienceAnalyticsAppHealthApplicationPerform...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UserExperienceAnalyticsAppHealthApplicationPerformance: """The user experience analytics application performance entity contains application performance details.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserExperienceAnalyticsAppHealthApplicationPerformance: ...
the_stack_v2_python_sparse
msgraph/generated/models/user_experience_analytics_app_health_application_performance.py
microsoftgraph/msgraph-sdk-python
train
135
5d31725e2e365272579c381749a397c815d54153
[ "try:\n validate_email(email)\nexcept ValidationError:\n raise ValueError('Invalid email address, please try again.')\nuser = self.model(email=self.normalize_email(email))\nif password:\n user.set_password(password)\nelse:\n user.set_unusable_password()\nuser.save(using=self._db)\nreturn user", "user ...
<|body_start_0|> try: validate_email(email) except ValidationError: raise ValueError('Invalid email address, please try again.') user = self.model(email=self.normalize_email(email)) if password: user.set_password(password) else: use...
RinkUserManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RinkUserManager: def create_user(self, email, password=None): """Creates and saves a User with the given email and password.""" <|body_0|> def create_superuser(self, email, password): """Creates and saves a superuser with the given email and password.""" <|bo...
stack_v2_sparse_classes_10k_train_003066
9,151
no_license
[ { "docstring": "Creates and saves a User with the given email and password.", "name": "create_user", "signature": "def create_user(self, email, password=None)" }, { "docstring": "Creates and saves a superuser with the given email and password.", "name": "create_superuser", "signature": "...
2
stack_v2_sparse_classes_30k_train_007189
Implement the Python class `RinkUserManager` described below. Class description: Implement the RinkUserManager class. Method signatures and docstrings: - def create_user(self, email, password=None): Creates and saves a User with the given email and password. - def create_superuser(self, email, password): Creates and ...
Implement the Python class `RinkUserManager` described below. Class description: Implement the RinkUserManager class. Method signatures and docstrings: - def create_user(self, email, password=None): Creates and saves a User with the given email and password. - def create_superuser(self, email, password): Creates and ...
e3eebf1a9bce85616df698f7e33a01688929fe53
<|skeleton|> class RinkUserManager: def create_user(self, email, password=None): """Creates and saves a User with the given email and password.""" <|body_0|> def create_superuser(self, email, password): """Creates and saves a superuser with the given email and password.""" <|bo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RinkUserManager: def create_user(self, email, password=None): """Creates and saves a User with the given email and password.""" try: validate_email(email) except ValidationError: raise ValueError('Invalid email address, please try again.') user = self.mo...
the_stack_v2_python_sparse
rink/users/models.py
MadisonRollerDerby/rink
train
0
d6caca973b4a6afbcfce6986451f8096d03f83d6
[ "for row in rows:\n if str(row.product_code) == product and str(row.activity) == state:\n if chart_type == 'order':\n product_data.append(int(row.orders))\n else:\n product_data.append(int(row.units))\n break\nelse:\n product_data.append(0)", "product_data.append(0...
<|body_start_0|> for row in rows: if str(row.product_code) == product and str(row.activity) == state: if chart_type == 'order': product_data.append(int(row.orders)) else: product_data.append(int(row.units)) break...
Gathers data for the various pipeline related charts that show progress through the workflow for all products.
PipelineChartProc
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PipelineChartProc: """Gathers data for the various pipeline related charts that show progress through the workflow for all products.""" def _appendAggregate(self, rows, product, state, chart_type, product_data): """Append the aggregate for the requested product / state combo to the l...
stack_v2_sparse_classes_10k_train_003067
3,498
no_license
[ { "docstring": "Append the aggregate for the requested product / state combo to the list of data for the current product.", "name": "_appendAggregate", "signature": "def _appendAggregate(self, rows, product, state, chart_type, product_data)" }, { "docstring": "Append sum of the aggregates for th...
3
stack_v2_sparse_classes_30k_train_004695
Implement the Python class `PipelineChartProc` described below. Class description: Gathers data for the various pipeline related charts that show progress through the workflow for all products. Method signatures and docstrings: - def _appendAggregate(self, rows, product, state, chart_type, product_data): Append the a...
Implement the Python class `PipelineChartProc` described below. Class description: Gathers data for the various pipeline related charts that show progress through the workflow for all products. Method signatures and docstrings: - def _appendAggregate(self, rows, product, state, chart_type, product_data): Append the a...
a0edcc220f5c950838c0d0a5e42ee06bb7f2c6ad
<|skeleton|> class PipelineChartProc: """Gathers data for the various pipeline related charts that show progress through the workflow for all products.""" def _appendAggregate(self, rows, product, state, chart_type, product_data): """Append the aggregate for the requested product / state combo to the l...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PipelineChartProc: """Gathers data for the various pipeline related charts that show progress through the workflow for all products.""" def _appendAggregate(self, rows, product, state, chart_type, product_data): """Append the aggregate for the requested product / state combo to the list of data f...
the_stack_v2_python_sparse
pipelinechartproc.py
ryanlowe0/misc-python
train
0
b3e87975a505a0082bf88f5c44bd6a39ca71666a
[ "super(SentinelClient, self).__init__(server, params, backend)\nself._client_write = None\nself._client_read = None\nself._connection_string = server", "try:\n connection_params = constring.split('/')\n master_name = connection_params[0]\n servers = [host_port.split(':') for host_port in connection_param...
<|body_start_0|> super(SentinelClient, self).__init__(server, params, backend) self._client_write = None self._client_read = None self._connection_string = server <|end_body_0|> <|body_start_1|> try: connection_params = constring.split('/') master_name = ...
Sentinel client object extending django-redis DefaultClient
SentinelClient
[ "MIT", "LGPL-2.1-or-later", "LGPL-3.0-only" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SentinelClient: """Sentinel client object extending django-redis DefaultClient""" def __init__(self, server, params, backend): """Slightly different logic than connection to multiple Redis servers. Reserve only one write and read descriptors, as they will be closed on exit anyway."""...
stack_v2_sparse_classes_10k_train_003068
5,721
permissive
[ { "docstring": "Slightly different logic than connection to multiple Redis servers. Reserve only one write and read descriptors, as they will be closed on exit anyway.", "name": "__init__", "signature": "def __init__(self, server, params, backend)" }, { "docstring": "Parse connection string in f...
5
null
Implement the Python class `SentinelClient` described below. Class description: Sentinel client object extending django-redis DefaultClient Method signatures and docstrings: - def __init__(self, server, params, backend): Slightly different logic than connection to multiple Redis servers. Reserve only one write and re...
Implement the Python class `SentinelClient` described below. Class description: Sentinel client object extending django-redis DefaultClient Method signatures and docstrings: - def __init__(self, server, params, backend): Slightly different logic than connection to multiple Redis servers. Reserve only one write and re...
2d708bd0d869d391456e0fb8d644af3b9f031acf
<|skeleton|> class SentinelClient: """Sentinel client object extending django-redis DefaultClient""" def __init__(self, server, params, backend): """Slightly different logic than connection to multiple Redis servers. Reserve only one write and read descriptors, as they will be closed on exit anyway."""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SentinelClient: """Sentinel client object extending django-redis DefaultClient""" def __init__(self, server, params, backend): """Slightly different logic than connection to multiple Redis servers. Reserve only one write and read descriptors, as they will be closed on exit anyway.""" supe...
the_stack_v2_python_sparse
itsm/component/data/sentinel.py
TencentBlueKing/bk-itsm
train
100
52d2f2449d0805ab45e5a5494e07e3f8921597b1
[ "medical_image = nib.load(image_path)\nimage = medical_image.get_fdata()\nwindow_the_image = window_image(image=image, window_center=window_center, window_width=window_width)\nfunc = nib.load(image_path)\nni_img = nib.Nifti1Image(window_the_image, func.affine)\nnib.save(ni_img, os.path.join(export_dir, export_name)...
<|body_start_0|> medical_image = nib.load(image_path) image = medical_image.get_fdata() window_the_image = window_image(image=image, window_center=window_center, window_width=window_width) func = nib.load(image_path) ni_img = nib.Nifti1Image(window_the_image, func.affine) ...
Windowing
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Windowing: def windowing(image_path, window_center, window_width, export_dir, export_name): """Creates a normalized image from a given image, and optionally a ROI mask for the image. Parameters ---------- image_path : str Path to the image. window_center: int Window center is sometimes r...
stack_v2_sparse_classes_10k_train_003069
4,295
no_license
[ { "docstring": "Creates a normalized image from a given image, and optionally a ROI mask for the image. Parameters ---------- image_path : str Path to the image. window_center: int Window center is sometimes referred to as window length. window_width: int export_dir: str Folder path in which the created windowe...
2
stack_v2_sparse_classes_30k_train_002560
Implement the Python class `Windowing` described below. Class description: Implement the Windowing class. Method signatures and docstrings: - def windowing(image_path, window_center, window_width, export_dir, export_name): Creates a normalized image from a given image, and optionally a ROI mask for the image. Paramet...
Implement the Python class `Windowing` described below. Class description: Implement the Windowing class. Method signatures and docstrings: - def windowing(image_path, window_center, window_width, export_dir, export_name): Creates a normalized image from a given image, and optionally a ROI mask for the image. Paramet...
fad319f2f8061ff662b16bd935abefbc0c5e176d
<|skeleton|> class Windowing: def windowing(image_path, window_center, window_width, export_dir, export_name): """Creates a normalized image from a given image, and optionally a ROI mask for the image. Parameters ---------- image_path : str Path to the image. window_center: int Window center is sometimes r...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Windowing: def windowing(image_path, window_center, window_width, export_dir, export_name): """Creates a normalized image from a given image, and optionally a ROI mask for the image. Parameters ---------- image_path : str Path to the image. window_center: int Window center is sometimes referred to as ...
the_stack_v2_python_sparse
Windowing.py
youpele52/thesis
train
2
42e72d88479772d8617878918d03b759cac61933
[ "if not prerequisites:\n return True\nindegree = [0] * numCourses\ndict = {}\nfor i in range(len(prerequisites)):\n edge = prerequisites[i]\n src = edge[1]\n dst = edge[0]\n if not dict.get(src):\n indegree[dst] += 1\n dict[src] = [dst]\n elif dst not in dict[src]:\n indegree[...
<|body_start_0|> if not prerequisites: return True indegree = [0] * numCourses dict = {} for i in range(len(prerequisites)): edge = prerequisites[i] src = edge[1] dst = edge[0] if not dict.get(src): indegree[dst]...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canFinishBFS(self, numCourses, prerequisites): """:type numCourses: int :type prerequisites: List[List[int]] :rtype: bool""" <|body_0|> def canFinishDFS(self, numCourses, prerequisites): """:type numCourses: int :type prerequisites: List[List[int]] :rty...
stack_v2_sparse_classes_10k_train_003070
4,104
no_license
[ { "docstring": ":type numCourses: int :type prerequisites: List[List[int]] :rtype: bool", "name": "canFinishBFS", "signature": "def canFinishBFS(self, numCourses, prerequisites)" }, { "docstring": ":type numCourses: int :type prerequisites: List[List[int]] :rtype: bool", "name": "canFinishDF...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canFinishBFS(self, numCourses, prerequisites): :type numCourses: int :type prerequisites: List[List[int]] :rtype: bool - def canFinishDFS(self, numCourses, prerequisites): :t...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canFinishBFS(self, numCourses, prerequisites): :type numCourses: int :type prerequisites: List[List[int]] :rtype: bool - def canFinishDFS(self, numCourses, prerequisites): :t...
0584b86642dff667f5bf6b7acfbbce86a41a55b6
<|skeleton|> class Solution: def canFinishBFS(self, numCourses, prerequisites): """:type numCourses: int :type prerequisites: List[List[int]] :rtype: bool""" <|body_0|> def canFinishDFS(self, numCourses, prerequisites): """:type numCourses: int :type prerequisites: List[List[int]] :rty...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def canFinishBFS(self, numCourses, prerequisites): """:type numCourses: int :type prerequisites: List[List[int]] :rtype: bool""" if not prerequisites: return True indegree = [0] * numCourses dict = {} for i in range(len(prerequisites)): ...
the_stack_v2_python_sparse
python_solution/201_210/CourseSchedule.py
CescWang1991/LeetCode-Python
train
1
c740e18d709baa471bc0f12144c76089953feeac
[ "json = self.json_parse(value)\nif json and json['source'] == self._YOUTUBE_MILESTONE_SOURCE:\n data = transforms.loads(json['data'])\n video_identifier = (data['video_id'], data['instance_id'])\n playhead_position = data['position']\n if playhead_position <= _POS_LIMIT_SECONDS and playhead_position != ...
<|body_start_0|> json = self.json_parse(value) if json and json['source'] == self._YOUTUBE_MILESTONE_SOURCE: data = transforms.loads(json['data']) video_identifier = (data['video_id'], data['instance_id']) playhead_position = data['position'] if playhead_p...
Generates time histogram of user video engagement. Input file: EventEntity JSON file. Each event has a 'source' that defines a place in a code where the event was recorded. Each event has a 'user_id' to represent an actor who triggered the event. The event 'data' is a JSON object and its format and content depends on t...
YoutubeHistogramGenerator
[ "Apache-2.0", "CC-BY-3.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class YoutubeHistogramGenerator: """Generates time histogram of user video engagement. Input file: EventEntity JSON file. Each event has a 'source' that defines a place in a code where the event was recorded. Each event has a 'user_id' to represent an actor who triggered the event. The event 'data' is ...
stack_v2_sparse_classes_10k_train_003071
20,093
permissive
[ { "docstring": "Filters out YouTube video data from EventEntity JSON file. Args: unused_key: int. line number of each EventEntity in file. value: str. instance of EventEntity extracted from file. Yields: A tuple of (video_identifier, time_position) to be passed into reduce function. Video_identifier is a tuple ...
2
null
Implement the Python class `YoutubeHistogramGenerator` described below. Class description: Generates time histogram of user video engagement. Input file: EventEntity JSON file. Each event has a 'source' that defines a place in a code where the event was recorded. Each event has a 'user_id' to represent an actor who tr...
Implement the Python class `YoutubeHistogramGenerator` described below. Class description: Generates time histogram of user video engagement. Input file: EventEntity JSON file. Each event has a 'source' that defines a place in a code where the event was recorded. Each event has a 'user_id' to represent an actor who tr...
64f5ea13a8d85b9ef057dddae888a427b1396df6
<|skeleton|> class YoutubeHistogramGenerator: """Generates time histogram of user video engagement. Input file: EventEntity JSON file. Each event has a 'source' that defines a place in a code where the event was recorded. Each event has a 'user_id' to represent an actor who triggered the event. The event 'data' is ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class YoutubeHistogramGenerator: """Generates time histogram of user video engagement. Input file: EventEntity JSON file. Each event has a 'source' that defines a place in a code where the event was recorded. Each event has a 'user_id' to represent an actor who triggered the event. The event 'data' is a JSON object...
the_stack_v2_python_sparse
coursebuilder/tools/etl/mapreduce_examples.py
ram8647/gcb-clone-v111
train
1
87cb2b84b7fb4a62fde3925fb0de75487186f056
[ "self.x = np.random.randint(0, 16, size=(100, 2)).astype('int64')\ny = count(self.x, 16)\nself.cum_count = np.cumsum(y).astype(self.x.dtype)\nself.out = assign_pos(self.x, self.cum_count)\nself.place = paddle.CUDAPlace(0)", "paddle.enable_static()\nwith paddle.static.program_guard(paddle.static.Program()):\n x...
<|body_start_0|> self.x = np.random.randint(0, 16, size=(100, 2)).astype('int64') y = count(self.x, 16) self.cum_count = np.cumsum(y).astype(self.x.dtype) self.out = assign_pos(self.x, self.cum_count) self.place = paddle.CUDAPlace(0) <|end_body_0|> <|body_start_1|> paddl...
TestAssignPosAPI
TestAssignPosAPI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestAssignPosAPI: """TestAssignPosAPI""" def setUp(self): """setUp""" <|body_0|> def test_MoE_assign_pos_static(self): """test_MoE_assign_pos_static""" <|body_1|> def test_MoE_assign_pos_dygraph(self): """test_MoE_assign_pos_dygraph""" ...
stack_v2_sparse_classes_10k_train_003072
3,262
no_license
[ { "docstring": "setUp", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "test_MoE_assign_pos_static", "name": "test_MoE_assign_pos_static", "signature": "def test_MoE_assign_pos_static(self)" }, { "docstring": "test_MoE_assign_pos_dygraph", "name": "test_MoE...
3
stack_v2_sparse_classes_30k_val_000394
Implement the Python class `TestAssignPosAPI` described below. Class description: TestAssignPosAPI Method signatures and docstrings: - def setUp(self): setUp - def test_MoE_assign_pos_static(self): test_MoE_assign_pos_static - def test_MoE_assign_pos_dygraph(self): test_MoE_assign_pos_dygraph
Implement the Python class `TestAssignPosAPI` described below. Class description: TestAssignPosAPI Method signatures and docstrings: - def setUp(self): setUp - def test_MoE_assign_pos_static(self): test_MoE_assign_pos_static - def test_MoE_assign_pos_dygraph(self): test_MoE_assign_pos_dygraph <|skeleton|> class Test...
bd3790ce72a2a26611b5eda3901651b5a809348f
<|skeleton|> class TestAssignPosAPI: """TestAssignPosAPI""" def setUp(self): """setUp""" <|body_0|> def test_MoE_assign_pos_static(self): """test_MoE_assign_pos_static""" <|body_1|> def test_MoE_assign_pos_dygraph(self): """test_MoE_assign_pos_dygraph""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestAssignPosAPI: """TestAssignPosAPI""" def setUp(self): """setUp""" self.x = np.random.randint(0, 16, size=(100, 2)).astype('int64') y = count(self.x, 16) self.cum_count = np.cumsum(y).astype(self.x.dtype) self.out = assign_pos(self.x, self.cum_count) sel...
the_stack_v2_python_sparse
distributed/CE_API/case/dist_MoE_assign_pos.py
PaddlePaddle/PaddleTest
train
42
63d3b2e21da89af97aa971767baa588ec0f33200
[ "if data is None:\n if lambtha <= 0:\n raise ValueError('lambtha must be a positive value')\n self.lambtha = float(lambtha)\nelse:\n if type(data) != list:\n raise TypeError('data must be a list')\n if len(data) < 2:\n raise ValueError('data must contain multiple values')\n self....
<|body_start_0|> if data is None: if lambtha <= 0: raise ValueError('lambtha must be a positive value') self.lambtha = float(lambtha) else: if type(data) != list: raise TypeError('data must be a list') if len(data) < 2: ...
Poisson distribution stats class
Exponential
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Exponential: """Poisson distribution stats class""" def __init__(self, data=None, lambtha=1.0): """Initialize poisson distribution stats""" <|body_0|> def pdf(self, x): """PMF at k number of events""" <|body_1|> def cdf(self, x): """CDF at k ...
stack_v2_sparse_classes_10k_train_003073
1,040
no_license
[ { "docstring": "Initialize poisson distribution stats", "name": "__init__", "signature": "def __init__(self, data=None, lambtha=1.0)" }, { "docstring": "PMF at k number of events", "name": "pdf", "signature": "def pdf(self, x)" }, { "docstring": "CDF at k number of events", "...
3
stack_v2_sparse_classes_30k_train_001428
Implement the Python class `Exponential` described below. Class description: Poisson distribution stats class Method signatures and docstrings: - def __init__(self, data=None, lambtha=1.0): Initialize poisson distribution stats - def pdf(self, x): PMF at k number of events - def cdf(self, x): CDF at k number of event...
Implement the Python class `Exponential` described below. Class description: Poisson distribution stats class Method signatures and docstrings: - def __init__(self, data=None, lambtha=1.0): Initialize poisson distribution stats - def pdf(self, x): PMF at k number of events - def cdf(self, x): CDF at k number of event...
a51fbcb76dae9281ff34ace0fb762ef899b4c380
<|skeleton|> class Exponential: """Poisson distribution stats class""" def __init__(self, data=None, lambtha=1.0): """Initialize poisson distribution stats""" <|body_0|> def pdf(self, x): """PMF at k number of events""" <|body_1|> def cdf(self, x): """CDF at k ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Exponential: """Poisson distribution stats class""" def __init__(self, data=None, lambtha=1.0): """Initialize poisson distribution stats""" if data is None: if lambtha <= 0: raise ValueError('lambtha must be a positive value') self.lambtha = float(l...
the_stack_v2_python_sparse
math/0x03-probability/exponential.py
Diegokernel/holbertonschool-machine_learning
train
0
7d949e7d1134bf651771606bf91fbb00001c7b16
[ "self.ids.lblText.text = 'Check des servos'\ntime.sleep(0.5)\nself.tabServo = axControl.checkAllServo(14)", "self.ids.lblText.text = 'En mouvement'\ntime.sleep(0.5)\naxControl.doFullMouvement(filename, 0.015)\nself.ids.lblText.text = 'En attente'\ntime.sleep(0.5)", "self.Check()\nself.ids.lblText.text = 'Progra...
<|body_start_0|> self.ids.lblText.text = 'Check des servos' time.sleep(0.5) self.tabServo = axControl.checkAllServo(14) <|end_body_0|> <|body_start_1|> self.ids.lblText.text = 'En mouvement' time.sleep(0.5) axControl.doFullMouvement(filename, 0.015) self.ids.lblT...
Menu principal de l'interface utilisateur
Menu
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Menu: """Menu principal de l'interface utilisateur""" def Check(self): """Check tous les servos connectes et stock la valeur dans tabServo""" <|body_0|> def StartMouvement(self, filename): """Demarre un mouvement enregistrer""" <|body_1|> def ProgMou...
stack_v2_sparse_classes_10k_train_003074
4,508
no_license
[ { "docstring": "Check tous les servos connectes et stock la valeur dans tabServo", "name": "Check", "signature": "def Check(self)" }, { "docstring": "Demarre un mouvement enregistrer", "name": "StartMouvement", "signature": "def StartMouvement(self, filename)" }, { "docstring": "...
3
stack_v2_sparse_classes_30k_train_004192
Implement the Python class `Menu` described below. Class description: Menu principal de l'interface utilisateur Method signatures and docstrings: - def Check(self): Check tous les servos connectes et stock la valeur dans tabServo - def StartMouvement(self, filename): Demarre un mouvement enregistrer - def ProgMouveme...
Implement the Python class `Menu` described below. Class description: Menu principal de l'interface utilisateur Method signatures and docstrings: - def Check(self): Check tous les servos connectes et stock la valeur dans tabServo - def StartMouvement(self, filename): Demarre un mouvement enregistrer - def ProgMouveme...
4ce70329a6ee107754acf3f01c3794989bf6394b
<|skeleton|> class Menu: """Menu principal de l'interface utilisateur""" def Check(self): """Check tous les servos connectes et stock la valeur dans tabServo""" <|body_0|> def StartMouvement(self, filename): """Demarre un mouvement enregistrer""" <|body_1|> def ProgMou...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Menu: """Menu principal de l'interface utilisateur""" def Check(self): """Check tous les servos connectes et stock la valeur dans tabServo""" self.ids.lblText.text = 'Check des servos' time.sleep(0.5) self.tabServo = axControl.checkAllServo(14) def StartMouvement(self...
the_stack_v2_python_sparse
2019 - Atom Factory/Développement/Bras_robotis/SAMFRA_RASPBERRYHUMANOIDE_2016-17/Software/R0B1/robui.py
EMBAvalais/EMBA_Eurobot
train
0
85c26497b4a9ded635b3bc22c6142db31ed7bb1f
[ "self.calc_id = calc_id\nself.data_top_dir = os.path.join(tdc_Filenames.get_vis_results_dir(), 'FMCI__%s' % calc_id)\nself.particles = self.__default_particles if particles is None else particles\ntimeinfo = tdc_TimeInfo(calc_id, self.particles[0] + '.h5')\ni_ts_max = timeinfo.get_number_of_ts()\nself.default__i_ts...
<|body_start_0|> self.calc_id = calc_id self.data_top_dir = os.path.join(tdc_Filenames.get_vis_results_dir(), 'FMCI__%s' % calc_id) self.particles = self.__default_particles if particles is None else particles timeinfo = tdc_TimeInfo(calc_id, self.particles[0] + '.h5') i_ts_max =...
Class for reading particle data from TDC simulations and creating FMCI files
tdc_FMCI_DataFiles_Maker
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class tdc_FMCI_DataFiles_Maker: """Class for reading particle data from TDC simulations and creating FMCI files""" def __init__(self, calc_id, particles=None, partition=None): """Initializes output directory name, particles, i_ts range, partition Actual calculations will be performed by ma...
stack_v2_sparse_classes_10k_train_003075
3,303
no_license
[ { "docstring": "Initializes output directory name, particles, i_ts range, partition Actual calculations will be performed by make_files(..) method", "name": "__init__", "signature": "def __init__(self, calc_id, particles=None, partition=None)" }, { "docstring": "Reads data and creates FMCI files...
2
null
Implement the Python class `tdc_FMCI_DataFiles_Maker` described below. Class description: Class for reading particle data from TDC simulations and creating FMCI files Method signatures and docstrings: - def __init__(self, calc_id, particles=None, partition=None): Initializes output directory name, particles, i_ts ran...
Implement the Python class `tdc_FMCI_DataFiles_Maker` described below. Class description: Class for reading particle data from TDC simulations and creating FMCI files Method signatures and docstrings: - def __init__(self, calc_id, particles=None, partition=None): Initializes output directory name, particles, i_ts ran...
775dc841b1d8538584c8c68a5f75ae997191e685
<|skeleton|> class tdc_FMCI_DataFiles_Maker: """Class for reading particle data from TDC simulations and creating FMCI files""" def __init__(self, calc_id, particles=None, partition=None): """Initializes output directory name, particles, i_ts range, partition Actual calculations will be performed by ma...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class tdc_FMCI_DataFiles_Maker: """Class for reading particle data from TDC simulations and creating FMCI files""" def __init__(self, calc_id, particles=None, partition=None): """Initializes output directory name, particles, i_ts range, partition Actual calculations will be performed by make_files(..) ...
the_stack_v2_python_sparse
x_DataFunctions/FMCI/tdc_fmci_datafiles_maker.py
atimokhin/tdc_vis
train
0
ee7b9a5d70f529cf10799604b4860d09d3292ac7
[ "fake_cfg = mock.MagicMock()\nfake_cfg.ssh_public_key_path = self.SSH_PUBLIC_KEY_PATH\nfake_cfg.machine_type = self.MACHINE_TYPE\nfake_cfg.network = self.NETWORK\nfake_cfg.zone = self.ZONE\nfake_cfg.resolution = '{x}x{y}x32x{dpi}'.format(x=self.X_RES, y=self.Y_RES, dpi=self.DPI)\nfake_cfg.metadata_variable = self.M...
<|body_start_0|> fake_cfg = mock.MagicMock() fake_cfg.ssh_public_key_path = self.SSH_PUBLIC_KEY_PATH fake_cfg.machine_type = self.MACHINE_TYPE fake_cfg.network = self.NETWORK fake_cfg.zone = self.ZONE fake_cfg.resolution = '{x}x{y}x32x{dpi}'.format(x=self.X_RES, y=self.Y_...
Test CheepsComputeClient.
CheepsComputeClientTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CheepsComputeClientTest: """Test CheepsComputeClient.""" def _GetFakeConfig(self): """Create a fake configuration object. Returns: A fake configuration mock object.""" <|body_0|> def setUp(self): """Set up the test.""" <|body_1|> def testCreateInstan...
stack_v2_sparse_classes_10k_train_003076
6,492
permissive
[ { "docstring": "Create a fake configuration object. Returns: A fake configuration mock object.", "name": "_GetFakeConfig", "signature": "def _GetFakeConfig(self)" }, { "docstring": "Set up the test.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test CreateI...
4
stack_v2_sparse_classes_30k_train_005342
Implement the Python class `CheepsComputeClientTest` described below. Class description: Test CheepsComputeClient. Method signatures and docstrings: - def _GetFakeConfig(self): Create a fake configuration object. Returns: A fake configuration mock object. - def setUp(self): Set up the test. - def testCreateInstance(s...
Implement the Python class `CheepsComputeClientTest` described below. Class description: Test CheepsComputeClient. Method signatures and docstrings: - def _GetFakeConfig(self): Create a fake configuration object. Returns: A fake configuration mock object. - def setUp(self): Set up the test. - def testCreateInstance(s...
78a61ca023cbf1a0cecfef8b97df2b274ac3a988
<|skeleton|> class CheepsComputeClientTest: """Test CheepsComputeClient.""" def _GetFakeConfig(self): """Create a fake configuration object. Returns: A fake configuration mock object.""" <|body_0|> def setUp(self): """Set up the test.""" <|body_1|> def testCreateInstan...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CheepsComputeClientTest: """Test CheepsComputeClient.""" def _GetFakeConfig(self): """Create a fake configuration object. Returns: A fake configuration mock object.""" fake_cfg = mock.MagicMock() fake_cfg.ssh_public_key_path = self.SSH_PUBLIC_KEY_PATH fake_cfg.machine_type...
the_stack_v2_python_sparse
tools/acloud/internal/lib/cheeps_compute_client_test.py
ZYHGOD-1/Aosp11
train
0
7ff0274a6865ec51839c177dfc1c254bb3a6a080
[ "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 Campaign Bid Modifier service. Service to manage campaign bid modifiers.
CampaignBidModifierServiceServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CampaignBidModifierServiceServicer: """Proto file describing the Campaign Bid Modifier service. Service to manage campaign bid modifiers.""" def GetCampaignBidModifier(self, request, context): """Returns the requested campaign bid modifier in full detail.""" <|body_0|> d...
stack_v2_sparse_classes_10k_train_003077
5,992
permissive
[ { "docstring": "Returns the requested campaign bid modifier in full detail.", "name": "GetCampaignBidModifier", "signature": "def GetCampaignBidModifier(self, request, context)" }, { "docstring": "Creates, updates, or removes campaign bid modifiers. Operation statuses are returned.", "name":...
2
stack_v2_sparse_classes_30k_train_003212
Implement the Python class `CampaignBidModifierServiceServicer` described below. Class description: Proto file describing the Campaign Bid Modifier service. Service to manage campaign bid modifiers. Method signatures and docstrings: - def GetCampaignBidModifier(self, request, context): Returns the requested campaign ...
Implement the Python class `CampaignBidModifierServiceServicer` described below. Class description: Proto file describing the Campaign Bid Modifier service. Service to manage campaign bid modifiers. Method signatures and docstrings: - def GetCampaignBidModifier(self, request, context): Returns the requested campaign ...
969eff5b6c3cec59d21191fa178cffb6270074c3
<|skeleton|> class CampaignBidModifierServiceServicer: """Proto file describing the Campaign Bid Modifier service. Service to manage campaign bid modifiers.""" def GetCampaignBidModifier(self, request, context): """Returns the requested campaign bid modifier in full detail.""" <|body_0|> d...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CampaignBidModifierServiceServicer: """Proto file describing the Campaign Bid Modifier service. Service to manage campaign bid modifiers.""" def GetCampaignBidModifier(self, request, context): """Returns the requested campaign bid modifier in full detail.""" context.set_code(grpc.StatusCo...
the_stack_v2_python_sparse
google/ads/google_ads/v6/proto/services/campaign_bid_modifier_service_pb2_grpc.py
VincentFritzsche/google-ads-python
train
0
51c894d1a4c736e8046b8097e8fda978168833eb
[ "if label is None:\n label = title\nif info is None:\n info = title\nif c is None:\n c = current.request.controller\nif label is None:\n if t is None:\n t = '%s_%s' % (c, f)\n if m == 'create':\n label = get_crud_string(t, 'label_create')\n elif m == 'update':\n label = get_cr...
<|body_start_0|> if label is None: label = title if info is None: info = title if c is None: c = current.request.controller if label is None: if t is None: t = '%s_%s' % (c, f) if m == 'create': l...
Links in form fields comments to show a form for adding a new foreign key record.
S3PopupLink
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class S3PopupLink: """Links in form fields comments to show a form for adding a new foreign key record.""" def __init__(self, label=None, c=None, f=None, t=None, m='create', args=None, vars=None, info=None, title=None, tooltip=None): """Constructor @param c: the target controller @param f:...
stack_v2_sparse_classes_10k_train_003078
26,788
permissive
[ { "docstring": "Constructor @param c: the target controller @param f: the target function @param t: the target table (defaults to c_f) @param m: the URL method (will be appended to args) @param args: the argument list @param vars: the request vars (format=\"popup\" will be added automatically) @param label: the...
3
null
Implement the Python class `S3PopupLink` described below. Class description: Links in form fields comments to show a form for adding a new foreign key record. Method signatures and docstrings: - def __init__(self, label=None, c=None, f=None, t=None, m='create', args=None, vars=None, info=None, title=None, tooltip=Non...
Implement the Python class `S3PopupLink` described below. Class description: Links in form fields comments to show a form for adding a new foreign key record. Method signatures and docstrings: - def __init__(self, label=None, c=None, f=None, t=None, m='create', args=None, vars=None, info=None, title=None, tooltip=Non...
7ec4b959d009daf26d5ca6ce91dd9c3c0bd978d6
<|skeleton|> class S3PopupLink: """Links in form fields comments to show a form for adding a new foreign key record.""" def __init__(self, label=None, c=None, f=None, t=None, m='create', args=None, vars=None, info=None, title=None, tooltip=None): """Constructor @param c: the target controller @param f:...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class S3PopupLink: """Links in form fields comments to show a form for adding a new foreign key record.""" def __init__(self, label=None, c=None, f=None, t=None, m='create', args=None, vars=None, info=None, title=None, tooltip=None): """Constructor @param c: the target controller @param f: the target f...
the_stack_v2_python_sparse
modules/s3layouts.py
nursix/drkcm
train
3
97f7abfcd6b16daa7fc082c01160cc04e44160fe
[ "ret = m\ndiff = n - m\ni = 0\nlast = 0\nx = 1\nwhile m != 0:\n if m % 2 == 1:\n last += x\n if x * 2 - last <= diff:\n ret -= x\n m >>= 1\n i += 1\n x *= 2\nreturn ret", "ret = m\nbuff = bin(ret)[-1::-1][:-2]\ni = 0\nlast = 0\nwhile i < len(buff):\n if buff[i] == '1':\n ...
<|body_start_0|> ret = m diff = n - m i = 0 last = 0 x = 1 while m != 0: if m % 2 == 1: last += x if x * 2 - last <= diff: ret -= x m >>= 1 i += 1 x *= 2 return ret...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rangeBitwiseAnd(self, m, n): """:type m: int :type n: int :rtype: int""" <|body_0|> def rangeBitwiseAnd1(self, m, n): """:type m: int :type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> ret = m diff = n - m...
stack_v2_sparse_classes_10k_train_003079
1,182
no_license
[ { "docstring": ":type m: int :type n: int :rtype: int", "name": "rangeBitwiseAnd", "signature": "def rangeBitwiseAnd(self, m, n)" }, { "docstring": ":type m: int :type n: int :rtype: int", "name": "rangeBitwiseAnd1", "signature": "def rangeBitwiseAnd1(self, m, n)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rangeBitwiseAnd(self, m, n): :type m: int :type n: int :rtype: int - def rangeBitwiseAnd1(self, m, n): :type m: int :type n: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rangeBitwiseAnd(self, m, n): :type m: int :type n: int :rtype: int - def rangeBitwiseAnd1(self, m, n): :type m: int :type n: int :rtype: int <|skeleton|> class Solution: ...
70bdd75b6af2e1811c1beab22050c01d28d7373e
<|skeleton|> class Solution: def rangeBitwiseAnd(self, m, n): """:type m: int :type n: int :rtype: int""" <|body_0|> def rangeBitwiseAnd1(self, m, n): """:type m: int :type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def rangeBitwiseAnd(self, m, n): """:type m: int :type n: int :rtype: int""" ret = m diff = n - m i = 0 last = 0 x = 1 while m != 0: if m % 2 == 1: last += x if x * 2 - last <= diff: ...
the_stack_v2_python_sparse
python/leetcode/201_Bitwise_AND_of_Numbers_Range.py
bobcaoge/my-code
train
0
32632a85dc78eef9588f422bb3ad2b38452baa05
[ "if (delta_value := data.get('delta')):\n if isinstance(delta_value, str):\n if (internal_value := DISTRIBUTED_COST_INTERNAL.get(delta_value)):\n data['delta'] = internal_value\n if delta_value == 'cost':\n data['delta'] = 'cost_total'\nreturn super().to_internal_value(data)",...
<|body_start_0|> if (delta_value := data.get('delta')): if isinstance(delta_value, str): if (internal_value := DISTRIBUTED_COST_INTERNAL.get(delta_value)): data['delta'] = internal_value if delta_value == 'cost': data['delta'] =...
Serializer for handling query parameters.
OCPQueryParamSerializer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OCPQueryParamSerializer: """Serializer for handling query parameters.""" def to_internal_value(self, data): """Send to internal value.""" <|body_0|> def validate(self, data): """Validate incoming data. Args: data (Dict): data to be validated Returns: (Dict): Vali...
stack_v2_sparse_classes_10k_train_003080
8,876
permissive
[ { "docstring": "Send to internal value.", "name": "to_internal_value", "signature": "def to_internal_value(self, data)" }, { "docstring": "Validate incoming data. Args: data (Dict): data to be validated Returns: (Dict): Validated data Raises: (ValidationError): if field inputs are invalid", ...
3
null
Implement the Python class `OCPQueryParamSerializer` described below. Class description: Serializer for handling query parameters. Method signatures and docstrings: - def to_internal_value(self, data): Send to internal value. - def validate(self, data): Validate incoming data. Args: data (Dict): data to be validated ...
Implement the Python class `OCPQueryParamSerializer` described below. Class description: Serializer for handling query parameters. Method signatures and docstrings: - def to_internal_value(self, data): Send to internal value. - def validate(self, data): Validate incoming data. Args: data (Dict): data to be validated ...
0416e5216eb1ec4b41c8dd4999adde218b1ab2e1
<|skeleton|> class OCPQueryParamSerializer: """Serializer for handling query parameters.""" def to_internal_value(self, data): """Send to internal value.""" <|body_0|> def validate(self, data): """Validate incoming data. Args: data (Dict): data to be validated Returns: (Dict): Vali...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class OCPQueryParamSerializer: """Serializer for handling query parameters.""" def to_internal_value(self, data): """Send to internal value.""" if (delta_value := data.get('delta')): if isinstance(delta_value, str): if (internal_value := DISTRIBUTED_COST_INTERNAL.get...
the_stack_v2_python_sparse
koku/api/report/ocp/serializers.py
project-koku/koku
train
225
dad96cbd4d7e089285f9cd78b3f95b86601ca9fe
[ "self.name = name\nself.motion_based_retention_enabled = motion_based_retention_enabled\nself.restricted_bandwidth_mode_enabled = restricted_bandwidth_mode_enabled\nself.audio_recording_enabled = audio_recording_enabled\nself.cloud_archive_enabled = cloud_archive_enabled\nself.schedule_id = schedule_id\nself.max_re...
<|body_start_0|> self.name = name self.motion_based_retention_enabled = motion_based_retention_enabled self.restricted_bandwidth_mode_enabled = restricted_bandwidth_mode_enabled self.audio_recording_enabled = audio_recording_enabled self.cloud_archive_enabled = cloud_archive_enab...
Implementation of the 'createNetworkCameraQualityRetentionProfile' model. TODO: type model description here. Attributes: name (string): The name of the new profile. Must be unique. This parameter is required. motion_based_retention_enabled (bool): Deletes footage older than 3 days in which no motion was detected. Can b...
CreateNetworkCameraQualityRetentionProfileModel
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreateNetworkCameraQualityRetentionProfileModel: """Implementation of the 'createNetworkCameraQualityRetentionProfile' model. TODO: type model description here. Attributes: name (string): The name of the new profile. Must be unique. This parameter is required. motion_based_retention_enabled (bool...
stack_v2_sparse_classes_10k_train_003081
4,849
permissive
[ { "docstring": "Constructor for the CreateNetworkCameraQualityRetentionProfileModel class", "name": "__init__", "signature": "def __init__(self, name=None, motion_based_retention_enabled=None, restricted_bandwidth_mode_enabled=None, audio_recording_enabled=None, cloud_archive_enabled=None, schedule_id=N...
2
null
Implement the Python class `CreateNetworkCameraQualityRetentionProfileModel` described below. Class description: Implementation of the 'createNetworkCameraQualityRetentionProfile' model. TODO: type model description here. Attributes: name (string): The name of the new profile. Must be unique. This parameter is require...
Implement the Python class `CreateNetworkCameraQualityRetentionProfileModel` described below. Class description: Implementation of the 'createNetworkCameraQualityRetentionProfile' model. TODO: type model description here. Attributes: name (string): The name of the new profile. Must be unique. This parameter is require...
9894089eb013318243ae48869cc5130eb37f80c0
<|skeleton|> class CreateNetworkCameraQualityRetentionProfileModel: """Implementation of the 'createNetworkCameraQualityRetentionProfile' model. TODO: type model description here. Attributes: name (string): The name of the new profile. Must be unique. This parameter is required. motion_based_retention_enabled (bool...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CreateNetworkCameraQualityRetentionProfileModel: """Implementation of the 'createNetworkCameraQualityRetentionProfile' model. TODO: type model description here. Attributes: name (string): The name of the new profile. Must be unique. This parameter is required. motion_based_retention_enabled (bool): Deletes fo...
the_stack_v2_python_sparse
meraki_sdk/models/create_network_camera_quality_retention_profile_model.py
RaulCatalano/meraki-python-sdk
train
1
17b43884f48ee17119d19e1826fff9011ceb2482
[ "if a >= b + c or b >= a + c or c >= a + b:\n raise TriangleError\nself.a, self.b, self.c = (a, b, c)", "distinct_edges = len(set([self.a, self.b, self.c]))\nif distinct_edges == 1:\n return TRIANGLE_KIND_EQUILATERAL\nelif distinct_edges == 2:\n return TRIANGLE_KIND_ISOSCELES\nelse:\n return TRIANGLE_...
<|body_start_0|> if a >= b + c or b >= a + c or c >= a + b: raise TriangleError self.a, self.b, self.c = (a, b, c) <|end_body_0|> <|body_start_1|> distinct_edges = len(set([self.a, self.b, self.c])) if distinct_edges == 1: return TRIANGLE_KIND_EQUILATERAL ...
A Triangle
Triangle
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Triangle: """A Triangle""" def __init__(self, a, b, c): """Create new triangle from given edges a, b and c. Raises: TriangleError: If given edges do not conform to the triangle inequality.""" <|body_0|> def kind(self): """Return which kind of triangle this is."""...
stack_v2_sparse_classes_10k_train_003082
954
no_license
[ { "docstring": "Create new triangle from given edges a, b and c. Raises: TriangleError: If given edges do not conform to the triangle inequality.", "name": "__init__", "signature": "def __init__(self, a, b, c)" }, { "docstring": "Return which kind of triangle this is.", "name": "kind", "...
2
stack_v2_sparse_classes_30k_train_003832
Implement the Python class `Triangle` described below. Class description: A Triangle Method signatures and docstrings: - def __init__(self, a, b, c): Create new triangle from given edges a, b and c. Raises: TriangleError: If given edges do not conform to the triangle inequality. - def kind(self): Return which kind of...
Implement the Python class `Triangle` described below. Class description: A Triangle Method signatures and docstrings: - def __init__(self, a, b, c): Create new triangle from given edges a, b and c. Raises: TriangleError: If given edges do not conform to the triangle inequality. - def kind(self): Return which kind of...
be0e2f635a7558f56c61bc0b36c6146b01d1e6e6
<|skeleton|> class Triangle: """A Triangle""" def __init__(self, a, b, c): """Create new triangle from given edges a, b and c. Raises: TriangleError: If given edges do not conform to the triangle inequality.""" <|body_0|> def kind(self): """Return which kind of triangle this is."""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Triangle: """A Triangle""" def __init__(self, a, b, c): """Create new triangle from given edges a, b and c. Raises: TriangleError: If given edges do not conform to the triangle inequality.""" if a >= b + c or b >= a + c or c >= a + b: raise TriangleError self.a, self.b...
the_stack_v2_python_sparse
all_data/exercism_data/python/triangle/c4a35fc8be7140458c7d674bd3662f2c.py
itsolutionscorp/AutoStyle-Clustering
train
4
1099acb6e84b4c95dcd0779733248cdc778f5d8a
[ "self.start = start\nself.end = end\ndx = end[0] - start[0]\nif dx == 0:\n self.m = None\n self.n = None\nelse:\n self.m = float(end[1] - start[1]) / dx\n self.n = float(start[1] * end[0] - end[1] * start[0]) / dx", "if self.m == None:\n if abs(x - self.start[0]) > 0.6:\n return False\n e...
<|body_start_0|> self.start = start self.end = end dx = end[0] - start[0] if dx == 0: self.m = None self.n = None else: self.m = float(end[1] - start[1]) / dx self.n = float(start[1] * end[0] - end[1] * start[0]) / dx <|end_body_0|>...
Represents a line between two points.
Segment
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Segment: """Represents a line between two points.""" def __init__(self, start, end): """Constructor. - start: An (x, y) pair with the coordinates where the line starts. - end: An (x, y) pair with the coordinates where the line ends.""" <|body_0|> def contains_point(self,...
stack_v2_sparse_classes_10k_train_003083
8,303
no_license
[ { "docstring": "Constructor. - start: An (x, y) pair with the coordinates where the line starts. - end: An (x, y) pair with the coordinates where the line ends.", "name": "__init__", "signature": "def __init__(self, start, end)" }, { "docstring": "Determines if the point is part of the segment."...
3
stack_v2_sparse_classes_30k_train_002770
Implement the Python class `Segment` described below. Class description: Represents a line between two points. Method signatures and docstrings: - def __init__(self, start, end): Constructor. - start: An (x, y) pair with the coordinates where the line starts. - end: An (x, y) pair with the coordinates where the line ...
Implement the Python class `Segment` described below. Class description: Represents a line between two points. Method signatures and docstrings: - def __init__(self, start, end): Constructor. - start: An (x, y) pair with the coordinates where the line starts. - end: An (x, y) pair with the coordinates where the line ...
3a7762c06d1c1fd115cf6e563a45b323c78926bd
<|skeleton|> class Segment: """Represents a line between two points.""" def __init__(self, start, end): """Constructor. - start: An (x, y) pair with the coordinates where the line starts. - end: An (x, y) pair with the coordinates where the line ends.""" <|body_0|> def contains_point(self,...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Segment: """Represents a line between two points.""" def __init__(self, start, end): """Constructor. - start: An (x, y) pair with the coordinates where the line starts. - end: An (x, y) pair with the coordinates where the line ends.""" self.start = start self.end = end dx ...
the_stack_v2_python_sparse
game/framework/geometry.py
sugar-activities/4444-activity
train
0
2ec589c14498750098724158d44fc12a80ec5260
[ "BasePoller.__init__(self, config, generator)\nself.couch = None\nself._query = '/_stats'\nself._setUp()", "try:\n couchURL = getattr(self.config, 'couchURL', None)\n if not couchURL:\n raise Exception(\"Configuration value 'couchURL' missing, can't connect to CouchDB.\")\n self.couch = CouchServe...
<|body_start_0|> BasePoller.__init__(self, config, generator) self.couch = None self._query = '/_stats' self._setUp() <|end_body_0|> <|body_start_1|> try: couchURL = getattr(self.config, 'couchURL', None) if not couchURL: raise Exception("...
Polling CouchDb statistics values - number of status error codes (configurable).
CouchErrorsPoller
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CouchErrorsPoller: """Polling CouchDb statistics values - number of status error codes (configurable).""" def __init__(self, config, generator): """couch - instance of CouchServer class""" <|body_0|> def _setUp(self): """Instantiate CouchServer reference. Test co...
stack_v2_sparse_classes_10k_train_003084
9,060
no_license
[ { "docstring": "couch - instance of CouchServer class", "name": "__init__", "signature": "def __init__(self, config, generator)" }, { "docstring": "Instantiate CouchServer reference. Test connection with CouchDB (first connect and retrieve attempt).", "name": "_setUp", "signature": "def ...
4
stack_v2_sparse_classes_30k_val_000407
Implement the Python class `CouchErrorsPoller` described below. Class description: Polling CouchDb statistics values - number of status error codes (configurable). Method signatures and docstrings: - def __init__(self, config, generator): couch - instance of CouchServer class - def _setUp(self): Instantiate CouchServ...
Implement the Python class `CouchErrorsPoller` described below. Class description: Polling CouchDb statistics values - number of status error codes (configurable). Method signatures and docstrings: - def __init__(self, config, generator): couch - instance of CouchServer class - def _setUp(self): Instantiate CouchServ...
f4cb398de940560e40491ba676b704e1489d4682
<|skeleton|> class CouchErrorsPoller: """Polling CouchDb statistics values - number of status error codes (configurable).""" def __init__(self, config, generator): """couch - instance of CouchServer class""" <|body_0|> def _setUp(self): """Instantiate CouchServer reference. Test co...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CouchErrorsPoller: """Polling CouchDb statistics values - number of status error codes (configurable).""" def __init__(self, config, generator): """couch - instance of CouchServer class""" BasePoller.__init__(self, config, generator) self.couch = None self._query = '/_stat...
the_stack_v2_python_sparse
src/python/WMComponent/AlertGenerator/Pollers/Couch.py
PerilousApricot/WMCore
train
1
03a8dd03eacea4683ee3b2d017aaf8a5e64eab21
[ "security = getSecurityManager()\nwant_referer = REQUEST['URL1'] + '/manage_owner'\ngot_referer = '%s://%s%s' % parse.urlparse(REQUEST['HTTP_REFERER'])[:3]\n__traceback_info__ = (want_referer, got_referer)\nif want_referer != got_referer or security.calledByExecutable():\n raise Unauthorized('manage_takeOwnershi...
<|body_start_0|> security = getSecurityManager() want_referer = REQUEST['URL1'] + '/manage_owner' got_referer = '%s://%s%s' % parse.urlparse(REQUEST['HTTP_REFERER'])[:3] __traceback_info__ = (want_referer, got_referer) if want_referer != got_referer or security.calledByExecutable...
Owned
[ "ZPL-2.1" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Owned: def manage_takeOwnership(self, REQUEST, RESPONSE, recursive=0): """Take ownership (responsibility) for an object. If 'recursive' is true, then also take ownership of all sub-objects.""" <|body_0|> def manage_changeOwnershipType(self, explicit=1, RESPONSE=None, REQUEST...
stack_v2_sparse_classes_10k_train_003085
3,508
permissive
[ { "docstring": "Take ownership (responsibility) for an object. If 'recursive' is true, then also take ownership of all sub-objects.", "name": "manage_takeOwnership", "signature": "def manage_takeOwnership(self, REQUEST, RESPONSE, recursive=0)" }, { "docstring": "Change the type (implicit or expl...
2
stack_v2_sparse_classes_30k_train_001547
Implement the Python class `Owned` described below. Class description: Implement the Owned class. Method signatures and docstrings: - def manage_takeOwnership(self, REQUEST, RESPONSE, recursive=0): Take ownership (responsibility) for an object. If 'recursive' is true, then also take ownership of all sub-objects. - de...
Implement the Python class `Owned` described below. Class description: Implement the Owned class. Method signatures and docstrings: - def manage_takeOwnership(self, REQUEST, RESPONSE, recursive=0): Take ownership (responsibility) for an object. If 'recursive' is true, then also take ownership of all sub-objects. - de...
c31b1c635e85a1766f2666cb0bd117337ae5fa67
<|skeleton|> class Owned: def manage_takeOwnership(self, REQUEST, RESPONSE, recursive=0): """Take ownership (responsibility) for an object. If 'recursive' is true, then also take ownership of all sub-objects.""" <|body_0|> def manage_changeOwnershipType(self, explicit=1, RESPONSE=None, REQUEST...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Owned: def manage_takeOwnership(self, REQUEST, RESPONSE, recursive=0): """Take ownership (responsibility) for an object. If 'recursive' is true, then also take ownership of all sub-objects.""" security = getSecurityManager() want_referer = REQUEST['URL1'] + '/manage_owner' got_...
the_stack_v2_python_sparse
src/OFS/owner.py
zopefoundation/Zope
train
335
de8847e42af40839fc7bf4d0c550d4a922c508f3
[ "if action.actor == self.tracked:\n return True\nif not self.actor_only and (self.tracked in action.targets.all() or self.tracked in action.related.all()):\n return True\nreturn False", "if not TRACK_UNREAD:\n return set()\ntrackers = Tracker.objects.exclude(pk=self.pk).filter(user=self.user, last_update...
<|body_start_0|> if action.actor == self.tracked: return True if not self.actor_only and (self.tracked in action.targets.all() or self.tracked in action.related.all()): return True return False <|end_body_0|> <|body_start_1|> if not TRACK_UNREAD: retu...
A base class for Tracker and TempTracker
TrackerBase
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TrackerBase: """A base class for Tracker and TempTracker""" def matches(self, action): """Returns true if an action is to be tracked by the Tracker object""" <|body_0|> def update_unread(self, already_fetched=()): """Retrieves the actions having occurred after th...
stack_v2_sparse_classes_10k_train_003086
12,849
permissive
[ { "docstring": "Returns true if an action is to be tracked by the Tracker object", "name": "matches", "signature": "def matches(self, action)" }, { "docstring": "Retrieves the actions having occurred after the last time the tracker was updated and mark them as unread (bulk-add to unread_actions)...
2
stack_v2_sparse_classes_30k_train_002420
Implement the Python class `TrackerBase` described below. Class description: A base class for Tracker and TempTracker Method signatures and docstrings: - def matches(self, action): Returns true if an action is to be tracked by the Tracker object - def update_unread(self, already_fetched=()): Retrieves the actions hav...
Implement the Python class `TrackerBase` described below. Class description: A base class for Tracker and TempTracker Method signatures and docstrings: - def matches(self, action): Returns true if an action is to be tracked by the Tracker object - def update_unread(self, already_fetched=()): Retrieves the actions hav...
014a6662b2d01673f17f8b8cb828570ad828650c
<|skeleton|> class TrackerBase: """A base class for Tracker and TempTracker""" def matches(self, action): """Returns true if an action is to be tracked by the Tracker object""" <|body_0|> def update_unread(self, already_fetched=()): """Retrieves the actions having occurred after th...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TrackerBase: """A base class for Tracker and TempTracker""" def matches(self, action): """Returns true if an action is to be tracked by the Tracker object""" if action.actor == self.tracked: return True if not self.actor_only and (self.tracked in action.targets.all() o...
the_stack_v2_python_sparse
actrack/models.py
tkhyn/django-actrack
train
1
8c59089a4194e700ad0b78eb4f9150753f24d4e4
[ "if type(rho) is type(1):\n self.order = rho\n self.rho = np.zeros(self.order, np.float64)\nelse:\n self.rho = np.squeeze(np.asarray(rho))\n if len(self.rho.shape) not in [0, 1]:\n raise ValueError('AR parameters must be a scalar or a vector')\n if self.rho.shape == ():\n self.rho.shape...
<|body_start_0|> if type(rho) is type(1): self.order = rho self.rho = np.zeros(self.order, np.float64) else: self.rho = np.squeeze(np.asarray(rho)) if len(self.rho.shape) not in [0, 1]: raise ValueError('AR parameters must be a scalar or a ...
A regression model with an AR(p) covariance structure. In terms of a LikelihoodModel, the parameters are beta, the usual regression parameters, and sigma, a scalar nuisance parameter that shows up as multiplier in front of the AR(p) covariance. The linear autoregressive process of order p--AR(p)--is defined as: TODO Ex...
ARModel
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ARModel: """A regression model with an AR(p) covariance structure. In terms of a LikelihoodModel, the parameters are beta, the usual regression parameters, and sigma, a scalar nuisance parameter that shows up as multiplier in front of the AR(p) covariance. The linear autoregressive process of ord...
stack_v2_sparse_classes_10k_train_003087
29,072
permissive
[ { "docstring": "Initialize AR model instance Parameters ---------- design : ndarray 2D array with design matrix rho : int or array-like If int, gives order of model, and initializes rho to zeros. If ndarray, gives initial estimate of rho. Be careful as ``ARModel(X, 1) != ARModel(X, 1.0)``.", "name": "__init...
3
stack_v2_sparse_classes_30k_train_005089
Implement the Python class `ARModel` described below. Class description: A regression model with an AR(p) covariance structure. In terms of a LikelihoodModel, the parameters are beta, the usual regression parameters, and sigma, a scalar nuisance parameter that shows up as multiplier in front of the AR(p) covariance. T...
Implement the Python class `ARModel` described below. Class description: A regression model with an AR(p) covariance structure. In terms of a LikelihoodModel, the parameters are beta, the usual regression parameters, and sigma, a scalar nuisance parameter that shows up as multiplier in front of the AR(p) covariance. T...
7eede02471567487e454016c1e7cf637d3afac9e
<|skeleton|> class ARModel: """A regression model with an AR(p) covariance structure. In terms of a LikelihoodModel, the parameters are beta, the usual regression parameters, and sigma, a scalar nuisance parameter that shows up as multiplier in front of the AR(p) covariance. The linear autoregressive process of ord...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ARModel: """A regression model with an AR(p) covariance structure. In terms of a LikelihoodModel, the parameters are beta, the usual regression parameters, and sigma, a scalar nuisance parameter that shows up as multiplier in front of the AR(p) covariance. The linear autoregressive process of order p--AR(p)--...
the_stack_v2_python_sparse
nipy/algorithms/statistics/models/regression.py
nipy/nipy
train
275
793e9053b218a4c4ece4d609e02a50cd685bfa1b
[ "super(Conv2dSubsampling, self).__init__()\nself.conv = nn.Sequential(nn.Conv2d(in_channels=1, out_channels=odim, kernel_size=3, stride=2), nn.ReLU(), nn.Conv2d(in_channels=odim, out_channels=odim, kernel_size=3, stride=2), nn.ReLU())\nself.out = nn.Linear(odim * (((idim - 1) // 2 - 1) // 2), odim)", "x = x.unsqu...
<|body_start_0|> super(Conv2dSubsampling, self).__init__() self.conv = nn.Sequential(nn.Conv2d(in_channels=1, out_channels=odim, kernel_size=3, stride=2), nn.ReLU(), nn.Conv2d(in_channels=odim, out_channels=odim, kernel_size=3, stride=2), nn.ReLU()) self.out = nn.Linear(odim * (((idim - 1) // 2 ...
Convolutional 2D subsampling (to 1/4 length). Modified from https://github.com/espnet/espnet/blob/master/espnet/nets/pytorch_backend/transformer/subsampling.py Args: idim: Input dimension. odim: Output dimension.
Conv2dSubsampling
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Conv2dSubsampling: """Convolutional 2D subsampling (to 1/4 length). Modified from https://github.com/espnet/espnet/blob/master/espnet/nets/pytorch_backend/transformer/subsampling.py Args: idim: Input dimension. odim: Output dimension.""" def __init__(self, idim: int, odim: int) -> None: ...
stack_v2_sparse_classes_10k_train_003088
33,189
permissive
[ { "docstring": "Construct a Conv2dSubsampling object.", "name": "__init__", "signature": "def __init__(self, idim: int, odim: int) -> None" }, { "docstring": "Subsample x. Args: x: Input tensor of dimension (batch_size, input_length, num_features). (#batch, time, idim). Returns: torch.Tensor: Su...
2
stack_v2_sparse_classes_30k_train_001078
Implement the Python class `Conv2dSubsampling` described below. Class description: Convolutional 2D subsampling (to 1/4 length). Modified from https://github.com/espnet/espnet/blob/master/espnet/nets/pytorch_backend/transformer/subsampling.py Args: idim: Input dimension. odim: Output dimension. Method signatures and ...
Implement the Python class `Conv2dSubsampling` described below. Class description: Convolutional 2D subsampling (to 1/4 length). Modified from https://github.com/espnet/espnet/blob/master/espnet/nets/pytorch_backend/transformer/subsampling.py Args: idim: Input dimension. odim: Output dimension. Method signatures and ...
2dda31e14039a79b77c89bcd3bb96d52cbf60c8a
<|skeleton|> class Conv2dSubsampling: """Convolutional 2D subsampling (to 1/4 length). Modified from https://github.com/espnet/espnet/blob/master/espnet/nets/pytorch_backend/transformer/subsampling.py Args: idim: Input dimension. odim: Output dimension.""" def __init__(self, idim: int, odim: int) -> None: ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Conv2dSubsampling: """Convolutional 2D subsampling (to 1/4 length). Modified from https://github.com/espnet/espnet/blob/master/espnet/nets/pytorch_backend/transformer/subsampling.py Args: idim: Input dimension. odim: Output dimension.""" def __init__(self, idim: int, odim: int) -> None: """Constr...
the_stack_v2_python_sparse
snowfall/models/transformer.py
csukuangfj/snowfall
train
0
9792d99b734927d3d3597c5682b97653fe389210
[ "if len(s) == 0:\n return 0\ni, j, ans, length, pre_set = (0, 0, 0, len(s), set(s[0]))\nfor i in range(length):\n while j + 1 < length and s[j + 1] not in pre_set:\n pre_set.add(s[j + 1])\n j += 1\n ans = max(ans, len(pre_set))\n pre_set.remove(s[i])\n if j == length:\n break\nre...
<|body_start_0|> if len(s) == 0: return 0 i, j, ans, length, pre_set = (0, 0, 0, len(s), set(s[0])) for i in range(length): while j + 1 < length and s[j + 1] not in pre_set: pre_set.add(s[j + 1]) j += 1 ans = max(ans, len(pre_se...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lengthOfLongestSubstring(self, s): """:type s: str :rtype: int""" <|body_0|> def lengthOfLongestSubstring(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(s) == 0: return 0 ...
stack_v2_sparse_classes_10k_train_003089
1,123
no_license
[ { "docstring": ":type s: str :rtype: int", "name": "lengthOfLongestSubstring", "signature": "def lengthOfLongestSubstring(self, s)" }, { "docstring": ":type s: str :rtype: int", "name": "lengthOfLongestSubstring", "signature": "def lengthOfLongestSubstring(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_001603
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLongestSubstring(self, s): :type s: str :rtype: int - def lengthOfLongestSubstring(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 lengthOfLongestSubstring(self, s): :type s: str :rtype: int - def lengthOfLongestSubstring(self, s): :type s: str :rtype: int <|skeleton|> class Solution: def lengthOfL...
c162817f717b78997197649c084c27af48c3fd6f
<|skeleton|> class Solution: def lengthOfLongestSubstring(self, s): """:type s: str :rtype: int""" <|body_0|> def lengthOfLongestSubstring(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def lengthOfLongestSubstring(self, s): """:type s: str :rtype: int""" if len(s) == 0: return 0 i, j, ans, length, pre_set = (0, 0, 0, len(s), set(s[0])) for i in range(length): while j + 1 < length and s[j + 1] not in pre_set: p...
the_stack_v2_python_sparse
Week_09/3.无重复字符的最长子串.py
dream201188/algorithm017
train
1
deef330d6975a7ef77189a3b834ceeb97a8d0946
[ "length = len(s)\nsize = [0 for i in range(length)]\nstack = [0 for i in range(length)]\nstackPtr = 0\nsumming = 0\nres = 0\nfor i, char in enumerate(s):\n if char == '(':\n stack[stackPtr] = i\n stackPtr += 1\n elif char == ')':\n if stackPtr > 0:\n prev = stack[stackPtr - 1]\...
<|body_start_0|> length = len(s) size = [0 for i in range(length)] stack = [0 for i in range(length)] stackPtr = 0 summing = 0 res = 0 for i, char in enumerate(s): if char == '(': stack[stackPtr] = i stackPtr += 1 ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestValidParentheses(self, s): """:type s: str :rtype: int""" <|body_0|> def longestValidParentheses2(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> length = len(s) size = [0 for i in r...
stack_v2_sparse_classes_10k_train_003090
1,528
permissive
[ { "docstring": ":type s: str :rtype: int", "name": "longestValidParentheses", "signature": "def longestValidParentheses(self, s)" }, { "docstring": ":type s: str :rtype: int", "name": "longestValidParentheses2", "signature": "def longestValidParentheses2(self, s)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestValidParentheses(self, s): :type s: str :rtype: int - def longestValidParentheses2(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 longestValidParentheses(self, s): :type s: str :rtype: int - def longestValidParentheses2(self, s): :type s: str :rtype: int <|skeleton|> class Solution: def longestVal...
c8bf33af30569177c5276ffcd72a8d93ba4c402a
<|skeleton|> class Solution: def longestValidParentheses(self, s): """:type s: str :rtype: int""" <|body_0|> def longestValidParentheses2(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def longestValidParentheses(self, s): """:type s: str :rtype: int""" length = len(s) size = [0 for i in range(length)] stack = [0 for i in range(length)] stackPtr = 0 summing = 0 res = 0 for i, char in enumerate(s): if char ...
the_stack_v2_python_sparse
1-100/31-40/32-longestValidParenthesis/longestValidParenthesis.py
xuychen/Leetcode
train
0
79fd783e07972dd497efd314089114f536ced46f
[ "logger.info('Get a specific role by Id', data=uuid)\nrole = Role.query.get(uuid)\nreturn role_schema.jsonify(role)", "logger.info('Update role')\nrole_obj = Role.query.get(uuid)\nif role_obj is None:\n return ({'message': 'Role not found'}, 404)\njson_data = request.get_json(force=True)\nif not json_data:\n ...
<|body_start_0|> logger.info('Get a specific role by Id', data=uuid) role = Role.query.get(uuid) return role_schema.jsonify(role) <|end_body_0|> <|body_start_1|> logger.info('Update role') role_obj = Role.query.get(uuid) if role_obj is None: return ({'message...
Role detail funtions written
RoleDetail
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RoleDetail: """Role detail funtions written""" def get(self, uuid): """Get a specific role by id""" <|body_0|> def put(self, uuid): """Update role""" <|body_1|> <|end_skeleton|> <|body_start_0|> logger.info('Get a specific role by Id', data=uuid...
stack_v2_sparse_classes_10k_train_003091
3,667
no_license
[ { "docstring": "Get a specific role by id", "name": "get", "signature": "def get(self, uuid)" }, { "docstring": "Update role", "name": "put", "signature": "def put(self, uuid)" } ]
2
stack_v2_sparse_classes_30k_train_005859
Implement the Python class `RoleDetail` described below. Class description: Role detail funtions written Method signatures and docstrings: - def get(self, uuid): Get a specific role by id - def put(self, uuid): Update role
Implement the Python class `RoleDetail` described below. Class description: Role detail funtions written Method signatures and docstrings: - def get(self, uuid): Get a specific role by id - def put(self, uuid): Update role <|skeleton|> class RoleDetail: """Role detail funtions written""" def get(self, uuid)...
4dc5f5e816e3c461b8a60c5f61c7eafc08050579
<|skeleton|> class RoleDetail: """Role detail funtions written""" def get(self, uuid): """Get a specific role by id""" <|body_0|> def put(self, uuid): """Update role""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RoleDetail: """Role detail funtions written""" def get(self, uuid): """Get a specific role by id""" logger.info('Get a specific role by Id', data=uuid) role = Role.query.get(uuid) return role_schema.jsonify(role) def put(self, uuid): """Update role""" ...
the_stack_v2_python_sparse
app/api/role.py
ekramulmostafa/ms-auth
train
0
4a0521e733d7580ef3eba6519f3e26a369b68637
[ "super().__init__()\nself.ratio = ratio\nself.kernel_size = kernel_size\nif pooling_class == 'icosahedron':\n self.pooling_class = Icosahedron()\n self.laps = get_icosahedron_laplacians(N, depth, laplacian_type)\nelif pooling_class == 'healpix':\n self.pooling_class = Healpix()\n self.laps = get_healpix...
<|body_start_0|> super().__init__() self.ratio = ratio self.kernel_size = kernel_size if pooling_class == 'icosahedron': self.pooling_class = Icosahedron() self.laps = get_icosahedron_laplacians(N, depth, laplacian_type) elif pooling_class == 'healpix': ...
Spherical GCNN Autoencoder.
SphericalUNet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SphericalUNet: """Spherical GCNN Autoencoder.""" def __init__(self, pooling_class, N, depth, laplacian_type, kernel_size, ratio=1): """Initialization. Args: pooling_class (obj): One of three classes of pooling methods N (int): Number of pixels in the input image depth (int): The dept...
stack_v2_sparse_classes_10k_train_003092
41,403
no_license
[ { "docstring": "Initialization. Args: pooling_class (obj): One of three classes of pooling methods N (int): Number of pixels in the input image depth (int): The depth of the UNet, which is bounded by the N and the type of pooling kernel_size (int): chebychev polynomial degree ratio (float): Parameter for equian...
2
null
Implement the Python class `SphericalUNet` described below. Class description: Spherical GCNN Autoencoder. Method signatures and docstrings: - def __init__(self, pooling_class, N, depth, laplacian_type, kernel_size, ratio=1): Initialization. Args: pooling_class (obj): One of three classes of pooling methods N (int): ...
Implement the Python class `SphericalUNet` described below. Class description: Spherical GCNN Autoencoder. Method signatures and docstrings: - def __init__(self, pooling_class, N, depth, laplacian_type, kernel_size, ratio=1): Initialization. Args: pooling_class (obj): One of three classes of pooling methods N (int): ...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class SphericalUNet: """Spherical GCNN Autoencoder.""" def __init__(self, pooling_class, N, depth, laplacian_type, kernel_size, ratio=1): """Initialization. Args: pooling_class (obj): One of three classes of pooling methods N (int): Number of pixels in the input image depth (int): The dept...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SphericalUNet: """Spherical GCNN Autoencoder.""" def __init__(self, pooling_class, N, depth, laplacian_type, kernel_size, ratio=1): """Initialization. Args: pooling_class (obj): One of three classes of pooling methods N (int): Number of pixels in the input image depth (int): The depth of the UNet...
the_stack_v2_python_sparse
generated/test_deepsphere_deepsphere_pytorch.py
jansel/pytorch-jit-paritybench
train
35
1b0f74feca4f6fe4f71e4405f11880a178f4e31c
[ "self.check_authenticator_managed_groups()\ngroup = self.find_group(group_name)\ndata = self.get_json_body()\nself._check_group_model(data)\nif 'users' not in data:\n raise web.HTTPError(400, 'Must specify users to add')\nself.log.info('Adding %i users to group %s', len(data['users']), group_name)\nself.log.debu...
<|body_start_0|> self.check_authenticator_managed_groups() group = self.find_group(group_name) data = self.get_json_body() self._check_group_model(data) if 'users' not in data: raise web.HTTPError(400, 'Must specify users to add') self.log.info('Adding %i user...
Modify a group's user list
GroupUsersAPIHandler
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GroupUsersAPIHandler: """Modify a group's user list""" def post(self, group_name): """POST adds users to a group""" <|body_0|> async def delete(self, group_name): """DELETE removes users from a group""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_003093
8,154
permissive
[ { "docstring": "POST adds users to a group", "name": "post", "signature": "def post(self, group_name)" }, { "docstring": "DELETE removes users from a group", "name": "delete", "signature": "async def delete(self, group_name)" } ]
2
stack_v2_sparse_classes_30k_train_002302
Implement the Python class `GroupUsersAPIHandler` described below. Class description: Modify a group's user list Method signatures and docstrings: - def post(self, group_name): POST adds users to a group - async def delete(self, group_name): DELETE removes users from a group
Implement the Python class `GroupUsersAPIHandler` described below. Class description: Modify a group's user list Method signatures and docstrings: - def post(self, group_name): POST adds users to a group - async def delete(self, group_name): DELETE removes users from a group <|skeleton|> class GroupUsersAPIHandler: ...
7757dea8a463e75d8a540e85deee45c1635dd273
<|skeleton|> class GroupUsersAPIHandler: """Modify a group's user list""" def post(self, group_name): """POST adds users to a group""" <|body_0|> async def delete(self, group_name): """DELETE removes users from a group""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GroupUsersAPIHandler: """Modify a group's user list""" def post(self, group_name): """POST adds users to a group""" self.check_authenticator_managed_groups() group = self.find_group(group_name) data = self.get_json_body() self._check_group_model(data) if 'u...
the_stack_v2_python_sparse
jupyterhub/apihandlers/groups.py
jupyterhub/jupyterhub
train
6,751
ef71b7721e9da0238a27f588c77f7059afa8a1ff
[ "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...
Manages comments
CommentsServiceServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommentsServiceServicer: """Manages comments""" def CommentOnVideo(self, request, context): """Add a new comment to a video""" <|body_0|> def GetUserComments(self, request, context): """Get comments made by a user""" <|body_1|> def GetVideoComments(s...
stack_v2_sparse_classes_10k_train_003094
3,367
permissive
[ { "docstring": "Add a new comment to a video", "name": "CommentOnVideo", "signature": "def CommentOnVideo(self, request, context)" }, { "docstring": "Get comments made by a user", "name": "GetUserComments", "signature": "def GetUserComments(self, request, context)" }, { "docstrin...
3
stack_v2_sparse_classes_30k_train_003484
Implement the Python class `CommentsServiceServicer` described below. Class description: Manages comments Method signatures and docstrings: - def CommentOnVideo(self, request, context): Add a new comment to a video - def GetUserComments(self, request, context): Get comments made by a user - def GetVideoComments(self,...
Implement the Python class `CommentsServiceServicer` described below. Class description: Manages comments Method signatures and docstrings: - def CommentOnVideo(self, request, context): Add a new comment to a video - def GetUserComments(self, request, context): Get comments made by a user - def GetVideoComments(self,...
55a610c97fd53c405edb2459c2722fc03857cb83
<|skeleton|> class CommentsServiceServicer: """Manages comments""" def CommentOnVideo(self, request, context): """Add a new comment to a video""" <|body_0|> def GetUserComments(self, request, context): """Get comments made by a user""" <|body_1|> def GetVideoComments(s...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CommentsServiceServicer: """Manages comments""" def CommentOnVideo(self, request, context): """Add a new comment to a video""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!'...
the_stack_v2_python_sparse
killrvideo/comments/comments_service_pb2_grpc.py
krzysztof-adamski/killrvideo-python
train
0
3c29634bdc27ce94bc9beb1d26a25e12fb7a2cb2
[ "if config['lang'] != 'ja':\n raise Exception('SudachiPy tokenizer is only allowed in Japanese pipelines.')\ncheck_sudachipy()\nfrom sudachipy import tokenizer\nfrom sudachipy import dictionary\nself.tokenizer = dictionary.Dictionary().create()\nself.no_ssplit = config.get('no_ssplit', False)", "if isinstance(...
<|body_start_0|> if config['lang'] != 'ja': raise Exception('SudachiPy tokenizer is only allowed in Japanese pipelines.') check_sudachipy() from sudachipy import tokenizer from sudachipy import dictionary self.tokenizer = dictionary.Dictionary().create() self....
SudachiPyTokenizer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SudachiPyTokenizer: def __init__(self, config): """Construct a SudachiPy-based tokenizer. Note that this tokenizer uses regex for sentence segmentation.""" <|body_0|> def process(self, document): """Tokenize a document with the SudachiPy tokenizer and wrap the result...
stack_v2_sparse_classes_10k_train_003095
2,917
permissive
[ { "docstring": "Construct a SudachiPy-based tokenizer. Note that this tokenizer uses regex for sentence segmentation.", "name": "__init__", "signature": "def __init__(self, config)" }, { "docstring": "Tokenize a document with the SudachiPy tokenizer and wrap the results into a Doc object.", ...
2
null
Implement the Python class `SudachiPyTokenizer` described below. Class description: Implement the SudachiPyTokenizer class. Method signatures and docstrings: - def __init__(self, config): Construct a SudachiPy-based tokenizer. Note that this tokenizer uses regex for sentence segmentation. - def process(self, document...
Implement the Python class `SudachiPyTokenizer` described below. Class description: Implement the SudachiPyTokenizer class. Method signatures and docstrings: - def __init__(self, config): Construct a SudachiPy-based tokenizer. Note that this tokenizer uses regex for sentence segmentation. - def process(self, document...
c530c9af647d521262b56b717bcc38b0cfc5f1b8
<|skeleton|> class SudachiPyTokenizer: def __init__(self, config): """Construct a SudachiPy-based tokenizer. Note that this tokenizer uses regex for sentence segmentation.""" <|body_0|> def process(self, document): """Tokenize a document with the SudachiPy tokenizer and wrap the result...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SudachiPyTokenizer: def __init__(self, config): """Construct a SudachiPy-based tokenizer. Note that this tokenizer uses regex for sentence segmentation.""" if config['lang'] != 'ja': raise Exception('SudachiPy tokenizer is only allowed in Japanese pipelines.') check_sudachi...
the_stack_v2_python_sparse
stanza/pipeline/external/sudachipy.py
stanfordnlp/stanza
train
4,281
4fc5b8a135c695c5b24b11096175f6145308383b
[ "\"\"\"\n :type name: str \n :rtype: int\n \"\"\"\nself.name = name", "self.prob = prob\nself.R = R\nif self.name == 'Binomial':\n return np.where(self.prob <= 1 - self.R, 1, 0)\nelse:\n print('Not available!')\n return []" ]
<|body_start_0|> """ :type name: str :rtype: int """ self.name = name <|end_body_0|> <|body_start_1|> self.prob = prob self.R = R if self.name == 'Binomial': return np.where(self.prob <= 1 - self.R, 1, 0) else:...
Indicator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Indicator: def __init__(self, name): """Constructor for this class.""" <|body_0|> def Binary_Indicator(self, prob, R): """:type pi: float :type R: float :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> """ :type name: str ...
stack_v2_sparse_classes_10k_train_003096
771
permissive
[ { "docstring": "Constructor for this class.", "name": "__init__", "signature": "def __init__(self, name)" }, { "docstring": ":type pi: float :type R: float :rtype: int", "name": "Binary_Indicator", "signature": "def Binary_Indicator(self, prob, R)" } ]
2
stack_v2_sparse_classes_30k_val_000270
Implement the Python class `Indicator` described below. Class description: Implement the Indicator class. Method signatures and docstrings: - def __init__(self, name): Constructor for this class. - def Binary_Indicator(self, prob, R): :type pi: float :type R: float :rtype: int
Implement the Python class `Indicator` described below. Class description: Implement the Indicator class. Method signatures and docstrings: - def __init__(self, name): Constructor for this class. - def Binary_Indicator(self, prob, R): :type pi: float :type R: float :rtype: int <|skeleton|> class Indicator: def ...
0517780d05443cb77ce339db1854c298b87681e3
<|skeleton|> class Indicator: def __init__(self, name): """Constructor for this class.""" <|body_0|> def Binary_Indicator(self, prob, R): """:type pi: float :type R: float :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Indicator: def __init__(self, name): """Constructor for this class.""" """ :type name: str :rtype: int """ self.name = name def Binary_Indicator(self, prob, R): """:type pi: float :type R: float :rtype: int""" self.p...
the_stack_v2_python_sparse
brdt/Indicator.py
ericchen12377/BRDT-Python
train
2
f6bbcf5045d5fa31d858a8a296e25d7313779112
[ "super().__init__()\nimport sklearn\nimport sklearn.naive_bayes\nself.model = sklearn.naive_bayes.MultinomialNB", "specs = super(MultinomialNB, cls).getInputSpecification()\nspecs.description = 'The \\\\\\\\textit{MultinomialNB} classifier implements the naive Bayes algorithm for\\n multino...
<|body_start_0|> super().__init__() import sklearn import sklearn.naive_bayes self.model = sklearn.naive_bayes.MultinomialNB <|end_body_0|> <|body_start_1|> specs = super(MultinomialNB, cls).getInputSpecification() specs.description = 'The \\\\textit{MultinomialNB} class...
MultinomialNBClassifier Naive Bayes classifier for multinomial models
MultinomialNB
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "BSD-2-Clause", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultinomialNB: """MultinomialNBClassifier Naive Bayes classifier for multinomial models""" def __init__(self): """Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None""" <|body_0|> def getInputSpecification(cls): """M...
stack_v2_sparse_classes_10k_train_003097
5,834
permissive
[ { "docstring": "Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for...
3
null
Implement the Python class `MultinomialNB` described below. Class description: MultinomialNBClassifier Naive Bayes classifier for multinomial models Method signatures and docstrings: - def __init__(self): Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None - def getInput...
Implement the Python class `MultinomialNB` described below. Class description: MultinomialNBClassifier Naive Bayes classifier for multinomial models Method signatures and docstrings: - def __init__(self): Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None - def getInput...
2b16e7aa3325fe84cab2477947a951414c635381
<|skeleton|> class MultinomialNB: """MultinomialNBClassifier Naive Bayes classifier for multinomial models""" def __init__(self): """Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None""" <|body_0|> def getInputSpecification(cls): """M...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MultinomialNB: """MultinomialNBClassifier Naive Bayes classifier for multinomial models""" def __init__(self): """Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None""" super().__init__() import sklearn import sklearn.naive_ba...
the_stack_v2_python_sparse
ravenframework/SupervisedLearning/ScikitLearn/NaiveBayes/MultinomialNBClassifier.py
idaholab/raven
train
201
635c5bee25dbb5c2f14c3e1cb6c16f805c9dc727
[ "Company = self.old_state.apps.get_model('company', 'company')\nPurchaseOrder = self.old_state.apps.get_model('order', 'purchaseorder')\nPart = self.old_state.apps.get_model('part', 'part')\nSupplierpart = self.old_state.apps.get_model('company', 'supplierpart')\nsupplier = Company.objects.create(name='Supplier A',...
<|body_start_0|> Company = self.old_state.apps.get_model('company', 'company') PurchaseOrder = self.old_state.apps.get_model('order', 'purchaseorder') Part = self.old_state.apps.get_model('part', 'part') Supplierpart = self.old_state.apps.get_model('company', 'supplierpart') supp...
Test entire schema migration.
TestAdditionalLineMigration
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestAdditionalLineMigration: """Test entire schema migration.""" def prepare(self): """Create initial data set.""" <|body_0|> def test_po_migration(self): """Test that the the PO lines where converted correctly.""" <|body_1|> <|end_skeleton|> <|body_sta...
stack_v2_sparse_classes_10k_train_003098
7,688
permissive
[ { "docstring": "Create initial data set.", "name": "prepare", "signature": "def prepare(self)" }, { "docstring": "Test that the the PO lines where converted correctly.", "name": "test_po_migration", "signature": "def test_po_migration(self)" } ]
2
stack_v2_sparse_classes_30k_train_005818
Implement the Python class `TestAdditionalLineMigration` described below. Class description: Test entire schema migration. Method signatures and docstrings: - def prepare(self): Create initial data set. - def test_po_migration(self): Test that the the PO lines where converted correctly.
Implement the Python class `TestAdditionalLineMigration` described below. Class description: Test entire schema migration. Method signatures and docstrings: - def prepare(self): Create initial data set. - def test_po_migration(self): Test that the the PO lines where converted correctly. <|skeleton|> class TestAdditi...
e88a8e99a5f0b201c67a95cba097c729f090d5e2
<|skeleton|> class TestAdditionalLineMigration: """Test entire schema migration.""" def prepare(self): """Create initial data set.""" <|body_0|> def test_po_migration(self): """Test that the the PO lines where converted correctly.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestAdditionalLineMigration: """Test entire schema migration.""" def prepare(self): """Create initial data set.""" Company = self.old_state.apps.get_model('company', 'company') PurchaseOrder = self.old_state.apps.get_model('order', 'purchaseorder') Part = self.old_state.ap...
the_stack_v2_python_sparse
InvenTree/order/test_migrations.py
inventree/InvenTree
train
3,077
5f9a2d3ef5b9561c2fbb42c39a7df0cee48b358c
[ "for fieldname in fieldnames:\n field = form_.fields[fieldname]\n data = field.widget.value_from_datadict(form_.data, form_.files, form_.add_prefix(fieldname))\n try:\n if not hasattr(form_, 'cleaned_data'):\n form_.cleaned_data = {}\n form_.cleaned_data[fieldname] = field.clean(da...
<|body_start_0|> for fieldname in fieldnames: field = form_.fields[fieldname] data = field.widget.value_from_datadict(form_.data, form_.files, form_.add_prefix(fieldname)) try: if not hasattr(form_, 'cleaned_data'): form_.cleaned_data = {} ...
Mise à jour d'un objet de type Model avec certains champs d'un ModelForm Monkey-patching done in scoop.core.__init__ Le monkey patch se fait sur la classe django.db.models.Model - instance : objet dérivé de models.Model - form : objet de type forms.ModelForm dont la classe ciblée est celle de instance - fieldnames : li...
ModelFormUtil
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModelFormUtil: """Mise à jour d'un objet de type Model avec certains champs d'un ModelForm Monkey-patching done in scoop.core.__init__ Le monkey patch se fait sur la classe django.db.models.Model - instance : objet dérivé de models.Model - form : objet de type forms.ModelForm dont la classe ciblé...
stack_v2_sparse_classes_10k_train_003099
10,808
no_license
[ { "docstring": "Renvoyer si un champ d'un formulaire est valide", "name": "is_field_valid", "signature": "def is_field_valid(form_, fieldnames)" }, { "docstring": "Mettre à jour les champs de l'objet selon l'état d'un formulaire - La validation ne se fait que sur les champs sélectionnés et valid...
2
stack_v2_sparse_classes_30k_train_006692
Implement the Python class `ModelFormUtil` described below. Class description: Mise à jour d'un objet de type Model avec certains champs d'un ModelForm Monkey-patching done in scoop.core.__init__ Le monkey patch se fait sur la classe django.db.models.Model - instance : objet dérivé de models.Model - form : objet de ty...
Implement the Python class `ModelFormUtil` described below. Class description: Mise à jour d'un objet de type Model avec certains champs d'un ModelForm Monkey-patching done in scoop.core.__init__ Le monkey patch se fait sur la classe django.db.models.Model - instance : objet dérivé de models.Model - form : objet de ty...
8cef6f6e89c1990e2b25f83e54e0c3481d83b6d7
<|skeleton|> class ModelFormUtil: """Mise à jour d'un objet de type Model avec certains champs d'un ModelForm Monkey-patching done in scoop.core.__init__ Le monkey patch se fait sur la classe django.db.models.Model - instance : objet dérivé de models.Model - form : objet de type forms.ModelForm dont la classe ciblé...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ModelFormUtil: """Mise à jour d'un objet de type Model avec certains champs d'un ModelForm Monkey-patching done in scoop.core.__init__ Le monkey patch se fait sur la classe django.db.models.Model - instance : objet dérivé de models.Model - form : objet de type forms.ModelForm dont la classe ciblée est celle d...
the_stack_v2_python_sparse
scoop/core/util/django/forms.py
artscoop/scoop
train
0