blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
870953d0d99265c39ec3458163d86e85e3e2948f
[ "self.buffer_size = buffer_size\nself.num_imgs = 0\nself.images = []", "return_images = []\nfor image in images:\n image = torch.unsqueeze(image.data, 0)\n if self.num_imgs < self.buffer_size:\n self.images.append(image)\n return_images.append(image)\n self.num_imgs += 1\n else:\n ...
<|body_start_0|> self.buffer_size = buffer_size self.num_imgs = 0 self.images = [] <|end_body_0|> <|body_start_1|> return_images = [] for image in images: image = torch.unsqueeze(image.data, 0) if self.num_imgs < self.buffer_size: self.ima...
Random choose previous generated images or ones produced by the latest generators. :param buffer_size: the size of image buffer :type buffer_size: int
ShuffleBuffer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShuffleBuffer: """Random choose previous generated images or ones produced by the latest generators. :param buffer_size: the size of image buffer :type buffer_size: int""" def __init__(self, buffer_size): """Initialize the ImagePool class. :param buffer_size: the size of image buffer...
stack_v2_sparse_classes_36k_train_025100
10,238
permissive
[ { "docstring": "Initialize the ImagePool class. :param buffer_size: the size of image buffer :type buffer_size: int", "name": "__init__", "signature": "def __init__(self, buffer_size)" }, { "docstring": "Return an image from the pool. :param images: the latest generated images from the generator...
2
null
Implement the Python class `ShuffleBuffer` described below. Class description: Random choose previous generated images or ones produced by the latest generators. :param buffer_size: the size of image buffer :type buffer_size: int Method signatures and docstrings: - def __init__(self, buffer_size): Initialize the Imag...
Implement the Python class `ShuffleBuffer` described below. Class description: Random choose previous generated images or ones produced by the latest generators. :param buffer_size: the size of image buffer :type buffer_size: int Method signatures and docstrings: - def __init__(self, buffer_size): Initialize the Imag...
e4ef3a1c92d19d1d08c3ef0e2156b6fecefdbe04
<|skeleton|> class ShuffleBuffer: """Random choose previous generated images or ones produced by the latest generators. :param buffer_size: the size of image buffer :type buffer_size: int""" def __init__(self, buffer_size): """Initialize the ImagePool class. :param buffer_size: the size of image buffer...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ShuffleBuffer: """Random choose previous generated images or ones produced by the latest generators. :param buffer_size: the size of image buffer :type buffer_size: int""" def __init__(self, buffer_size): """Initialize the ImagePool class. :param buffer_size: the size of image buffer :type buffer...
the_stack_v2_python_sparse
zeus/networks/pytorch/cyclesrbodys/trans_model.py
huawei-noah/xingtian
train
308
24279632f980c7ee174612d490f01a5ec4b5317f
[ "self.cap = capacity\nself.cnt = collections.defaultdict(int)\nself.cache = {}\nself.visited = collections.deque()", "if key in self.cache:\n self.visited.append(key)\n self.cnt[key] += 1\n return self.cache[key]\nreturn -1", "if key not in self.cache and len(self.cache) >= self.cap:\n while self.vi...
<|body_start_0|> self.cap = capacity self.cnt = collections.defaultdict(int) self.cache = {} self.visited = collections.deque() <|end_body_0|> <|body_start_1|> if key in self.cache: self.visited.append(key) self.cnt[key] += 1 return self.cache...
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k_train_025101
2,031
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: void", "name": "pu...
3
stack_v2_sparse_classes_30k_train_012587
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void <|sk...
28d47c9488d47921769f40383ea9ffe2c56f3597
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LRUCache: def __init__(self, capacity): """:type capacity: int""" self.cap = capacity self.cnt = collections.defaultdict(int) self.cache = {} self.visited = collections.deque() def get(self, key): """:type key: int :rtype: int""" if key in self.cach...
the_stack_v2_python_sparse
146. LRU Cache.py
liangliannie/LeetCode
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_36k_train_025102
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_016688
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_36k
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
1cd16d219c678d753c96c367884211a3fed00a86
[ "self.cluster_name = cluster_name\nself.environment = environment\nself.job_name = job_name\nself.job_uid = job_uid", "if dictionary is None:\n return None\ncluster_name = dictionary.get('clusterName')\nenvironment = dictionary.get('environment')\njob_name = dictionary.get('jobName')\njob_uid = cohesity_manage...
<|body_start_0|> self.cluster_name = cluster_name self.environment = environment self.job_name = job_name self.job_uid = job_uid <|end_body_0|> <|body_start_1|> if dictionary is None: return None cluster_name = dictionary.get('clusterName') environmen...
Implementation of the 'RemoteProtectionJobInformation' model. Specifies details about the original Protection Job and its Snapshots, that were archived to a remote Vault. Attributes: cluster_name (string): Specifies the name of the original Cluster that archived the data to the Vault. environment (EnvironmentRemoteProt...
RemoteProtectionJobInformation
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RemoteProtectionJobInformation: """Implementation of the 'RemoteProtectionJobInformation' model. Specifies details about the original Protection Job and its Snapshots, that were archived to a remote Vault. Attributes: cluster_name (string): Specifies the name of the original Cluster that archived...
stack_v2_sparse_classes_36k_train_025103
6,552
permissive
[ { "docstring": "Constructor for the RemoteProtectionJobInformation class", "name": "__init__", "signature": "def __init__(self, cluster_name=None, environment=None, job_name=None, job_uid=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary):...
2
null
Implement the Python class `RemoteProtectionJobInformation` described below. Class description: Implementation of the 'RemoteProtectionJobInformation' model. Specifies details about the original Protection Job and its Snapshots, that were archived to a remote Vault. Attributes: cluster_name (string): Specifies the nam...
Implement the Python class `RemoteProtectionJobInformation` described below. Class description: Implementation of the 'RemoteProtectionJobInformation' model. Specifies details about the original Protection Job and its Snapshots, that were archived to a remote Vault. Attributes: cluster_name (string): Specifies the nam...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class RemoteProtectionJobInformation: """Implementation of the 'RemoteProtectionJobInformation' model. Specifies details about the original Protection Job and its Snapshots, that were archived to a remote Vault. Attributes: cluster_name (string): Specifies the name of the original Cluster that archived...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RemoteProtectionJobInformation: """Implementation of the 'RemoteProtectionJobInformation' model. Specifies details about the original Protection Job and its Snapshots, that were archived to a remote Vault. Attributes: cluster_name (string): Specifies the name of the original Cluster that archived the data to ...
the_stack_v2_python_sparse
cohesity_management_sdk/models/remote_protection_job_information.py
cohesity/management-sdk-python
train
24
c84d997a2ce771d5bbc37273d9d6216bed642715
[ "if p == None and q == None:\n return True\nelif p != None and q != None:\n p_stack = [p]\n q_stack = [q]\n while p_stack:\n p = p_stack.pop(0)\n q = q_stack.pop(0)\n left_flag = right_flag = True\n if p.val != q.val:\n return False\n if p.left != None and q...
<|body_start_0|> if p == None and q == None: return True elif p != None and q != None: p_stack = [p] q_stack = [q] while p_stack: p = p_stack.pop(0) q = q_stack.pop(0) left_flag = right_flag = True ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isSameTree1(self, p, q): """:type p: TreeNode :type q: TreeNode :rtype: bool""" <|body_0|> def isSameTree2(self, p, q): """:type p: TreeNode :type q: TreeNode :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> if p == None an...
stack_v2_sparse_classes_36k_train_025104
1,753
no_license
[ { "docstring": ":type p: TreeNode :type q: TreeNode :rtype: bool", "name": "isSameTree1", "signature": "def isSameTree1(self, p, q)" }, { "docstring": ":type p: TreeNode :type q: TreeNode :rtype: bool", "name": "isSameTree2", "signature": "def isSameTree2(self, p, q)" } ]
2
stack_v2_sparse_classes_30k_train_014344
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isSameTree1(self, p, q): :type p: TreeNode :type q: TreeNode :rtype: bool - def isSameTree2(self, p, q): :type p: TreeNode :type q: TreeNode :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isSameTree1(self, p, q): :type p: TreeNode :type q: TreeNode :rtype: bool - def isSameTree2(self, p, q): :type p: TreeNode :type q: TreeNode :rtype: bool <|skeleton|> class ...
e2fecd266bfced6208694b19a2d81182b13dacd6
<|skeleton|> class Solution: def isSameTree1(self, p, q): """:type p: TreeNode :type q: TreeNode :rtype: bool""" <|body_0|> def isSameTree2(self, p, q): """:type p: TreeNode :type q: TreeNode :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isSameTree1(self, p, q): """:type p: TreeNode :type q: TreeNode :rtype: bool""" if p == None and q == None: return True elif p != None and q != None: p_stack = [p] q_stack = [q] while p_stack: p = p_stack.pop...
the_stack_v2_python_sparse
isSameTree.py
HuipengXu/leetcode
train
0
3bf12d14d627ae6dff8b4657b87546705e414b0b
[ "try:\n return self._dao.execute('SELECT interest_id, interest_name FROM Student_Interest INNER JOIN Interest ON Student_Interest.interest_id=Interest.id where k_number = %s AND Student_Interest.scheme_id = %s', (k_number, scheme_id))\nexcept Exception as e:\n self._log.exception('Could not get interests')\n ...
<|body_start_0|> try: return self._dao.execute('SELECT interest_id, interest_name FROM Student_Interest INNER JOIN Interest ON Student_Interest.interest_id=Interest.id where k_number = %s AND Student_Interest.scheme_id = %s', (k_number, scheme_id)) except Exception as e: self._lo...
StudentInterestModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StudentInterestModel: def get_interests(self, scheme_id, k_number): """Given the k_number will return all the student's interests""" <|body_0|> def insert_interest(self, scheme_id, k_number, interest_id): """Will entirely populate an entry for Student_Interest table"...
stack_v2_sparse_classes_36k_train_025105
2,655
no_license
[ { "docstring": "Given the k_number will return all the student's interests", "name": "get_interests", "signature": "def get_interests(self, scheme_id, k_number)" }, { "docstring": "Will entirely populate an entry for Student_Interest table", "name": "insert_interest", "signature": "def i...
4
stack_v2_sparse_classes_30k_train_005423
Implement the Python class `StudentInterestModel` described below. Class description: Implement the StudentInterestModel class. Method signatures and docstrings: - def get_interests(self, scheme_id, k_number): Given the k_number will return all the student's interests - def insert_interest(self, scheme_id, k_number, ...
Implement the Python class `StudentInterestModel` described below. Class description: Implement the StudentInterestModel class. Method signatures and docstrings: - def get_interests(self, scheme_id, k_number): Given the k_number will return all the student's interests - def insert_interest(self, scheme_id, k_number, ...
649a3c1cdcc90443f9561dfa1262ae3b0e970729
<|skeleton|> class StudentInterestModel: def get_interests(self, scheme_id, k_number): """Given the k_number will return all the student's interests""" <|body_0|> def insert_interest(self, scheme_id, k_number, interest_id): """Will entirely populate an entry for Student_Interest table"...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StudentInterestModel: def get_interests(self, scheme_id, k_number): """Given the k_number will return all the student's interests""" try: return self._dao.execute('SELECT interest_id, interest_name FROM Student_Interest INNER JOIN Interest ON Student_Interest.interest_id=Interest.i...
the_stack_v2_python_sparse
flaskr/models/student_interestmdl.py
nickpezzotti1/BuddySchemeWebApp
train
2
9419298407bf2c2ee1aafb71a1378315f2810685
[ "self.module = module\nself.exclude = exclude\nself.include = include", "if self.exclude:\n self.actions = [a for a in self.actions if a.__name__ not in self.exclude]\nif self.include:\n self.actions = [a for a in self.actions if a.__name__ in self.include]\nif self.exclude:\n self.cleanup = [c for c in ...
<|body_start_0|> self.module = module self.exclude = exclude self.include = include <|end_body_0|> <|body_start_1|> if self.exclude: self.actions = [a for a in self.actions if a.__name__ not in self.exclude] if self.include: self.actions = [a for a in sel...
Model
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Model: def __init__(self, module, exclude, include): """initializations common to all derived classes""" <|body_0|> def revise_actions(self): """Revise lists of actions and cleanups accounting for -e --exclude -a --add Alter the copies, results might differ from self...
stack_v2_sparse_classes_36k_train_025106
2,307
permissive
[ { "docstring": "initializations common to all derived classes", "name": "__init__", "signature": "def __init__(self, module, exclude, include)" }, { "docstring": "Revise lists of actions and cleanups accounting for -e --exclude -a --add Alter the copies, results might differ from self.module.act...
3
stack_v2_sparse_classes_30k_train_002457
Implement the Python class `Model` described below. Class description: Implement the Model class. Method signatures and docstrings: - def __init__(self, module, exclude, include): initializations common to all derived classes - def revise_actions(self): Revise lists of actions and cleanups accounting for -e --exclude...
Implement the Python class `Model` described below. Class description: Implement the Model class. Method signatures and docstrings: - def __init__(self, module, exclude, include): initializations common to all derived classes - def revise_actions(self): Revise lists of actions and cleanups accounting for -e --exclude...
457ea284ea20703885f8e57fa5c1891051be9b03
<|skeleton|> class Model: def __init__(self, module, exclude, include): """initializations common to all derived classes""" <|body_0|> def revise_actions(self): """Revise lists of actions and cleanups accounting for -e --exclude -a --add Alter the copies, results might differ from self...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Model: def __init__(self, module, exclude, include): """initializations common to all derived classes""" self.module = module self.exclude = exclude self.include = include def revise_actions(self): """Revise lists of actions and cleanups accounting for -e --exclude...
the_stack_v2_python_sparse
pymodel/model.py
jon-jacky/PyModel
train
75
9a3879df9d987b03d5e78edeaf561b327a4d9493
[ "self.attribute_vec = attribute_vec\nself.dest_guid = dest_guid\nself.dest_prop_count = dest_prop_count\nself.excluded_prop_count = excluded_prop_count\nself.mismatch_prop_count = mismatch_prop_count\nself.object_flags = object_flags\nself.source_guid = source_guid\nself.source_prop_count = source_prop_count\nself....
<|body_start_0|> self.attribute_vec = attribute_vec self.dest_guid = dest_guid self.dest_prop_count = dest_prop_count self.excluded_prop_count = excluded_prop_count self.mismatch_prop_count = mismatch_prop_count self.object_flags = object_flags self.source_guid = ...
Implementation of the 'CompareADObjectsResult_ADObject' model. TODO: type description here. Attributes: attribute_vec (list of CompareADObjectsResult_ADAttribute): Array of AD attributes of AD object. This will contain distinct attributes from source and destination objects. dest_guid (string): Object guid from dest_se...
CompareADObjectsResult_ADObject
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CompareADObjectsResult_ADObject: """Implementation of the 'CompareADObjectsResult_ADObject' model. TODO: type description here. Attributes: attribute_vec (list of CompareADObjectsResult_ADAttribute): Array of AD attributes of AD object. This will contain distinct attributes from source and destin...
stack_v2_sparse_classes_36k_train_025107
5,278
permissive
[ { "docstring": "Constructor for the CompareADObjectsResult_ADObject class", "name": "__init__", "signature": "def __init__(self, attribute_vec=None, dest_guid=None, dest_prop_count=None, excluded_prop_count=None, mismatch_prop_count=None, object_flags=None, source_guid=None, source_prop_count=None, stat...
2
null
Implement the Python class `CompareADObjectsResult_ADObject` described below. Class description: Implementation of the 'CompareADObjectsResult_ADObject' model. TODO: type description here. Attributes: attribute_vec (list of CompareADObjectsResult_ADAttribute): Array of AD attributes of AD object. This will contain dis...
Implement the Python class `CompareADObjectsResult_ADObject` described below. Class description: Implementation of the 'CompareADObjectsResult_ADObject' model. TODO: type description here. Attributes: attribute_vec (list of CompareADObjectsResult_ADAttribute): Array of AD attributes of AD object. This will contain dis...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class CompareADObjectsResult_ADObject: """Implementation of the 'CompareADObjectsResult_ADObject' model. TODO: type description here. Attributes: attribute_vec (list of CompareADObjectsResult_ADAttribute): Array of AD attributes of AD object. This will contain distinct attributes from source and destin...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CompareADObjectsResult_ADObject: """Implementation of the 'CompareADObjectsResult_ADObject' model. TODO: type description here. Attributes: attribute_vec (list of CompareADObjectsResult_ADAttribute): Array of AD attributes of AD object. This will contain distinct attributes from source and destination objects...
the_stack_v2_python_sparse
cohesity_management_sdk/models/compare_ad_objects_result_ad_object.py
cohesity/management-sdk-python
train
24
b690d468aec3ffaadaff1b24f8bc28941501d648
[ "self.biosqllog = LogIt().default(logname='BioSQL', logfile=None)\nself.biosql_utils = FullUtilities()\nself.biosql_proc = self.biosql_utils.system_cmd\nself.scripts = pkg_resources.resource_filename(sql_scripts.__name__, '')\nself.ncbi_taxon_script = pkg_resources.resource_filename(sql_scripts.__name__, 'load_ncbi...
<|body_start_0|> self.biosqllog = LogIt().default(logname='BioSQL', logfile=None) self.biosql_utils = FullUtilities() self.biosql_proc = self.biosql_utils.system_cmd self.scripts = pkg_resources.resource_filename(sql_scripts.__name__, '') self.ncbi_taxon_script = pkg_resources.re...
BaseBioSQL
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseBioSQL: def __init__(self, database_name, template_name='', project=None, project_path=None, proj_mana=ProjectManagement, **kwargs): """This is the base BioSQL class. It provides a general framework for managing the BioSQL workflow. Higher level classes provide more specific function...
stack_v2_sparse_classes_36k_train_025108
13,035
no_license
[ { "docstring": "This is the base BioSQL class. It provides a general framework for managing the BioSQL workflow. Higher level classes provide more specific functionality related to the various BioSQL supported database types. Taxonomy data can be found at: NCBI: ftp://ftp.ncbi.nlm.nih.gov/pub/taxonomy ITIS: htt...
3
stack_v2_sparse_classes_30k_train_017447
Implement the Python class `BaseBioSQL` described below. Class description: Implement the BaseBioSQL class. Method signatures and docstrings: - def __init__(self, database_name, template_name='', project=None, project_path=None, proj_mana=ProjectManagement, **kwargs): This is the base BioSQL class. It provides a gene...
Implement the Python class `BaseBioSQL` described below. Class description: Implement the BaseBioSQL class. Method signatures and docstrings: - def __init__(self, database_name, template_name='', project=None, project_path=None, proj_mana=ProjectManagement, **kwargs): This is the base BioSQL class. It provides a gene...
e207046ec36387751fe2bba8b6782fdc2a580107
<|skeleton|> class BaseBioSQL: def __init__(self, database_name, template_name='', project=None, project_path=None, proj_mana=ProjectManagement, **kwargs): """This is the base BioSQL class. It provides a general framework for managing the BioSQL workflow. Higher level classes provide more specific function...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseBioSQL: def __init__(self, database_name, template_name='', project=None, project_path=None, proj_mana=ProjectManagement, **kwargs): """This is the base BioSQL class. It provides a general framework for managing the BioSQL workflow. Higher level classes provide more specific functionality related ...
the_stack_v2_python_sparse
OrthoEvol/Manager/biosql/biosql.py
datasnakes/OrthoEvolution
train
19
dbfe82fa28ce2a9e38bab882de22687fb3800cb2
[ "self.state = np.array([[detection[0]], [detection[1]], [detection[2]], [detection[3]], [1], [1]])\nself.p_matrix = np.eye(6, dtype=int)\nself.h_matrix = np.array([[1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0]])\nself.r_matrix = np.eye(4)\nself.predicted_state = type(None)\nself.pre...
<|body_start_0|> self.state = np.array([[detection[0]], [detection[1]], [detection[2]], [detection[3]], [1], [1]]) self.p_matrix = np.eye(6, dtype=int) self.h_matrix = np.array([[1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0]]) self.r_matrix = np.eye(4) ...
Class KalmanFilter
KalmanFilter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KalmanFilter: """Class KalmanFilter""" def __init__(self, detection): """This function initializes KalmanFilter object. Args: detection(list: 1x4): Detection of an object, which is used to initialize the state vector.""" <|body_0|> def predict(self): """Function ...
stack_v2_sparse_classes_36k_train_025109
3,453
no_license
[ { "docstring": "This function initializes KalmanFilter object. Args: detection(list: 1x4): Detection of an object, which is used to initialize the state vector.", "name": "__init__", "signature": "def __init__(self, detection)" }, { "docstring": "Function for prediction. This function predicts t...
3
stack_v2_sparse_classes_30k_val_000747
Implement the Python class `KalmanFilter` described below. Class description: Class KalmanFilter Method signatures and docstrings: - def __init__(self, detection): This function initializes KalmanFilter object. Args: detection(list: 1x4): Detection of an object, which is used to initialize the state vector. - def pre...
Implement the Python class `KalmanFilter` described below. Class description: Class KalmanFilter Method signatures and docstrings: - def __init__(self, detection): This function initializes KalmanFilter object. Args: detection(list: 1x4): Detection of an object, which is used to initialize the state vector. - def pre...
7e2095142e604c157bc19fdca9cbe8c294376710
<|skeleton|> class KalmanFilter: """Class KalmanFilter""" def __init__(self, detection): """This function initializes KalmanFilter object. Args: detection(list: 1x4): Detection of an object, which is used to initialize the state vector.""" <|body_0|> def predict(self): """Function ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KalmanFilter: """Class KalmanFilter""" def __init__(self, detection): """This function initializes KalmanFilter object. Args: detection(list: 1x4): Detection of an object, which is used to initialize the state vector.""" self.state = np.array([[detection[0]], [detection[1]], [detection[2]...
the_stack_v2_python_sparse
src/stabilisierung/kalman.py
Heatdh/advanced_machine_detection_gui
train
0
c56ac94690fbec2ea84a0b954e0c54627a0dcb52
[ "self.centre = centre\nif hasattr(centre, 'e') and centre.e is not None:\n self.e = centre.e\nelse:\n self.e = 0.0\nself.grad = grad\nself.hess = hess\nn_atoms = grad.shape[0]\nassert hess.shape == (n_atoms, n_atoms)", "dx = (coords - self.centre).flatten()\nnew_e = self.e + np.dot(self.grad, dx)\nnew_e += ...
<|body_start_0|> self.centre = centre if hasattr(centre, 'e') and centre.e is not None: self.e = centre.e else: self.e = 0.0 self.grad = grad self.hess = hess n_atoms = grad.shape[0] assert hess.shape == (n_atoms, n_atoms) <|end_body_0|> <...
The truncated taylor surface from current grad and hessian
TruncatedTaylor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TruncatedTaylor: """The truncated taylor surface from current grad and hessian""" def __init__(self, centre: Union[OptCoordinates, np.ndarray], grad: np.ndarray, hess: np.ndarray): """Second-order Taylor expansion around a point Args: centre (OptCoordinates|np.ndarray): The coordinat...
stack_v2_sparse_classes_36k_train_025110
26,310
permissive
[ { "docstring": "Second-order Taylor expansion around a point Args: centre (OptCoordinates|np.ndarray): The coordinate point grad (np.ndarray): Gradient at that point hess (np.ndarray): Hessian at that point", "name": "__init__", "signature": "def __init__(self, centre: Union[OptCoordinates, np.ndarray],...
3
stack_v2_sparse_classes_30k_train_016221
Implement the Python class `TruncatedTaylor` described below. Class description: The truncated taylor surface from current grad and hessian Method signatures and docstrings: - def __init__(self, centre: Union[OptCoordinates, np.ndarray], grad: np.ndarray, hess: np.ndarray): Second-order Taylor expansion around a poin...
Implement the Python class `TruncatedTaylor` described below. Class description: The truncated taylor surface from current grad and hessian Method signatures and docstrings: - def __init__(self, centre: Union[OptCoordinates, np.ndarray], grad: np.ndarray, hess: np.ndarray): Second-order Taylor expansion around a poin...
4d6667592f083dfcf38de6b75c4222c0a0e7b60b
<|skeleton|> class TruncatedTaylor: """The truncated taylor surface from current grad and hessian""" def __init__(self, centre: Union[OptCoordinates, np.ndarray], grad: np.ndarray, hess: np.ndarray): """Second-order Taylor expansion around a point Args: centre (OptCoordinates|np.ndarray): The coordinat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TruncatedTaylor: """The truncated taylor surface from current grad and hessian""" def __init__(self, centre: Union[OptCoordinates, np.ndarray], grad: np.ndarray, hess: np.ndarray): """Second-order Taylor expansion around a point Args: centre (OptCoordinates|np.ndarray): The coordinate point grad ...
the_stack_v2_python_sparse
autode/bracket/dhs.py
duartegroup/autodE
train
132
e533e5c8dd556553e5b616c34e61b9c5d26a19e3
[ "self.model = model\nself.forward_relu_outputs: List[torch.Tensor] = []\nself.model.eval()\nself.unguided_gradient = unguided_gradient\nself.post_process_output = post_process_output\nif not unguided_gradient:\n self.update_relus()", "def relu_backward_hook_function(module, grad_in, grad_out):\n \"\"\"\n ...
<|body_start_0|> self.model = model self.forward_relu_outputs: List[torch.Tensor] = [] self.model.eval() self.unguided_gradient = unguided_gradient self.post_process_output = post_process_output if not unguided_gradient: self.update_relus() <|end_body_0|> <|b...
Produces gradients generated with guided back propagation from the given image .. warning: * We assume the model is built with `Relu` activation function * the model will be instrumented, use `trw.train.CleanAddedHooks` to remove the hooks once guided back-propagation is finished
GuidedBackprop
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GuidedBackprop: """Produces gradients generated with guided back propagation from the given image .. warning: * We assume the model is built with `Relu` activation function * the model will be instrumented, use `trw.train.CleanAddedHooks` to remove the hooks once guided back-propagation is finish...
stack_v2_sparse_classes_36k_train_025111
6,548
permissive
[ { "docstring": "Args: model: the model unguided_gradient: if `False`, calculate the guided gradient. If `True`, calculate the gradient only post_process_output: a function to post-process the output of a model so that it is suitable for gradient attribution", "name": "__init__", "signature": "def __init...
5
null
Implement the Python class `GuidedBackprop` described below. Class description: Produces gradients generated with guided back propagation from the given image .. warning: * We assume the model is built with `Relu` activation function * the model will be instrumented, use `trw.train.CleanAddedHooks` to remove the hooks...
Implement the Python class `GuidedBackprop` described below. Class description: Produces gradients generated with guided back propagation from the given image .. warning: * We assume the model is built with `Relu` activation function * the model will be instrumented, use `trw.train.CleanAddedHooks` to remove the hooks...
11c59dea0072d940b036166be22b392bb9e3b066
<|skeleton|> class GuidedBackprop: """Produces gradients generated with guided back propagation from the given image .. warning: * We assume the model is built with `Relu` activation function * the model will be instrumented, use `trw.train.CleanAddedHooks` to remove the hooks once guided back-propagation is finish...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GuidedBackprop: """Produces gradients generated with guided back propagation from the given image .. warning: * We assume the model is built with `Relu` activation function * the model will be instrumented, use `trw.train.CleanAddedHooks` to remove the hooks once guided back-propagation is finished""" de...
the_stack_v2_python_sparse
src/trw/train/guided_back_propagation.py
civodlu/trw
train
12
2fc34223ff7e19ba468a622f26857279da92dbc6
[ "super().__init__()\nself.D = D\nself.W = W\nself.in_channels_dir = in_channels_dir\nfor i in range(D):\n if i == 0:\n layer = nn.Sequential(nn.Linear(in_channels_dir, W), nn.ReLU())\n else:\n layer = nn.Sequential(nn.Linear(W, W), nn.ReLU())\n setattr(self, f'dir_encoding_{i + 1}', layer)\ns...
<|body_start_0|> super().__init__() self.D = D self.W = W self.in_channels_dir = in_channels_dir for i in range(D): if i == 0: layer = nn.Sequential(nn.Linear(in_channels_dir, W), nn.ReLU()) else: layer = nn.Sequential(nn.Li...
BgNeRF
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BgNeRF: def __init__(self, D, W, in_channels_dir=27, with_semantics=False, n_classes=6): """D: number of layers W: number of hidden units in each layer in_channels_dir: number of input channels for direction (3+3*4*2=27 by default) skips: add skip connection in the Dth layer""" <...
stack_v2_sparse_classes_36k_train_025112
8,749
permissive
[ { "docstring": "D: number of layers W: number of hidden units in each layer in_channels_dir: number of input channels for direction (3+3*4*2=27 by default) skips: add skip connection in the Dth layer", "name": "__init__", "signature": "def __init__(self, D, W, in_channels_dir=27, with_semantics=False, n...
2
null
Implement the Python class `BgNeRF` described below. Class description: Implement the BgNeRF class. Method signatures and docstrings: - def __init__(self, D, W, in_channels_dir=27, with_semantics=False, n_classes=6): D: number of layers W: number of hidden units in each layer in_channels_dir: number of input channels...
Implement the Python class `BgNeRF` described below. Class description: Implement the BgNeRF class. Method signatures and docstrings: - def __init__(self, D, W, in_channels_dir=27, with_semantics=False, n_classes=6): D: number of layers W: number of hidden units in each layer in_channels_dir: number of input channels...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class BgNeRF: def __init__(self, D, W, in_channels_dir=27, with_semantics=False, n_classes=6): """D: number of layers W: number of hidden units in each layer in_channels_dir: number of input channels for direction (3+3*4*2=27 by default) skips: add skip connection in the Dth layer""" <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BgNeRF: def __init__(self, D, W, in_channels_dir=27, with_semantics=False, n_classes=6): """D: number of layers W: number of hidden units in each layer in_channels_dir: number of input channels for direction (3+3*4*2=27 by default) skips: add skip connection in the Dth layer""" super().__init_...
the_stack_v2_python_sparse
nerflets/models/nerf.py
Jimmy-INL/google-research
train
1
8f5217c239308f19f1e873422c05455e42c4c0f4
[ "self.num_map = defaultdict(list)\nfor i in range(len(nums)):\n self.num_map[nums[i]].append(i)", "arr = self.num_map[target]\nif len(self.num_map) == 1:\n return arr[0]\nelse:\n index = randint(0, len(arr) - 1)\n return arr[index]" ]
<|body_start_0|> self.num_map = defaultdict(list) for i in range(len(nums)): self.num_map[nums[i]].append(i) <|end_body_0|> <|body_start_1|> arr = self.num_map[target] if len(self.num_map) == 1: return arr[0] else: index = randint(0, len(arr) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def pick(self, target): """:type target: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.num_map = defaultdict(list) for i in range(len(nums)): ...
stack_v2_sparse_classes_36k_train_025113
1,594
no_license
[ { "docstring": ":type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": ":type target: int :rtype: int", "name": "pick", "signature": "def pick(self, target)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def pick(self, target): :type target: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def pick(self, target): :type target: int :rtype: int <|skeleton|> class Solution: def __init__(self, nums): """:t...
1211eac167f33084f536007468ea10c1a0ceab08
<|skeleton|> class Solution: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def pick(self, target): """:type target: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, nums): """:type nums: List[int]""" self.num_map = defaultdict(list) for i in range(len(nums)): self.num_map[nums[i]].append(i) def pick(self, target): """:type target: int :rtype: int""" arr = self.num_map[target] if...
the_stack_v2_python_sparse
398_RandomPickIndex.py
renukadeshmukh/Leetcode_Solutions
train
3
e7604ed3ca0b5e41f97e5f7aa3cb550eecb484dc
[ "if isinstance(key, int):\n return Option(key)\nif key not in Option._member_map_:\n return extend_enum(Option, key, default)\nreturn Option[key]", "if not (isinstance(value, int) and 0 <= value <= 255):\n raise ValueError('%r is not a valid %s' % (value, cls.__name__))\nreturn extend_enum(cls, 'Unassign...
<|body_start_0|> if isinstance(key, int): return Option(key) if key not in Option._member_map_: return extend_enum(Option, key, default) return Option[key] <|end_body_0|> <|body_start_1|> if not (isinstance(value, int) and 0 <= value <= 255): raise Va...
[Option] Mobility Options
Option
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Option: """[Option] Mobility Options""" def get(key: 'int | str', default: 'int'=-1) -> 'Option': """Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:""" <|body_0|> def _missing_(cls, value: 'int') -...
stack_v2_sparse_classes_36k_train_025114
7,031
permissive
[ { "docstring": "Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:", "name": "get", "signature": "def get(key: 'int | str', default: 'int'=-1) -> 'Option'" }, { "docstring": "Lookup function used when value is not found. Args...
2
null
Implement the Python class `Option` described below. Class description: [Option] Mobility Options Method signatures and docstrings: - def get(key: 'int | str', default: 'int'=-1) -> 'Option': Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private: - de...
Implement the Python class `Option` described below. Class description: [Option] Mobility Options Method signatures and docstrings: - def get(key: 'int | str', default: 'int'=-1) -> 'Option': Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private: - de...
a6fe49ec58f09e105bec5a00fb66d9b3f22730d9
<|skeleton|> class Option: """[Option] Mobility Options""" def get(key: 'int | str', default: 'int'=-1) -> 'Option': """Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:""" <|body_0|> def _missing_(cls, value: 'int') -...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Option: """[Option] Mobility Options""" def get(key: 'int | str', default: 'int'=-1) -> 'Option': """Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:""" if isinstance(key, int): return Option(key) ...
the_stack_v2_python_sparse
pcapkit/const/mh/option.py
JarryShaw/PyPCAPKit
train
204
ac92d1a0eb628e22f9472b7215529fa745a83ebd
[ "if config.memoryProfile:\n config.memoryProfile.sample()\nif config.hotshotProfile:\n import hotshot\n config.hotshotProfile = hotshot.Profile(config.hotshotProfile)\nserver.Site.startFactory(self)", "server.Site.stopFactory(self)\nif config.hotshotProfile:\n config.hotshotProfile.close()" ]
<|body_start_0|> if config.memoryProfile: config.memoryProfile.sample() if config.hotshotProfile: import hotshot config.hotshotProfile = hotshot.Profile(config.hotshotProfile) server.Site.startFactory(self) <|end_body_0|> <|body_start_1|> server.Site....
Moin site
MoinSite
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MoinSite: """Moin site""" def startFactory(self): """Setup before starting""" <|body_0|> def stopFactory(self): """Cleaup before stoping""" <|body_1|> <|end_skeleton|> <|body_start_0|> if config.memoryProfile: config.memoryProfile.sa...
stack_v2_sparse_classes_36k_train_025115
8,777
no_license
[ { "docstring": "Setup before starting", "name": "startFactory", "signature": "def startFactory(self)" }, { "docstring": "Cleaup before stoping", "name": "stopFactory", "signature": "def stopFactory(self)" } ]
2
stack_v2_sparse_classes_30k_train_001992
Implement the Python class `MoinSite` described below. Class description: Moin site Method signatures and docstrings: - def startFactory(self): Setup before starting - def stopFactory(self): Cleaup before stoping
Implement the Python class `MoinSite` described below. Class description: Moin site Method signatures and docstrings: - def startFactory(self): Setup before starting - def stopFactory(self): Cleaup before stoping <|skeleton|> class MoinSite: """Moin site""" def startFactory(self): """Setup before st...
a17b987c5adaa13befb0fd74ac400c8edbe62ef5
<|skeleton|> class MoinSite: """Moin site""" def startFactory(self): """Setup before starting""" <|body_0|> def stopFactory(self): """Cleaup before stoping""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MoinSite: """Moin site""" def startFactory(self): """Setup before starting""" if config.memoryProfile: config.memoryProfile.sample() if config.hotshotProfile: import hotshot config.hotshotProfile = hotshot.Profile(config.hotshotProfile) ...
the_stack_v2_python_sparse
moin/lib/python2.4/site-packages/MoinMoin/server/twistedmoin.py
imosts/flume
train
0
435f48322403ca8e571f3bccfe8cc3a0a1677b7e
[ "super().__init__()\nself.frequency = frequency\nself.quality_factor = quality_factor\nself.sampling_freq = sampling_freq", "b_notch, a_notch = convert_to_tensor(iirnotch(self.frequency, self.quality_factor, self.sampling_freq), dtype=torch.float)\ny_notched = filtfilt(convert_to_tensor(signal), a_notch, b_notch)...
<|body_start_0|> super().__init__() self.frequency = frequency self.quality_factor = quality_factor self.sampling_freq = sampling_freq <|end_body_0|> <|body_start_1|> b_notch, a_notch = convert_to_tensor(iirnotch(self.frequency, self.quality_factor, self.sampling_freq), dtype=to...
Remove a frequency from a signal
SignalRemoveFrequency
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SignalRemoveFrequency: """Remove a frequency from a signal""" def __init__(self, frequency: float | None=None, quality_factor: float | None=None, sampling_freq: float | None=None) -> None: """Args: frequency: frequency to be removed from the signal quality_factor: quality factor for ...
stack_v2_sparse_classes_36k_train_025116
16,322
permissive
[ { "docstring": "Args: frequency: frequency to be removed from the signal quality_factor: quality factor for notch filter see : https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.iirnotch.html sampling_freq: sampling frequency of the input signal", "name": "__init__", "signature": "def __i...
2
stack_v2_sparse_classes_30k_train_018552
Implement the Python class `SignalRemoveFrequency` described below. Class description: Remove a frequency from a signal Method signatures and docstrings: - def __init__(self, frequency: float | None=None, quality_factor: float | None=None, sampling_freq: float | None=None) -> None: Args: frequency: frequency to be re...
Implement the Python class `SignalRemoveFrequency` described below. Class description: Remove a frequency from a signal Method signatures and docstrings: - def __init__(self, frequency: float | None=None, quality_factor: float | None=None, sampling_freq: float | None=None) -> None: Args: frequency: frequency to be re...
e48c3e2c741fa3fc705c4425d17ac4a5afac6c47
<|skeleton|> class SignalRemoveFrequency: """Remove a frequency from a signal""" def __init__(self, frequency: float | None=None, quality_factor: float | None=None, sampling_freq: float | None=None) -> None: """Args: frequency: frequency to be removed from the signal quality_factor: quality factor for ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SignalRemoveFrequency: """Remove a frequency from a signal""" def __init__(self, frequency: float | None=None, quality_factor: float | None=None, sampling_freq: float | None=None) -> None: """Args: frequency: frequency to be removed from the signal quality_factor: quality factor for notch filter ...
the_stack_v2_python_sparse
monai/transforms/signal/array.py
Project-MONAI/MONAI
train
4,805
af11b83519e5d40ab468f52d17412432523ec196
[ "self.bam_handler = PEPPER_VARIANT.BAM_handler(bam_file_path)\nself.fasta_handler = PEPPER_VARIANT.FASTA_handler(fasta_file_path)\nself.chromosome_name = chromosome_name", "if not options.use_hp_info:\n alignment_summarizer = AlignmentSummarizer(self.bam_handler, self.fasta_handler, self.chromosome_name, start...
<|body_start_0|> self.bam_handler = PEPPER_VARIANT.BAM_handler(bam_file_path) self.fasta_handler = PEPPER_VARIANT.FASTA_handler(fasta_file_path) self.chromosome_name = chromosome_name <|end_body_0|> <|body_start_1|> if not options.use_hp_info: alignment_summarizer = Alignmen...
Process manager that runs sequence of processes to generate images and their labels.
ImageGenerator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageGenerator: """Process manager that runs sequence of processes to generate images and their labels.""" def __init__(self, chromosome_name, bam_file_path, fasta_file_path): """Initialize a manager object :param chromosome_name: Name of the chromosome :param bam_file_path: Path to ...
stack_v2_sparse_classes_36k_train_025117
16,089
permissive
[ { "docstring": "Initialize a manager object :param chromosome_name: Name of the chromosome :param bam_file_path: Path to the BAM file :param fasta_file_path: Path to the reference FASTA file", "name": "__init__", "signature": "def __init__(self, chromosome_name, bam_file_path, fasta_file_path)" }, {...
2
null
Implement the Python class `ImageGenerator` described below. Class description: Process manager that runs sequence of processes to generate images and their labels. Method signatures and docstrings: - def __init__(self, chromosome_name, bam_file_path, fasta_file_path): Initialize a manager object :param chromosome_na...
Implement the Python class `ImageGenerator` described below. Class description: Process manager that runs sequence of processes to generate images and their labels. Method signatures and docstrings: - def __init__(self, chromosome_name, bam_file_path, fasta_file_path): Initialize a manager object :param chromosome_na...
30c8907501b254bb72d8f64dfb8cf54a1b7a60eb
<|skeleton|> class ImageGenerator: """Process manager that runs sequence of processes to generate images and their labels.""" def __init__(self, chromosome_name, bam_file_path, fasta_file_path): """Initialize a manager object :param chromosome_name: Name of the chromosome :param bam_file_path: Path to ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImageGenerator: """Process manager that runs sequence of processes to generate images and their labels.""" def __init__(self, chromosome_name, bam_file_path, fasta_file_path): """Initialize a manager object :param chromosome_name: Name of the chromosome :param bam_file_path: Path to the BAM file ...
the_stack_v2_python_sparse
pepper_variant/modules/python/ImageGenerationUI.py
kishwarshafin/pepper
train
219
60e091d1b582be3cd32147f3374be9d3ce03cb25
[ "self.foldername = foldername\nself.s3_config_json_filename = os.path.join(AWS_CRED_DIR, 'aws_s3_credentials.json')\nself.s3_util = S3Util(aws_cred_config_json_filename=self.s3_config_json_filename)\nself.msg_printer = wasabi.Printer()\nself.interact()", "choices = []\npath = pathlib.Path(self.foldername)\nfor di...
<|body_start_0|> self.foldername = foldername self.s3_config_json_filename = os.path.join(AWS_CRED_DIR, 'aws_s3_credentials.json') self.s3_util = S3Util(aws_cred_config_json_filename=self.s3_config_json_filename) self.msg_printer = wasabi.Printer() self.interact() <|end_body_0|> ...
S3OutputMove
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class S3OutputMove: def __init__(self, foldername: str): """Provides an interactive way to move some folders to s3 Parameters ---------- foldername : str The folder name which will be moved to S3 bucket""" <|body_0|> def get_folder_choice(self): """Goes through the folder ...
stack_v2_sparse_classes_36k_train_025118
3,125
permissive
[ { "docstring": "Provides an interactive way to move some folders to s3 Parameters ---------- foldername : str The folder name which will be moved to S3 bucket", "name": "__init__", "signature": "def __init__(self, foldername: str)" }, { "docstring": "Goes through the folder and gets the choice o...
4
stack_v2_sparse_classes_30k_train_009491
Implement the Python class `S3OutputMove` described below. Class description: Implement the S3OutputMove class. Method signatures and docstrings: - def __init__(self, foldername: str): Provides an interactive way to move some folders to s3 Parameters ---------- foldername : str The folder name which will be moved to ...
Implement the Python class `S3OutputMove` described below. Class description: Implement the S3OutputMove class. Method signatures and docstrings: - def __init__(self, foldername: str): Provides an interactive way to move some folders to s3 Parameters ---------- foldername : str The folder name which will be moved to ...
1c061b99a35a9d8b565d9762aaaf5db979b50112
<|skeleton|> class S3OutputMove: def __init__(self, foldername: str): """Provides an interactive way to move some folders to s3 Parameters ---------- foldername : str The folder name which will be moved to S3 bucket""" <|body_0|> def get_folder_choice(self): """Goes through the folder ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class S3OutputMove: def __init__(self, foldername: str): """Provides an interactive way to move some folders to s3 Parameters ---------- foldername : str The folder name which will be moved to S3 bucket""" self.foldername = foldername self.s3_config_json_filename = os.path.join(AWS_CRED_DIR,...
the_stack_v2_python_sparse
sciwing/cli/s3_mv_cli.py
abhinavkashyap/sciwing
train
58
a8e50982c1776966b621ddde4ab8d7844365cceb
[ "if self.__dict__.get('verbose', False):\n print('generating anagrams')\nself.anagrams = build_anagrams(jobs)\nfor job in jobs:\n try:\n remaining_letters = alphabetize(char_filter(self.word, job, 1))\n if remaining_letters in self.anagrams:\n for second_job in self.anagrams[remaining...
<|body_start_0|> if self.__dict__.get('verbose', False): print('generating anagrams') self.anagrams = build_anagrams(jobs) for job in jobs: try: remaining_letters = alphabetize(char_filter(self.word, job, 1)) if remaining_letters in self.an...
MySolver is an example solver which is a child of the solver class.
MySolver
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MySolver: """MySolver is an example solver which is a child of the solver class.""" def try_list(self, list_name, jobs): """Takes a list job titles, and trys to find whether any of them together match merchant raider alphabetized.""" <|body_0|> def get_candidates(self): ...
stack_v2_sparse_classes_36k_train_025119
3,609
permissive
[ { "docstring": "Takes a list job titles, and trys to find whether any of them together match merchant raider alphabetized.", "name": "try_list", "signature": "def try_list(self, list_name, jobs)" }, { "docstring": "prints the current list of candidates", "name": "get_candidates", "signat...
2
stack_v2_sparse_classes_30k_train_004224
Implement the Python class `MySolver` described below. Class description: MySolver is an example solver which is a child of the solver class. Method signatures and docstrings: - def try_list(self, list_name, jobs): Takes a list job titles, and trys to find whether any of them together match merchant raider alphabetiz...
Implement the Python class `MySolver` described below. Class description: MySolver is an example solver which is a child of the solver class. Method signatures and docstrings: - def try_list(self, list_name, jobs): Takes a list job titles, and trys to find whether any of them together match merchant raider alphabetiz...
c84c1b51d83c7e780430175e41588632441aa180
<|skeleton|> class MySolver: """MySolver is an example solver which is a child of the solver class.""" def try_list(self, list_name, jobs): """Takes a list job titles, and trys to find whether any of them together match merchant raider alphabetized.""" <|body_0|> def get_candidates(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MySolver: """MySolver is an example solver which is a child of the solver class.""" def try_list(self, list_name, jobs): """Takes a list job titles, and trys to find whether any of them together match merchant raider alphabetized.""" if self.__dict__.get('verbose', False): pri...
the_stack_v2_python_sparse
solutions/20150524/merchant_raider.py
johnobrien/pyshortz
train
0
6e27f7b8c62d9a9632620af1d831dbe069c94492
[ "super(Encoder, self).__init__()\nself.dm = dm\nself.N = N\nself.embedding = tf.keras.layers.Embedding(input_vocab, dm)\nself.positional_encoding = positional_encoding(max_seq_len, self.dm)\nself.blocks = [EncoderBlock(dm, h, hidden, drop_rate) for _ in range(N)]\nself.dropout = tf.keras.layers.Dropout(drop_rate)",...
<|body_start_0|> super(Encoder, self).__init__() self.dm = dm self.N = N self.embedding = tf.keras.layers.Embedding(input_vocab, dm) self.positional_encoding = positional_encoding(max_seq_len, self.dm) self.blocks = [EncoderBlock(dm, h, hidden, drop_rate) for _ in range(N...
Encoder represents a Transformers encoder layer
Encoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Encoder: """Encoder represents a Transformers encoder layer""" def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1): """Encoder represents a Transformers encoder layer""" <|body_0|> def call(self, x, training, mask): """This calls the enc...
stack_v2_sparse_classes_36k_train_025120
1,422
no_license
[ { "docstring": "Encoder represents a Transformers encoder layer", "name": "__init__", "signature": "def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1)" }, { "docstring": "This calls the encoder algo and returns encoder output", "name": "call", "signature": "def...
2
stack_v2_sparse_classes_30k_val_001140
Implement the Python class `Encoder` described below. Class description: Encoder represents a Transformers encoder layer Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1): Encoder represents a Transformers encoder layer - def call(self, x, training, mask...
Implement the Python class `Encoder` described below. Class description: Encoder represents a Transformers encoder layer Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1): Encoder represents a Transformers encoder layer - def call(self, x, training, mask...
05eabebe5e5c050b1c4a7e1454b947638d883176
<|skeleton|> class Encoder: """Encoder represents a Transformers encoder layer""" def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1): """Encoder represents a Transformers encoder layer""" <|body_0|> def call(self, x, training, mask): """This calls the enc...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Encoder: """Encoder represents a Transformers encoder layer""" def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1): """Encoder represents a Transformers encoder layer""" super(Encoder, self).__init__() self.dm = dm self.N = N self.embeddin...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/9-transformer_encoder.py
chriswill88/holbertonschool-machine_learning
train
0
37b7b25d91417ed99dc8b6b5fa6636c08d6fc391
[ "super(PIFuhd_Surface_Head, self).__init__()\nself.name = 'PIFuhd_Surface_Head'\nif last_op == 'sigmoid':\n self.last_op = nn.Sigmoid()\nelse:\n raise NotImplementedError('only sigmoid function could be used in terms of sigmoid')\nself.filters = nn.ModuleList()\nself.norms = nn.ModuleList()\nself.merge_layer ...
<|body_start_0|> super(PIFuhd_Surface_Head, self).__init__() self.name = 'PIFuhd_Surface_Head' if last_op == 'sigmoid': self.last_op = nn.Sigmoid() else: raise NotImplementedError('only sigmoid function could be used in terms of sigmoid') self.filters = nn...
MLP: aims at learn iso-surface function Implicit function where 0->outside, 1-> inside therefore, we define 0.5 is iso-surface
PIFuhd_Surface_Head
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PIFuhd_Surface_Head: """MLP: aims at learn iso-surface function Implicit function where 0->outside, 1-> inside therefore, we define 0.5 is iso-surface""" def __init__(self, filter_channels, merge_layer=0, res_layers=[], norm='group', last_op=None): """Parameters: filter_channels: Lis...
stack_v2_sparse_classes_36k_train_025121
3,326
permissive
[ { "docstring": "Parameters: filter_channels: List mlp layers default [257, 1024, 512, 256, 128, 1] merge_layer: it means which layer you want to employ in fine PIFu model res_layers: whether you wana employ residual block ? Default [2,3,4] norm: use group normalization or not last_op: what kind of operator you ...
2
stack_v2_sparse_classes_30k_train_008983
Implement the Python class `PIFuhd_Surface_Head` described below. Class description: MLP: aims at learn iso-surface function Implicit function where 0->outside, 1-> inside therefore, we define 0.5 is iso-surface Method signatures and docstrings: - def __init__(self, filter_channels, merge_layer=0, res_layers=[], norm...
Implement the Python class `PIFuhd_Surface_Head` described below. Class description: MLP: aims at learn iso-surface function Implicit function where 0->outside, 1-> inside therefore, we define 0.5 is iso-surface Method signatures and docstrings: - def __init__(self, filter_channels, merge_layer=0, res_layers=[], norm...
3a66b647bcf5591e818af62735e64a93c4aaef85
<|skeleton|> class PIFuhd_Surface_Head: """MLP: aims at learn iso-surface function Implicit function where 0->outside, 1-> inside therefore, we define 0.5 is iso-surface""" def __init__(self, filter_channels, merge_layer=0, res_layers=[], norm='group', last_op=None): """Parameters: filter_channels: Lis...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PIFuhd_Surface_Head: """MLP: aims at learn iso-surface function Implicit function where 0->outside, 1-> inside therefore, we define 0.5 is iso-surface""" def __init__(self, filter_channels, merge_layer=0, res_layers=[], norm='group', last_op=None): """Parameters: filter_channels: List mlp layers ...
the_stack_v2_python_sparse
engineer/models/heads/PIFuhd_Surface_head.py
yukangcao/Open-PIFuhd
train
0
60db057abca1525edf81897dfc1b3748b2e430a8
[ "List = []\nfor i in range(len(points) - 2):\n for j in range(i + 1, len(points) - 1):\n for k in range(j + 1, len(points)):\n S = self.TriangleArea(points[i], points[j], points[k])\n List.append(S)\nreturn max(List)", "x1, x2, x3 = (A[0], B[0], C[0])\ny1, y2, y3 = (A[1], B[1], C[1...
<|body_start_0|> List = [] for i in range(len(points) - 2): for j in range(i + 1, len(points) - 1): for k in range(j + 1, len(points)): S = self.TriangleArea(points[i], points[j], points[k]) List.append(S) return max(List) <|end...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def largestTriangleArea(self, points): """:type points: List[List[int]] :rtype: float""" <|body_0|> def TriangleArea(self, A, B, C): """给定三个坐标,求三角形面积""" <|body_1|> <|end_skeleton|> <|body_start_0|> List = [] for i in range(len(poin...
stack_v2_sparse_classes_36k_train_025122
765
no_license
[ { "docstring": ":type points: List[List[int]] :rtype: float", "name": "largestTriangleArea", "signature": "def largestTriangleArea(self, points)" }, { "docstring": "给定三个坐标,求三角形面积", "name": "TriangleArea", "signature": "def TriangleArea(self, A, B, C)" } ]
2
stack_v2_sparse_classes_30k_train_019633
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestTriangleArea(self, points): :type points: List[List[int]] :rtype: float - def TriangleArea(self, A, B, C): 给定三个坐标,求三角形面积
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestTriangleArea(self, points): :type points: List[List[int]] :rtype: float - def TriangleArea(self, A, B, C): 给定三个坐标,求三角形面积 <|skeleton|> class Solution: def largest...
2df5d3b361bc7d25cd3d2afd5ac1c64fbc303920
<|skeleton|> class Solution: def largestTriangleArea(self, points): """:type points: List[List[int]] :rtype: float""" <|body_0|> def TriangleArea(self, A, B, C): """给定三个坐标,求三角形面积""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def largestTriangleArea(self, points): """:type points: List[List[int]] :rtype: float""" List = [] for i in range(len(points) - 2): for j in range(i + 1, len(points) - 1): for k in range(j + 1, len(points)): S = self.TriangleAre...
the_stack_v2_python_sparse
leetcode_812.py
SongJialiJiali/test
train
0
bd7724708e167478f1b6ccd9ab4aef77d1a9e9d0
[ "writeFastaFile(sequences, 'sequences.fasta.tmp')\ncommand = 'mafft --auto'\nif anysymbol:\n command += ' --anysymbol'\ncommand += ' sequences.fasta.tmp > sequences.aligned.fasta.tmp'\nos.system(command)\nalignment = AlignIO.read('sequences.aligned.fasta.tmp', 'fasta')\nos.remove('sequences.fasta.tmp')\nif outpu...
<|body_start_0|> writeFastaFile(sequences, 'sequences.fasta.tmp') command = 'mafft --auto' if anysymbol: command += ' --anysymbol' command += ' sequences.fasta.tmp > sequences.aligned.fasta.tmp' os.system(command) alignment = AlignIO.read('sequences.aligned.fa...
Class to hold methods to work with mafft executable. Methods ------- multipleSequenceAlignment() Execute a multiple sequence alignment of the input sequences
mafft
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class mafft: """Class to hold methods to work with mafft executable. Methods ------- multipleSequenceAlignment() Execute a multiple sequence alignment of the input sequences""" def multipleSequenceAlignment(sequences, output=None, anysymbol=False): """Use the mafft executable to perform a ...
stack_v2_sparse_classes_36k_train_025123
5,064
no_license
[ { "docstring": "Use the mafft executable to perform a multiple sequence alignment. Parameters ---------- sequences : dict Dictionary containing as values the strings representing the sequences of the proteins to align and their identifiers as keys. output : str File name to write the fasta formatted alignment o...
3
stack_v2_sparse_classes_30k_train_005470
Implement the Python class `mafft` described below. Class description: Class to hold methods to work with mafft executable. Methods ------- multipleSequenceAlignment() Execute a multiple sequence alignment of the input sequences Method signatures and docstrings: - def multipleSequenceAlignment(sequences, output=None,...
Implement the Python class `mafft` described below. Class description: Class to hold methods to work with mafft executable. Methods ------- multipleSequenceAlignment() Execute a multiple sequence alignment of the input sequences Method signatures and docstrings: - def multipleSequenceAlignment(sequences, output=None,...
13dedb6ed7114286d922253819dc433478a6fbcb
<|skeleton|> class mafft: """Class to hold methods to work with mafft executable. Methods ------- multipleSequenceAlignment() Execute a multiple sequence alignment of the input sequences""" def multipleSequenceAlignment(sequences, output=None, anysymbol=False): """Use the mafft executable to perform a ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class mafft: """Class to hold methods to work with mafft executable. Methods ------- multipleSequenceAlignment() Execute a multiple sequence alignment of the input sequences""" def multipleSequenceAlignment(sequences, output=None, anysymbol=False): """Use the mafft executable to perform a multiple sequ...
the_stack_v2_python_sparse
pycbbl/alignment/mafft_functions.py
CompBiochBiophLab/pycbbl
train
1
590822e0dac13775cd3fb6cee93cb6794b4be3a6
[ "test_array = [array_amqp_type]\nfor _ in range(repeat):\n for val in self.type_map[array_amqp_type]:\n test_array.append(val)\nreturn test_array", "if test_type == 'binary':\n test_values = []\n bytes_test_values = super().get_test_values(test_type)\n for bytes_test_value in bytes_test_values:...
<|body_start_0|> test_array = [array_amqp_type] for _ in range(repeat): for val in self.type_map[array_amqp_type]: test_array.append(val) return test_array <|end_body_0|> <|body_start_1|> if test_type == 'binary': test_values = [] byte...
Class which contains all the described AMQP primitive types and the test values to be used in testing.
AmqpPrimitiveTypes
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AmqpPrimitiveTypes: """Class which contains all the described AMQP primitive types and the test values to be used in testing.""" def create_array(self, array_amqp_type, repeat): """Create a single test array for a given AMQP type from the test values for that type. It can be optional...
stack_v2_sparse_classes_36k_train_025124
18,156
permissive
[ { "docstring": "Create a single test array for a given AMQP type from the test values for that type. It can be optionally repeated for greater number of elements.", "name": "create_array", "signature": "def create_array(self, array_amqp_type, repeat)" }, { "docstring": "Overload the parent metho...
2
stack_v2_sparse_classes_30k_train_000716
Implement the Python class `AmqpPrimitiveTypes` described below. Class description: Class which contains all the described AMQP primitive types and the test values to be used in testing. Method signatures and docstrings: - def create_array(self, array_amqp_type, repeat): Create a single test array for a given AMQP ty...
Implement the Python class `AmqpPrimitiveTypes` described below. Class description: Class which contains all the described AMQP primitive types and the test values to be used in testing. Method signatures and docstrings: - def create_array(self, array_amqp_type, repeat): Create a single test array for a given AMQP ty...
2ae24aa2ac6998b9598b02e5b181f187f7b51212
<|skeleton|> class AmqpPrimitiveTypes: """Class which contains all the described AMQP primitive types and the test values to be used in testing.""" def create_array(self, array_amqp_type, repeat): """Create a single test array for a given AMQP type from the test values for that type. It can be optional...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AmqpPrimitiveTypes: """Class which contains all the described AMQP primitive types and the test values to be used in testing.""" def create_array(self, array_amqp_type, repeat): """Create a single test array for a given AMQP type from the test values for that type. It can be optionally repeated f...
the_stack_v2_python_sparse
src/python/qpid_interop_test/amqp_types_test.py
apache/qpid-interop-test
train
7
304f726f08b371ded8567a002c4eabed8624e2a1
[ "super().__init__()\nself.factor_dependencies = factor_dependencies\nfor factor_type, model in factor_models.items():\n self.__setattr__(factor_type + '_factor_model', model)\nself.factor_models = factor_models\nself.factor_label_indices = dict()\nfor factor_type, dependencies in factor_dependencies.items():\n ...
<|body_start_0|> super().__init__() self.factor_dependencies = factor_dependencies for factor_type, model in factor_models.items(): self.__setattr__(factor_type + '_factor_model', model) self.factor_models = factor_models self.factor_label_indices = dict() for...
FactorGraph interface to work with cpp implementations. It manages the models for the factors and the inference of their scores.
FactorGraphCpp
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FactorGraphCpp: """FactorGraph interface to work with cpp implementations. It manages the models for the factors and the inference of their scores.""" def __init__(self, factor_dependencies: Dict[str, List[Tuple[int]]], factor_models: Dict[str, nn.Module]): """See nsr.graph.factor_gr...
stack_v2_sparse_classes_36k_train_025125
2,129
permissive
[ { "docstring": "See nsr.graph.factor_graph.FactorGraph.", "name": "__init__", "signature": "def __init__(self, factor_dependencies: Dict[str, List[Tuple[int]]], factor_models: Dict[str, nn.Module])" }, { "docstring": "Evaluate all the factor Tensors. Args: input_states: states for each label nod...
2
stack_v2_sparse_classes_30k_train_016510
Implement the Python class `FactorGraphCpp` described below. Class description: FactorGraph interface to work with cpp implementations. It manages the models for the factors and the inference of their scores. Method signatures and docstrings: - def __init__(self, factor_dependencies: Dict[str, List[Tuple[int]]], fact...
Implement the Python class `FactorGraphCpp` described below. Class description: FactorGraph interface to work with cpp implementations. It manages the models for the factors and the inference of their scores. Method signatures and docstrings: - def __init__(self, factor_dependencies: Dict[str, List[Tuple[int]]], fact...
8b4a7a40cc34bff608f19d3f7eb64bda76669c5b
<|skeleton|> class FactorGraphCpp: """FactorGraph interface to work with cpp implementations. It manages the models for the factors and the inference of their scores.""" def __init__(self, factor_dependencies: Dict[str, List[Tuple[int]]], factor_models: Dict[str, nn.Module]): """See nsr.graph.factor_gr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FactorGraphCpp: """FactorGraph interface to work with cpp implementations. It manages the models for the factors and the inference of their scores.""" def __init__(self, factor_dependencies: Dict[str, List[Tuple[int]]], factor_models: Dict[str, nn.Module]): """See nsr.graph.factor_graph.FactorGra...
the_stack_v2_python_sparse
nsr/graph_cpp/factor_graph_cpp.py
GaoSida/Neural-SampleRank
train
3
92a1915fa2859bf57ef59813821caedd96bfdbaa
[ "if not nums:\n return False\ncount = {}\nfor i in nums:\n count[i] = count.get(i, 0) + 1\n if count.get(i, 0) > 1:\n return True\nreturn False", "if not nums:\n return False\nnums.sort()\ni = 1\nwhile i < len(nums):\n if nums[i] == nums[i - 1]:\n return True\n i += 1\nreturn False...
<|body_start_0|> if not nums: return False count = {} for i in nums: count[i] = count.get(i, 0) + 1 if count.get(i, 0) > 1: return True return False <|end_body_0|> <|body_start_1|> if not nums: return False ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def containsDuplicate(self, nums: List[int]) -> bool: """统计""" <|body_0|> def containsDuplicate1(self, nums: List[int]) -> bool: """指针""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not nums: return False count = {}...
stack_v2_sparse_classes_36k_train_025126
1,003
no_license
[ { "docstring": "统计", "name": "containsDuplicate", "signature": "def containsDuplicate(self, nums: List[int]) -> bool" }, { "docstring": "指针", "name": "containsDuplicate1", "signature": "def containsDuplicate1(self, nums: List[int]) -> bool" } ]
2
stack_v2_sparse_classes_30k_train_017162
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsDuplicate(self, nums: List[int]) -> bool: 统计 - def containsDuplicate1(self, nums: List[int]) -> bool: 指针
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsDuplicate(self, nums: List[int]) -> bool: 统计 - def containsDuplicate1(self, nums: List[int]) -> bool: 指针 <|skeleton|> class Solution: def containsDuplicate(self...
069bb0b751ef7f469036b9897436eb5d138ffa24
<|skeleton|> class Solution: def containsDuplicate(self, nums: List[int]) -> bool: """统计""" <|body_0|> def containsDuplicate1(self, nums: List[int]) -> bool: """指针""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def containsDuplicate(self, nums: List[int]) -> bool: """统计""" if not nums: return False count = {} for i in nums: count[i] = count.get(i, 0) + 1 if count.get(i, 0) > 1: return True return False def cont...
the_stack_v2_python_sparse
算法/Week_03/217. 存在重复元素.py
RichieSong/algorithm
train
0
16735da1a755908f562d3d59cf5ed009f837f213
[ "dqrqsj = datetime.datetime.now().strftime('%Y%m%d%H:%M:%S')\ndqrq = dqrqsj[:8]\ndqsj = dqrqsj[8:]\nqtrqsj = (datetime.datetime.strptime(dqrqsj, '%Y%m%d%H:%M:%S') - datetime.timedelta(minutes=int(min))).strftime('%Y%m%d%H:%M:%S')\nqtrq = qtrqsj[:8]\nqtsj = qtrqsj[8:]\nxym_str_lst = sbxymlb.split(',')\njym_str_lst =...
<|body_start_0|> dqrqsj = datetime.datetime.now().strftime('%Y%m%d%H:%M:%S') dqrq = dqrqsj[:8] dqsj = dqrqsj[8:] qtrqsj = (datetime.datetime.strptime(dqrqsj, '%Y%m%d%H:%M:%S') - datetime.timedelta(minutes=int(min))).strftime('%Y%m%d%H:%M:%S') qtrq = qtrqsj[:8] qtsj = qtrq...
Business
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Business: def get_failtrans(self, jymlb, sbxymlb, min): """获取交易失败笔数""" <|body_0|> def get_firstrans(self, jymlb): """获取业务第一笔交易""" <|body_1|> <|end_skeleton|> <|body_start_0|> dqrqsj = datetime.datetime.now().strftime('%Y%m%d%H:%M:%S') dqrq =...
stack_v2_sparse_classes_36k_train_025127
16,132
no_license
[ { "docstring": "获取交易失败笔数", "name": "get_failtrans", "signature": "def get_failtrans(self, jymlb, sbxymlb, min)" }, { "docstring": "获取业务第一笔交易", "name": "get_firstrans", "signature": "def get_firstrans(self, jymlb)" } ]
2
stack_v2_sparse_classes_30k_train_013729
Implement the Python class `Business` described below. Class description: Implement the Business class. Method signatures and docstrings: - def get_failtrans(self, jymlb, sbxymlb, min): 获取交易失败笔数 - def get_firstrans(self, jymlb): 获取业务第一笔交易
Implement the Python class `Business` described below. Class description: Implement the Business class. Method signatures and docstrings: - def get_failtrans(self, jymlb, sbxymlb, min): 获取交易失败笔数 - def get_firstrans(self, jymlb): 获取业务第一笔交易 <|skeleton|> class Business: def get_failtrans(self, jymlb, sbxymlb, min)...
68ddf3df6d2cd731e6634b09d27aff4c22debd8e
<|skeleton|> class Business: def get_failtrans(self, jymlb, sbxymlb, min): """获取交易失败笔数""" <|body_0|> def get_firstrans(self, jymlb): """获取业务第一笔交易""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Business: def get_failtrans(self, jymlb, sbxymlb, min): """获取交易失败笔数""" dqrqsj = datetime.datetime.now().strftime('%Y%m%d%H:%M:%S') dqrq = dqrqsj[:8] dqsj = dqrqsj[8:] qtrqsj = (datetime.datetime.strptime(dqrqsj, '%Y%m%d%H:%M:%S') - datetime.timedelta(minutes=int(min)))....
the_stack_v2_python_sparse
zh_manage/apps/_init/oa/yw_jkgl/yw_jkgl_001/yw_jkgl_001.py
yizhong120110/CPOS
train
0
5506856d790b0315ee9a2092553d08dae7830412
[ "self._generator = generator\nself._pageSize = pageSize\nif otherOptions is None:\n otherOptions = []\nself._otherOptions = otherOptions\nself._preMessage = preMessage\nself._postMessage = postMessage\nself._emptyMessage = emptyMessage\nself._displayedItems = []\nself._displayedItemStrings = []\nself._exhaustedI...
<|body_start_0|> self._generator = generator self._pageSize = pageSize if otherOptions is None: otherOptions = [] self._otherOptions = otherOptions self._preMessage = preMessage self._postMessage = postMessage self._emptyMessage = emptyMessage ...
A menu that displays a few options at a time with a "See more" option Gets options using a given generator
TerminalGeneratorMenu
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TerminalGeneratorMenu: """A menu that displays a few options at a time with a "See more" option Gets options using a given generator""" def __init__(self, generator, pageSize=5, otherOptions=None, preMessage=None, postMessage=None, emptyMessage='Nothing to display'): """Arguments: ge...
stack_v2_sparse_classes_36k_train_025128
7,322
no_license
[ { "docstring": "Arguments: generator -- the generator to get the options from pageSize -- the number of items to show per page otherOptions -- any options to show below the options from the generator preMessage -- the message to show above the menu postMessage -- the message to show below the menu emptyMessage ...
5
stack_v2_sparse_classes_30k_train_015821
Implement the Python class `TerminalGeneratorMenu` described below. Class description: A menu that displays a few options at a time with a "See more" option Gets options using a given generator Method signatures and docstrings: - def __init__(self, generator, pageSize=5, otherOptions=None, preMessage=None, postMessag...
Implement the Python class `TerminalGeneratorMenu` described below. Class description: A menu that displays a few options at a time with a "See more" option Gets options using a given generator Method signatures and docstrings: - def __init__(self, generator, pageSize=5, otherOptions=None, preMessage=None, postMessag...
46b7e084234227f925a24ea2eb41ed5d9ac14b7a
<|skeleton|> class TerminalGeneratorMenu: """A menu that displays a few options at a time with a "See more" option Gets options using a given generator""" def __init__(self, generator, pageSize=5, otherOptions=None, preMessage=None, postMessage=None, emptyMessage='Nothing to display'): """Arguments: ge...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TerminalGeneratorMenu: """A menu that displays a few options at a time with a "See more" option Gets options using a given generator""" def __init__(self, generator, pageSize=5, otherOptions=None, preMessage=None, postMessage=None, emptyMessage='Nothing to display'): """Arguments: generator -- th...
the_stack_v2_python_sparse
Source/TerminalMenu.py
csahmad/291-Mini-Project-1
train
0
1f1d3e5c277becf8ed0e388acad0bb7c7dd4912a
[ "new_trans = transaction()\nnew_trans.isBuyTransaction = True\nnew_trans.amount = amount\nnew_trans.desired_value = value\nreturn new_trans", "new_trans = transaction()\nnew_trans.isBuyTransaction = False\nnew_trans.amount = amount\nnew_trans.desired_value = value\nreturn new_trans", "if self.isBuyTransaction:\...
<|body_start_0|> new_trans = transaction() new_trans.isBuyTransaction = True new_trans.amount = amount new_trans.desired_value = value return new_trans <|end_body_0|> <|body_start_1|> new_trans = transaction() new_trans.isBuyTransaction = False new_trans....
Transaction factory class. Produces a transaction based on buying or selling.
transaction
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class transaction: """Transaction factory class. Produces a transaction based on buying or selling.""" def buyTransactionFactory(amount, value): """Create a long transaction object.""" <|body_0|> def sellTransactionFactory(amount, value): """Create a short transaction ...
stack_v2_sparse_classes_36k_train_025129
1,093
permissive
[ { "docstring": "Create a long transaction object.", "name": "buyTransactionFactory", "signature": "def buyTransactionFactory(amount, value)" }, { "docstring": "Create a short transaction object.", "name": "sellTransactionFactory", "signature": "def sellTransactionFactory(amount, value)" ...
3
stack_v2_sparse_classes_30k_train_002218
Implement the Python class `transaction` described below. Class description: Transaction factory class. Produces a transaction based on buying or selling. Method signatures and docstrings: - def buyTransactionFactory(amount, value): Create a long transaction object. - def sellTransactionFactory(amount, value): Create...
Implement the Python class `transaction` described below. Class description: Transaction factory class. Produces a transaction based on buying or selling. Method signatures and docstrings: - def buyTransactionFactory(amount, value): Create a long transaction object. - def sellTransactionFactory(amount, value): Create...
e4cfc62f2daa45cb939bb544491cdb1c1a7294ef
<|skeleton|> class transaction: """Transaction factory class. Produces a transaction based on buying or selling.""" def buyTransactionFactory(amount, value): """Create a long transaction object.""" <|body_0|> def sellTransactionFactory(amount, value): """Create a short transaction ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class transaction: """Transaction factory class. Produces a transaction based on buying or selling.""" def buyTransactionFactory(amount, value): """Create a long transaction object.""" new_trans = transaction() new_trans.isBuyTransaction = True new_trans.amount = amount ...
the_stack_v2_python_sparse
app/common/common_classes.py
DataScienceHobbyGroup/nacho-b
train
0
1fc23e16fa9033fb5d66df522f7ba9b1829e8bc0
[ "a = [[None] * n for x in range(n)]\ni = 0\nj = 0\np = 0\na, j, x = self.set_initial_row(a, i, j, n)\nfor q in self.gen_part_len(n):\n for t in range(0, q):\n i, j = self.eval_next_loc(p, i, j)\n a[i][j] = x\n x += 1\n p += 1\nreturn a", "for x in range(1, n):\n a[i][j] = x\n j +=...
<|body_start_0|> a = [[None] * n for x in range(n)] i = 0 j = 0 p = 0 a, j, x = self.set_initial_row(a, i, j, n) for q in self.gen_part_len(n): for t in range(0, q): i, j = self.eval_next_loc(p, i, j) a[i][j] = x ...
Solution
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def make_spiral_matrix(self, n): """Creates spiral matrix from given characteristic factor "n". :param int n: characteristic factor for spiral matrix :return: completed 2D spiral matrix :rtype: list[list[int]]""" <|body_0|> def set_initial_row(self, a, i, j, n): ...
stack_v2_sparse_classes_36k_train_025130
3,472
permissive
[ { "docstring": "Creates spiral matrix from given characteristic factor \"n\". :param int n: characteristic factor for spiral matrix :return: completed 2D spiral matrix :rtype: list[list[int]]", "name": "make_spiral_matrix", "signature": "def make_spiral_matrix(self, n)" }, { "docstring": "Comple...
4
stack_v2_sparse_classes_30k_train_014290
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def make_spiral_matrix(self, n): Creates spiral matrix from given characteristic factor "n". :param int n: characteristic factor for spiral matrix :return: completed 2D spiral ma...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def make_spiral_matrix(self, n): Creates spiral matrix from given characteristic factor "n". :param int n: characteristic factor for spiral matrix :return: completed 2D spiral ma...
69f90877c5466927e8b081c4268cbcda074813ec
<|skeleton|> class Solution: def make_spiral_matrix(self, n): """Creates spiral matrix from given characteristic factor "n". :param int n: characteristic factor for spiral matrix :return: completed 2D spiral matrix :rtype: list[list[int]]""" <|body_0|> def set_initial_row(self, a, i, j, n): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def make_spiral_matrix(self, n): """Creates spiral matrix from given characteristic factor "n". :param int n: characteristic factor for spiral matrix :return: completed 2D spiral matrix :rtype: list[list[int]]""" a = [[None] * n for x in range(n)] i = 0 j = 0 ...
the_stack_v2_python_sparse
0059_spiral_matrix_2/python_source.py
arthurdysart/LeetCode
train
0
78684c89a06df79f0c2207c4a41c7b4ebdf4a036
[ "y = 0\nfor x in range(len(nums)):\n if nums[x]:\n nums[x], nums[y] = (nums[y], nums[x])\n y += 1", "l = len(nums)\nfor i in range(l):\n if nums[i] == 0:\n j = i + 1\n while j < l and nums[j] == 0:\n j += 1\n if j < l:\n nums[i], nums[j] = (nums[j], n...
<|body_start_0|> y = 0 for x in range(len(nums)): if nums[x]: nums[x], nums[y] = (nums[y], nums[x]) y += 1 <|end_body_0|> <|body_start_1|> l = len(nums) for i in range(l): if nums[i] == 0: j = i + 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def moveZeroes(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.""" <|body_0|> def moveZeroes(self, nums: List[int]) -> None: """Do not return anything, modify nums in-place instead.""" <|body_1...
stack_v2_sparse_classes_36k_train_025131
1,129
no_license
[ { "docstring": ":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.", "name": "moveZeroes", "signature": "def moveZeroes(self, nums)" }, { "docstring": "Do not return anything, modify nums in-place instead.", "name": "moveZeroes", "signature": "def mo...
2
stack_v2_sparse_classes_30k_train_003847
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def moveZeroes(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. - def moveZeroes(self, nums: List[int]) -> None: Do not retur...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def moveZeroes(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. - def moveZeroes(self, nums: List[int]) -> None: Do not retur...
378cb9b53e7710c5cf546f5d75e572060e2a211a
<|skeleton|> class Solution: def moveZeroes(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.""" <|body_0|> def moveZeroes(self, nums: List[int]) -> None: """Do not return anything, modify nums in-place instead.""" <|body_1...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def moveZeroes(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.""" y = 0 for x in range(len(nums)): if nums[x]: nums[x], nums[y] = (nums[y], nums[x]) y += 1 def moveZeroes...
the_stack_v2_python_sparse
283.MoveZeroes.py
RupertMa/LeetCode-Playground
train
0
1d33c339a471d73df0253d0cda5ebe5e059f8fc7
[ "length = len(nums)\nif length > 0:\n maxSoFar = nums[0]\n maxEndingHere = nums[0]\n for i in range(1, length):\n maxEndingHere = max(maxEndingHere + nums[i], nums[i])\n maxSoFar = max(maxSoFar, maxEndingHere)\n return maxSoFar\nelse:\n return 0", "count = len(nums)\nif count == 0:\n ...
<|body_start_0|> length = len(nums) if length > 0: maxSoFar = nums[0] maxEndingHere = nums[0] for i in range(1, length): maxEndingHere = max(maxEndingHere + nums[i], nums[i]) maxSoFar = max(maxSoFar, maxEndingHere) return ma...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxSubArray(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def maxSubArray_self(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> length = len(nums) if length > 0...
stack_v2_sparse_classes_36k_train_025132
896
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "maxSubArray", "signature": "def maxSubArray(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "maxSubArray_self", "signature": "def maxSubArray_self(self, nums)" } ]
2
stack_v2_sparse_classes_30k_test_000611
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray(self, nums): :type nums: List[int] :rtype: int - def maxSubArray_self(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray(self, nums): :type nums: List[int] :rtype: int - def maxSubArray_self(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def maxSub...
ea492ec864b50547214ecbbb2cdeeac21e70229b
<|skeleton|> class Solution: def maxSubArray(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def maxSubArray_self(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxSubArray(self, nums): """:type nums: List[int] :rtype: int""" length = len(nums) if length > 0: maxSoFar = nums[0] maxEndingHere = nums[0] for i in range(1, length): maxEndingHere = max(maxEndingHere + nums[i], nums[i...
the_stack_v2_python_sparse
53_maximum_subarray/sol.py
lianke123321/leetcode_sol
train
0
2230b1ab69065d8df6f1ca845c6264e9acd12962
[ "dimod.Composite.__init__(self, sampler)\ntry:\n target_nodelist, target_edgelist, target_adjacency = sampler.structure\nexcept:\n raise\nself.chain_strength = self._validate_chain_strength(chain_strength)\nif isinstance(embedding, str):\n embedding = get_embedding_from_tag(embedding, target_nodelist, targ...
<|body_start_0|> dimod.Composite.__init__(self, sampler) try: target_nodelist, target_edgelist, target_adjacency = sampler.structure except: raise self.chain_strength = self._validate_chain_strength(chain_strength) if isinstance(embedding, str): ...
VirtualGraph
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VirtualGraph: def __init__(self, sampler, embedding, chain_strength=None, flux_biases=None, flux_bias_num_reads=1000, flux_bias_max_age=3600): """Apply the VirtualGraph composite layer to the given solver. Args: sampler (:class:`dwave_micro_client_dimod.DWaveSampler`): A dimod_ sampler. ...
stack_v2_sparse_classes_36k_train_025133
13,081
permissive
[ { "docstring": "Apply the VirtualGraph composite layer to the given solver. Args: sampler (:class:`dwave_micro_client_dimod.DWaveSampler`): A dimod_ sampler. Normally :class:`dwave_micro_client_dimod.DWaveSampler`, or a derived composite sampler. Other samplers in general will not work or will not make sense wi...
3
stack_v2_sparse_classes_30k_train_020639
Implement the Python class `VirtualGraph` described below. Class description: Implement the VirtualGraph class. Method signatures and docstrings: - def __init__(self, sampler, embedding, chain_strength=None, flux_biases=None, flux_bias_num_reads=1000, flux_bias_max_age=3600): Apply the VirtualGraph composite layer to...
Implement the Python class `VirtualGraph` described below. Class description: Implement the VirtualGraph class. Method signatures and docstrings: - def __init__(self, sampler, embedding, chain_strength=None, flux_biases=None, flux_bias_num_reads=1000, flux_bias_max_age=3600): Apply the VirtualGraph composite layer to...
0c1c805fd5dfce465a8955ee3faf81037023a23e
<|skeleton|> class VirtualGraph: def __init__(self, sampler, embedding, chain_strength=None, flux_biases=None, flux_bias_num_reads=1000, flux_bias_max_age=3600): """Apply the VirtualGraph composite layer to the given solver. Args: sampler (:class:`dwave_micro_client_dimod.DWaveSampler`): A dimod_ sampler. ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VirtualGraph: def __init__(self, sampler, embedding, chain_strength=None, flux_biases=None, flux_bias_num_reads=1000, flux_bias_max_age=3600): """Apply the VirtualGraph composite layer to the given solver. Args: sampler (:class:`dwave_micro_client_dimod.DWaveSampler`): A dimod_ sampler. Normally :clas...
the_stack_v2_python_sparse
artifacts/minimal_bugfixes/dwave-system/dwave-system#16/before/virtual_graph.py
MattePalte/Bugs-Quantum-Computing-Platforms
train
4
9cece4bc21262697605da0124afabe8c1263e14d
[ "for lcl, rmt in cls._to_ref:\n cls._decl_class_registry[lcl]._reference_table(cls._decl_class_registry[rmt].__table__)\ncls._to_ref.clear()", "cols = [(Column(), refcol) for refcol in ref_table.primary_key]\nfor col, refcol in cols:\n setattr(cls, '%s_%s' % (ref_table.name, refcol.name), col)\ncls.__table_...
<|body_start_0|> for lcl, rmt in cls._to_ref: cls._decl_class_registry[lcl]._reference_table(cls._decl_class_registry[rmt].__table__) cls._to_ref.clear() <|end_body_0|> <|body_start_1|> cols = [(Column(), refcol) for refcol in ref_table.primary_key] for col, refcol in cols: ...
A mixin which creates foreign key references to related classes.
References
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class References: """A mixin which creates foreign key references to related classes.""" def __declare_first__(cls): """declarative hook called within the 'before_configure' mapper event.""" <|body_0|> def _reference_table(cls, ref_table): """Create a foreign key refer...
stack_v2_sparse_classes_36k_train_025134
19,400
permissive
[ { "docstring": "declarative hook called within the 'before_configure' mapper event.", "name": "__declare_first__", "signature": "def __declare_first__(cls)" }, { "docstring": "Create a foreign key reference from the local class to the given remote table. Adds column references to the declarative...
2
null
Implement the Python class `References` described below. Class description: A mixin which creates foreign key references to related classes. Method signatures and docstrings: - def __declare_first__(cls): declarative hook called within the 'before_configure' mapper event. - def _reference_table(cls, ref_table): Creat...
Implement the Python class `References` described below. Class description: A mixin which creates foreign key references to related classes. Method signatures and docstrings: - def __declare_first__(cls): declarative hook called within the 'before_configure' mapper event. - def _reference_table(cls, ref_table): Creat...
cdc18ee0c8bab67f049228d28d03578babfafb3d
<|skeleton|> class References: """A mixin which creates foreign key references to related classes.""" def __declare_first__(cls): """declarative hook called within the 'before_configure' mapper event.""" <|body_0|> def _reference_table(cls, ref_table): """Create a foreign key refer...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class References: """A mixin which creates foreign key references to related classes.""" def __declare_first__(cls): """declarative hook called within the 'before_configure' mapper event.""" for lcl, rmt in cls._to_ref: cls._decl_class_registry[lcl]._reference_table(cls._decl_class_...
the_stack_v2_python_sparse
systemcheck/models/meta/schema.py
team-fasel/systemcheck
train
2
bd0f1abfcf830758fb58ba5e12d93d44f79d7085
[ "super(LayerNorm, self).__init__()\nself.a_2 = nn.Parameter(torch.ones(features))\nself.b_2 = nn.Parameter(torch.zeros(features))\nself.eps = eps", "mean = x.mean(-1, keepdim=True)\nstd = x.std(-1, keepdim=True)\nreturn self.a_2 * (x - mean) / (std + self.eps) + self.b_2" ]
<|body_start_0|> super(LayerNorm, self).__init__() self.a_2 = nn.Parameter(torch.ones(features)) self.b_2 = nn.Parameter(torch.zeros(features)) self.eps = eps <|end_body_0|> <|body_start_1|> mean = x.mean(-1, keepdim=True) std = x.std(-1, keepdim=True) return sel...
Layer normalization module.
LayerNorm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LayerNorm: """Layer normalization module.""" def __init__(self, features, eps=1e-06): """:param features: shape of normalized features :param eps: epsilon used for standard deviation""" <|body_0|> def forward(self, x): """Forward pass through the layer normalizat...
stack_v2_sparse_classes_36k_train_025135
21,238
no_license
[ { "docstring": ":param features: shape of normalized features :param eps: epsilon used for standard deviation", "name": "__init__", "signature": "def __init__(self, features, eps=1e-06)" }, { "docstring": "Forward pass through the layer normalization. :param x: input of shape [batch_size, slate_...
2
stack_v2_sparse_classes_30k_train_011993
Implement the Python class `LayerNorm` described below. Class description: Layer normalization module. Method signatures and docstrings: - def __init__(self, features, eps=1e-06): :param features: shape of normalized features :param eps: epsilon used for standard deviation - def forward(self, x): Forward pass through...
Implement the Python class `LayerNorm` described below. Class description: Layer normalization module. Method signatures and docstrings: - def __init__(self, features, eps=1e-06): :param features: shape of normalized features :param eps: epsilon used for standard deviation - def forward(self, x): Forward pass through...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class LayerNorm: """Layer normalization module.""" def __init__(self, features, eps=1e-06): """:param features: shape of normalized features :param eps: epsilon used for standard deviation""" <|body_0|> def forward(self, x): """Forward pass through the layer normalizat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LayerNorm: """Layer normalization module.""" def __init__(self, features, eps=1e-06): """:param features: shape of normalized features :param eps: epsilon used for standard deviation""" super(LayerNorm, self).__init__() self.a_2 = nn.Parameter(torch.ones(features)) self.b_...
the_stack_v2_python_sparse
generated/test_allegro_allRank.py
jansel/pytorch-jit-paritybench
train
35
1eb3edc4948f2d7a8a2f7bf6908311519bb30962
[ "super().__init__()\nself.image_uri_key = image_uri_key\nself.image_good_counter = Metrics.counter(self.__class__, 'image_good')\nself.image_bad_counter = Metrics.counter(self.__class__, 'image_bad')", "d = {}\ntry:\n image_uri = element.pop(self.image_uri_key)\n image = load(image_uri)\n element['image_...
<|body_start_0|> super().__init__() self.image_uri_key = image_uri_key self.image_good_counter = Metrics.counter(self.__class__, 'image_good') self.image_bad_counter = Metrics.counter(self.__class__, 'image_bad') <|end_body_0|> <|body_start_1|> d = {} try: im...
Adds image to PCollection.
ExtractImagesDoFn
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExtractImagesDoFn: """Adds image to PCollection.""" def __init__(self, image_uri_key: str): """Constructor.""" <|body_0|> def process(self, element: Dict[str, Any], *args: Tuple[Any, ...], **kwargs: Dict) -> Generator[Dict[str, Any], None, None]: """Loads image a...
stack_v2_sparse_classes_36k_train_025136
3,408
permissive
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self, image_uri_key: str)" }, { "docstring": "Loads image and creates image features. This DoFn extracts an image being stored on local disk or GCS and yields a base64 encoded image, the image height, image width, and ...
2
stack_v2_sparse_classes_30k_train_011381
Implement the Python class `ExtractImagesDoFn` described below. Class description: Adds image to PCollection. Method signatures and docstrings: - def __init__(self, image_uri_key: str): Constructor. - def process(self, element: Dict[str, Any], *args: Tuple[Any, ...], **kwargs: Dict) -> Generator[Dict[str, Any], None,...
Implement the Python class `ExtractImagesDoFn` described below. Class description: Adds image to PCollection. Method signatures and docstrings: - def __init__(self, image_uri_key: str): Constructor. - def process(self, element: Dict[str, Any], *args: Tuple[Any, ...], **kwargs: Dict) -> Generator[Dict[str, Any], None,...
80f421ef53778ad2dc793d344d079ab4a814687a
<|skeleton|> class ExtractImagesDoFn: """Adds image to PCollection.""" def __init__(self, image_uri_key: str): """Constructor.""" <|body_0|> def process(self, element: Dict[str, Any], *args: Tuple[Any, ...], **kwargs: Dict) -> Generator[Dict[str, Any], None, None]: """Loads image a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExtractImagesDoFn: """Adds image to PCollection.""" def __init__(self, image_uri_key: str): """Constructor.""" super().__init__() self.image_uri_key = image_uri_key self.image_good_counter = Metrics.counter(self.__class__, 'image_good') self.image_bad_counter = Met...
the_stack_v2_python_sparse
tfrecorder/beam_image.py
jared-burns/tensorflow-recorder
train
0
311b4c55f3f2c3d0fbc1a9d7913350227fabc42a
[ "prog = sf.TDMProgram(2)\neng = sf.Engine('gaussian')\nwith prog.context([1, 2], [3, 4]) as (p, q):\n ops.Sgate(p[0]) | q[0]\n ops.MeasureHomodyne(p[1]) | q[0]\nresults = eng.run(prog)\nassert results.samples.shape[0] == 1", "prog = sf.TDMProgram(2)\neng = sf.Engine('gaussian')\nwith prog.context([1, 2], [3...
<|body_start_0|> prog = sf.TDMProgram(2) eng = sf.Engine('gaussian') with prog.context([1, 2], [3, 4]) as (p, q): ops.Sgate(p[0]) | q[0] ops.MeasureHomodyne(p[1]) | q[0] results = eng.run(prog) assert results.samples.shape[0] == 1 <|end_body_0|> <|body_st...
Test the Engine class and its interaction with TDMProgram instances.
TestEngineTDMProgramInteraction
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestEngineTDMProgramInteraction: """Test the Engine class and its interaction with TDMProgram instances.""" def test_shots_default(self): """Test that default shots (1) is used""" <|body_0|> def test_shots_run_options(self): """Test that run_options takes precede...
stack_v2_sparse_classes_36k_train_025137
29,620
permissive
[ { "docstring": "Test that default shots (1) is used", "name": "test_shots_default", "signature": "def test_shots_default(self)" }, { "docstring": "Test that run_options takes precedence over default", "name": "test_shots_run_options", "signature": "def test_shots_run_options(self)" }, ...
3
stack_v2_sparse_classes_30k_train_018361
Implement the Python class `TestEngineTDMProgramInteraction` described below. Class description: Test the Engine class and its interaction with TDMProgram instances. Method signatures and docstrings: - def test_shots_default(self): Test that default shots (1) is used - def test_shots_run_options(self): Test that run_...
Implement the Python class `TestEngineTDMProgramInteraction` described below. Class description: Test the Engine class and its interaction with TDMProgram instances. Method signatures and docstrings: - def test_shots_default(self): Test that default shots (1) is used - def test_shots_run_options(self): Test that run_...
0c1c805fd5dfce465a8955ee3faf81037023a23e
<|skeleton|> class TestEngineTDMProgramInteraction: """Test the Engine class and its interaction with TDMProgram instances.""" def test_shots_default(self): """Test that default shots (1) is used""" <|body_0|> def test_shots_run_options(self): """Test that run_options takes precede...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestEngineTDMProgramInteraction: """Test the Engine class and its interaction with TDMProgram instances.""" def test_shots_default(self): """Test that default shots (1) is used""" prog = sf.TDMProgram(2) eng = sf.Engine('gaussian') with prog.context([1, 2], [3, 4]) as (p, ...
the_stack_v2_python_sparse
artifacts/old_dataset_versions/original_commits/strawberryfields/strawberryfields#611/before/test_tdmprogram.py
MattePalte/Bugs-Quantum-Computing-Platforms
train
4
592fa985d3be9e61737e78892a28d3124a1c4974
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn WindowsHelloForBusinessAuthenticationMethod()", "from .authentication_method import AuthenticationMethod\nfrom .authentication_method_key_strength import AuthenticationMethodKeyStrength\nfrom .device import Device\nfrom .authentication...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return WindowsHelloForBusinessAuthenticationMethod() <|end_body_0|> <|body_start_1|> from .authentication_method import AuthenticationMethod from .authentication_method_key_strength import Auth...
WindowsHelloForBusinessAuthenticationMethod
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WindowsHelloForBusinessAuthenticationMethod: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsHelloForBusinessAuthenticationMethod: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use t...
stack_v2_sparse_classes_36k_train_025138
3,929
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: WindowsHelloForBusinessAuthenticationMethod", "name": "create_from_discriminator_value", "signature": "def c...
3
null
Implement the Python class `WindowsHelloForBusinessAuthenticationMethod` described below. Class description: Implement the WindowsHelloForBusinessAuthenticationMethod class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsHelloForBusinessAuthenti...
Implement the Python class `WindowsHelloForBusinessAuthenticationMethod` described below. Class description: Implement the WindowsHelloForBusinessAuthenticationMethod class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsHelloForBusinessAuthenti...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class WindowsHelloForBusinessAuthenticationMethod: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsHelloForBusinessAuthenticationMethod: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WindowsHelloForBusinessAuthenticationMethod: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsHelloForBusinessAuthenticationMethod: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the dis...
the_stack_v2_python_sparse
msgraph/generated/models/windows_hello_for_business_authentication_method.py
microsoftgraph/msgraph-sdk-python
train
135
6a49f704aa0351a21a848b0fc40c7b451f35bdbd
[ "validated_data['bundle_name'] = validated_data.pop('name')\nvalidated_data['bundle_note'] = validated_data.pop('note')\nreturn Bundle.UploadNew(**validated_data)", "project_name = validated_data.pop('project_name')\nbundle_name = instance.name\ndata = {'dst_bundle_name': validated_data.pop('new_name', None), 'no...
<|body_start_0|> validated_data['bundle_name'] = validated_data.pop('name') validated_data['bundle_note'] = validated_data.pop('note') return Bundle.UploadNew(**validated_data) <|end_body_0|> <|body_start_1|> project_name = validated_data.pop('project_name') bundle_name = instan...
Serialize or deserialize Bundle objects.
BundleSerializer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BundleSerializer: """Serialize or deserialize Bundle objects.""" def create(self, validated_data): """Override parent's method.""" <|body_0|> def update(self, instance, validated_data): """Override parent's method.""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_025139
6,625
permissive
[ { "docstring": "Override parent's method.", "name": "create", "signature": "def create(self, validated_data)" }, { "docstring": "Override parent's method.", "name": "update", "signature": "def update(self, instance, validated_data)" } ]
2
stack_v2_sparse_classes_30k_train_008274
Implement the Python class `BundleSerializer` described below. Class description: Serialize or deserialize Bundle objects. Method signatures and docstrings: - def create(self, validated_data): Override parent's method. - def update(self, instance, validated_data): Override parent's method.
Implement the Python class `BundleSerializer` described below. Class description: Serialize or deserialize Bundle objects. Method signatures and docstrings: - def create(self, validated_data): Override parent's method. - def update(self, instance, validated_data): Override parent's method. <|skeleton|> class BundleS...
a1b0fccd68987d8cd9c89710adc3c04b868347ec
<|skeleton|> class BundleSerializer: """Serialize or deserialize Bundle objects.""" def create(self, validated_data): """Override parent's method.""" <|body_0|> def update(self, instance, validated_data): """Override parent's method.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BundleSerializer: """Serialize or deserialize Bundle objects.""" def create(self, validated_data): """Override parent's method.""" validated_data['bundle_name'] = validated_data.pop('name') validated_data['bundle_note'] = validated_data.pop('note') return Bundle.UploadNew(...
the_stack_v2_python_sparse
py/dome/backend/serializers.py
bridder/factory
train
0
361814879fbd1019509550d74cd6f07ac4827d05
[ "citations.sort()\nN = len(citations)\nlow, high = (0, N - 1)\nwhile low <= high:\n mid = (low + high) // 2\n if N - mid > citations[mid]:\n low = mid + 1\n else:\n high = mid - 1\nreturn N - low", "citations.sort()\nprint(citations)\nn = len(citations)\nfor i in range(n):\n length = n -...
<|body_start_0|> citations.sort() N = len(citations) low, high = (0, N - 1) while low <= high: mid = (low + high) // 2 if N - mid > citations[mid]: low = mid + 1 else: high = mid - 1 return N - low <|end_body_0|>...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def hIndex(self, citations): """二分查找 :type citations: List[int] :rtype: int""" <|body_0|> def hIndex2(self, citations): """:type citations: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> citations.sort() N = ...
stack_v2_sparse_classes_36k_train_025140
1,636
no_license
[ { "docstring": "二分查找 :type citations: List[int] :rtype: int", "name": "hIndex", "signature": "def hIndex(self, citations)" }, { "docstring": ":type citations: List[int] :rtype: int", "name": "hIndex2", "signature": "def hIndex2(self, citations)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hIndex(self, citations): 二分查找 :type citations: List[int] :rtype: int - def hIndex2(self, citations): :type citations: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hIndex(self, citations): 二分查找 :type citations: List[int] :rtype: int - def hIndex2(self, citations): :type citations: List[int] :rtype: int <|skeleton|> class Solution: ...
5d3574ccd282d0146c83c286ae28d8baaabd4910
<|skeleton|> class Solution: def hIndex(self, citations): """二分查找 :type citations: List[int] :rtype: int""" <|body_0|> def hIndex2(self, citations): """:type citations: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def hIndex(self, citations): """二分查找 :type citations: List[int] :rtype: int""" citations.sort() N = len(citations) low, high = (0, N - 1) while low <= high: mid = (low + high) // 2 if N - mid > citations[mid]: low = mid ...
the_stack_v2_python_sparse
274_H指数.py
lovehhf/LeetCode
train
0
f43517cbdb4cb79b1f6241414780018e198a6e3f
[ "self.students = []\nself.grades = {}\nself.is_sorted = True", "if student in self.students:\n raise ValueError('Duplicate student')\nself.students.append(student)\nself.grades[student.get_id_num()] = []\nself.is_sorted = False", "try:\n self.grades[student.get_id_num()].append(grade)\nexcept KeyError:\n ...
<|body_start_0|> self.students = [] self.grades = {} self.is_sorted = True <|end_body_0|> <|body_start_1|> if student in self.students: raise ValueError('Duplicate student') self.students.append(student) self.grades[student.get_id_num()] = [] self.is_...
A mapping from students to a list of grades
Grades
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Grades: """A mapping from students to a list of grades""" def __init__(self): """Create empty grade book""" <|body_0|> def add_student(self, student): """Assume: student is if type Student add student to the grade book""" <|body_1|> def add_grade(sel...
stack_v2_sparse_classes_36k_train_025141
2,494
no_license
[ { "docstring": "Create empty grade book", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Assume: student is if type Student add student to the grade book", "name": "add_student", "signature": "def add_student(self, student)" }, { "docstring": "Assume gra...
5
stack_v2_sparse_classes_30k_train_018038
Implement the Python class `Grades` described below. Class description: A mapping from students to a list of grades Method signatures and docstrings: - def __init__(self): Create empty grade book - def add_student(self, student): Assume: student is if type Student add student to the grade book - def add_grade(self, s...
Implement the Python class `Grades` described below. Class description: A mapping from students to a list of grades Method signatures and docstrings: - def __init__(self): Create empty grade book - def add_student(self, student): Assume: student is if type Student add student to the grade book - def add_grade(self, s...
cae706564efdc41e435b309493484ea9348c908d
<|skeleton|> class Grades: """A mapping from students to a list of grades""" def __init__(self): """Create empty grade book""" <|body_0|> def add_student(self, student): """Assume: student is if type Student add student to the grade book""" <|body_1|> def add_grade(sel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Grades: """A mapping from students to a list of grades""" def __init__(self): """Create empty grade book""" self.students = [] self.grades = {} self.is_sorted = True def add_student(self, student): """Assume: student is if type Student add student to the grade...
the_stack_v2_python_sparse
Week_05/OOP_Part_02/class_grade_book.py
xeusteerapat/MIT-6.00.1x-EDX
train
0
cb6f3da2f7cb83f8ab52ee54c9479923a60a8bb7
[ "dic = {*wordDict}\nn = len(s)\ndp = [0] * (n + 1)\ndp[0] = 1\nfor i in range(1, n + 1):\n for j in wordDict:\n if s[i - len(j):i] in dic and dp[i - len(j)] == 1:\n dp[i] = 1\n break\nreturn True if dp[-1] == 1 else False", "@lru_cache()\ndef dfs(l):\n if l == len(s):\n s...
<|body_start_0|> dic = {*wordDict} n = len(s) dp = [0] * (n + 1) dp[0] = 1 for i in range(1, n + 1): for j in wordDict: if s[i - len(j):i] in dic and dp[i - len(j)] == 1: dp[i] = 1 break return True if dp...
题意:判断给定的s能否由wordDict中的word连起来,word可以使用多次
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """题意:判断给定的s能否由wordDict中的word连起来,word可以使用多次""" def wordBreak1(self, s: str, wordDict: List[str]) -> bool: """思路:动态规划法 1. 判断s中每个位置前面是否有""" <|body_0|> def wordBreak2(self, s: str, wordDict: List[str]) -> bool: """思路:dfs 1. 用字符串s去wordDict中匹配,匹配到就从s剩下的字符串中匹...
stack_v2_sparse_classes_36k_train_025142
2,350
no_license
[ { "docstring": "思路:动态规划法 1. 判断s中每个位置前面是否有", "name": "wordBreak1", "signature": "def wordBreak1(self, s: str, wordDict: List[str]) -> bool" }, { "docstring": "思路:dfs 1. 用字符串s去wordDict中匹配,匹配到就从s剩下的字符串中匹配wordDict,直到正好匹配完s 2.", "name": "wordBreak2", "signature": "def wordBreak2(self, s: str,...
2
stack_v2_sparse_classes_30k_train_013703
Implement the Python class `Solution` described below. Class description: 题意:判断给定的s能否由wordDict中的word连起来,word可以使用多次 Method signatures and docstrings: - def wordBreak1(self, s: str, wordDict: List[str]) -> bool: 思路:动态规划法 1. 判断s中每个位置前面是否有 - def wordBreak2(self, s: str, wordDict: List[str]) -> bool: 思路:dfs 1. 用字符串s去wordD...
Implement the Python class `Solution` described below. Class description: 题意:判断给定的s能否由wordDict中的word连起来,word可以使用多次 Method signatures and docstrings: - def wordBreak1(self, s: str, wordDict: List[str]) -> bool: 思路:动态规划法 1. 判断s中每个位置前面是否有 - def wordBreak2(self, s: str, wordDict: List[str]) -> bool: 思路:dfs 1. 用字符串s去wordD...
e43ee86c5a8cdb808da09b4b6138e10275abadb5
<|skeleton|> class Solution: """题意:判断给定的s能否由wordDict中的word连起来,word可以使用多次""" def wordBreak1(self, s: str, wordDict: List[str]) -> bool: """思路:动态规划法 1. 判断s中每个位置前面是否有""" <|body_0|> def wordBreak2(self, s: str, wordDict: List[str]) -> bool: """思路:dfs 1. 用字符串s去wordDict中匹配,匹配到就从s剩下的字符串中匹...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """题意:判断给定的s能否由wordDict中的word连起来,word可以使用多次""" def wordBreak1(self, s: str, wordDict: List[str]) -> bool: """思路:动态规划法 1. 判断s中每个位置前面是否有""" dic = {*wordDict} n = len(s) dp = [0] * (n + 1) dp[0] = 1 for i in range(1, n + 1): for j in word...
the_stack_v2_python_sparse
LeetCode/动态规划法(dp)/139. 单词拆分.py
yiming1012/MyLeetCode
train
2
3f0852cff7c49d86edf3535a79447785075f4ccb
[ "if not root:\n return -1\nret = 1 + max((self.find_leaves_helper(child, results) for child in (root.left, root.right)))\nif ret >= len(results):\n results.append([])\nresults[ret].append(root.val)\nreturn ret", "ret = []\nself.find_leaves_helper(root, ret)\nreturn ret" ]
<|body_start_0|> if not root: return -1 ret = 1 + max((self.find_leaves_helper(child, results) for child in (root.left, root.right))) if ret >= len(results): results.append([]) results[ret].append(root.val) return ret <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def find_leaves_helper(self, root, results): """push root and all descendants to results return the distance from root to farthest leaf""" <|body_0|> def find_leaves(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_1|> <|end_s...
stack_v2_sparse_classes_36k_train_025143
1,688
no_license
[ { "docstring": "push root and all descendants to results return the distance from root to farthest leaf", "name": "find_leaves_helper", "signature": "def find_leaves_helper(self, root, results)" }, { "docstring": ":type root: TreeNode :rtype: List[List[int]]", "name": "find_leaves", "sig...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def find_leaves_helper(self, root, results): push root and all descendants to results return the distance from root to farthest leaf - def find_leaves(self, root): :type root: Tr...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def find_leaves_helper(self, root, results): push root and all descendants to results return the distance from root to farthest leaf - def find_leaves(self, root): :type root: Tr...
e3637e293c5e4e8b4e5cc2e24dcd638ef796c560
<|skeleton|> class Solution: def find_leaves_helper(self, root, results): """push root and all descendants to results return the distance from root to farthest leaf""" <|body_0|> def find_leaves(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_1|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def find_leaves_helper(self, root, results): """push root and all descendants to results return the distance from root to farthest leaf""" if not root: return -1 ret = 1 + max((self.find_leaves_helper(child, results) for child in (root.left, root.right))) ...
the_stack_v2_python_sparse
tree/findLeavesOfBinaryTree.py
ay701/Coding_Challenges
train
1
69891e9fdce4619a4a9b093225cf7c8fd9c063a5
[ "self.producers = producers\nself.consumer = consumer\nself.is_unary = is_unary", "values = tuple([f(row) for f in self.producers])\nif self.is_unary:\n return self.consumer(values)\nelse:\n return self.consumer(*values)" ]
<|body_start_0|> self.producers = producers self.consumer = consumer self.is_unary = is_unary <|end_body_0|> <|body_start_1|> values = tuple([f(row) for f in self.producers]) if self.is_unary: return self.consumer(values) else: return self.consume...
A ternary stream function extracts values using multiple producers and passes them to a single consumer. The consumer may either be a unary or a ternary function. An unary function will receive a tuple of extracted values as the argument.
TernaryStreamFunction
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TernaryStreamFunction: """A ternary stream function extracts values using multiple producers and passes them to a single consumer. The consumer may either be a unary or a ternary function. An unary function will receive a tuple of extracted values as the argument.""" def __init__(self, produ...
stack_v2_sparse_classes_36k_train_025144
44,356
permissive
[ { "docstring": "Initialize the list of producers and the consumer for values that are extracted (by the producers) from data stream rows. Parameters ---------- producers: list of openclean.data.stream.base.StreamFunction List of stream functions that are used to extract values from data stream rows. consumer: c...
2
stack_v2_sparse_classes_30k_train_004188
Implement the Python class `TernaryStreamFunction` described below. Class description: A ternary stream function extracts values using multiple producers and passes them to a single consumer. The consumer may either be a unary or a ternary function. An unary function will receive a tuple of extracted values as the arg...
Implement the Python class `TernaryStreamFunction` described below. Class description: A ternary stream function extracts values using multiple producers and passes them to a single consumer. The consumer may either be a unary or a ternary function. An unary function will receive a tuple of extracted values as the arg...
e3d0e04f90468c49f29ca53edc2feb12465c24d5
<|skeleton|> class TernaryStreamFunction: """A ternary stream function extracts values using multiple producers and passes them to a single consumer. The consumer may either be a unary or a ternary function. An unary function will receive a tuple of extracted values as the argument.""" def __init__(self, produ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TernaryStreamFunction: """A ternary stream function extracts values using multiple producers and passes them to a single consumer. The consumer may either be a unary or a ternary function. An unary function will receive a tuple of extracted values as the argument.""" def __init__(self, producers: StreamF...
the_stack_v2_python_sparse
openclean/function/eval/base.py
Denisfench/openclean-core
train
0
532e4a663a1d4e7801ae2baa8487f45bc07173f9
[ "self._params = Parameters()\nfor path, param in network.get_variables().items():\n self._params.add(path + '_mean_sqr_gradient', numpy.zeros_like(param.get_value()))\n self._params.add(path + '_mean_sqr_delta', numpy.zeros_like(param.get_value()))\nif 'gradient_decay_rate' not in optimization_options:\n r...
<|body_start_0|> self._params = Parameters() for path, param in network.get_variables().items(): self._params.add(path + '_mean_sqr_gradient', numpy.zeros_like(param.get_value())) self._params.add(path + '_mean_sqr_delta', numpy.zeros_like(param.get_value())) if 'gradient...
ADADELTA Optimization Method ADADELTA optimization method has been derived from AdaGrad. AdaGrad accumulates the sum of squared gradients over all time, which is used to scale the learning rate smaller and smaller. ADADELTA uses an exponentially decaying average of the squared gradients. This implementation scales the ...
AdadeltaOptimizer
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdadeltaOptimizer: """ADADELTA Optimization Method ADADELTA optimization method has been derived from AdaGrad. AdaGrad accumulates the sum of squared gradients over all time, which is used to scale the learning rate smaller and smaller. ADADELTA uses an exponentially decaying average of the squar...
stack_v2_sparse_classes_36k_train_025145
3,644
permissive
[ { "docstring": "Creates an Adadelta optimizer. :type optimization_options: dict :param optimization_options: a dictionary of optimization options :type network: Network :param network: the neural network object", "name": "__init__", "signature": "def __init__(self, optimization_options, network, *args, ...
2
stack_v2_sparse_classes_30k_train_001435
Implement the Python class `AdadeltaOptimizer` described below. Class description: ADADELTA Optimization Method ADADELTA optimization method has been derived from AdaGrad. AdaGrad accumulates the sum of squared gradients over all time, which is used to scale the learning rate smaller and smaller. ADADELTA uses an expo...
Implement the Python class `AdadeltaOptimizer` described below. Class description: ADADELTA Optimization Method ADADELTA optimization method has been derived from AdaGrad. AdaGrad accumulates the sum of squared gradients over all time, which is used to scale the learning rate smaller and smaller. ADADELTA uses an expo...
9904faec19ad5718470f21927229aad2656e5686
<|skeleton|> class AdadeltaOptimizer: """ADADELTA Optimization Method ADADELTA optimization method has been derived from AdaGrad. AdaGrad accumulates the sum of squared gradients over all time, which is used to scale the learning rate smaller and smaller. ADADELTA uses an exponentially decaying average of the squar...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdadeltaOptimizer: """ADADELTA Optimization Method ADADELTA optimization method has been derived from AdaGrad. AdaGrad accumulates the sum of squared gradients over all time, which is used to scale the learning rate smaller and smaller. ADADELTA uses an exponentially decaying average of the squared gradients....
the_stack_v2_python_sparse
theanolm/training/adadeltaoptimizer.py
senarvi/theanolm
train
95
bf8c6a7dc4b51b2c4bf86d0078c45a3de872197f
[ "found = 1\nstep = 2\nwhile step <= number:\n found *= step\n step += 1\nreturn found", "trimmed = re.compile('[^a-zA-Z0-9 ]').sub('', sentence)\nchunks = trimmed.split(' ')\nlongest = 0\nindex = -1\nfor i, x in enumerate(chunks):\n if len(x) > longest:\n longest = len(x)\n index = i\nretur...
<|body_start_0|> found = 1 step = 2 while step <= number: found *= step step += 1 return found <|end_body_0|> <|body_start_1|> trimmed = re.compile('[^a-zA-Z0-9 ]').sub('', sentence) chunks = trimmed.split(' ') longest = 0 index = ...
Challenges
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Challenges: def first_factorial(number: int) -> int: """Iterative approach :param number: an input, first factorial of a number :return: factorial""" <|body_0|> def longest_word(sentence: str) -> str: """Detect longest word in a sentence :param sentence: :return:""" ...
stack_v2_sparse_classes_36k_train_025146
1,505
permissive
[ { "docstring": "Iterative approach :param number: an input, first factorial of a number :return: factorial", "name": "first_factorial", "signature": "def first_factorial(number: int) -> int" }, { "docstring": "Detect longest word in a sentence :param sentence: :return:", "name": "longest_wor...
3
stack_v2_sparse_classes_30k_train_005035
Implement the Python class `Challenges` described below. Class description: Implement the Challenges class. Method signatures and docstrings: - def first_factorial(number: int) -> int: Iterative approach :param number: an input, first factorial of a number :return: factorial - def longest_word(sentence: str) -> str: ...
Implement the Python class `Challenges` described below. Class description: Implement the Challenges class. Method signatures and docstrings: - def first_factorial(number: int) -> int: Iterative approach :param number: an input, first factorial of a number :return: factorial - def longest_word(sentence: str) -> str: ...
ce7cf332483e01d05bcad98921d736c33a33a66c
<|skeleton|> class Challenges: def first_factorial(number: int) -> int: """Iterative approach :param number: an input, first factorial of a number :return: factorial""" <|body_0|> def longest_word(sentence: str) -> str: """Detect longest word in a sentence :param sentence: :return:""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Challenges: def first_factorial(number: int) -> int: """Iterative approach :param number: an input, first factorial of a number :return: factorial""" found = 1 step = 2 while step <= number: found *= step step += 1 return found def longest_w...
the_stack_v2_python_sparse
py_algorithms/challenges/challenges.py
ktp-forked-repos/py-algorithms
train
0
fa6bde2bb36b271c4a327f81a9459bf91fe8cf38
[ "super().__init__()\nself.vote_factor = vote_factor\nself.in_dim = seed_feature_dim\nself.out_dim = self.in_dim\nself.conv1 = torch.nn.Conv1d(self.in_dim, self.in_dim, 1)\nself.conv2 = torch.nn.Conv1d(self.in_dim, self.in_dim, 1)\nself.conv3 = torch.nn.Conv1d(self.in_dim, (3 + self.out_dim) * self.vote_factor, 1)\n...
<|body_start_0|> super().__init__() self.vote_factor = vote_factor self.in_dim = seed_feature_dim self.out_dim = self.in_dim self.conv1 = torch.nn.Conv1d(self.in_dim, self.in_dim, 1) self.conv2 = torch.nn.Conv1d(self.in_dim, self.in_dim, 1) self.conv3 = torch.nn.C...
VotingModule
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VotingModule: def __init__(self, vote_factor, seed_feature_dim): """Votes generation from seed point features. Args: vote_facotr: int number of votes generated from each seed point seed_feature_dim: int number of channels of seed point features vote_feature_dim: int number of channels of...
stack_v2_sparse_classes_36k_train_025147
40,928
no_license
[ { "docstring": "Votes generation from seed point features. Args: vote_facotr: int number of votes generated from each seed point seed_feature_dim: int number of channels of seed point features vote_feature_dim: int number of channels of vote features", "name": "__init__", "signature": "def __init__(self...
2
stack_v2_sparse_classes_30k_test_000724
Implement the Python class `VotingModule` described below. Class description: Implement the VotingModule class. Method signatures and docstrings: - def __init__(self, vote_factor, seed_feature_dim): Votes generation from seed point features. Args: vote_facotr: int number of votes generated from each seed point seed_f...
Implement the Python class `VotingModule` described below. Class description: Implement the VotingModule class. Method signatures and docstrings: - def __init__(self, vote_factor, seed_feature_dim): Votes generation from seed point features. Args: vote_facotr: int number of votes generated from each seed point seed_f...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class VotingModule: def __init__(self, vote_factor, seed_feature_dim): """Votes generation from seed point features. Args: vote_facotr: int number of votes generated from each seed point seed_feature_dim: int number of channels of seed point features vote_feature_dim: int number of channels of...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VotingModule: def __init__(self, vote_factor, seed_feature_dim): """Votes generation from seed point features. Args: vote_facotr: int number of votes generated from each seed point seed_feature_dim: int number of channels of seed point features vote_feature_dim: int number of channels of vote features...
the_stack_v2_python_sparse
generated/test_Na_Z_sess.py
jansel/pytorch-jit-paritybench
train
35
da196a044126e5086f8feff65e92ad55d98f9f55
[ "result = []\nif not root:\n return result\nqueue = [root]\nwhile queue:\n levelNum = len(queue)\n temp = []\n for i in range(levelNum):\n cur = queue[0]\n temp.append(cur.val)\n if cur.left:\n queue.append(cur.left)\n if cur.right:\n queue.append(cur.ri...
<|body_start_0|> result = [] if not root: return result queue = [root] while queue: levelNum = len(queue) temp = [] for i in range(levelNum): cur = queue[0] temp.append(cur.val) if cur.left: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rightSideView(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_0|> def rightSideView_self(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> result = [] if not...
stack_v2_sparse_classes_36k_train_025148
1,417
no_license
[ { "docstring": ":type root: TreeNode :rtype: List[int]", "name": "rightSideView", "signature": "def rightSideView(self, root)" }, { "docstring": ":type root: TreeNode :rtype: List[int]", "name": "rightSideView_self", "signature": "def rightSideView_self(self, root)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rightSideView(self, root): :type root: TreeNode :rtype: List[int] - def rightSideView_self(self, root): :type root: TreeNode :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rightSideView(self, root): :type root: TreeNode :rtype: List[int] - def rightSideView_self(self, root): :type root: TreeNode :rtype: List[int] <|skeleton|> class Solution: ...
ea492ec864b50547214ecbbb2cdeeac21e70229b
<|skeleton|> class Solution: def rightSideView(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_0|> def rightSideView_self(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rightSideView(self, root): """:type root: TreeNode :rtype: List[int]""" result = [] if not root: return result queue = [root] while queue: levelNum = len(queue) temp = [] for i in range(levelNum): ...
the_stack_v2_python_sparse
199_binary_tree_right_side_view/sol.py
lianke123321/leetcode_sol
train
0
787a1b61ae0bc890ca0772ea5aed183e4cbe89aa
[ "self.folder = folder\nself.is_latin_required = is_latin_required\nif root:\n self.folder = os.path.join(root, self.folder)\nassert os.path.exists(os.path.join(self.folder, 'ImagesPart1'))\nassert os.path.exists(os.path.join(self.folder, 'ImagesPart2'))\nassert os.path.exists(os.path.join(self.folder, 'train_gt_...
<|body_start_0|> self.folder = folder self.is_latin_required = is_latin_required if root: self.folder = os.path.join(root, self.folder) assert os.path.exists(os.path.join(self.folder, 'ImagesPart1')) assert os.path.exists(os.path.join(self.folder, 'ImagesPart2')) ...
Class for conversion of ICDAR2019 to TextOnlyCocoAnnotation.
ICDAR2019MLTDatasetConverter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ICDAR2019MLTDatasetConverter: """Class for conversion of ICDAR2019 to TextOnlyCocoAnnotation.""" def __init__(self, folder, is_latin_required, root=''): """Converts ICDAR2017 MLT to TextOnlyCocoAnnotation :param folder: Folder with extracted zip archives containing images and annotat...
stack_v2_sparse_classes_36k_train_025149
25,441
permissive
[ { "docstring": "Converts ICDAR2017 MLT to TextOnlyCocoAnnotation :param folder: Folder with extracted zip archives containing images and annotation. :param is_latin_required: if it is True than images that do not contain latin text will be filtered out.", "name": "__init__", "signature": "def __init__(s...
4
null
Implement the Python class `ICDAR2019MLTDatasetConverter` described below. Class description: Class for conversion of ICDAR2019 to TextOnlyCocoAnnotation. Method signatures and docstrings: - def __init__(self, folder, is_latin_required, root=''): Converts ICDAR2017 MLT to TextOnlyCocoAnnotation :param folder: Folder ...
Implement the Python class `ICDAR2019MLTDatasetConverter` described below. Class description: Class for conversion of ICDAR2019 to TextOnlyCocoAnnotation. Method signatures and docstrings: - def __init__(self, folder, is_latin_required, root=''): Converts ICDAR2017 MLT to TextOnlyCocoAnnotation :param folder: Folder ...
c553a56088f0055baba838b68c9299e19683227e
<|skeleton|> class ICDAR2019MLTDatasetConverter: """Class for conversion of ICDAR2019 to TextOnlyCocoAnnotation.""" def __init__(self, folder, is_latin_required, root=''): """Converts ICDAR2017 MLT to TextOnlyCocoAnnotation :param folder: Folder with extracted zip archives containing images and annotat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ICDAR2019MLTDatasetConverter: """Class for conversion of ICDAR2019 to TextOnlyCocoAnnotation.""" def __init__(self, folder, is_latin_required, root=''): """Converts ICDAR2017 MLT to TextOnlyCocoAnnotation :param folder: Folder with extracted zip archives containing images and annotation. :param i...
the_stack_v2_python_sparse
pytorch_toolkit/text_spotting/text_spotting/datasets/datasets.py
DmitriySidnev/openvino_training_extensions
train
0
df4ea4d2c92528ca2a3c8af7c4ac627e5d563437
[ "if n == 0:\n return 1\nif x == 0:\n if n > 0:\n return 0\n else:\n return inf\nres = 1\nflag = 1\nif n < 0:\n flag = -1\n n = abs(n)\nfor i in range(n):\n res *= x\nreturn res if flag == 1 else 1 / res", "if n == 0:\n return 1\nif x == 0:\n if n > 0:\n return 0\n e...
<|body_start_0|> if n == 0: return 1 if x == 0: if n > 0: return 0 else: return inf res = 1 flag = 1 if n < 0: flag = -1 n = abs(n) for i in range(n): res *= x ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def myPow1(self, x: float, n: int) -> float: """思路:迭代 时间复杂度:O(N)""" <|body_0|> def myPow2(self, x: float, n: int) -> float: """执行用时 :28 ms, 在所有 Python3 提交中击败了94.37%的用户 内存消耗 :13.7 MB, 在所有 Python3 提交中击败了5.05%的用户 思路:快速幂 1、首先,任何数的0次幂都是 2、负数的n次幂,为这个数绝对值的n次幂的倒数 3...
stack_v2_sparse_classes_36k_train_025150
2,333
no_license
[ { "docstring": "思路:迭代 时间复杂度:O(N)", "name": "myPow1", "signature": "def myPow1(self, x: float, n: int) -> float" }, { "docstring": "执行用时 :28 ms, 在所有 Python3 提交中击败了94.37%的用户 内存消耗 :13.7 MB, 在所有 Python3 提交中击败了5.05%的用户 思路:快速幂 1、首先,任何数的0次幂都是 2、负数的n次幂,为这个数绝对值的n次幂的倒数 3、将n转化为2进制,如10对应的二进制为:1010,即n=1*(2**...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def myPow1(self, x: float, n: int) -> float: 思路:迭代 时间复杂度:O(N) - def myPow2(self, x: float, n: int) -> float: 执行用时 :28 ms, 在所有 Python3 提交中击败了94.37%的用户 内存消耗 :13.7 MB, 在所有 Python3 提...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def myPow1(self, x: float, n: int) -> float: 思路:迭代 时间复杂度:O(N) - def myPow2(self, x: float, n: int) -> float: 执行用时 :28 ms, 在所有 Python3 提交中击败了94.37%的用户 内存消耗 :13.7 MB, 在所有 Python3 提...
e43ee86c5a8cdb808da09b4b6138e10275abadb5
<|skeleton|> class Solution: def myPow1(self, x: float, n: int) -> float: """思路:迭代 时间复杂度:O(N)""" <|body_0|> def myPow2(self, x: float, n: int) -> float: """执行用时 :28 ms, 在所有 Python3 提交中击败了94.37%的用户 内存消耗 :13.7 MB, 在所有 Python3 提交中击败了5.05%的用户 思路:快速幂 1、首先,任何数的0次幂都是 2、负数的n次幂,为这个数绝对值的n次幂的倒数 3...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def myPow1(self, x: float, n: int) -> float: """思路:迭代 时间复杂度:O(N)""" if n == 0: return 1 if x == 0: if n > 0: return 0 else: return inf res = 1 flag = 1 if n < 0: flag = -1 ...
the_stack_v2_python_sparse
LeetCode/快速幂/50. Pow(x, n).py
yiming1012/MyLeetCode
train
2
a67028db1ac6093b14f47bcdae8bfaf5e41bcc51
[ "sets = collections()\nboss = Char(104, 8, 1)\nreturn part1(sets, boss)", "sets = collections()\nboss = Char(104, 8, 1)\nreturn part2(sets, boss)" ]
<|body_start_0|> sets = collections() boss = Char(104, 8, 1) return part1(sets, boss) <|end_body_0|> <|body_start_1|> sets = collections() boss = Char(104, 8, 1) return part2(sets, boss) <|end_body_1|>
AoC 2015 Day 21
Day21
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Day21: """AoC 2015 Day 21""" def part1(_filename: str) -> int: """Given a filename, solve 2015 day 21 part 1""" <|body_0|> def part2(_filename: str) -> int: """Given a filename, solve 2015 day 21 part 2""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_025151
3,590
no_license
[ { "docstring": "Given a filename, solve 2015 day 21 part 1", "name": "part1", "signature": "def part1(_filename: str) -> int" }, { "docstring": "Given a filename, solve 2015 day 21 part 2", "name": "part2", "signature": "def part2(_filename: str) -> int" } ]
2
stack_v2_sparse_classes_30k_train_015538
Implement the Python class `Day21` described below. Class description: AoC 2015 Day 21 Method signatures and docstrings: - def part1(_filename: str) -> int: Given a filename, solve 2015 day 21 part 1 - def part2(_filename: str) -> int: Given a filename, solve 2015 day 21 part 2
Implement the Python class `Day21` described below. Class description: AoC 2015 Day 21 Method signatures and docstrings: - def part1(_filename: str) -> int: Given a filename, solve 2015 day 21 part 1 - def part2(_filename: str) -> int: Given a filename, solve 2015 day 21 part 2 <|skeleton|> class Day21: """AoC 2...
e89db235837d2d05848210a18c9c2a4456085570
<|skeleton|> class Day21: """AoC 2015 Day 21""" def part1(_filename: str) -> int: """Given a filename, solve 2015 day 21 part 1""" <|body_0|> def part2(_filename: str) -> int: """Given a filename, solve 2015 day 21 part 2""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Day21: """AoC 2015 Day 21""" def part1(_filename: str) -> int: """Given a filename, solve 2015 day 21 part 1""" sets = collections() boss = Char(104, 8, 1) return part1(sets, boss) def part2(_filename: str) -> int: """Given a filename, solve 2015 day 21 part 2...
the_stack_v2_python_sparse
2015/python2015/aoc/day21.py
mreishus/aoc
train
16
1b7575a64366b7da437ac0ffd9fddd6860b639ac
[ "self.cutoff = cutoff\nself.angle_cutoff = angle_cutoff\nself.box_width = box_width\nself.voxel_width = voxel_width", "if 'complex' in kwargs:\n datapoint = kwargs.get('complex')\n raise DeprecationWarning('Complex is being phased out as a parameter, please pass \"datapoint\" instead.')\ntry:\n fragments...
<|body_start_0|> self.cutoff = cutoff self.angle_cutoff = angle_cutoff self.box_width = box_width self.voxel_width = voxel_width <|end_body_0|> <|body_start_1|> if 'complex' in kwargs: datapoint = kwargs.get('complex') raise DeprecationWarning('Complex is...
Localize cation-Pi interactions between atoms in macromolecular complexes. Given a macromolecular complex made up of multiple constitutent molecules, compute cation-Pi between atoms in the macromolecular complex. For each atom, localize this salt bridge in the voxel in which it originated to create a local cation-pi ar...
CationPiVoxelizer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CationPiVoxelizer: """Localize cation-Pi interactions between atoms in macromolecular complexes. Given a macromolecular complex made up of multiple constitutent molecules, compute cation-Pi between atoms in the macromolecular complex. For each atom, localize this salt bridge in the voxel in which...
stack_v2_sparse_classes_36k_train_025152
27,676
permissive
[ { "docstring": "Parameters ---------- cutoff: float, optional (default 6.5) The distance in angstroms within which atoms must be to be considered for a cation-pi interaction between them. angle_cutoff: float, optional (default 30.0) Angle cutoff. Max allowed deviation from the ideal (0deg) angle between ring no...
2
null
Implement the Python class `CationPiVoxelizer` described below. Class description: Localize cation-Pi interactions between atoms in macromolecular complexes. Given a macromolecular complex made up of multiple constitutent molecules, compute cation-Pi between atoms in the macromolecular complex. For each atom, localize...
Implement the Python class `CationPiVoxelizer` described below. Class description: Localize cation-Pi interactions between atoms in macromolecular complexes. Given a macromolecular complex made up of multiple constitutent molecules, compute cation-Pi between atoms in the macromolecular complex. For each atom, localize...
ee6e67ebcf7bf04259cf13aff6388e2b791fea3d
<|skeleton|> class CationPiVoxelizer: """Localize cation-Pi interactions between atoms in macromolecular complexes. Given a macromolecular complex made up of multiple constitutent molecules, compute cation-Pi between atoms in the macromolecular complex. For each atom, localize this salt bridge in the voxel in which...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CationPiVoxelizer: """Localize cation-Pi interactions between atoms in macromolecular complexes. Given a macromolecular complex made up of multiple constitutent molecules, compute cation-Pi between atoms in the macromolecular complex. For each atom, localize this salt bridge in the voxel in which it originate...
the_stack_v2_python_sparse
deepchem/feat/complex_featurizers/grid_featurizers.py
deepchem/deepchem
train
4,876
a949cbe2c39bd9425420f981d4178fd687913534
[ "rst = []\ncounter = dict([(n, int(0)) for n in range(nums[0] - 1, nums[-1] + 2)])\nfor n in nums:\n counter[n] += 1\nfor i in range(nums[0], nums[-1] + 1):\n rst.extend([i] * (counter[i] - counter[i - 1]))\nreturn rst", "rst = []\ncounter = dict([(n, int(0)) for n in range(nums[0] - 1, nums[-1] + 2)])\nfor...
<|body_start_0|> rst = [] counter = dict([(n, int(0)) for n in range(nums[0] - 1, nums[-1] + 2)]) for n in nums: counter[n] += 1 for i in range(nums[0], nums[-1] + 1): rst.extend([i] * (counter[i] - counter[i - 1])) return rst <|end_body_0|> <|body_start_...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findStarsPoints(self, nums: list[int]) -> list[int]: """>>> s = Solution() >>> s.findStarsPoints([1,2,4,5]) [1, 4] >>> s.findStarsPoints([1,1,1,2,2,3]) [1, 1, 1] >>> s.findStarsPoints([1,2,3]) [1] >>> s.findStarsPoints([1,2,3,4,4,5]) [1, 4] >>> s.findStarsPoints([1,2,3,3,4,...
stack_v2_sparse_classes_36k_train_025153
3,767
no_license
[ { "docstring": ">>> s = Solution() >>> s.findStarsPoints([1,2,4,5]) [1, 4] >>> s.findStarsPoints([1,1,1,2,2,3]) [1, 1, 1] >>> s.findStarsPoints([1,2,3]) [1] >>> s.findStarsPoints([1,2,3,4,4,5]) [1, 4] >>> s.findStarsPoints([1,2,3,3,4,5]) [1, 3] >>> s.findStarsPoints([1,2,3,3,4,4,5,5]) [1, 3]", "name": "find...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findStarsPoints(self, nums: list[int]) -> list[int]: >>> s = Solution() >>> s.findStarsPoints([1,2,4,5]) [1, 4] >>> s.findStarsPoints([1,1,1,2,2,3]) [1, 1, 1] >>> s.findStars...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findStarsPoints(self, nums: list[int]) -> list[int]: >>> s = Solution() >>> s.findStarsPoints([1,2,4,5]) [1, 4] >>> s.findStarsPoints([1,1,1,2,2,3]) [1, 1, 1] >>> s.findStars...
d2e8b2dca40fc955045eb62e576c776bad8ee5f1
<|skeleton|> class Solution: def findStarsPoints(self, nums: list[int]) -> list[int]: """>>> s = Solution() >>> s.findStarsPoints([1,2,4,5]) [1, 4] >>> s.findStarsPoints([1,1,1,2,2,3]) [1, 1, 1] >>> s.findStarsPoints([1,2,3]) [1] >>> s.findStarsPoints([1,2,3,4,4,5]) [1, 4] >>> s.findStarsPoints([1,2,3,3,4,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findStarsPoints(self, nums: list[int]) -> list[int]: """>>> s = Solution() >>> s.findStarsPoints([1,2,4,5]) [1, 4] >>> s.findStarsPoints([1,1,1,2,2,3]) [1, 1, 1] >>> s.findStarsPoints([1,2,3]) [1] >>> s.findStarsPoints([1,2,3,4,4,5]) [1, 4] >>> s.findStarsPoints([1,2,3,3,4,5]) [1, 3] >>>...
the_stack_v2_python_sparse
split-array-into-consecutive-subsequences/solution.py
childe/leetcode
train
2
3d9e78c57add055f3642a9768fd751b0c6955765
[ "if context is None:\n context = {}\njournal_pool = self.pool.get('account.journal')\ninvoice_pool = self.pool.get('account.invoice')\nif context.get('invoice_id', False):\n currency_id = invoice_pool.browse(cr, uid, context['invoice_id'], context=context).currency_id.id\n journal_id = journal_pool.search(...
<|body_start_0|> if context is None: context = {} journal_pool = self.pool.get('account.journal') invoice_pool = self.pool.get('account.invoice') if context.get('invoice_id', False): currency_id = invoice_pool.browse(cr, uid, context['invoice_id'], context=context...
account_voucher
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class account_voucher: def _get_journal(self, cr, uid, context=None): """Function to initialise the variable journal_id""" <|body_0|> def onchange_partner_id(self, cr, uid, ids, partner_id, journal_id, price, currency_id, ttype, date, context=None): """Inherited - add amou...
stack_v2_sparse_classes_36k_train_025154
8,345
no_license
[ { "docstring": "Function to initialise the variable journal_id", "name": "_get_journal", "signature": "def _get_journal(self, cr, uid, context=None)" }, { "docstring": "Inherited - add amount_in_word in return value dictionary cr: cursor uid: user id ids: ids of account voucher partner_id: partn...
3
null
Implement the Python class `account_voucher` described below. Class description: Implement the account_voucher class. Method signatures and docstrings: - def _get_journal(self, cr, uid, context=None): Function to initialise the variable journal_id - def onchange_partner_id(self, cr, uid, ids, partner_id, journal_id, ...
Implement the Python class `account_voucher` described below. Class description: Implement the account_voucher class. Method signatures and docstrings: - def _get_journal(self, cr, uid, context=None): Function to initialise the variable journal_id - def onchange_partner_id(self, cr, uid, ids, partner_id, journal_id, ...
b5cf28bdbb347df4c39ffe3ca32355bd2206077b
<|skeleton|> class account_voucher: def _get_journal(self, cr, uid, context=None): """Function to initialise the variable journal_id""" <|body_0|> def onchange_partner_id(self, cr, uid, ids, partner_id, journal_id, price, currency_id, ttype, date, context=None): """Inherited - add amou...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class account_voucher: def _get_journal(self, cr, uid, context=None): """Function to initialise the variable journal_id""" if context is None: context = {} journal_pool = self.pool.get('account.journal') invoice_pool = self.pool.get('account.invoice') if context.g...
the_stack_v2_python_sparse
account_check_writing/account_voucher.py
aryaadiputra/addons60_ptgbu_2013
train
0
544d1e6504d9719f684ba5aaa653dd09aa20ee96
[ "if self.ssl:\n url = 'https://'\nelse:\n url = 'http://'\nurl += '{}:{}{}'.format(self.target, self.port, path)\nkwargs.setdefault('timeout', HTTP_TIMEOUT)\nkwargs.setdefault('verify', False)\nkwargs.setdefault('allow_redirects', False)\ntry:\n return getattr(session, method.lower())(url, **kwargs)\nexcep...
<|body_start_0|> if self.ssl: url = 'https://' else: url = 'http://' url += '{}:{}{}'.format(self.target, self.port, path) kwargs.setdefault('timeout', HTTP_TIMEOUT) kwargs.setdefault('verify', False) kwargs.setdefault('allow_redirects', False) ...
HTTP Client provides methods to handle communication with HTTP server
HTTPClient
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HTTPClient: """HTTP Client provides methods to handle communication with HTTP server""" def http_request(self, method: str, path: str, session: requests=requests, **kwargs) -> requests.Response: """Requests HTTP resource :param str method: method that should be issued e.g. GET, POST ...
stack_v2_sparse_classes_36k_train_025155
2,798
permissive
[ { "docstring": "Requests HTTP resource :param str method: method that should be issued e.g. GET, POST :param str path: path to the resource that should be requested :param requests session: session manager that should be used :param kwargs: kwargs passed to request method :return Response: Response object", ...
3
stack_v2_sparse_classes_30k_train_020283
Implement the Python class `HTTPClient` described below. Class description: HTTP Client provides methods to handle communication with HTTP server Method signatures and docstrings: - def http_request(self, method: str, path: str, session: requests=requests, **kwargs) -> requests.Response: Requests HTTP resource :param...
Implement the Python class `HTTPClient` described below. Class description: HTTP Client provides methods to handle communication with HTTP server Method signatures and docstrings: - def http_request(self, method: str, path: str, session: requests=requests, **kwargs) -> requests.Response: Requests HTTP resource :param...
56ae6325c08bcedd22c57b9fe11b58f1b38314ca
<|skeleton|> class HTTPClient: """HTTP Client provides methods to handle communication with HTTP server""" def http_request(self, method: str, path: str, session: requests=requests, **kwargs) -> requests.Response: """Requests HTTP resource :param str method: method that should be issued e.g. GET, POST ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HTTPClient: """HTTP Client provides methods to handle communication with HTTP server""" def http_request(self, method: str, path: str, session: requests=requests, **kwargs) -> requests.Response: """Requests HTTP resource :param str method: method that should be issued e.g. GET, POST :param str pa...
the_stack_v2_python_sparse
maza/core/http/http_client.py
ArturSpirin/maza
train
2
ee2e9245e55be32ed9ba104cfed089cf46abbe76
[ "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...
Converter is a service for converting between other ecosystems and Pulumi. This is currently unstable and experimental.
ConverterServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConverterServicer: """Converter is a service for converting between other ecosystems and Pulumi. This is currently unstable and experimental.""" def ConvertState(self, request, context): """ConvertState converts state from the target ecosystem into a form that can be imported into Pu...
stack_v2_sparse_classes_36k_train_025156
4,535
permissive
[ { "docstring": "ConvertState converts state from the target ecosystem into a form that can be imported into Pulumi.", "name": "ConvertState", "signature": "def ConvertState(self, request, context)" }, { "docstring": "ConvertProgram converts a program from the target ecosystem into a form that ca...
2
stack_v2_sparse_classes_30k_train_017910
Implement the Python class `ConverterServicer` described below. Class description: Converter is a service for converting between other ecosystems and Pulumi. This is currently unstable and experimental. Method signatures and docstrings: - def ConvertState(self, request, context): ConvertState converts state from the ...
Implement the Python class `ConverterServicer` described below. Class description: Converter is a service for converting between other ecosystems and Pulumi. This is currently unstable and experimental. Method signatures and docstrings: - def ConvertState(self, request, context): ConvertState converts state from the ...
46e2753d02d46a1c077930eeccdfe6738f46c0d2
<|skeleton|> class ConverterServicer: """Converter is a service for converting between other ecosystems and Pulumi. This is currently unstable and experimental.""" def ConvertState(self, request, context): """ConvertState converts state from the target ecosystem into a form that can be imported into Pu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConverterServicer: """Converter is a service for converting between other ecosystems and Pulumi. This is currently unstable and experimental.""" def ConvertState(self, request, context): """ConvertState converts state from the target ecosystem into a form that can be imported into Pulumi.""" ...
the_stack_v2_python_sparse
sdk/python/lib/pulumi/runtime/proto/converter_pb2_grpc.py
pulumi/pulumi
train
17,553
c9a2c399126ae3cebc7ed720ce6a98d1d184a261
[ "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.
BoxSecretServiceServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BoxSecretServiceServicer: """Missing associated documentation comment in .proto file.""" def getBoxSecret(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def createBoxSecret(self, request, context): """Missing as...
stack_v2_sparse_classes_36k_train_025157
7,947
permissive
[ { "docstring": "Missing associated documentation comment in .proto file.", "name": "getBoxSecret", "signature": "def getBoxSecret(self, request, context)" }, { "docstring": "Missing associated documentation comment in .proto file.", "name": "createBoxSecret", "signature": "def createBoxS...
4
stack_v2_sparse_classes_30k_train_002453
Implement the Python class `BoxSecretServiceServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def getBoxSecret(self, request, context): Missing associated documentation comment in .proto file. - def createBoxSecret(self, request,...
Implement the Python class `BoxSecretServiceServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def getBoxSecret(self, request, context): Missing associated documentation comment in .proto file. - def createBoxSecret(self, request,...
c69e14b409add099d151434b9add711e41f41b20
<|skeleton|> class BoxSecretServiceServicer: """Missing associated documentation comment in .proto file.""" def getBoxSecret(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def createBoxSecret(self, request, context): """Missing as...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BoxSecretServiceServicer: """Missing associated documentation comment in .proto file.""" def getBoxSecret(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not impleme...
the_stack_v2_python_sparse
python-sdk/src/airavata_mft_sdk/box/BoxSecretService_pb2_grpc.py
apache/airavata-mft
train
23
f0a1f12694e99ba46af996e444ef32d7ebce0b22
[ "if model._meta.app_label == 'researcherquery':\n return 'safedb'\nreturn None", "if model._meta.app_label == 'researcherquery':\n return 'safedb'\nreturn None", "if obj1._meta.app_label == 'researcherquery' and obj2._meta.app_label == 'researcherquery':\n return True\nreturn None", "if app_label == ...
<|body_start_0|> if model._meta.app_label == 'researcherquery': return 'safedb' return None <|end_body_0|> <|body_start_1|> if model._meta.app_label == 'researcherquery': return 'safedb' return None <|end_body_1|> <|body_start_2|> if obj1._meta.app_label...
A router to control all database operations on models in the researcherquery application.
ResearcherqueryRouter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResearcherqueryRouter: """A router to control all database operations on models in the researcherquery application.""" def db_for_read(self, model, **hints): """Attempts to read researcherquery models go to safedb.""" <|body_0|> def db_for_write(self, model, **hints): ...
stack_v2_sparse_classes_36k_train_025158
1,295
no_license
[ { "docstring": "Attempts to read researcherquery models go to safedb.", "name": "db_for_read", "signature": "def db_for_read(self, model, **hints)" }, { "docstring": "Attempts to write researcherquery models go to safedb.", "name": "db_for_write", "signature": "def db_for_write(self, mod...
4
stack_v2_sparse_classes_30k_train_003232
Implement the Python class `ResearcherqueryRouter` described below. Class description: A router to control all database operations on models in the researcherquery application. Method signatures and docstrings: - def db_for_read(self, model, **hints): Attempts to read researcherquery models go to safedb. - def db_for...
Implement the Python class `ResearcherqueryRouter` described below. Class description: A router to control all database operations on models in the researcherquery application. Method signatures and docstrings: - def db_for_read(self, model, **hints): Attempts to read researcherquery models go to safedb. - def db_for...
685c2b9d40fb24ca1735352846a39fdf5d3728eb
<|skeleton|> class ResearcherqueryRouter: """A router to control all database operations on models in the researcherquery application.""" def db_for_read(self, model, **hints): """Attempts to read researcherquery models go to safedb.""" <|body_0|> def db_for_write(self, model, **hints): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResearcherqueryRouter: """A router to control all database operations on models in the researcherquery application.""" def db_for_read(self, model, **hints): """Attempts to read researcherquery models go to safedb.""" if model._meta.app_label == 'researcherquery': return 'safe...
the_stack_v2_python_sparse
researcherquery/router.py
guekling/ifs4205team1
train
0
79817d45b4be6f79b525a78cb4ea720a165d7453
[ "stock_company = get_object_or_404(UserCompany, user=request.user, pk=id)\nurl = f'https://www.alphavantage.co/query?function=TIME_SERIES_DAILY_ADJUSTED&symbol={stock_company.companystock.symbol}&outputsize=compact&apikey={settings.STOCK_API_KEY}'\nres = requests.get(url)\ndata = res.json()\ndata = data['Time Serie...
<|body_start_0|> stock_company = get_object_or_404(UserCompany, user=request.user, pk=id) url = f'https://www.alphavantage.co/query?function=TIME_SERIES_DAILY_ADJUSTED&symbol={stock_company.companystock.symbol}&outputsize=compact&apikey={settings.STOCK_API_KEY}' res = requests.get(url) d...
CompanyStockView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CompanyStockView: def get(self, request, id): """Retorna los datos del mercado de la compañía""" <|body_0|> def post(self, request, id): """Suscribirse a una acción""" <|body_1|> def delete(self, request, id): """Elimina la suscripción a una acci...
stack_v2_sparse_classes_36k_train_025159
3,455
no_license
[ { "docstring": "Retorna los datos del mercado de la compañía", "name": "get", "signature": "def get(self, request, id)" }, { "docstring": "Suscribirse a una acción", "name": "post", "signature": "def post(self, request, id)" }, { "docstring": "Elimina la suscripción a una acción"...
3
stack_v2_sparse_classes_30k_train_014606
Implement the Python class `CompanyStockView` described below. Class description: Implement the CompanyStockView class. Method signatures and docstrings: - def get(self, request, id): Retorna los datos del mercado de la compañía - def post(self, request, id): Suscribirse a una acción - def delete(self, request, id): ...
Implement the Python class `CompanyStockView` described below. Class description: Implement the CompanyStockView class. Method signatures and docstrings: - def get(self, request, id): Retorna los datos del mercado de la compañía - def post(self, request, id): Suscribirse a una acción - def delete(self, request, id): ...
db0c61cd66da56f9c904cffeae807b2605a96cc7
<|skeleton|> class CompanyStockView: def get(self, request, id): """Retorna los datos del mercado de la compañía""" <|body_0|> def post(self, request, id): """Suscribirse a una acción""" <|body_1|> def delete(self, request, id): """Elimina la suscripción a una acci...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CompanyStockView: def get(self, request, id): """Retorna los datos del mercado de la compañía""" stock_company = get_object_or_404(UserCompany, user=request.user, pk=id) url = f'https://www.alphavantage.co/query?function=TIME_SERIES_DAILY_ADJUSTED&symbol={stock_company.companystock.sym...
the_stack_v2_python_sparse
api/views/companystock.py
klasinky/FinaccessBackend
train
2
15a16734f497adee8dab1202558e8ae8814ab2e7
[ "index = 0\ncount = 0\nwhile index <= n:\n count += str(index).count('1')\n index += 1\nreturn count", "if n < 0:\n return 0\nlevel = 1\ncount = 0\nwhile True:\n step, redundancy = divmod(n, level * 10)\n count += level * step\n r, l = divmod(redundancy, level)\n if r > 1:\n count += l...
<|body_start_0|> index = 0 count = 0 while index <= n: count += str(index).count('1') index += 1 return count <|end_body_0|> <|body_start_1|> if n < 0: return 0 level = 1 count = 0 while True: step, redundan...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def _countDigitOne(self, n): """:type n: int :rtype: int""" <|body_0|> def countDigitOne(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> index = 0 count = 0 while index <= n: ...
stack_v2_sparse_classes_36k_train_025160
1,818
permissive
[ { "docstring": ":type n: int :rtype: int", "name": "_countDigitOne", "signature": "def _countDigitOne(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "countDigitOne", "signature": "def countDigitOne(self, n)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _countDigitOne(self, n): :type n: int :rtype: int - def countDigitOne(self, n): :type n: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _countDigitOne(self, n): :type n: int :rtype: int - def countDigitOne(self, n): :type n: int :rtype: int <|skeleton|> class Solution: def _countDigitOne(self, n): ...
0dd67edca4e0b0323cb5a7239f02ea46383cd15a
<|skeleton|> class Solution: def _countDigitOne(self, n): """:type n: int :rtype: int""" <|body_0|> def countDigitOne(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def _countDigitOne(self, n): """:type n: int :rtype: int""" index = 0 count = 0 while index <= n: count += str(index).count('1') index += 1 return count def countDigitOne(self, n): """:type n: int :rtype: int""" if ...
the_stack_v2_python_sparse
233.number-of-digit-one.py
windard/leeeeee
train
0
38eb2f43acf9033951650652027b33bd1f59b1df
[ "self._categorical_features = set(schema_util.get_categorical_numeric_features(schema) if schema else [])\nself._weight_feature = weight_feature\nself._num_top_values = num_top_values\nself._num_rank_histogram_buckets = num_rank_histogram_buckets", "feature_values_with_weights = pcoll | 'TopK_ConvertInputToFeatur...
<|body_start_0|> self._categorical_features = set(schema_util.get_categorical_numeric_features(schema) if schema else []) self._weight_feature = weight_feature self._num_top_values = num_top_values self._num_rank_histogram_buckets = num_rank_histogram_buckets <|end_body_0|> <|body_start...
A ptransform that computes the top-k most frequent feature values for string features.
_ComputeTopKStats
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _ComputeTopKStats: """A ptransform that computes the top-k most frequent feature values for string features.""" def __init__(self, schema, weight_feature, num_top_values, num_rank_histogram_buckets): """Initializes _ComputeTopKStats. Args: schema: An schema for the dataset. None if n...
stack_v2_sparse_classes_36k_train_025161
14,116
permissive
[ { "docstring": "Initializes _ComputeTopKStats. Args: schema: An schema for the dataset. None if no schema is available. weight_feature: Feature name whose numeric value represents the weight of an example. None if there is no weight feature. num_top_values: The number of most frequent feature values to keep for...
2
stack_v2_sparse_classes_30k_train_006321
Implement the Python class `_ComputeTopKStats` described below. Class description: A ptransform that computes the top-k most frequent feature values for string features. Method signatures and docstrings: - def __init__(self, schema, weight_feature, num_top_values, num_rank_histogram_buckets): Initializes _ComputeTopK...
Implement the Python class `_ComputeTopKStats` described below. Class description: A ptransform that computes the top-k most frequent feature values for string features. Method signatures and docstrings: - def __init__(self, schema, weight_feature, num_top_values, num_rank_histogram_buckets): Initializes _ComputeTopK...
9c29b0dc92e73d794db90d0676ab6b43ed73815d
<|skeleton|> class _ComputeTopKStats: """A ptransform that computes the top-k most frequent feature values for string features.""" def __init__(self, schema, weight_feature, num_top_values, num_rank_histogram_buckets): """Initializes _ComputeTopKStats. Args: schema: An schema for the dataset. None if n...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _ComputeTopKStats: """A ptransform that computes the top-k most frequent feature values for string features.""" def __init__(self, schema, weight_feature, num_top_values, num_rank_histogram_buckets): """Initializes _ComputeTopKStats. Args: schema: An schema for the dataset. None if no schema is a...
the_stack_v2_python_sparse
tensorflow_data_validation/statistics/generators/top_k_stats_generator.py
paulgc/data-validation
train
1
27de429078601ca9d7f472a83261c7eeb4e16318
[ "request = await stream.recv_message()\nassert request is not None\nuser: str | None = None\nuser_data: UserData | None = None\nentity_tag: int | None = None\nasync with self.catch_errors('GetUser') as result, self.login_as(stream.metadata, request.user) as identity:\n user = identity.name\n metadata = await ...
<|body_start_0|> request = await stream.recv_message() assert request is not None user: str | None = None user_data: UserData | None = None entity_tag: int | None = None async with self.catch_errors('GetUser') as result, self.login_as(stream.metadata, request.user) as ide...
The GRPC handlers, executed when an admin request is received. Each handler should receive a request, take action, and send the response. See Also: :class:`grpclib.server.Server`
UserHandlers
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserHandlers: """The GRPC handlers, executed when an admin request is received. Each handler should receive a request, take action, and send the response. See Also: :class:`grpclib.server.Server`""" async def GetUser(self, stream: _GetUserStream) -> None: """See ``pymap-admin get-use...
stack_v2_sparse_classes_36k_train_025162
4,142
permissive
[ { "docstring": "See ``pymap-admin get-user --help`` for more options. Args: stream (:class:`~grpclib.server.Stream`): The stream for the request and response.", "name": "GetUser", "signature": "async def GetUser(self, stream: _GetUserStream) -> None" }, { "docstring": "See ``pymap-admin set-user...
3
null
Implement the Python class `UserHandlers` described below. Class description: The GRPC handlers, executed when an admin request is received. Each handler should receive a request, take action, and send the response. See Also: :class:`grpclib.server.Server` Method signatures and docstrings: - async def GetUser(self, s...
Implement the Python class `UserHandlers` described below. Class description: The GRPC handlers, executed when an admin request is received. Each handler should receive a request, take action, and send the response. See Also: :class:`grpclib.server.Server` Method signatures and docstrings: - async def GetUser(self, s...
0b7cc3f0a1a000b96cb9873af7a2bbdf5cb7dc34
<|skeleton|> class UserHandlers: """The GRPC handlers, executed when an admin request is received. Each handler should receive a request, take action, and send the response. See Also: :class:`grpclib.server.Server`""" async def GetUser(self, stream: _GetUserStream) -> None: """See ``pymap-admin get-use...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserHandlers: """The GRPC handlers, executed when an admin request is received. Each handler should receive a request, take action, and send the response. See Also: :class:`grpclib.server.Server`""" async def GetUser(self, stream: _GetUserStream) -> None: """See ``pymap-admin get-user --help`` fo...
the_stack_v2_python_sparse
pymap/admin/handlers/user.py
icgood/pymap
train
23
45a2e00e9038699c6335a2be5be2b1c7cf2686e7
[ "self.clean_number()\nself.clean_letters()\nsuper().save(*args, **kwargs)", "if not self.number:\n if not self.letters:\n raise ValidationError('You must enter either a phonenumber or a letter representation of the phonenumber!')\n self.number = dectutil.letters_to_number(self.letters)\ntry:\n int...
<|body_start_0|> self.clean_number() self.clean_letters() super().save(*args, **kwargs) <|end_body_0|> <|body_start_1|> if not self.number: if not self.letters: raise ValidationError('You must enter either a phonenumber or a letter representation of the phone...
This model contains DECT registrations for users and services
DectRegistration
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DectRegistration: """This model contains DECT registrations for users and services""" def save(self, *args, **kwargs): """This is just here so we get the validation in the admin as well.""" <|body_0|> def clean_number(self): """We call this from the views form_va...
stack_v2_sparse_classes_36k_train_025163
5,767
permissive
[ { "docstring": "This is just here so we get the validation in the admin as well.", "name": "save", "signature": "def save(self, *args, **kwargs)" }, { "docstring": "We call this from the views form_valid() so we have a Camp object available for the validation. This code really belongs in model.c...
3
null
Implement the Python class `DectRegistration` described below. Class description: This model contains DECT registrations for users and services Method signatures and docstrings: - def save(self, *args, **kwargs): This is just here so we get the validation in the admin as well. - def clean_number(self): We call this f...
Implement the Python class `DectRegistration` described below. Class description: This model contains DECT registrations for users and services Method signatures and docstrings: - def save(self, *args, **kwargs): This is just here so we get the validation in the admin as well. - def clean_number(self): We call this f...
767deb7f58429e9162e0c2ef79be9f0f38f37ce1
<|skeleton|> class DectRegistration: """This model contains DECT registrations for users and services""" def save(self, *args, **kwargs): """This is just here so we get the validation in the admin as well.""" <|body_0|> def clean_number(self): """We call this from the views form_va...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DectRegistration: """This model contains DECT registrations for users and services""" def save(self, *args, **kwargs): """This is just here so we get the validation in the admin as well.""" self.clean_number() self.clean_letters() super().save(*args, **kwargs) def cle...
the_stack_v2_python_sparse
src/phonebook/models.py
bornhack/bornhack-website
train
9
c433331b0118f1588dfda0428440ea85685c5baf
[ "super().__init__()\nself.encoder = Encoder(**encoder_config)\nself.decoder = Decoder(**decoder_config)", "out = self.encoder(x)\nout = self.decoder(out)\nreturn out" ]
<|body_start_0|> super().__init__() self.encoder = Encoder(**encoder_config) self.decoder = Decoder(**decoder_config) <|end_body_0|> <|body_start_1|> out = self.encoder(x) out = self.decoder(out) return out <|end_body_1|>
A PyTorch implementation of the translation model proposed by Guillaume Genthial and Romain Sauvestre for the Im2Latex-100k dataset.
Im2Latex
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Im2Latex: """A PyTorch implementation of the translation model proposed by Guillaume Genthial and Romain Sauvestre for the Im2Latex-100k dataset.""" def __init__(self, encoder_config, decoder_config): """Initializes the stages of the Im2Latex model. Inputs: encoder_config : dict A di...
stack_v2_sparse_classes_36k_train_025164
2,334
no_license
[ { "docstring": "Initializes the stages of the Im2Latex model. Inputs: encoder_config : dict A dictionary of keyword arguments used to configure the Encoder. decoder_config : dict A dictionary of keyword arguments used to configure the Decoder. Outputs: None, but initializes the layers.", "name": "__init__",...
2
stack_v2_sparse_classes_30k_train_019220
Implement the Python class `Im2Latex` described below. Class description: A PyTorch implementation of the translation model proposed by Guillaume Genthial and Romain Sauvestre for the Im2Latex-100k dataset. Method signatures and docstrings: - def __init__(self, encoder_config, decoder_config): Initializes the stages ...
Implement the Python class `Im2Latex` described below. Class description: A PyTorch implementation of the translation model proposed by Guillaume Genthial and Romain Sauvestre for the Im2Latex-100k dataset. Method signatures and docstrings: - def __init__(self, encoder_config, decoder_config): Initializes the stages ...
9820aca2d37d2b320a3e3c1283f6c2e0e16bbb75
<|skeleton|> class Im2Latex: """A PyTorch implementation of the translation model proposed by Guillaume Genthial and Romain Sauvestre for the Im2Latex-100k dataset.""" def __init__(self, encoder_config, decoder_config): """Initializes the stages of the Im2Latex model. Inputs: encoder_config : dict A di...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Im2Latex: """A PyTorch implementation of the translation model proposed by Guillaume Genthial and Romain Sauvestre for the Im2Latex-100k dataset.""" def __init__(self, encoder_config, decoder_config): """Initializes the stages of the Im2Latex model. Inputs: encoder_config : dict A dictionary of k...
the_stack_v2_python_sparse
src/models/im2latex/model.py
davidlin001/equation2latex
train
2
5321ec5ec76882045f25df52ff1a4e1a25142d2b
[ "m = len(matrix)\nif m == 0:\n self.F = None\n return\nn = len(matrix[0])\nself.F = [[0 for _ in xrange(n + 1)] for _ in xrange(m + 1)]\nfor i in xrange(1, m + 1):\n for j in xrange(1, n + 1):\n self.F[i][j] = self.F[i - 1][j] + self.F[i][j - 1] - self.F[i - 1][j - 1] + matrix[i - 1][j - 1]", "if ...
<|body_start_0|> m = len(matrix) if m == 0: self.F = None return n = len(matrix[0]) self.F = [[0 for _ in xrange(n + 1)] for _ in xrange(m + 1)] for i in xrange(1, m + 1): for j in xrange(1, n + 1): self.F[i][j] = self.F[i - 1][...
NumMatrix
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumMatrix: def __init__(self, matrix): """initialize your data structure here. dp F[i][j] = F[i-1][j]+F[i][j-1]-F[i-1][j-1]+mat[i][j] :type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """sum of elements matrix[(row1,col1)..(row2...
stack_v2_sparse_classes_36k_train_025165
1,587
permissive
[ { "docstring": "initialize your data structure here. dp F[i][j] = F[i-1][j]+F[i][j-1]-F[i-1][j-1]+mat[i][j] :type matrix: List[List[int]]", "name": "__init__", "signature": "def __init__(self, matrix)" }, { "docstring": "sum of elements matrix[(row1,col1)..(row2,col2)], inclusive.", "name": ...
2
null
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): initialize your data structure here. dp F[i][j] = F[i-1][j]+F[i][j-1]-F[i-1][j-1]+mat[i][j] :type matrix: List[List[int]] - def sumRegion(self, row1...
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): initialize your data structure here. dp F[i][j] = F[i-1][j]+F[i][j-1]-F[i-1][j-1]+mat[i][j] :type matrix: List[List[int]] - def sumRegion(self, row1...
cbbd4a67ab342ada2421e13f82d660b1d47d4d20
<|skeleton|> class NumMatrix: def __init__(self, matrix): """initialize your data structure here. dp F[i][j] = F[i-1][j]+F[i][j-1]-F[i-1][j-1]+mat[i][j] :type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """sum of elements matrix[(row1,col1)..(row2...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NumMatrix: def __init__(self, matrix): """initialize your data structure here. dp F[i][j] = F[i-1][j]+F[i][j-1]-F[i-1][j-1]+mat[i][j] :type matrix: List[List[int]]""" m = len(matrix) if m == 0: self.F = None return n = len(matrix[0]) self.F = [[0...
the_stack_v2_python_sparse
304 Range Sum Query 2D - Immutable.py
Aminaba123/LeetCode
train
1
b193fabdd3da5642332a5e14485acaf24d7f40d4
[ "super(MeanAggregator, self).__init__()\nself.features = features\nself.cuda = cuda\nself.gcn = gcn", "_set = set\nif num_sample:\n _sample = random.sample\n samp_neighs = [_set(_sample(to_neigh, num_sample)) if len(to_neigh) >= num_sample else to_neigh for to_neigh in to_neighs]\nelse:\n samp_neighs = t...
<|body_start_0|> super(MeanAggregator, self).__init__() self.features = features self.cuda = cuda self.gcn = gcn <|end_body_0|> <|body_start_1|> _set = set if num_sample: _sample = random.sample samp_neighs = [_set(_sample(to_neigh, num_sample)) i...
Aggregates a node's embeddings using mean of neighbors' embeddings
MeanAggregator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MeanAggregator: """Aggregates a node's embeddings using mean of neighbors' embeddings""" def __init__(self, features, cuda=False, gcn=False): """Initializes the aggregator for a specific graph. Parameters ---------- features : [type] function mapping LongTensor of node ids to FloatTe...
stack_v2_sparse_classes_36k_train_025166
14,546
no_license
[ { "docstring": "Initializes the aggregator for a specific graph. Parameters ---------- features : [type] function mapping LongTensor of node ids to FloatTensor of feature values. cuda : bool, optional whether to use GPU, by default False gcn : bool, optional whether to perform concatenation GraphSAGE-style, or ...
2
stack_v2_sparse_classes_30k_train_003943
Implement the Python class `MeanAggregator` described below. Class description: Aggregates a node's embeddings using mean of neighbors' embeddings Method signatures and docstrings: - def __init__(self, features, cuda=False, gcn=False): Initializes the aggregator for a specific graph. Parameters ---------- features : ...
Implement the Python class `MeanAggregator` described below. Class description: Aggregates a node's embeddings using mean of neighbors' embeddings Method signatures and docstrings: - def __init__(self, features, cuda=False, gcn=False): Initializes the aggregator for a specific graph. Parameters ---------- features : ...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class MeanAggregator: """Aggregates a node's embeddings using mean of neighbors' embeddings""" def __init__(self, features, cuda=False, gcn=False): """Initializes the aggregator for a specific graph. Parameters ---------- features : [type] function mapping LongTensor of node ids to FloatTe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MeanAggregator: """Aggregates a node's embeddings using mean of neighbors' embeddings""" def __init__(self, features, cuda=False, gcn=False): """Initializes the aggregator for a specific graph. Parameters ---------- features : [type] function mapping LongTensor of node ids to FloatTensor of featu...
the_stack_v2_python_sparse
generated/test_dreamhomes_PyTorch_GNNs.py
jansel/pytorch-jit-paritybench
train
35
cc878044d30b3563836322d6f429d72294c9dd17
[ "from facebook import GraphAPI, GraphAPIError\nself.GraphAPI = GraphAPI\nself.GraphAPIError = GraphAPIError\nrequest = current.request\nsettings = current.deployment_settings\nscope = 'email,user_about_me,user_location,user_photos,user_relationships,user_birthday,user_website,create_event,user_events,publish_stream...
<|body_start_0|> from facebook import GraphAPI, GraphAPIError self.GraphAPI = GraphAPI self.GraphAPIError = GraphAPIError request = current.request settings = current.deployment_settings scope = 'email,user_about_me,user_location,user_photos,user_relationships,user_birthd...
OAuth implementation for FaceBook
FaceBookAccount
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FaceBookAccount: """OAuth implementation for FaceBook""" def __init__(self, channel): """Constructor @param channel: Facebook channel (Row) with API credentials: {app_id=clientID, app_secret=clientSecret}""" <|body_0|> def login_url(self, next='/'): """Overriding...
stack_v2_sparse_classes_36k_train_025167
31,965
permissive
[ { "docstring": "Constructor @param channel: Facebook channel (Row) with API credentials: {app_id=clientID, app_secret=clientSecret}", "name": "__init__", "signature": "def __init__(self, channel)" }, { "docstring": "Overriding to produce a different redirect_uri", "name": "login_url", "s...
3
stack_v2_sparse_classes_30k_train_019720
Implement the Python class `FaceBookAccount` described below. Class description: OAuth implementation for FaceBook Method signatures and docstrings: - def __init__(self, channel): Constructor @param channel: Facebook channel (Row) with API credentials: {app_id=clientID, app_secret=clientSecret} - def login_url(self, ...
Implement the Python class `FaceBookAccount` described below. Class description: OAuth implementation for FaceBook Method signatures and docstrings: - def __init__(self, channel): Constructor @param channel: Facebook channel (Row) with API credentials: {app_id=clientID, app_secret=clientSecret} - def login_url(self, ...
7ec4b959d009daf26d5ca6ce91dd9c3c0bd978d6
<|skeleton|> class FaceBookAccount: """OAuth implementation for FaceBook""" def __init__(self, channel): """Constructor @param channel: Facebook channel (Row) with API credentials: {app_id=clientID, app_secret=clientSecret}""" <|body_0|> def login_url(self, next='/'): """Overriding...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FaceBookAccount: """OAuth implementation for FaceBook""" def __init__(self, channel): """Constructor @param channel: Facebook channel (Row) with API credentials: {app_id=clientID, app_secret=clientSecret}""" from facebook import GraphAPI, GraphAPIError self.GraphAPI = GraphAPI ...
the_stack_v2_python_sparse
modules/core/aaa/oauth.py
nursix/drkcm
train
3
4d542d06223e08a24c96a31d4d834483f1bf64da
[ "queue = [root]\nans = ''\nwhile queue:\n cur = queue.pop(0)\n if cur:\n ans += str(cur.val) + ','\n queue.append(cur.left)\n queue.append(cur.right)\n else:\n ans += '#,'\nreturn ans[:-1]", "if data == '#' or not data:\n return None\nnodes = data.split(',')\nroot = TreeNod...
<|body_start_0|> queue = [root] ans = '' while queue: cur = queue.pop(0) if cur: ans += str(cur.val) + ',' queue.append(cur.left) queue.append(cur.right) else: ans += '#,' return ans[:-1] ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_025168
2,652
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
3a5649357e0f21cbbc5e238351300cd706d533b3
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" queue = [root] ans = '' while queue: cur = queue.pop(0) if cur: ans += str(cur.val) + ',' queue.append(cur.left) ...
the_stack_v2_python_sparse
leetcode-py/leetcode297.py
cicihou/LearningProject
train
0
9fc0ab610b5b525f0bfa5669faa026122c4b4e0c
[ "assert FinancialAid.objects.count() == 0\nassert User.objects.count() == 0\nassert Profile.objects.count() == 0\nFinancialAidFactory.create()\nassert FinancialAid.objects.count() == 1\nassert User.objects.count() == 1\nassert Profile.objects.count() == 1", "with mute_signals(post_save):\n user = UserFactory.c...
<|body_start_0|> assert FinancialAid.objects.count() == 0 assert User.objects.count() == 0 assert Profile.objects.count() == 0 FinancialAidFactory.create() assert FinancialAid.objects.count() == 1 assert User.objects.count() == 1 assert Profile.objects.count() == ...
Tests for financialaid factories
FinancialAidModelsTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FinancialAidModelsTests: """Tests for financialaid factories""" def test_financial_aid_factory_create(self): """Tests that FinancialAidFactory.create() will create a profile for the user field if a user is not specified""" <|body_0|> def test_financial_aid_factory_create...
stack_v2_sparse_classes_36k_train_025169
1,554
permissive
[ { "docstring": "Tests that FinancialAidFactory.create() will create a profile for the user field if a user is not specified", "name": "test_financial_aid_factory_create", "signature": "def test_financial_aid_factory_create(self)" }, { "docstring": "Tests that FinancialAidFactory.create() will st...
2
null
Implement the Python class `FinancialAidModelsTests` described below. Class description: Tests for financialaid factories Method signatures and docstrings: - def test_financial_aid_factory_create(self): Tests that FinancialAidFactory.create() will create a profile for the user field if a user is not specified - def t...
Implement the Python class `FinancialAidModelsTests` described below. Class description: Tests for financialaid factories Method signatures and docstrings: - def test_financial_aid_factory_create(self): Tests that FinancialAidFactory.create() will create a profile for the user field if a user is not specified - def t...
d6564caca0b7bbfd31e67a751564107fd17d6eb0
<|skeleton|> class FinancialAidModelsTests: """Tests for financialaid factories""" def test_financial_aid_factory_create(self): """Tests that FinancialAidFactory.create() will create a profile for the user field if a user is not specified""" <|body_0|> def test_financial_aid_factory_create...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FinancialAidModelsTests: """Tests for financialaid factories""" def test_financial_aid_factory_create(self): """Tests that FinancialAidFactory.create() will create a profile for the user field if a user is not specified""" assert FinancialAid.objects.count() == 0 assert User.objec...
the_stack_v2_python_sparse
financialaid/factories_test.py
mitodl/micromasters
train
35
d295f56e7d03aad68ac25921d46879b8b8e5e39d
[ "super(AttentionalDecoder, self).__init__(output_size, hidden_size, embedding_dim, max_length, enc_dim, device, dropout_p, pad_token)\nself._gru = nn.GRU(input_size=self._embedding_dim + self._enc_dim, hidden_size=self._hidden_size)\nself._attention = AdditiveAttention(key_dim=self._enc_dim, value_dim=self._enc_dim...
<|body_start_0|> super(AttentionalDecoder, self).__init__(output_size, hidden_size, embedding_dim, max_length, enc_dim, device, dropout_p, pad_token) self._gru = nn.GRU(input_size=self._embedding_dim + self._enc_dim, hidden_size=self._hidden_size) self._attention = AdditiveAttention(key_dim=self...
AttentionalDecoder
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AttentionalDecoder: def __init__(self, hidden_size, output_size, embedding_dim, max_length, enc_dim, device, dropout_p=0.1, pad_token=0): """:param embedding_dim: dimension of :param hidden_size: :param output_size: :param max_length: :param device: :param dropout_p:""" <|body_0|...
stack_v2_sparse_classes_36k_train_025170
2,837
permissive
[ { "docstring": ":param embedding_dim: dimension of :param hidden_size: :param output_size: :param max_length: :param device: :param dropout_p:", "name": "__init__", "signature": "def __init__(self, hidden_size, output_size, embedding_dim, max_length, enc_dim, device, dropout_p=0.1, pad_token=0)" }, ...
2
stack_v2_sparse_classes_30k_train_004275
Implement the Python class `AttentionalDecoder` described below. Class description: Implement the AttentionalDecoder class. Method signatures and docstrings: - def __init__(self, hidden_size, output_size, embedding_dim, max_length, enc_dim, device, dropout_p=0.1, pad_token=0): :param embedding_dim: dimension of :para...
Implement the Python class `AttentionalDecoder` described below. Class description: Implement the AttentionalDecoder class. Method signatures and docstrings: - def __init__(self, hidden_size, output_size, embedding_dim, max_length, enc_dim, device, dropout_p=0.1, pad_token=0): :param embedding_dim: dimension of :para...
689b9924d3c88a433f8f350b89c13a878ac7d7c3
<|skeleton|> class AttentionalDecoder: def __init__(self, hidden_size, output_size, embedding_dim, max_length, enc_dim, device, dropout_p=0.1, pad_token=0): """:param embedding_dim: dimension of :param hidden_size: :param output_size: :param max_length: :param device: :param dropout_p:""" <|body_0|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AttentionalDecoder: def __init__(self, hidden_size, output_size, embedding_dim, max_length, enc_dim, device, dropout_p=0.1, pad_token=0): """:param embedding_dim: dimension of :param hidden_size: :param output_size: :param max_length: :param device: :param dropout_p:""" super(AttentionalDecode...
the_stack_v2_python_sparse
nntoolbox/sequence/models/decoder.py
nhatsmrt/nn-toolbox
train
19
12029a082f09dc317def3d8adaae053dfd10f99f
[ "if not userid:\n raise ValueError('Users must have an email address')\nuser = self.model(userid=userid, date_of_birth=date_of_birth)\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user", "user = self.create_user(userid, password=password, date_of_birth=date_of_birth)\nuser.is_admin = True\nus...
<|body_start_0|> if not userid: raise ValueError('Users must have an email address') user = self.model(userid=userid, date_of_birth=date_of_birth) user.set_password(password) user.save(using=self._db) return user <|end_body_0|> <|body_start_1|> user = self.cr...
MyUserManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyUserManager: def create_user(self, userid, date_of_birth, password=None): """Creates and saves a User with the given email, date of birth and password.""" <|body_0|> def create_superuser(self, userid, date_of_birth, password): """Creates and saves a superuser with ...
stack_v2_sparse_classes_36k_train_025171
15,631
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, userid, date_of_birth, password=None)" }, { "docstring": "Creates and saves a superuser with the given email, date of birth and password.", ...
2
stack_v2_sparse_classes_30k_train_003485
Implement the Python class `MyUserManager` described below. Class description: Implement the MyUserManager class. Method signatures and docstrings: - def create_user(self, userid, date_of_birth, password=None): Creates and saves a User with the given email, date of birth and password. - def create_superuser(self, use...
Implement the Python class `MyUserManager` described below. Class description: Implement the MyUserManager class. Method signatures and docstrings: - def create_user(self, userid, date_of_birth, password=None): Creates and saves a User with the given email, date of birth and password. - def create_superuser(self, use...
54f2b945e5214c7f7e85984cafd5b22c999a3640
<|skeleton|> class MyUserManager: def create_user(self, userid, date_of_birth, password=None): """Creates and saves a User with the given email, date of birth and password.""" <|body_0|> def create_superuser(self, userid, date_of_birth, password): """Creates and saves a superuser with ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MyUserManager: def create_user(self, userid, date_of_birth, password=None): """Creates and saves a User with the given email, date of birth and password.""" if not userid: raise ValueError('Users must have an email address') user = self.model(userid=userid, date_of_birth=da...
the_stack_v2_python_sparse
testuser/newapp/models.py
vaibhavs95/NSIT-Hostel-MS
train
0
09ceeff88db61da4ecf6a84878bedc5302bdf39a
[ "if request.version == 'v6':\n return self._post_v6(request)\nelif request.version == 'v7':\n return self._post_v6(request)\nraise Http404()", "configuration = rest_util.parse_dict(request, 'configuration')\nvalidation = Scan.objects.validate_scan_v6(configuration=configuration)\nresp_dict = {'is_valid': va...
<|body_start_0|> if request.version == 'v6': return self._post_v6(request) elif request.version == 'v7': return self._post_v6(request) raise Http404() <|end_body_0|> <|body_start_1|> configuration = rest_util.parse_dict(request, 'configuration') validatio...
This view is the endpoint for validating a new Scan process before attempting to actually create it
ScansValidationView
[ "LicenseRef-scancode-free-unknown", "Apache-2.0", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScansValidationView: """This view is the endpoint for validating a new Scan process before attempting to actually create it""" def post(self, request): """Validates a new Scan process and returns any warnings discovered :param request: the HTTP POST request :type request: :class:`res...
stack_v2_sparse_classes_36k_train_025172
30,689
permissive
[ { "docstring": "Validates a new Scan process and returns any warnings discovered :param request: the HTTP POST request :type request: :class:`rest_framework.request.Request` :rtype: :class:`rest_framework.response.Response` :returns: the HTTP response to send back to the user", "name": "post", "signatur...
2
stack_v2_sparse_classes_30k_train_002858
Implement the Python class `ScansValidationView` described below. Class description: This view is the endpoint for validating a new Scan process before attempting to actually create it Method signatures and docstrings: - def post(self, request): Validates a new Scan process and returns any warnings discovered :param ...
Implement the Python class `ScansValidationView` described below. Class description: This view is the endpoint for validating a new Scan process before attempting to actually create it Method signatures and docstrings: - def post(self, request): Validates a new Scan process and returns any warnings discovered :param ...
28618aee07ceed9e4a6eb7b8d0e6f05b31d8fd6b
<|skeleton|> class ScansValidationView: """This view is the endpoint for validating a new Scan process before attempting to actually create it""" def post(self, request): """Validates a new Scan process and returns any warnings discovered :param request: the HTTP POST request :type request: :class:`res...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ScansValidationView: """This view is the endpoint for validating a new Scan process before attempting to actually create it""" def post(self, request): """Validates a new Scan process and returns any warnings discovered :param request: the HTTP POST request :type request: :class:`rest_framework.r...
the_stack_v2_python_sparse
scale/ingest/views.py
kfconsultant/scale
train
0
d91a8c1a3cad5d695140c97462da3ab7b49fa1cb
[ "self.graph = graph\nself.weight = weight\nself.threshold = threshold\nself.distance = dict(nx.all_pairs_dijkstra_path_length(self.graph, weight=self.weight))", "def length(nodes):\n return np.sum([self.graph.edges[edge].get(self.weight, 1.0) for edge in zip(nodes[:-1], nodes[1:])])\ncoverage = np.mean([np.exp...
<|body_start_0|> self.graph = graph self.weight = weight self.threshold = threshold self.distance = dict(nx.all_pairs_dijkstra_path_length(self.graph, weight=self.weight)) <|end_body_0|> <|body_start_1|> def length(nodes): return np.sum([self.graph.edges[edge].get(se...
Coverage weighted by length score (CLS). Python doctest: >>> cls = CLS(nx.grid_graph([3, 4])) >>> reference = [(0, 0), (1, 0), (1, 1), (2, 1), (2, 2), (3, 2)] >>> assert np.isclose(cls(reference, reference), 1.0) >>> prediction = [(0, 0), (0, 1), (1, 1), (2, 1), (3, 1), (3, 2)] >>> assert np.isclose(cls(reference, pred...
CLS
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CLS: """Coverage weighted by length score (CLS). Python doctest: >>> cls = CLS(nx.grid_graph([3, 4])) >>> reference = [(0, 0), (1, 0), (1, 1), (2, 1), (2, 2), (3, 2)] >>> assert np.isclose(cls(reference, reference), 1.0) >>> prediction = [(0, 0), (0, 1), (1, 1), (2, 1), (3, 1), (3, 2)] >>> assert...
stack_v2_sparse_classes_36k_train_025173
2,653
permissive
[ { "docstring": "Initializes a CLS object. Args: graph: networkx graph for the environment. weight: networkx edge weight key (str). threshold: distance threshold $d_{th}$ (float).", "name": "__init__", "signature": "def __init__(self, graph, weight='weight', threshold=3.0)" }, { "docstring": "Com...
2
null
Implement the Python class `CLS` described below. Class description: Coverage weighted by length score (CLS). Python doctest: >>> cls = CLS(nx.grid_graph([3, 4])) >>> reference = [(0, 0), (1, 0), (1, 1), (2, 1), (2, 2), (3, 2)] >>> assert np.isclose(cls(reference, reference), 1.0) >>> prediction = [(0, 0), (0, 1), (1,...
Implement the Python class `CLS` described below. Class description: Coverage weighted by length score (CLS). Python doctest: >>> cls = CLS(nx.grid_graph([3, 4])) >>> reference = [(0, 0), (1, 0), (1, 1), (2, 1), (2, 2), (3, 2)] >>> assert np.isclose(cls(reference, reference), 1.0) >>> prediction = [(0, 0), (0, 1), (1,...
dea327aa9e7ef7f7bca5a6c225dbdca1077a06e9
<|skeleton|> class CLS: """Coverage weighted by length score (CLS). Python doctest: >>> cls = CLS(nx.grid_graph([3, 4])) >>> reference = [(0, 0), (1, 0), (1, 1), (2, 1), (2, 2), (3, 2)] >>> assert np.isclose(cls(reference, reference), 1.0) >>> prediction = [(0, 0), (0, 1), (1, 1), (2, 1), (3, 1), (3, 2)] >>> assert...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CLS: """Coverage weighted by length score (CLS). Python doctest: >>> cls = CLS(nx.grid_graph([3, 4])) >>> reference = [(0, 0), (1, 0), (1, 1), (2, 1), (2, 2), (3, 2)] >>> assert np.isclose(cls(reference, reference), 1.0) >>> prediction = [(0, 0), (0, 1), (1, 1), (2, 1), (3, 1), (3, 2)] >>> assert np.isclose(c...
the_stack_v2_python_sparse
r4r/cls.py
Tarkiyah/googleResearch
train
11
d96679ad499aae31ac5a6441972f7f057e12f357
[ "super().__init__(args)\nself.batch_matmul_shapes = [[16, 512, 64, 512]]\nself.dispatches_collection_list = []", "for bmm_shape in bmm_shapes:\n operation = BatchMatmulOperation(bmm_shape, TensorDescription(data_type[0], LayoutType.RowMajor), TensorDescription(data_type[1], LayoutType.RowMajor), TensorDescript...
<|body_start_0|> super().__init__(args) self.batch_matmul_shapes = [[16, 512, 64, 512]] self.dispatches_collection_list = [] <|end_body_0|> <|body_start_1|> for bmm_shape in bmm_shapes: operation = BatchMatmulOperation(bmm_shape, TensorDescription(data_type[0], LayoutType.Ro...
Batch matmul dispatch generator class.
CudaBatchMatmulGenerator
[ "Apache-2.0", "LLVM-exception", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CudaBatchMatmulGenerator: """Batch matmul dispatch generator class.""" def __init__(self, args): """Initializes the batch matmul dispatch generator.""" <|body_0|> def _append_matmul_dispatch_collection(self, bmm_shapes, data_type, configuration_list): """Update t...
stack_v2_sparse_classes_36k_train_025174
11,380
permissive
[ { "docstring": "Initializes the batch matmul dispatch generator.", "name": "__init__", "signature": "def __init__(self, args)" }, { "docstring": "Update the batch matmul dispatch collection with the given configuration list.", "name": "_append_matmul_dispatch_collection", "signature": "d...
5
null
Implement the Python class `CudaBatchMatmulGenerator` described below. Class description: Batch matmul dispatch generator class. Method signatures and docstrings: - def __init__(self, args): Initializes the batch matmul dispatch generator. - def _append_matmul_dispatch_collection(self, bmm_shapes, data_type, configur...
Implement the Python class `CudaBatchMatmulGenerator` described below. Class description: Batch matmul dispatch generator class. Method signatures and docstrings: - def __init__(self, args): Initializes the batch matmul dispatch generator. - def _append_matmul_dispatch_collection(self, bmm_shapes, data_type, configur...
13ef677e556d0a1d154e45b052fe016256057f65
<|skeleton|> class CudaBatchMatmulGenerator: """Batch matmul dispatch generator class.""" def __init__(self, args): """Initializes the batch matmul dispatch generator.""" <|body_0|> def _append_matmul_dispatch_collection(self, bmm_shapes, data_type, configuration_list): """Update t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CudaBatchMatmulGenerator: """Batch matmul dispatch generator class.""" def __init__(self, args): """Initializes the batch matmul dispatch generator.""" super().__init__(args) self.batch_matmul_shapes = [[16, 512, 64, 512]] self.dispatches_collection_list = [] def _app...
the_stack_v2_python_sparse
experimental/dispatch_profiler/batch_matmul.py
openxla/iree
train
387
17de4550a8bb03ab737dcdf55647de45cf68d523
[ "assert isinstance(item, User)\nitem.password = bcrypt.encrypt(item.password)\nsuper().insert(item)", "errors = {}\nif not item.get('firstname'):\n errors['firstname'] = 'First name is required'\nif not item.get('lastname'):\n errors['lastname'] = 'Last name is required'\nif not item.get('username'):\n e...
<|body_start_0|> assert isinstance(item, User) item.password = bcrypt.encrypt(item.password) super().insert(item) <|end_body_0|> <|body_start_1|> errors = {} if not item.get('firstname'): errors['firstname'] = 'First name is required' if not item.get('lastnam...
UserCollection
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserCollection: def insert(self, item): """Encrypt password before adding user into the collection""" <|body_0|> def is_valid(self, item): """Check if the response has valid user details""" <|body_1|> <|end_skeleton|> <|body_start_0|> assert isinsta...
stack_v2_sparse_classes_36k_train_025175
4,439
no_license
[ { "docstring": "Encrypt password before adding user into the collection", "name": "insert", "signature": "def insert(self, item)" }, { "docstring": "Check if the response has valid user details", "name": "is_valid", "signature": "def is_valid(self, item)" } ]
2
stack_v2_sparse_classes_30k_train_006882
Implement the Python class `UserCollection` described below. Class description: Implement the UserCollection class. Method signatures and docstrings: - def insert(self, item): Encrypt password before adding user into the collection - def is_valid(self, item): Check if the response has valid user details
Implement the Python class `UserCollection` described below. Class description: Implement the UserCollection class. Method signatures and docstrings: - def insert(self, item): Encrypt password before adding user into the collection - def is_valid(self, item): Check if the response has valid user details <|skeleton|>...
22228f996b8e1d7d571bc6ade184087c396da655
<|skeleton|> class UserCollection: def insert(self, item): """Encrypt password before adding user into the collection""" <|body_0|> def is_valid(self, item): """Check if the response has valid user details""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserCollection: def insert(self, item): """Encrypt password before adding user into the collection""" assert isinstance(item, User) item.password = bcrypt.encrypt(item.password) super().insert(item) def is_valid(self, item): """Check if the response has valid user ...
the_stack_v2_python_sparse
API/v1/data_store/collections.py
gitaumoses4/maintenance-tracker
train
2
a240bec196f7bd6d82fd9d657c39e2d362513690
[ "try:\n logger.info('上传片头,片尾等图片测试')\n self.login()\n texts = self.upload()\n self.assertEqual(texts, ['上传文件成功!', '上传文件成功!', '上传文件成功!', '上传文件成功!', '上传文件成功!'])\nexcept Exception as msg:\n logger.error(u'异常原因:%s' % msg)\n self.driver.get_screenshot_as_file(os.path.join(readconfig.screen_path, 'test_u...
<|body_start_0|> try: logger.info('上传片头,片尾等图片测试') self.login() texts = self.upload() self.assertEqual(texts, ['上传文件成功!', '上传文件成功!', '上传文件成功!', '上传文件成功!', '上传文件成功!']) except Exception as msg: logger.error(u'异常原因:%s' % msg) self.drive...
片头片尾相关功能测试
HeadTailTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HeadTailTest: """片头片尾相关功能测试""" def test_upload(self): """上传片头,片尾等图片测试""" <|body_0|> def test_set_title_trailer_time(self): """片头片尾机显示视频信息测试""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: logger.info('上传片头,片尾等图片测试') ...
stack_v2_sparse_classes_36k_train_025176
1,940
no_license
[ { "docstring": "上传片头,片尾等图片测试", "name": "test_upload", "signature": "def test_upload(self)" }, { "docstring": "片头片尾机显示视频信息测试", "name": "test_set_title_trailer_time", "signature": "def test_set_title_trailer_time(self)" } ]
2
null
Implement the Python class `HeadTailTest` described below. Class description: 片头片尾相关功能测试 Method signatures and docstrings: - def test_upload(self): 上传片头,片尾等图片测试 - def test_set_title_trailer_time(self): 片头片尾机显示视频信息测试
Implement the Python class `HeadTailTest` described below. Class description: 片头片尾相关功能测试 Method signatures and docstrings: - def test_upload(self): 上传片头,片尾等图片测试 - def test_set_title_trailer_time(self): 片头片尾机显示视频信息测试 <|skeleton|> class HeadTailTest: """片头片尾相关功能测试""" def test_upload(self): """上传片头,片尾等...
fd552eeb47fd4838c2c5caef4deea7480ab75ce9
<|skeleton|> class HeadTailTest: """片头片尾相关功能测试""" def test_upload(self): """上传片头,片尾等图片测试""" <|body_0|> def test_set_title_trailer_time(self): """片头片尾机显示视频信息测试""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HeadTailTest: """片头片尾相关功能测试""" def test_upload(self): """上传片头,片尾等图片测试""" try: logger.info('上传片头,片尾等图片测试') self.login() texts = self.upload() self.assertEqual(texts, ['上传文件成功!', '上传文件成功!', '上传文件成功!', '上传文件成功!', '上传文件成功!']) except Exce...
the_stack_v2_python_sparse
test_case/B004_head_tail_test.py
luhuifnag/AVA_UIauto_test
train
0
c1f4411390ee078534c99a7c6f52ff9ac7ea58b4
[ "self.capacity = capacity\nself.head = {}\nself.tail = {}\nself.head['next'] = self.tail\nself.tail['prev'] = self.head\nself.cache = {}", "if key not in self.cache:\n return -1\nnode = self.cache.get(key)\nnode['prev']['next'] = node['next']\nnode['next']['prev'] = node['prev']\nnode['next'] = self.tail\nnode...
<|body_start_0|> self.capacity = capacity self.head = {} self.tail = {} self.head['next'] = self.tail self.tail['prev'] = self.head self.cache = {} <|end_body_0|> <|body_start_1|> if key not in self.cache: return -1 node = self.cache.get(key) ...
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity: int): """init empty head and empty tail dict point the head and tail to each other init empty cache dict""" <|body_0|> def get(self, key: int) -> int: """if key is not in the cache, return -1 re-position the key's prev's next an...
stack_v2_sparse_classes_36k_train_025177
3,112
no_license
[ { "docstring": "init empty head and empty tail dict point the head and tail to each other init empty cache dict", "name": "__init__", "signature": "def __init__(self, capacity: int)" }, { "docstring": "if key is not in the cache, return -1 re-position the key's prev's next and the next's prev po...
3
stack_v2_sparse_classes_30k_train_021307
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity: int): init empty head and empty tail dict point the head and tail to each other init empty cache dict - def get(self, key: int) -> int: if key is not...
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity: int): init empty head and empty tail dict point the head and tail to each other init empty cache dict - def get(self, key: int) -> int: if key is not...
8499dcee8c1f3e310a39153324216d25c3ca36cf
<|skeleton|> class LRUCache: def __init__(self, capacity: int): """init empty head and empty tail dict point the head and tail to each other init empty cache dict""" <|body_0|> def get(self, key: int) -> int: """if key is not in the cache, return -1 re-position the key's prev's next an...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LRUCache: def __init__(self, capacity: int): """init empty head and empty tail dict point the head and tail to each other init empty cache dict""" self.capacity = capacity self.head = {} self.tail = {} self.head['next'] = self.tail self.tail['prev'] = self.head ...
the_stack_v2_python_sparse
leetCode/py3/lru_cache.py
spark721/ds_al
train
0
db51d54f75ae6bff35a70ae7afa7d0c3cb11d26a
[ "args = parser.parse_args()\nname = args.get('name')\npgnum = args.get('pgnum')\nif not pgnum:\n pgnum = 1\noptions = {'name': name, 'pgnum': pgnum}\nrole, pg = role_list_c(options)\nresponse_data = {'code': 1200, 'ok': True, 'data': role, 'msg': '获取角色信息成功', 'pg': pg}\nreturn response_data", "args = parser.par...
<|body_start_0|> args = parser.parse_args() name = args.get('name') pgnum = args.get('pgnum') if not pgnum: pgnum = 1 options = {'name': name, 'pgnum': pgnum} role, pg = role_list_c(options) response_data = {'code': 1200, 'ok': True, 'data': role, 'msg...
RoleManage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RoleManage: def get(self): """获取角色信息 --- tags: - role summary: Add a new pet to the store parameters: - in: query name: name type: string description: 角色名 - in: query name: pgnum type: string description: 页码 responses: 200: description: 获取角色信息 schema: id: Role properties: name: type: str...
stack_v2_sparse_classes_36k_train_025178
5,564
no_license
[ { "docstring": "获取角色信息 --- tags: - role summary: Add a new pet to the store parameters: - in: query name: name type: string description: 角色名 - in: query name: pgnum type: string description: 页码 responses: 200: description: 获取角色信息 schema: id: Role properties: name: type: string description: The name of the user ...
4
stack_v2_sparse_classes_30k_train_007807
Implement the Python class `RoleManage` described below. Class description: Implement the RoleManage class. Method signatures and docstrings: - def get(self): 获取角色信息 --- tags: - role summary: Add a new pet to the store parameters: - in: query name: name type: string description: 角色名 - in: query name: pgnum type: stri...
Implement the Python class `RoleManage` described below. Class description: Implement the RoleManage class. Method signatures and docstrings: - def get(self): 获取角色信息 --- tags: - role summary: Add a new pet to the store parameters: - in: query name: name type: string description: 角色名 - in: query name: pgnum type: stri...
73246bbd492fd991e0329b9a011b5380b11a1618
<|skeleton|> class RoleManage: def get(self): """获取角色信息 --- tags: - role summary: Add a new pet to the store parameters: - in: query name: name type: string description: 角色名 - in: query name: pgnum type: string description: 页码 responses: 200: description: 获取角色信息 schema: id: Role properties: name: type: str...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RoleManage: def get(self): """获取角色信息 --- tags: - role summary: Add a new pet to the store parameters: - in: query name: name type: string description: 角色名 - in: query name: pgnum type: string description: 页码 responses: 200: description: 获取角色信息 schema: id: Role properties: name: type: string descriptio...
the_stack_v2_python_sparse
app/main/base/apis/role.py
zhouliang0v0/naguan-kpy
train
0
18ff1b945320dfcdb39010ff71532dbee8b13d88
[ "descriptor = self._select(self._descriptors)\nnoun = self._select(self._nouns)\nnumbers = ''.join((self._select(chars) for _ in range(length)))\nreturn delim.join([descriptor, noun, numbers])", "if len(select_from) <= 0:\n return ''\nreturn choice(select_from)" ]
<|body_start_0|> descriptor = self._select(self._descriptors) noun = self._select(self._nouns) numbers = ''.join((self._select(chars) for _ in range(length))) return delim.join([descriptor, noun, numbers]) <|end_body_0|> <|body_start_1|> if len(select_from) <= 0: ret...
RobotNamer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RobotNamer: def generate(self, delim='-', length=4, chars='0123456789'): """Generate a robot name. Inspiration from Haikunator, but much more poorly implemented ;) Parameters ========== delim: Delimiter length: TokenLength chars: TokenChars""" <|body_0|> def _select(self, se...
stack_v2_sparse_classes_36k_train_025179
4,323
permissive
[ { "docstring": "Generate a robot name. Inspiration from Haikunator, but much more poorly implemented ;) Parameters ========== delim: Delimiter length: TokenLength chars: TokenChars", "name": "generate", "signature": "def generate(self, delim='-', length=4, chars='0123456789')" }, { "docstring": ...
2
null
Implement the Python class `RobotNamer` described below. Class description: Implement the RobotNamer class. Method signatures and docstrings: - def generate(self, delim='-', length=4, chars='0123456789'): Generate a robot name. Inspiration from Haikunator, but much more poorly implemented ;) Parameters ========== del...
Implement the Python class `RobotNamer` described below. Class description: Implement the RobotNamer class. Method signatures and docstrings: - def generate(self, delim='-', length=4, chars='0123456789'): Generate a robot name. Inspiration from Haikunator, but much more poorly implemented ;) Parameters ========== del...
31fd3fb1233f39ea2252a7a44160ff8a2140f7bd
<|skeleton|> class RobotNamer: def generate(self, delim='-', length=4, chars='0123456789'): """Generate a robot name. Inspiration from Haikunator, but much more poorly implemented ;) Parameters ========== delim: Delimiter length: TokenLength chars: TokenChars""" <|body_0|> def _select(self, se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RobotNamer: def generate(self, delim='-', length=4, chars='0123456789'): """Generate a robot name. Inspiration from Haikunator, but much more poorly implemented ;) Parameters ========== delim: Delimiter length: TokenLength chars: TokenChars""" descriptor = self._select(self._descriptors) ...
the_stack_v2_python_sparse
Python/Telegram_Bot/markovmeme/namer.py
HarshCasper/Rotten-Scripts
train
1,474
a3f1dbccdcb751e47254742818a93ef6ca6fc047
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('yjunchoi_yzhang71', 'yjunchoi_yzhang71')\nPL = repo['yjunchoi_yzhang71.pollingLocation'].find()\nPE = repo['yjunchoi_yzhang71.presidentElectionByPrecinct'].find()\nmapPEList = []\nvoterTotal = 0\nfor row...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('yjunchoi_yzhang71', 'yjunchoi_yzhang71') PL = repo['yjunchoi_yzhang71.pollingLocation'].find() PE = repo['yjunchoi_yzhang71.presidentElectionByPre...
countPollingLocationByWard
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class countPollingLocationByWard: def execute(trial=False): """Merging data sets""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everything happening in this script. Each run of the scr...
stack_v2_sparse_classes_36k_train_025180
5,202
no_license
[ { "docstring": "Merging data sets", "name": "execute", "signature": "def execute(trial=False)" }, { "docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new document describing that invocation event.", "name": "pr...
2
null
Implement the Python class `countPollingLocationByWard` described below. Class description: Implement the countPollingLocationByWard class. Method signatures and docstrings: - def execute(trial=False): Merging data sets - def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): Create the provenan...
Implement the Python class `countPollingLocationByWard` described below. Class description: Implement the countPollingLocationByWard class. Method signatures and docstrings: - def execute(trial=False): Merging data sets - def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): Create the provenan...
97e72731ffadbeae57d7a332decd58706e7c08de
<|skeleton|> class countPollingLocationByWard: def execute(trial=False): """Merging data sets""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everything happening in this script. Each run of the scr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class countPollingLocationByWard: def execute(trial=False): """Merging data sets""" startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('yjunchoi_yzhang71', 'yjunchoi_yzhang71') PL = repo['yjunchoi_yzhang71.polli...
the_stack_v2_python_sparse
yjunchoi_yzhang71/countPollingLocationByWard.py
ROODAY/course-2017-fal-proj
train
3
02d264799b8f25eda1bd7c799735a4538b695e68
[ "timestamp = self._GetRowValue(query_hash, row, value_name)\nif timestamp is None:\n return None\nreturn dfdatetime_cocoa_time.CocoaTime(timestamp=timestamp)", "query_hash = hash(query)\nzhtmlstring = self._GetRowValue(query_hash, row, 'zhtmlstring')\ntext_extractor = _ZHTMLStringTextExtractor()\ntext = text_e...
<|body_start_0|> timestamp = self._GetRowValue(query_hash, row, value_name) if timestamp is None: return None return dfdatetime_cocoa_time.CocoaTime(timestamp=timestamp) <|end_body_0|> <|body_start_1|> query_hash = hash(query) zhtmlstring = self._GetRowValue(query_ha...
SQLite parser plugin for MacOS notes database files. The MacOS Notes database file is typically stored in: test_data/NotesV7.storedata
MacOSNotesPlugin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MacOSNotesPlugin: """SQLite parser plugin for MacOS notes database files. The MacOS Notes database file is typically stored in: test_data/NotesV7.storedata""" def _GetDateTimeRowValue(self, query_hash, row, value_name): """Retrieves a date and time value from the row. Args: query_has...
stack_v2_sparse_classes_36k_train_025181
7,734
permissive
[ { "docstring": "Retrieves a date and time value from the row. Args: query_hash (int): hash of the query, that uniquely identifies the query that produced the row. row (sqlite3.Row): row. value_name (str): name of the value. Returns: dfdatetime.CocoaTime: date and time value or None if not available.", "name...
2
stack_v2_sparse_classes_30k_train_017329
Implement the Python class `MacOSNotesPlugin` described below. Class description: SQLite parser plugin for MacOS notes database files. The MacOS Notes database file is typically stored in: test_data/NotesV7.storedata Method signatures and docstrings: - def _GetDateTimeRowValue(self, query_hash, row, value_name): Retr...
Implement the Python class `MacOSNotesPlugin` described below. Class description: SQLite parser plugin for MacOS notes database files. The MacOS Notes database file is typically stored in: test_data/NotesV7.storedata Method signatures and docstrings: - def _GetDateTimeRowValue(self, query_hash, row, value_name): Retr...
d6022f8cfebfddf2d08ab2d300a41b61f3349933
<|skeleton|> class MacOSNotesPlugin: """SQLite parser plugin for MacOS notes database files. The MacOS Notes database file is typically stored in: test_data/NotesV7.storedata""" def _GetDateTimeRowValue(self, query_hash, row, value_name): """Retrieves a date and time value from the row. Args: query_has...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MacOSNotesPlugin: """SQLite parser plugin for MacOS notes database files. The MacOS Notes database file is typically stored in: test_data/NotesV7.storedata""" def _GetDateTimeRowValue(self, query_hash, row, value_name): """Retrieves a date and time value from the row. Args: query_hash (int): hash...
the_stack_v2_python_sparse
plaso/parsers/sqlite_plugins/macos_notes.py
log2timeline/plaso
train
1,506
c55960c80f23835a9bafb2dce4d22c3ae89bd214
[ "request_payload = {}\nc = commons.parse_coordinates(coordinates).transform_to('icrs')\nra_dec_str = str(c.ra.hour) + ' ' + str(c.dec.degree)\nrequest_payload['RA'] = ra_dec_str\nrequest_payload['Equinox'] = 'J2000'\nrequest_payload['ImageSize'] = coord.Angle(image_size).arcmin\nrequest_payload['ImageType'] = 'FITS...
<|body_start_0|> request_payload = {} c = commons.parse_coordinates(coordinates).transform_to('icrs') ra_dec_str = str(c.ra.hour) + ' ' + str(c.dec.degree) request_payload['RA'] = ra_dec_str request_payload['Equinox'] = 'J2000' request_payload['ImageSize'] = coord.Angle(i...
FirstClass
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FirstClass: def _args_to_payload(self, coordinates, *, image_size=1 * u.arcmin, maximsize=None): """Fetches image cutouts from FIRST survey. Parameters ---------- coordinates : str or `astropy.coordinates` object The target around which to search. It may be specified as a string in which...
stack_v2_sparse_classes_36k_train_025182
3,737
permissive
[ { "docstring": "Fetches image cutouts from FIRST survey. Parameters ---------- coordinates : str or `astropy.coordinates` object The target around which to search. It may be specified as a string in which case it is resolved using online services or as the appropriate `astropy.coordinates` object. ICRS coordina...
3
stack_v2_sparse_classes_30k_train_019297
Implement the Python class `FirstClass` described below. Class description: Implement the FirstClass class. Method signatures and docstrings: - def _args_to_payload(self, coordinates, *, image_size=1 * u.arcmin, maximsize=None): Fetches image cutouts from FIRST survey. Parameters ---------- coordinates : str or `astr...
Implement the Python class `FirstClass` described below. Class description: Implement the FirstClass class. Method signatures and docstrings: - def _args_to_payload(self, coordinates, *, image_size=1 * u.arcmin, maximsize=None): Fetches image cutouts from FIRST survey. Parameters ---------- coordinates : str or `astr...
51316d7417d7daf01a8b29d1df99037b9227c2bc
<|skeleton|> class FirstClass: def _args_to_payload(self, coordinates, *, image_size=1 * u.arcmin, maximsize=None): """Fetches image cutouts from FIRST survey. Parameters ---------- coordinates : str or `astropy.coordinates` object The target around which to search. It may be specified as a string in which...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FirstClass: def _args_to_payload(self, coordinates, *, image_size=1 * u.arcmin, maximsize=None): """Fetches image cutouts from FIRST survey. Parameters ---------- coordinates : str or `astropy.coordinates` object The target around which to search. It may be specified as a string in which case it is re...
the_stack_v2_python_sparse
astroquery/image_cutouts/first/core.py
astropy/astroquery
train
636
f73e4bcf78273940cbba1f31c19d6d28be77824b
[ "for fld in ['TargetNameFields', 'TargetInfoFields']:\n yield (fld, self[fld])\nreturn", "for _, item in self.enumerate():\n yield item\nreturn", "for item in self.iterate():\n yield item\nreturn" ]
<|body_start_0|> for fld in ['TargetNameFields', 'TargetInfoFields']: yield (fld, self[fld]) return <|end_body_0|> <|body_start_1|> for _, item in self.enumerate(): yield item return <|end_body_1|> <|body_start_2|> for item in self.iterate(): ...
CHALLENGE_MESSAGE
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CHALLENGE_MESSAGE: def enumerate(self): """Yield the name and field that compose the message type payload.""" <|body_0|> def iterate(self): """Yield each field that composes the message type payload.""" <|body_1|> def Fields(self): """Yield all o...
stack_v2_sparse_classes_36k_train_025183
31,838
permissive
[ { "docstring": "Yield the name and field that compose the message type payload.", "name": "enumerate", "signature": "def enumerate(self)" }, { "docstring": "Yield each field that composes the message type payload.", "name": "iterate", "signature": "def iterate(self)" }, { "docstr...
3
null
Implement the Python class `CHALLENGE_MESSAGE` described below. Class description: Implement the CHALLENGE_MESSAGE class. Method signatures and docstrings: - def enumerate(self): Yield the name and field that compose the message type payload. - def iterate(self): Yield each field that composes the message type payloa...
Implement the Python class `CHALLENGE_MESSAGE` described below. Class description: Implement the CHALLENGE_MESSAGE class. Method signatures and docstrings: - def enumerate(self): Yield the name and field that compose the message type payload. - def iterate(self): Yield each field that composes the message type payloa...
e02b014dc764ed822288210248c9438a843af8a9
<|skeleton|> class CHALLENGE_MESSAGE: def enumerate(self): """Yield the name and field that compose the message type payload.""" <|body_0|> def iterate(self): """Yield each field that composes the message type payload.""" <|body_1|> def Fields(self): """Yield all o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CHALLENGE_MESSAGE: def enumerate(self): """Yield the name and field that compose the message type payload.""" for fld in ['TargetNameFields', 'TargetInfoFields']: yield (fld, self[fld]) return def iterate(self): """Yield each field that composes the message typ...
the_stack_v2_python_sparse
template/protocol/nlmp.py
arizvisa/syringe
train
36
9f961a4a2ab99e5eec3193af6039e5b57ad5bfce
[ "_input = DataFrame({'A': [1, 2, 3]})\n_expected = DataFrame({'A': [1, 2, 3]})\n_groupings = [{'operator': 'difference', 'columns': ['A'], 'value': 0}]\n_vc = VariableCleaner(_input)\n_vc.clean(_groupings)\nassert_frame_equal(_expected, _vc.frame)", "_input = DataFrame({'A': [1, 2, 3]})\n_expected = DataFrame({'A...
<|body_start_0|> _input = DataFrame({'A': [1, 2, 3]}) _expected = DataFrame({'A': [1, 2, 3]}) _groupings = [{'operator': 'difference', 'columns': ['A'], 'value': 0}] _vc = VariableCleaner(_input) _vc.clean(_groupings) assert_frame_equal(_expected, _vc.frame) <|end_body_0|...
Tests for the ``preprocess._aggregate_columns._difference`` module. Assert final data frames match expectations.
PreprocessConstantDifferenceTests
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PreprocessConstantDifferenceTests: """Tests for the ``preprocess._aggregate_columns._difference`` module. Assert final data frames match expectations.""" def test_clean_difference_ints_0(): """Test subtracting 0 from a column.""" <|body_0|> def test_clean_difference_ints...
stack_v2_sparse_classes_36k_train_025184
5,083
permissive
[ { "docstring": "Test subtracting 0 from a column.", "name": "test_clean_difference_ints_0", "signature": "def test_clean_difference_ints_0()" }, { "docstring": "Test subtracting 1 from a column.", "name": "test_clean_difference_ints_1", "signature": "def test_clean_difference_ints_1()" ...
4
stack_v2_sparse_classes_30k_train_011841
Implement the Python class `PreprocessConstantDifferenceTests` described below. Class description: Tests for the ``preprocess._aggregate_columns._difference`` module. Assert final data frames match expectations. Method signatures and docstrings: - def test_clean_difference_ints_0(): Test subtracting 0 from a column. ...
Implement the Python class `PreprocessConstantDifferenceTests` described below. Class description: Tests for the ``preprocess._aggregate_columns._difference`` module. Assert final data frames match expectations. Method signatures and docstrings: - def test_clean_difference_ints_0(): Test subtracting 0 from a column. ...
2e89bc55a61ce2a4ce77646bb427f5b3040f672c
<|skeleton|> class PreprocessConstantDifferenceTests: """Tests for the ``preprocess._aggregate_columns._difference`` module. Assert final data frames match expectations.""" def test_clean_difference_ints_0(): """Test subtracting 0 from a column.""" <|body_0|> def test_clean_difference_ints...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PreprocessConstantDifferenceTests: """Tests for the ``preprocess._aggregate_columns._difference`` module. Assert final data frames match expectations.""" def test_clean_difference_ints_0(): """Test subtracting 0 from a column.""" _input = DataFrame({'A': [1, 2, 3]}) _expected = Da...
the_stack_v2_python_sparse
numom2b_preprocessing/unittests/cleaning_tests/test_difference.py
hayesall/nuMoM2b_preprocessing
train
2
65be1fcf50a650c9e5286a0c1028136ca431d64b
[ "if not head or not head.next:\n return head\nlength, cur = (1, head)\nwhile cur.next:\n cur = cur.next\n length += 1\ncur.next = head\ncur, tail = (head, cur)\nfor _ in xrange(length - k % length):\n tail = cur\n cur = cur.next\ntail.next = None\nreturn cur", "if not head or not head.next:\n re...
<|body_start_0|> if not head or not head.next: return head length, cur = (1, head) while cur.next: cur = cur.next length += 1 cur.next = head cur, tail = (head, cur) for _ in xrange(length - k % length): tail = cur ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rotateRight(self, head, k): """:type head: ListNode :type k: int :rtype: ListNode""" <|body_0|> def rotate_without_count(self, head, k): """不需要计算链表的长度, 但是当K很大时, 会遍历多次, 浪费时间 :type head: ListNode :type k: int :rtype: ListNode""" <|body_1|> <|end_...
stack_v2_sparse_classes_36k_train_025185
1,740
no_license
[ { "docstring": ":type head: ListNode :type k: int :rtype: ListNode", "name": "rotateRight", "signature": "def rotateRight(self, head, k)" }, { "docstring": "不需要计算链表的长度, 但是当K很大时, 会遍历多次, 浪费时间 :type head: ListNode :type k: int :rtype: ListNode", "name": "rotate_without_count", "signature": ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotateRight(self, head, k): :type head: ListNode :type k: int :rtype: ListNode - def rotate_without_count(self, head, k): 不需要计算链表的长度, 但是当K很大时, 会遍历多次, 浪费时间 :type head: ListNod...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotateRight(self, head, k): :type head: ListNode :type k: int :rtype: ListNode - def rotate_without_count(self, head, k): 不需要计算链表的长度, 但是当K很大时, 会遍历多次, 浪费时间 :type head: ListNod...
215d513b3564a7a76db3d2b29e4acc341a68e8ee
<|skeleton|> class Solution: def rotateRight(self, head, k): """:type head: ListNode :type k: int :rtype: ListNode""" <|body_0|> def rotate_without_count(self, head, k): """不需要计算链表的长度, 但是当K很大时, 会遍历多次, 浪费时间 :type head: ListNode :type k: int :rtype: ListNode""" <|body_1|> <|end_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rotateRight(self, head, k): """:type head: ListNode :type k: int :rtype: ListNode""" if not head or not head.next: return head length, cur = (1, head) while cur.next: cur = cur.next length += 1 cur.next = head cu...
the_stack_v2_python_sparse
python/two-pointer/rotate-list.py
euxuoh/leetcode
train
0
47c71ca91a7dd0bd27a51e4b155dab3c1279b638
[ "video = VideosPerm.objects.filter(videos_id=self, username=healthcare, perm_value__in=[2, 3])\nif video.count() == 0:\n return False\nelse:\n return True", "if self.patient_id == patient:\n return True\nelse:\n return False" ]
<|body_start_0|> video = VideosPerm.objects.filter(videos_id=self, username=healthcare, perm_value__in=[2, 3]) if video.count() == 0: return False else: return True <|end_body_0|> <|body_start_1|> if self.patient_id == patient: return True els...
Videos
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Videos: def has_permission(self, healthcare): """Checks if a user has permissions to view the video.""" <|body_0|> def is_patient(self, patient): """Checks if the record belongs to the patient.""" <|body_1|> <|end_skeleton|> <|body_start_0|> video =...
stack_v2_sparse_classes_36k_train_025186
12,031
no_license
[ { "docstring": "Checks if a user has permissions to view the video.", "name": "has_permission", "signature": "def has_permission(self, healthcare)" }, { "docstring": "Checks if the record belongs to the patient.", "name": "is_patient", "signature": "def is_patient(self, patient)" } ]
2
null
Implement the Python class `Videos` described below. Class description: Implement the Videos class. Method signatures and docstrings: - def has_permission(self, healthcare): Checks if a user has permissions to view the video. - def is_patient(self, patient): Checks if the record belongs to the patient.
Implement the Python class `Videos` described below. Class description: Implement the Videos class. Method signatures and docstrings: - def has_permission(self, healthcare): Checks if a user has permissions to view the video. - def is_patient(self, patient): Checks if the record belongs to the patient. <|skeleton|> ...
685c2b9d40fb24ca1735352846a39fdf5d3728eb
<|skeleton|> class Videos: def has_permission(self, healthcare): """Checks if a user has permissions to view the video.""" <|body_0|> def is_patient(self, patient): """Checks if the record belongs to the patient.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Videos: def has_permission(self, healthcare): """Checks if a user has permissions to view the video.""" video = VideosPerm.objects.filter(videos_id=self, username=healthcare, perm_value__in=[2, 3]) if video.count() == 0: return False else: return True ...
the_stack_v2_python_sparse
patientrecords/models.py
guekling/ifs4205team1
train
0
518ded4a160bfb0dbd8c78461458c62ad7c9bd04
[ "if component is None:\n return\nif isinstance(component, INotifiable):\n component.notify(correlation_id, args)", "if components is None:\n return\nargs = args if not args is None else Parameters()\nfor component in components:\n Notifier.notify_one(correlation_id, component, args)" ]
<|body_start_0|> if component is None: return if isinstance(component, INotifiable): component.notify(correlation_id, args) <|end_body_0|> <|body_start_1|> if components is None: return args = args if not args is None else Parameters() for com...
Helper class that notifies components.
Notifier
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Notifier: """Helper class that notifies components.""" def notify_one(correlation_id: Optional[str], component: Any, args: Parameters): """Notifies specific component. To be notiied components must implement :class:`INotifiable <pip_services3_commons.run.INotifiable.INotifiable>` int...
stack_v2_sparse_classes_36k_train_025187
2,000
permissive
[ { "docstring": "Notifies specific component. To be notiied components must implement :class:`INotifiable <pip_services3_commons.run.INotifiable.INotifiable>` interface. If they don't the call to this method has no effect. :param correlation_id: (optional) transaction id to trace execution through call chain. :p...
2
null
Implement the Python class `Notifier` described below. Class description: Helper class that notifies components. Method signatures and docstrings: - def notify_one(correlation_id: Optional[str], component: Any, args: Parameters): Notifies specific component. To be notiied components must implement :class:`INotifiable...
Implement the Python class `Notifier` described below. Class description: Helper class that notifies components. Method signatures and docstrings: - def notify_one(correlation_id: Optional[str], component: Any, args: Parameters): Notifies specific component. To be notiied components must implement :class:`INotifiable...
17f8a231fb75684032ec57b24025c9a3ca3dcdd6
<|skeleton|> class Notifier: """Helper class that notifies components.""" def notify_one(correlation_id: Optional[str], component: Any, args: Parameters): """Notifies specific component. To be notiied components must implement :class:`INotifiable <pip_services3_commons.run.INotifiable.INotifiable>` int...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Notifier: """Helper class that notifies components.""" def notify_one(correlation_id: Optional[str], component: Any, args: Parameters): """Notifies specific component. To be notiied components must implement :class:`INotifiable <pip_services3_commons.run.INotifiable.INotifiable>` interface. If th...
the_stack_v2_python_sparse
pip_services3_commons/run/Notifier.py
pip-services3-python/pip-services3-commons-python
train
0
85e28405e5fc34617e37429fafc14ae82bc4ba14
[ "if _has_content(self):\n chunk_size = cast(int, self._connection_data_block_size)\n for i in range(0, len(self.content), chunk_size):\n yield self.content[i:i + chunk_size]\nelse:\n for part in _stream_download_helper(decompress=True, response=self):\n yield part\nself.close()", "for raw_b...
<|body_start_0|> if _has_content(self): chunk_size = cast(int, self._connection_data_block_size) for i in range(0, len(self.content), chunk_size): yield self.content[i:i + chunk_size] else: for part in _stream_download_helper(decompress=True, response=...
RestRequestsTransportResponse
[ "MIT", "LicenseRef-scancode-generic-cla", "LGPL-2.1-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RestRequestsTransportResponse: def iter_bytes(self): """Iterates over the response's bytes. Will decompress in the process :return: An iterator of bytes from the response :rtype: Iterator[str]""" <|body_0|> def iter_raw(self): """Iterates over the response's bytes. W...
stack_v2_sparse_classes_36k_train_025188
5,630
permissive
[ { "docstring": "Iterates over the response's bytes. Will decompress in the process :return: An iterator of bytes from the response :rtype: Iterator[str]", "name": "iter_bytes", "signature": "def iter_bytes(self)" }, { "docstring": "Iterates over the response's bytes. Will not decompress in the p...
3
stack_v2_sparse_classes_30k_train_004269
Implement the Python class `RestRequestsTransportResponse` described below. Class description: Implement the RestRequestsTransportResponse class. Method signatures and docstrings: - def iter_bytes(self): Iterates over the response's bytes. Will decompress in the process :return: An iterator of bytes from the response...
Implement the Python class `RestRequestsTransportResponse` described below. Class description: Implement the RestRequestsTransportResponse class. Method signatures and docstrings: - def iter_bytes(self): Iterates over the response's bytes. Will decompress in the process :return: An iterator of bytes from the response...
b2bdfe659210998d6d479e73b133b6c51eb2c009
<|skeleton|> class RestRequestsTransportResponse: def iter_bytes(self): """Iterates over the response's bytes. Will decompress in the process :return: An iterator of bytes from the response :rtype: Iterator[str]""" <|body_0|> def iter_raw(self): """Iterates over the response's bytes. W...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RestRequestsTransportResponse: def iter_bytes(self): """Iterates over the response's bytes. Will decompress in the process :return: An iterator of bytes from the response :rtype: Iterator[str]""" if _has_content(self): chunk_size = cast(int, self._connection_data_block_size) ...
the_stack_v2_python_sparse
sdk/core/azure-core/azure/core/rest/_requests_basic.py
adriananeci/azure-sdk-for-python
train
1
74221624a22d31c8b2d1df4a5024a1190ddd40b6
[ "ori_shapes = tuple((meta['ori_shape'] for meta in img_metas))\nscale_factors = tuple((meta['scale_factor'] for meta in img_metas))\nif isinstance(scale_factors[0], float):\n warnings.warn('Scale factor in img_metas should be a ndarray with shape (4,) arrange as (factor_w, factor_h, factor_w, factor_h), The scal...
<|body_start_0|> ori_shapes = tuple((meta['ori_shape'] for meta in img_metas)) scale_factors = tuple((meta['scale_factor'] for meta in img_metas)) if isinstance(scale_factors[0], float): warnings.warn('Scale factor in img_metas should be a ndarray with shape (4,) arrange as (factor_w...
MaskTestMixin
[ "Apache-2.0", "BSD-2-Clause-Views", "MIT", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MaskTestMixin: def simple_test_mask(self, x, img_metas, det_bboxes, det_labels, rescale=False): """Simple test for mask head without augmentation.""" <|body_0|> def aug_test_mask(self, feats, img_metas, det_bboxes, det_labels): """Test for mask head with test time au...
stack_v2_sparse_classes_36k_train_025189
13,557
permissive
[ { "docstring": "Simple test for mask head without augmentation.", "name": "simple_test_mask", "signature": "def simple_test_mask(self, x, img_metas, det_bboxes, det_labels, rescale=False)" }, { "docstring": "Test for mask head with test time augmentation.", "name": "aug_test_mask", "sign...
2
null
Implement the Python class `MaskTestMixin` described below. Class description: Implement the MaskTestMixin class. Method signatures and docstrings: - def simple_test_mask(self, x, img_metas, det_bboxes, det_labels, rescale=False): Simple test for mask head without augmentation. - def aug_test_mask(self, feats, img_me...
Implement the Python class `MaskTestMixin` described below. Class description: Implement the MaskTestMixin class. Method signatures and docstrings: - def simple_test_mask(self, x, img_metas, det_bboxes, det_labels, rescale=False): Simple test for mask head without augmentation. - def aug_test_mask(self, feats, img_me...
3652b18c7ce68122dae7a32670624727d50e0914
<|skeleton|> class MaskTestMixin: def simple_test_mask(self, x, img_metas, det_bboxes, det_labels, rescale=False): """Simple test for mask head without augmentation.""" <|body_0|> def aug_test_mask(self, feats, img_metas, det_bboxes, det_labels): """Test for mask head with test time au...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MaskTestMixin: def simple_test_mask(self, x, img_metas, det_bboxes, det_labels, rescale=False): """Simple test for mask head without augmentation.""" ori_shapes = tuple((meta['ori_shape'] for meta in img_metas)) scale_factors = tuple((meta['scale_factor'] for meta in img_metas)) ...
the_stack_v2_python_sparse
mmdet/models/roi_heads/test_mixins.py
shinya7y/UniverseNet
train
407
fa80ffa5f9e2f1eefcacd7f4fdd044de9574029e
[ "if name is None:\n name = self._default_cache_dir\nif dirpath is None:\n dirpath = self._default_cache_dir\ncachedir = self._default_cache_dir\nif not os.path.exists(cachedir):\n os.makedirs(cachedir)\nself._name = name\ncachefile = self._default_cache_dir + '/' + name\nself._dbm = _gdbm.open(cachefile, '...
<|body_start_0|> if name is None: name = self._default_cache_dir if dirpath is None: dirpath = self._default_cache_dir cachedir = self._default_cache_dir if not os.path.exists(cachedir): os.makedirs(cachedir) self._name = name cachefile...
gun dbm cache class
GNUDBMCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GNUDBMCache: """gun dbm cache class""" def __init__(self, name=_default_cache_name, dirpath=_default_cache_dir): """initialize file cache with cache file path :param name: str, cache name :param dirpath: str, cache directory path""" <|body_0|> def cachedir(self, dirpath=...
stack_v2_sparse_classes_36k_train_025190
4,045
no_license
[ { "docstring": "initialize file cache with cache file path :param name: str, cache name :param dirpath: str, cache directory path", "name": "__init__", "signature": "def __init__(self, name=_default_cache_name, dirpath=_default_cache_dir)" }, { "docstring": "get or set the cache file directory p...
6
stack_v2_sparse_classes_30k_val_000690
Implement the Python class `GNUDBMCache` described below. Class description: gun dbm cache class Method signatures and docstrings: - def __init__(self, name=_default_cache_name, dirpath=_default_cache_dir): initialize file cache with cache file path :param name: str, cache name :param dirpath: str, cache directory pa...
Implement the Python class `GNUDBMCache` described below. Class description: gun dbm cache class Method signatures and docstrings: - def __init__(self, name=_default_cache_name, dirpath=_default_cache_dir): initialize file cache with cache file path :param name: str, cache name :param dirpath: str, cache directory pa...
9f452b6c57ff211b38ca8ce971396e94c0b2194b
<|skeleton|> class GNUDBMCache: """gun dbm cache class""" def __init__(self, name=_default_cache_name, dirpath=_default_cache_dir): """initialize file cache with cache file path :param name: str, cache name :param dirpath: str, cache directory path""" <|body_0|> def cachedir(self, dirpath=...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GNUDBMCache: """gun dbm cache class""" def __init__(self, name=_default_cache_name, dirpath=_default_cache_dir): """initialize file cache with cache file path :param name: str, cache name :param dirpath: str, cache directory path""" if name is None: name = self._default_cache_...
the_stack_v2_python_sparse
python/security/utl/cache/gnuc.py
wruibo/tools
train
0
aac0d5477577bb48862068d44bd862f2a34d51bf
[ "if num <= 0:\n return False\nreturn num & 1431655765 != 0 and (not num & num - 1)", "if num <= 0:\n return False\nreturn not num & num - 1 and (num - 1) % 3 == 0" ]
<|body_start_0|> if num <= 0: return False return num & 1431655765 != 0 and (not num & num - 1) <|end_body_0|> <|body_start_1|> if num <= 0: return False return not num & num - 1 and (num - 1) % 3 == 0 <|end_body_1|>
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isPowerOfFour(self, num): """:type num: int :rtype: bool""" <|body_0|> def isPowerOfFour(self, num): """:type num: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> if num <= 0: return False return nu...
stack_v2_sparse_classes_36k_train_025191
801
no_license
[ { "docstring": ":type num: int :rtype: bool", "name": "isPowerOfFour", "signature": "def isPowerOfFour(self, num)" }, { "docstring": ":type num: int :rtype: bool", "name": "isPowerOfFour", "signature": "def isPowerOfFour(self, num)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPowerOfFour(self, num): :type num: int :rtype: bool - def isPowerOfFour(self, num): :type num: int :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPowerOfFour(self, num): :type num: int :rtype: bool - def isPowerOfFour(self, num): :type num: int :rtype: bool <|skeleton|> class Solution: def isPowerOfFour(self, n...
6fec95b9b4d735727160905e754a698513bfb7d8
<|skeleton|> class Solution: def isPowerOfFour(self, num): """:type num: int :rtype: bool""" <|body_0|> def isPowerOfFour(self, num): """:type num: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isPowerOfFour(self, num): """:type num: int :rtype: bool""" if num <= 0: return False return num & 1431655765 != 0 and (not num & num - 1) def isPowerOfFour(self, num): """:type num: int :rtype: bool""" if num <= 0: return Fals...
the_stack_v2_python_sparse
leetcode/bit-manipulation/power-of-four.py
jwyx3/practices
train
2
30e6805e0a422fa6ccf9d8ab40ef4acdc19569c5
[ "super().__init__(**kwargs)\nself.strategies = [self.PARALLEL_DOWNLOADER_CLASS(min_part_size=self.DEFAULT_MIN_PART_SIZE, min_chunk_size=self.MIN_CHUNK_SIZE, max_chunk_size=max(self.MAX_CHUNK_SIZE, write_buffer_size or 0), align_factor=write_buffer_size, thread_pool=self._thread_pool, check_hash=check_hash, max_stre...
<|body_start_0|> super().__init__(**kwargs) self.strategies = [self.PARALLEL_DOWNLOADER_CLASS(min_part_size=self.DEFAULT_MIN_PART_SIZE, min_chunk_size=self.MIN_CHUNK_SIZE, max_chunk_size=max(self.MAX_CHUNK_SIZE, write_buffer_size or 0), align_factor=write_buffer_size, thread_pool=self._thread_pool, chec...
Handle complex actions around downloads to free raw_api from that responsibility.
DownloadManager
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DownloadManager: """Handle complex actions around downloads to free raw_api from that responsibility.""" def __init__(self, write_buffer_size: int | None=None, check_hash: bool=True, max_download_streams_per_file: int | None=None, **kwargs): """Initialize the DownloadManager using th...
stack_v2_sparse_classes_36k_train_025192
4,349
permissive
[ { "docstring": "Initialize the DownloadManager using the given services object.", "name": "__init__", "signature": "def __init__(self, write_buffer_size: int | None=None, check_hash: bool=True, max_download_streams_per_file: int | None=None, **kwargs)" }, { "docstring": ":param url: url from whi...
2
null
Implement the Python class `DownloadManager` described below. Class description: Handle complex actions around downloads to free raw_api from that responsibility. Method signatures and docstrings: - def __init__(self, write_buffer_size: int | None=None, check_hash: bool=True, max_download_streams_per_file: int | None...
Implement the Python class `DownloadManager` described below. Class description: Handle complex actions around downloads to free raw_api from that responsibility. Method signatures and docstrings: - def __init__(self, write_buffer_size: int | None=None, check_hash: bool=True, max_download_streams_per_file: int | None...
072f96dfe90ff191cb74dd2b657564ed5649553c
<|skeleton|> class DownloadManager: """Handle complex actions around downloads to free raw_api from that responsibility.""" def __init__(self, write_buffer_size: int | None=None, check_hash: bool=True, max_download_streams_per_file: int | None=None, **kwargs): """Initialize the DownloadManager using th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DownloadManager: """Handle complex actions around downloads to free raw_api from that responsibility.""" def __init__(self, write_buffer_size: int | None=None, check_hash: bool=True, max_download_streams_per_file: int | None=None, **kwargs): """Initialize the DownloadManager using the given servi...
the_stack_v2_python_sparse
b2sdk/transfer/inbound/download_manager.py
Backblaze/b2-sdk-python
train
160
cb5ad5f9d984c2c1d78d4d445e7c7631cfbe5bfb
[ "if not isinstance(trial, AbstractArchiveTrial):\n raise TypeError('The trial must an instance of AbstractArchiveTrial.')\nself.__trial = trial\nself.__name = name\nself.__locked = False", "if not (value := getattr(self, f'_{self.__class__.__name__}__placeholder', None)) is not None:\n raise ValueError(\"Tr...
<|body_start_0|> if not isinstance(trial, AbstractArchiveTrial): raise TypeError('The trial must an instance of AbstractArchiveTrial.') self.__trial = trial self.__name = name self.__locked = False <|end_body_0|> <|body_start_1|> if not (value := getattr(self, f'_{se...
ArchiveTrialDescriptor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArchiveTrialDescriptor: def __init__(self, name: str, trial: AbstractArchiveTrial): """Initializes the ArchiveTrialDescriptor object, by injecting an AbstractArchiveTrial instance as a trial. :param trial:AbstractArchiveTrial:""" <|body_0|> async def __get__(self, instance, ...
stack_v2_sparse_classes_36k_train_025193
2,160
no_license
[ { "docstring": "Initializes the ArchiveTrialDescriptor object, by injecting an AbstractArchiveTrial instance as a trial. :param trial:AbstractArchiveTrial:", "name": "__init__", "signature": "def __init__(self, name: str, trial: AbstractArchiveTrial)" }, { "docstring": "Given that a trial value ...
3
null
Implement the Python class `ArchiveTrialDescriptor` described below. Class description: Implement the ArchiveTrialDescriptor class. Method signatures and docstrings: - def __init__(self, name: str, trial: AbstractArchiveTrial): Initializes the ArchiveTrialDescriptor object, by injecting an AbstractArchiveTrial instan...
Implement the Python class `ArchiveTrialDescriptor` described below. Class description: Implement the ArchiveTrialDescriptor class. Method signatures and docstrings: - def __init__(self, name: str, trial: AbstractArchiveTrial): Initializes the ArchiveTrialDescriptor object, by injecting an AbstractArchiveTrial instan...
6eeedc6b61247bed79ec4d65e1ef77e89a39352f
<|skeleton|> class ArchiveTrialDescriptor: def __init__(self, name: str, trial: AbstractArchiveTrial): """Initializes the ArchiveTrialDescriptor object, by injecting an AbstractArchiveTrial instance as a trial. :param trial:AbstractArchiveTrial:""" <|body_0|> async def __get__(self, instance, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ArchiveTrialDescriptor: def __init__(self, name: str, trial: AbstractArchiveTrial): """Initializes the ArchiveTrialDescriptor object, by injecting an AbstractArchiveTrial instance as a trial. :param trial:AbstractArchiveTrial:""" if not isinstance(trial, AbstractArchiveTrial): rais...
the_stack_v2_python_sparse
application/utils/protocol/descriptor/archive.py
VictorJan/Bruteforcer
train
0
5bce473350076a4b36778b6a885ec49b6fd68e36
[ "super(MPN, self).__init__()\nself.args = args\nself.atom_fdim = atom_fdim or get_atom_fdim(args)\nself.bond_fdim = bond_fdim or get_bond_fdim(args) + (not args.atom_messages) * self.atom_fdim\nself.graph_input = graph_input\nself.encoder = MPNEncoder(self.args, self.atom_fdim, self.bond_fdim)", "if not self.grap...
<|body_start_0|> super(MPN, self).__init__() self.args = args self.atom_fdim = atom_fdim or get_atom_fdim(args) self.bond_fdim = bond_fdim or get_bond_fdim(args) + (not args.atom_messages) * self.atom_fdim self.graph_input = graph_input self.encoder = MPNEncoder(self.args...
A message passing neural network for encoding a molecule.
MPN
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MPN: """A message passing neural network for encoding a molecule.""" def __init__(self, args: Namespace, atom_fdim: int=None, bond_fdim: int=None, graph_input: bool=False): """Initializes the MPN. :param args: Arguments. :param atom_fdim: Atom features dimension. :param bond_fdim: Bo...
stack_v2_sparse_classes_36k_train_025194
26,669
no_license
[ { "docstring": "Initializes the MPN. :param args: Arguments. :param atom_fdim: Atom features dimension. :param bond_fdim: Bond features dimension. :param graph_input: If true, expects BatchMolGraph as input. Otherwise expects a list of smiles strings as input.", "name": "__init__", "signature": "def __i...
2
stack_v2_sparse_classes_30k_train_003654
Implement the Python class `MPN` described below. Class description: A message passing neural network for encoding a molecule. Method signatures and docstrings: - def __init__(self, args: Namespace, atom_fdim: int=None, bond_fdim: int=None, graph_input: bool=False): Initializes the MPN. :param args: Arguments. :param...
Implement the Python class `MPN` described below. Class description: A message passing neural network for encoding a molecule. Method signatures and docstrings: - def __init__(self, args: Namespace, atom_fdim: int=None, bond_fdim: int=None, graph_input: bool=False): Initializes the MPN. :param args: Arguments. :param...
1851765edfd77f4a1ebd1702b32a11a6e8e8f01d
<|skeleton|> class MPN: """A message passing neural network for encoding a molecule.""" def __init__(self, args: Namespace, atom_fdim: int=None, bond_fdim: int=None, graph_input: bool=False): """Initializes the MPN. :param args: Arguments. :param atom_fdim: Atom features dimension. :param bond_fdim: Bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MPN: """A message passing neural network for encoding a molecule.""" def __init__(self, args: Namespace, atom_fdim: int=None, bond_fdim: int=None, graph_input: bool=False): """Initializes the MPN. :param args: Arguments. :param atom_fdim: Atom features dimension. :param bond_fdim: Bond features d...
the_stack_v2_python_sparse
MIRACLE/models/mpn.py
aabbccgithub/MIRACLE
train
0
893c89076649bf25c15c091b0fe36b0b673a3e31
[ "self.mobmondir = self.tempdir\nself.staticdir = os.path.join(self.mobmondir, self.STATICDIR)\nosutils.SafeMakedirs(self.staticdir)", "cfm = MockCheckFileManager()\nroot = mobmonitor.MobMonitorRoot(cfm, staticdir=self.staticdir)\nself.assertEqual(cfm.GetServiceList(), json.loads(root.GetServiceList()))", "cfm =...
<|body_start_0|> self.mobmondir = self.tempdir self.staticdir = os.path.join(self.mobmondir, self.STATICDIR) osutils.SafeMakedirs(self.staticdir) <|end_body_0|> <|body_start_1|> cfm = MockCheckFileManager() root = mobmonitor.MobMonitorRoot(cfm, staticdir=self.staticdir) ...
Unittests for the MobMonitorRoot.
MobMonitorRootTest
[ "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0", "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MobMonitorRootTest: """Unittests for the MobMonitorRoot.""" def setUp(self): """Setup directories expected by the Mob* Monitor.""" <|body_0|> def testGetServiceList(self): """Test the GetServiceList RPC.""" <|body_1|> def testGetStatus(self): ...
stack_v2_sparse_classes_36k_train_025195
4,242
permissive
[ { "docstring": "Setup directories expected by the Mob* Monitor.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test the GetServiceList RPC.", "name": "testGetServiceList", "signature": "def testGetServiceList(self)" }, { "docstring": "Test the GetStatus RPC....
5
stack_v2_sparse_classes_30k_train_009973
Implement the Python class `MobMonitorRootTest` described below. Class description: Unittests for the MobMonitorRoot. Method signatures and docstrings: - def setUp(self): Setup directories expected by the Mob* Monitor. - def testGetServiceList(self): Test the GetServiceList RPC. - def testGetStatus(self): Test the Ge...
Implement the Python class `MobMonitorRootTest` described below. Class description: Unittests for the MobMonitorRoot. Method signatures and docstrings: - def setUp(self): Setup directories expected by the Mob* Monitor. - def testGetServiceList(self): Test the GetServiceList RPC. - def testGetStatus(self): Test the Ge...
72a05af97787001756bae2511b7985e61498c965
<|skeleton|> class MobMonitorRootTest: """Unittests for the MobMonitorRoot.""" def setUp(self): """Setup directories expected by the Mob* Monitor.""" <|body_0|> def testGetServiceList(self): """Test the GetServiceList RPC.""" <|body_1|> def testGetStatus(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MobMonitorRootTest: """Unittests for the MobMonitorRoot.""" def setUp(self): """Setup directories expected by the Mob* Monitor.""" self.mobmondir = self.tempdir self.staticdir = os.path.join(self.mobmondir, self.STATICDIR) osutils.SafeMakedirs(self.staticdir) def test...
the_stack_v2_python_sparse
third_party/chromite/mobmonitor/scripts/mobmonitor_unittest.py
metux/chromium-suckless
train
5
c9fe72e7ad5f51722deccaa06d2e4a3e7e3a0c16
[ "self.commit_id = commit_id\nself.repository = repository\nself.generated_by = generated_by\nself.project_id = project_id", "metadata_properties_request = dict()\nif self.commit_id:\n metadata_properties_request['CommitId'] = self.commit_id\nif self.repository:\n metadata_properties_request['Repository'] = ...
<|body_start_0|> self.commit_id = commit_id self.repository = repository self.generated_by = generated_by self.project_id = project_id <|end_body_0|> <|body_start_1|> metadata_properties_request = dict() if self.commit_id: metadata_properties_request['CommitI...
Accepts metadata properties parameters for conversion to request dict.
MetadataProperties
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MetadataProperties: """Accepts metadata properties parameters for conversion to request dict.""" def __init__(self, commit_id: Optional[Union[str, PipelineVariable]]=None, repository: Optional[Union[str, PipelineVariable]]=None, generated_by: Optional[Union[str, PipelineVariable]]=None, proj...
stack_v2_sparse_classes_36k_train_025196
2,293
permissive
[ { "docstring": "Initialize a ``MetadataProperties`` instance and turn parameters into dict. # TODO: flesh out docstrings Args: commit_id (str or PipelineVariable): repository (str or PipelineVariable): generated_by (str or PipelineVariable): project_id (str or PipelineVariable):", "name": "__init__", "s...
2
stack_v2_sparse_classes_30k_train_010953
Implement the Python class `MetadataProperties` described below. Class description: Accepts metadata properties parameters for conversion to request dict. Method signatures and docstrings: - def __init__(self, commit_id: Optional[Union[str, PipelineVariable]]=None, repository: Optional[Union[str, PipelineVariable]]=N...
Implement the Python class `MetadataProperties` described below. Class description: Accepts metadata properties parameters for conversion to request dict. Method signatures and docstrings: - def __init__(self, commit_id: Optional[Union[str, PipelineVariable]]=None, repository: Optional[Union[str, PipelineVariable]]=N...
8d5d7fd8ae1a917ed3e2b988d5e533bce244fd85
<|skeleton|> class MetadataProperties: """Accepts metadata properties parameters for conversion to request dict.""" def __init__(self, commit_id: Optional[Union[str, PipelineVariable]]=None, repository: Optional[Union[str, PipelineVariable]]=None, generated_by: Optional[Union[str, PipelineVariable]]=None, proj...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MetadataProperties: """Accepts metadata properties parameters for conversion to request dict.""" def __init__(self, commit_id: Optional[Union[str, PipelineVariable]]=None, repository: Optional[Union[str, PipelineVariable]]=None, generated_by: Optional[Union[str, PipelineVariable]]=None, project_id: Optio...
the_stack_v2_python_sparse
src/sagemaker/metadata_properties.py
aws/sagemaker-python-sdk
train
2,050
2663073006aa9f021f66bed56b3b6f75c73c03b8
[ "d = {}\n\ndef help(n):\n if n in d:\n return d[n]\n if n <= 2:\n d[n] = n\n return n\n result = 0\n for i in range(1, n - 1):\n result += help(i) * help(n - i - 1)\n result += 2 * help(n - 1)\n d[n] = result\n return result\nhelp(n)\nreturn d[n]", "dp = [0] * (n +...
<|body_start_0|> d = {} def help(n): if n in d: return d[n] if n <= 2: d[n] = n return n result = 0 for i in range(1, n - 1): result += help(i) * help(n - i - 1) result += 2 * hel...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numTrees(self, n): """:type n: int :rtype: int""" <|body_0|> def numTreesDP(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> d = {} def help(n): if n in d: retur...
stack_v2_sparse_classes_36k_train_025197
823
permissive
[ { "docstring": ":type n: int :rtype: int", "name": "numTrees", "signature": "def numTrees(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "numTreesDP", "signature": "def numTreesDP(self, n)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numTrees(self, n): :type n: int :rtype: int - def numTreesDP(self, n): :type n: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numTrees(self, n): :type n: int :rtype: int - def numTreesDP(self, n): :type n: int :rtype: int <|skeleton|> class Solution: def numTrees(self, n): """:type n: ...
eb7f2fb142b8a30d987c5ac8002a96ead0aa56f4
<|skeleton|> class Solution: def numTrees(self, n): """:type n: int :rtype: int""" <|body_0|> def numTreesDP(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def numTrees(self, n): """:type n: int :rtype: int""" d = {} def help(n): if n in d: return d[n] if n <= 2: d[n] = n return n result = 0 for i in range(1, n - 1): ...
the_stack_v2_python_sparse
python/96.UniqueBinarySearchTrees.py
Wanger-SJTU/leetcode-solutions
train
1
4871a08c11a277745bb2baafa5412da60abd12a6
[ "self.plist = []\nself.limit = syze\nself.sieve = syze * [True]\nfor i in range(4, syze, 2):\n self.sieve[i] = False\nfinished = False\nloop = iter(range(3, syze, 2))\nwhile not finished:\n nprime = next(loop)\n if self.sieve[nprime] is False:\n continue\n spt = nprime * nprime\n if spt > syze...
<|body_start_0|> self.plist = [] self.limit = syze self.sieve = syze * [True] for i in range(4, syze, 2): self.sieve[i] = False finished = False loop = iter(range(3, syze, 2)) while not finished: nprime = next(loop) if self.siev...
Prime number generator
primez
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class primez: """Prime number generator""" def __init__(self, syze): """Initialize a sieve to handle a prime number table of the size specified.""" <|body_0|> def getList(self): """Return a list of prime numbers.""" <|body_1|> def amIprime(self, number): ...
stack_v2_sparse_classes_36k_train_025198
16,005
no_license
[ { "docstring": "Initialize a sieve to handle a prime number table of the size specified.", "name": "__init__", "signature": "def __init__(self, syze)" }, { "docstring": "Return a list of prime numbers.", "name": "getList", "signature": "def getList(self)" }, { "docstring": "Retur...
3
null
Implement the Python class `primez` described below. Class description: Prime number generator Method signatures and docstrings: - def __init__(self, syze): Initialize a sieve to handle a prime number table of the size specified. - def getList(self): Return a list of prime numbers. - def amIprime(self, number): Retur...
Implement the Python class `primez` described below. Class description: Prime number generator Method signatures and docstrings: - def __init__(self, syze): Initialize a sieve to handle a prime number table of the size specified. - def getList(self): Return a list of prime numbers. - def amIprime(self, number): Retur...
2ebb0a525d2d1c0ee28e83fdc2638c2bec97ac99
<|skeleton|> class primez: """Prime number generator""" def __init__(self, syze): """Initialize a sieve to handle a prime number table of the size specified.""" <|body_0|> def getList(self): """Return a list of prime numbers.""" <|body_1|> def amIprime(self, number): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class primez: """Prime number generator""" def __init__(self, syze): """Initialize a sieve to handle a prime number table of the size specified.""" self.plist = [] self.limit = syze self.sieve = syze * [True] for i in range(4, syze, 2): self.sieve[i] = False ...
the_stack_v2_python_sparse
src/pemjh/challenge211/main.py
mattjhussey/pemjh
train
0
1bb0e22f8d35f7fd2dd38700928af1c91c3f7001
[ "patient_request = json.loads(request.body.decode('utf-8'))\nPatientView.validate_patient_request(patient_request)\nnew_patient_info = PatientService.add_patient(patient_request)\nreturn JsonResponse(new_patient_info)", "pagination_args = PaginationViewUtils.get_pagination_args(request)\ncurrent_path = request.bu...
<|body_start_0|> patient_request = json.loads(request.body.decode('utf-8')) PatientView.validate_patient_request(patient_request) new_patient_info = PatientService.add_patient(patient_request) return JsonResponse(new_patient_info) <|end_body_0|> <|body_start_1|> pagination_args ...
All endpoints related to patient actions
PatientView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PatientView: """All endpoints related to patient actions""" def post(request): """Action when calling the endpoint with POST :param request: request for patient adding :return: json response with new patient info""" <|body_0|> def get(request): """Action when cal...
stack_v2_sparse_classes_36k_train_025199
7,260
no_license
[ { "docstring": "Action when calling the endpoint with POST :param request: request for patient adding :return: json response with new patient info", "name": "post", "signature": "def post(request)" }, { "docstring": "Action when calling the endpoint with GET Return list of patients :param reques...
3
stack_v2_sparse_classes_30k_train_008266
Implement the Python class `PatientView` described below. Class description: All endpoints related to patient actions Method signatures and docstrings: - def post(request): Action when calling the endpoint with POST :param request: request for patient adding :return: json response with new patient info - def get(requ...
Implement the Python class `PatientView` described below. Class description: All endpoints related to patient actions Method signatures and docstrings: - def post(request): Action when calling the endpoint with POST :param request: request for patient adding :return: json response with new patient info - def get(requ...
941e8b2870f8724db3d5103dda5157fd597cfcc7
<|skeleton|> class PatientView: """All endpoints related to patient actions""" def post(request): """Action when calling the endpoint with POST :param request: request for patient adding :return: json response with new patient info""" <|body_0|> def get(request): """Action when cal...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PatientView: """All endpoints related to patient actions""" def post(request): """Action when calling the endpoint with POST :param request: request for patient adding :return: json response with new patient info""" patient_request = json.loads(request.body.decode('utf-8')) Patien...
the_stack_v2_python_sparse
backend/martin_helder/views/patient_view.py
JoaoAlvaroFerreira/FEUP-LGP
train
1