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
900245b19c568b38659204c68d605b4177aff694
[ "self._version_strings = []\nfor bin_str in self._all_strings:\n if str(bin_str).startswith(self.VERSION_STRING_VP8) or str(bin_str).startswith(self.VERSION_STRING_VP9):\n version_string = str(bin_str)\n logger.debug('Located a version string of %s in address 0x%x', self.NAME, bin_str.ea)\n ...
<|body_start_0|> self._version_strings = [] for bin_str in self._all_strings: if str(bin_str).startswith(self.VERSION_STRING_VP8) or str(bin_str).startswith(self.VERSION_STRING_VP9): version_string = str(bin_str) logger.debug('Located a version string of %s in...
Seeker (Identifier) for the libvpx (codec) open source library.
libvpxSeeker
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class libvpxSeeker: """Seeker (Identifier) for the libvpx (codec) open source library.""" def searchLib(self, logger): """Check if the open source library is located somewhere in the binary. Args: logger (logger): elementals logger instance Return Value: number of library instances that we...
stack_v2_sparse_classes_36k_train_015400
2,457
permissive
[ { "docstring": "Check if the open source library is located somewhere in the binary. Args: logger (logger): elementals logger instance Return Value: number of library instances that were found in the binary", "name": "searchLib", "signature": "def searchLib(self, logger)" }, { "docstring": "Iden...
2
stack_v2_sparse_classes_30k_train_009433
Implement the Python class `libvpxSeeker` described below. Class description: Seeker (Identifier) for the libvpx (codec) open source library. Method signatures and docstrings: - def searchLib(self, logger): Check if the open source library is located somewhere in the binary. Args: logger (logger): elementals logger i...
Implement the Python class `libvpxSeeker` described below. Class description: Seeker (Identifier) for the libvpx (codec) open source library. Method signatures and docstrings: - def searchLib(self, logger): Check if the open source library is located somewhere in the binary. Args: logger (logger): elementals logger i...
03adda0775bfa338bfc61bfac14fe457b283a85c
<|skeleton|> class libvpxSeeker: """Seeker (Identifier) for the libvpx (codec) open source library.""" def searchLib(self, logger): """Check if the open source library is located somewhere in the binary. Args: logger (logger): elementals logger instance Return Value: number of library instances that we...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class libvpxSeeker: """Seeker (Identifier) for the libvpx (codec) open source library.""" def searchLib(self, logger): """Check if the open source library is located somewhere in the binary. Args: logger (logger): elementals logger instance Return Value: number of library instances that were found in t...
the_stack_v2_python_sparse
src/libs/libvpx.py
MITRE-Reversing-Internship/Karta-Modified
train
1
41352013643edadf0caac4ae3bf0e9ef1bfbb512
[ "if not nums or len(nums) < 2:\n return 0\nnums.sort()\nres = 0\nfor i in range(1, len(nums)):\n res = max(res, nums[i] - nums[i - 1])\nreturn res", "if not nums or len(nums) < 2:\n return 0\nK = int(math.ceil(math.log(2 ** 31, 10)))\nbucket = [[] for _ in range(10)]\nfor i in range(K):\n for val in n...
<|body_start_0|> if not nums or len(nums) < 2: return 0 nums.sort() res = 0 for i in range(1, len(nums)): res = max(res, nums[i] - nums[i - 1]) return res <|end_body_0|> <|body_start_1|> if not nums or len(nums) < 2: return 0 K...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maximumGap(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def maximumGap_1(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not nums or len(nums) < 2: ret...
stack_v2_sparse_classes_36k_train_015401
2,222
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "maximumGap", "signature": "def maximumGap(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "maximumGap_1", "signature": "def maximumGap_1(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_009862
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maximumGap(self, nums): :type nums: List[int] :rtype: int - def maximumGap_1(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 maximumGap(self, nums): :type nums: List[int] :rtype: int - def maximumGap_1(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def maximumGap(...
3d9e0ad2f6ed92ec969556f75d97c51ea4854719
<|skeleton|> class Solution: def maximumGap(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def maximumGap_1(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 maximumGap(self, nums): """:type nums: List[int] :rtype: int""" if not nums or len(nums) < 2: return 0 nums.sort() res = 0 for i in range(1, len(nums)): res = max(res, nums[i] - nums[i - 1]) return res def maximumGap_1(...
the_stack_v2_python_sparse
Solutions/0164_maximumGap.py
YoupengLi/leetcode-sorting
train
3
133942505a1e2b2037048a20188683b3314f0d2b
[ "SBIg.alert('verbose', self, 'Writting object to file {0}'.format(object_file))\ndumpFile = File(file_name=object_file, action='w', overwrite=overwrite)\npickle.dump(self, dumpFile._fd)\ndumpFile.close()", "SBIg.alert('verbose', StorableObject(), 'Preparing to load object from file {0}'.format(object_file))\nObje...
<|body_start_0|> SBIg.alert('verbose', self, 'Writting object to file {0}'.format(object_file)) dumpFile = File(file_name=object_file, action='w', overwrite=overwrite) pickle.dump(self, dumpFile._fd) dumpFile.close() <|end_body_0|> <|body_start_1|> SBIg.alert('verbose', Storable...
An abstract "dumping" class. This means that it is basically useful for those who would like to extend this library. Basically, it gives the object the ability to be "dumped" on disk and be recovered afterwards.
StorableObject
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StorableObject: """An abstract "dumping" class. This means that it is basically useful for those who would like to extend this library. Basically, it gives the object the ability to be "dumped" on disk and be recovered afterwards.""" def dump(self, object_file, overwrite=None): """St...
stack_v2_sparse_classes_36k_train_015402
1,791
permissive
[ { "docstring": "Stores the object into a file. @param: object_file @pdef: Name for the output file @ptype: {String} @param: overwrite @pdef: write over a existing file @pdefault: _SBIglobals.overwrite_ @ptype: {Boolean}", "name": "dump", "signature": "def dump(self, object_file, overwrite=None)" }, ...
2
stack_v2_sparse_classes_30k_train_007293
Implement the Python class `StorableObject` described below. Class description: An abstract "dumping" class. This means that it is basically useful for those who would like to extend this library. Basically, it gives the object the ability to be "dumped" on disk and be recovered afterwards. Method signatures and docs...
Implement the Python class `StorableObject` described below. Class description: An abstract "dumping" class. This means that it is basically useful for those who would like to extend this library. Basically, it gives the object the ability to be "dumped" on disk and be recovered afterwards. Method signatures and docs...
946b7afdac16aef391ddd162daabfcc968eb9110
<|skeleton|> class StorableObject: """An abstract "dumping" class. This means that it is basically useful for those who would like to extend this library. Basically, it gives the object the ability to be "dumped" on disk and be recovered afterwards.""" def dump(self, object_file, overwrite=None): """St...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StorableObject: """An abstract "dumping" class. This means that it is basically useful for those who would like to extend this library. Basically, it gives the object the ability to be "dumped" on disk and be recovered afterwards.""" def dump(self, object_file, overwrite=None): """Stores the obje...
the_stack_v2_python_sparse
SBI/beans/StorableObject.py
structuralbioinformatics/SPServer
train
3
d48dd8289a56cc35670e7a636c49528d3b381099
[ "version = FlowFileHistory(flow=self)\nversion.save()\nshutil.copy(temp_flow_file_path, version.get_storage_path())\nreturn self", "try:\n version = FlowFileHistory.objects.filter(flow=self).order_by('id').last()\n return version.get_storage_path()\nexcept FlowFileHistory.DoesNotExist:\n return None" ]
<|body_start_0|> version = FlowFileHistory(flow=self) version.save() shutil.copy(temp_flow_file_path, version.get_storage_path()) return self <|end_body_0|> <|body_start_1|> try: version = FlowFileHistory.objects.filter(flow=self).order_by('id').last() re...
流程文件
FlowFile
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FlowFile: """流程文件""" def clone_flow_file_from_path(self, temp_flow_file_path): """从临时文件处克隆流程文件""" <|body_0|> def get_flow_file_as_abs_path(self): """获取流程文件的完整路径""" <|body_1|> <|end_skeleton|> <|body_start_0|> version = FlowFileHistory(flow=self)...
stack_v2_sparse_classes_36k_train_015403
12,718
no_license
[ { "docstring": "从临时文件处克隆流程文件", "name": "clone_flow_file_from_path", "signature": "def clone_flow_file_from_path(self, temp_flow_file_path)" }, { "docstring": "获取流程文件的完整路径", "name": "get_flow_file_as_abs_path", "signature": "def get_flow_file_as_abs_path(self)" } ]
2
null
Implement the Python class `FlowFile` described below. Class description: 流程文件 Method signatures and docstrings: - def clone_flow_file_from_path(self, temp_flow_file_path): 从临时文件处克隆流程文件 - def get_flow_file_as_abs_path(self): 获取流程文件的完整路径
Implement the Python class `FlowFile` described below. Class description: 流程文件 Method signatures and docstrings: - def clone_flow_file_from_path(self, temp_flow_file_path): 从临时文件处克隆流程文件 - def get_flow_file_as_abs_path(self): 获取流程文件的完整路径 <|skeleton|> class FlowFile: """流程文件""" def clone_flow_file_from_path(s...
19f5879c50bc5ecc12a2340f7f9d0e7864735001
<|skeleton|> class FlowFile: """流程文件""" def clone_flow_file_from_path(self, temp_flow_file_path): """从临时文件处克隆流程文件""" <|body_0|> def get_flow_file_as_abs_path(self): """获取流程文件的完整路径""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FlowFile: """流程文件""" def clone_flow_file_from_path(self, temp_flow_file_path): """从临时文件处克隆流程文件""" version = FlowFileHistory(flow=self) version.save() shutil.copy(temp_flow_file_path, version.get_storage_path()) return self def get_flow_file_as_abs_path(self): ...
the_stack_v2_python_sparse
storage/models.py
bedreamer/plane-ui
train
1
3ee7a1bdc06202aa5754ffa2ad3dbf7763d4db3d
[ "self._archive_data_source = archive_data_source\nself._config = config\nself._archive_data_file_creator = data_file_creator_factory.create(config, archive_data_source, config.continuous_logging_filename_template)\nself._last_write_time = None", "continual_logging_last_write = self._last_write_time\nif continual_...
<|body_start_0|> self._archive_data_source = archive_data_source self._config = config self._archive_data_file_creator = data_file_creator_factory.create(config, archive_data_source, config.continuous_logging_filename_template) self._last_write_time = None <|end_body_0|> <|body_start_1|...
A logger that will write the data to the file every period.
ContinualLogger
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ContinualLogger: """A logger that will write the data to the file every period.""" def __init__(self, config, archive_data_source, data_file_creator_factory): """Initializer. Args: config(ArchiverAccess.archive_access_configuration.ArchiveAccessConfig): configuration for this logging...
stack_v2_sparse_classes_36k_train_015404
11,537
permissive
[ { "docstring": "Initializer. Args: config(ArchiverAccess.archive_access_configuration.ArchiveAccessConfig): configuration for this logging set archive_data_source(ArchiverAccess.archiver_data_source.ArchiverDataSource): data source from the archive data_file_creator_factory: factor to allow creation of data fil...
5
stack_v2_sparse_classes_30k_train_012335
Implement the Python class `ContinualLogger` described below. Class description: A logger that will write the data to the file every period. Method signatures and docstrings: - def __init__(self, config, archive_data_source, data_file_creator_factory): Initializer. Args: config(ArchiverAccess.archive_access_configura...
Implement the Python class `ContinualLogger` described below. Class description: A logger that will write the data to the file every period. Method signatures and docstrings: - def __init__(self, config, archive_data_source, data_file_creator_factory): Initializer. Args: config(ArchiverAccess.archive_access_configura...
2e605cbff1cfe071571a64bed61708d8c92dc204
<|skeleton|> class ContinualLogger: """A logger that will write the data to the file every period.""" def __init__(self, config, archive_data_source, data_file_creator_factory): """Initializer. Args: config(ArchiverAccess.archive_access_configuration.ArchiveAccessConfig): configuration for this logging...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ContinualLogger: """A logger that will write the data to the file every period.""" def __init__(self, config, archive_data_source, data_file_creator_factory): """Initializer. Args: config(ArchiverAccess.archive_access_configuration.ArchiveAccessConfig): configuration for this logging set archive_...
the_stack_v2_python_sparse
ArchiverAccess/log_file_initiator.py
ISISComputingGroup/EPICS-inst_servers
train
1
0a48e14b6b283b777b9041049549529b10dbbe1d
[ "if not quota_max_calls:\n use_rate_limiter = False\nself._groups = None\nself._members = None\nself._users = None\nsuper(AdminDirectoryRepositoryClient, self).__init__(API_NAME, versions=['directory_v1'], credentials=credentials, quota_max_calls=quota_max_calls, quota_period=quota_period, use_rate_limiter=use_r...
<|body_start_0|> if not quota_max_calls: use_rate_limiter = False self._groups = None self._members = None self._users = None super(AdminDirectoryRepositoryClient, self).__init__(API_NAME, versions=['directory_v1'], credentials=credentials, quota_max_calls=quota_max_c...
Admin Directory API Respository Client.
AdminDirectoryRepositoryClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdminDirectoryRepositoryClient: """Admin Directory API Respository Client.""" def __init__(self, credentials, quota_max_calls=None, quota_period=1.0, use_rate_limiter=True): """Constructor. Args: credentials (object): An google.auth credentials object. The admin directory API needs a...
stack_v2_sparse_classes_36k_train_015405
9,750
permissive
[ { "docstring": "Constructor. Args: credentials (object): An google.auth credentials object. The admin directory API needs a service account credential with delegated super admin role. quota_max_calls (int): Allowed requests per <quota_period> for the API. quota_period (float): The time period to track requests ...
4
stack_v2_sparse_classes_30k_train_002479
Implement the Python class `AdminDirectoryRepositoryClient` described below. Class description: Admin Directory API Respository Client. Method signatures and docstrings: - def __init__(self, credentials, quota_max_calls=None, quota_period=1.0, use_rate_limiter=True): Constructor. Args: credentials (object): An google...
Implement the Python class `AdminDirectoryRepositoryClient` described below. Class description: Admin Directory API Respository Client. Method signatures and docstrings: - def __init__(self, credentials, quota_max_calls=None, quota_period=1.0, use_rate_limiter=True): Constructor. Args: credentials (object): An google...
d4421afa50a17ed47cbebe942044ebab3720e0f5
<|skeleton|> class AdminDirectoryRepositoryClient: """Admin Directory API Respository Client.""" def __init__(self, credentials, quota_max_calls=None, quota_period=1.0, use_rate_limiter=True): """Constructor. Args: credentials (object): An google.auth credentials object. The admin directory API needs a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdminDirectoryRepositoryClient: """Admin Directory API Respository Client.""" def __init__(self, credentials, quota_max_calls=None, quota_period=1.0, use_rate_limiter=True): """Constructor. Args: credentials (object): An google.auth credentials object. The admin directory API needs a service acco...
the_stack_v2_python_sparse
google/cloud/forseti/common/gcp_api/admin_directory.py
kevensen/forseti-security
train
1
5129e494b9406d57e3783963f5af0b169253ef8a
[ "self.entityTypes = entityTypes\ncurToken = None\nsimpleTree = sentence.getSimpleTree()\nfor tNode in simpleTree.tokenNodes():\n if tNode.isNounPhraseNode():\n npUnbroken = True\n for npToken in tNode.npTokens:\n newToken = self.createOrAddToToken(curToken, npToken.token, mode)\n ...
<|body_start_0|> self.entityTypes = entityTypes curToken = None simpleTree = sentence.getSimpleTree() for tNode in simpleTree.tokenNodes(): if tNode.isNounPhraseNode(): npUnbroken = True for npToken in tNode.npTokens: newTok...
create a special simplified version of a given sentence.
SimplifiedSentence
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimplifiedSentence: """create a special simplified version of a given sentence.""" def __init__(self, sentence, entityTypes, mode): """create a simplified version of a given sentence. replace noun phrases with NP token, verb phrases with VP token, entity mentions with label for the e...
stack_v2_sparse_classes_36k_train_015406
4,501
no_license
[ { "docstring": "create a simplified version of a given sentence. replace noun phrases with NP token, verb phrases with VP token, entity mentions with label for the entity type. if mode == 'train', use annotated labels. Otherwise use detected ones.", "name": "__init__", "signature": "def __init__(self, s...
4
null
Implement the Python class `SimplifiedSentence` described below. Class description: create a special simplified version of a given sentence. Method signatures and docstrings: - def __init__(self, sentence, entityTypes, mode): create a simplified version of a given sentence. replace noun phrases with NP token, verb ph...
Implement the Python class `SimplifiedSentence` described below. Class description: create a special simplified version of a given sentence. Method signatures and docstrings: - def __init__(self, sentence, entityTypes, mode): create a simplified version of a given sentence. replace noun phrases with NP token, verb ph...
aecc4c4ac18ebc1c6cb39d54f9ed8cba5217c6f8
<|skeleton|> class SimplifiedSentence: """create a special simplified version of a given sentence.""" def __init__(self, sentence, entityTypes, mode): """create a simplified version of a given sentence. replace noun phrases with NP token, verb phrases with VP token, entity mentions with label for the e...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SimplifiedSentence: """create a special simplified version of a given sentence.""" def __init__(self, sentence, entityTypes, mode): """create a simplified version of a given sentence. replace noun phrases with NP token, verb phrases with VP token, entity mentions with label for the entity type. i...
the_stack_v2_python_sparse
simplifiedsentence.py
rlsummerscales/acres
train
0
76d61f95b2f041bdddabff067593ee2c7547499a
[ "from torch.nn import ModuleList\nfrom torch.nn import Conv2d\nsuper().__init__()\nassert feature_size != 0 and feature_size & feature_size - 1 == 0, 'latent size not a power of 2'\nif depth >= 4:\n assert feature_size >= np.power(2, depth - 4), 'feature size cannot be produced'\nself.depth = depth\nself.feature...
<|body_start_0|> from torch.nn import ModuleList from torch.nn import Conv2d super().__init__() assert feature_size != 0 and feature_size & feature_size - 1 == 0, 'latent size not a power of 2' if depth >= 4: assert feature_size >= np.power(2, depth - 4), 'feature siz...
Discriminator of the GAN
msg_stylegan2_lm_id_D
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class msg_stylegan2_lm_id_D: """Discriminator of the GAN""" def __init__(self, depth=7, feature_size=512, dilation=1, use_spectral_norm=True): """constructor for the class :param depth: total depth of the discriminator (Must be equal to the Generator depth) :param feature_size: size of the...
stack_v2_sparse_classes_36k_train_015407
14,685
no_license
[ { "docstring": "constructor for the class :param depth: total depth of the discriminator (Must be equal to the Generator depth) :param feature_size: size of the deepest features extracted (Must be equal to Generator latent_size) :param dilation: amount of dilation to be applied to the 3x3 convolutional blocks o...
4
stack_v2_sparse_classes_30k_train_006474
Implement the Python class `msg_stylegan2_lm_id_D` described below. Class description: Discriminator of the GAN Method signatures and docstrings: - def __init__(self, depth=7, feature_size=512, dilation=1, use_spectral_norm=True): constructor for the class :param depth: total depth of the discriminator (Must be equal...
Implement the Python class `msg_stylegan2_lm_id_D` described below. Class description: Discriminator of the GAN Method signatures and docstrings: - def __init__(self, depth=7, feature_size=512, dilation=1, use_spectral_norm=True): constructor for the class :param depth: total depth of the discriminator (Must be equal...
428abe1fefe5ea4ef00290155e7e59657bc83444
<|skeleton|> class msg_stylegan2_lm_id_D: """Discriminator of the GAN""" def __init__(self, depth=7, feature_size=512, dilation=1, use_spectral_norm=True): """constructor for the class :param depth: total depth of the discriminator (Must be equal to the Generator depth) :param feature_size: size of the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class msg_stylegan2_lm_id_D: """Discriminator of the GAN""" def __init__(self, depth=7, feature_size=512, dilation=1, use_spectral_norm=True): """constructor for the class :param depth: total depth of the discriminator (Must be equal to the Generator depth) :param feature_size: size of the deepest feat...
the_stack_v2_python_sparse
src/msg_stylegan2.py
blakecheng/lafin
train
0
216b20ef272f010d5a78af6052b9a6016e3109fc
[ "super().__init__(config, args)\nif not config.has_section('inhouse'):\n logging.error('inhouse section missing in configuration file')\n sys.exit(1)\nif not config.has_option('inhouse', 'username'):\n logging.error('inouse section has not username field in configuration file')\n sys.exit(1)\nself._remo...
<|body_start_0|> super().__init__(config, args) if not config.has_section('inhouse'): logging.error('inhouse section missing in configuration file') sys.exit(1) if not config.has_option('inhouse', 'username'): logging.error('inouse section has not username fie...
Class to manage the execution of experiments on a remote server accessed through ssh Attributes ---------- _abs_root: str The absolute path containing the root of the library" Methods ------- run_experiment() Run the experiments on the remote server copy_list_to_target() Copy the file with the list of experiments to be...
Provider
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Provider: """Class to manage the execution of experiments on a remote server accessed through ssh Attributes ---------- _abs_root: str The absolute path containing the root of the library" Methods ------- run_experiment() Run the experiments on the remote server copy_list_to_target() Copy the fil...
stack_v2_sparse_classes_36k_train_015408
7,109
permissive
[ { "docstring": "Arguments --------- config: dict of str: dict of str: str The dictionary created from configuration file args The command line arguments parsed", "name": "__init__", "signature": "def __init__(self, config, args)" }, { "docstring": "Copy the list_file_name to target Parameters --...
3
stack_v2_sparse_classes_30k_train_004235
Implement the Python class `Provider` described below. Class description: Class to manage the execution of experiments on a remote server accessed through ssh Attributes ---------- _abs_root: str The absolute path containing the root of the library" Methods ------- run_experiment() Run the experiments on the remote se...
Implement the Python class `Provider` described below. Class description: Class to manage the execution of experiments on a remote server accessed through ssh Attributes ---------- _abs_root: str The absolute path containing the root of the library" Methods ------- run_experiment() Run the experiments on the remote se...
2332fb68247cad347f889c006028385fed4c5c93
<|skeleton|> class Provider: """Class to manage the execution of experiments on a remote server accessed through ssh Attributes ---------- _abs_root: str The absolute path containing the root of the library" Methods ------- run_experiment() Run the experiments on the remote server copy_list_to_target() Copy the fil...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Provider: """Class to manage the execution of experiments on a remote server accessed through ssh Attributes ---------- _abs_root: str The absolute path containing the root of the library" Methods ------- run_experiment() Run the experiments on the remote server copy_list_to_target() Copy the file with the li...
the_stack_v2_python_sparse
providers/inhouse.py
giovannidispoto/a-GPUBench
train
0
7f4a2f60ea0ad967752870abea028f98b29fa970
[ "if root is None:\n return '[]'\nnodes = [root]\ni = 0\nwhile i < len(nodes):\n if nodes[i]:\n nodes.append(nodes[i].left)\n nodes.append(nodes[i].right)\n i += 1\nwhile nodes[-1] is None:\n nodes.pop()\nreturn '[' + ','.join((str(node.val) if node else 'null' for node in nodes)) + ']'", ...
<|body_start_0|> if root is None: return '[]' nodes = [root] i = 0 while i < len(nodes): if nodes[i]: nodes.append(nodes[i].left) nodes.append(nodes[i].right) i += 1 while nodes[-1] is None: nodes.pop...
Codec
[ "MIT" ]
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_015409
1,605
permissive
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_017858
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:...
4ddea0a532fe7c5d053ffbd6870174ec99fc2d60
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if root is None: return '[]' nodes = [root] i = 0 while i < len(nodes): if nodes[i]: nodes.append(nodes[i].left) ...
the_stack_v2_python_sparse
0201-0300/0297-Serialize and Deserialize Binary Tree/0297-Serialize and Deserialize Binary Tree.py
jiadaizhao/LeetCode
train
52
034a7b4150d2147a0339a36f51a3627a4bcf232e
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('jgrishey', 'jgrishey')\nclient = sodapy.Socrata('data.cityofboston.gov', dml.auth['services']['cityofbostondataportal']['token'])\nresponse = client.get('29yf-ye7n', limit=10000)\ncrimes = []\nID = 0\nfo...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('jgrishey', 'jgrishey') client = sodapy.Socrata('data.cityofboston.gov', dml.auth['services']['cityofbostondataportal']['token']) response = client...
getCrime
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class getCrime: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everything happ...
stack_v2_sparse_classes_36k_train_015410
3,719
no_license
[ { "docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).", "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 d...
2
stack_v2_sparse_classes_30k_train_018593
Implement the Python class `getCrime` described below. Class description: Implement the getCrime class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=Non...
Implement the Python class `getCrime` described below. Class description: Implement the getCrime class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=Non...
0df485d0469c5451ebdcd684bed2a0960ba3ab84
<|skeleton|> class getCrime: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everything happ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class getCrime: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('jgrishey', 'jgrishey') client = so...
the_stack_v2_python_sparse
jgrishey/getCrime.py
lingyigu/course-2017-spr-proj
train
0
f6d263115bdf9d3f83851e3fd401b389d7413cf7
[ "if isinstance(element_or_cond, str):\n if element_or_cond not in STREAM_ERRORS:\n raise ValueError('Bad error condition')\nErrorElement.__init__(self, element_or_cond, text, language)", "cond = self.condition_name\nif cond in STREAM_ERRORS:\n return STREAM_ERRORS[cond][0]\nelse:\n return None" ]
<|body_start_0|> if isinstance(element_or_cond, str): if element_or_cond not in STREAM_ERRORS: raise ValueError('Bad error condition') ErrorElement.__init__(self, element_or_cond, text, language) <|end_body_0|> <|body_start_1|> cond = self.condition_name if c...
Stream error element.
StreamErrorElement
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StreamErrorElement: """Stream error element.""" def __init__(self, element_or_cond, text=None, language=None): """Initialize an StreamErrorElement object. :Parameters: - `element_or_cond`: XML <error/> element to decode or an error condition name or element. - `text`: optional descri...
stack_v2_sparse_classes_36k_train_015411
16,456
permissive
[ { "docstring": "Initialize an StreamErrorElement object. :Parameters: - `element_or_cond`: XML <error/> element to decode or an error condition name or element. - `text`: optional description to override the default one - `language`: RFC 3066 language tag for the description :Types: - `element_or_cond`: :etree:...
2
null
Implement the Python class `StreamErrorElement` described below. Class description: Stream error element. Method signatures and docstrings: - def __init__(self, element_or_cond, text=None, language=None): Initialize an StreamErrorElement object. :Parameters: - `element_or_cond`: XML <error/> element to decode or an e...
Implement the Python class `StreamErrorElement` described below. Class description: Stream error element. Method signatures and docstrings: - def __init__(self, element_or_cond, text=None, language=None): Initialize an StreamErrorElement object. :Parameters: - `element_or_cond`: XML <error/> element to decode or an e...
26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891
<|skeleton|> class StreamErrorElement: """Stream error element.""" def __init__(self, element_or_cond, text=None, language=None): """Initialize an StreamErrorElement object. :Parameters: - `element_or_cond`: XML <error/> element to decode or an error condition name or element. - `text`: optional descri...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StreamErrorElement: """Stream error element.""" def __init__(self, element_or_cond, text=None, language=None): """Initialize an StreamErrorElement object. :Parameters: - `element_or_cond`: XML <error/> element to decode or an error condition name or element. - `text`: optional description to over...
the_stack_v2_python_sparse
python3-alpha/python-libs/pyxmpp2/error.py
kuri65536/python-for-android
train
280
7b17739a8ef79c19e0e2e4e0a5f8b5ee02f5b313
[ "mes = {'message': 'success'}\nnow = datetime.datetime.now()\nd2 = {'hotel_group_id': hotel_group_id, 'creator': user_id, 'last_user': user_id, 'create_time': now, 'last_time': now}\napps = [update_dict(app, d2) for app in apps]\nwith db.atomic() as transaction:\n try:\n cls.insert_many(rows=apps)\n ex...
<|body_start_0|> mes = {'message': 'success'} now = datetime.datetime.now() d2 = {'hotel_group_id': hotel_group_id, 'creator': user_id, 'last_user': user_id, 'create_time': now, 'last_time': now} apps = [update_dict(app, d2) for app in apps] with db.atomic() as transaction: ...
集团可用的app
UsableApp
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UsableApp: """集团可用的app""" def init_status(cls, user_id: int, hotel_group_id, apps: list) -> dict: """初始化/批量添加可用的app信息 :param user_id: :param hotel_group_id: :param apps: [{"app_id": app_id, "usable": usable},...] :return:""" <|body_0|> def add_record(cls, user_id: int, a...
stack_v2_sparse_classes_36k_train_015412
25,579
no_license
[ { "docstring": "初始化/批量添加可用的app信息 :param user_id: :param hotel_group_id: :param apps: [{\"app_id\": app_id, \"usable\": usable},...] :return:", "name": "init_status", "signature": "def init_status(cls, user_id: int, hotel_group_id, apps: list) -> dict" }, { "docstring": "添加一条app是否可用的记录 :param use...
4
stack_v2_sparse_classes_30k_train_000673
Implement the Python class `UsableApp` described below. Class description: 集团可用的app Method signatures and docstrings: - def init_status(cls, user_id: int, hotel_group_id, apps: list) -> dict: 初始化/批量添加可用的app信息 :param user_id: :param hotel_group_id: :param apps: [{"app_id": app_id, "usable": usable},...] :return: - def...
Implement the Python class `UsableApp` described below. Class description: 集团可用的app Method signatures and docstrings: - def init_status(cls, user_id: int, hotel_group_id, apps: list) -> dict: 初始化/批量添加可用的app信息 :param user_id: :param hotel_group_id: :param apps: [{"app_id": app_id, "usable": usable},...] :return: - def...
3a2bdfd1598bfcdfe56386ec0c46fcede772cbfe
<|skeleton|> class UsableApp: """集团可用的app""" def init_status(cls, user_id: int, hotel_group_id, apps: list) -> dict: """初始化/批量添加可用的app信息 :param user_id: :param hotel_group_id: :param apps: [{"app_id": app_id, "usable": usable},...] :return:""" <|body_0|> def add_record(cls, user_id: int, a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UsableApp: """集团可用的app""" def init_status(cls, user_id: int, hotel_group_id, apps: list) -> dict: """初始化/批量添加可用的app信息 :param user_id: :param hotel_group_id: :param apps: [{"app_id": app_id, "usable": usable},...] :return:""" mes = {'message': 'success'} now = datetime.datetime.now...
the_stack_v2_python_sparse
NewISpider/authorization_package/permission_module.py
SYYDSN/py_projects
train
0
5f9a2d3ef5b9561c2fbb42c39a7df0cee48b358c
[ "for fieldname in fieldnames:\n field = form_.fields[fieldname]\n data = field.widget.value_from_datadict(form_.data, form_.files, form_.add_prefix(fieldname))\n try:\n if not hasattr(form_, 'cleaned_data'):\n form_.cleaned_data = {}\n form_.cleaned_data[fieldname] = field.clean(da...
<|body_start_0|> for fieldname in fieldnames: field = form_.fields[fieldname] data = field.widget.value_from_datadict(form_.data, form_.files, form_.add_prefix(fieldname)) try: if not hasattr(form_, 'cleaned_data'): form_.cleaned_data = {} ...
Mise à jour d'un objet de type Model avec certains champs d'un ModelForm Monkey-patching done in scoop.core.__init__ Le monkey patch se fait sur la classe django.db.models.Model - instance : objet dérivé de models.Model - form : objet de type forms.ModelForm dont la classe ciblée est celle de instance - fieldnames : li...
ModelFormUtil
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModelFormUtil: """Mise à jour d'un objet de type Model avec certains champs d'un ModelForm Monkey-patching done in scoop.core.__init__ Le monkey patch se fait sur la classe django.db.models.Model - instance : objet dérivé de models.Model - form : objet de type forms.ModelForm dont la classe ciblé...
stack_v2_sparse_classes_36k_train_015413
10,808
no_license
[ { "docstring": "Renvoyer si un champ d'un formulaire est valide", "name": "is_field_valid", "signature": "def is_field_valid(form_, fieldnames)" }, { "docstring": "Mettre à jour les champs de l'objet selon l'état d'un formulaire - La validation ne se fait que sur les champs sélectionnés et valid...
2
stack_v2_sparse_classes_30k_train_010061
Implement the Python class `ModelFormUtil` described below. Class description: Mise à jour d'un objet de type Model avec certains champs d'un ModelForm Monkey-patching done in scoop.core.__init__ Le monkey patch se fait sur la classe django.db.models.Model - instance : objet dérivé de models.Model - form : objet de ty...
Implement the Python class `ModelFormUtil` described below. Class description: Mise à jour d'un objet de type Model avec certains champs d'un ModelForm Monkey-patching done in scoop.core.__init__ Le monkey patch se fait sur la classe django.db.models.Model - instance : objet dérivé de models.Model - form : objet de ty...
8cef6f6e89c1990e2b25f83e54e0c3481d83b6d7
<|skeleton|> class ModelFormUtil: """Mise à jour d'un objet de type Model avec certains champs d'un ModelForm Monkey-patching done in scoop.core.__init__ Le monkey patch se fait sur la classe django.db.models.Model - instance : objet dérivé de models.Model - form : objet de type forms.ModelForm dont la classe ciblé...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ModelFormUtil: """Mise à jour d'un objet de type Model avec certains champs d'un ModelForm Monkey-patching done in scoop.core.__init__ Le monkey patch se fait sur la classe django.db.models.Model - instance : objet dérivé de models.Model - form : objet de type forms.ModelForm dont la classe ciblée est celle d...
the_stack_v2_python_sparse
scoop/core/util/django/forms.py
artscoop/scoop
train
0
7a8cc6a1a2d70ded49996b9e5700b1b0ecab984b
[ "self.code = code\nself.id = id\nself.is_system_defined = is_system_defined\nself.jar_name = jar_name\nself.jar_path = jar_path\nself.language = language\nself.name = name", "if dictionary is None:\n return None\ncode = dictionary.get('code')\nid = dictionary.get('id')\nis_system_defined = dictionary.get('isSy...
<|body_start_0|> self.code = code self.id = id self.is_system_defined = is_system_defined self.jar_name = jar_name self.jar_path = jar_path self.language = language self.name = name <|end_body_0|> <|body_start_1|> if dictionary is None: return...
Implementation of the 'MapperInfo' model. TODO: type description here. Attributes: code (string): The code of the mapper in the specified language. Should be UTF-8. id (long|int): Mapper ID generated by system. Absent when user is creating a new mapper. Mandatory in all other use cases. is_system_defined (bool): Whethe...
MapperInfo
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MapperInfo: """Implementation of the 'MapperInfo' model. TODO: type description here. Attributes: code (string): The code of the mapper in the specified language. Should be UTF-8. id (long|int): Mapper ID generated by system. Absent when user is creating a new mapper. Mandatory in all other use c...
stack_v2_sparse_classes_36k_train_015414
2,938
permissive
[ { "docstring": "Constructor for the MapperInfo class", "name": "__init__", "signature": "def __init__(self, code=None, id=None, is_system_defined=None, jar_name=None, jar_path=None, language=None, name=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary...
2
null
Implement the Python class `MapperInfo` described below. Class description: Implementation of the 'MapperInfo' model. TODO: type description here. Attributes: code (string): The code of the mapper in the specified language. Should be UTF-8. id (long|int): Mapper ID generated by system. Absent when user is creating a n...
Implement the Python class `MapperInfo` described below. Class description: Implementation of the 'MapperInfo' model. TODO: type description here. Attributes: code (string): The code of the mapper in the specified language. Should be UTF-8. id (long|int): Mapper ID generated by system. Absent when user is creating a n...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class MapperInfo: """Implementation of the 'MapperInfo' model. TODO: type description here. Attributes: code (string): The code of the mapper in the specified language. Should be UTF-8. id (long|int): Mapper ID generated by system. Absent when user is creating a new mapper. Mandatory in all other use c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MapperInfo: """Implementation of the 'MapperInfo' model. TODO: type description here. Attributes: code (string): The code of the mapper in the specified language. Should be UTF-8. id (long|int): Mapper ID generated by system. Absent when user is creating a new mapper. Mandatory in all other use cases. is_syst...
the_stack_v2_python_sparse
cohesity_management_sdk/models/mapper_info.py
cohesity/management-sdk-python
train
24
10b25eea5c9846c891d6a2c90ef760a898dd666d
[ "loc = {}\nloc['FOO'] = 'foo'\nloc['BAR'] = SCons.Util.CLVar('bar')\nloc['CALL'] = lambda target, source, env, for_signature: 'call'\nenv = DummyEnv(loc)\ncmd = SCons.Util.CLVar('test $FOO $BAR $CALL test')\nnewcmd = scons_subst(cmd, env, gvars=env.Dictionary())\nassert newcmd == ['test', 'foo', 'bar', 'call', 'tes...
<|body_start_0|> loc = {} loc['FOO'] = 'foo' loc['BAR'] = SCons.Util.CLVar('bar') loc['CALL'] = lambda target, source, env, for_signature: 'call' env = DummyEnv(loc) cmd = SCons.Util.CLVar('test $FOO $BAR $CALL test') newcmd = scons_subst(cmd, env, gvars=env.Dicti...
CLVar_TestCase
[ "MIT", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CLVar_TestCase: def test_CLVar(self) -> None: """Test scons_subst() and scons_subst_list() with CLVar objects""" <|body_0|> def test_subst_overriding_lvars_overrides(self) -> None: """Test that optional passed arg overrides overrides gvars, and existing lvars.""" ...
stack_v2_sparse_classes_36k_train_015415
47,375
permissive
[ { "docstring": "Test scons_subst() and scons_subst_list() with CLVar objects", "name": "test_CLVar", "signature": "def test_CLVar(self) -> None" }, { "docstring": "Test that optional passed arg overrides overrides gvars, and existing lvars.", "name": "test_subst_overriding_lvars_overrides", ...
2
null
Implement the Python class `CLVar_TestCase` described below. Class description: Implement the CLVar_TestCase class. Method signatures and docstrings: - def test_CLVar(self) -> None: Test scons_subst() and scons_subst_list() with CLVar objects - def test_subst_overriding_lvars_overrides(self) -> None: Test that option...
Implement the Python class `CLVar_TestCase` described below. Class description: Implement the CLVar_TestCase class. Method signatures and docstrings: - def test_CLVar(self) -> None: Test scons_subst() and scons_subst_list() with CLVar objects - def test_subst_overriding_lvars_overrides(self) -> None: Test that option...
b2a7d7066a2b854460a334a5fe737ea389655e6e
<|skeleton|> class CLVar_TestCase: def test_CLVar(self) -> None: """Test scons_subst() and scons_subst_list() with CLVar objects""" <|body_0|> def test_subst_overriding_lvars_overrides(self) -> None: """Test that optional passed arg overrides overrides gvars, and existing lvars.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CLVar_TestCase: def test_CLVar(self) -> None: """Test scons_subst() and scons_subst_list() with CLVar objects""" loc = {} loc['FOO'] = 'foo' loc['BAR'] = SCons.Util.CLVar('bar') loc['CALL'] = lambda target, source, env, for_signature: 'call' env = DummyEnv(loc) ...
the_stack_v2_python_sparse
SCons/SubstTests.py
SCons/scons
train
1,827
959c5ba910b87b05bc1cdf67bfbd126391f5caaf
[ "super().__init__()\nself.input_channel_size = input_channels\nself.output_channel_size = output_channels\nself.num_nodes = num_nodes\nGraphConv.global_count += 1\nself.name = name if name else 'Graph_{}'.format(GraphConv.global_count)\nvalue = math.sqrt(6 / (input_channels + output_channels))\nmat_weights = []\nid...
<|body_start_0|> super().__init__() self.input_channel_size = input_channels self.output_channel_size = output_channels self.num_nodes = num_nodes GraphConv.global_count += 1 self.name = name if name else 'Graph_{}'.format(GraphConv.global_count) value = math.sqrt...
Graph Conv layer. See: https://arxiv.org/abs/1609.02907
GraphConv
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GraphConv: """Graph Conv layer. See: https://arxiv.org/abs/1609.02907""" def __init__(self, input_channels, output_channels, num_nodes, bias=True, activation=lbann.Relu, name=None): """Initialize Graph layer Args: input_channels (int): The size of the input node features output_chann...
stack_v2_sparse_classes_36k_train_015416
4,744
permissive
[ { "docstring": "Initialize Graph layer Args: input_channels (int): The size of the input node features output_channels (int): The output size of the node features num_nodes (int): Number of vertices in the graph bias (bool): Whether to apply biases after weights transform activation (type): Activation layer for...
2
stack_v2_sparse_classes_30k_train_020318
Implement the Python class `GraphConv` described below. Class description: Graph Conv layer. See: https://arxiv.org/abs/1609.02907 Method signatures and docstrings: - def __init__(self, input_channels, output_channels, num_nodes, bias=True, activation=lbann.Relu, name=None): Initialize Graph layer Args: input_channel...
Implement the Python class `GraphConv` described below. Class description: Graph Conv layer. See: https://arxiv.org/abs/1609.02907 Method signatures and docstrings: - def __init__(self, input_channels, output_channels, num_nodes, bias=True, activation=lbann.Relu, name=None): Initialize Graph layer Args: input_channel...
e8cf85eed2acbd3383892bf7cb2d88b44c194f4f
<|skeleton|> class GraphConv: """Graph Conv layer. See: https://arxiv.org/abs/1609.02907""" def __init__(self, input_channels, output_channels, num_nodes, bias=True, activation=lbann.Relu, name=None): """Initialize Graph layer Args: input_channels (int): The size of the input node features output_chann...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GraphConv: """Graph Conv layer. See: https://arxiv.org/abs/1609.02907""" def __init__(self, input_channels, output_channels, num_nodes, bias=True, activation=lbann.Relu, name=None): """Initialize Graph layer Args: input_channels (int): The size of the input node features output_channels (int): Th...
the_stack_v2_python_sparse
python/lbann/modules/graph/sparse/GraphConv.py
LLNL/lbann
train
225
945a4b093259cdad37747481dee12ada7cef3f37
[ "self._amount = amount\nself._user = user\nself._fund = FundModel.find_by_id(fund_id)", "if self._amount <= 0:\n return DonationResult.STINGY\nif self._fund is None:\n return DonationResult.LIAR\ntry:\n if UserStateModel.withdraw(user=self._user, amount=self._amount):\n EventModel.from_event(Donat...
<|body_start_0|> self._amount = amount self._user = user self._fund = FundModel.find_by_id(fund_id) <|end_body_0|> <|body_start_1|> if self._amount <= 0: return DonationResult.STINGY if self._fund is None: return DonationResult.LIAR try: ...
Class hides mildly complex donation logic from cruel outer world.
DonationsService
[ "LicenseRef-scancode-proprietary-license", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DonationsService: """Class hides mildly complex donation logic from cruel outer world.""" def __init__(self, user: User, fund_id: str, amount: Decimal) -> None: """Constructor. :param user: Current user :type user: User""" <|body_0|> def donate(self) -> DonationResult: ...
stack_v2_sparse_classes_36k_train_015417
6,001
permissive
[ { "docstring": "Constructor. :param user: Current user :type user: User", "name": "__init__", "signature": "def __init__(self, user: User, fund_id: str, amount: Decimal) -> None" }, { "docstring": "Perform a donation process: - check if there is enough active money to spare - check if fund exist...
2
stack_v2_sparse_classes_30k_train_008727
Implement the Python class `DonationsService` described below. Class description: Class hides mildly complex donation logic from cruel outer world. Method signatures and docstrings: - def __init__(self, user: User, fund_id: str, amount: Decimal) -> None: Constructor. :param user: Current user :type user: User - def d...
Implement the Python class `DonationsService` described below. Class description: Class hides mildly complex donation logic from cruel outer world. Method signatures and docstrings: - def __init__(self, user: User, fund_id: str, amount: Decimal) -> None: Constructor. :param user: Current user :type user: User - def d...
dd89a1fdacc322a43090169aae9e36f03f1b55c2
<|skeleton|> class DonationsService: """Class hides mildly complex donation logic from cruel outer world.""" def __init__(self, user: User, fund_id: str, amount: Decimal) -> None: """Constructor. :param user: Current user :type user: User""" <|body_0|> def donate(self) -> DonationResult: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DonationsService: """Class hides mildly complex donation logic from cruel outer world.""" def __init__(self, user: User, fund_id: str, amount: Decimal) -> None: """Constructor. :param user: Current user :type user: User""" self._amount = amount self._user = user self._fund...
the_stack_v2_python_sparse
vulyk/blueprints/gamification/services.py
mrgambal/vulyk
train
34
055c378caf94fdbca13f438c013da44397d8d14e
[ "self.parser = argparse.ArgumentParser()\nself.parser.add_argument('-ncep', '--ncep_trkr_filename', help='The path to the file containing the NCEP TC tracker output (fort.64).', default=None)\nself.parser.add_argument('-tcv', '--tcv_filename', help='The path to the file containing the TC-vitals.', default=None)\nse...
<|body_start_0|> self.parser = argparse.ArgumentParser() self.parser.add_argument('-ncep', '--ncep_trkr_filename', help='The path to the file containing the NCEP TC tracker output (fort.64).', default=None) self.parser.add_argument('-tcv', '--tcv_filename', help='The path to the file containing ...
DESCRIPTION: This is the base-class object used to collect command line arguments provided by the user.
ObsPreProcTCVOptions
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObsPreProcTCVOptions: """DESCRIPTION: This is the base-class object used to collect command line arguments provided by the user.""" def __init__(self): """DESCRIPTION: Creates a new ObsPreProcTCVOptions object.""" <|body_0|> def run(self): """DESCRIPTION: This me...
stack_v2_sparse_classes_36k_train_015418
17,469
no_license
[ { "docstring": "DESCRIPTION: Creates a new ObsPreProcTCVOptions object.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "DESCRIPTION: This method collects the user-specified command-line arguments; the available command line arguments are as follows: -ncep; The path to ...
2
stack_v2_sparse_classes_30k_train_019413
Implement the Python class `ObsPreProcTCVOptions` described below. Class description: DESCRIPTION: This is the base-class object used to collect command line arguments provided by the user. Method signatures and docstrings: - def __init__(self): DESCRIPTION: Creates a new ObsPreProcTCVOptions object. - def run(self):...
Implement the Python class `ObsPreProcTCVOptions` described below. Class description: DESCRIPTION: This is the base-class object used to collect command line arguments provided by the user. Method signatures and docstrings: - def __init__(self): DESCRIPTION: Creates a new ObsPreProcTCVOptions object. - def run(self):...
cba6b3649eb7a25bb8be392db1901f47d3287c93
<|skeleton|> class ObsPreProcTCVOptions: """DESCRIPTION: This is the base-class object used to collect command line arguments provided by the user.""" def __init__(self): """DESCRIPTION: Creates a new ObsPreProcTCVOptions object.""" <|body_0|> def run(self): """DESCRIPTION: This me...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ObsPreProcTCVOptions: """DESCRIPTION: This is the base-class object used to collect command line arguments provided by the user.""" def __init__(self): """DESCRIPTION: Creates a new ObsPreProcTCVOptions object.""" self.parser = argparse.ArgumentParser() self.parser.add_argument('-...
the_stack_v2_python_sparse
ush/hafs_opptcv_format.py
hafs-community/HAFS
train
22
caf54cd1807dcacbf822584c08e45d9933187b6e
[ "if n == 1:\n return 1\nfirst, second = (1, 2)\nfor i in range(3, n + 1):\n third = first + second\n first = second\n second = third\nreturn second", "cache = {0: 1, 1: 1}\nfor i in range(2, n + 1):\n cache[i] = cache[i - 1] + cache[i - 2]\nreturn cache[n]", "if n in self.cache:\n return self....
<|body_start_0|> if n == 1: return 1 first, second = (1, 2) for i in range(3, n + 1): third = first + second first = second second = third return second <|end_body_0|> <|body_start_1|> cache = {0: 1, 1: 1} for i in range(2,...
ClimbingStairs
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClimbingStairs: def total_ways(self, n: int) -> int: """Approach: Fibonacci Number Time Complexity: O(N) Space Complexity: O(1) :param n: :param int: :return:""" <|body_0|> def total_ways_(self, n: int) -> int: """Approach: DP Time Complexity: O(N) Space Complexity: ...
stack_v2_sparse_classes_36k_train_015419
1,757
no_license
[ { "docstring": "Approach: Fibonacci Number Time Complexity: O(N) Space Complexity: O(1) :param n: :param int: :return:", "name": "total_ways", "signature": "def total_ways(self, n: int) -> int" }, { "docstring": "Approach: DP Time Complexity: O(N) Space Complexity: O(N) :param n: :return:", ...
4
stack_v2_sparse_classes_30k_train_018202
Implement the Python class `ClimbingStairs` described below. Class description: Implement the ClimbingStairs class. Method signatures and docstrings: - def total_ways(self, n: int) -> int: Approach: Fibonacci Number Time Complexity: O(N) Space Complexity: O(1) :param n: :param int: :return: - def total_ways_(self, n:...
Implement the Python class `ClimbingStairs` described below. Class description: Implement the ClimbingStairs class. Method signatures and docstrings: - def total_ways(self, n: int) -> int: Approach: Fibonacci Number Time Complexity: O(N) Space Complexity: O(1) :param n: :param int: :return: - def total_ways_(self, n:...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class ClimbingStairs: def total_ways(self, n: int) -> int: """Approach: Fibonacci Number Time Complexity: O(N) Space Complexity: O(1) :param n: :param int: :return:""" <|body_0|> def total_ways_(self, n: int) -> int: """Approach: DP Time Complexity: O(N) Space Complexity: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClimbingStairs: def total_ways(self, n: int) -> int: """Approach: Fibonacci Number Time Complexity: O(N) Space Complexity: O(1) :param n: :param int: :return:""" if n == 1: return 1 first, second = (1, 2) for i in range(3, n + 1): third = first + second ...
the_stack_v2_python_sparse
revisited_2021/dp/climbing_stairs.py
Shiv2157k/leet_code
train
1
4eac0a204bd080ba3e8750fdec61c4a335dd1f1c
[ "if self.state_model.op_state in [DevState.FAULT, DevState.UNKNOWN]:\n tango.Except.throw_exception(f'Command TelescopeOn is not allowed in current state {self.state_model.op_state}.', 'Failed to invoke On command on CspMasterLeafNode.', 'CspMasterLeafNode.TelescopeOn()', tango.ErrSeverity.ERR)\nreturn True", ...
<|body_start_0|> if self.state_model.op_state in [DevState.FAULT, DevState.UNKNOWN]: tango.Except.throw_exception(f'Command TelescopeOn is not allowed in current state {self.state_model.op_state}.', 'Failed to invoke On command on CspMasterLeafNode.', 'CspMasterLeafNode.TelescopeOn()', tango.ErrSeve...
A class for CspMasterLeafNode's TelescopeOn() command. On command is inherited from BaseCommand. It Sets the State to On.
TelescopeOn
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TelescopeOn: """A class for CspMasterLeafNode's TelescopeOn() command. On command is inherited from BaseCommand. It Sets the State to On.""" def check_allowed(self): """Checks whether this command is allowed to be run in current device state :return: True if this command is allowed t...
stack_v2_sparse_classes_36k_train_015420
4,504
permissive
[ { "docstring": "Checks whether this command is allowed to be run in current device state :return: True if this command is allowed to be run in current device state :rtype: boolean :raises: DevFailed if this command is not allowed to be run in current device state", "name": "check_allowed", "signature": ...
3
stack_v2_sparse_classes_30k_train_017791
Implement the Python class `TelescopeOn` described below. Class description: A class for CspMasterLeafNode's TelescopeOn() command. On command is inherited from BaseCommand. It Sets the State to On. Method signatures and docstrings: - def check_allowed(self): Checks whether this command is allowed to be run in curren...
Implement the Python class `TelescopeOn` described below. Class description: A class for CspMasterLeafNode's TelescopeOn() command. On command is inherited from BaseCommand. It Sets the State to On. Method signatures and docstrings: - def check_allowed(self): Checks whether this command is allowed to be run in curren...
7ee65a9c8dada9b28893144b372a398bd0646195
<|skeleton|> class TelescopeOn: """A class for CspMasterLeafNode's TelescopeOn() command. On command is inherited from BaseCommand. It Sets the State to On.""" def check_allowed(self): """Checks whether this command is allowed to be run in current device state :return: True if this command is allowed t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TelescopeOn: """A class for CspMasterLeafNode's TelescopeOn() command. On command is inherited from BaseCommand. It Sets the State to On.""" def check_allowed(self): """Checks whether this command is allowed to be run in current device state :return: True if this command is allowed to be run in c...
the_stack_v2_python_sparse
temp_src/ska_tmc_cspmasterleafnode_mid/telescope_on_command.py
ska-telescope/tmc-prototype
train
4
3ba98098466b472909ac637a0b4118f66025cc13
[ "log.info('[%s] Message Instance Created' % subject)\nself._subject = subject\nmsg = message.EmailMessage(subject=subject, body=body, from_email='zk_monitor', to=[email], connection=conn)\nmsg.send(callback=self._alertSent)", "if state == 1:\n log.info('[%s] Message Sent Successfully!' % self._subject)\n re...
<|body_start_0|> log.info('[%s] Message Instance Created' % subject) self._subject = subject msg = message.EmailMessage(subject=subject, body=body, from_email='zk_monitor', to=[email], connection=conn) msg.send(callback=self._alertSent) <|end_body_0|> <|body_start_1|> if state =...
A single Email Alert.
EmailAlert
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmailAlert: """A single Email Alert.""" def __init__(self, subject, body, email, conn): """Simple object for sending and tracking an email. args: subject: Subject of the message body: Body of the email email: Email Address to send to conn: smtp.EmailBackend instance""" <|body...
stack_v2_sparse_classes_36k_train_015421
4,661
no_license
[ { "docstring": "Simple object for sending and tracking an email. args: subject: Subject of the message body: Body of the email email: Email Address to send to conn: smtp.EmailBackend instance", "name": "__init__", "signature": "def __init__(self, subject, body, email, conn)" }, { "docstring": "S...
2
stack_v2_sparse_classes_30k_train_003637
Implement the Python class `EmailAlert` described below. Class description: A single Email Alert. Method signatures and docstrings: - def __init__(self, subject, body, email, conn): Simple object for sending and tracking an email. args: subject: Subject of the message body: Body of the email email: Email Address to s...
Implement the Python class `EmailAlert` described below. Class description: A single Email Alert. Method signatures and docstrings: - def __init__(self, subject, body, email, conn): Simple object for sending and tracking an email. args: subject: Subject of the message body: Body of the email email: Email Address to s...
d33720eeec274396435896ed4fb1c71025344fc1
<|skeleton|> class EmailAlert: """A single Email Alert.""" def __init__(self, subject, body, email, conn): """Simple object for sending and tracking an email. args: subject: Subject of the message body: Body of the email email: Email Address to send to conn: smtp.EmailBackend instance""" <|body...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EmailAlert: """A single Email Alert.""" def __init__(self, subject, body, email, conn): """Simple object for sending and tracking an email. args: subject: Subject of the message body: Body of the email email: Email Address to send to conn: smtp.EmailBackend instance""" log.info('[%s] Mess...
the_stack_v2_python_sparse
zk_monitor/alerts/email.py
Nextdoor/zkmonitor
train
4
defe92c87bd701d77f25c3500aa5d6adb669e92b
[ "self.displays = None\nself.username = None\nself.password = None\nself.tenant = None", "app = self.hass.data.get(DATA_TOON_CONFIG, {})\nif not app:\n return self.async_abort(reason='no_app')\nreturn await self.async_step_authenticate(user_input)", "fields = OrderedDict()\nfields[vol.Required(CONF_USERNAME)]...
<|body_start_0|> self.displays = None self.username = None self.password = None self.tenant = None <|end_body_0|> <|body_start_1|> app = self.hass.data.get(DATA_TOON_CONFIG, {}) if not app: return self.async_abort(reason='no_app') return await self.as...
Handle a Toon config flow.
ToonFlowHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ToonFlowHandler: """Handle a Toon config flow.""" def __init__(self): """Initialize the Toon flow.""" <|body_0|> async def async_step_user(self, user_input=None): """Handle a flow initiated by the user.""" <|body_1|> async def _show_authenticaticate_...
stack_v2_sparse_classes_36k_train_015422
5,377
permissive
[ { "docstring": "Initialize the Toon flow.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Handle a flow initiated by the user.", "name": "async_step_user", "signature": "async def async_step_user(self, user_input=None)" }, { "docstring": "Show the authe...
6
null
Implement the Python class `ToonFlowHandler` described below. Class description: Handle a Toon config flow. Method signatures and docstrings: - def __init__(self): Initialize the Toon flow. - async def async_step_user(self, user_input=None): Handle a flow initiated by the user. - async def _show_authenticaticate_form...
Implement the Python class `ToonFlowHandler` described below. Class description: Handle a Toon config flow. Method signatures and docstrings: - def __init__(self): Initialize the Toon flow. - async def async_step_user(self, user_input=None): Handle a flow initiated by the user. - async def _show_authenticaticate_form...
6e414983738d9495eb9e4f858e3e98e9e38869db
<|skeleton|> class ToonFlowHandler: """Handle a Toon config flow.""" def __init__(self): """Initialize the Toon flow.""" <|body_0|> async def async_step_user(self, user_input=None): """Handle a flow initiated by the user.""" <|body_1|> async def _show_authenticaticate_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ToonFlowHandler: """Handle a Toon config flow.""" def __init__(self): """Initialize the Toon flow.""" self.displays = None self.username = None self.password = None self.tenant = None async def async_step_user(self, user_input=None): """Handle a flow i...
the_stack_v2_python_sparse
homeassistant/components/toon/config_flow.py
Watemlifts/home-assistant
train
4
d07d3761c9b8b37d3c8762b32863e604f340e615
[ "if time_format is None:\n time_format = _TIME_FORMAT\nvalidator.check_paramType_str(time_format)\nif timestamp is None:\n return datetime.datetime.now().strftime(time_format)\nvalidator.check_paramType_int(timestamp)\nlocal_time = time.localtime(timestamp)\ntime_data = time.strftime(time_format, local_time)\...
<|body_start_0|> if time_format is None: time_format = _TIME_FORMAT validator.check_paramType_str(time_format) if timestamp is None: return datetime.datetime.now().strftime(time_format) validator.check_paramType_int(timestamp) local_time = time.localtime(t...
TimeHelper
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimeHelper: def get_time_from_timestamp(timestamp=None, time_format=None): """功能:将一个时间戳转为指定时间格式的时间,默认转为的时间格式为:%Y-%m-%d %H:%M:%S 场景1:获取当前时间,时间格式为:%Y-%m-%d %H:%M:%S get_time_from_timestamp() 场景2:获取当前时间,时间格式为:%H:%M:%S get_time_from_timestamp(time_format="%H:%M:%S") 场景3:根据指定时间戳来获取时间,时间格式为:%Y...
stack_v2_sparse_classes_36k_train_015423
31,475
no_license
[ { "docstring": "功能:将一个时间戳转为指定时间格式的时间,默认转为的时间格式为:%Y-%m-%d %H:%M:%S 场景1:获取当前时间,时间格式为:%Y-%m-%d %H:%M:%S get_time_from_timestamp() 场景2:获取当前时间,时间格式为:%H:%M:%S get_time_from_timestamp(time_format=\"%H:%M:%S\") 场景3:根据指定时间戳来获取时间,时间格式为:%Y-%m-%d %H:%M:%S get_time_from_timestamp(timestamp=1569850832) :param timestamp: 待转换为...
4
null
Implement the Python class `TimeHelper` described below. Class description: Implement the TimeHelper class. Method signatures and docstrings: - def get_time_from_timestamp(timestamp=None, time_format=None): 功能:将一个时间戳转为指定时间格式的时间,默认转为的时间格式为:%Y-%m-%d %H:%M:%S 场景1:获取当前时间,时间格式为:%Y-%m-%d %H:%M:%S get_time_from_timestamp() ...
Implement the Python class `TimeHelper` described below. Class description: Implement the TimeHelper class. Method signatures and docstrings: - def get_time_from_timestamp(timestamp=None, time_format=None): 功能:将一个时间戳转为指定时间格式的时间,默认转为的时间格式为:%Y-%m-%d %H:%M:%S 场景1:获取当前时间,时间格式为:%Y-%m-%d %H:%M:%S get_time_from_timestamp() ...
543b1e0a567bd7094875ef8f26212c16a4378bde
<|skeleton|> class TimeHelper: def get_time_from_timestamp(timestamp=None, time_format=None): """功能:将一个时间戳转为指定时间格式的时间,默认转为的时间格式为:%Y-%m-%d %H:%M:%S 场景1:获取当前时间,时间格式为:%Y-%m-%d %H:%M:%S get_time_from_timestamp() 场景2:获取当前时间,时间格式为:%H:%M:%S get_time_from_timestamp(time_format="%H:%M:%S") 场景3:根据指定时间戳来获取时间,时间格式为:%Y...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TimeHelper: def get_time_from_timestamp(timestamp=None, time_format=None): """功能:将一个时间戳转为指定时间格式的时间,默认转为的时间格式为:%Y-%m-%d %H:%M:%S 场景1:获取当前时间,时间格式为:%Y-%m-%d %H:%M:%S get_time_from_timestamp() 场景2:获取当前时间,时间格式为:%H:%M:%S get_time_from_timestamp(time_format="%H:%M:%S") 场景3:根据指定时间戳来获取时间,时间格式为:%Y-%m-%d %H:%M:%...
the_stack_v2_python_sparse
接口/Data/Report_Data/base/helper.py
CHENMO12/MyGithub
train
0
683e5ac7a23a76c3996b3ef8dec3a4db88f001a3
[ "branch_weight = perceptron_table.perceptron[address]\nglobal_history = global_hr.global_history\ntheta = len(global_history) * 2 + 20\nif weight * yi < 0 or abs(weight) < theta:\n for i in range(len(branch_weight)):\n branch_weight[i] += yi * global_history[i]", "weight = 0.0\nbranch_weight = perceptro...
<|body_start_0|> branch_weight = perceptron_table.perceptron[address] global_history = global_hr.global_history theta = len(global_history) * 2 + 20 if weight * yi < 0 or abs(weight) < theta: for i in range(len(branch_weight)): branch_weight[i] += yi * global_...
Perceptron
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Perceptron: def train(self, address, weight, yi, perceptron_table, global_hr): """According to the definition of perceptron, we update our f(x) model if f(x)*yi is less than 0 for each trace. While if f(x) is too small, it also need update. :param address: int PC address :param weight: f...
stack_v2_sparse_classes_36k_train_015424
2,941
no_license
[ { "docstring": "According to the definition of perceptron, we update our f(x) model if f(x)*yi is less than 0 for each trace. While if f(x) is too small, it also need update. :param address: int PC address :param weight: float random set at first, and update it base on wx>0? :param yi: int previous branch resul...
3
stack_v2_sparse_classes_30k_train_009402
Implement the Python class `Perceptron` described below. Class description: Implement the Perceptron class. Method signatures and docstrings: - def train(self, address, weight, yi, perceptron_table, global_hr): According to the definition of perceptron, we update our f(x) model if f(x)*yi is less than 0 for each trac...
Implement the Python class `Perceptron` described below. Class description: Implement the Perceptron class. Method signatures and docstrings: - def train(self, address, weight, yi, perceptron_table, global_hr): According to the definition of perceptron, we update our f(x) model if f(x)*yi is less than 0 for each trac...
2711bc08f15266bec4ca135e8e3e629df46713eb
<|skeleton|> class Perceptron: def train(self, address, weight, yi, perceptron_table, global_hr): """According to the definition of perceptron, we update our f(x) model if f(x)*yi is less than 0 for each trace. While if f(x) is too small, it also need update. :param address: int PC address :param weight: f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Perceptron: def train(self, address, weight, yi, perceptron_table, global_hr): """According to the definition of perceptron, we update our f(x) model if f(x)*yi is less than 0 for each trace. While if f(x) is too small, it also need update. :param address: int PC address :param weight: float random se...
the_stack_v2_python_sparse
6.基于机器学习的CPU分支预测/Perceptron.py
unlimitediw/CheckCode
train
0
9d1d6d65fc9a6e820e3a2a29b77e8a809384eb37
[ "self.root = root\nself.checksum = checksum\nself._verify()\nsuper().__init__(root, crs, res, transforms=transforms, cache=cache)", "pathname = os.path.join(self.root, self.filename_glob)\nif glob.glob(pathname):\n return\npathname = os.path.join(self.root, self.zipfile_glob)\nif glob.glob(pathname):\n for ...
<|body_start_0|> self.root = root self.checksum = checksum self._verify() super().__init__(root, crs, res, transforms=transforms, cache=cache) <|end_body_0|> <|body_start_1|> pathname = os.path.join(self.root, self.filename_glob) if glob.glob(pathname): retur...
European Digital Elevation Model (EU-DEM) Dataset. The `EU-DEM <https://land.copernicus.eu/imagery-in-situ/eu-dem/eu-dem-v1.1?tab=mapview>`__ dataset is a Digital Elevation Model of reference for the entire European region. The dataset can be downloaded from this `website <https://land.copernicus.eu/imagery-in-situ/eu-...
EUDEM
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EUDEM: """European Digital Elevation Model (EU-DEM) Dataset. The `EU-DEM <https://land.copernicus.eu/imagery-in-situ/eu-dem/eu-dem-v1.1?tab=mapview>`__ dataset is a Digital Elevation Model of reference for the entire European region. The dataset can be downloaded from this `website <https://land....
stack_v2_sparse_classes_36k_train_015425
7,256
permissive
[ { "docstring": "Initialize a new Dataset instance. Args: root: root directory where dataset can be found, here the collection of individual zip files for each tile should be found crs: :term:`coordinate reference system (CRS)` to warp to (defaults to the CRS of the first file found) res: resolution of the datas...
3
null
Implement the Python class `EUDEM` described below. Class description: European Digital Elevation Model (EU-DEM) Dataset. The `EU-DEM <https://land.copernicus.eu/imagery-in-situ/eu-dem/eu-dem-v1.1?tab=mapview>`__ dataset is a Digital Elevation Model of reference for the entire European region. The dataset can be downl...
Implement the Python class `EUDEM` described below. Class description: European Digital Elevation Model (EU-DEM) Dataset. The `EU-DEM <https://land.copernicus.eu/imagery-in-situ/eu-dem/eu-dem-v1.1?tab=mapview>`__ dataset is a Digital Elevation Model of reference for the entire European region. The dataset can be downl...
29985861614b3b93f9ef5389469ebb98570de7dd
<|skeleton|> class EUDEM: """European Digital Elevation Model (EU-DEM) Dataset. The `EU-DEM <https://land.copernicus.eu/imagery-in-situ/eu-dem/eu-dem-v1.1?tab=mapview>`__ dataset is a Digital Elevation Model of reference for the entire European region. The dataset can be downloaded from this `website <https://land....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EUDEM: """European Digital Elevation Model (EU-DEM) Dataset. The `EU-DEM <https://land.copernicus.eu/imagery-in-situ/eu-dem/eu-dem-v1.1?tab=mapview>`__ dataset is a Digital Elevation Model of reference for the entire European region. The dataset can be downloaded from this `website <https://land.copernicus.eu...
the_stack_v2_python_sparse
torchgeo/datasets/eudem.py
microsoft/torchgeo
train
1,724
cc15e2111cd96a422debe0d6bf491ae7cdd6723a
[ "self.actor_id = kwargs.get('actor_id')\nself.hp = kwargs.get('hp')\nself.max_ammo = kwargs.get('max_ammo')\nself.ammo = kwargs.get('ammo')", "self.actor_id = kwargs['actor_id']\nself.hp = kwargs['hp']\nself.max_ammo = kwargs['max_ammo']\nself.ammo = kwargs['ammo']", "ret = {}\nret['actor_id'] = sockutil.dump(s...
<|body_start_0|> self.actor_id = kwargs.get('actor_id') self.hp = kwargs.get('hp') self.max_ammo = kwargs.get('max_ammo') self.ammo = kwargs.get('ammo') <|end_body_0|> <|body_start_1|> self.actor_id = kwargs['actor_id'] self.hp = kwargs['hp'] self.max_ammo = kwar...
UpdateActorHpRequest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateActorHpRequest: def __init__(self, **kwargs): """Params: actor_id: int hp: int max_ammo: int ammo: int""" <|body_0|> def load(self, **kwargs): """load from dict Exception: KeyError""" <|body_1|> def dump(self): """dump -> dict""" <|...
stack_v2_sparse_classes_36k_train_015426
26,590
no_license
[ { "docstring": "Params: actor_id: int hp: int max_ammo: int ammo: int", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "load from dict Exception: KeyError", "name": "load", "signature": "def load(self, **kwargs)" }, { "docstring": "dump -> dict"...
3
stack_v2_sparse_classes_30k_train_000005
Implement the Python class `UpdateActorHpRequest` described below. Class description: Implement the UpdateActorHpRequest class. Method signatures and docstrings: - def __init__(self, **kwargs): Params: actor_id: int hp: int max_ammo: int ammo: int - def load(self, **kwargs): load from dict Exception: KeyError - def d...
Implement the Python class `UpdateActorHpRequest` described below. Class description: Implement the UpdateActorHpRequest class. Method signatures and docstrings: - def __init__(self, **kwargs): Params: actor_id: int hp: int max_ammo: int ammo: int - def load(self, **kwargs): load from dict Exception: KeyError - def d...
aa0b2697e295889e8c23a7104889ea95f2a4b6b1
<|skeleton|> class UpdateActorHpRequest: def __init__(self, **kwargs): """Params: actor_id: int hp: int max_ammo: int ammo: int""" <|body_0|> def load(self, **kwargs): """load from dict Exception: KeyError""" <|body_1|> def dump(self): """dump -> dict""" <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UpdateActorHpRequest: def __init__(self, **kwargs): """Params: actor_id: int hp: int max_ammo: int ammo: int""" self.actor_id = kwargs.get('actor_id') self.hp = kwargs.get('hp') self.max_ammo = kwargs.get('max_ammo') self.ammo = kwargs.get('ammo') def load(self, **...
the_stack_v2_python_sparse
message.py
songhui17/Server
train
0
d76999dba2768570f188b92bed1ad863212de70a
[ "store_view_obj = self.pool.get('magento.store.store_view')\nstore_view = store_view_obj.browse(cursor, user, context.get('active_id'))\nsales = store_view_obj.import_orders_from_store_view(cursor, user, store_view, context)\nreturn self.open_sales(cursor, user, map(int, sales), context)", "ir_model_data = self.p...
<|body_start_0|> store_view_obj = self.pool.get('magento.store.store_view') store_view = store_view_obj.browse(cursor, user, context.get('active_id')) sales = store_view_obj.import_orders_from_store_view(cursor, user, store_view, context) return self.open_sales(cursor, user, map(int, sal...
Import orders
ImportOrders
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImportOrders: """Import orders""" def import_orders(self, cursor, user, ids, context): """Import sale orders from magento for the current store view. :param cursor: Database cursor :param user: ID of current user :param ids: List of ids of records for this model :param context: Appli...
stack_v2_sparse_classes_36k_train_015427
2,001
no_license
[ { "docstring": "Import sale orders from magento for the current store view. :param cursor: Database cursor :param user: ID of current user :param ids: List of ids of records for this model :param context: Application context", "name": "import_orders", "signature": "def import_orders(self, cursor, user, ...
2
stack_v2_sparse_classes_30k_train_002048
Implement the Python class `ImportOrders` described below. Class description: Import orders Method signatures and docstrings: - def import_orders(self, cursor, user, ids, context): Import sale orders from magento for the current store view. :param cursor: Database cursor :param user: ID of current user :param ids: Li...
Implement the Python class `ImportOrders` described below. Class description: Import orders Method signatures and docstrings: - def import_orders(self, cursor, user, ids, context): Import sale orders from magento for the current store view. :param cursor: Database cursor :param user: ID of current user :param ids: Li...
f661c776973868c0414007791ae6a0b069b1038f
<|skeleton|> class ImportOrders: """Import orders""" def import_orders(self, cursor, user, ids, context): """Import sale orders from magento for the current store view. :param cursor: Database cursor :param user: ID of current user :param ids: List of ids of records for this model :param context: Appli...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImportOrders: """Import orders""" def import_orders(self, cursor, user, ids, context): """Import sale orders from magento for the current store view. :param cursor: Database cursor :param user: ID of current user :param ids: List of ids of records for this model :param context: Application contex...
the_stack_v2_python_sparse
wizard/import_orders.py
openlabs/magento_integration
train
23
a8ec1e25dae76cc13fcb5f5037ad20fc32cd89c8
[ "self._algorithm = algorithm\nself._prefix = prefix\nself._type = type\nself._props = {}\npass", "if not name in self._props:\n raise AttributeError('Property \"%s\" was not set on \"%s/%s.%s\"' % (name, self._algorithm.type(), self._algorithm.name(), self._prefix))\nreturn self._props[name]", "if key[0] == ...
<|body_start_0|> self._algorithm = algorithm self._prefix = prefix self._type = type self._props = {} pass <|end_body_0|> <|body_start_1|> if not name in self._props: raise AttributeError('Property "%s" was not set on "%s/%s.%s"' % (name, self._algorithm.type...
Standalone Private Tool Configuration This class is used to mimic the behaviour of Athena tool configurable classes. To be able to set the properties of private tools used by dual-use algorithms in a way that's valid for both Athena and EventLoop.
PrivateToolConfig
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrivateToolConfig: """Standalone Private Tool Configuration This class is used to mimic the behaviour of Athena tool configurable classes. To be able to set the properties of private tools used by dual-use algorithms in a way that's valid for both Athena and EventLoop.""" def __init__(self, ...
stack_v2_sparse_classes_36k_train_015428
16,311
permissive
[ { "docstring": "Constructor for an private tool configuration object", "name": "__init__", "signature": "def __init__(self, algorithm, prefix, type)" }, { "docstring": "Get a previously set property value from the configuration This function allows us to retrieve the value of a tool property tha...
4
null
Implement the Python class `PrivateToolConfig` described below. Class description: Standalone Private Tool Configuration This class is used to mimic the behaviour of Athena tool configurable classes. To be able to set the properties of private tools used by dual-use algorithms in a way that's valid for both Athena and...
Implement the Python class `PrivateToolConfig` described below. Class description: Standalone Private Tool Configuration This class is used to mimic the behaviour of Athena tool configurable classes. To be able to set the properties of private tools used by dual-use algorithms in a way that's valid for both Athena and...
354f92551294f7be678aebcd7b9d67d2c4448176
<|skeleton|> class PrivateToolConfig: """Standalone Private Tool Configuration This class is used to mimic the behaviour of Athena tool configurable classes. To be able to set the properties of private tools used by dual-use algorithms in a way that's valid for both Athena and EventLoop.""" def __init__(self, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PrivateToolConfig: """Standalone Private Tool Configuration This class is used to mimic the behaviour of Athena tool configurable classes. To be able to set the properties of private tools used by dual-use algorithms in a way that's valid for both Athena and EventLoop.""" def __init__(self, algorithm, pr...
the_stack_v2_python_sparse
PhysicsAnalysis/D3PDTools/AnaAlgorithm/python/AnaAlgorithmConfig.py
strigazi/athena
train
0
ca54de5bbeaeca46c78ba0fbdb3ea718067d38c7
[ "FeatureDefinition.__init__(self)\nnbTypes = self._getTypeNumber(kwargs)\nprint('BETTER FEATURES')\nblock_transformer = FeatureUnion([('xywh', Pipeline([('selector', NodeTransformerXYWH_v2()), ('xywh', QuantileTransformer(n_quantiles=self.n_QUANTILES, copy=False))])), ('neighbors', Pipeline([('selector', NodeTransf...
<|body_start_0|> FeatureDefinition.__init__(self) nbTypes = self._getTypeNumber(kwargs) print('BETTER FEATURES') block_transformer = FeatureUnion([('xywh', Pipeline([('selector', NodeTransformerXYWH_v2()), ('xywh', QuantileTransformer(n_quantiles=self.n_QUANTILES, copy=False))])), ('neig...
Multitype version: so the node_transformer actually is a list of node_transformer of length n_class the edge_transformer actually is a list of node_transformer of length n_class^2 We also inherit from FeatureDefinition_T !!!
My_FeatureDefinition_v2
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class My_FeatureDefinition_v2: """Multitype version: so the node_transformer actually is a list of node_transformer of length n_class the edge_transformer actually is a list of node_transformer of length n_class^2 We also inherit from FeatureDefinition_T !!!""" def __init__(self, **kwargs): ...
stack_v2_sparse_classes_36k_train_015429
31,127
permissive
[ { "docstring": "set _node_transformer, _edge_transformer, tdifNodeTextVectorizer", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "Fit the transformers using the graphs, but TYPE BY TYPE !!! return True", "name": "fitTranformers", "signature": "def fitT...
2
null
Implement the Python class `My_FeatureDefinition_v2` described below. Class description: Multitype version: so the node_transformer actually is a list of node_transformer of length n_class the edge_transformer actually is a list of node_transformer of length n_class^2 We also inherit from FeatureDefinition_T !!! Meth...
Implement the Python class `My_FeatureDefinition_v2` described below. Class description: Multitype version: so the node_transformer actually is a list of node_transformer of length n_class the edge_transformer actually is a list of node_transformer of length n_class^2 We also inherit from FeatureDefinition_T !!! Meth...
9f2fed81672dc222ca52ee4329eac3126b500d21
<|skeleton|> class My_FeatureDefinition_v2: """Multitype version: so the node_transformer actually is a list of node_transformer of length n_class the edge_transformer actually is a list of node_transformer of length n_class^2 We also inherit from FeatureDefinition_T !!!""" def __init__(self, **kwargs): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class My_FeatureDefinition_v2: """Multitype version: so the node_transformer actually is a list of node_transformer of length n_class the edge_transformer actually is a list of node_transformer of length n_class^2 We also inherit from FeatureDefinition_T !!!""" def __init__(self, **kwargs): """set _nod...
the_stack_v2_python_sparse
TranskribusDU/tasks/TablePrototypes/DU_ABPTableRG3.py
Transkribus/TranskribusDU
train
24
40bf947af3f03c23acc7fc10efb7893380ce96a9
[ "owner_id = request.manager.id\nexsign = app_models.exSign.objects(owner_id=owner_id)\nif exsign.count() > 0:\n exsign = exsign[0]\n is_create_new_data = False\n project_id = 'new_app:exsign:%s' % exsign.related_page_id\nelse:\n exsign = None\n is_create_new_data = True\n project_id = 'new_app:exs...
<|body_start_0|> owner_id = request.manager.id exsign = app_models.exSign.objects(owner_id=owner_id) if exsign.count() > 0: exsign = exsign[0] is_create_new_data = False project_id = 'new_app:exsign:%s' % exsign.related_page_id else: exsign...
exSign
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class exSign: def get(request): """响应GET""" <|body_0|> def api_put(request): """响应PUT""" <|body_1|> def api_post(request): """响应POST""" <|body_2|> <|end_skeleton|> <|body_start_0|> owner_id = request.manager.id exsign = app_mo...
stack_v2_sparse_classes_36k_train_015430
3,317
no_license
[ { "docstring": "响应GET", "name": "get", "signature": "def get(request)" }, { "docstring": "响应PUT", "name": "api_put", "signature": "def api_put(request)" }, { "docstring": "响应POST", "name": "api_post", "signature": "def api_post(request)" } ]
3
stack_v2_sparse_classes_30k_train_004509
Implement the Python class `exSign` described below. Class description: Implement the exSign class. Method signatures and docstrings: - def get(request): 响应GET - def api_put(request): 响应PUT - def api_post(request): 响应POST
Implement the Python class `exSign` described below. Class description: Implement the exSign class. Method signatures and docstrings: - def get(request): 响应GET - def api_put(request): 响应PUT - def api_post(request): 响应POST <|skeleton|> class exSign: def get(request): """响应GET""" <|body_0|> d...
8b2f7befe92841bcc35e0e60cac5958ef3f3af54
<|skeleton|> class exSign: def get(request): """响应GET""" <|body_0|> def api_put(request): """响应PUT""" <|body_1|> def api_post(request): """响应POST""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class exSign: def get(request): """响应GET""" owner_id = request.manager.id exsign = app_models.exSign.objects(owner_id=owner_id) if exsign.count() > 0: exsign = exsign[0] is_create_new_data = False project_id = 'new_app:exsign:%s' % exsign.related_p...
the_stack_v2_python_sparse
weapp/apps/customerized_apps/exsign/exsign.py
chengdg/weizoom
train
1
8ca738bb5b067d1d509738538218da45d12aec80
[ "self.schema_blocks = schema_blocks\nself.required_fields = required_fields\nself.json_schema = self._build_json_schema()", "try:\n jsonschema.validate(registration_responses, self.json_schema)\nexcept jsonschema.ValidationError as e:\n properties = self.json_schema.get('properties', {})\n relative_path ...
<|body_start_0|> self.schema_blocks = schema_blocks self.required_fields = required_fields self.json_schema = self._build_json_schema() <|end_body_0|> <|body_start_1|> try: jsonschema.validate(registration_responses, self.json_schema) except jsonschema.ValidationErro...
RegistrationResponsesValidator
[ "MIT", "BSD-3-Clause", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-warranty-disclaimer", "AGPL-3.0-only", "LGPL-2.0-or-later", "LicenseRef-scancode-proprietary-license", "MPL-1.1", "CPAL-1.0", "LicenseRef-scancode-unknown-license-reference", "BSD-2-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegistrationResponsesValidator: def __init__(self, schema_blocks, required_fields): """For validating `registration_responses` on Registrations and DraftRegistrations :params schema_blocks iterable of SchemaBlock instances :params required_fields boolean - do we want to enforce that requ...
stack_v2_sparse_classes_36k_train_015431
17,225
permissive
[ { "docstring": "For validating `registration_responses` on Registrations and DraftRegistrations :params schema_blocks iterable of SchemaBlock instances :params required_fields boolean - do we want to enforce that required fields are present", "name": "__init__", "signature": "def __init__(self, schema_b...
5
null
Implement the Python class `RegistrationResponsesValidator` described below. Class description: Implement the RegistrationResponsesValidator class. Method signatures and docstrings: - def __init__(self, schema_blocks, required_fields): For validating `registration_responses` on Registrations and DraftRegistrations :p...
Implement the Python class `RegistrationResponsesValidator` described below. Class description: Implement the RegistrationResponsesValidator class. Method signatures and docstrings: - def __init__(self, schema_blocks, required_fields): For validating `registration_responses` on Registrations and DraftRegistrations :p...
a3e0a0b9ddda5dd75fc8248d58f3bcdeece0323e
<|skeleton|> class RegistrationResponsesValidator: def __init__(self, schema_blocks, required_fields): """For validating `registration_responses` on Registrations and DraftRegistrations :params schema_blocks iterable of SchemaBlock instances :params required_fields boolean - do we want to enforce that requ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RegistrationResponsesValidator: def __init__(self, schema_blocks, required_fields): """For validating `registration_responses` on Registrations and DraftRegistrations :params schema_blocks iterable of SchemaBlock instances :params required_fields boolean - do we want to enforce that required fields ar...
the_stack_v2_python_sparse
osf/models/validators.py
CenterForOpenScience/osf.io
train
683
4f4a0af05157f4f5ce13914aa271b4f0d025ca89
[ "self.dataset = dataset\nself.logger = logger\nself.length = len(self.dataset)", "if isinstance(test_info, str):\n self._check_load(test_info)\nelse:\n self._check_unit(test_info)", "n, unit = info\ncheck_len = n == self.length\nif check_len:\n logger.get_log().info('dataset length check success !!!')\...
<|body_start_0|> self.dataset = dataset self.logger = logger self.length = len(self.dataset) <|end_body_0|> <|body_start_1|> if isinstance(test_info, str): self._check_load(test_info) else: self._check_unit(test_info) <|end_body_1|> <|body_start_2|> ...
test Dataset class
TestDataset
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestDataset: """test Dataset class""" def __init__(self, dataset): """init""" <|body_0|> def run(self, test_info): """run""" <|body_1|> def _check_unit(self, info): """check unit case""" <|body_2|> def _check_load(self, dir): ...
stack_v2_sparse_classes_36k_train_015432
7,560
no_license
[ { "docstring": "init", "name": "__init__", "signature": "def __init__(self, dataset)" }, { "docstring": "run", "name": "run", "signature": "def run(self, test_info)" }, { "docstring": "check unit case", "name": "_check_unit", "signature": "def _check_unit(self, info)" }...
4
stack_v2_sparse_classes_30k_train_020443
Implement the Python class `TestDataset` described below. Class description: test Dataset class Method signatures and docstrings: - def __init__(self, dataset): init - def run(self, test_info): run - def _check_unit(self, info): check unit case - def _check_load(self, dir): check load case
Implement the Python class `TestDataset` described below. Class description: test Dataset class Method signatures and docstrings: - def __init__(self, dataset): init - def run(self, test_info): run - def _check_unit(self, info): check unit case - def _check_load(self, dir): check load case <|skeleton|> class TestDat...
bd3790ce72a2a26611b5eda3901651b5a809348f
<|skeleton|> class TestDataset: """test Dataset class""" def __init__(self, dataset): """init""" <|body_0|> def run(self, test_info): """run""" <|body_1|> def _check_unit(self, info): """check unit case""" <|body_2|> def _check_load(self, dir): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestDataset: """test Dataset class""" def __init__(self, dataset): """init""" self.dataset = dataset self.logger = logger self.length = len(self.dataset) def run(self, test_info): """run""" if isinstance(test_info, str): self._check_load(te...
the_stack_v2_python_sparse
framework/e2e/io/io_test.py
PaddlePaddle/PaddleTest
train
42
716ee3abb71db9975ec37ee8e9dce570f5a4c311
[ "globals()['Augmentor'] = importlib.import_module('Augmentor')\nif data_dir is not None and os.path.isdir(data_dir):\n self.option = 1\n self.pipeline = Augmentor.Pipeline(source_directory=data_dir)\n self.num_images = len(self.pipeline.augmentor_images)\n self.num_classes = np.unique(self.pipeline.clas...
<|body_start_0|> globals()['Augmentor'] = importlib.import_module('Augmentor') if data_dir is not None and os.path.isdir(data_dir): self.option = 1 self.pipeline = Augmentor.Pipeline(source_directory=data_dir) self.num_images = len(self.pipeline.augmentor_images) ...
ezData_Augmentor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ezData_Augmentor: def __init__(self, data_dir=None): """always assume: BatchSize x Height x Width x Channels Options: (1) load data straight into Augmentor.Pipeline if there a parent directory and all images of each class are in their own respective subdirectories (2) load in the data as...
stack_v2_sparse_classes_36k_train_015433
6,194
permissive
[ { "docstring": "always assume: BatchSize x Height x Width x Channels Options: (1) load data straight into Augmentor.Pipeline if there a parent directory and all images of each class are in their own respective subdirectories (2) load in the data as np.arrays of x and y, and eventually manually feed into Augment...
2
stack_v2_sparse_classes_30k_train_013525
Implement the Python class `ezData_Augmentor` described below. Class description: Implement the ezData_Augmentor class. Method signatures and docstrings: - def __init__(self, data_dir=None): always assume: BatchSize x Height x Width x Channels Options: (1) load data straight into Augmentor.Pipeline if there a parent ...
Implement the Python class `ezData_Augmentor` described below. Class description: Implement the ezData_Augmentor class. Method signatures and docstrings: - def __init__(self, data_dir=None): always assume: BatchSize x Height x Width x Channels Options: (1) load data straight into Augmentor.Pipeline if there a parent ...
a93df7ae91fd5905df368661b86ae653c3d08869
<|skeleton|> class ezData_Augmentor: def __init__(self, data_dir=None): """always assume: BatchSize x Height x Width x Channels Options: (1) load data straight into Augmentor.Pipeline if there a parent directory and all images of each class are in their own respective subdirectories (2) load in the data as...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ezData_Augmentor: def __init__(self, data_dir=None): """always assume: BatchSize x Height x Width x Channels Options: (1) load data straight into Augmentor.Pipeline if there a parent directory and all images of each class are in their own respective subdirectories (2) load in the data as np.arrays of ...
the_stack_v2_python_sparse
data/data_tools/ezData.py
ezCGP/ezCGP
train
6
9aaa3219a96fbb78e9a1be0648a1514bc24d0402
[ "self.logger = AntiVirusLogger(__name__, debug=debug)\nif not utils.check_root():\n self.logger.log('Please run as root exiting.', logtype='error')\n sys.exit(0)\nif cred is not None:\n self.cred = cred\nelse:\n self.logger.log('SecureTea AntiVirus credentials not found.', logtype='error')\n sys.exit...
<|body_start_0|> self.logger = AntiVirusLogger(__name__, debug=debug) if not utils.check_root(): self.logger.log('Please run as root exiting.', logtype='error') sys.exit(0) if cred is not None: self.cred = cred else: self.logger.log('Secure...
SecureTeaAntiVirus class.
SecureTeaAntiVirus
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SecureTeaAntiVirus: """SecureTeaAntiVirus class.""" def __init__(self, debug=False, cred=None): """Initialize SecureTeaAntiVirus. Args: debug (bool): Log on terminal or not cred (dict): SecureTea AntiVirus credentials Raises: None Returns: None""" <|body_0|> def start(se...
stack_v2_sparse_classes_36k_train_015434
3,217
permissive
[ { "docstring": "Initialize SecureTeaAntiVirus. Args: debug (bool): Log on terminal or not cred (dict): SecureTea AntiVirus credentials Raises: None Returns: None", "name": "__init__", "signature": "def __init__(self, debug=False, cred=None)" }, { "docstring": "Start AntiVirus core engine. Args: ...
2
stack_v2_sparse_classes_30k_train_003983
Implement the Python class `SecureTeaAntiVirus` described below. Class description: SecureTeaAntiVirus class. Method signatures and docstrings: - def __init__(self, debug=False, cred=None): Initialize SecureTeaAntiVirus. Args: debug (bool): Log on terminal or not cred (dict): SecureTea AntiVirus credentials Raises: N...
Implement the Python class `SecureTeaAntiVirus` described below. Class description: SecureTeaAntiVirus class. Method signatures and docstrings: - def __init__(self, debug=False, cred=None): Initialize SecureTeaAntiVirus. Args: debug (bool): Log on terminal or not cred (dict): SecureTea AntiVirus credentials Raises: N...
43dec187e5848b9ced8a6b4957b6e9028d4d43cd
<|skeleton|> class SecureTeaAntiVirus: """SecureTeaAntiVirus class.""" def __init__(self, debug=False, cred=None): """Initialize SecureTeaAntiVirus. Args: debug (bool): Log on terminal or not cred (dict): SecureTea AntiVirus credentials Raises: None Returns: None""" <|body_0|> def start(se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SecureTeaAntiVirus: """SecureTeaAntiVirus class.""" def __init__(self, debug=False, cred=None): """Initialize SecureTeaAntiVirus. Args: debug (bool): Log on terminal or not cred (dict): SecureTea AntiVirus credentials Raises: None Returns: None""" self.logger = AntiVirusLogger(__name__, d...
the_stack_v2_python_sparse
securetea/lib/antivirus/secureTeaAntiVirus.py
rejahrehim/SecureTea-Project
train
1
e034fab7c1b65e338e3668073f1729b8f6e2b25f
[ "n = len(s)\nif n == 0:\n return s\ndp = [[0] * n for i in range(n)]\nleft = 0\nright = 0\nfor i in range(n - 2, -1, -1):\n dp[i][i] = 1\n for j in range(i + 1, n):\n dp[i][j] = s[i] == s[j] and (j - i < 3 or dp[i + 1][j - 1])\n if dp[i][j] and right - left < j - i:\n left = i\n ...
<|body_start_0|> n = len(s) if n == 0: return s dp = [[0] * n for i in range(n)] left = 0 right = 0 for i in range(n - 2, -1, -1): dp[i][i] = 1 for j in range(i + 1, n): dp[i][j] = s[i] == s[j] and (j - i < 3 or dp[i + 1...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestPalindrome(self, s: str) -> str: """中级的动态规划——二维关系 时间复杂度 O(n^2) 空间复杂度O(n^2)""" <|body_0|> def longestPalindrome1(self, s: str) -> str: """中心扩展的方法 时间复杂度 O(n^2) 空间复杂度O(1)""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(s) ...
stack_v2_sparse_classes_36k_train_015435
968
no_license
[ { "docstring": "中级的动态规划——二维关系 时间复杂度 O(n^2) 空间复杂度O(n^2)", "name": "longestPalindrome", "signature": "def longestPalindrome(self, s: str) -> str" }, { "docstring": "中心扩展的方法 时间复杂度 O(n^2) 空间复杂度O(1)", "name": "longestPalindrome1", "signature": "def longestPalindrome1(self, s: str) -> str" }...
2
stack_v2_sparse_classes_30k_train_019694
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s: str) -> str: 中级的动态规划——二维关系 时间复杂度 O(n^2) 空间复杂度O(n^2) - def longestPalindrome1(self, s: str) -> str: 中心扩展的方法 时间复杂度 O(n^2) 空间复杂度O(1)
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s: str) -> str: 中级的动态规划——二维关系 时间复杂度 O(n^2) 空间复杂度O(n^2) - def longestPalindrome1(self, s: str) -> str: 中心扩展的方法 时间复杂度 O(n^2) 空间复杂度O(1) <|skeleton|> cla...
95dddb78bccd169d9d219a473627361fe739ab5e
<|skeleton|> class Solution: def longestPalindrome(self, s: str) -> str: """中级的动态规划——二维关系 时间复杂度 O(n^2) 空间复杂度O(n^2)""" <|body_0|> def longestPalindrome1(self, s: str) -> str: """中心扩展的方法 时间复杂度 O(n^2) 空间复杂度O(1)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestPalindrome(self, s: str) -> str: """中级的动态规划——二维关系 时间复杂度 O(n^2) 空间复杂度O(n^2)""" n = len(s) if n == 0: return s dp = [[0] * n for i in range(n)] left = 0 right = 0 for i in range(n - 2, -1, -1): dp[i][i] = 1 ...
the_stack_v2_python_sparse
DrasticPlan/longestPalindrome.py
Philex5/codingPractice
train
0
713e275ee06f20f9ace24cff743ca10bbfed08cf
[ "self._name = name\nself._password = password\nself._logged_in = False", "if password == self._password:\n self._logged_in = True\nelse:\n print('Incorrect password.')", "if self._logged_in:\n print(f'{self._name} is logged in.')\nelse:\n print(f'{self._name} is NOT logged in.')" ]
<|body_start_0|> self._name = name self._password = password self._logged_in = False <|end_body_0|> <|body_start_1|> if password == self._password: self._logged_in = True else: print('Incorrect password.') <|end_body_1|> <|body_start_2|> if self....
A user of the store.
User
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class User: """A user of the store.""" def __init__(self, name, password): """Initialise data for user.""" <|body_0|> def login(self, password): """Check password and log user in.""" <|body_1|> def show_status(self): """Print the status of the user...
stack_v2_sparse_classes_36k_train_015436
1,487
no_license
[ { "docstring": "Initialise data for user.", "name": "__init__", "signature": "def __init__(self, name, password)" }, { "docstring": "Check password and log user in.", "name": "login", "signature": "def login(self, password)" }, { "docstring": "Print the status of the user.", ...
3
stack_v2_sparse_classes_30k_train_009502
Implement the Python class `User` described below. Class description: A user of the store. Method signatures and docstrings: - def __init__(self, name, password): Initialise data for user. - def login(self, password): Check password and log user in. - def show_status(self): Print the status of the user.
Implement the Python class `User` described below. Class description: A user of the store. Method signatures and docstrings: - def __init__(self, name, password): Initialise data for user. - def login(self, password): Check password and log user in. - def show_status(self): Print the status of the user. <|skeleton|>...
dc2d3af99406c380f62f319c908984262d2be8f7
<|skeleton|> class User: """A user of the store.""" def __init__(self, name, password): """Initialise data for user.""" <|body_0|> def login(self, password): """Check password and log user in.""" <|body_1|> def show_status(self): """Print the status of the user...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class User: """A user of the store.""" def __init__(self, name, password): """Initialise data for user.""" self._name = name self._password = password self._logged_in = False def login(self, password): """Check password and log user in.""" if password == sel...
the_stack_v2_python_sparse
final-code/oop/inheritance_store.py
juliakyrychuk/python-for-beginners-resources
train
0
78dfcf4068c0b98ff80f67f17e9d8aaf502d424c
[ "self.food, self.food_idx = (food, 0)\nself.snake = deque([[0, 0]])\nself.size = (height, width)\nself.dirs = {'U': (-1, 0), 'L': (0, -1), 'R': (0, 1), 'D': (1, 0)}\nself.res = 0", "pos = [self.snake[0][0] + self.dirs[direction][0], self.snake[0][1] + self.dirs[direction][1]]\nif pos[0] < 0 or pos[0] >= self.size...
<|body_start_0|> self.food, self.food_idx = (food, 0) self.snake = deque([[0, 0]]) self.size = (height, width) self.dirs = {'U': (-1, 0), 'L': (0, -1), 'R': (0, 1), 'D': (1, 0)} self.res = 0 <|end_body_0|> <|body_start_1|> pos = [self.snake[0][0] + self.dirs[direction][0...
SnakeGame
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SnakeGame: def __init__(self, width: int, height: int, food: 'List[List[int]]'): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1],...
stack_v2_sparse_classes_36k_train_015437
3,226
no_license
[ { "docstring": "Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0].", "name": "__init__", "signature": "def __init__(self, widt...
3
null
Implement the Python class `SnakeGame` described below. Class description: Implement the SnakeGame class. Method signatures and docstrings: - def __init__(self, width: int, height: int, food: 'List[List[int]]'): Initialize your data structure here. @param width - screen width @param height - screen height @param food...
Implement the Python class `SnakeGame` described below. Class description: Implement the SnakeGame class. Method signatures and docstrings: - def __init__(self, width: int, height: int, food: 'List[List[int]]'): Initialize your data structure here. @param width - screen width @param height - screen height @param food...
4a1747b6497305f3821612d9c358a6795b1690da
<|skeleton|> class SnakeGame: def __init__(self, width: int, height: int, food: 'List[List[int]]'): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1],...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SnakeGame: def __init__(self, width: int, height: int, food: 'List[List[int]]'): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is...
the_stack_v2_python_sparse
Queue/q353_design_snake_game.py
sevenhe716/LeetCode
train
0
976ef4a4e02f900221e023f10dda42e190459cf7
[ "BaseNet.__init__(self, name=name)\nself.global_net = INetAffine(decay=decay, affine_w_initializer=affine_w_initializer, affine_b_initializer=affine_b_initializer, acti_func=acti_func, name='inet-global')\nself.local_net = INetDense(decay=decay, disp_w_initializer=disp_w_initializer, disp_b_initializer=disp_b_initi...
<|body_start_0|> BaseNet.__init__(self, name=name) self.global_net = INetAffine(decay=decay, affine_w_initializer=affine_w_initializer, affine_b_initializer=affine_b_initializer, acti_func=acti_func, name='inet-global') self.local_net = INetDense(decay=decay, disp_w_initializer=disp_w_initialize...
### Description Re-implementation of the registration network proposed in: Hu et al., Label-driven weakly-supervised learning for multimodal deformable image registration, arXiv:1711.01666 https://arxiv.org/abs/1711.01666 Hu et al., Weakly-Supervised Convolutional Neural Networks for Multimodal Image Registration, Medi...
INetHybridTwoStream
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class INetHybridTwoStream: """### Description Re-implementation of the registration network proposed in: Hu et al., Label-driven weakly-supervised learning for multimodal deformable image registration, arXiv:1711.01666 https://arxiv.org/abs/1711.01666 Hu et al., Weakly-Supervised Convolutional Neural N...
stack_v2_sparse_classes_36k_train_015438
7,784
permissive
[ { "docstring": ":param decay: float, regularisation decay :param affine_w_initializer: weight initialisation for affine registration network :param affine_b_initializer: bias initialisation for affine registration network :param disp_w_initializer: weight initialisation for dense registration network :param dis...
2
stack_v2_sparse_classes_30k_train_015293
Implement the Python class `INetHybridTwoStream` described below. Class description: ### Description Re-implementation of the registration network proposed in: Hu et al., Label-driven weakly-supervised learning for multimodal deformable image registration, arXiv:1711.01666 https://arxiv.org/abs/1711.01666 Hu et al., W...
Implement the Python class `INetHybridTwoStream` described below. Class description: ### Description Re-implementation of the registration network proposed in: Hu et al., Label-driven weakly-supervised learning for multimodal deformable image registration, arXiv:1711.01666 https://arxiv.org/abs/1711.01666 Hu et al., W...
67db048685705e36622bc2851b4c7794e56065ad
<|skeleton|> class INetHybridTwoStream: """### Description Re-implementation of the registration network proposed in: Hu et al., Label-driven weakly-supervised learning for multimodal deformable image registration, arXiv:1711.01666 https://arxiv.org/abs/1711.01666 Hu et al., Weakly-Supervised Convolutional Neural N...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class INetHybridTwoStream: """### Description Re-implementation of the registration network proposed in: Hu et al., Label-driven weakly-supervised learning for multimodal deformable image registration, arXiv:1711.01666 https://arxiv.org/abs/1711.01666 Hu et al., Weakly-Supervised Convolutional Neural Networks for M...
the_stack_v2_python_sparse
niftynet/network/interventional_hybrid_net.py
BRAINSia/NiftyNet
train
0
4bf8a3ca5213dc8e7bf9ec6fde34577bd28bfb41
[ "super().__init__()\nself.args = args\nself.get_controller(args)", "image = data['image']\nimage = cv2.imdecode(np.asarray(bytearray(image), dtype=np.uint8), 1)\nglobal global_steer\nglobal_steer = self.controller.get_steering_angle(image, args.horizon)" ]
<|body_start_0|> super().__init__() self.args = args self.get_controller(args) <|end_body_0|> <|body_start_1|> image = data['image'] image = cv2.imdecode(np.asarray(bytearray(image), dtype=np.uint8), 1) global global_steer global_steer = self.controller.get_steer...
Class that extends the client socket and BaseEnvironment Attributes: args (Object): command line arguments
WheelchairClientProtocol
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WheelchairClientProtocol: """Class that extends the client socket and BaseEnvironment Attributes: args (Object): command line arguments""" def __init__(self, args): """Instantiate an instance of the WheelchairClientProtocol Calls the __init__ of the extended classes Get the controlle...
stack_v2_sparse_classes_36k_train_015439
4,116
no_license
[ { "docstring": "Instantiate an instance of the WheelchairClientProtocol Calls the __init__ of the extended classes Get the controller based on the command line arguments", "name": "__init__", "signature": "def __init__(self, args)" }, { "docstring": "Function that receives the centre image from ...
2
stack_v2_sparse_classes_30k_train_002618
Implement the Python class `WheelchairClientProtocol` described below. Class description: Class that extends the client socket and BaseEnvironment Attributes: args (Object): command line arguments Method signatures and docstrings: - def __init__(self, args): Instantiate an instance of the WheelchairClientProtocol Cal...
Implement the Python class `WheelchairClientProtocol` described below. Class description: Class that extends the client socket and BaseEnvironment Attributes: args (Object): command line arguments Method signatures and docstrings: - def __init__(self, args): Instantiate an instance of the WheelchairClientProtocol Cal...
b5c67e0e7737e524d7780286552face882b63531
<|skeleton|> class WheelchairClientProtocol: """Class that extends the client socket and BaseEnvironment Attributes: args (Object): command line arguments""" def __init__(self, args): """Instantiate an instance of the WheelchairClientProtocol Calls the __init__ of the extended classes Get the controlle...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WheelchairClientProtocol: """Class that extends the client socket and BaseEnvironment Attributes: args (Object): command line arguments""" def __init__(self, args): """Instantiate an instance of the WheelchairClientProtocol Calls the __init__ of the extended classes Get the controller based on th...
the_stack_v2_python_sparse
src/environment/wheelchair.py
DomhnallBoyle/Research-Project
train
0
a25e9e52cc4a8bd00e8d59633590f572fb662fb2
[ "super(Runner, self).__init__()\nself._log('Runner.init')\nself._pipeline = pline\nself._output = output\nself._input = None\nself._execution_chain = list()\nprocess_chain = list()\nif self._pipeline.last() is not None:\n process_chain = self._pipeline.last().chain()\n self._input = process_chain[0].pipeline(...
<|body_start_0|> super(Runner, self).__init__() self._log('Runner.init') self._pipeline = pline self._output = output self._input = None self._execution_chain = list() process_chain = list() if self._pipeline.last() is not None: process_chain =...
A runner is used to extract the chain of processing operations from a Pipeline given an Output. The idea here is to traverse back up the Pipeline(s) and build an execution chain. When the runner is started, events from the "in" are streamed into the execution chain and outputed into the "out". Rebuilding in this way en...
Runner
[ "BSD-3-Clause-LBNL" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Runner: """A runner is used to extract the chain of processing operations from a Pipeline given an Output. The idea here is to traverse back up the Pipeline(s) and build an execution chain. When the runner is started, events from the "in" are streamed into the execution chain and outputed into th...
stack_v2_sparse_classes_36k_train_015440
35,761
permissive
[ { "docstring": "Create a new batch runner", "name": "__init__", "signature": "def __init__(self, pline, output)" }, { "docstring": "Start the runner Args: force (bool, optional): force Flush at the end of the batch source to cause any buffers to emit.", "name": "start", "signature": "def...
2
stack_v2_sparse_classes_30k_train_002332
Implement the Python class `Runner` described below. Class description: A runner is used to extract the chain of processing operations from a Pipeline given an Output. The idea here is to traverse back up the Pipeline(s) and build an execution chain. When the runner is started, events from the "in" are streamed into t...
Implement the Python class `Runner` described below. Class description: A runner is used to extract the chain of processing operations from a Pipeline given an Output. The idea here is to traverse back up the Pipeline(s) and build an execution chain. When the runner is started, events from the "in" are streamed into t...
62b90a60e68ef91d24a834a81436235885324ecf
<|skeleton|> class Runner: """A runner is used to extract the chain of processing operations from a Pipeline given an Output. The idea here is to traverse back up the Pipeline(s) and build an execution chain. When the runner is started, events from the "in" are streamed into the execution chain and outputed into th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Runner: """A runner is used to extract the chain of processing operations from a Pipeline given an Output. The idea here is to traverse back up the Pipeline(s) and build an execution chain. When the runner is started, events from the "in" are streamed into the execution chain and outputed into the "out". Rebu...
the_stack_v2_python_sparse
pypond/pipeline.py
esnet/pypond
train
5
93611a5a702e1c1138a902794f07af9d196cbc96
[ "slow = 0\nfor fast in range(len(nums)):\n if nums[fast] != val:\n nums[i] = nums[j]\n slow += 1\nreturn slow", "i = 0\nn = len(nums)\nwhile i < n:\n if nums[i] == val:\n nums[i], nums[n - 1] = (nums[n - 1], nums[i])\n n -= 1\n else:\n i += 1\nreturn n" ]
<|body_start_0|> slow = 0 for fast in range(len(nums)): if nums[fast] != val: nums[i] = nums[j] slow += 1 return slow <|end_body_0|> <|body_start_1|> i = 0 n = len(nums) while i < n: if nums[i] == val: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def removeElement(self, nums: List[int], val: int) -> int: """Time O(n) --> 2n; Space: O(1)""" <|body_0|> def removeElement_swap(self, nums: List[int], val: int) -> int: """When we encounter nums[i] == val, swap it's value with last element and dispose last...
stack_v2_sparse_classes_36k_train_015441
1,068
no_license
[ { "docstring": "Time O(n) --> 2n; Space: O(1)", "name": "removeElement", "signature": "def removeElement(self, nums: List[int], val: int) -> int" }, { "docstring": "When we encounter nums[i] == val, swap it's value with last element and dispose last one immediatly. O(n), swap operation == # of r...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeElement(self, nums: List[int], val: int) -> int: Time O(n) --> 2n; Space: O(1) - def removeElement_swap(self, nums: List[int], val: int) -> int: When we encounter nums[...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeElement(self, nums: List[int], val: int) -> int: Time O(n) --> 2n; Space: O(1) - def removeElement_swap(self, nums: List[int], val: int) -> int: When we encounter nums[...
1a3c1f4d6e9d3444039f087763b93241f4ba7892
<|skeleton|> class Solution: def removeElement(self, nums: List[int], val: int) -> int: """Time O(n) --> 2n; Space: O(1)""" <|body_0|> def removeElement_swap(self, nums: List[int], val: int) -> int: """When we encounter nums[i] == val, swap it's value with last element and dispose last...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def removeElement(self, nums: List[int], val: int) -> int: """Time O(n) --> 2n; Space: O(1)""" slow = 0 for fast in range(len(nums)): if nums[fast] != val: nums[i] = nums[j] slow += 1 return slow def removeElement_swap(...
the_stack_v2_python_sparse
Algorithm/027_RemoveElement.py
Gi1ia/TechNoteBook
train
7
0b5d49fe6c69285fca0a5ea1c822acdf1520e1d2
[ "func_name = sys._getframe().f_code.co_name\nhash = gl.get_value('hash')\nrow = self.get_case_row_index(func_name)\nrequest_data = self.get_request_data(func_name)\nfor imgs in ['imgs', 'detailImgs', 'bigProductImgs', 'bigImgs']:\n request_data[imgs] += hash\nrandomId = random.random()\nrandomId_en = random.rand...
<|body_start_0|> func_name = sys._getframe().f_code.co_name hash = gl.get_value('hash') row = self.get_case_row_index(func_name) request_data = self.get_request_data(func_name) for imgs in ['imgs', 'detailImgs', 'bigProductImgs', 'bigImgs']: request_data[imgs] += hash...
CommodityManagement
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommodityManagement: def test_urine_v2_goodsInfo_saveGoodsInfo(self): """添加商品 :return:""" <|body_0|> def test_urine_v2_goodsInfo_queryGoodsInfos(self): """查询商品信息 :return:""" <|body_1|> def test_urine_v2_goodsInfo_updateGoodsInfo(self): """更新商品信息 ...
stack_v2_sparse_classes_36k_train_015442
3,152
no_license
[ { "docstring": "添加商品 :return:", "name": "test_urine_v2_goodsInfo_saveGoodsInfo", "signature": "def test_urine_v2_goodsInfo_saveGoodsInfo(self)" }, { "docstring": "查询商品信息 :return:", "name": "test_urine_v2_goodsInfo_queryGoodsInfos", "signature": "def test_urine_v2_goodsInfo_queryGoodsInfo...
4
stack_v2_sparse_classes_30k_train_001674
Implement the Python class `CommodityManagement` described below. Class description: Implement the CommodityManagement class. Method signatures and docstrings: - def test_urine_v2_goodsInfo_saveGoodsInfo(self): 添加商品 :return: - def test_urine_v2_goodsInfo_queryGoodsInfos(self): 查询商品信息 :return: - def test_urine_v2_good...
Implement the Python class `CommodityManagement` described below. Class description: Implement the CommodityManagement class. Method signatures and docstrings: - def test_urine_v2_goodsInfo_saveGoodsInfo(self): 添加商品 :return: - def test_urine_v2_goodsInfo_queryGoodsInfos(self): 查询商品信息 :return: - def test_urine_v2_good...
6837a07ff200b610e7ba799a52543493848b6026
<|skeleton|> class CommodityManagement: def test_urine_v2_goodsInfo_saveGoodsInfo(self): """添加商品 :return:""" <|body_0|> def test_urine_v2_goodsInfo_queryGoodsInfos(self): """查询商品信息 :return:""" <|body_1|> def test_urine_v2_goodsInfo_updateGoodsInfo(self): """更新商品信息 ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CommodityManagement: def test_urine_v2_goodsInfo_saveGoodsInfo(self): """添加商品 :return:""" func_name = sys._getframe().f_code.co_name hash = gl.get_value('hash') row = self.get_case_row_index(func_name) request_data = self.get_request_data(func_name) for imgs in ...
the_stack_v2_python_sparse
run/commodity_management/test_commodity_management.py
liwei123a/APITestFrame
train
0
aa9a09bc595ade1419abb2183ac8589ae774764a
[ "self.seq = []\nfor i in range(0, len(A), 2):\n if A[i] == 0:\n continue\n self.seq.append([A[i], A[i + 1]])\nself.seq.reverse()", "last_num = -1\nwhile self.seq and n >= self.seq[-1][0]:\n n -= self.seq[-1][0]\n last_num = self.seq[-1][1]\n self.seq.pop()\nif n > 0 and self.seq:\n self.s...
<|body_start_0|> self.seq = [] for i in range(0, len(A), 2): if A[i] == 0: continue self.seq.append([A[i], A[i + 1]]) self.seq.reverse() <|end_body_0|> <|body_start_1|> last_num = -1 while self.seq and n >= self.seq[-1][0]: n -...
RLEIterator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RLEIterator: def __init__(self, A): """:type A: List[int]""" <|body_0|> def next(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.seq = [] for i in range(0, len(A), 2): if A[i] == 0: ...
stack_v2_sparse_classes_36k_train_015443
826
no_license
[ { "docstring": ":type A: List[int]", "name": "__init__", "signature": "def __init__(self, A)" }, { "docstring": ":type n: int :rtype: int", "name": "next", "signature": "def next(self, n)" } ]
2
stack_v2_sparse_classes_30k_train_018018
Implement the Python class `RLEIterator` described below. Class description: Implement the RLEIterator class. Method signatures and docstrings: - def __init__(self, A): :type A: List[int] - def next(self, n): :type n: int :rtype: int
Implement the Python class `RLEIterator` described below. Class description: Implement the RLEIterator class. Method signatures and docstrings: - def __init__(self, A): :type A: List[int] - def next(self, n): :type n: int :rtype: int <|skeleton|> class RLEIterator: def __init__(self, A): """:type A: Lis...
d6fac85a94a7188e93d4e202e67b6485562d12bd
<|skeleton|> class RLEIterator: def __init__(self, A): """:type A: List[int]""" <|body_0|> def next(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RLEIterator: def __init__(self, A): """:type A: List[int]""" self.seq = [] for i in range(0, len(A), 2): if A[i] == 0: continue self.seq.append([A[i], A[i + 1]]) self.seq.reverse() def next(self, n): """:type n: int :rtype: i...
the_stack_v2_python_sparse
lc900.py
GeorgyZhou/Leetcode-Problem
train
0
7cf11c3dcf1169783a763fa6be9ec4089889f63e
[ "try:\n documentobj = extract_value_from_input(input=input, field_id='document_id', model_type='Document', model=document_model)\nexcept ObjectDoesNotExist:\n raise GraphQLError(u'Ci sono stati problemi durante il recupero del documento.')\ntry:\n documentobj.document.delete()\nexcept Exception:\n raise...
<|body_start_0|> try: documentobj = extract_value_from_input(input=input, field_id='document_id', model_type='Document', model=document_model) except ObjectDoesNotExist: raise GraphQLError(u'Ci sono stati problemi durante il recupero del documento.') try: docu...
DocumentMutationService
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DocumentMutationService: def deleteDocument(self, input): """cancellazione di un file input: input: dict output: ritorna una tupla composta da: int: numero di oggetti eliminati dict: che indica il numero di cancellazioni per quel tipo di oggetto esempio: (1, {'document.Entry': 1})""" ...
stack_v2_sparse_classes_36k_train_015444
3,329
no_license
[ { "docstring": "cancellazione di un file input: input: dict output: ritorna una tupla composta da: int: numero di oggetti eliminati dict: che indica il numero di cancellazioni per quel tipo di oggetto esempio: (1, {'document.Entry': 1})", "name": "deleteDocument", "signature": "def deleteDocument(self, ...
2
stack_v2_sparse_classes_30k_train_017631
Implement the Python class `DocumentMutationService` described below. Class description: Implement the DocumentMutationService class. Method signatures and docstrings: - def deleteDocument(self, input): cancellazione di un file input: input: dict output: ritorna una tupla composta da: int: numero di oggetti eliminati...
Implement the Python class `DocumentMutationService` described below. Class description: Implement the DocumentMutationService class. Method signatures and docstrings: - def deleteDocument(self, input): cancellazione di un file input: input: dict output: ritorna una tupla composta da: int: numero di oggetti eliminati...
7929b244a40a2faf834f55f1803d131cc6324a49
<|skeleton|> class DocumentMutationService: def deleteDocument(self, input): """cancellazione di un file input: input: dict output: ritorna una tupla composta da: int: numero di oggetti eliminati dict: che indica il numero di cancellazioni per quel tipo di oggetto esempio: (1, {'document.Entry': 1})""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DocumentMutationService: def deleteDocument(self, input): """cancellazione di un file input: input: dict output: ritorna una tupla composta da: int: numero di oggetti eliminati dict: che indica il numero di cancellazioni per quel tipo di oggetto esempio: (1, {'document.Entry': 1})""" try: ...
the_stack_v2_python_sparse
legionella/graphqlapp/document/mutationservice.py
RedTurtle/legionella-backend
train
0
5611d5c7feaedc555e7351eff675a0dbfb2bcd66
[ "parser.add_argument('instance', help='Cloud SQL instance ID.')\nparser.add_argument('--database', '-d', required=False, help='The database (for example, guestbook) to which the import is made. If not set, it is assumed that the database is specified in the file to be imported.')\nparser.add_argument('--uri', '-u',...
<|body_start_0|> parser.add_argument('instance', help='Cloud SQL instance ID.') parser.add_argument('--database', '-d', required=False, help='The database (for example, guestbook) to which the import is made. If not set, it is assumed that the database is specified in the file to be imported.') ...
Imports data into a Cloud SQL instance from Google Cloud Storage.
Import
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Import: """Imports data into a Cloud SQL instance from Google Cloud Storage.""" def Args(parser): """Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use it to add arguments that go on the command line after this command. ...
stack_v2_sparse_classes_36k_train_015445
3,727
permissive
[ { "docstring": "Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use it to add arguments that go on the command line after this command. Positional arguments are allowed.", "name": "Args", "signature": "def Args(parser)" }, { "docstri...
3
stack_v2_sparse_classes_30k_train_002505
Implement the Python class `Import` described below. Class description: Imports data into a Cloud SQL instance from Google Cloud Storage. Method signatures and docstrings: - def Args(parser): Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use it to add a...
Implement the Python class `Import` described below. Class description: Imports data into a Cloud SQL instance from Google Cloud Storage. Method signatures and docstrings: - def Args(parser): Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use it to add a...
90d87b2adb1eab7f218b075886aa620d8d6eeedb
<|skeleton|> class Import: """Imports data into a Cloud SQL instance from Google Cloud Storage.""" def Args(parser): """Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use it to add arguments that go on the command line after this command. ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Import: """Imports data into a Cloud SQL instance from Google Cloud Storage.""" def Args(parser): """Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use it to add arguments that go on the command line after this command. Positional ar...
the_stack_v2_python_sparse
old/google-cloud-sdk/lib/googlecloudsdk/sql/tools/instances/import.py
altock/dev
train
0
bda496b4505e2472d022c261b47a174f83b81201
[ "if custom_values is None:\n custom_values = {}\ndesc = html2plaintext(msg.get('body')) if msg.get('body') else ''\ndefaults = {'name': msg.get('subject') or _('No Subject'), 'description': desc, 'email_from': msg.get('from'), 'email_cc': msg.get('cc'), 'user_id': False, 'partner_id': msg.get('author_id', False)...
<|body_start_0|> if custom_values is None: custom_values = {} desc = html2plaintext(msg.get('body')) if msg.get('body') else '' defaults = {'name': msg.get('subject') or _('No Subject'), 'description': desc, 'email_from': msg.get('from'), 'email_cc': msg.get('cc'), 'user_id': False, ...
master_gaji
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class master_gaji: def message_new(self, cr, uid, msg, custom_values=None, context=None): """Overrides mail_thread message_new that is called by the mailgateway through message_process. This override updates the document according to the email.""" <|body_0|> def message_update(sel...
stack_v2_sparse_classes_36k_train_015446
7,579
no_license
[ { "docstring": "Overrides mail_thread message_new that is called by the mailgateway through message_process. This override updates the document according to the email.", "name": "message_new", "signature": "def message_new(self, cr, uid, msg, custom_values=None, context=None)" }, { "docstring": ...
2
null
Implement the Python class `master_gaji` described below. Class description: Implement the master_gaji class. Method signatures and docstrings: - def message_new(self, cr, uid, msg, custom_values=None, context=None): Overrides mail_thread message_new that is called by the mailgateway through message_process. This ove...
Implement the Python class `master_gaji` described below. Class description: Implement the master_gaji class. Method signatures and docstrings: - def message_new(self, cr, uid, msg, custom_values=None, context=None): Overrides mail_thread message_new that is called by the mailgateway through message_process. This ove...
c5a5678379649ccdf57a9d55b09b30436428b430
<|skeleton|> class master_gaji: def message_new(self, cr, uid, msg, custom_values=None, context=None): """Overrides mail_thread message_new that is called by the mailgateway through message_process. This override updates the document according to the email.""" <|body_0|> def message_update(sel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class master_gaji: def message_new(self, cr, uid, msg, custom_values=None, context=None): """Overrides mail_thread message_new that is called by the mailgateway through message_process. This override updates the document according to the email.""" if custom_values is None: custom_values ...
the_stack_v2_python_sparse
lucas_marin/hrd_ppi_payroll/hr_contract.py
adahra/addons
train
1
0195284ae71a3a93343c1a96eb39a06452e8af31
[ "page = self.get_argument_int('page', default='1')\nname_or_text_like = self.get_argument_str('name_or_text_like', min_len=0, max_len=127, default='')\n\ndef response(request, max_page, review_list):\n request.send_json({'code': 0, 'max_page': max_page, 'review_list': review_list})\nif name_or_text_like == '':\n...
<|body_start_0|> page = self.get_argument_int('page', default='1') name_or_text_like = self.get_argument_str('name_or_text_like', min_len=0, max_len=127, default='') def response(request, max_page, review_list): request.send_json({'code': 0, 'max_page': max_page, 'review_list': revi...
评论处理
ReviewHandler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReviewHandler: """评论处理""" async def get(self): """# 获取评论列表,没有按照套路出牌,应该是获取单条评论""" <|body_0|> async def delete(self): """# 根据评论ID删除评论""" <|body_1|> <|end_skeleton|> <|body_start_0|> page = self.get_argument_int('page', default='1') name_or...
stack_v2_sparse_classes_36k_train_015447
1,105
permissive
[ { "docstring": "# 获取评论列表,没有按照套路出牌,应该是获取单条评论", "name": "get", "signature": "async def get(self)" }, { "docstring": "# 根据评论ID删除评论", "name": "delete", "signature": "async def delete(self)" } ]
2
stack_v2_sparse_classes_30k_train_007273
Implement the Python class `ReviewHandler` described below. Class description: 评论处理 Method signatures and docstrings: - async def get(self): # 获取评论列表,没有按照套路出牌,应该是获取单条评论 - async def delete(self): # 根据评论ID删除评论
Implement the Python class `ReviewHandler` described below. Class description: 评论处理 Method signatures and docstrings: - async def get(self): # 获取评论列表,没有按照套路出牌,应该是获取单条评论 - async def delete(self): # 根据评论ID删除评论 <|skeleton|> class ReviewHandler: """评论处理""" async def get(self): """# 获取评论列表,没有按照套路出牌,应该是获取...
2a6f44f86469bfbb472dfd1bec4238587d8402bf
<|skeleton|> class ReviewHandler: """评论处理""" async def get(self): """# 获取评论列表,没有按照套路出牌,应该是获取单条评论""" <|body_0|> async def delete(self): """# 根据评论ID删除评论""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReviewHandler: """评论处理""" async def get(self): """# 获取评论列表,没有按照套路出牌,应该是获取单条评论""" page = self.get_argument_int('page', default='1') name_or_text_like = self.get_argument_str('name_or_text_like', min_len=0, max_len=127, default='') def response(request, max_page, review_lis...
the_stack_v2_python_sparse
backend/blog/handler/admin/review.py
o8oo8o/blog
train
0
b992550f26593f09a6912f5c91970c7aecfde264
[ "for x in range(len(nums)):\n for y in range(len(nums)):\n if x != y and nums[x] + nums[y] == target:\n return [x, y]", "if len(nums) <= 1:\n return False\nbuff_dict = {}\nfor i in range(len(nums)):\n if nums[i] in buff_dict:\n return [buff_dict[nums[i]], i]\n else:\n b...
<|body_start_0|> for x in range(len(nums)): for y in range(len(nums)): if x != y and nums[x] + nums[y] == target: return [x, y] <|end_body_0|> <|body_start_1|> if len(nums) <= 1: return False buff_dict = {} for i in range(len(n...
Problem: Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution. Example: Given nums = [2, 7, 11, 15], target = 9, Because nums[0] + nums[1] = 2 + 7 = 9, return [0, 1].
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """Problem: Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution. Example: Given nums = [2, 7, 11, 15], target = 9, Because nums[0] + nums[1] = 2 + 7 = 9, return [0, 1].""...
stack_v2_sparse_classes_36k_train_015448
1,292
permissive
[ { "docstring": ":type nums: List[int] :type target: int :rtype: List[int] O(n^2)", "name": "twoSum", "signature": "def twoSum(self, nums, target)" }, { "docstring": "O(n)", "name": "twoSumBest", "signature": "def twoSumBest(self, nums, target)" } ]
2
stack_v2_sparse_classes_30k_train_001061
Implement the Python class `Solution` described below. Class description: Problem: Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution. Example: Given nums = [2, 7, 11, 15], target = 9, Because nums[0] ...
Implement the Python class `Solution` described below. Class description: Problem: Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution. Example: Given nums = [2, 7, 11, 15], target = 9, Because nums[0] ...
0420fbcbebad3b746db63b9e9a5878b4af8ad6ac
<|skeleton|> class Solution: """Problem: Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution. Example: Given nums = [2, 7, 11, 15], target = 9, Because nums[0] + nums[1] = 2 + 7 = 9, return [0, 1].""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """Problem: Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution. Example: Given nums = [2, 7, 11, 15], target = 9, Because nums[0] + nums[1] = 2 + 7 = 9, return [0, 1].""" def tw...
the_stack_v2_python_sparse
leetcode/array/easy/twoSum.py
joway/PyAlgorithm
train
1
3b5938f4ae413e2973823b2d914ae58679f3a8c5
[ "auth = None\nif request.username or request.password:\n auth = (request.username, request.password)\nresponse = requests.request(HttpMethodEnum.to_string(request.http_method), request.query_url, headers=request.headers, params=request.query_parameters, data=request.parameters, files=request.files, auth=auth)\nr...
<|body_start_0|> auth = None if request.username or request.password: auth = (request.username, request.password) response = requests.request(HttpMethodEnum.to_string(request.http_method), request.query_url, headers=request.headers, params=request.query_parameters, data=request.param...
An implementation of HttpClient that uses Requests as its HTTP Client
RequestsClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RequestsClient: """An implementation of HttpClient that uses Requests as its HTTP Client""" def execute_as_string(self, request): """Execute a given HttpRequest to get a string response back Args: request (HttpRequest): The given HttpRequest to execute. Returns: HttpResponse: The res...
stack_v2_sparse_classes_36k_train_015449
2,815
permissive
[ { "docstring": "Execute a given HttpRequest to get a string response back Args: request (HttpRequest): The given HttpRequest to execute. Returns: HttpResponse: The response of the HttpRequest.", "name": "execute_as_string", "signature": "def execute_as_string(self, request)" }, { "docstring": "E...
3
stack_v2_sparse_classes_30k_train_002485
Implement the Python class `RequestsClient` described below. Class description: An implementation of HttpClient that uses Requests as its HTTP Client Method signatures and docstrings: - def execute_as_string(self, request): Execute a given HttpRequest to get a string response back Args: request (HttpRequest): The giv...
Implement the Python class `RequestsClient` described below. Class description: An implementation of HttpClient that uses Requests as its HTTP Client Method signatures and docstrings: - def execute_as_string(self, request): Execute a given HttpRequest to get a string response back Args: request (HttpRequest): The giv...
e65347f1c4fe6ef014648db4e3b25d0392f820d0
<|skeleton|> class RequestsClient: """An implementation of HttpClient that uses Requests as its HTTP Client""" def execute_as_string(self, request): """Execute a given HttpRequest to get a string response back Args: request (HttpRequest): The given HttpRequest to execute. Returns: HttpResponse: The res...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RequestsClient: """An implementation of HttpClient that uses Requests as its HTTP Client""" def execute_as_string(self, request): """Execute a given HttpRequest to get a string response back Args: request (HttpRequest): The given HttpRequest to execute. Returns: HttpResponse: The response of the ...
the_stack_v2_python_sparse
moesifapi/http/requests_client.py
Moesif/moesifapi-python
train
5
22212173318c3f7458e62e0ed582e2a66f9e5f43
[ "if self.arguments:\n self.options['project_name'] = self.arguments[0]\ntargetid = f\"installation-{self.env.new_serialno('sphinx-toolbox installation'):d}\"\ntargetnode = nodes.target('', '', ids=[targetid])\ncontent = make_installation_instructions(self.options, self.env)\nview = ViewList(content)\ninstallatio...
<|body_start_0|> if self.arguments: self.options['project_name'] = self.arguments[0] targetid = f"installation-{self.env.new_serialno('sphinx-toolbox installation'):d}" targetnode = nodes.target('', '', ids=[targetid]) content = make_installation_instructions(self.options, se...
Directive to show installation instructions.
InstallationDirective
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InstallationDirective: """Directive to show installation instructions.""" def run_html(self) -> List[nodes.Node]: """Generate output for ``HTML`` builders.""" <|body_0|> def run_generic(self) -> List[nodes.Node]: """Generate generic reStructuredText output.""" ...
stack_v2_sparse_classes_36k_train_015450
20,436
no_license
[ { "docstring": "Generate output for ``HTML`` builders.", "name": "run_html", "signature": "def run_html(self) -> List[nodes.Node]" }, { "docstring": "Generate generic reStructuredText output.", "name": "run_generic", "signature": "def run_generic(self) -> List[nodes.Node]" }, { "...
3
null
Implement the Python class `InstallationDirective` described below. Class description: Directive to show installation instructions. Method signatures and docstrings: - def run_html(self) -> List[nodes.Node]: Generate output for ``HTML`` builders. - def run_generic(self) -> List[nodes.Node]: Generate generic reStructu...
Implement the Python class `InstallationDirective` described below. Class description: Directive to show installation instructions. Method signatures and docstrings: - def run_html(self) -> List[nodes.Node]: Generate output for ``HTML`` builders. - def run_generic(self) -> List[nodes.Node]: Generate generic reStructu...
64c071d6d53576e0fa6ed0fe544bbc4811546991
<|skeleton|> class InstallationDirective: """Directive to show installation instructions.""" def run_html(self) -> List[nodes.Node]: """Generate output for ``HTML`` builders.""" <|body_0|> def run_generic(self) -> List[nodes.Node]: """Generate generic reStructuredText output.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InstallationDirective: """Directive to show installation instructions.""" def run_html(self) -> List[nodes.Node]: """Generate output for ``HTML`` builders.""" if self.arguments: self.options['project_name'] = self.arguments[0] targetid = f"installation-{self.env.new_se...
the_stack_v2_python_sparse
venv/lib/python3.9/site-packages/sphinx_toolbox/installation.py
felipe1297/networkPacketGetter
train
0
0b1a60e767d7de7ca2687912534877a99d16c454
[ "self.host = host\nself.port = port\nself.user = user\nself.password = password", "for chunk in data:\n if not isinstance(chunk, tuple):\n continue\n match = UID_EXTRACTOR.search(chunk[0])\n if match is None:\n logger.debug(f'Could not find UID in: {chunk[0]}')\n raise IMAPClientErro...
<|body_start_0|> self.host = host self.port = port self.user = user self.password = password <|end_body_0|> <|body_start_1|> for chunk in data: if not isinstance(chunk, tuple): continue match = UID_EXTRACTOR.search(chunk[0]) if...
IMAP4 (SSL) email client. Attributes: DEFAULT_PORT: Value to be used for the `port` attribute of the constructor if unspecified. Set to the standard IMAP4 SSL port. DEFAULT_MAILBOX: Value to be used for the `mailbox` attribute of the yield_messages() method if unspecified. Set to "INBOX".
IMAP_SSLClient
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IMAP_SSLClient: """IMAP4 (SSL) email client. Attributes: DEFAULT_PORT: Value to be used for the `port` attribute of the constructor if unspecified. Set to the standard IMAP4 SSL port. DEFAULT_MAILBOX: Value to be used for the `mailbox` attribute of the yield_messages() method if unspecified. Set ...
stack_v2_sparse_classes_36k_train_015451
11,807
no_license
[ { "docstring": "Constructor. Args: host: The hostname (without protocol or port) of the IMAP4 server. port: The port of the IMAP4 server to connect to. If unspecified, uses the default. user: The user name or email address to send with the LOGIN command. password: The password to send with the LOGIN command.", ...
3
stack_v2_sparse_classes_30k_train_008383
Implement the Python class `IMAP_SSLClient` described below. Class description: IMAP4 (SSL) email client. Attributes: DEFAULT_PORT: Value to be used for the `port` attribute of the constructor if unspecified. Set to the standard IMAP4 SSL port. DEFAULT_MAILBOX: Value to be used for the `mailbox` attribute of the yield...
Implement the Python class `IMAP_SSLClient` described below. Class description: IMAP4 (SSL) email client. Attributes: DEFAULT_PORT: Value to be used for the `port` attribute of the constructor if unspecified. Set to the standard IMAP4 SSL port. DEFAULT_MAILBOX: Value to be used for the `mailbox` attribute of the yield...
72e73cd10465095b19772c79c45432e997f9a7e7
<|skeleton|> class IMAP_SSLClient: """IMAP4 (SSL) email client. Attributes: DEFAULT_PORT: Value to be used for the `port` attribute of the constructor if unspecified. Set to the standard IMAP4 SSL port. DEFAULT_MAILBOX: Value to be used for the `mailbox` attribute of the yield_messages() method if unspecified. Set ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IMAP_SSLClient: """IMAP4 (SSL) email client. Attributes: DEFAULT_PORT: Value to be used for the `port` attribute of the constructor if unspecified. Set to the standard IMAP4 SSL port. DEFAULT_MAILBOX: Value to be used for the `mailbox` attribute of the yield_messages() method if unspecified. Set to "INBOX".""...
the_stack_v2_python_sparse
windowbox/clients/imap.py
smitelli/windowbox
train
0
87549ddd9cc78c3d6f348873ffdd32e287d3a6c8
[ "with self.assertRaises(wx.PyNoAppError):\n frame = wx.Frame(None)\n frame.Close()", "app = wx.App()\nframe = wx.Frame(None)\nframe.Show()\nframe.Close()\napp.MainLoop()" ]
<|body_start_0|> with self.assertRaises(wx.PyNoAppError): frame = wx.Frame(None) frame.Close() <|end_body_0|> <|body_start_1|> app = wx.App() frame = wx.Frame(None) frame.Show() frame.Close() app.MainLoop() <|end_body_1|>
TestMustHaveApp
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestMustHaveApp: def test_mustHaveApp0(self): """Test that an exception is raised if there is no app""" <|body_0|> def test_mustHaveApp1(self): """Create App and then create a frame""" <|body_1|> <|end_skeleton|> <|body_start_0|> with self.assertRai...
stack_v2_sparse_classes_36k_train_015452
690
no_license
[ { "docstring": "Test that an exception is raised if there is no app", "name": "test_mustHaveApp0", "signature": "def test_mustHaveApp0(self)" }, { "docstring": "Create App and then create a frame", "name": "test_mustHaveApp1", "signature": "def test_mustHaveApp1(self)" } ]
2
stack_v2_sparse_classes_30k_train_007422
Implement the Python class `TestMustHaveApp` described below. Class description: Implement the TestMustHaveApp class. Method signatures and docstrings: - def test_mustHaveApp0(self): Test that an exception is raised if there is no app - def test_mustHaveApp1(self): Create App and then create a frame
Implement the Python class `TestMustHaveApp` described below. Class description: Implement the TestMustHaveApp class. Method signatures and docstrings: - def test_mustHaveApp0(self): Test that an exception is raised if there is no app - def test_mustHaveApp1(self): Create App and then create a frame <|skeleton|> cla...
a1184286703cf24c4b88e5bc14cf2979c1b1ea00
<|skeleton|> class TestMustHaveApp: def test_mustHaveApp0(self): """Test that an exception is raised if there is no app""" <|body_0|> def test_mustHaveApp1(self): """Create App and then create a frame""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestMustHaveApp: def test_mustHaveApp0(self): """Test that an exception is raised if there is no app""" with self.assertRaises(wx.PyNoAppError): frame = wx.Frame(None) frame.Close() def test_mustHaveApp1(self): """Create App and then create a frame""" ...
the_stack_v2_python_sparse
unittests/test_mustHaveApp.py
wxWidgets/Phoenix
train
2,268
7d860aa0ca1b8a52b96a328fd7860c5510927a51
[ "test_data = os.path.join(TEST_DIR_PATH, 'testcases', 'yara_test_data')\nwith tempfile.TemporaryDirectory() as tmp_dir:\n project_name = 'yara'\n old_commit = 'f79be4f2330f4b89ea2f42e1c44ca998c59a0c0f'\n new_commit = 'f50a39051ea8c7f10d6d8db9656658b49601caef'\n fuzzer = 'rules_fuzzer'\n yara_repo_man...
<|body_start_0|> test_data = os.path.join(TEST_DIR_PATH, 'testcases', 'yara_test_data') with tempfile.TemporaryDirectory() as tmp_dir: project_name = 'yara' old_commit = 'f79be4f2330f4b89ea2f42e1c44ca998c59a0c0f' new_commit = 'f50a39051ea8c7f10d6d8db9656658b49601caef'...
Testing if an image can be built from different states e.g. a commit.
BuildImageIntegrationTests
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BuildImageIntegrationTests: """Testing if an image can be built from different states e.g. a commit.""" def test_build_fuzzers_from_commit(self): """Tests if the fuzzers can build at a proper commit. This is done by using a known regression range for a specific test case. The old com...
stack_v2_sparse_classes_36k_train_015453
5,295
permissive
[ { "docstring": "Tests if the fuzzers can build at a proper commit. This is done by using a known regression range for a specific test case. The old commit should show the error when its fuzzers run and the new one should not.", "name": "test_build_fuzzers_from_commit", "signature": "def test_build_fuzze...
3
stack_v2_sparse_classes_30k_train_004352
Implement the Python class `BuildImageIntegrationTests` described below. Class description: Testing if an image can be built from different states e.g. a commit. Method signatures and docstrings: - def test_build_fuzzers_from_commit(self): Tests if the fuzzers can build at a proper commit. This is done by using a kno...
Implement the Python class `BuildImageIntegrationTests` described below. Class description: Testing if an image can be built from different states e.g. a commit. Method signatures and docstrings: - def test_build_fuzzers_from_commit(self): Tests if the fuzzers can build at a proper commit. This is done by using a kno...
8e2d57684bd49355b80572592c3af5cefc19a69c
<|skeleton|> class BuildImageIntegrationTests: """Testing if an image can be built from different states e.g. a commit.""" def test_build_fuzzers_from_commit(self): """Tests if the fuzzers can build at a proper commit. This is done by using a known regression range for a specific test case. The old com...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BuildImageIntegrationTests: """Testing if an image can be built from different states e.g. a commit.""" def test_build_fuzzers_from_commit(self): """Tests if the fuzzers can build at a proper commit. This is done by using a known regression range for a specific test case. The old commit should sh...
the_stack_v2_python_sparse
infra/build_specified_commit_test.py
DeepInThought/oss-fuzz
train
2
401d403c50e760ba43d886874933abae5414aa63
[ "matched = re.match(cls.uri_regex, str(uri))\nif not matched:\n Log.a().debug('invalid uri: %s', uri)\n return False\nscheme = matched.group(2)\nif not scheme:\n scheme = 'local'\nauthority = matched.group(4) if matched.group(4) else ''\npath = matched.group(5) if matched.group(5) else '/'\npath = re.sub('...
<|body_start_0|> matched = re.match(cls.uri_regex, str(uri)) if not matched: Log.a().debug('invalid uri: %s', uri) return False scheme = matched.group(2) if not scheme: scheme = 'local' authority = matched.group(4) if matched.group(4) else '' ...
Light-weight URI parser adhering to part of RFC 3986. This URI parser is not comprehensive, but implements enough of the standard to recognize the following URI pattern: scheme://authority/path/to/name/.. "scheme" and "authority" are optional. It will also extract the folder.. and name from the path. For the above exam...
URIParser
[ "LicenseRef-scancode-us-govt-public-domain", "CC0-1.0", "Apache-2.0", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class URIParser: """Light-weight URI parser adhering to part of RFC 3986. This URI parser is not comprehensive, but implements enough of the standard to recognize the following URI pattern: scheme://authority/path/to/name/.. "scheme" and "authority" are optional. It will also extract the folder.. and n...
stack_v2_sparse_classes_36k_train_015454
5,792
permissive
[ { "docstring": "Parse a URI and return components. If the scheme is missing, it.. defaults to \"local\". Args: uri: A generic URI string. Returns: On success: A dict that contains \"uri\", \"scheme\", \"authority\", and \"path\", etc: { \"uri\": original URI \"chopped_uri\": normalized URI \"scheme\": \"authori...
2
stack_v2_sparse_classes_30k_train_000419
Implement the Python class `URIParser` described below. Class description: Light-weight URI parser adhering to part of RFC 3986. This URI parser is not comprehensive, but implements enough of the standard to recognize the following URI pattern: scheme://authority/path/to/name/.. "scheme" and "authority" are optional. ...
Implement the Python class `URIParser` described below. Class description: Light-weight URI parser adhering to part of RFC 3986. This URI parser is not comprehensive, but implements enough of the standard to recognize the following URI pattern: scheme://authority/path/to/name/.. "scheme" and "authority" are optional. ...
2de8dbb5c022fafded5c7335c1e00766d17b44fa
<|skeleton|> class URIParser: """Light-weight URI parser adhering to part of RFC 3986. This URI parser is not comprehensive, but implements enough of the standard to recognize the following URI pattern: scheme://authority/path/to/name/.. "scheme" and "authority" are optional. It will also extract the folder.. and n...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class URIParser: """Light-weight URI parser adhering to part of RFC 3986. This URI parser is not comprehensive, but implements enough of the standard to recognize the following URI pattern: scheme://authority/path/to/name/.. "scheme" and "authority" are optional. It will also extract the folder.. and name from the ...
the_stack_v2_python_sparse
src/geneflow/uri_parser.py
CDCgov/geneflow2
train
2
2e56f7458de7172fce86ef388881bd22b670308d
[ "super(PointerNet, self).__init__()\nself.embedding_dim = embedding_dim\nself.bidir = bidir\nself.para_encoder = Encoder(embedding_dim, hidden_dim, lstm_layers, dropout, bidir)\nself.question_encoder = Encoder(embedding_dim, hidden_dim, lstm_layers, dropout, bidir)\nself.downsize_linear = nn.Linear(2 * hidden_dim, ...
<|body_start_0|> super(PointerNet, self).__init__() self.embedding_dim = embedding_dim self.bidir = bidir self.para_encoder = Encoder(embedding_dim, hidden_dim, lstm_layers, dropout, bidir) self.question_encoder = Encoder(embedding_dim, hidden_dim, lstm_layers, dropout, bidir) ...
Pointer-Net
PointerNet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PointerNet: """Pointer-Net""" def __init__(self, vocab_sz, embedding_dim, hidden_dim, lstm_layers, dropout, bidir=False): """Initiate Pointer-Net :param int embedding_dim: Number of embbeding channels :param int hidden_dim: Encoders hidden units :param int lstm_layers: Number of laye...
stack_v2_sparse_classes_36k_train_015455
14,528
no_license
[ { "docstring": "Initiate Pointer-Net :param int embedding_dim: Number of embbeding channels :param int hidden_dim: Encoders hidden units :param int lstm_layers: Number of layers for LSTMs :param float dropout: Float between 0-1 :param bool bidir: Bidirectional", "name": "__init__", "signature": "def __i...
2
stack_v2_sparse_classes_30k_train_007033
Implement the Python class `PointerNet` described below. Class description: Pointer-Net Method signatures and docstrings: - def __init__(self, vocab_sz, embedding_dim, hidden_dim, lstm_layers, dropout, bidir=False): Initiate Pointer-Net :param int embedding_dim: Number of embbeding channels :param int hidden_dim: Enc...
Implement the Python class `PointerNet` described below. Class description: Pointer-Net Method signatures and docstrings: - def __init__(self, vocab_sz, embedding_dim, hidden_dim, lstm_layers, dropout, bidir=False): Initiate Pointer-Net :param int embedding_dim: Number of embbeding channels :param int hidden_dim: Enc...
f4b63e6643fe5e2112cc5afa5915a2b847c29e06
<|skeleton|> class PointerNet: """Pointer-Net""" def __init__(self, vocab_sz, embedding_dim, hidden_dim, lstm_layers, dropout, bidir=False): """Initiate Pointer-Net :param int embedding_dim: Number of embbeding channels :param int hidden_dim: Encoders hidden units :param int lstm_layers: Number of laye...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PointerNet: """Pointer-Net""" def __init__(self, vocab_sz, embedding_dim, hidden_dim, lstm_layers, dropout, bidir=False): """Initiate Pointer-Net :param int embedding_dim: Number of embbeding channels :param int hidden_dim: Encoders hidden units :param int lstm_layers: Number of layers for LSTMs ...
the_stack_v2_python_sparse
PointerNet.py
Nishad94/SQuAD_PtrNets
train
0
414066553086dd0ceb7e4a5861656b1c1695ed38
[ "assert instance is None\nsuper(UserApplicationCreationForm, self).__init__(data=data, initial=initial, instance=instance)\nself.user = user\nself.fields['local_site'].queryset = LocalSite.objects.filter(users=user)", "instance = super(UserApplicationCreationForm, self).save(commit=False)\ninstance.user = self.us...
<|body_start_0|> assert instance is None super(UserApplicationCreationForm, self).__init__(data=data, initial=initial, instance=instance) self.user = user self.fields['local_site'].queryset = LocalSite.objects.filter(users=user) <|end_body_0|> <|body_start_1|> instance = super(U...
A form for an end user to update an Application.
UserApplicationCreationForm
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserApplicationCreationForm: """A form for an end user to update an Application.""" def __init__(self, user, data, initial=None, instance=None): """Initialize the form. Args: user (django.contrib.auth.models.User): The user changing the form. Ignored, but included to match :py:meth:`...
stack_v2_sparse_classes_36k_train_015456
13,782
permissive
[ { "docstring": "Initialize the form. Args: user (django.contrib.auth.models.User): The user changing the form. Ignored, but included to match :py:meth:`UserApplicationCreationForm.__init__`. data (dict): The provided data. initial (dict, optional): The initial form values. instance (reviewboard.oauth.models.App...
2
stack_v2_sparse_classes_30k_train_020108
Implement the Python class `UserApplicationCreationForm` described below. Class description: A form for an end user to update an Application. Method signatures and docstrings: - def __init__(self, user, data, initial=None, instance=None): Initialize the form. Args: user (django.contrib.auth.models.User): The user cha...
Implement the Python class `UserApplicationCreationForm` described below. Class description: A form for an end user to update an Application. Method signatures and docstrings: - def __init__(self, user, data, initial=None, instance=None): Initialize the form. Args: user (django.contrib.auth.models.User): The user cha...
c3a991f1e9d7682239a1ab0e8661cee6da01d537
<|skeleton|> class UserApplicationCreationForm: """A form for an end user to update an Application.""" def __init__(self, user, data, initial=None, instance=None): """Initialize the form. Args: user (django.contrib.auth.models.User): The user changing the form. Ignored, but included to match :py:meth:`...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserApplicationCreationForm: """A form for an end user to update an Application.""" def __init__(self, user, data, initial=None, instance=None): """Initialize the form. Args: user (django.contrib.auth.models.User): The user changing the form. Ignored, but included to match :py:meth:`UserApplicati...
the_stack_v2_python_sparse
reviewboard/oauth/forms.py
reviewboard/reviewboard
train
1,141
a9ae5460e68b76d60e0af2057808b8cc6f08b53e
[ "print('+' * 64)\ndetailUrls = response.css('tr.even a::attr(href),tr.odd a::attr(href)').extract()\nfor url in detailUrls:\n fullUrl = response.urljoin(url)\n print(fullUrl)\n yield scrapy.Request(url=fullUrl, callback=self.parse_page)\nprint('-' * 64)\nnextUrl = response.css('#next::attr(href)').extract_...
<|body_start_0|> print('+' * 64) detailUrls = response.css('tr.even a::attr(href),tr.odd a::attr(href)').extract() for url in detailUrls: fullUrl = response.urljoin(url) print(fullUrl) yield scrapy.Request(url=fullUrl, callback=self.parse_page) print('...
HrSpider
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HrSpider: def parse(self, response): """解析当前招聘列表信息的url地址""" <|body_0|> def parse_page(self, response): """解析详情页""" <|body_1|> <|end_skeleton|> <|body_start_0|> print('+' * 64) detailUrls = response.css('tr.even a::attr(href),tr.odd a::attr(h...
stack_v2_sparse_classes_36k_train_015457
1,821
permissive
[ { "docstring": "解析当前招聘列表信息的url地址", "name": "parse", "signature": "def parse(self, response)" }, { "docstring": "解析详情页", "name": "parse_page", "signature": "def parse_page(self, response)" } ]
2
stack_v2_sparse_classes_30k_train_015328
Implement the Python class `HrSpider` described below. Class description: Implement the HrSpider class. Method signatures and docstrings: - def parse(self, response): 解析当前招聘列表信息的url地址 - def parse_page(self, response): 解析详情页
Implement the Python class `HrSpider` described below. Class description: Implement the HrSpider class. Method signatures and docstrings: - def parse(self, response): 解析当前招聘列表信息的url地址 - def parse_page(self, response): 解析详情页 <|skeleton|> class HrSpider: def parse(self, response): """解析当前招聘列表信息的url地址""" ...
e851524917b60e7308172bc235597b7c578882cc
<|skeleton|> class HrSpider: def parse(self, response): """解析当前招聘列表信息的url地址""" <|body_0|> def parse_page(self, response): """解析详情页""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HrSpider: def parse(self, response): """解析当前招聘列表信息的url地址""" print('+' * 64) detailUrls = response.css('tr.even a::attr(href),tr.odd a::attr(href)').extract() for url in detailUrls: fullUrl = response.urljoin(url) print(fullUrl) yield scrapy.R...
the_stack_v2_python_sparse
9th_week/tencent/tencent/spiders/hr.py
luhuadong/Python_Learning
train
1
fd870f007d03036bafb3d1d54f73e97f37d00fa2
[ "if obj is None:\n return super(UseCaseAdminInLine, self).has_delete_permission(request, obj=None)\nelif (request.user == obj.created_by or request.user.has_perm('muo.can_edit_all')) and obj.status in ('draft', 'rejected'):\n return super(UseCaseAdminInLine, self).has_delete_permission(request, obj=None)\nels...
<|body_start_0|> if obj is None: return super(UseCaseAdminInLine, self).has_delete_permission(request, obj=None) elif (request.user == obj.created_by or request.user.has_perm('muo.can_edit_all')) and obj.status in ('draft', 'rejected'): return super(UseCaseAdminInLine, self).has_...
UseCaseAdminInLine
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UseCaseAdminInLine: def has_delete_permission(self, request, obj=None): """Overriding the method such that the delete option on the UseCaseAdminInline form on change form is not available for the users except the original author or users with 'can_edit_all' permission. The delete option ...
stack_v2_sparse_classes_36k_train_015458
18,243
no_license
[ { "docstring": "Overriding the method such that the delete option on the UseCaseAdminInline form on change form is not available for the users except the original author or users with 'can_edit_all' permission. The delete option is only available to the original author or users with 'can_edit_all' permission if...
3
stack_v2_sparse_classes_30k_train_004338
Implement the Python class `UseCaseAdminInLine` described below. Class description: Implement the UseCaseAdminInLine class. Method signatures and docstrings: - def has_delete_permission(self, request, obj=None): Overriding the method such that the delete option on the UseCaseAdminInline form on change form is not ava...
Implement the Python class `UseCaseAdminInLine` described below. Class description: Implement the UseCaseAdminInLine class. Method signatures and docstrings: - def has_delete_permission(self, request, obj=None): Overriding the method such that the delete option on the UseCaseAdminInline form on change form is not ava...
d9b330ef70b0d0985bfc8248612ba57ee46ff0f4
<|skeleton|> class UseCaseAdminInLine: def has_delete_permission(self, request, obj=None): """Overriding the method such that the delete option on the UseCaseAdminInline form on change form is not available for the users except the original author or users with 'can_edit_all' permission. The delete option ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UseCaseAdminInLine: def has_delete_permission(self, request, obj=None): """Overriding the method such that the delete option on the UseCaseAdminInline form on change form is not available for the users except the original author or users with 'can_edit_all' permission. The delete option is only availa...
the_stack_v2_python_sparse
Code/EnhanceCWE-master/muo/admin.py
happinesstaker/more-website
train
0
420e41a6194bb6311df86b6d03861e2200850968
[ "super(MultiHeaderAttention, self).__init__()\nassert d_model % h == 0\nself.d_k = d_model // h\nself.h = h\nself.linears = clones(nn.Linear(d_model, d_model), 4)\nself.attn = None\nself.dropout = nn.Dropout(p=dropout)", "if mask is not None:\n mask = mask.unsqueeze(1)\nnbatches = query.size(0)\nquery, key, va...
<|body_start_0|> super(MultiHeaderAttention, self).__init__() assert d_model % h == 0 self.d_k = d_model // h self.h = h self.linears = clones(nn.Linear(d_model, d_model), 4) self.attn = None self.dropout = nn.Dropout(p=dropout) <|end_body_0|> <|body_start_1|> ...
MultiHeaderAttention
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiHeaderAttention: def __init__(self, h, d_model, dropout=0.1): """Take in model size and number of heads.""" <|body_0|> def forward(self, query, key, value, mask=None): """Implements Figure 2""" <|body_1|> <|end_skeleton|> <|body_start_0|> super...
stack_v2_sparse_classes_36k_train_015459
32,837
no_license
[ { "docstring": "Take in model size and number of heads.", "name": "__init__", "signature": "def __init__(self, h, d_model, dropout=0.1)" }, { "docstring": "Implements Figure 2", "name": "forward", "signature": "def forward(self, query, key, value, mask=None)" } ]
2
null
Implement the Python class `MultiHeaderAttention` described below. Class description: Implement the MultiHeaderAttention class. Method signatures and docstrings: - def __init__(self, h, d_model, dropout=0.1): Take in model size and number of heads. - def forward(self, query, key, value, mask=None): Implements Figure ...
Implement the Python class `MultiHeaderAttention` described below. Class description: Implement the MultiHeaderAttention class. Method signatures and docstrings: - def __init__(self, h, d_model, dropout=0.1): Take in model size and number of heads. - def forward(self, query, key, value, mask=None): Implements Figure ...
0e3598a20214dd78deb4f5e6809f7789722f6f5d
<|skeleton|> class MultiHeaderAttention: def __init__(self, h, d_model, dropout=0.1): """Take in model size and number of heads.""" <|body_0|> def forward(self, query, key, value, mask=None): """Implements Figure 2""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiHeaderAttention: def __init__(self, h, d_model, dropout=0.1): """Take in model size and number of heads.""" super(MultiHeaderAttention, self).__init__() assert d_model % h == 0 self.d_k = d_model // h self.h = h self.linears = clones(nn.Linear(d_model, d_mo...
the_stack_v2_python_sparse
17-word_language_model-pytorch/attentionisallyouneed.py
bjbluejita/deep-learning-notebook
train
0
f5a3ebef506f78c66bbd38db36cc86b28c1598e3
[ "self.hook = hook\nself.torch_modules = {'torch': torch, 'torch.functional': torch.functional, 'torch.nn.functional': torch.nn.functional}\nself._torch_functions = {f'{module_name}.{func_name}' for module_name, torch_module in self.torch_modules.items() for func_name in dir(torch_module)}\nself.exclude = ['as_tenso...
<|body_start_0|> self.hook = hook self.torch_modules = {'torch': torch, 'torch.functional': torch.functional, 'torch.nn.functional': torch.nn.functional} self._torch_functions = {f'{module_name}.{func_name}' for module_name, torch_module in self.torch_modules.items() for func_name in dir(torch_m...
Adds torch module related custom attributes. TorchAttributes is a special class where all custom attributes related to the torch module can be added. Any global parameter, configuration, or reference relating to PyTorch should be stored here instead of attaching it directly to some other part of the global namespace. T...
TorchAttributes
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TorchAttributes: """Adds torch module related custom attributes. TorchAttributes is a special class where all custom attributes related to the torch module can be added. Any global parameter, configuration, or reference relating to PyTorch should be stored here instead of attaching it directly to...
stack_v2_sparse_classes_36k_train_015460
5,349
permissive
[ { "docstring": "Initialization of the TorchAttributes class.", "name": "__init__", "signature": "def __init__(self, torch: ModuleType, hook: ModuleType) -> None" }, { "docstring": "Determine if a method is inplace or not. Check if the method ends by _ and is not a __xx__, then stash for constant...
2
stack_v2_sparse_classes_30k_test_000024
Implement the Python class `TorchAttributes` described below. Class description: Adds torch module related custom attributes. TorchAttributes is a special class where all custom attributes related to the torch module can be added. Any global parameter, configuration, or reference relating to PyTorch should be stored h...
Implement the Python class `TorchAttributes` described below. Class description: Adds torch module related custom attributes. TorchAttributes is a special class where all custom attributes related to the torch module can be added. Any global parameter, configuration, or reference relating to PyTorch should be stored h...
cc4765bed880ad38a02505834f63df39e0815328
<|skeleton|> class TorchAttributes: """Adds torch module related custom attributes. TorchAttributes is a special class where all custom attributes related to the torch module can be added. Any global parameter, configuration, or reference relating to PyTorch should be stored here instead of attaching it directly to...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TorchAttributes: """Adds torch module related custom attributes. TorchAttributes is a special class where all custom attributes related to the torch module can be added. Any global parameter, configuration, or reference relating to PyTorch should be stored here instead of attaching it directly to some other p...
the_stack_v2_python_sparse
syft/frameworks/torch/torch_attributes.py
tudorcebere/PySyft
train
2
b3d91d707ce94a045011e46d5bd9b7fdce880855
[ "if root is None:\n return '[]'\nserialize_array = []\nmy_queue = deque([root])\nwhile len(my_queue) > 0:\n element = my_queue.pop()\n if element is None:\n serialize_array.append('null')\n else:\n serialize_array.append(element.val)\n my_queue.appendleft(element.left)\n my_q...
<|body_start_0|> if root is None: return '[]' serialize_array = [] my_queue = deque([root]) while len(my_queue) > 0: element = my_queue.pop() if element is None: serialize_array.append('null') else: serialize...
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_015461
1,610
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_008958
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:...
0b208516a6ae3e72bc7b79ef0ac83dcbfa100496
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if root is None: return '[]' serialize_array = [] my_queue = deque([root]) while len(my_queue) > 0: element = my_queue.pop() i...
the_stack_v2_python_sparse
leetcode/medium/serialize-and-deserialize-binary-tree.py
gsantam/competitive-programming
train
0
079f803c4cbf2fa2e3131e274d618fa2caab1b06
[ "d = {}\nfor i, num in enumerate(nums):\n for val, j in d.items():\n if abs(num - val) <= t and abs(i - j) <= k:\n return True\n d[num] = i\nreturn False", "bucket = {}\nw = t + 1\nfor i, num in enumerate(nums):\n bucket_id = num / w\n if bucket_id in bucket:\n return True\n ...
<|body_start_0|> d = {} for i, num in enumerate(nums): for val, j in d.items(): if abs(num - val) <= t and abs(i - j) <= k: return True d[num] = i return False <|end_body_0|> <|body_start_1|> bucket = {} w = t + 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def containsNearbyAlmostDuplicate2(self, nums, k, t): """用字典记录 value:index,每次 loop 字典比较 value :type nums: List[int] :type k: int :type t: int :rtype: bool""" <|body_0|> def containsNearbyAlmostDuplicate(self, nums, k, t): """桶排序,同样用字典记录 value:index :type nu...
stack_v2_sparse_classes_36k_train_015462
2,185
no_license
[ { "docstring": "用字典记录 value:index,每次 loop 字典比较 value :type nums: List[int] :type k: int :type t: int :rtype: bool", "name": "containsNearbyAlmostDuplicate2", "signature": "def containsNearbyAlmostDuplicate2(self, nums, k, t)" }, { "docstring": "桶排序,同样用字典记录 value:index :type nums: List[int] :type...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsNearbyAlmostDuplicate2(self, nums, k, t): 用字典记录 value:index,每次 loop 字典比较 value :type nums: List[int] :type k: int :type t: int :rtype: bool - def containsNearbyAlmost...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsNearbyAlmostDuplicate2(self, nums, k, t): 用字典记录 value:index,每次 loop 字典比较 value :type nums: List[int] :type k: int :type t: int :rtype: bool - def containsNearbyAlmost...
860590239da0618c52967a55eda8d6bbe00bfa96
<|skeleton|> class Solution: def containsNearbyAlmostDuplicate2(self, nums, k, t): """用字典记录 value:index,每次 loop 字典比较 value :type nums: List[int] :type k: int :type t: int :rtype: bool""" <|body_0|> def containsNearbyAlmostDuplicate(self, nums, k, t): """桶排序,同样用字典记录 value:index :type nu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def containsNearbyAlmostDuplicate2(self, nums, k, t): """用字典记录 value:index,每次 loop 字典比较 value :type nums: List[int] :type k: int :type t: int :rtype: bool""" d = {} for i, num in enumerate(nums): for val, j in d.items(): if abs(num - val) <= t and ...
the_stack_v2_python_sparse
LeetCode/p0220/I/contains-duplicate-iii.py
Ynjxsjmh/PracticeMakesPerfect
train
0
a6b69b0ef410b335ee48a075033cdc1d05ea64e4
[ "rows = len(word1) + 1\ncols = len(word2) + 1\ndp = [[0 for j in range(cols)] for i in range(rows)]\nfor irow in range(rows):\n dp[irow][0] = irow\nfor icol in range(cols):\n dp[0][icol] = icol\nfor irow in range(0, rows - 1):\n for icol in range(0, cols - 1):\n if word1[irow] == word2[icol]:\n ...
<|body_start_0|> rows = len(word1) + 1 cols = len(word2) + 1 dp = [[0 for j in range(cols)] for i in range(rows)] for irow in range(rows): dp[irow][0] = irow for icol in range(cols): dp[0][icol] = icol for irow in range(0, rows - 1): fo...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minDistance(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" <|body_0|> def minDistance_hashtable(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" <|body_1|> def minDistance_lcs(self, word1, w...
stack_v2_sparse_classes_36k_train_015463
3,756
permissive
[ { "docstring": ":type word1: str :type word2: str :rtype: int", "name": "minDistance", "signature": "def minDistance(self, word1, word2)" }, { "docstring": ":type word1: str :type word2: str :rtype: int", "name": "minDistance_hashtable", "signature": "def minDistance_hashtable(self, word...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minDistance(self, word1, word2): :type word1: str :type word2: str :rtype: int - def minDistance_hashtable(self, word1, word2): :type word1: str :type word2: str :rtype: int ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minDistance(self, word1, word2): :type word1: str :type word2: str :rtype: int - def minDistance_hashtable(self, word1, word2): :type word1: str :type word2: str :rtype: int ...
bf03743a3676ca9a8c107f92cf3858b6887d0308
<|skeleton|> class Solution: def minDistance(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" <|body_0|> def minDistance_hashtable(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" <|body_1|> def minDistance_lcs(self, word1, w...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minDistance(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" rows = len(word1) + 1 cols = len(word2) + 1 dp = [[0 for j in range(cols)] for i in range(rows)] for irow in range(rows): dp[irow][0] = irow for icol i...
the_stack_v2_python_sparse
python/583_delete_operation_for_two_strings.py
liaison/LeetCode
train
17
b7a2d94682e6b48916ec4c884ff27a3149596bfc
[ "super().__init__(topic=X10_RECEIVED)\nself._last_housecode = None\nself._last_unitcode = None", "housecode, uc_or_cmd = parse_x10(raw_x10)\nif x10_flag == X10CommandType.COMMAND:\n self._notify_subscribers(housecode, uc_or_cmd)\nelse:\n self._last_housecode = housecode\n self._last_unitcode = byte_to_un...
<|body_start_0|> super().__init__(topic=X10_RECEIVED) self._last_housecode = None self._last_unitcode = None <|end_body_0|> <|body_start_1|> housecode, uc_or_cmd = parse_x10(raw_x10) if x10_flag == X10CommandType.COMMAND: self._notify_subscribers(housecode, uc_or_cmd...
Receive an X10 message.
X10Received
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class X10Received: """Receive an X10 message.""" def __init__(self): """Init the X10Received class.""" <|body_0|> def handle_x10_received(self, raw_x10, x10_flag): """Manage X10 inbound messages.""" <|body_1|> def _notify_subscribers(self, housecode, uc_or...
stack_v2_sparse_classes_36k_train_015464
1,692
permissive
[ { "docstring": "Init the X10Received class.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Manage X10 inbound messages.", "name": "handle_x10_received", "signature": "def handle_x10_received(self, raw_x10, x10_flag)" }, { "docstring": "Notify subscribe...
3
null
Implement the Python class `X10Received` described below. Class description: Receive an X10 message. Method signatures and docstrings: - def __init__(self): Init the X10Received class. - def handle_x10_received(self, raw_x10, x10_flag): Manage X10 inbound messages. - def _notify_subscribers(self, housecode, uc_or_cmd...
Implement the Python class `X10Received` described below. Class description: Receive an X10 message. Method signatures and docstrings: - def __init__(self): Init the X10Received class. - def handle_x10_received(self, raw_x10, x10_flag): Manage X10 inbound messages. - def _notify_subscribers(self, housecode, uc_or_cmd...
3f74aec8491fbc118c4732dbd990d91d31705845
<|skeleton|> class X10Received: """Receive an X10 message.""" def __init__(self): """Init the X10Received class.""" <|body_0|> def handle_x10_received(self, raw_x10, x10_flag): """Manage X10 inbound messages.""" <|body_1|> def _notify_subscribers(self, housecode, uc_or...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class X10Received: """Receive an X10 message.""" def __init__(self): """Init the X10Received class.""" super().__init__(topic=X10_RECEIVED) self._last_housecode = None self._last_unitcode = None def handle_x10_received(self, raw_x10, x10_flag): """Manage X10 inbound...
the_stack_v2_python_sparse
pyinsteon/handlers/from_device/x10_received.py
pyinsteon/pyinsteon
train
26
76275827782ca3fb5408a39692d688d09b89efc1
[ "super().__init__(parse)\nself.table_name = parse['table_name']\ncolumns = parse['table_element_list']\nself.column_order = [c['def_column_name'] for c in columns if 'def_column_name' in c]\nself.column_attributes = {c['def_column_name']: {'data_type': c['data_type']} for c in columns if 'def_column_name' in c}\nif...
<|body_start_0|> super().__init__(parse) self.table_name = parse['table_name'] columns = parse['table_element_list'] self.column_order = [c['def_column_name'] for c in columns if 'def_column_name' in c] self.column_attributes = {c['def_column_name']: {'data_type': c['data_type']}...
CREATE TABLE ...
SQLExecTableDefinition
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SQLExecTableDefinition: """CREATE TABLE ...""" def __init__(self, parse): """Create a table with given table_name (string) and table_element_list (from parse tree).""" <|body_0|> def execute(self): """Execute the statement.""" <|body_1|> <|end_skeleton|>...
stack_v2_sparse_classes_36k_train_015465
14,323
no_license
[ { "docstring": "Create a table with given table_name (string) and table_element_list (from parse tree).", "name": "__init__", "signature": "def __init__(self, parse)" }, { "docstring": "Execute the statement.", "name": "execute", "signature": "def execute(self)" } ]
2
stack_v2_sparse_classes_30k_train_013682
Implement the Python class `SQLExecTableDefinition` described below. Class description: CREATE TABLE ... Method signatures and docstrings: - def __init__(self, parse): Create a table with given table_name (string) and table_element_list (from parse tree). - def execute(self): Execute the statement.
Implement the Python class `SQLExecTableDefinition` described below. Class description: CREATE TABLE ... Method signatures and docstrings: - def __init__(self, parse): Create a table with given table_name (string) and table_element_list (from parse tree). - def execute(self): Execute the statement. <|skeleton|> clas...
088210db213ad380bce115d2c40a948b7edf38fa
<|skeleton|> class SQLExecTableDefinition: """CREATE TABLE ...""" def __init__(self, parse): """Create a table with given table_name (string) and table_element_list (from parse tree).""" <|body_0|> def execute(self): """Execute the statement.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SQLExecTableDefinition: """CREATE TABLE ...""" def __init__(self, parse): """Create a table with given table_name (string) and table_element_list (from parse tree).""" super().__init__(parse) self.table_name = parse['table_name'] columns = parse['table_element_list'] ...
the_stack_v2_python_sparse
sqlexec.py
gradyDiakubama/cpsc5300py
train
0
dca41c46ebaba746596a7cbb7dcee68a37e44e71
[ "super().__init__()\nself.organization = organization\nself.year_ending = year_ending\nself.case_description = case_description\nself.extra_data_factory = extra_data_factory", "append_choices = ('a', 'b', 'c')\nfirst_number = str(randint(1, 999))\nsecond_number = str(randint(1, 999))\nres = None\nif randint(0, 1)...
<|body_start_0|> super().__init__() self.organization = organization self.year_ending = year_ending self.case_description = case_description self.extra_data_factory = extra_data_factory <|end_body_0|> <|body_start_1|> append_choices = ('a', 'b', 'c') first_number...
Factory Class for producing PropertyState dict
CreateSampleDataFakePropertyStateFactory
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreateSampleDataFakePropertyStateFactory: """Factory Class for producing PropertyState dict""" def __init__(self, organization, year_ending, case_description, extra_data_factory): """:param organization: The organization that will own the created records :param year_ending: datetime,...
stack_v2_sparse_classes_36k_train_015466
40,306
permissive
[ { "docstring": ":param organization: The organization that will own the created records :param year_ending: datetime, used to populate the \"year_ending\" field :param case_description: string, used to populate the \"property_notes\" field Useful for sorting by case in the web client. :param extra_data_factory:...
4
null
Implement the Python class `CreateSampleDataFakePropertyStateFactory` described below. Class description: Factory Class for producing PropertyState dict Method signatures and docstrings: - def __init__(self, organization, year_ending, case_description, extra_data_factory): :param organization: The organization that w...
Implement the Python class `CreateSampleDataFakePropertyStateFactory` described below. Class description: Factory Class for producing PropertyState dict Method signatures and docstrings: - def __init__(self, organization, year_ending, case_description, extra_data_factory): :param organization: The organization that w...
680b6a2b45f3c568d779d8ac86553a0b08c384c8
<|skeleton|> class CreateSampleDataFakePropertyStateFactory: """Factory Class for producing PropertyState dict""" def __init__(self, organization, year_ending, case_description, extra_data_factory): """:param organization: The organization that will own the created records :param year_ending: datetime,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CreateSampleDataFakePropertyStateFactory: """Factory Class for producing PropertyState dict""" def __init__(self, organization, year_ending, case_description, extra_data_factory): """:param organization: The organization that will own the created records :param year_ending: datetime, used to popu...
the_stack_v2_python_sparse
seed/management/commands/create_and_load_sample_data.py
SEED-platform/seed
train
108
0fb98998ddaeef5c4bbfdb856d3133c142f8a643
[ "context = super().get_context_data(**kwargs)\nt_path = self.request.path.split('/')\np_id = t_path[len(t_path) - 1]\np_type = t_path[len(t_path) - 2]\nif p_type == 'user':\n context['p_user'] = User.objects.get(id=p_id)\nelif p_type == 'team':\n context['team'] = Team.objects.get(id=p_id)\nreturn context", ...
<|body_start_0|> context = super().get_context_data(**kwargs) t_path = self.request.path.split('/') p_id = t_path[len(t_path) - 1] p_type = t_path[len(t_path) - 2] if p_type == 'user': context['p_user'] = User.objects.get(id=p_id) elif p_type == 'team': ...
Class for listing this user's (or all if admin) QAPP objects.
QappList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QappList: """Class for listing this user's (or all if admin) QAPP objects.""" def get_context_data(self, **kwargs): """Override the default method to send data to the template. Specifically, include the user or team information for this list of data.""" <|body_0|> def ge...
stack_v2_sparse_classes_36k_train_015467
36,787
no_license
[ { "docstring": "Override the default method to send data to the template. Specifically, include the user or team information for this list of data.", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" }, { "docstring": "Get a list of QAPP objects based on the provide...
2
null
Implement the Python class `QappList` described below. Class description: Class for listing this user's (or all if admin) QAPP objects. Method signatures and docstrings: - def get_context_data(self, **kwargs): Override the default method to send data to the template. Specifically, include the user or team information...
Implement the Python class `QappList` described below. Class description: Class for listing this user's (or all if admin) QAPP objects. Method signatures and docstrings: - def get_context_data(self, **kwargs): Override the default method to send data to the template. Specifically, include the user or team information...
ee419afa3c9f4b9ef3b30b62b693cfac956ce5b4
<|skeleton|> class QappList: """Class for listing this user's (or all if admin) QAPP objects.""" def get_context_data(self, **kwargs): """Override the default method to send data to the template. Specifically, include the user or team information for this list of data.""" <|body_0|> def ge...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QappList: """Class for listing this user's (or all if admin) QAPP objects.""" def get_context_data(self, **kwargs): """Override the default method to send data to the template. Specifically, include the user or team information for this list of data.""" context = super().get_context_data(...
the_stack_v2_python_sparse
DataSearch/qar5/views.py
USEPA/FoodWaste
train
1
82582a200ee1c45205c4bbe6b05077e36fa5a63d
[ "no_duplicate_list = []\nfor i in nums:\n if i not in no_duplicate_list:\n no_duplicate_list.append(i)\n else:\n no_duplicate_list.remove(i)\nreturn no_duplicate_list.pop()", "hash_table = {}\nfor i in nums:\n try:\n hash_table.pop(i)\n except:\n hash_table[i] = 1\nreturn h...
<|body_start_0|> no_duplicate_list = [] for i in nums: if i not in no_duplicate_list: no_duplicate_list.append(i) else: no_duplicate_list.remove(i) return no_duplicate_list.pop() <|end_body_0|> <|body_start_1|> hash_table = {} ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def singleNumber(self, nums): """1.遍历nums; 2.如果数字是新的,加入暂存列表; 3.如果数字已存在于暂存列表,删除它。 时间复杂度:两次查询O(N**2) 空间复杂度:O(N),最坏情况下需要一个大小为N/2的列表。 :type nums: List[int] :rtype: int""" <|body_0|> def singleNumber_hash(self, nums): """1.遍历nums 2.查找has_table是否有当前元素 3.如果没有,插入ha...
stack_v2_sparse_classes_36k_train_015468
2,970
no_license
[ { "docstring": "1.遍历nums; 2.如果数字是新的,加入暂存列表; 3.如果数字已存在于暂存列表,删除它。 时间复杂度:两次查询O(N**2) 空间复杂度:O(N),最坏情况下需要一个大小为N/2的列表。 :type nums: List[int] :rtype: int", "name": "singleNumber", "signature": "def singleNumber(self, nums)" }, { "docstring": "1.遍历nums 2.查找has_table是否有当前元素 3.如果没有,插入hash_table 4.最后hash_t...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def singleNumber(self, nums): 1.遍历nums; 2.如果数字是新的,加入暂存列表; 3.如果数字已存在于暂存列表,删除它。 时间复杂度:两次查询O(N**2) 空间复杂度:O(N),最坏情况下需要一个大小为N/2的列表。 :type nums: List[int] :rtype: int - def singleNumbe...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def singleNumber(self, nums): 1.遍历nums; 2.如果数字是新的,加入暂存列表; 3.如果数字已存在于暂存列表,删除它。 时间复杂度:两次查询O(N**2) 空间复杂度:O(N),最坏情况下需要一个大小为N/2的列表。 :type nums: List[int] :rtype: int - def singleNumbe...
62ad010a992c031e8c0fe4d1a9b6f9364f96ed4c
<|skeleton|> class Solution: def singleNumber(self, nums): """1.遍历nums; 2.如果数字是新的,加入暂存列表; 3.如果数字已存在于暂存列表,删除它。 时间复杂度:两次查询O(N**2) 空间复杂度:O(N),最坏情况下需要一个大小为N/2的列表。 :type nums: List[int] :rtype: int""" <|body_0|> def singleNumber_hash(self, nums): """1.遍历nums 2.查找has_table是否有当前元素 3.如果没有,插入ha...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def singleNumber(self, nums): """1.遍历nums; 2.如果数字是新的,加入暂存列表; 3.如果数字已存在于暂存列表,删除它。 时间复杂度:两次查询O(N**2) 空间复杂度:O(N),最坏情况下需要一个大小为N/2的列表。 :type nums: List[int] :rtype: int""" no_duplicate_list = [] for i in nums: if i not in no_duplicate_list: no_duplicate...
the_stack_v2_python_sparse
leetcode/solved/136_.py
usnnu/python_foundation
train
0
9fb44330adba462db77eb50594a0a4d8fa91580a
[ "query = CurrentPathQuery(path, **kwargs)\n\n@self.document.synchronize\ndef assert_current_path():\n if not query.resolves_for(self):\n raise ExpectationNotMet(query.failure_message)\nassert_current_path()\nreturn True", "query = CurrentPathQuery(path, **kwargs)\n\n@self.document.synchronize\ndef asser...
<|body_start_0|> query = CurrentPathQuery(path, **kwargs) @self.document.synchronize def assert_current_path(): if not query.resolves_for(self): raise ExpectationNotMet(query.failure_message) assert_current_path() return True <|end_body_0|> <|body_st...
SessionMatchersMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SessionMatchersMixin: def assert_current_path(self, path, **kwargs): """Asserts that the page has the given path. By default this will compare against the path+query portion of the full URL. Args: path (str | RegexObject): The string or regex that the current "path" should match. **kwarg...
stack_v2_sparse_classes_36k_train_015469
2,758
permissive
[ { "docstring": "Asserts that the page has the given path. By default this will compare against the path+query portion of the full URL. Args: path (str | RegexObject): The string or regex that the current \"path\" should match. **kwargs: Arbitrary keyword arguments for :class:`CurrentPathQuery`. Returns: True Ra...
4
stack_v2_sparse_classes_30k_train_006908
Implement the Python class `SessionMatchersMixin` described below. Class description: Implement the SessionMatchersMixin class. Method signatures and docstrings: - def assert_current_path(self, path, **kwargs): Asserts that the page has the given path. By default this will compare against the path+query portion of th...
Implement the Python class `SessionMatchersMixin` described below. Class description: Implement the SessionMatchersMixin class. Method signatures and docstrings: - def assert_current_path(self, path, **kwargs): Asserts that the page has the given path. By default this will compare against the path+query portion of th...
eafd9ac50d02e8b57ef90d767493c8fa2be0739a
<|skeleton|> class SessionMatchersMixin: def assert_current_path(self, path, **kwargs): """Asserts that the page has the given path. By default this will compare against the path+query portion of the full URL. Args: path (str | RegexObject): The string or regex that the current "path" should match. **kwarg...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SessionMatchersMixin: def assert_current_path(self, path, **kwargs): """Asserts that the page has the given path. By default this will compare against the path+query portion of the full URL. Args: path (str | RegexObject): The string or regex that the current "path" should match. **kwargs: Arbitrary k...
the_stack_v2_python_sparse
capybara/session_matchers.py
elliterate/capybara.py
train
63
65ea03057d6166684db19be128bde18d69443c80
[ "user_uuid = get_jwt_identity()\ntry:\n page = int(request.args.get('page'))\nexcept (ValueError, TypeError):\n page = 1\nreturn SerieService.get_popular_series(page, user_uuid)", "user_uuid = get_jwt_identity()\ndata = request.get_json()\nreturn SerieService.add_additional_serie(user_uuid, data)" ]
<|body_start_0|> user_uuid = get_jwt_identity() try: page = int(request.args.get('page')) except (ValueError, TypeError): page = 1 return SerieService.get_popular_series(page, user_uuid) <|end_body_0|> <|body_start_1|> user_uuid = get_jwt_identity() ...
SerieResource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SerieResource: def get(self): """Get list of the most popular Series""" <|body_0|> def post(self): """Add additional Serie for validation""" <|body_1|> <|end_skeleton|> <|body_start_0|> user_uuid = get_jwt_identity() try: page = ...
stack_v2_sparse_classes_36k_train_015470
8,589
no_license
[ { "docstring": "Get list of the most popular Series", "name": "get", "signature": "def get(self)" }, { "docstring": "Add additional Serie for validation", "name": "post", "signature": "def post(self)" } ]
2
null
Implement the Python class `SerieResource` described below. Class description: Implement the SerieResource class. Method signatures and docstrings: - def get(self): Get list of the most popular Series - def post(self): Add additional Serie for validation
Implement the Python class `SerieResource` described below. Class description: Implement the SerieResource class. Method signatures and docstrings: - def get(self): Get list of the most popular Series - def post(self): Add additional Serie for validation <|skeleton|> class SerieResource: def get(self): ...
2e7b4e07f149ede884cfe37130d9842ff9bb7be2
<|skeleton|> class SerieResource: def get(self): """Get list of the most popular Series""" <|body_0|> def post(self): """Add additional Serie for validation""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SerieResource: def get(self): """Get list of the most popular Series""" user_uuid = get_jwt_identity() try: page = int(request.args.get('page')) except (ValueError, TypeError): page = 1 return SerieService.get_popular_series(page, user_uuid) ...
the_stack_v2_python_sparse
src/resources/serie_resource.py
RomainCtl/RecoFinement-api
train
0
feffc6be430cc636a40c9ba937dbdb433b1b6e31
[ "if isinstance(path, tuple):\n if len(path) != 1:\n return None\n path = path[0]\nout = load(path)\nif out is not None and len(model):\n raise NotImplementedError()\nif out is not None:\n LOGS.info('%s loading %s', type(self).__name__, path)\nreturn [out] if isinstance(out, dict) else out", "if...
<|body_start_0|> if isinstance(path, tuple): if len(path) != 1: return None path = path[0] out = load(path) if out is not None and len(model): raise NotImplementedError() if out is not None: LOGS.info('%s loading %s', type(s...
Ana IO
AnaIO
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnaIO: """Ana IO""" def open(self, path: Union[str, Tuple[str, ...]], model: tuple): """opens an ana file""" <|body_0|> def save(self, path: str, models): """closes an ana file""" <|body_1|> <|end_skeleton|> <|body_start_0|> if isinstance(path, ...
stack_v2_sparse_classes_36k_train_015471
3,001
no_license
[ { "docstring": "opens an ana file", "name": "open", "signature": "def open(self, path: Union[str, Tuple[str, ...]], model: tuple)" }, { "docstring": "closes an ana file", "name": "save", "signature": "def save(self, path: str, models)" } ]
2
null
Implement the Python class `AnaIO` described below. Class description: Ana IO Method signatures and docstrings: - def open(self, path: Union[str, Tuple[str, ...]], model: tuple): opens an ana file - def save(self, path: str, models): closes an ana file
Implement the Python class `AnaIO` described below. Class description: Ana IO Method signatures and docstrings: - def open(self, path: Union[str, Tuple[str, ...]], model: tuple): opens an ana file - def save(self, path: str, models): closes an ana file <|skeleton|> class AnaIO: """Ana IO""" def open(self, p...
f9534e4fff9775ff45d08d401de61015d4a69e76
<|skeleton|> class AnaIO: """Ana IO""" def open(self, path: Union[str, Tuple[str, ...]], model: tuple): """opens an ana file""" <|body_0|> def save(self, path: str, models): """closes an ana file""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AnaIO: """Ana IO""" def open(self, path: Union[str, Tuple[str, ...]], model: tuple): """opens an ana file""" if isinstance(path, tuple): if len(path) != 1: return None path = path[0] out = load(path) if out is not None and len(model)...
the_stack_v2_python_sparse
src/taskstore/control.py
depixusgenome/trackanalysis
train
0
7bdfca5a348ea8adb5500929466b85274a15817c
[ "self.START_CMD = 1\nself.STOP_CMD = 0\nself.hasLaserPoint = True\nself.laserToBaseTransform = node.lookupTransform('base', 'rgbd_cam_1_rgb_optical_frame')\nself.laserPointPub = rospy.Publisher('/laser_detector/cmd', Int16Msg, queue_size=1)\nself.laserPointSub = rospy.Subscriber('/laser_detector/point', PointMsg, s...
<|body_start_0|> self.START_CMD = 1 self.STOP_CMD = 0 self.hasLaserPoint = True self.laserToBaseTransform = node.lookupTransform('base', 'rgbd_cam_1_rgb_optical_frame') self.laserPointPub = rospy.Publisher('/laser_detector/cmd', Int16Msg, queue_size=1) self.laserPointSub ...
A class for interfacing with a standard ROS topic point cloud.
LaserDetector
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LaserDetector: """A class for interfacing with a standard ROS topic point cloud.""" def __init__(self, node): """TODO""" <|body_0|> def laserPointCallback(self, msg): """TODO""" <|body_1|> def detectStablePoint(self, laserPointWorkspace, laserPointQu...
stack_v2_sparse_classes_36k_train_015472
2,696
no_license
[ { "docstring": "TODO", "name": "__init__", "signature": "def __init__(self, node)" }, { "docstring": "TODO", "name": "laserPointCallback", "signature": "def laserPointCallback(self, msg)" }, { "docstring": "TODO", "name": "detectStablePoint", "signature": "def detectStabl...
3
null
Implement the Python class `LaserDetector` described below. Class description: A class for interfacing with a standard ROS topic point cloud. Method signatures and docstrings: - def __init__(self, node): TODO - def laserPointCallback(self, msg): TODO - def detectStablePoint(self, laserPointWorkspace, laserPointQueueS...
Implement the Python class `LaserDetector` described below. Class description: A class for interfacing with a standard ROS topic point cloud. Method signatures and docstrings: - def __init__(self, node): TODO - def laserPointCallback(self, msg): TODO - def detectStablePoint(self, laserPointWorkspace, laserPointQueueS...
04009550321868722d207924eed3609be7f54882
<|skeleton|> class LaserDetector: """A class for interfacing with a standard ROS topic point cloud.""" def __init__(self, node): """TODO""" <|body_0|> def laserPointCallback(self, msg): """TODO""" <|body_1|> def detectStablePoint(self, laserPointWorkspace, laserPointQu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LaserDetector: """A class for interfacing with a standard ROS topic point cloud.""" def __init__(self, node): """TODO""" self.START_CMD = 1 self.STOP_CMD = 0 self.hasLaserPoint = True self.laserToBaseTransform = node.lookupTransform('base', 'rgbd_cam_1_rgb_optical_...
the_stack_v2_python_sparse
src/active_sensing/scripts/laser_detector.py
DeepBlue14/arm_wkspc
train
0
752baf5385fe36e92276b92fec051107d7cb65a8
[ "self.val = val\nself.left = None\nself.right = None", "if side == 'l':\n self.left = node\nelif side == 'r':\n self.right = node\nelse:\n raise Exception('Wrong parameter.')", "if self.val == None:\n print('Empty tree.')\nelif mode == 'recursive':\n print(root.val, end=' -> ')\n if root.left ...
<|body_start_0|> self.val = val self.left = None self.right = None <|end_body_0|> <|body_start_1|> if side == 'l': self.left = node elif side == 'r': self.right = node else: raise Exception('Wrong parameter.') <|end_body_1|> <|body_st...
Node of a binary tree. Attributes: val: The value of the node. left: Left child of current node, default: None. right: Right child of current node, default: None.
TreeNode
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TreeNode: """Node of a binary tree. Attributes: val: The value of the node. left: Left child of current node, default: None. right: Right child of current node, default: None.""" def __init__(self, val: int) -> 'TreeNode': """Initialize the TreeNode with desired value. Args: val: The...
stack_v2_sparse_classes_36k_train_015473
7,998
permissive
[ { "docstring": "Initialize the TreeNode with desired value. Args: val: The value of the tree node.", "name": "__init__", "signature": "def __init__(self, val: int) -> 'TreeNode'" }, { "docstring": "Add new node to existing tree node. Args: node: The node to be added to the tree. side: The side t...
5
stack_v2_sparse_classes_30k_train_000740
Implement the Python class `TreeNode` described below. Class description: Node of a binary tree. Attributes: val: The value of the node. left: Left child of current node, default: None. right: Right child of current node, default: None. Method signatures and docstrings: - def __init__(self, val: int) -> 'TreeNode': I...
Implement the Python class `TreeNode` described below. Class description: Node of a binary tree. Attributes: val: The value of the node. left: Left child of current node, default: None. right: Right child of current node, default: None. Method signatures and docstrings: - def __init__(self, val: int) -> 'TreeNode': I...
9adbe5fc2bce71f4c09ccf83079c44699c27fce4
<|skeleton|> class TreeNode: """Node of a binary tree. Attributes: val: The value of the node. left: Left child of current node, default: None. right: Right child of current node, default: None.""" def __init__(self, val: int) -> 'TreeNode': """Initialize the TreeNode with desired value. Args: val: The...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TreeNode: """Node of a binary tree. Attributes: val: The value of the node. left: Left child of current node, default: None. right: Right child of current node, default: None.""" def __init__(self, val: int) -> 'TreeNode': """Initialize the TreeNode with desired value. Args: val: The value of the...
the_stack_v2_python_sparse
data_structures/binary_tree.py
1lch2/PythonExercise
train
1
5a4a6ef527ab3f137663a78fe8b6df996321a3b7
[ "status, output = subprocess.getstatusoutput('ifconfig')\nif status == 0:\n pattern = re.compile(ifname + '.*?inet.*?(\\\\d+\\\\.\\\\d+\\\\.\\\\d+\\\\.\\\\d+).*?netmask', re.S)\n result = re.search(pattern, output)\n if result:\n ip = result.group(1)\n return ip", "try:\n response = requ...
<|body_start_0|> status, output = subprocess.getstatusoutput('ifconfig') if status == 0: pattern = re.compile(ifname + '.*?inet.*?(\\d+\\.\\d+\\.\\d+\\.\\d+).*?netmask', re.S) result = re.search(pattern, output) if result: ip = result.group(1) ...
Sender
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Sender: def get_ip(self, ifname=ADSL_IFNAME): """获取本机ip :param ifname: :return:""" <|body_0|> def test_proxy(self, proxy): """测试代理 :param proxy: :return:""" <|body_1|> def remove_proxy(self): """移除代理 :param self: :return:""" <|body_2|> ...
stack_v2_sparse_classes_36k_train_015474
2,939
no_license
[ { "docstring": "获取本机ip :param ifname: :return:", "name": "get_ip", "signature": "def get_ip(self, ifname=ADSL_IFNAME)" }, { "docstring": "测试代理 :param proxy: :return:", "name": "test_proxy", "signature": "def test_proxy(self, proxy)" }, { "docstring": "移除代理 :param self: :return:",...
5
stack_v2_sparse_classes_30k_train_010485
Implement the Python class `Sender` described below. Class description: Implement the Sender class. Method signatures and docstrings: - def get_ip(self, ifname=ADSL_IFNAME): 获取本机ip :param ifname: :return: - def test_proxy(self, proxy): 测试代理 :param proxy: :return: - def remove_proxy(self): 移除代理 :param self: :return: -...
Implement the Python class `Sender` described below. Class description: Implement the Sender class. Method signatures and docstrings: - def get_ip(self, ifname=ADSL_IFNAME): 获取本机ip :param ifname: :return: - def test_proxy(self, proxy): 测试代理 :param proxy: :return: - def remove_proxy(self): 移除代理 :param self: :return: -...
28d89fd08f58daddadf68c4c8796b670a417efe3
<|skeleton|> class Sender: def get_ip(self, ifname=ADSL_IFNAME): """获取本机ip :param ifname: :return:""" <|body_0|> def test_proxy(self, proxy): """测试代理 :param proxy: :return:""" <|body_1|> def remove_proxy(self): """移除代理 :param self: :return:""" <|body_2|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Sender: def get_ip(self, ifname=ADSL_IFNAME): """获取本机ip :param ifname: :return:""" status, output = subprocess.getstatusoutput('ifconfig') if status == 0: pattern = re.compile(ifname + '.*?inet.*?(\\d+\\.\\d+\\.\\d+\\.\\d+).*?netmask', re.S) result = re.search(p...
the_stack_v2_python_sparse
ADSL_proxypool/Sender.py
Dgama/CaiqingCui-Python-Webspider
train
0
247cd6ad5582de9e5bb3beffebee50f5eb828674
[ "super(FPA, self).__init__()\nchannels_mid = int(channels / 4)\nself.channels_cond = channels\nself.conv_master = nn.Conv2d(self.channels_cond, channels, kernel_size=1, bias=False)\nself.bn_master = nn.BatchNorm2d(channels)\nself.conv_gpb = nn.Conv2d(self.channels_cond, channels, kernel_size=1, bias=False)\nself.bn...
<|body_start_0|> super(FPA, self).__init__() channels_mid = int(channels / 4) self.channels_cond = channels self.conv_master = nn.Conv2d(self.channels_cond, channels, kernel_size=1, bias=False) self.bn_master = nn.BatchNorm2d(channels) self.conv_gpb = nn.Conv2d(self.chann...
FPA
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FPA: def __init__(self, channels=2048): """Feature Pyramid Attention :type channels: int""" <|body_0|> def forward(self, x): """:param x: Shape: [b, 2048, h, w] :return: out: Feature maps. Shape: [b, 2048, h, w]""" <|body_1|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_36k_train_015475
9,063
permissive
[ { "docstring": "Feature Pyramid Attention :type channels: int", "name": "__init__", "signature": "def __init__(self, channels=2048)" }, { "docstring": ":param x: Shape: [b, 2048, h, w] :return: out: Feature maps. Shape: [b, 2048, h, w]", "name": "forward", "signature": "def forward(self,...
2
stack_v2_sparse_classes_30k_train_004798
Implement the Python class `FPA` described below. Class description: Implement the FPA class. Method signatures and docstrings: - def __init__(self, channels=2048): Feature Pyramid Attention :type channels: int - def forward(self, x): :param x: Shape: [b, 2048, h, w] :return: out: Feature maps. Shape: [b, 2048, h, w]
Implement the Python class `FPA` described below. Class description: Implement the FPA class. Method signatures and docstrings: - def __init__(self, channels=2048): Feature Pyramid Attention :type channels: int - def forward(self, x): :param x: Shape: [b, 2048, h, w] :return: out: Feature maps. Shape: [b, 2048, h, w]...
fc93419b5edb917100450f45254d68ad372c15b5
<|skeleton|> class FPA: def __init__(self, channels=2048): """Feature Pyramid Attention :type channels: int""" <|body_0|> def forward(self, x): """:param x: Shape: [b, 2048, h, w] :return: out: Feature maps. Shape: [b, 2048, h, w]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FPA: def __init__(self, channels=2048): """Feature Pyramid Attention :type channels: int""" super(FPA, self).__init__() channels_mid = int(channels / 4) self.channels_cond = channels self.conv_master = nn.Conv2d(self.channels_cond, channels, kernel_size=1, bias=False) ...
the_stack_v2_python_sparse
2021届毕设-语义分割-CascadePSP/models/pan/network.py
lqwrl542293/JL-Yang_CV
train
14
1d9656247478eaee8967fbd286450ae2b06b66b7
[ "self.log = logger or logging.getLogger('layout_json')\nself._vault_client = None\nself.cache = {}\nself.vault_token = os.getenv('VAULT_TOKEN')\nself.vault_addr = os.getenv('VAULT_ADDR') or os.getenv('VAULT_URL')", "if '/' in env_variable:\n paths = env_variable.lstrip('/').split('/')\n env_variable = '/'.j...
<|body_start_0|> self.log = logger or logging.getLogger('layout_json') self._vault_client = None self.cache = {} self.vault_token = os.getenv('VAULT_TOKEN') self.vault_addr = os.getenv('VAULT_ADDR') or os.getenv('VAULT_URL') <|end_body_0|> <|body_start_1|> if '/' in env_...
TcEx Key Value API Module. Args: logger (logging.Logger, optional): A instance of Logger. Defaults to None.
EnvStore
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EnvStore: """TcEx Key Value API Module. Args: logger (logging.Logger, optional): A instance of Logger. Defaults to None.""" def __init__(self, logger=None): """Initialize the Class properties.""" <|body_0|> def _convert_env(env_variable): """Convert an a vault pa...
stack_v2_sparse_classes_36k_train_015476
4,970
permissive
[ { "docstring": "Initialize the Class properties.", "name": "__init__", "signature": "def __init__(self, logger=None)" }, { "docstring": "Convert an a vault path to env variable, removing first 2 parts of path Vault path need to be updated to be looked up as env variables. /ninja/int/cisco/umbrel...
5
stack_v2_sparse_classes_30k_train_015888
Implement the Python class `EnvStore` described below. Class description: TcEx Key Value API Module. Args: logger (logging.Logger, optional): A instance of Logger. Defaults to None. Method signatures and docstrings: - def __init__(self, logger=None): Initialize the Class properties. - def _convert_env(env_variable): ...
Implement the Python class `EnvStore` described below. Class description: TcEx Key Value API Module. Args: logger (logging.Logger, optional): A instance of Logger. Defaults to None. Method signatures and docstrings: - def __init__(self, logger=None): Initialize the Class properties. - def _convert_env(env_variable): ...
7cf04fec048fadc71ff851970045b8a587269ccf
<|skeleton|> class EnvStore: """TcEx Key Value API Module. Args: logger (logging.Logger, optional): A instance of Logger. Defaults to None.""" def __init__(self, logger=None): """Initialize the Class properties.""" <|body_0|> def _convert_env(env_variable): """Convert an a vault pa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EnvStore: """TcEx Key Value API Module. Args: logger (logging.Logger, optional): A instance of Logger. Defaults to None.""" def __init__(self, logger=None): """Initialize the Class properties.""" self.log = logger or logging.getLogger('layout_json') self._vault_client = None ...
the_stack_v2_python_sparse
tcex/env_store/env_store.py
TpyoKnig/tcex
train
0
a01f0b92b5474681ef51e6c9fe9d37b7d31b7413
[ "self.__buckets = [collections.deque() for _ in xrange(int(math.ceil(n ** 0.5)))]\nfor i in xrange(n):\n self.__buckets[i // len(self.__buckets)].append(i + 1)", "k -= 1\nleft, idx = divmod(k, len(self.__buckets))\nval = self.__buckets[left][idx]\ndel self.__buckets[left][idx]\nself.__buckets[-1].append(val)\n...
<|body_start_0|> self.__buckets = [collections.deque() for _ in xrange(int(math.ceil(n ** 0.5)))] for i in xrange(n): self.__buckets[i // len(self.__buckets)].append(i + 1) <|end_body_0|> <|body_start_1|> k -= 1 left, idx = divmod(k, len(self.__buckets)) val = self._...
MRUQueue3
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MRUQueue3: def __init__(self, n): """:type n: int""" <|body_0|> def fetch(self, k): """:type k: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.__buckets = [collections.deque() for _ in xrange(int(math.ceil(n ** 0.5)))] ...
stack_v2_sparse_classes_36k_train_015477
3,178
permissive
[ { "docstring": ":type n: int", "name": "__init__", "signature": "def __init__(self, n)" }, { "docstring": ":type k: int :rtype: int", "name": "fetch", "signature": "def fetch(self, k)" } ]
2
null
Implement the Python class `MRUQueue3` described below. Class description: Implement the MRUQueue3 class. Method signatures and docstrings: - def __init__(self, n): :type n: int - def fetch(self, k): :type k: int :rtype: int
Implement the Python class `MRUQueue3` described below. Class description: Implement the MRUQueue3 class. Method signatures and docstrings: - def __init__(self, n): :type n: int - def fetch(self, k): :type k: int :rtype: int <|skeleton|> class MRUQueue3: def __init__(self, n): """:type n: int""" ...
4dc4e6642dc92f1983c13564cc0fd99917cab358
<|skeleton|> class MRUQueue3: def __init__(self, n): """:type n: int""" <|body_0|> def fetch(self, k): """:type k: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MRUQueue3: def __init__(self, n): """:type n: int""" self.__buckets = [collections.deque() for _ in xrange(int(math.ceil(n ** 0.5)))] for i in xrange(n): self.__buckets[i // len(self.__buckets)].append(i + 1) def fetch(self, k): """:type k: int :rtype: int""" ...
the_stack_v2_python_sparse
Python/design-most-recently-used-queue.py
kamyu104/LeetCode-Solutions
train
4,549
266db3947a97a24b0f624db8a61a0e6fc795d3a8
[ "template_id = kwargs.pop('template_id')\ntemplate = template_api.get(template_id)\nversion_manager = version_manager_api.get_from_version(template)\nversion_number = version_manager_api.get_version_number(version_manager, template_id)\ntry:\n template_xsl_rendering = template_xsl_rendering_api.get_by_template_i...
<|body_start_0|> template_id = kwargs.pop('template_id') template = template_api.get(template_id) version_manager = version_manager_api.get_from_version(template) version_number = version_manager_api.get_version_number(version_manager, template_id) try: template_xsl_r...
Template XSL rendering view.
TemplateXSLRenderingView
[ "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TemplateXSLRenderingView: """Template XSL rendering view.""" def get(self, request, *args, **kwargs): """GET request. Create/Show the form for the configuration. Args: request: *args: **kwargs: Returns:""" <|body_0|> def post(self, request, *args, **kwargs): """P...
stack_v2_sparse_classes_36k_train_015478
16,210
permissive
[ { "docstring": "GET request. Create/Show the form for the configuration. Args: request: *args: **kwargs: Returns:", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "POST request. Try to save the configuration. Args: request: *args: **kwargs: Returns:", ...
3
stack_v2_sparse_classes_30k_train_010505
Implement the Python class `TemplateXSLRenderingView` described below. Class description: Template XSL rendering view. Method signatures and docstrings: - def get(self, request, *args, **kwargs): GET request. Create/Show the form for the configuration. Args: request: *args: **kwargs: Returns: - def post(self, request...
Implement the Python class `TemplateXSLRenderingView` described below. Class description: Template XSL rendering view. Method signatures and docstrings: - def get(self, request, *args, **kwargs): GET request. Create/Show the form for the configuration. Args: request: *args: **kwargs: Returns: - def post(self, request...
568cb75a40ccff1d74a1a757866112535efd769a
<|skeleton|> class TemplateXSLRenderingView: """Template XSL rendering view.""" def get(self, request, *args, **kwargs): """GET request. Create/Show the form for the configuration. Args: request: *args: **kwargs: Returns:""" <|body_0|> def post(self, request, *args, **kwargs): """P...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TemplateXSLRenderingView: """Template XSL rendering view.""" def get(self, request, *args, **kwargs): """GET request. Create/Show the form for the configuration. Args: request: *args: **kwargs: Returns:""" template_id = kwargs.pop('template_id') template = template_api.get(templat...
the_stack_v2_python_sparse
core_main_app/views/common/views.py
adilmania/core_main_app
train
0
5a66b20110b2947aefb4afa75292115957e03ecd
[ "try:\n return Member.objects.get(pk=pk)\nexcept Member.DoesNotExist:\n raise Http404", "if pk is not None:\n member = self.get_member(int(pk))\nelse:\n member = None\nself.check_object_permissions(request, member)\nsavings = Savings.get_members_savings(member)\nserializer = SavingsMinimalSerializer(s...
<|body_start_0|> try: return Member.objects.get(pk=pk) except Member.DoesNotExist: raise Http404 <|end_body_0|> <|body_start_1|> if pk is not None: member = self.get_member(int(pk)) else: member = None self.check_object_permissions...
SavingsView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SavingsView: def get_member(self, pk): """Get a member.""" <|body_0|> def get(self, request, pk, format=None): """List Member's savings --- serializer: savings.serializers.SavingsMinimalSerializer""" <|body_1|> <|end_skeleton|> <|body_start_0|> try:...
stack_v2_sparse_classes_36k_train_015479
5,809
no_license
[ { "docstring": "Get a member.", "name": "get_member", "signature": "def get_member(self, pk)" }, { "docstring": "List Member's savings --- serializer: savings.serializers.SavingsMinimalSerializer", "name": "get", "signature": "def get(self, request, pk, format=None)" } ]
2
stack_v2_sparse_classes_30k_train_018753
Implement the Python class `SavingsView` described below. Class description: Implement the SavingsView class. Method signatures and docstrings: - def get_member(self, pk): Get a member. - def get(self, request, pk, format=None): List Member's savings --- serializer: savings.serializers.SavingsMinimalSerializer
Implement the Python class `SavingsView` described below. Class description: Implement the SavingsView class. Method signatures and docstrings: - def get_member(self, pk): Get a member. - def get(self, request, pk, format=None): List Member's savings --- serializer: savings.serializers.SavingsMinimalSerializer <|ske...
c5ac11e40a628c93c3865363e97b4f255a104ca8
<|skeleton|> class SavingsView: def get_member(self, pk): """Get a member.""" <|body_0|> def get(self, request, pk, format=None): """List Member's savings --- serializer: savings.serializers.SavingsMinimalSerializer""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SavingsView: def get_member(self, pk): """Get a member.""" try: return Member.objects.get(pk=pk) except Member.DoesNotExist: raise Http404 def get(self, request, pk, format=None): """List Member's savings --- serializer: savings.serializers.SavingsM...
the_stack_v2_python_sparse
savings/views.py
lubegamark/gosacco
train
2
f37d94e0b76a10115380f4ea0ccb103a954501fa
[ "from collections import defaultdict\nres = defaultdict(int)\nfor dm in cpdomains:\n click = cpdomains[dm]\n subs = dm.split('.')\n for i in range(len(subs)):\n csb = '.'.join(subs[i:])\n res[csb] += click\nreturn res", "dp = [[0 for _ in range(len(his2) + 1)] for _ in range(len(his1) + 1)]...
<|body_start_0|> from collections import defaultdict res = defaultdict(int) for dm in cpdomains: click = cpdomains[dm] subs = dm.split('.') for i in range(len(subs)): csb = '.'.join(subs[i:]) res[csb] += click return res...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def subdomainVisits(self, cpdomains): """:type cpdomains: List[str] :rtype: List[str]""" <|body_0|> def longest_continuous_common_history(self, his1, his2): """user0 = [ "/nine.html", "/four.html", "/six.html", "/seven.html", "/one.html" ] user2 = [ "/nine....
stack_v2_sparse_classes_36k_train_015480
1,513
no_license
[ { "docstring": ":type cpdomains: List[str] :rtype: List[str]", "name": "subdomainVisits", "signature": "def subdomainVisits(self, cpdomains)" }, { "docstring": "user0 = [ \"/nine.html\", \"/four.html\", \"/six.html\", \"/seven.html\", \"/one.html\" ] user2 = [ \"/nine.html\", \"/two.html\", \"/t...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subdomainVisits(self, cpdomains): :type cpdomains: List[str] :rtype: List[str] - def longest_continuous_common_history(self, his1, his2): user0 = [ "/nine.html", "/four.html"...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subdomainVisits(self, cpdomains): :type cpdomains: List[str] :rtype: List[str] - def longest_continuous_common_history(self, his1, his2): user0 = [ "/nine.html", "/four.html"...
e807ae43a0a253deaa6c9ed1c592fa3a14a6cab8
<|skeleton|> class Solution: def subdomainVisits(self, cpdomains): """:type cpdomains: List[str] :rtype: List[str]""" <|body_0|> def longest_continuous_common_history(self, his1, his2): """user0 = [ "/nine.html", "/four.html", "/six.html", "/seven.html", "/one.html" ] user2 = [ "/nine....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def subdomainVisits(self, cpdomains): """:type cpdomains: List[str] :rtype: List[str]""" from collections import defaultdict res = defaultdict(int) for dm in cpdomains: click = cpdomains[dm] subs = dm.split('.') for i in range(len(s...
the_stack_v2_python_sparse
Medium/Subdomain visit count.py
uathena1991/Leetcode
train
1
a7b71c941db485bfa8b423f413a785dfb4fd4da2
[ "versions = []\nfor key, data in VERSIONS.items():\n v = BaseVersion(data['id'], data['status'], request.application_url, data['updated'])\n versions.append(v)\nreturn wsgi.Result(VersionsDataView(versions))", "data = VERSIONS[request.url_version]\nv = Version(data['id'], data['status'], request.application...
<|body_start_0|> versions = [] for key, data in VERSIONS.items(): v = BaseVersion(data['id'], data['status'], request.application_url, data['updated']) versions.append(v) return wsgi.Result(VersionsDataView(versions)) <|end_body_0|> <|body_start_1|> data = VERSIO...
VersionsController
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VersionsController: def index(self, request): """Respond to a request for API versions.""" <|body_0|> def show(self, request): """Respond to a request for a specific API version.""" <|body_1|> <|end_skeleton|> <|body_start_0|> versions = [] ...
stack_v2_sparse_classes_36k_train_015481
3,164
permissive
[ { "docstring": "Respond to a request for API versions.", "name": "index", "signature": "def index(self, request)" }, { "docstring": "Respond to a request for a specific API version.", "name": "show", "signature": "def show(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_013186
Implement the Python class `VersionsController` described below. Class description: Implement the VersionsController class. Method signatures and docstrings: - def index(self, request): Respond to a request for API versions. - def show(self, request): Respond to a request for a specific API version.
Implement the Python class `VersionsController` described below. Class description: Implement the VersionsController class. Method signatures and docstrings: - def index(self, request): Respond to a request for API versions. - def show(self, request): Respond to a request for a specific API version. <|skeleton|> cla...
4288b8f78250cc3a1c93b019e2c3b4bf78df177c
<|skeleton|> class VersionsController: def index(self, request): """Respond to a request for API versions.""" <|body_0|> def show(self, request): """Respond to a request for a specific API version.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VersionsController: def index(self, request): """Respond to a request for API versions.""" versions = [] for key, data in VERSIONS.items(): v = BaseVersion(data['id'], data['status'], request.application_url, data['updated']) versions.append(v) return ws...
the_stack_v2_python_sparse
trove/versions.py
openstack/trove
train
258
64a8a0d251288efac2b58abed9da71c3eda9d011
[ "super().__init__(display_name, entity_id, 'SWITCH', *args, **kwargs)\nself._hass = hass\nself._entity_id = entity_id\nself._domain = split_entity_id(entity_id)[0]\nself.flag_target_state = False\nserv_switch = add_preload_service(self, SERV_SWITCH)\nself.char_on = serv_switch.get_characteristic(CHAR_ON)\nself.char...
<|body_start_0|> super().__init__(display_name, entity_id, 'SWITCH', *args, **kwargs) self._hass = hass self._entity_id = entity_id self._domain = split_entity_id(entity_id)[0] self.flag_target_state = False serv_switch = add_preload_service(self, SERV_SWITCH) sel...
Generate a Switch accessory.
Switch
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Switch: """Generate a Switch accessory.""" def __init__(self, hass, entity_id, display_name, *args, **kwargs): """Initialize a Switch accessory object to represent a remote.""" <|body_0|> def set_state(self, value): """Move switch state to value if call came from...
stack_v2_sparse_classes_36k_train_015482
1,985
permissive
[ { "docstring": "Initialize a Switch accessory object to represent a remote.", "name": "__init__", "signature": "def __init__(self, hass, entity_id, display_name, *args, **kwargs)" }, { "docstring": "Move switch state to value if call came from HomeKit.", "name": "set_state", "signature":...
3
stack_v2_sparse_classes_30k_train_018027
Implement the Python class `Switch` described below. Class description: Generate a Switch accessory. Method signatures and docstrings: - def __init__(self, hass, entity_id, display_name, *args, **kwargs): Initialize a Switch accessory object to represent a remote. - def set_state(self, value): Move switch state to va...
Implement the Python class `Switch` described below. Class description: Generate a Switch accessory. Method signatures and docstrings: - def __init__(self, hass, entity_id, display_name, *args, **kwargs): Initialize a Switch accessory object to represent a remote. - def set_state(self, value): Move switch state to va...
5c4529d044463083bad73cdbf9d17d8cb2b29afa
<|skeleton|> class Switch: """Generate a Switch accessory.""" def __init__(self, hass, entity_id, display_name, *args, **kwargs): """Initialize a Switch accessory object to represent a remote.""" <|body_0|> def set_state(self, value): """Move switch state to value if call came from...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Switch: """Generate a Switch accessory.""" def __init__(self, hass, entity_id, display_name, *args, **kwargs): """Initialize a Switch accessory object to represent a remote.""" super().__init__(display_name, entity_id, 'SWITCH', *args, **kwargs) self._hass = hass self._ent...
the_stack_v2_python_sparse
homeassistant/components/homekit/type_switches.py
simpss/home-assistant
train
1
40b37e7e96924811468d9e0e368beb798c02949a
[ "command = subparsers.add_parser('test', help=textwrap.fill('Test operational status.', width=width))\nself.subcommand = command.add_subparsers(dest='qualifier')\nfor name in dir(self):\n attribute = getattr(self, name)\n if ismethod(attribute):\n if name.startswith('_'):\n continue\n ...
<|body_start_0|> command = subparsers.add_parser('test', help=textwrap.fill('Test operational status.', width=width)) self.subcommand = command.add_subparsers(dest='qualifier') for name in dir(self): attribute = getattr(self, name) if ismethod(attribute): ...
Class handles CLI 'test' option.
_Test
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _Test: """Class handles CLI 'test' option.""" def __init__(self, subparsers, width=80): """Function for intializing the class.""" <|body_0|> def poller(self, width=80): """Process test poller CLI commands. Args: width: Width of the help text string to STDIO befor...
stack_v2_sparse_classes_36k_train_015483
14,010
permissive
[ { "docstring": "Function for intializing the class.", "name": "__init__", "signature": "def __init__(self, subparsers, width=80)" }, { "docstring": "Process test poller CLI commands. Args: width: Width of the help text string to STDIO before wrapping Returns: None", "name": "poller", "si...
2
null
Implement the Python class `_Test` described below. Class description: Class handles CLI 'test' option. Method signatures and docstrings: - def __init__(self, subparsers, width=80): Function for intializing the class. - def poller(self, width=80): Process test poller CLI commands. Args: width: Width of the help text ...
Implement the Python class `_Test` described below. Class description: Class handles CLI 'test' option. Method signatures and docstrings: - def __init__(self, subparsers, width=80): Function for intializing the class. - def poller(self, width=80): Process test poller CLI commands. Args: width: Width of the help text ...
ae82589fbbab77fef6d6be09c1fcca5846f595a8
<|skeleton|> class _Test: """Class handles CLI 'test' option.""" def __init__(self, subparsers, width=80): """Function for intializing the class.""" <|body_0|> def poller(self, width=80): """Process test poller CLI commands. Args: width: Width of the help text string to STDIO befor...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _Test: """Class handles CLI 'test' option.""" def __init__(self, subparsers, width=80): """Function for intializing the class.""" command = subparsers.add_parser('test', help=textwrap.fill('Test operational status.', width=width)) self.subcommand = command.add_subparsers(dest='qua...
the_stack_v2_python_sparse
switchmap/cli/cli.py
PalisadoesFoundation/switchmap-ng
train
8
16a6433799f3af263c5added4e5d258efc8babc1
[ "self.prfs_d = extract_settings()\nself.logger = logger\nself.mag = mag\nself.scmp_d = scmp_d\nself.scmp_cf = scmp_cf\nself.sex_d = sex_d\nself.scamp_process()", "sex_cf = '{}_{}_{}_{}_{}'.format(self.sex_d['deblend_nthresh'], self.sex_d['analysis_thresh'], self.sex_d['detect_thresh'], self.sex_d['deblend_mincoun...
<|body_start_0|> self.prfs_d = extract_settings() self.logger = logger self.mag = mag self.scmp_d = scmp_d self.scmp_cf = scmp_cf self.sex_d = sex_d self.scamp_process() <|end_body_0|> <|body_start_1|> sex_cf = '{}_{}_{}_{}_{}'.format(self.sex_d['deblend_...
Scamp
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Scamp: def __init__(self, logger, mag, scmp_d, scmp_cf, sex_d): """:param logger: :param mag: :param scmp_d: :param scmp_cf: :param sex_d:""" <|body_0|> def scamp_process(self): """:return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.prfs_d...
stack_v2_sparse_classes_36k_train_015484
3,359
no_license
[ { "docstring": ":param logger: :param mag: :param scmp_d: :param scmp_cf: :param sex_d:", "name": "__init__", "signature": "def __init__(self, logger, mag, scmp_d, scmp_cf, sex_d)" }, { "docstring": ":return:", "name": "scamp_process", "signature": "def scamp_process(self)" } ]
2
stack_v2_sparse_classes_30k_train_009519
Implement the Python class `Scamp` described below. Class description: Implement the Scamp class. Method signatures and docstrings: - def __init__(self, logger, mag, scmp_d, scmp_cf, sex_d): :param logger: :param mag: :param scmp_d: :param scmp_cf: :param sex_d: - def scamp_process(self): :return:
Implement the Python class `Scamp` described below. Class description: Implement the Scamp class. Method signatures and docstrings: - def __init__(self, logger, mag, scmp_d, scmp_cf, sex_d): :param logger: :param mag: :param scmp_d: :param scmp_cf: :param sex_d: - def scamp_process(self): :return: <|skeleton|> class...
ca9f090ed8b6049049c13a348cf1ebd8c054acd4
<|skeleton|> class Scamp: def __init__(self, logger, mag, scmp_d, scmp_cf, sex_d): """:param logger: :param mag: :param scmp_d: :param scmp_cf: :param sex_d:""" <|body_0|> def scamp_process(self): """:return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Scamp: def __init__(self, logger, mag, scmp_d, scmp_cf, sex_d): """:param logger: :param mag: :param scmp_d: :param scmp_cf: :param sex_d:""" self.prfs_d = extract_settings() self.logger = logger self.mag = mag self.scmp_d = scmp_d self.scmp_cf = scmp_cf ...
the_stack_v2_python_sparse
pipeline_luca/scamp_aux_luca.py
sgongar/Euclid-tests
train
0
fb25f86d4956d0617e8e8b9df02a666e9f948b18
[ "for name, infos in Rt.geom_dict.items():\n if name in Rt.optim_var_dict:\n self.add_input(name, val=infos[1][0])", "log.info(f'Start optimisation iteration: {Rt.counter}')\nfor name, infos in Rt.geom_dict.items():\n infos[1].append(inputs[name][0])\nif Rt.counter == 0:\n cpacs_in = Rt.modules[0]....
<|body_start_0|> for name, infos in Rt.geom_dict.items(): if name in Rt.optim_var_dict: self.add_input(name, val=infos[1][0]) <|end_body_0|> <|body_start_1|> log.info(f'Start optimisation iteration: {Rt.counter}') for name, infos in Rt.geom_dict.items(): ...
Classe to define the geometric parameters
Geom_param
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Geom_param: """Classe to define the geometric parameters""" def setup(self): """Setup inputs only for the geometry""" <|body_0|> def compute(self, inputs, outputs): """Update the geometry of the CPACS""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_015485
20,064
permissive
[ { "docstring": "Setup inputs only for the geometry", "name": "setup", "signature": "def setup(self)" }, { "docstring": "Update the geometry of the CPACS", "name": "compute", "signature": "def compute(self, inputs, outputs)" } ]
2
stack_v2_sparse_classes_30k_train_016319
Implement the Python class `Geom_param` described below. Class description: Classe to define the geometric parameters Method signatures and docstrings: - def setup(self): Setup inputs only for the geometry - def compute(self, inputs, outputs): Update the geometry of the CPACS
Implement the Python class `Geom_param` described below. Class description: Classe to define the geometric parameters Method signatures and docstrings: - def setup(self): Setup inputs only for the geometry - def compute(self, inputs, outputs): Update the geometry of the CPACS <|skeleton|> class Geom_param: """Cl...
30ca55b39dc14e3f8ec1e00a475f76024d1b5fef
<|skeleton|> class Geom_param: """Classe to define the geometric parameters""" def setup(self): """Setup inputs only for the geometry""" <|body_0|> def compute(self, inputs, outputs): """Update the geometry of the CPACS""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Geom_param: """Classe to define the geometric parameters""" def setup(self): """Setup inputs only for the geometry""" for name, infos in Rt.geom_dict.items(): if name in Rt.optim_var_dict: self.add_input(name, val=infos[1][0]) def compute(self, inputs, out...
the_stack_v2_python_sparse
ceasiompy/Optimisation/optimisation.py
cfsengineering/CEASIOMpy
train
60
ade0794bd7115a03f1baeb1f68194f21993a5c25
[ "\"\"\"\n My first implementation of algorithm TLE(using two pointer to optimize it)!!!\n Time complexity: O(n^2)\n Space complexity: O(1)\n \"\"\"\nif not height or len(height) == 0:\n return 0\nres = 0\nfor i in range(len(height)):\n for j in range(len(height) - 1, i, -1):\n ...
<|body_start_0|> """ My first implementation of algorithm TLE(using two pointer to optimize it)!!! Time complexity: O(n^2) Space complexity: O(1) """ if not height or len(height) == 0: return 0 res = 0 for i in r...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxArea(self, height): """:type height: List[int] :rtype: int""" <|body_0|> def maxArea2(self, height): """Using two pointer to optimize algorithm!!! Good solution Time complexity: O(n) Space complexity: O(1)""" <|body_1|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_36k_train_015486
1,046
no_license
[ { "docstring": ":type height: List[int] :rtype: int", "name": "maxArea", "signature": "def maxArea(self, height)" }, { "docstring": "Using two pointer to optimize algorithm!!! Good solution Time complexity: O(n) Space complexity: O(1)", "name": "maxArea2", "signature": "def maxArea2(self...
2
stack_v2_sparse_classes_30k_train_015253
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxArea(self, height): :type height: List[int] :rtype: int - def maxArea2(self, height): Using two pointer to optimize algorithm!!! Good solution Time complexity: O(n) Space ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxArea(self, height): :type height: List[int] :rtype: int - def maxArea2(self, height): Using two pointer to optimize algorithm!!! Good solution Time complexity: O(n) Space ...
4960986edae561c1f9f32f3c97ce144f976d7844
<|skeleton|> class Solution: def maxArea(self, height): """:type height: List[int] :rtype: int""" <|body_0|> def maxArea2(self, height): """Using two pointer to optimize algorithm!!! Good solution Time complexity: O(n) Space complexity: O(1)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxArea(self, height): """:type height: List[int] :rtype: int""" """ My first implementation of algorithm TLE(using two pointer to optimize it)!!! Time complexity: O(n^2) Space complexity: O(1) """ if not hei...
the_stack_v2_python_sparse
two_pointer/11. Container With Most Water.py
AlexSchumi/Algorithms
train
0
5f7486ea44e0fdc3586570fe9e60b7dfff53a45f
[ "page = BaiduSearchPage(browser)\npage.search_input('pytest')\npage.search_button()\npage.sleep(1)\ntitle = page.search_title()\nassert title == 'pytest_百度搜索'", "page = BaiduSearchPage(browser)\npage.search_input(search_key)\npage.search_button()\npage.sleep(2)\ntitle = page.search_title()\nassert title == search...
<|body_start_0|> page = BaiduSearchPage(browser) page.search_input('pytest') page.search_button() page.sleep(1) title = page.search_title() assert title == 'pytest_百度搜索' <|end_body_0|> <|body_start_1|> page = BaiduSearchPage(browser) page.search_input(sea...
TestSearch
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestSearch: def test_baidu_search_case(self, browser): """百度搜索:pytest""" <|body_0|> def test_baidu_search(self, name, search_key, browser): """百度搜索 --参数化""" <|body_1|> <|end_skeleton|> <|body_start_0|> page = BaiduSearchPage(browser) page.se...
stack_v2_sparse_classes_36k_train_015487
1,494
no_license
[ { "docstring": "百度搜索:pytest", "name": "test_baidu_search_case", "signature": "def test_baidu_search_case(self, browser)" }, { "docstring": "百度搜索 --参数化", "name": "test_baidu_search", "signature": "def test_baidu_search(self, name, search_key, browser)" } ]
2
stack_v2_sparse_classes_30k_train_012763
Implement the Python class `TestSearch` described below. Class description: Implement the TestSearch class. Method signatures and docstrings: - def test_baidu_search_case(self, browser): 百度搜索:pytest - def test_baidu_search(self, name, search_key, browser): 百度搜索 --参数化
Implement the Python class `TestSearch` described below. Class description: Implement the TestSearch class. Method signatures and docstrings: - def test_baidu_search_case(self, browser): 百度搜索:pytest - def test_baidu_search(self, name, search_key, browser): 百度搜索 --参数化 <|skeleton|> class TestSearch: def test_baid...
b3a532d33ddeb8d01fff315bcd59b451befdef23
<|skeleton|> class TestSearch: def test_baidu_search_case(self, browser): """百度搜索:pytest""" <|body_0|> def test_baidu_search(self, name, search_key, browser): """百度搜索 --参数化""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestSearch: def test_baidu_search_case(self, browser): """百度搜索:pytest""" page = BaiduSearchPage(browser) page.search_input('pytest') page.search_button() page.sleep(1) title = page.search_title() assert title == 'pytest_百度搜索' def test_baidu_search(s...
the_stack_v2_python_sparse
pyautoTest-master(ICF-7.5.0)/test_case/1test_baidu_search.py
lizhuoya1111/Automated_testing_practice
train
0
f1dc1d67d71adc23dad91ea1ba96677645e59ab3
[ "log.debug('subscribe')\nself.callback = callback\nself.cargo = cargo\nself.service = service\naddr = '%s%s' % (service.url_base, service.event_sub_url)\nPaddr = parse_url(addr)\nheaders = {}\nheaders['User-agent'] = 'BRisa UPnP Framework'\nheaders['TIMEOUT'] = 'Second-300'\nheaders['NT'] = 'upnp:event'\nheaders['C...
<|body_start_0|> log.debug('subscribe') self.callback = callback self.cargo = cargo self.service = service addr = '%s%s' % (service.url_base, service.event_sub_url) Paddr = parse_url(addr) headers = {} headers['User-agent'] = 'BRisa UPnP Framework' ...
Wrapper for an event subscription.
SubscribeRequest
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubscribeRequest: """Wrapper for an event subscription.""" def __init__(self, service, event_host, callback, cargo): """Constructor for the SubscribeRequest class. @param service: service that is subscribing @param event_host: 2-tuple (host, port) of the event listener server @param ...
stack_v2_sparse_classes_36k_train_015488
17,901
permissive
[ { "docstring": "Constructor for the SubscribeRequest class. @param service: service that is subscribing @param event_host: 2-tuple (host, port) of the event listener server @param callback: callback @param cargo: callback parameters @type service: Service @type event_host: tuple @type callback: callable", "...
3
null
Implement the Python class `SubscribeRequest` described below. Class description: Wrapper for an event subscription. Method signatures and docstrings: - def __init__(self, service, event_host, callback, cargo): Constructor for the SubscribeRequest class. @param service: service that is subscribing @param event_host: ...
Implement the Python class `SubscribeRequest` described below. Class description: Wrapper for an event subscription. Method signatures and docstrings: - def __init__(self, service, event_host, callback, cargo): Constructor for the SubscribeRequest class. @param service: service that is subscribing @param event_host: ...
69f9c870369085f4440033201e2fb263a463a523
<|skeleton|> class SubscribeRequest: """Wrapper for an event subscription.""" def __init__(self, service, event_host, callback, cargo): """Constructor for the SubscribeRequest class. @param service: service that is subscribing @param event_host: 2-tuple (host, port) of the event listener server @param ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SubscribeRequest: """Wrapper for an event subscription.""" def __init__(self, service, event_host, callback, cargo): """Constructor for the SubscribeRequest class. @param service: service that is subscribing @param event_host: 2-tuple (host, port) of the event listener server @param callback: cal...
the_stack_v2_python_sparse
WebBrickLibs/brisa/upnp/control_point/service.py
AndyThirtover/wb_gateway
train
0
22cb82d2c92422aa89a0821898d63b60edc58920
[ "possibles = [set() for i in range(n)]\nfor i in range(n):\n a = i + 1\n for j in range(n):\n b = j + 1\n if a % b == 0 or b % a == 0:\n possibles[i].add(b)\npossibles.sort(key=lambda s: len(s))\n\ndef try_remove_from(possible: int, start: int):\n indexes = []\n for i in range(s...
<|body_start_0|> possibles = [set() for i in range(n)] for i in range(n): a = i + 1 for j in range(n): b = j + 1 if a % b == 0 or b % a == 0: possibles[i].add(b) possibles.sort(key=lambda s: len(s)) def try_remo...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countArrangement_1(self, n: int) -> int: """This looks like a back-tracking with pruning problem: - we have to try all combinations - we can abort prematuraly some prefix of solutions How de we know when to abort? - we just list the numbers that are valid at each position: ...
stack_v2_sparse_classes_36k_train_015489
3,168
no_license
[ { "docstring": "This looks like a back-tracking with pruning problem: - we have to try all combinations - we can abort prematuraly some prefix of solutions How de we know when to abort? - we just list the numbers that are valid at each position: initial phase in O(N ** 2) - we start with the indices with the le...
2
stack_v2_sparse_classes_30k_train_005800
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countArrangement_1(self, n: int) -> int: This looks like a back-tracking with pruning problem: - we have to try all combinations - we can abort prematuraly some prefix of sol...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countArrangement_1(self, n: int) -> int: This looks like a back-tracking with pruning problem: - we have to try all combinations - we can abort prematuraly some prefix of sol...
3ffcfee5cedf421d5de6d0dec4ba53b0eecbbff8
<|skeleton|> class Solution: def countArrangement_1(self, n: int) -> int: """This looks like a back-tracking with pruning problem: - we have to try all combinations - we can abort prematuraly some prefix of solutions How de we know when to abort? - we just list the numbers that are valid at each position: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def countArrangement_1(self, n: int) -> int: """This looks like a back-tracking with pruning problem: - we have to try all combinations - we can abort prematuraly some prefix of solutions How de we know when to abort? - we just list the numbers that are valid at each position: initial phase ...
the_stack_v2_python_sparse
backtrack/BeautifulArrangements.py
QuentinDuval/PythonExperiments
train
3
82f08ea102e9fdd8022048f6cca8fbabbf4324f3
[ "n = len(nums)\nif n == 0:\n return 0\ndp = [0] * n\ndp[0] = 1\nmax_len = 1\nfor i in range(1, n):\n max_val = 0\n for j in range(i):\n if nums[i] > nums[j]:\n max_val = max(max_val, dp[j])\n dp[i] = max_val + 1\n max_len = max(max_len, dp[i])\nreturn max_len", "n = len(nums)\nif ...
<|body_start_0|> n = len(nums) if n == 0: return 0 dp = [0] * n dp[0] = 1 max_len = 1 for i in range(1, n): max_val = 0 for j in range(i): if nums[i] > nums[j]: max_val = max(max_val, dp[j]) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lengthOfLIS(self, nums): """input| nums: List[int] output| int""" <|body_0|> def lengthOfLIS_bisec(self, nums): """input| nums: List[int] output| int""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(nums) if n == 0: ...
stack_v2_sparse_classes_36k_train_015490
1,740
no_license
[ { "docstring": "input| nums: List[int] output| int", "name": "lengthOfLIS", "signature": "def lengthOfLIS(self, nums)" }, { "docstring": "input| nums: List[int] output| int", "name": "lengthOfLIS_bisec", "signature": "def lengthOfLIS_bisec(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_006183
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLIS(self, nums): input| nums: List[int] output| int - def lengthOfLIS_bisec(self, nums): input| nums: List[int] output| int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLIS(self, nums): input| nums: List[int] output| int - def lengthOfLIS_bisec(self, nums): input| nums: List[int] output| int <|skeleton|> class Solution: def len...
8290ad1c763d9f7c7f7bed63426b4769b34fd2fc
<|skeleton|> class Solution: def lengthOfLIS(self, nums): """input| nums: List[int] output| int""" <|body_0|> def lengthOfLIS_bisec(self, nums): """input| nums: List[int] output| int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def lengthOfLIS(self, nums): """input| nums: List[int] output| int""" n = len(nums) if n == 0: return 0 dp = [0] * n dp[0] = 1 max_len = 1 for i in range(1, n): max_val = 0 for j in range(i): ...
the_stack_v2_python_sparse
dp_300_lengthOfLIS.py
screnary/Algorithm_python
train
0
f81931f2c6e14ce5f801ceaeeae8884a47883eeb
[ "flags.Instance().AddToParser(parser)\nflags.Config().AddToParser(parser)\nflags.Description().AddToParser(parser)\nresource_args.AddExpireBehaviorArg(parser)\nresource_args.AddInstanceTypeArg(parser)\ngroup_parser = parser.add_argument_group(mutex=True, required=False)\nflags.Nodes().AddToParser(group_parser)\nfla...
<|body_start_0|> flags.Instance().AddToParser(parser) flags.Config().AddToParser(parser) flags.Description().AddToParser(parser) resource_args.AddExpireBehaviorArg(parser) resource_args.AddInstanceTypeArg(parser) group_parser = parser.add_argument_group(mutex=True, requir...
Create a Cloud Spanner instance.
Create
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Create: """Create a Cloud Spanner instance.""" def Args(parser): """Args is called by calliope to gather arguments for this command. Please add arguments in alphabetical order except for no- or a clear- pair for that argument which can follow the argument itself. Args: parser: An arg...
stack_v2_sparse_classes_36k_train_015491
5,848
permissive
[ { "docstring": "Args is called by calliope to gather arguments for this command. Please add arguments in alphabetical order except for no- or a clear- pair for that argument which can follow the argument itself. Args: parser: An argparse parser that you can use to add arguments that go on the command line after...
2
stack_v2_sparse_classes_30k_train_018010
Implement the Python class `Create` described below. Class description: Create a Cloud Spanner instance. Method signatures and docstrings: - def Args(parser): Args is called by calliope to gather arguments for this command. Please add arguments in alphabetical order except for no- or a clear- pair for that argument w...
Implement the Python class `Create` described below. Class description: Create a Cloud Spanner instance. Method signatures and docstrings: - def Args(parser): Args is called by calliope to gather arguments for this command. Please add arguments in alphabetical order except for no- or a clear- pair for that argument w...
392abf004b16203030e6efd2f0af24db7c8d669e
<|skeleton|> class Create: """Create a Cloud Spanner instance.""" def Args(parser): """Args is called by calliope to gather arguments for this command. Please add arguments in alphabetical order except for no- or a clear- pair for that argument which can follow the argument itself. Args: parser: An arg...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Create: """Create a Cloud Spanner instance.""" def Args(parser): """Args is called by calliope to gather arguments for this command. Please add arguments in alphabetical order except for no- or a clear- pair for that argument which can follow the argument itself. Args: parser: An argparse parser ...
the_stack_v2_python_sparse
lib/surface/spanner/instances/create.py
google-cloud-sdk-unofficial/google-cloud-sdk
train
9
e316af4427639441ed2116da2deb81f2b19918eb
[ "data = self.get_json()\nname = data.get('galaxyName')\nif name is None:\n return self.error('galaxyName required to set object host')\nwith self.Session() as session:\n obj = session.scalars(Obj.select(session.user_or_token, mode='update').where(Obj.id == obj_id)).first()\n if obj is None:\n return...
<|body_start_0|> data = self.get_json() name = data.get('galaxyName') if name is None: return self.error('galaxyName required to set object host') with self.Session() as session: obj = session.scalars(Obj.select(session.user_or_token, mode='update').where(Obj.id =...
ObjHostHandler
[ "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObjHostHandler: def post(self, obj_id): """--- description: Set an object's host galaxy tags: - objs - galaxys parameters: - in: path name: obj_id required: true schema: type: string requestBody: content: application/json: schema: type: object properties: galaxyName: type: string descrip...
stack_v2_sparse_classes_36k_train_015492
41,985
permissive
[ { "docstring": "--- description: Set an object's host galaxy tags: - objs - galaxys parameters: - in: path name: obj_id required: true schema: type: string requestBody: content: application/json: schema: type: object properties: galaxyName: type: string description: | Name of the galaxy to associate with the ob...
2
stack_v2_sparse_classes_30k_train_018529
Implement the Python class `ObjHostHandler` described below. Class description: Implement the ObjHostHandler class. Method signatures and docstrings: - def post(self, obj_id): --- description: Set an object's host galaxy tags: - objs - galaxys parameters: - in: path name: obj_id required: true schema: type: string re...
Implement the Python class `ObjHostHandler` described below. Class description: Implement the ObjHostHandler class. Method signatures and docstrings: - def post(self, obj_id): --- description: Set an object's host galaxy tags: - objs - galaxys parameters: - in: path name: obj_id required: true schema: type: string re...
161d3532ba3ba059446addcdac58ca96f39e9636
<|skeleton|> class ObjHostHandler: def post(self, obj_id): """--- description: Set an object's host galaxy tags: - objs - galaxys parameters: - in: path name: obj_id required: true schema: type: string requestBody: content: application/json: schema: type: object properties: galaxyName: type: string descrip...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ObjHostHandler: def post(self, obj_id): """--- description: Set an object's host galaxy tags: - objs - galaxys parameters: - in: path name: obj_id required: true schema: type: string requestBody: content: application/json: schema: type: object properties: galaxyName: type: string description: | Name o...
the_stack_v2_python_sparse
skyportal/handlers/api/galaxy.py
skyportal/skyportal
train
80
34cef8b96047866cb54a7651d926dd3b0ec89221
[ "mce_attrs = {}\nif obj:\n link_list_url = self.get_link_list_url(request, field, obj)\n image_list_url = self.get_image_list_url(request, field, obj)\nelse:\n link_list_url = self.get_link_list_url(request, field)\n image_list_url = self.get_image_list_url(request, field)\nif link_list_url:\n mce_at...
<|body_start_0|> mce_attrs = {} if obj: link_list_url = self.get_link_list_url(request, field, obj) image_list_url = self.get_image_list_url(request, field, obj) else: link_list_url = self.get_link_list_url(request, field) image_list_url = self.get...
Example usage:: class BrandTranslationInline(TinyMCEAdminListMixin, TranslationInline): model = BrandTranslation tinymce_fields = ('description', ) def get_image_list_url(self, request, field, obj=None): if obj: return reverse('admin:basic_webshop_brand_image_list', args=(obj.pk, )) else: return None
TinyMCEAdminListMixin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TinyMCEAdminListMixin: """Example usage:: class BrandTranslationInline(TinyMCEAdminListMixin, TranslationInline): model = BrandTranslation tinymce_fields = ('description', ) def get_image_list_url(self, request, field, obj=None): if obj: return reverse('admin:basic_webshop_brand_image_list', args...
stack_v2_sparse_classes_36k_train_015493
5,965
no_license
[ { "docstring": "Return the appropriate TinyMCE widget.", "name": "get_tinymce_widget", "signature": "def get_tinymce_widget(self, request, field, obj)" }, { "docstring": "Override the form widget for the content field with a TinyMCE field which uses a dynamically assigned image list.", "name...
2
stack_v2_sparse_classes_30k_train_003672
Implement the Python class `TinyMCEAdminListMixin` described below. Class description: Example usage:: class BrandTranslationInline(TinyMCEAdminListMixin, TranslationInline): model = BrandTranslation tinymce_fields = ('description', ) def get_image_list_url(self, request, field, obj=None): if obj: return reverse('admi...
Implement the Python class `TinyMCEAdminListMixin` described below. Class description: Example usage:: class BrandTranslationInline(TinyMCEAdminListMixin, TranslationInline): model = BrandTranslation tinymce_fields = ('description', ) def get_image_list_url(self, request, field, obj=None): if obj: return reverse('admi...
618dee93539ecc4d1ff20aafb138ee85b4d6173b
<|skeleton|> class TinyMCEAdminListMixin: """Example usage:: class BrandTranslationInline(TinyMCEAdminListMixin, TranslationInline): model = BrandTranslation tinymce_fields = ('description', ) def get_image_list_url(self, request, field, obj=None): if obj: return reverse('admin:basic_webshop_brand_image_list', args...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TinyMCEAdminListMixin: """Example usage:: class BrandTranslationInline(TinyMCEAdminListMixin, TranslationInline): model = BrandTranslation tinymce_fields = ('description', ) def get_image_list_url(self, request, field, obj=None): if obj: return reverse('admin:basic_webshop_brand_image_list', args=(obj.pk, )) ...
the_stack_v2_python_sparse
basic_webshop/baseadmin.py
dokterbob/basic-webshop
train
1
ef756d1f328db913294797b1c75adf059262fb9c
[ "if not height:\n return 0\nmax_hgt = max(height)\nlength = len(height)\nresult = length * max_hgt\nleft = 0\nright = length - 1\nwhile height[left] < max_hgt:\n left += 1\nwhile height[right] < max_hgt:\n right -= 1\ncurr = 0\nlast = 0\nwhile curr < left:\n if height[curr] > last:\n last = heigh...
<|body_start_0|> if not height: return 0 max_hgt = max(height) length = len(height) result = length * max_hgt left = 0 right = length - 1 while height[left] < max_hgt: left += 1 while height[right] < max_hgt: right -= 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def trap_old(self, height): """:type height: List[int] :rtype: int""" <|body_0|> def trap(self, height): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not height: return 0 max...
stack_v2_sparse_classes_36k_train_015494
1,926
no_license
[ { "docstring": ":type height: List[int] :rtype: int", "name": "trap_old", "signature": "def trap_old(self, height)" }, { "docstring": ":type height: List[int] :rtype: int", "name": "trap", "signature": "def trap(self, height)" } ]
2
stack_v2_sparse_classes_30k_test_000096
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def trap_old(self, height): :type height: List[int] :rtype: int - def trap(self, height): :type height: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def trap_old(self, height): :type height: List[int] :rtype: int - def trap(self, height): :type height: List[int] :rtype: int <|skeleton|> class Solution: def trap_old(self...
dbdb227e12f329e4ca064b338f1fbdca42f3a848
<|skeleton|> class Solution: def trap_old(self, height): """:type height: List[int] :rtype: int""" <|body_0|> def trap(self, height): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def trap_old(self, height): """:type height: List[int] :rtype: int""" if not height: return 0 max_hgt = max(height) length = len(height) result = length * max_hgt left = 0 right = length - 1 while height[left] < max_hgt: ...
the_stack_v2_python_sparse
LC42.py
Qiao-Liang/LeetCode
train
0
33f01f6a41f63f4a22c9c3457d71ed2d44853e5e
[ "super(InTriggerDistanceToNextIntersection, self).__init__(name)\nself.logger.debug('%s.__init__()' % self.__class__.__name__)\nself._actor = actor\nself._distance = distance\nself._map = self._actor.get_world().get_map()\nwaypoint = self._map.get_waypoint(self._actor.get_location())\nwhile not waypoint.is_intersec...
<|body_start_0|> super(InTriggerDistanceToNextIntersection, self).__init__(name) self.logger.debug('%s.__init__()' % self.__class__.__name__) self._actor = actor self._distance = distance self._map = self._actor.get_world().get_map() waypoint = self._map.get_waypoint(self...
This class contains the trigger (condition) for a distance to the next intersection of a scenario
InTriggerDistanceToNextIntersection
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InTriggerDistanceToNextIntersection: """This class contains the trigger (condition) for a distance to the next intersection of a scenario""" def __init__(self, actor, distance, name='InTriggerDistanceToNextIntersection'): """Setup trigger distance""" <|body_0|> def updat...
stack_v2_sparse_classes_36k_train_015495
25,380
permissive
[ { "docstring": "Setup trigger distance", "name": "__init__", "signature": "def __init__(self, actor, distance, name='InTriggerDistanceToNextIntersection')" }, { "docstring": "Check if the actor is within trigger distance to the intersection", "name": "update", "signature": "def update(se...
2
stack_v2_sparse_classes_30k_train_009063
Implement the Python class `InTriggerDistanceToNextIntersection` described below. Class description: This class contains the trigger (condition) for a distance to the next intersection of a scenario Method signatures and docstrings: - def __init__(self, actor, distance, name='InTriggerDistanceToNextIntersection'): Se...
Implement the Python class `InTriggerDistanceToNextIntersection` described below. Class description: This class contains the trigger (condition) for a distance to the next intersection of a scenario Method signatures and docstrings: - def __init__(self, actor, distance, name='InTriggerDistanceToNextIntersection'): Se...
1d3e8339f8e60f7bdcaefeff49ec238b1746b047
<|skeleton|> class InTriggerDistanceToNextIntersection: """This class contains the trigger (condition) for a distance to the next intersection of a scenario""" def __init__(self, actor, distance, name='InTriggerDistanceToNextIntersection'): """Setup trigger distance""" <|body_0|> def updat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InTriggerDistanceToNextIntersection: """This class contains the trigger (condition) for a distance to the next intersection of a scenario""" def __init__(self, actor, distance, name='InTriggerDistanceToNextIntersection'): """Setup trigger distance""" super(InTriggerDistanceToNextIntersect...
the_stack_v2_python_sparse
srunner/scenariomanager/atomic_scenario_behavior.py
chauvinSimon/scenario_runner
train
2
4a0bab33da7154d9fe2820b3ab96d4e0b7380a68
[ "self.prot_attr = prot_attr\nself.estimator = estimator\nself.constraints = constraints\nself.constraint_weight = constraint_weight\nself.grid_size = grid_size\nself.grid_limit = grid_limit\nself.grid = grid\nself.drop_prot_attr = drop_prot_attr\nself.loss = loss\nself.min_val = min_val\nself.max_val = max_val", ...
<|body_start_0|> self.prot_attr = prot_attr self.estimator = estimator self.constraints = constraints self.constraint_weight = constraint_weight self.grid_size = grid_size self.grid_limit = grid_limit self.grid = grid self.drop_prot_attr = drop_prot_attr ...
Grid search reduction for fair classification or regression. Grid search is an in-processing technique that can be used for fair classification or fair regression. For classification it reduces fair classification to a sequence of cost-sensitive classification problems, returning the deterministic classifier with the l...
GridSearchReduction
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GridSearchReduction: """Grid search reduction for fair classification or regression. Grid search is an in-processing technique that can be used for fair classification or fair regression. For classification it reduces fair classification to a sequence of cost-sensitive classification problems, re...
stack_v2_sparse_classes_36k_train_015496
8,519
permissive
[ { "docstring": "Args: prot_attr: String or array-like column indices or column names of protected attributes. estimator: An estimator implementing methods ``fit(X, y, sample_weight)`` and ``predict(X)``, where ``X`` is the matrix of features, ``y`` is the vector of labels, and ``sample_weight`` is a vector of w...
4
stack_v2_sparse_classes_30k_train_011320
Implement the Python class `GridSearchReduction` described below. Class description: Grid search reduction for fair classification or regression. Grid search is an in-processing technique that can be used for fair classification or fair regression. For classification it reduces fair classification to a sequence of cos...
Implement the Python class `GridSearchReduction` described below. Class description: Grid search reduction for fair classification or regression. Grid search is an in-processing technique that can be used for fair classification or fair regression. For classification it reduces fair classification to a sequence of cos...
6f9972e4a7dbca2402f29b86ea67889143dbeb3e
<|skeleton|> class GridSearchReduction: """Grid search reduction for fair classification or regression. Grid search is an in-processing technique that can be used for fair classification or fair regression. For classification it reduces fair classification to a sequence of cost-sensitive classification problems, re...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GridSearchReduction: """Grid search reduction for fair classification or regression. Grid search is an in-processing technique that can be used for fair classification or fair regression. For classification it reduces fair classification to a sequence of cost-sensitive classification problems, returning the d...
the_stack_v2_python_sparse
aif360/sklearn/inprocessing/grid_search_reduction.py
Trusted-AI/AIF360
train
1,157
c8971923f727c82ba4b6f6429304d713cd340567
[ "self.vitesse = 75\nself.pin_enable = pin_enable\nself.pin_in_1 = pin_in_1\nself.pin_in_2 = pin_in_2\nGPIO.setup(self.pin_enable, GPIO.OUT)\nGPIO.setup(self.pin_in_1, GPIO.OUT)\nGPIO.setup(self.pin_in_2, GPIO.OUT)\nGPIO.output(self.pin_in_1, GPIO.LOW)\nGPIO.output(self.pin_in_2, GPIO.LOW)\nself.speed = GPIO.PWM(sel...
<|body_start_0|> self.vitesse = 75 self.pin_enable = pin_enable self.pin_in_1 = pin_in_1 self.pin_in_2 = pin_in_2 GPIO.setup(self.pin_enable, GPIO.OUT) GPIO.setup(self.pin_in_1, GPIO.OUT) GPIO.setup(self.pin_in_2, GPIO.OUT) GPIO.output(self.pin_in_1, GPIO....
classe de pilotage d'un moteur DC sur driver L298N
MotorDC
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MotorDC: """classe de pilotage d'un moteur DC sur driver L298N""" def __init__(self, pin_enable, pin_in_1, pin_in_2): """initialise les pins de pilotage du driver""" <|body_0|> def stop(self): """arrete le moteur""" <|body_1|> def forward(self): ...
stack_v2_sparse_classes_36k_train_015497
4,598
no_license
[ { "docstring": "initialise les pins de pilotage du driver", "name": "__init__", "signature": "def __init__(self, pin_enable, pin_in_1, pin_in_2)" }, { "docstring": "arrete le moteur", "name": "stop", "signature": "def stop(self)" }, { "docstring": "fait avancer le moteur", "n...
4
stack_v2_sparse_classes_30k_train_020121
Implement the Python class `MotorDC` described below. Class description: classe de pilotage d'un moteur DC sur driver L298N Method signatures and docstrings: - def __init__(self, pin_enable, pin_in_1, pin_in_2): initialise les pins de pilotage du driver - def stop(self): arrete le moteur - def forward(self): fait ava...
Implement the Python class `MotorDC` described below. Class description: classe de pilotage d'un moteur DC sur driver L298N Method signatures and docstrings: - def __init__(self, pin_enable, pin_in_1, pin_in_2): initialise les pins de pilotage du driver - def stop(self): arrete le moteur - def forward(self): fait ava...
b7641573580a50b8770c09f55f0de927b8d41055
<|skeleton|> class MotorDC: """classe de pilotage d'un moteur DC sur driver L298N""" def __init__(self, pin_enable, pin_in_1, pin_in_2): """initialise les pins de pilotage du driver""" <|body_0|> def stop(self): """arrete le moteur""" <|body_1|> def forward(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MotorDC: """classe de pilotage d'un moteur DC sur driver L298N""" def __init__(self, pin_enable, pin_in_1, pin_in_2): """initialise les pins de pilotage du driver""" self.vitesse = 75 self.pin_enable = pin_enable self.pin_in_1 = pin_in_1 self.pin_in_2 = pin_in_2 ...
the_stack_v2_python_sparse
poulailler-console/modules/porte_dc.py
lremy/poulailler-manager
train
0
5bb3a89ec388420e25a02d8d1915da64268be1b7
[ "result = self.valiant.get_package_metadata(package_name=self.argument('package'), package_version=self.argument('version'), repository_name=self.option('repository'))\nif not result:\n raise ValueError('Package details could not be loaded.')\nreturn Payload(metadata=result.package_metadata)", "if not data.met...
<|body_start_0|> result = self.valiant.get_package_metadata(package_name=self.argument('package'), package_version=self.argument('version'), repository_name=self.option('repository')) if not result: raise ValueError('Package details could not be loaded.') return Payload(metadata=resu...
Describes a package. show {package : The package name} {version : The package version} {--r|repository= : The repository to use}
ShowCommand
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShowCommand: """Describes a package. show {package : The package name} {version : The package version} {--r|repository= : The repository to use}""" def prepare_data(self) -> Payload: """Gets the package metadata. Returns: Package metadata Raises: ValueError: When the package data can...
stack_v2_sparse_classes_36k_train_015498
2,671
permissive
[ { "docstring": "Gets the package metadata. Returns: Package metadata Raises: ValueError: When the package data can't be loaded", "name": "prepare_data", "signature": "def prepare_data(self) -> Payload" }, { "docstring": "Prepares text representations. Args: data: A payload that must have the pac...
2
stack_v2_sparse_classes_30k_train_014643
Implement the Python class `ShowCommand` described below. Class description: Describes a package. show {package : The package name} {version : The package version} {--r|repository= : The repository to use} Method signatures and docstrings: - def prepare_data(self) -> Payload: Gets the package metadata. Returns: Packa...
Implement the Python class `ShowCommand` described below. Class description: Describes a package. show {package : The package name} {version : The package version} {--r|repository= : The repository to use} Method signatures and docstrings: - def prepare_data(self) -> Payload: Gets the package metadata. Returns: Packa...
786d417a7903d40e54136f645fdbe51575612902
<|skeleton|> class ShowCommand: """Describes a package. show {package : The package name} {version : The package version} {--r|repository= : The repository to use}""" def prepare_data(self) -> Payload: """Gets the package metadata. Returns: Package metadata Raises: ValueError: When the package data can...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ShowCommand: """Describes a package. show {package : The package name} {version : The package version} {--r|repository= : The repository to use}""" def prepare_data(self) -> Payload: """Gets the package metadata. Returns: Package metadata Raises: ValueError: When the package data can't be loaded"...
the_stack_v2_python_sparse
src/valiant/console/commands/show.py
pomes/valiant
train
4
63b74731f598e1fbf23429e4346645db97f8816e
[ "possible_words = list(set([w for w in ''.join(wordList)]))\nwordList = set(wordList)\nqueue = [(beginWord, 1)]\nvisited = set()\nwhile queue:\n word, step = queue.pop(0)\n if word == endWord:\n return step\n for i in range(len(word)):\n for p in possible_words:\n temp_word = word[...
<|body_start_0|> possible_words = list(set([w for w in ''.join(wordList)])) wordList = set(wordList) queue = [(beginWord, 1)] visited = set() while queue: word, step = queue.pop(0) if word == endWord: return step for i in range(...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def ladderLength(self, beginWord, endWord, wordList): """:type beginWord: str :type endWord: str :type wordList: List[str] :rtype: int""" <|body_0|> def lemonadeChange(self, bills): """:type bills: List[int] :rtype: bool""" <|body_1|> def findC...
stack_v2_sparse_classes_36k_train_015499
3,746
no_license
[ { "docstring": ":type beginWord: str :type endWord: str :type wordList: List[str] :rtype: int", "name": "ladderLength", "signature": "def ladderLength(self, beginWord, endWord, wordList)" }, { "docstring": ":type bills: List[int] :rtype: bool", "name": "lemonadeChange", "signature": "def...
6
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def ladderLength(self, beginWord, endWord, wordList): :type beginWord: str :type endWord: str :type wordList: List[str] :rtype: int - def lemonadeChange(self, bills): :type bills...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def ladderLength(self, beginWord, endWord, wordList): :type beginWord: str :type endWord: str :type wordList: List[str] :rtype: int - def lemonadeChange(self, bills): :type bills...
3b13b36f37eb364410b3b5b4f10a1808d8b1111e
<|skeleton|> class Solution: def ladderLength(self, beginWord, endWord, wordList): """:type beginWord: str :type endWord: str :type wordList: List[str] :rtype: int""" <|body_0|> def lemonadeChange(self, bills): """:type bills: List[int] :rtype: bool""" <|body_1|> def findC...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def ladderLength(self, beginWord, endWord, wordList): """:type beginWord: str :type endWord: str :type wordList: List[str] :rtype: int""" possible_words = list(set([w for w in ''.join(wordList)])) wordList = set(wordList) queue = [(beginWord, 1)] visited = set...
the_stack_v2_python_sparse
practice/20191101.py
yanggelinux/algorithm-data-structure
train
0