blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
378
8.64k
id
stringlengths
44
44
length_bytes
int64
505
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.88k
prompted_full_text
stringlengths
565
12.5k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
5.05k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
snapshot_total_rows
int64
75.8k
75.8k
solution
stringlengths
242
8.3k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
c12917949c5cb349cdd7d91554b4297b4bb23946
[ "if not date == None:\n date = '%sT%sZ' % (date, time)\nreturn date", "if not datetime == None and 'T' in datetime:\n datetime = datetime.split('T')[0]\nreturn datetime" ]
<|body_start_0|> if not date == None: date = '%sT%sZ' % (date, time) return date <|end_body_0|> <|body_start_1|> if not datetime == None and 'T' in datetime: datetime = datetime.split('T')[0] return datetime <|end_body_1|>
StringExtensions
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StringExtensions: def convertDateStrToDateTimeStr(date, time='00:00:00'): """Convert Date string (YYYY-MM-DD) to a datetime string by adding the desired time (YYYY-MM-DDTHH:mm:SSZ) Args: date: the date as a string to be converted time: the time as a string to be added to the date Returns...
stack_v2_sparse_classes_75kplus_train_006500
1,907
permissive
[ { "docstring": "Convert Date string (YYYY-MM-DD) to a datetime string by adding the desired time (YYYY-MM-DDTHH:mm:SSZ) Args: date: the date as a string to be converted time: the time as a string to be added to the date Returns: A string representation of a datetime in the following format YYYY-MM-DDTHH:mm:SSZ"...
2
stack_v2_sparse_classes_30k_train_031100
Implement the Python class `StringExtensions` described below. Class description: Implement the StringExtensions class. Method signatures and docstrings: - def convertDateStrToDateTimeStr(date, time='00:00:00'): Convert Date string (YYYY-MM-DD) to a datetime string by adding the desired time (YYYY-MM-DDTHH:mm:SSZ) Ar...
Implement the Python class `StringExtensions` described below. Class description: Implement the StringExtensions class. Method signatures and docstrings: - def convertDateStrToDateTimeStr(date, time='00:00:00'): Convert Date string (YYYY-MM-DD) to a datetime string by adding the desired time (YYYY-MM-DDTHH:mm:SSZ) Ar...
b596df09c52511e2e0c0987f6245aa4607190dd0
<|skeleton|> class StringExtensions: def convertDateStrToDateTimeStr(date, time='00:00:00'): """Convert Date string (YYYY-MM-DD) to a datetime string by adding the desired time (YYYY-MM-DDTHH:mm:SSZ) Args: date: the date as a string to be converted time: the time as a string to be added to the date Returns...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StringExtensions: def convertDateStrToDateTimeStr(date, time='00:00:00'): """Convert Date string (YYYY-MM-DD) to a datetime string by adding the desired time (YYYY-MM-DDTHH:mm:SSZ) Args: date: the date as a string to be converted time: the time as a string to be added to the date Returns: A string rep...
the_stack_v2_python_sparse
starthinker/task/traffic/class_extensions.py
google/starthinker
train
167
cd56e733ef5b7c29119fd0b11d7a53d602a2a9df
[ "print()\n_cred = {'username': input('Username: '), 'password': getpass.getpass('Password: '), 'cred_type': input('Credential Type: ')}\nmanage.add_device_cred(_cred)", "if len(manage.get_device_creds()) == 0:\n print('No device credentials stored.')\nelse:\n print()\n DeleteDeviceCred().cmdloop()\n p...
<|body_start_0|> print() _cred = {'username': input('Username: '), 'password': getpass.getpass('Password: '), 'cred_type': input('Credential Type: ')} manage.add_device_cred(_cred) <|end_body_0|> <|body_start_1|> if len(manage.get_device_creds()) == 0: print('No device crede...
ModifyDevice
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModifyDevice: def do_1(self, args): """Add a device credential to secure storage""" <|body_0|> def do_2(self, args): """Delete a credential""" <|body_1|> <|end_skeleton|> <|body_start_0|> print() _cred = {'username': input('Username: '), 'pa...
stack_v2_sparse_classes_75kplus_train_006501
3,458
no_license
[ { "docstring": "Add a device credential to secure storage", "name": "do_1", "signature": "def do_1(self, args)" }, { "docstring": "Delete a credential", "name": "do_2", "signature": "def do_2(self, args)" } ]
2
stack_v2_sparse_classes_30k_train_019579
Implement the Python class `ModifyDevice` described below. Class description: Implement the ModifyDevice class. Method signatures and docstrings: - def do_1(self, args): Add a device credential to secure storage - def do_2(self, args): Delete a credential
Implement the Python class `ModifyDevice` described below. Class description: Implement the ModifyDevice class. Method signatures and docstrings: - def do_1(self, args): Add a device credential to secure storage - def do_2(self, args): Delete a credential <|skeleton|> class ModifyDevice: def do_1(self, args): ...
a26ed281f72ea6f2f5e197684f540f65102024ee
<|skeleton|> class ModifyDevice: def do_1(self, args): """Add a device credential to secure storage""" <|body_0|> def do_2(self, args): """Delete a credential""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ModifyDevice: def do_1(self, args): """Add a device credential to secure storage""" print() _cred = {'username': input('Username: '), 'password': getpass.getpass('Password: '), 'cred_type': input('Credential Type: ')} manage.add_device_cred(_cred) def do_2(self, args): ...
the_stack_v2_python_sparse
netcrawl/credentials/menu.py
jhinckley/netcrawl
train
0
686077756fe8211cb66acc1786fae01a1d389c00
[ "self.graph = tf.Graph()\ngraph_def = None\nwith tf.gfile.GFile(FROZEN_GRAPH_NAME, 'rb') as f:\n print(FROZEN_GRAPH_NAME)\n graph_def = tf.GraphDef().FromString(f.read())\nif graph_def is None:\n raise RuntimeError('Cannot find inference graph in tar archive.')\nwith self.graph.as_default():\n tf.import...
<|body_start_0|> self.graph = tf.Graph() graph_def = None with tf.gfile.GFile(FROZEN_GRAPH_NAME, 'rb') as f: print(FROZEN_GRAPH_NAME) graph_def = tf.GraphDef().FromString(f.read()) if graph_def is None: raise RuntimeError('Cannot find inference graph i...
Class to load deeplab model and run inference.
SgmtModel
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SgmtModel: """Class to load deeplab model and run inference.""" def __init__(self): """Creates and loads pretrained deeplab model.""" <|body_0|> def run(self, image): """Runs inference on a single image. Args: image: A PIL.Image object, raw input image. Returns: ...
stack_v2_sparse_classes_75kplus_train_006502
2,761
permissive
[ { "docstring": "Creates and loads pretrained deeplab model.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Runs inference on a single image. Args: image: A PIL.Image object, raw input image. Returns: resized_image: RGB image resized from original input image. seg_map:...
2
null
Implement the Python class `SgmtModel` described below. Class description: Class to load deeplab model and run inference. Method signatures and docstrings: - def __init__(self): Creates and loads pretrained deeplab model. - def run(self, image): Runs inference on a single image. Args: image: A PIL.Image object, raw i...
Implement the Python class `SgmtModel` described below. Class description: Class to load deeplab model and run inference. Method signatures and docstrings: - def __init__(self): Creates and loads pretrained deeplab model. - def run(self, image): Runs inference on a single image. Args: image: A PIL.Image object, raw i...
fba29e142e3ef628c6b9b09cbb3b49cbc0828c8a
<|skeleton|> class SgmtModel: """Class to load deeplab model and run inference.""" def __init__(self): """Creates and loads pretrained deeplab model.""" <|body_0|> def run(self, image): """Runs inference on a single image. Args: image: A PIL.Image object, raw input image. Returns: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SgmtModel: """Class to load deeplab model and run inference.""" def __init__(self): """Creates and loads pretrained deeplab model.""" self.graph = tf.Graph() graph_def = None with tf.gfile.GFile(FROZEN_GRAPH_NAME, 'rb') as f: print(FROZEN_GRAPH_NAME) ...
the_stack_v2_python_sparse
workspace/seg/infer_utils/inference_gpu.py
huangxf14/models
train
0
3d70a69127c57de607b4d136373576ac5ddf0e2f
[ "bounds = {}\nfor c in self.chunks:\n bounds[c.chunk_idx[-1]] = c.chunk_size[-1]\nreturn bounds", "offsets = {}\no = 0\nfor c in self.chunks:\n for i, s in zip(c.chunk_idx, c.chunk_size):\n offsets[i] = o\n o += s\nreturn offsets" ]
<|body_start_0|> bounds = {} for c in self.chunks: bounds[c.chunk_idx[-1]] = c.chunk_size[-1] return bounds <|end_body_0|> <|body_start_1|> offsets = {} o = 0 for c in self.chunks: for i, s in zip(c.chunk_idx, c.chunk_size): offset...
ChunkInfo
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChunkInfo: def get_contig_chunk_boundary(self): """Get index in last chunk for each contig keyed by chunk index""" <|body_0|> def get_chunk_offset(self): """Get global offset for first row index in each chunk keyed by chunk index""" <|body_1|> <|end_skeleton...
stack_v2_sparse_classes_75kplus_train_006503
10,548
permissive
[ { "docstring": "Get index in last chunk for each contig keyed by chunk index", "name": "get_contig_chunk_boundary", "signature": "def get_contig_chunk_boundary(self)" }, { "docstring": "Get global offset for first row index in each chunk keyed by chunk index", "name": "get_chunk_offset", ...
2
stack_v2_sparse_classes_30k_train_041294
Implement the Python class `ChunkInfo` described below. Class description: Implement the ChunkInfo class. Method signatures and docstrings: - def get_contig_chunk_boundary(self): Get index in last chunk for each contig keyed by chunk index - def get_chunk_offset(self): Get global offset for first row index in each ch...
Implement the Python class `ChunkInfo` described below. Class description: Implement the ChunkInfo class. Method signatures and docstrings: - def get_contig_chunk_boundary(self): Get index in last chunk for each contig keyed by chunk index - def get_chunk_offset(self): Get global offset for first row index in each ch...
c3e8fbc3dff1d25109b01a62fc372555306ecbb3
<|skeleton|> class ChunkInfo: def get_contig_chunk_boundary(self): """Get index in last chunk for each contig keyed by chunk index""" <|body_0|> def get_chunk_offset(self): """Get global offset for first row index in each chunk keyed by chunk index""" <|body_1|> <|end_skeleton...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ChunkInfo: def get_contig_chunk_boundary(self): """Get index in last chunk for each contig keyed by chunk index""" bounds = {} for c in self.chunks: bounds[c.chunk_idx[-1]] = c.chunk_size[-1] return bounds def get_chunk_offset(self): """Get global offse...
the_stack_v2_python_sparse
src/python/gwas_analysis/method/pruning.py
related-sciences/gwas-analysis
train
23
8fec4badf95c2f7b4425935763445afdab6cfb5e
[ "if lazy_numer is None:\n self.lazy_numer = int(np.sqrt(points_number))\nelse:\n self.lazy_numer = lazy_numer\nsuper().__init__(points_number, neighborhood_radius, 1, dist_func_points, net_dist_to_lr, points_to_aprox, self.lazy_numer)\nself.lr = lr", "def dist_from_point(p):\n return self.dist_points(poi...
<|body_start_0|> if lazy_numer is None: self.lazy_numer = int(np.sqrt(points_number)) else: self.lazy_numer = lazy_numer super().__init__(points_number, neighborhood_radius, 1, dist_func_points, net_dist_to_lr, points_to_aprox, self.lazy_numer) self.lr = lr <|end_...
Implementation neuron gas
Neuron_gas
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Neuron_gas: """Implementation neuron gas""" def __init__(self, points_number, points_to_aprox, neighborhood_radius=2, net_dist_to_lr=GNF, dist_func_points=E_dist, lazy_numer=None, lr=0.2): """Args: points_number: number of points to approximate dinm_network: number of dimensions of n...
stack_v2_sparse_classes_75kplus_train_006504
2,811
no_license
[ { "docstring": "Args: points_number: number of points to approximate dinm_network: number of dimensions of network organization dist_func: callable object that takes two points of from points_to_aprox and returns distance between them net_dist_to_lr: callable object that takes poison of two neurons and returns ...
2
null
Implement the Python class `Neuron_gas` described below. Class description: Implementation neuron gas Method signatures and docstrings: - def __init__(self, points_number, points_to_aprox, neighborhood_radius=2, net_dist_to_lr=GNF, dist_func_points=E_dist, lazy_numer=None, lr=0.2): Args: points_number: number of poin...
Implement the Python class `Neuron_gas` described below. Class description: Implementation neuron gas Method signatures and docstrings: - def __init__(self, points_number, points_to_aprox, neighborhood_radius=2, net_dist_to_lr=GNF, dist_func_points=E_dist, lazy_numer=None, lr=0.2): Args: points_number: number of poin...
2609bf83e00e1d8773f127e10d9c140341397554
<|skeleton|> class Neuron_gas: """Implementation neuron gas""" def __init__(self, points_number, points_to_aprox, neighborhood_radius=2, net_dist_to_lr=GNF, dist_func_points=E_dist, lazy_numer=None, lr=0.2): """Args: points_number: number of points to approximate dinm_network: number of dimensions of n...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Neuron_gas: """Implementation neuron gas""" def __init__(self, points_number, points_to_aprox, neighborhood_radius=2, net_dist_to_lr=GNF, dist_func_points=E_dist, lazy_numer=None, lr=0.2): """Args: points_number: number of points to approximate dinm_network: number of dimensions of network organi...
the_stack_v2_python_sparse
Zadanie2/SOM/Neuron_gas.py
PatrykLisik/iad
train
0
7bc512d873d6e52dd5e690bb4b66510bbe69286a
[ "log.debug('setting up')\ncls.extractors = LyricsExtractor.extractors\nlog.info('loaded {} extractors'.format(len(cls.extractors)))", "log.info('extracting lyrics from url \"{}\"'.format(url))\nurl_data = UrlData(url)\nfor extractor in cls.extractors:\n if not extractor.can_handle(url_data):\n continue\...
<|body_start_0|> log.debug('setting up') cls.extractors = LyricsExtractor.extractors log.info('loaded {} extractors'.format(len(cls.extractors))) <|end_body_0|> <|body_start_1|> log.info('extracting lyrics from url "{}"'.format(url)) url_data = UrlData(url) for extractor...
Manage stuff.
LyricsManager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LyricsManager: """Manage stuff.""" def setup(cls): """Initialize class.""" <|body_0|> def extract_lyrics(cls, url: str, song: str, artist: str) -> Lyrics: """Extract lyrics from url.""" <|body_1|> def search_lyrics(cls, song: str, album: str, artist:...
stack_v2_sparse_classes_75kplus_train_006505
3,433
permissive
[ { "docstring": "Initialize class.", "name": "setup", "signature": "def setup(cls)" }, { "docstring": "Extract lyrics from url.", "name": "extract_lyrics", "signature": "def extract_lyrics(cls, url: str, song: str, artist: str) -> Lyrics" }, { "docstring": "Search the net for lyri...
3
stack_v2_sparse_classes_30k_train_039524
Implement the Python class `LyricsManager` described below. Class description: Manage stuff. Method signatures and docstrings: - def setup(cls): Initialize class. - def extract_lyrics(cls, url: str, song: str, artist: str) -> Lyrics: Extract lyrics from url. - def search_lyrics(cls, song: str, album: str, artist: str...
Implement the Python class `LyricsManager` described below. Class description: Manage stuff. Method signatures and docstrings: - def setup(cls): Initialize class. - def extract_lyrics(cls, url: str, song: str, artist: str) -> Lyrics: Extract lyrics from url. - def search_lyrics(cls, song: str, album: str, artist: str...
e8836c23b7b7e43661b59afd1bfc18d381b95d4a
<|skeleton|> class LyricsManager: """Manage stuff.""" def setup(cls): """Initialize class.""" <|body_0|> def extract_lyrics(cls, url: str, song: str, artist: str) -> Lyrics: """Extract lyrics from url.""" <|body_1|> def search_lyrics(cls, song: str, album: str, artist:...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LyricsManager: """Manage stuff.""" def setup(cls): """Initialize class.""" log.debug('setting up') cls.extractors = LyricsExtractor.extractors log.info('loaded {} extractors'.format(len(cls.extractors))) def extract_lyrics(cls, url: str, song: str, artist: str) -> Lyr...
the_stack_v2_python_sparse
wiki_music/external_libraries/lyricsfinder/lyrics.py
marian-code/wikipedia-music-tags
train
13
7e211fd2c0414dcfea889002ba45d2d8c6c78b07
[ "ret_data = []\nfunction_query = FunctionGenerator.extend()\nname = self.get_argument('name', None)\nif name is not None:\n function_query = function_query.filter(FunctionGenerator.name == name)\nfunction_query = function_query.order_by(FunctionGenerator.add_time.desc())\nfunctions = await self.application.objec...
<|body_start_0|> ret_data = [] function_query = FunctionGenerator.extend() name = self.get_argument('name', None) if name is not None: function_query = function_query.filter(FunctionGenerator.name == name) function_query = function_query.order_by(FunctionGenerator.add...
FunctionHandler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FunctionHandler: async def get(self, *args, **kwargs): """获取内置函数列表""" <|body_0|> async def post(self, *args, **kwargs): """增加内置函数数据""" <|body_1|> <|end_skeleton|> <|body_start_0|> ret_data = [] function_query = FunctionGenerator.extend() ...
stack_v2_sparse_classes_75kplus_train_006506
17,374
permissive
[ { "docstring": "获取内置函数列表", "name": "get", "signature": "async def get(self, *args, **kwargs)" }, { "docstring": "增加内置函数数据", "name": "post", "signature": "async def post(self, *args, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_025241
Implement the Python class `FunctionHandler` described below. Class description: Implement the FunctionHandler class. Method signatures and docstrings: - async def get(self, *args, **kwargs): 获取内置函数列表 - async def post(self, *args, **kwargs): 增加内置函数数据
Implement the Python class `FunctionHandler` described below. Class description: Implement the FunctionHandler class. Method signatures and docstrings: - async def get(self, *args, **kwargs): 获取内置函数列表 - async def post(self, *args, **kwargs): 增加内置函数数据 <|skeleton|> class FunctionHandler: async def get(self, *args...
dc9b4c55f0b3ace180c30b7f080eb5d88bb38fdb
<|skeleton|> class FunctionHandler: async def get(self, *args, **kwargs): """获取内置函数列表""" <|body_0|> async def post(self, *args, **kwargs): """增加内置函数数据""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FunctionHandler: async def get(self, *args, **kwargs): """获取内置函数列表""" ret_data = [] function_query = FunctionGenerator.extend() name = self.get_argument('name', None) if name is not None: function_query = function_query.filter(FunctionGenerator.name == name)...
the_stack_v2_python_sparse
apps/project/handlers.py
xiaoxiaolulu/MagicTestPlatform
train
5
8df120006538e72e8e7e248f5befec826cb4d276
[ "self.application_parameters = application_parameters\nself.excluded_disks = excluded_disks\nself.vm_credentials = vm_credentials", "if dictionary is None:\n return None\napplication_parameters = cohesity_management_sdk.models.application_parameters.ApplicationParameters.from_dictionary(dictionary.get('applica...
<|body_start_0|> self.application_parameters = application_parameters self.excluded_disks = excluded_disks self.vm_credentials = vm_credentials <|end_body_0|> <|body_start_1|> if dictionary is None: return None application_parameters = cohesity_management_sdk.models....
Implementation of the 'VmwareSpecialParameters' model. Specifies additional special settings applicable for a Protection Source of 'kVMware' type in a Protection Job. Attributes: application_parameters (ApplicationParameters): Specifies parameters that are related to applications running on the Protection Source. exclu...
VmwareSpecialParameters
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VmwareSpecialParameters: """Implementation of the 'VmwareSpecialParameters' model. Specifies additional special settings applicable for a Protection Source of 'kVMware' type in a Protection Job. Attributes: application_parameters (ApplicationParameters): Specifies parameters that are related to a...
stack_v2_sparse_classes_75kplus_train_006507
3,395
permissive
[ { "docstring": "Constructor for the VmwareSpecialParameters class", "name": "__init__", "signature": "def __init__(self, application_parameters=None, excluded_disks=None, vm_credentials=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A...
2
stack_v2_sparse_classes_30k_train_035191
Implement the Python class `VmwareSpecialParameters` described below. Class description: Implementation of the 'VmwareSpecialParameters' model. Specifies additional special settings applicable for a Protection Source of 'kVMware' type in a Protection Job. Attributes: application_parameters (ApplicationParameters): Spe...
Implement the Python class `VmwareSpecialParameters` described below. Class description: Implementation of the 'VmwareSpecialParameters' model. Specifies additional special settings applicable for a Protection Source of 'kVMware' type in a Protection Job. Attributes: application_parameters (ApplicationParameters): Spe...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class VmwareSpecialParameters: """Implementation of the 'VmwareSpecialParameters' model. Specifies additional special settings applicable for a Protection Source of 'kVMware' type in a Protection Job. Attributes: application_parameters (ApplicationParameters): Specifies parameters that are related to a...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VmwareSpecialParameters: """Implementation of the 'VmwareSpecialParameters' model. Specifies additional special settings applicable for a Protection Source of 'kVMware' type in a Protection Job. Attributes: application_parameters (ApplicationParameters): Specifies parameters that are related to applications r...
the_stack_v2_python_sparse
cohesity_management_sdk/models/vmware_special_parameters.py
cohesity/management-sdk-python
train
24
271a9b156211331a53efbf7d15818f3d1f9835e2
[ "Reference.__init__(self, reference_tokens)\nself.n = n\nself._reference_length = len(self._reference_tokens)\nself._reference_ngrams = self._get_ngrams(self._reference_tokens, self.n)", "n_grams = []\nfor n in range(1, max_n + 1):\n n_grams.append(defaultdict(int))\n for n_gram in zip(*[tokens[i:] for i in...
<|body_start_0|> Reference.__init__(self, reference_tokens) self.n = n self._reference_length = len(self._reference_tokens) self._reference_ngrams = self._get_ngrams(self._reference_tokens, self.n) <|end_body_0|> <|body_start_1|> n_grams = [] for n in range(1, max_n + 1)...
Smoothed sentence-level BLEU as as proposed by Lin and Och (2004). Implemented as described in (Chen and Cherry, 2014).
SentenceBleuReference
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SentenceBleuReference: """Smoothed sentence-level BLEU as as proposed by Lin and Och (2004). Implemented as described in (Chen and Cherry, 2014).""" def __init__(self, reference_tokens, n=4): """@param reference the reference translation that hypotheses shall be scored against. Must ...
stack_v2_sparse_classes_75kplus_train_006508
3,952
permissive
[ { "docstring": "@param reference the reference translation that hypotheses shall be scored against. Must be an iterable of tokens (any type). @param n maximum n-gram order to consider.", "name": "__init__", "signature": "def __init__(self, reference_tokens, n=4)" }, { "docstring": "Extracts all ...
3
stack_v2_sparse_classes_30k_train_032069
Implement the Python class `SentenceBleuReference` described below. Class description: Smoothed sentence-level BLEU as as proposed by Lin and Och (2004). Implemented as described in (Chen and Cherry, 2014). Method signatures and docstrings: - def __init__(self, reference_tokens, n=4): @param reference the reference t...
Implement the Python class `SentenceBleuReference` described below. Class description: Smoothed sentence-level BLEU as as proposed by Lin and Och (2004). Implemented as described in (Chen and Cherry, 2014). Method signatures and docstrings: - def __init__(self, reference_tokens, n=4): @param reference the reference t...
49d050863bc9644b8c0a9d9ab6e54ccd30f927dd
<|skeleton|> class SentenceBleuReference: """Smoothed sentence-level BLEU as as proposed by Lin and Och (2004). Implemented as described in (Chen and Cherry, 2014).""" def __init__(self, reference_tokens, n=4): """@param reference the reference translation that hypotheses shall be scored against. Must ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SentenceBleuReference: """Smoothed sentence-level BLEU as as proposed by Lin and Och (2004). Implemented as described in (Chen and Cherry, 2014).""" def __init__(self, reference_tokens, n=4): """@param reference the reference translation that hypotheses shall be scored against. Must be an iterabl...
the_stack_v2_python_sparse
nematus/metrics/sentence_bleu.py
EdinburghNLP/nematus
train
598
99f68a678806e1e4b77a8e876c5ff2e7165a1ac3
[ "if not data:\n return ''\nreturn data[0].upper() + data[1:]", "if not data:\n return ''\nreturn data[0].lower() + data[1:]", "isContains = False\nfor data in dataList:\n if data in srcStr:\n isContains = True\n break\nreturn isContains" ]
<|body_start_0|> if not data: return '' return data[0].upper() + data[1:] <|end_body_0|> <|body_start_1|> if not data: return '' return data[0].lower() + data[1:] <|end_body_1|> <|body_start_2|> isContains = False for data in dataList: ...
StrUtil
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StrUtil: def capitalize(data: str): """将字符串的首字母大写,其余字母大小写不变 :param data: data :return: value""" <|body_0|> def decapitalize(data: str): """将字符串的首字母小写,其余字母大小写不变 :param data: data :return: value""" <|body_1|> def containsStr(srcStr: str, dataList: []): ...
stack_v2_sparse_classes_75kplus_train_006509
1,488
permissive
[ { "docstring": "将字符串的首字母大写,其余字母大小写不变 :param data: data :return: value", "name": "capitalize", "signature": "def capitalize(data: str)" }, { "docstring": "将字符串的首字母小写,其余字母大小写不变 :param data: data :return: value", "name": "decapitalize", "signature": "def decapitalize(data: str)" }, { ...
3
stack_v2_sparse_classes_30k_test_001368
Implement the Python class `StrUtil` described below. Class description: Implement the StrUtil class. Method signatures and docstrings: - def capitalize(data: str): 将字符串的首字母大写,其余字母大小写不变 :param data: data :return: value - def decapitalize(data: str): 将字符串的首字母小写,其余字母大小写不变 :param data: data :return: value - def contains...
Implement the Python class `StrUtil` described below. Class description: Implement the StrUtil class. Method signatures and docstrings: - def capitalize(data: str): 将字符串的首字母大写,其余字母大小写不变 :param data: data :return: value - def decapitalize(data: str): 将字符串的首字母小写,其余字母大小写不变 :param data: data :return: value - def contains...
24cca5e9aaa56392200da48a1692201e2dfa25c8
<|skeleton|> class StrUtil: def capitalize(data: str): """将字符串的首字母大写,其余字母大小写不变 :param data: data :return: value""" <|body_0|> def decapitalize(data: str): """将字符串的首字母小写,其余字母大小写不变 :param data: data :return: value""" <|body_1|> def containsStr(srcStr: str, dataList: []): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StrUtil: def capitalize(data: str): """将字符串的首字母大写,其余字母大小写不变 :param data: data :return: value""" if not data: return '' return data[0].upper() + data[1:] def decapitalize(data: str): """将字符串的首字母小写,其余字母大小写不变 :param data: data :return: value""" if not data...
the_stack_v2_python_sparse
util/StrUtil.py
lkl22/CommonTools
train
2
55a8d31018ec74d8722fc0afe894a7a192e2d665
[ "audit = AuditResource.get_by_id(audit_uuid=audit_uuid, withContacts=False, withScans=False)\nif audit['submitted'] == True:\n abort(400, 'Already submitted')\nif audit['approved'] == True:\n abort(400, 'Already approved by administrator(s)')\nschema = AuditUpdateSchema(only=['submitted', 'rejected_reason'])\...
<|body_start_0|> audit = AuditResource.get_by_id(audit_uuid=audit_uuid, withContacts=False, withScans=False) if audit['submitted'] == True: abort(400, 'Already submitted') if audit['approved'] == True: abort(400, 'Already approved by administrator(s)') schema = Au...
AuditSubmission
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuditSubmission: def post(self, audit_uuid): """Submit the specified audit result""" <|body_0|> def delete(self, audit_uuid): """Withdraw the submission of the specified audit result""" <|body_1|> <|end_skeleton|> <|body_start_0|> audit = AuditResou...
stack_v2_sparse_classes_75kplus_train_006510
18,857
no_license
[ { "docstring": "Submit the specified audit result", "name": "post", "signature": "def post(self, audit_uuid)" }, { "docstring": "Withdraw the submission of the specified audit result", "name": "delete", "signature": "def delete(self, audit_uuid)" } ]
2
stack_v2_sparse_classes_30k_train_025930
Implement the Python class `AuditSubmission` described below. Class description: Implement the AuditSubmission class. Method signatures and docstrings: - def post(self, audit_uuid): Submit the specified audit result - def delete(self, audit_uuid): Withdraw the submission of the specified audit result
Implement the Python class `AuditSubmission` described below. Class description: Implement the AuditSubmission class. Method signatures and docstrings: - def post(self, audit_uuid): Submit the specified audit result - def delete(self, audit_uuid): Withdraw the submission of the specified audit result <|skeleton|> cl...
7b67aa682d73c8a8d7f0f19b2a90e69c40761c58
<|skeleton|> class AuditSubmission: def post(self, audit_uuid): """Submit the specified audit result""" <|body_0|> def delete(self, audit_uuid): """Withdraw the submission of the specified audit result""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AuditSubmission: def post(self, audit_uuid): """Submit the specified audit result""" audit = AuditResource.get_by_id(audit_uuid=audit_uuid, withContacts=False, withScans=False) if audit['submitted'] == True: abort(400, 'Already submitted') if audit['approved'] == Tr...
the_stack_v2_python_sparse
rem/apis/audit.py
recruit-tech/casval
train
6
44214eb762ef6d852b2e1ceef7aa03f16498991e
[ "update = np.random.random(size=(size,))\nshp = update[update <= heading_update_chance].shape\npersons[:, idx.x_dir][update <= heading_update_chance] = np.random.normal(loc=0, scale=1 / 3, size=shp)\nupdate = np.random.random(size=(size,))\nshp = update[update <= heading_update_chance].shape\npersons[:, idx.y_dir][...
<|body_start_0|> update = np.random.random(size=(size,)) shp = update[update <= heading_update_chance].shape persons[:, idx.x_dir][update <= heading_update_chance] = np.random.normal(loc=0, scale=1 / 3, size=shp) update = np.random.random(size=(size,)) shp = update[update <= head...
Class providing abstraction into each movement of the population
Movement
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Movement: """Class providing abstraction into each movement of the population""" def update_persons(self, persons: np.ndarray, size: int, speed: float=0.1, heading_update_chance: float=0.02) -> np.ndarray: """Randomly updates/initializes the destination each person is headed to and c...
stack_v2_sparse_classes_75kplus_train_006511
6,071
permissive
[ { "docstring": "Randomly updates/initializes the destination each person is headed to and corresponding speed randomly. Parameters ---------- person : np.ndarray The NumPy array containing the details of the persons to be updated. size : int The size of the array of the persons to be updated to. speed : float, ...
3
null
Implement the Python class `Movement` described below. Class description: Class providing abstraction into each movement of the population Method signatures and docstrings: - def update_persons(self, persons: np.ndarray, size: int, speed: float=0.1, heading_update_chance: float=0.02) -> np.ndarray: Randomly updates/i...
Implement the Python class `Movement` described below. Class description: Class providing abstraction into each movement of the population Method signatures and docstrings: - def update_persons(self, persons: np.ndarray, size: int, speed: float=0.1, heading_update_chance: float=0.02) -> np.ndarray: Randomly updates/i...
d07994136163918858773afc10c6651a03418adc
<|skeleton|> class Movement: """Class providing abstraction into each movement of the population""" def update_persons(self, persons: np.ndarray, size: int, speed: float=0.1, heading_update_chance: float=0.02) -> np.ndarray: """Randomly updates/initializes the destination each person is headed to and c...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Movement: """Class providing abstraction into each movement of the population""" def update_persons(self, persons: np.ndarray, size: int, speed: float=0.1, heading_update_chance: float=0.02) -> np.ndarray: """Randomly updates/initializes the destination each person is headed to and corresponding ...
the_stack_v2_python_sparse
src/movements.py
mnk400/viral-diseases-simulator
train
1
5ab8cb16aebe6f89bbcb22ab72f9a1e6c967bda0
[ "self.trie = Trie()\nfor sentence, time in zip(sentences, times):\n self.trie.update_sentence(sentence, time)\nself.cur_trie_node = self.trie.root\nself.prefix = []", "if c == '#':\n self.trie.update_sentence(self.prefix, 1)\n self.cur_trie_node = self.trie.root\n self.prefix = []\n return []\nelse...
<|body_start_0|> self.trie = Trie() for sentence, time in zip(sentences, times): self.trie.update_sentence(sentence, time) self.cur_trie_node = self.trie.root self.prefix = [] <|end_body_0|> <|body_start_1|> if c == '#': self.trie.update_sentence(self.pre...
AutocompleteSystem
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AutocompleteSystem: def __init__(self, sentences, times): """:type sentences: List[str] :type times: List[int]""" <|body_0|> def input(self, c): """:type c: str :rtype: List[str]""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.trie = Trie() ...
stack_v2_sparse_classes_75kplus_train_006512
2,164
permissive
[ { "docstring": ":type sentences: List[str] :type times: List[int]", "name": "__init__", "signature": "def __init__(self, sentences, times)" }, { "docstring": ":type c: str :rtype: List[str]", "name": "input", "signature": "def input(self, c)" } ]
2
null
Implement the Python class `AutocompleteSystem` described below. Class description: Implement the AutocompleteSystem class. Method signatures and docstrings: - def __init__(self, sentences, times): :type sentences: List[str] :type times: List[int] - def input(self, c): :type c: str :rtype: List[str]
Implement the Python class `AutocompleteSystem` described below. Class description: Implement the AutocompleteSystem class. Method signatures and docstrings: - def __init__(self, sentences, times): :type sentences: List[str] :type times: List[int] - def input(self, c): :type c: str :rtype: List[str] <|skeleton|> cla...
ba84c192fb9995dd48ddc6d81c3153488dd3c698
<|skeleton|> class AutocompleteSystem: def __init__(self, sentences, times): """:type sentences: List[str] :type times: List[int]""" <|body_0|> def input(self, c): """:type c: str :rtype: List[str]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AutocompleteSystem: def __init__(self, sentences, times): """:type sentences: List[str] :type times: List[int]""" self.trie = Trie() for sentence, time in zip(sentences, times): self.trie.update_sentence(sentence, time) self.cur_trie_node = self.trie.root se...
the_stack_v2_python_sparse
Python/design-search-autocomplete-system.py
phucle2411/LeetCode
train
0
777924f2d7a53dedcb1d6ba16df62fb98e77ae7a
[ "super().__init__(pred_name, target_name, filter_func=filter_func, use_sample_weights=use_sample_weights, sample_weight_name=sample_weight_name)\nself._class_names = class_names\nself.metric_func = metric_func", "results = {}\naucs_per_class = []\nif self._class_names is None:\n num_classes = self.collected_da...
<|body_start_0|> super().__init__(pred_name, target_name, filter_func=filter_func, use_sample_weights=use_sample_weights, sample_weight_name=sample_weight_name) self._class_names = class_names self.metric_func = metric_func <|end_body_0|> <|body_start_1|> results = {} aucs_per_c...
Applying a given metric function
FuseMetricDefault
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FuseMetricDefault: """Applying a given metric function""" def __init__(self, metric_func: Callable, pred_name: str, target_name: str, class_names: Optional[str]=None, filter_func: Optional[Callable]=None, use_sample_weights: Optional[bool]=False, sample_weight_name: Optional[str]=None) -> No...
stack_v2_sparse_classes_75kplus_train_006513
6,058
permissive
[ { "docstring": ":param metric_func: metric function. Will be applied for each class in a one-vs-rest manner. Gets as an input y_true (a boolean np.ndarray), y_score and sample_weight. :param pred_name: batch_dict key for predicted output (e.g., class probabilities after softmax) :param target_name: batch_dict k...
2
null
Implement the Python class `FuseMetricDefault` described below. Class description: Applying a given metric function Method signatures and docstrings: - def __init__(self, metric_func: Callable, pred_name: str, target_name: str, class_names: Optional[str]=None, filter_func: Optional[Callable]=None, use_sample_weights:...
Implement the Python class `FuseMetricDefault` described below. Class description: Applying a given metric function Method signatures and docstrings: - def __init__(self, metric_func: Callable, pred_name: str, target_name: str, class_names: Optional[str]=None, filter_func: Optional[Callable]=None, use_sample_weights:...
acbfd4975f18cd4361d31697faf2f82036399865
<|skeleton|> class FuseMetricDefault: """Applying a given metric function""" def __init__(self, metric_func: Callable, pred_name: str, target_name: str, class_names: Optional[str]=None, filter_func: Optional[Callable]=None, use_sample_weights: Optional[bool]=False, sample_weight_name: Optional[str]=None) -> No...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FuseMetricDefault: """Applying a given metric function""" def __init__(self, metric_func: Callable, pred_name: str, target_name: str, class_names: Optional[str]=None, filter_func: Optional[Callable]=None, use_sample_weights: Optional[bool]=False, sample_weight_name: Optional[str]=None) -> None: "...
the_stack_v2_python_sparse
fuse/metrics/classification/metric_default.py
rosenzvi/fuse-med-ml
train
0
278a2ac80920a9e32fd77b3c254e2bfe70710849
[ "assert type(n_bins) is int\nassert n_bins > 0\nassert isinstance(bin_boundaries_policy, BinBoundariesPolicy)\nsuper().__init__(n_bins=n_bins, bin_boundaries_policy=bin_boundaries_policy)", "if specific_scores is None:\n assert hasattr(model, 'predict_proba'), 'Model must implement the predict_proba method.'\n...
<|body_start_0|> assert type(n_bins) is int assert n_bins > 0 assert isinstance(bin_boundaries_policy, BinBoundariesPolicy) super().__init__(n_bins=n_bins, bin_boundaries_policy=bin_boundaries_policy) <|end_body_0|> <|body_start_1|> if specific_scores is None: assert...
SpecificClassBinningPolicy
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpecificClassBinningPolicy: def __init__(self, n_bins, bin_boundaries_policy): """Initializes a specific class binning policy, which sends samples into the n_bins bins created by the bin_boundaries_policy, based on the score the model gives for the class provided at runtime. Args: n_bins...
stack_v2_sparse_classes_75kplus_train_006514
6,913
permissive
[ { "docstring": "Initializes a specific class binning policy, which sends samples into the n_bins bins created by the bin_boundaries_policy, based on the score the model gives for the class provided at runtime. Args: n_bins: int, number of bins used to divide the interval. bin_boundaries_policy: BinBoundariesPol...
2
stack_v2_sparse_classes_30k_train_019090
Implement the Python class `SpecificClassBinningPolicy` described below. Class description: Implement the SpecificClassBinningPolicy class. Method signatures and docstrings: - def __init__(self, n_bins, bin_boundaries_policy): Initializes a specific class binning policy, which sends samples into the n_bins bins creat...
Implement the Python class `SpecificClassBinningPolicy` described below. Class description: Implement the SpecificClassBinningPolicy class. Method signatures and docstrings: - def __init__(self, n_bins, bin_boundaries_policy): Initializes a specific class binning policy, which sends samples into the n_bins bins creat...
9bfa81dd7a39ebe069c5b11b8e7a9bf9017e9350
<|skeleton|> class SpecificClassBinningPolicy: def __init__(self, n_bins, bin_boundaries_policy): """Initializes a specific class binning policy, which sends samples into the n_bins bins created by the bin_boundaries_policy, based on the score the model gives for the class provided at runtime. Args: n_bins...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SpecificClassBinningPolicy: def __init__(self, n_bins, bin_boundaries_policy): """Initializes a specific class binning policy, which sends samples into the n_bins bins created by the bin_boundaries_policy, based on the score the model gives for the class provided at runtime. Args: n_bins: int, number ...
the_stack_v2_python_sparse
explicalib/calibration/evaluation/prototype/binning/legacy.py
euranova/estimating_eces
train
4
f477fc0823af961884e87f5a90b3f8a698e20024
[ "super(RtuQuery, self).__init__()\nself._request_address = 0\nself._response_address = 0", "self._request_address = slave\nif self._request_address < 0 or self._request_address > 255:\n raise InvalidArgumentError('Invalid address {0}'.format(self._request_address))\ndata = struct.pack('>B', self._request_addre...
<|body_start_0|> super(RtuQuery, self).__init__() self._request_address = 0 self._response_address = 0 <|end_body_0|> <|body_start_1|> self._request_address = slave if self._request_address < 0 or self._request_address > 255: raise InvalidArgumentError('Invalid addre...
Subclass of a Query. Adds the Modbus RTU specific part of the protocol
RtuQuery
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RtuQuery: """Subclass of a Query. Adds the Modbus RTU specific part of the protocol""" def __init__(self): """Constructor""" <|body_0|> def build_request(self, pdu, slave): """Add the Modbus RTU part to the request""" <|body_1|> def parse_response(se...
stack_v2_sparse_classes_75kplus_train_006515
9,056
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Add the Modbus RTU part to the request", "name": "build_request", "signature": "def build_request(self, pdu, slave)" }, { "docstring": "Extract the pdu from the Modbus RTU respo...
5
stack_v2_sparse_classes_30k_train_024789
Implement the Python class `RtuQuery` described below. Class description: Subclass of a Query. Adds the Modbus RTU specific part of the protocol Method signatures and docstrings: - def __init__(self): Constructor - def build_request(self, pdu, slave): Add the Modbus RTU part to the request - def parse_response(self, ...
Implement the Python class `RtuQuery` described below. Class description: Subclass of a Query. Adds the Modbus RTU specific part of the protocol Method signatures and docstrings: - def __init__(self): Constructor - def build_request(self, pdu, slave): Add the Modbus RTU part to the request - def parse_response(self, ...
a5aeb1238b26c1af55cf3a82787ed347dff1fb86
<|skeleton|> class RtuQuery: """Subclass of a Query. Adds the Modbus RTU specific part of the protocol""" def __init__(self): """Constructor""" <|body_0|> def build_request(self, pdu, slave): """Add the Modbus RTU part to the request""" <|body_1|> def parse_response(se...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RtuQuery: """Subclass of a Query. Adds the Modbus RTU specific part of the protocol""" def __init__(self): """Constructor""" super(RtuQuery, self).__init__() self._request_address = 0 self._response_address = 0 def build_request(self, pdu, slave): """Add the M...
the_stack_v2_python_sparse
external/modbus_tk/modbus_tk/modbus_rtu.py
intel/intel-device-resource-mgt-lib
train
2
fdda61069f20db9251ada9d4cef33f36a90ca8a5
[ "super(Segmentation, self).__init__()\nself.word_segmentation = WordSegmentation(stop_words_file)\nself.sentence_segmentation = SentenceSegmentation(delimiters)", "sentences = self.sentence_segmentation.segment_text(text)\nwords_no_filter = self.word_segmentation.segment_sentences(sentences=sentences, lower=lower...
<|body_start_0|> super(Segmentation, self).__init__() self.word_segmentation = WordSegmentation(stop_words_file) self.sentence_segmentation = SentenceSegmentation(delimiters) <|end_body_0|> <|body_start_1|> sentences = self.sentence_segmentation.segment_text(text) words_no_filte...
分割器
Segmentation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Segmentation: """分割器""" def __init__(self, stop_words_file=None, delimiters='?!;?!。;…\n'): """函数功能: 默认构造函数 stop_words_file: 停止词文件 delimiters: 分隔符集合""" <|body_0|> def segment_text(self, text, lower=False, speech_tag_filter=True): """函数功能: 对text进行分割处理(分词/分句) text: ...
stack_v2_sparse_classes_75kplus_train_006516
6,042
no_license
[ { "docstring": "函数功能: 默认构造函数 stop_words_file: 停止词文件 delimiters: 分隔符集合", "name": "__init__", "signature": "def __init__(self, stop_words_file=None, delimiters='?!;?!。;…\\n')" }, { "docstring": "函数功能: 对text进行分割处理(分词/分句) text: 待处理文本 lower: 是否将英语单词转化为小写 speech_tag_filter: 词性过滤器", "name": "segmen...
2
stack_v2_sparse_classes_30k_train_041249
Implement the Python class `Segmentation` described below. Class description: 分割器 Method signatures and docstrings: - def __init__(self, stop_words_file=None, delimiters='?!;?!。;…\n'): 函数功能: 默认构造函数 stop_words_file: 停止词文件 delimiters: 分隔符集合 - def segment_text(self, text, lower=False, speech_tag_filter=True): 函数功能: 对tex...
Implement the Python class `Segmentation` described below. Class description: 分割器 Method signatures and docstrings: - def __init__(self, stop_words_file=None, delimiters='?!;?!。;…\n'): 函数功能: 默认构造函数 stop_words_file: 停止词文件 delimiters: 分隔符集合 - def segment_text(self, text, lower=False, speech_tag_filter=True): 函数功能: 对tex...
9855d6e69598f9cbf1652c3bcea27133a755c03c
<|skeleton|> class Segmentation: """分割器""" def __init__(self, stop_words_file=None, delimiters='?!;?!。;…\n'): """函数功能: 默认构造函数 stop_words_file: 停止词文件 delimiters: 分隔符集合""" <|body_0|> def segment_text(self, text, lower=False, speech_tag_filter=True): """函数功能: 对text进行分割处理(分词/分句) text: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Segmentation: """分割器""" def __init__(self, stop_words_file=None, delimiters='?!;?!。;…\n'): """函数功能: 默认构造函数 stop_words_file: 停止词文件 delimiters: 分隔符集合""" super(Segmentation, self).__init__() self.word_segmentation = WordSegmentation(stop_words_file) self.sentence_segmentation...
the_stack_v2_python_sparse
TextRank/Segmentation.py
xc15071347094/ASExtractor
train
0
0cf4d6fac4082cf456afc78b9cb480aa948d7f9b
[ "args = self.args\nif len(args.rsplit()) != 2:\n self.statname = None\n self.statvalue = None\n return\nstatname = args.rsplit()[0]\nstatvalue = args.rsplit()[1]\nself.statname = statname\nself.statvalue = statvalue", "allowed_statnames = self.caller.db.stats.keys()\nerrmsg1 = 'You must supply a stat ( %...
<|body_start_0|> args = self.args if len(args.rsplit()) != 2: self.statname = None self.statvalue = None return statname = args.rsplit()[0] statvalue = args.rsplit()[1] self.statname = statname self.statvalue = statvalue <|end_body_0|> ...
set a stat of a character Usage: +setstat (stat) (1-200) This sets the power of the current character. This can only be used during character generation.
CmdSetStat
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CmdSetStat: """set a stat of a character Usage: +setstat (stat) (1-200) This sets the power of the current character. This can only be used during character generation.""" def parse(self): """This parses the arguments""" <|body_0|> def func(self): """This perform...
stack_v2_sparse_classes_75kplus_train_006517
19,545
no_license
[ { "docstring": "This parses the arguments", "name": "parse", "signature": "def parse(self)" }, { "docstring": "This performs the actual command", "name": "func", "signature": "def func(self)" } ]
2
stack_v2_sparse_classes_30k_train_030549
Implement the Python class `CmdSetStat` described below. Class description: set a stat of a character Usage: +setstat (stat) (1-200) This sets the power of the current character. This can only be used during character generation. Method signatures and docstrings: - def parse(self): This parses the arguments - def fun...
Implement the Python class `CmdSetStat` described below. Class description: set a stat of a character Usage: +setstat (stat) (1-200) This sets the power of the current character. This can only be used during character generation. Method signatures and docstrings: - def parse(self): This parses the arguments - def fun...
66e9c2ab1570bc8f439cf6ccde872534eecb0d62
<|skeleton|> class CmdSetStat: """set a stat of a character Usage: +setstat (stat) (1-200) This sets the power of the current character. This can only be used during character generation.""" def parse(self): """This parses the arguments""" <|body_0|> def func(self): """This perform...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CmdSetStat: """set a stat of a character Usage: +setstat (stat) (1-200) This sets the power of the current character. This can only be used during character generation.""" def parse(self): """This parses the arguments""" args = self.args if len(args.rsplit()) != 2: sel...
the_stack_v2_python_sparse
commands/command.py
Cidusii/Kyatsu
train
0
6bb7b3ccbb8cea0dce1ed9533acb3f40220d1b9e
[ "self._config = {}\nfor key, value in kwargs.items():\n if key not in self.__dict__:\n self._config[key] = value\n else:\n raise ConfigException('Can\\'t store \"{0}\" in configuration because the key conflicts with an existing property.'.format(key))\nif 'path' not in self._config:\n self._c...
<|body_start_0|> self._config = {} for key, value in kwargs.items(): if key not in self.__dict__: self._config[key] = value else: raise ConfigException('Can\'t store "{0}" in configuration because the key conflicts with an existing property.'.forma...
The Config class handles all configuration for pokemontools. Other classes and functions use a Config object to determine where expected files can be located.
Config
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Config: """The Config class handles all configuration for pokemontools. Other classes and functions use a Config object to determine where expected files can be located.""" def __init__(self, **kwargs): """Store all parameters.""" <|body_0|> def __getattr__(self, key): ...
stack_v2_sparse_classes_75kplus_train_006518
1,717
permissive
[ { "docstring": "Store all parameters.", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "Grab the value from the class properties, then check the configuration, and raise an exception if nothing works.", "name": "__getattr__", "signature": "def __getattr...
2
stack_v2_sparse_classes_30k_train_042123
Implement the Python class `Config` described below. Class description: The Config class handles all configuration for pokemontools. Other classes and functions use a Config object to determine where expected files can be located. Method signatures and docstrings: - def __init__(self, **kwargs): Store all parameters....
Implement the Python class `Config` described below. Class description: The Config class handles all configuration for pokemontools. Other classes and functions use a Config object to determine where expected files can be located. Method signatures and docstrings: - def __init__(self, **kwargs): Store all parameters....
fc39e58b79e7805480e5b92bda2ad33e937423ff
<|skeleton|> class Config: """The Config class handles all configuration for pokemontools. Other classes and functions use a Config object to determine where expected files can be located.""" def __init__(self, **kwargs): """Store all parameters.""" <|body_0|> def __getattr__(self, key): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Config: """The Config class handles all configuration for pokemontools. Other classes and functions use a Config object to determine where expected files can be located.""" def __init__(self, **kwargs): """Store all parameters.""" self._config = {} for key, value in kwargs.items()...
the_stack_v2_python_sparse
extras/pokemontools/configuration.py
longlostsoul/EvoYellow
train
24
bb1b5efe7a199508d1ebd7dc4a7495686ec7bd0d
[ "self.key = []\nself.val = []\nself.capacity = capacity", "if key in self.key:\n idx = self.key.index(key)\n self.key.pop(idx)\n val = self.val.pop(idx)\n self.key.append(key)\n self.val.append(val)\n return val\nelse:\n return -1", "if key in self.key:\n idx = self.key.index(key)\n s...
<|body_start_0|> self.key = [] self.val = [] self.capacity = capacity <|end_body_0|> <|body_start_1|> if key in self.key: idx = self.key.index(key) self.key.pop(idx) val = self.val.pop(idx) self.key.append(key) self.val.append(...
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_75kplus_train_006519
1,281
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: None", "name": "pu...
3
stack_v2_sparse_classes_30k_train_003413
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: None
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: None <|sk...
d253f2bdc90348ad6ff0ea8f391fe3839f279879
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LRUCache: def __init__(self, capacity): """:type capacity: int""" self.key = [] self.val = [] self.capacity = capacity def get(self, key): """:type key: int :rtype: int""" if key in self.key: idx = self.key.index(key) self.key.pop(id...
the_stack_v2_python_sparse
字节跳动/5数据结构/2LRU缓存机制.py
eumeniders/LeetCode
train
1
afb7b9a422d5837e16624228215318bd8cf1cb83
[ "n = len(nums)\ni = 0\nj = 0\nwhile i < n:\n if nums[i] != 0:\n nums[i], nums[j] = (nums[j], nums[i])\n j += 1\n i += 1\nprint(nums)", "n = len(nums)\ncount = 0\nfor i in range(n):\n if nums[i] != 0:\n nums[count] = nums[i]\n count += 1\nfor j in range(count, n):\n nums[j] ...
<|body_start_0|> n = len(nums) i = 0 j = 0 while i < n: if nums[i] != 0: nums[i], nums[j] = (nums[j], nums[i]) j += 1 i += 1 print(nums) <|end_body_0|> <|body_start_1|> n = len(nums) count = 0 for i ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def move_zeroes(self, nums): """:type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead.""" <|body_0|> def move_zeroes2(self, nums): """:type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead."...
stack_v2_sparse_classes_75kplus_train_006520
1,304
no_license
[ { "docstring": ":type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead.", "name": "move_zeroes", "signature": "def move_zeroes(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead.", "name": "...
2
stack_v2_sparse_classes_30k_train_015050
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def move_zeroes(self, nums): :type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead. - def move_zeroes2(self, nums): :type nums: List[int] :rtype...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def move_zeroes(self, nums): :type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead. - def move_zeroes2(self, nums): :type nums: List[int] :rtype...
3b13b36f37eb364410b3b5b4f10a1808d8b1111e
<|skeleton|> class Solution: def move_zeroes(self, nums): """:type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead.""" <|body_0|> def move_zeroes2(self, nums): """:type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead."...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def move_zeroes(self, nums): """:type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead.""" n = len(nums) i = 0 j = 0 while i < n: if nums[i] != 0: nums[i], nums[j] = (nums[j], nums[i]) ...
the_stack_v2_python_sparse
leetcode/283.py
yanggelinux/algorithm-data-structure
train
0
dac925a2145fa34e8bd7ef71b271c2d78bc05f2c
[ "samples = len(y_pred)\ny_pred_clipped = np.clip(y_pred, 1e-07, 1 - 1e-07)\nif len(y_true.shape) == 1:\n correct_confidences = y_pred_clipped[range(samples), y_true]\nelif len(y_true.shape) == 2:\n correct_confidences = np.sum(y_pred_clipped * y_true, axis=1)\nnegative_log_likelihoods = -np.log(correct_confid...
<|body_start_0|> samples = len(y_pred) y_pred_clipped = np.clip(y_pred, 1e-07, 1 - 1e-07) if len(y_true.shape) == 1: correct_confidences = y_pred_clipped[range(samples), y_true] elif len(y_true.shape) == 2: correct_confidences = np.sum(y_pred_clipped * y_true, axi...
The class computes the categorical crossentropy by applying the formula: -sum(y_{i,j}*log(y_hat_{i,j})) Sources: * Neural Networks from Scratch - Harrison Kinsley & Daniel Kukieła [pg.112-116]
CategoricalCrossentropy
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CategoricalCrossentropy: """The class computes the categorical crossentropy by applying the formula: -sum(y_{i,j}*log(y_hat_{i,j})) Sources: * Neural Networks from Scratch - Harrison Kinsley & Daniel Kukieła [pg.112-116]""" def forward(self, y_pred, y_true): """Performs the forward p...
stack_v2_sparse_classes_75kplus_train_006521
2,192
no_license
[ { "docstring": "Performs the forward pass. Args : y_pred(np.array): Model predictions y_true(np.array): Actual values Sources: * Neural Networks from Scratch - Harrison Kinsley & Daniel Kukieła [pg.112-116]", "name": "forward", "signature": "def forward(self, y_pred, y_true)" }, { "docstring": "...
2
stack_v2_sparse_classes_30k_train_028957
Implement the Python class `CategoricalCrossentropy` described below. Class description: The class computes the categorical crossentropy by applying the formula: -sum(y_{i,j}*log(y_hat_{i,j})) Sources: * Neural Networks from Scratch - Harrison Kinsley & Daniel Kukieła [pg.112-116] Method signatures and docstrings: - ...
Implement the Python class `CategoricalCrossentropy` described below. Class description: The class computes the categorical crossentropy by applying the formula: -sum(y_{i,j}*log(y_hat_{i,j})) Sources: * Neural Networks from Scratch - Harrison Kinsley & Daniel Kukieła [pg.112-116] Method signatures and docstrings: - ...
8ffd24971d8808e7c9caa722a7ff4df306b75b90
<|skeleton|> class CategoricalCrossentropy: """The class computes the categorical crossentropy by applying the formula: -sum(y_{i,j}*log(y_hat_{i,j})) Sources: * Neural Networks from Scratch - Harrison Kinsley & Daniel Kukieła [pg.112-116]""" def forward(self, y_pred, y_true): """Performs the forward p...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CategoricalCrossentropy: """The class computes the categorical crossentropy by applying the formula: -sum(y_{i,j}*log(y_hat_{i,j})) Sources: * Neural Networks from Scratch - Harrison Kinsley & Daniel Kukieła [pg.112-116]""" def forward(self, y_pred, y_true): """Performs the forward pass. Args : y...
the_stack_v2_python_sparse
Music Recognizer/Metrics/CategoricalCrossentropy.py
andutzu7/Lucrare-Licenta-MusicRecognizer
train
0
dc9242ee420a6691b8c50ddae8286278cdeb2eab
[ "query = None\nif '-' in accession:\n accession = accession.split('-')[0]\ntry:\n service = Service('http://www.mousemine.org/mousemine/service')\n query = service.new_query('Gene')\n query.add_view('primaryIdentifier', 'ncbiGeneNumber', 'proteins.primaryAccession', 'symbol', 'proteins.synonyms.value', ...
<|body_start_0|> query = None if '-' in accession: accession = accession.split('-')[0] try: service = Service('http://www.mousemine.org/mousemine/service') query = service.new_query('Gene') query.add_view('primaryIdentifier', 'ncbiGeneNumber', 'pro...
IntermineTools
[ "LicenseRef-scancode-other-permissive" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IntermineTools: def mousemine_accession_lookup(accession, verbose=False): """Return an intermine query object for a given protien accession number. The query is design to find Entrez gene IDs for proetiens of a given accession number. It only considers the cannonical isoform of whole mou...
stack_v2_sparse_classes_75kplus_train_006522
9,507
permissive
[ { "docstring": "Return an intermine query object for a given protien accession number. The query is design to find Entrez gene IDs for proetiens of a given accession number. It only considers the cannonical isoform of whole mouse proteins(not fragments) presnt in the Swiss-Prot or TrEMBL databases. Parameters -...
5
stack_v2_sparse_classes_30k_train_018715
Implement the Python class `IntermineTools` described below. Class description: Implement the IntermineTools class. Method signatures and docstrings: - def mousemine_accession_lookup(accession, verbose=False): Return an intermine query object for a given protien accession number. The query is design to find Entrez ge...
Implement the Python class `IntermineTools` described below. Class description: Implement the IntermineTools class. Method signatures and docstrings: - def mousemine_accession_lookup(accession, verbose=False): Return an intermine query object for a given protien accession number. The query is design to find Entrez ge...
bedb36eafe681401c11d562f8d7117aad3d758d7
<|skeleton|> class IntermineTools: def mousemine_accession_lookup(accession, verbose=False): """Return an intermine query object for a given protien accession number. The query is design to find Entrez gene IDs for proetiens of a given accession number. It only considers the cannonical isoform of whole mou...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IntermineTools: def mousemine_accession_lookup(accession, verbose=False): """Return an intermine query object for a given protien accession number. The query is design to find Entrez gene IDs for proetiens of a given accession number. It only considers the cannonical isoform of whole mouse proteins(no...
the_stack_v2_python_sparse
omin/utils/network_tools.py
dmpio/omin
train
0
81cad55ae8195c696abe8e02a66ee833df38cfde
[ "rev = 0\nwhile x:\n pop = x % 10\n rev = rev * 10 + pop\n x //= 10\n if rev > 2147483647:\n return 0\nreturn rev", "if x >= 0:\n return self.reversed_positive(x)\nelse:\n return -self.reversed_positive(-x)", "x_l = list(str(x))\nx_l_r = []\nlead_string = x_l[0]\nwhile x_l:\n x_l_r.a...
<|body_start_0|> rev = 0 while x: pop = x % 10 rev = rev * 10 + pop x //= 10 if rev > 2147483647: return 0 return rev <|end_body_0|> <|body_start_1|> if x >= 0: return self.reversed_positive(x) else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reversed_positive(self, x): """方法1:用数学的方式解决,余数 及整除 的定义 :param x: 正整数 :return:""" <|body_0|> def reversed_all(self, x): """所有整数反转 :param x: :return:""" <|body_1|> def reverse(self, x): """方式2:借助列表进行末尾弹出,列表拼接、类型转换等方式反转数字 :type x: int ...
stack_v2_sparse_classes_75kplus_train_006523
1,527
no_license
[ { "docstring": "方法1:用数学的方式解决,余数 及整除 的定义 :param x: 正整数 :return:", "name": "reversed_positive", "signature": "def reversed_positive(self, x)" }, { "docstring": "所有整数反转 :param x: :return:", "name": "reversed_all", "signature": "def reversed_all(self, x)" }, { "docstring": "方式2:借助列表进...
3
stack_v2_sparse_classes_30k_train_010925
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reversed_positive(self, x): 方法1:用数学的方式解决,余数 及整除 的定义 :param x: 正整数 :return: - def reversed_all(self, x): 所有整数反转 :param x: :return: - def reverse(self, x): 方式2:借助列表进行末尾弹出,列表拼接、...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reversed_positive(self, x): 方法1:用数学的方式解决,余数 及整除 的定义 :param x: 正整数 :return: - def reversed_all(self, x): 所有整数反转 :param x: :return: - def reverse(self, x): 方式2:借助列表进行末尾弹出,列表拼接、...
9b55b49b468ff412c5d78773a03279bdc77a3874
<|skeleton|> class Solution: def reversed_positive(self, x): """方法1:用数学的方式解决,余数 及整除 的定义 :param x: 正整数 :return:""" <|body_0|> def reversed_all(self, x): """所有整数反转 :param x: :return:""" <|body_1|> def reverse(self, x): """方式2:借助列表进行末尾弹出,列表拼接、类型转换等方式反转数字 :type x: int ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def reversed_positive(self, x): """方法1:用数学的方式解决,余数 及整除 的定义 :param x: 正整数 :return:""" rev = 0 while x: pop = x % 10 rev = rev * 10 + pop x //= 10 if rev > 2147483647: return 0 return rev def reversed_...
the_stack_v2_python_sparse
online_programming/letecode_reverse.py
rowlingz/Deepen-learning-Python
train
0
c34b715f78860bf9fc9345651bfba7a221a13f65
[ "queryset = models.Book.objects.all().select_related()\nser_obj = BookSerializer(queryset, many=True)\nreturn Response(ser_obj.data)", "obj = request.data\nser_obj = BookSerializer(data=obj)\nprint(ser_obj)\nif not ser_obj.is_valid():\n return Response({'code': 1000, 'error_mes': ser_obj.errors})\nser_obj.save...
<|body_start_0|> queryset = models.Book.objects.all().select_related() ser_obj = BookSerializer(queryset, many=True) return Response(ser_obj.data) <|end_body_0|> <|body_start_1|> obj = request.data ser_obj = BookSerializer(data=obj) print(ser_obj) if not ser_obj....
BookView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BookView: def get(self, request): """获取所有""" <|body_0|> def post(self, request): """增加数据:反序列化""" <|body_1|> <|end_skeleton|> <|body_start_0|> queryset = models.Book.objects.all().select_related() ser_obj = BookSerializer(queryset, many=True)...
stack_v2_sparse_classes_75kplus_train_006524
3,287
no_license
[ { "docstring": "获取所有", "name": "get", "signature": "def get(self, request)" }, { "docstring": "增加数据:反序列化", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_020328
Implement the Python class `BookView` described below. Class description: Implement the BookView class. Method signatures and docstrings: - def get(self, request): 获取所有 - def post(self, request): 增加数据:反序列化
Implement the Python class `BookView` described below. Class description: Implement the BookView class. Method signatures and docstrings: - def get(self, request): 获取所有 - def post(self, request): 增加数据:反序列化 <|skeleton|> class BookView: def get(self, request): """获取所有""" <|body_0|> def post(s...
2d966d3e0ec0eebfb7882d807b806071aa1906f8
<|skeleton|> class BookView: def get(self, request): """获取所有""" <|body_0|> def post(self, request): """增加数据:反序列化""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BookView: def get(self, request): """获取所有""" queryset = models.Book.objects.all().select_related() ser_obj = BookSerializer(queryset, many=True) return Response(ser_obj.data) def post(self, request): """增加数据:反序列化""" obj = request.data ser_obj = Book...
the_stack_v2_python_sparse
django_pro_demo/demo_ModelSerializers/book_supermarket/views/books.py
MrHou999/study_django
train
0
b87107a2d5c8b0419c81300374fc8c8b4e8b8ab7
[ "self._login = login\nself._password = password\nself._cookie_jar = cookielib.CookieJar()\nself._url_opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(self._cookie_jar))", "data = {'login_username': self._login, 'login_password': self._password, 'login': '%C2%F5%EE%E4'}\nresp = self._url_opener.open('http...
<|body_start_0|> self._login = login self._password = password self._cookie_jar = cookielib.CookieJar() self._url_opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(self._cookie_jar)) <|end_body_0|> <|body_start_1|> data = {'login_username': self._login, 'login_password':...
Class RutrackerBrowser presents browser for RuTracker.Org. It allows logging in and getting .torrent files from RuTracker.Org.
RutrackerBrowser
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RutrackerBrowser: """Class RutrackerBrowser presents browser for RuTracker.Org. It allows logging in and getting .torrent files from RuTracker.Org.""" def __init__(self, login, password): """Initialises browser, stores RuTracker.Org's login and password. login - RuTracker.org login; ...
stack_v2_sparse_classes_75kplus_train_006525
3,694
permissive
[ { "docstring": "Initialises browser, stores RuTracker.Org's login and password. login - RuTracker.org login; password - RuTracker.org password.", "name": "__init__", "signature": "def __init__(self, login, password)" }, { "docstring": "Logs in RuTracker.Org. This method should be called before a...
5
stack_v2_sparse_classes_30k_train_025869
Implement the Python class `RutrackerBrowser` described below. Class description: Class RutrackerBrowser presents browser for RuTracker.Org. It allows logging in and getting .torrent files from RuTracker.Org. Method signatures and docstrings: - def __init__(self, login, password): Initialises browser, stores RuTracke...
Implement the Python class `RutrackerBrowser` described below. Class description: Class RutrackerBrowser presents browser for RuTracker.Org. It allows logging in and getting .torrent files from RuTracker.Org. Method signatures and docstrings: - def __init__(self, login, password): Initialises browser, stores RuTracke...
daff74bf96b2a7a13f94f6762305ac82c33edfe6
<|skeleton|> class RutrackerBrowser: """Class RutrackerBrowser presents browser for RuTracker.Org. It allows logging in and getting .torrent files from RuTracker.Org.""" def __init__(self, login, password): """Initialises browser, stores RuTracker.Org's login and password. login - RuTracker.org login; ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RutrackerBrowser: """Class RutrackerBrowser presents browser for RuTracker.Org. It allows logging in and getting .torrent files from RuTracker.Org.""" def __init__(self, login, password): """Initialises browser, stores RuTracker.Org's login and password. login - RuTracker.org login; password - Ru...
the_stack_v2_python_sparse
rt_browser.py
serejkus/rt_download_server
train
0
887722c706fc27b57dd15f1d1f4e5e8b05de78e4
[ "if not UpgradeCommand.check_mlf_core_latest():\n if mlf_core_questionary_or_dot_mlf_core(function='confirm', question='Do you want to upgrade?', default='y'):\n UpgradeCommand.upgrade_mlf_core()", "latest_local_version = mlf_core.__version__\nsliced_local_version = latest_local_version[:-9] if latest_l...
<|body_start_0|> if not UpgradeCommand.check_mlf_core_latest(): if mlf_core_questionary_or_dot_mlf_core(function='confirm', question='Do you want to upgrade?', default='y'): UpgradeCommand.upgrade_mlf_core() <|end_body_0|> <|body_start_1|> latest_local_version = mlf_core.__v...
Responsible for checking for newer versions mlf-core and upgrading it if required.
UpgradeCommand
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpgradeCommand: """Responsible for checking for newer versions mlf-core and upgrading it if required.""" def check_upgrade_mlf_core() -> None: """Checks whether the locally installed version of mlf-core is the latest. If not it prompts whether to upgrade and runs the upgrade command ...
stack_v2_sparse_classes_75kplus_train_006526
4,119
permissive
[ { "docstring": "Checks whether the locally installed version of mlf-core is the latest. If not it prompts whether to upgrade and runs the upgrade command if desired.", "name": "check_upgrade_mlf_core", "signature": "def check_upgrade_mlf_core() -> None" }, { "docstring": "Checks whether the loca...
4
stack_v2_sparse_classes_30k_train_013693
Implement the Python class `UpgradeCommand` described below. Class description: Responsible for checking for newer versions mlf-core and upgrading it if required. Method signatures and docstrings: - def check_upgrade_mlf_core() -> None: Checks whether the locally installed version of mlf-core is the latest. If not it...
Implement the Python class `UpgradeCommand` described below. Class description: Responsible for checking for newer versions mlf-core and upgrading it if required. Method signatures and docstrings: - def check_upgrade_mlf_core() -> None: Checks whether the locally installed version of mlf-core is the latest. If not it...
c997a20419b075b2860119b3a4cd06dc132ec704
<|skeleton|> class UpgradeCommand: """Responsible for checking for newer versions mlf-core and upgrading it if required.""" def check_upgrade_mlf_core() -> None: """Checks whether the locally installed version of mlf-core is the latest. If not it prompts whether to upgrade and runs the upgrade command ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UpgradeCommand: """Responsible for checking for newer versions mlf-core and upgrading it if required.""" def check_upgrade_mlf_core() -> None: """Checks whether the locally installed version of mlf-core is the latest. If not it prompts whether to upgrade and runs the upgrade command if desired.""...
the_stack_v2_python_sparse
mlf_core/upgrade/upgrade.py
ggabernet/mlf-core
train
0
1760b37375bb9216d067904813741986241a6d0f
[ "access_token = (yield self._token_cache.get_access_cache(self._token_cache.KEY_ACCESS_TOKEN))\nunion_id_url = WxConfig.get_union_id_url.format(ACCESS_TOKEN=access_token, OPENID=open_id)\nrequest_union_id = requests.get(union_id_url)\nres_info = json.loads(request_union_id.text, encoding='utf-8')\nunion_id = res_in...
<|body_start_0|> access_token = (yield self._token_cache.get_access_cache(self._token_cache.KEY_ACCESS_TOKEN)) union_id_url = WxConfig.get_union_id_url.format(ACCESS_TOKEN=access_token, OPENID=open_id) request_union_id = requests.get(union_id_url) res_info = json.loads(request_union_id.t...
分析该用户是否有机会领取奖励 0、是否有下载游戏注册账号 1、有机会就返回领取成功的字符串 2、没有机会的话返回没有机会的字符串
AnalysisChance
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnalysisChance: """分析该用户是否有机会领取奖励 0、是否有下载游戏注册账号 1、有机会就返回领取成功的字符串 2、没有机会的话返回没有机会的字符串""" def get_union_id(self, open_id): """根据open_id获取union_id :param open_id: :return:""" <|body_0|> def get_draw_status(self, open_id): """根据open_id返回需要返回的字符串 :param open_id: :retur...
stack_v2_sparse_classes_75kplus_train_006527
2,171
no_license
[ { "docstring": "根据open_id获取union_id :param open_id: :return:", "name": "get_union_id", "signature": "def get_union_id(self, open_id)" }, { "docstring": "根据open_id返回需要返回的字符串 :param open_id: :return:", "name": "get_draw_status", "signature": "def get_draw_status(self, open_id)" } ]
2
null
Implement the Python class `AnalysisChance` described below. Class description: 分析该用户是否有机会领取奖励 0、是否有下载游戏注册账号 1、有机会就返回领取成功的字符串 2、没有机会的话返回没有机会的字符串 Method signatures and docstrings: - def get_union_id(self, open_id): 根据open_id获取union_id :param open_id: :return: - def get_draw_status(self, open_id): 根据open_id返回需要返回的字符串 :...
Implement the Python class `AnalysisChance` described below. Class description: 分析该用户是否有机会领取奖励 0、是否有下载游戏注册账号 1、有机会就返回领取成功的字符串 2、没有机会的话返回没有机会的字符串 Method signatures and docstrings: - def get_union_id(self, open_id): 根据open_id获取union_id :param open_id: :return: - def get_draw_status(self, open_id): 根据open_id返回需要返回的字符串 :...
b4b60a33028ae1c638b8051304576f2b9e4630aa
<|skeleton|> class AnalysisChance: """分析该用户是否有机会领取奖励 0、是否有下载游戏注册账号 1、有机会就返回领取成功的字符串 2、没有机会的话返回没有机会的字符串""" def get_union_id(self, open_id): """根据open_id获取union_id :param open_id: :return:""" <|body_0|> def get_draw_status(self, open_id): """根据open_id返回需要返回的字符串 :param open_id: :retur...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AnalysisChance: """分析该用户是否有机会领取奖励 0、是否有下载游戏注册账号 1、有机会就返回领取成功的字符串 2、没有机会的话返回没有机会的字符串""" def get_union_id(self, open_id): """根据open_id获取union_id :param open_id: :return:""" access_token = (yield self._token_cache.get_access_cache(self._token_cache.KEY_ACCESS_TOKEN)) union_id_url = W...
the_stack_v2_python_sparse
prize_server/weixinback/core/server/analysis_chance.py
XTAYJGDUFVF/prize_server
train
0
61c14109b4ea67de36be535b4f96e9dfb61f50df
[ "if not email:\n raise ValueError('Введите e-mail')\nuser = self.model(email=self.normalize_email(email), username=username, first_name=first_name, last_name=last_name, confirm_email=False, is_active=True)\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user", "user = self.create_user(email=sel...
<|body_start_0|> if not email: raise ValueError('Введите e-mail') user = self.model(email=self.normalize_email(email), username=username, first_name=first_name, last_name=last_name, confirm_email=False, is_active=True) user.set_password(password) user.save(using=self._db) ...
Account manager.
MyAccountManager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyAccountManager: """Account manager.""" def create_user(self, first_name, last_name, email, username, password=None): """Creates and saves a new user.""" <|body_0|> def create_superuser(self, first_name, last_name, email, username, password): """Creates and save...
stack_v2_sparse_classes_75kplus_train_006528
3,931
permissive
[ { "docstring": "Creates and saves a new user.", "name": "create_user", "signature": "def create_user(self, first_name, last_name, email, username, password=None)" }, { "docstring": "Creates and saves a new super user.", "name": "create_superuser", "signature": "def create_superuser(self,...
2
stack_v2_sparse_classes_30k_test_000098
Implement the Python class `MyAccountManager` described below. Class description: Account manager. Method signatures and docstrings: - def create_user(self, first_name, last_name, email, username, password=None): Creates and saves a new user. - def create_superuser(self, first_name, last_name, email, username, passwo...
Implement the Python class `MyAccountManager` described below. Class description: Account manager. Method signatures and docstrings: - def create_user(self, first_name, last_name, email, username, password=None): Creates and saves a new user. - def create_superuser(self, first_name, last_name, email, username, passwo...
cbb16fc9ab2b85232e4c05446697fc82b78bc8e4
<|skeleton|> class MyAccountManager: """Account manager.""" def create_user(self, first_name, last_name, email, username, password=None): """Creates and saves a new user.""" <|body_0|> def create_superuser(self, first_name, last_name, email, username, password): """Creates and save...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MyAccountManager: """Account manager.""" def create_user(self, first_name, last_name, email, username, password=None): """Creates and saves a new user.""" if not email: raise ValueError('Введите e-mail') user = self.model(email=self.normalize_email(email), username=use...
the_stack_v2_python_sparse
shop/accounts/models.py
Anych/mila-iris
train
0
9f7b4254b82c1a94563110e2219e74d3feea60fc
[ "with self.OutputCapturer() as output:\n try:\n mps.main(['--help'])\n except exceptions.SystemExit as e:\n self.assertEquals(e.args[0], 0)\nstdout = output.GetStdout()\nself.assertTrue(stdout.startswith('usage: '), msg='Expected output starting with \"usage: \" but got:\\n%s' % stdout)", "wit...
<|body_start_0|> with self.OutputCapturer() as output: try: mps.main(['--help']) except exceptions.SystemExit as e: self.assertEquals(e.args[0], 0) stdout = output.GetStdout() self.assertTrue(stdout.startswith('usage: '), msg='Expected outp...
Test argument handling at the main method level.
MainTest
[ "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0", "BSD-3-Clause", "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MainTest: """Test argument handling at the main method level.""" def testHelp(self): """Test that --help is functioning""" <|body_0|> def testMissingOut(self): """Test that running without --out exits with an error.""" <|body_1|> def testMissingPacka...
stack_v2_sparse_classes_75kplus_train_006529
10,044
permissive
[ { "docstring": "Test that --help is functioning", "name": "testHelp", "signature": "def testHelp(self)" }, { "docstring": "Test that running without --out exits with an error.", "name": "testMissingOut", "signature": "def testMissingOut(self)" }, { "docstring": "Test that running...
4
stack_v2_sparse_classes_30k_train_019550
Implement the Python class `MainTest` described below. Class description: Test argument handling at the main method level. Method signatures and docstrings: - def testHelp(self): Test that --help is functioning - def testMissingOut(self): Test that running without --out exits with an error. - def testMissingPackage(s...
Implement the Python class `MainTest` described below. Class description: Test argument handling at the main method level. Method signatures and docstrings: - def testHelp(self): Test that --help is functioning - def testMissingOut(self): Test that running without --out exits with an error. - def testMissingPackage(s...
72a05af97787001756bae2511b7985e61498c965
<|skeleton|> class MainTest: """Test argument handling at the main method level.""" def testHelp(self): """Test that --help is functioning""" <|body_0|> def testMissingOut(self): """Test that running without --out exits with an error.""" <|body_1|> def testMissingPacka...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MainTest: """Test argument handling at the main method level.""" def testHelp(self): """Test that --help is functioning""" with self.OutputCapturer() as output: try: mps.main(['--help']) except exceptions.SystemExit as e: self.assert...
the_stack_v2_python_sparse
third_party/chromite/scripts/merge_package_status_unittest.py
metux/chromium-suckless
train
5
a9e701612e5995fd00dc97402f11a91f807cb47f
[ "with open(relation_file, 'r') as f:\n self.tweet_relations = f.read().split('\\n\\n')\nself.get_patterns()", "for idx, tweet in enumerate(self.tweet_relations):\n tweet_info = tweet.split('\\n')\n self.tweets.append(tweet_info[0])\n for relation in tweet_info[1:]:\n triple = relation.split(' '...
<|body_start_0|> with open(relation_file, 'r') as f: self.tweet_relations = f.read().split('\n\n') self.get_patterns() <|end_body_0|> <|body_start_1|> for idx, tweet in enumerate(self.tweet_relations): tweet_info = tweet.split('\n') self.tweets.append(tweet_i...
Processes OpenIE outputs - Converts triples to format that can be matched to predefined emotion-cause patterns - Includes preprocessing steps of adding POS tags and emotion values
TweetLoader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TweetLoader: """Processes OpenIE outputs - Converts triples to format that can be matched to predefined emotion-cause patterns - Includes preprocessing steps of adding POS tags and emotion values""" def __init__(self, relation_file): """Initialize the class by splitting the OpenIE fi...
stack_v2_sparse_classes_75kplus_train_006530
1,443
no_license
[ { "docstring": "Initialize the class by splitting the OpenIE file into tweet descriptor sections :param relation_file: the OpenIE output file with relations extracted from tweets", "name": "__init__", "signature": "def __init__(self, relation_file)" }, { "docstring": "Filter the output relations...
2
stack_v2_sparse_classes_30k_train_035462
Implement the Python class `TweetLoader` described below. Class description: Processes OpenIE outputs - Converts triples to format that can be matched to predefined emotion-cause patterns - Includes preprocessing steps of adding POS tags and emotion values Method signatures and docstrings: - def __init__(self, relati...
Implement the Python class `TweetLoader` described below. Class description: Processes OpenIE outputs - Converts triples to format that can be matched to predefined emotion-cause patterns - Includes preprocessing steps of adding POS tags and emotion values Method signatures and docstrings: - def __init__(self, relati...
1da8f7fb76cb9f193d3c262b07434f32caeefc09
<|skeleton|> class TweetLoader: """Processes OpenIE outputs - Converts triples to format that can be matched to predefined emotion-cause patterns - Includes preprocessing steps of adding POS tags and emotion values""" def __init__(self, relation_file): """Initialize the class by splitting the OpenIE fi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TweetLoader: """Processes OpenIE outputs - Converts triples to format that can be matched to predefined emotion-cause patterns - Includes preprocessing steps of adding POS tags and emotion values""" def __init__(self, relation_file): """Initialize the class by splitting the OpenIE file into tweet...
the_stack_v2_python_sparse
src/baseline/openie_tweet_loader.py
jmcanal/BECR
train
2
c06338d6b6a14da71922a2d8cee026b5113044b7
[ "if cosmo_type is None:\n self._Ddt_sampling = False\nelif cosmo_type == 'D_dt':\n self._Ddt_sampling = True\nelse:\n raise ValueError('cosmo_type %s is not supported!' % cosmo_type)\nself._cosmo_type = cosmo_type\nself._mass_scaling = mass_scaling\nself._num_scale_factor = num_scale_factor\nself._kwargs_f...
<|body_start_0|> if cosmo_type is None: self._Ddt_sampling = False elif cosmo_type == 'D_dt': self._Ddt_sampling = True else: raise ValueError('cosmo_type %s is not supported!' % cosmo_type) self._cosmo_type = cosmo_type self._mass_scaling = ma...
class that handles the cosmology relevant parameters
CosmoParam
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CosmoParam: """class that handles the cosmology relevant parameters""" def __init__(self, cosmo_type=None, mass_scaling=False, kwargs_fixed={}, num_scale_factor=1, kwargs_lower=None, kwargs_upper=None): """:param sampling: bool, if True, activates time-delay parameters :param D_dt_in...
stack_v2_sparse_classes_75kplus_train_006531
3,602
permissive
[ { "docstring": ":param sampling: bool, if True, activates time-delay parameters :param D_dt_init: initial guess of time-delay distance (Mpc) :param D_dt_sigma: initial uncertainty :param D_dt_lower: lower bound :param D_dt_upper: upper bound", "name": "__init__", "signature": "def __init__(self, cosmo_t...
4
stack_v2_sparse_classes_30k_train_008255
Implement the Python class `CosmoParam` described below. Class description: class that handles the cosmology relevant parameters Method signatures and docstrings: - def __init__(self, cosmo_type=None, mass_scaling=False, kwargs_fixed={}, num_scale_factor=1, kwargs_lower=None, kwargs_upper=None): :param sampling: bool...
Implement the Python class `CosmoParam` described below. Class description: class that handles the cosmology relevant parameters Method signatures and docstrings: - def __init__(self, cosmo_type=None, mass_scaling=False, kwargs_fixed={}, num_scale_factor=1, kwargs_lower=None, kwargs_upper=None): :param sampling: bool...
dcdfc61ce5351ac94565228c822f1c94392c1ad6
<|skeleton|> class CosmoParam: """class that handles the cosmology relevant parameters""" def __init__(self, cosmo_type=None, mass_scaling=False, kwargs_fixed={}, num_scale_factor=1, kwargs_lower=None, kwargs_upper=None): """:param sampling: bool, if True, activates time-delay parameters :param D_dt_in...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CosmoParam: """class that handles the cosmology relevant parameters""" def __init__(self, cosmo_type=None, mass_scaling=False, kwargs_fixed={}, num_scale_factor=1, kwargs_lower=None, kwargs_upper=None): """:param sampling: bool, if True, activates time-delay parameters :param D_dt_init: initial g...
the_stack_v2_python_sparse
lenstronomy/Cosmo/cosmo_param.py
guoxiaowhu/lenstronomy
train
1
1fd59927edeb1148d8581c6963d53c9ff3fed20a
[ "apply_patch(self.request, save=False, src=self.request.validated['tender_src'])\nif all([i.auctionPeriod and i.auctionPeriod.endDate for i in self.request.validated['tender'].lots if i.numberOfBids > 1 and i.status == 'active']):\n add_next_award(self.request)\nif save_tender(self.request):\n self.LOGGER.inf...
<|body_start_0|> apply_patch(self.request, save=False, src=self.request.validated['tender_src']) if all([i.auctionPeriod and i.auctionPeriod.endDate for i in self.request.validated['tender'].lots if i.numberOfBids > 1 and i.status == 'active']): add_next_award(self.request) if save_t...
TenderUaAuctionResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TenderUaAuctionResource: def collection_post(self): """Report auction results.""" <|body_0|> def post(self): """Report auction results for lot.""" <|body_1|> <|end_skeleton|> <|body_start_0|> apply_patch(self.request, save=False, src=self.request.va...
stack_v2_sparse_classes_75kplus_train_006532
2,504
permissive
[ { "docstring": "Report auction results.", "name": "collection_post", "signature": "def collection_post(self)" }, { "docstring": "Report auction results for lot.", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_045776
Implement the Python class `TenderUaAuctionResource` described below. Class description: Implement the TenderUaAuctionResource class. Method signatures and docstrings: - def collection_post(self): Report auction results. - def post(self): Report auction results for lot.
Implement the Python class `TenderUaAuctionResource` described below. Class description: Implement the TenderUaAuctionResource class. Method signatures and docstrings: - def collection_post(self): Report auction results. - def post(self): Report auction results for lot. <|skeleton|> class TenderUaAuctionResource: ...
5afdd3a62a8e562cf77e2d963d88f1a26613d16a
<|skeleton|> class TenderUaAuctionResource: def collection_post(self): """Report auction results.""" <|body_0|> def post(self): """Report auction results for lot.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TenderUaAuctionResource: def collection_post(self): """Report auction results.""" apply_patch(self.request, save=False, src=self.request.validated['tender_src']) if all([i.auctionPeriod and i.auctionPeriod.endDate for i in self.request.validated['tender'].lots if i.numberOfBids > 1 and...
the_stack_v2_python_sparse
src/openprocurement/tender/openuadefense/views/auction.py
pontostroy/api
train
0
916717d3f914b851dbae07a840fffb8989f31084
[ "result = super(StockPicking, self)._action_done()\nfor picking in self:\n if picking.sale_id.invoice_status == 'invoiced':\n continue\n order = picking.sale_id\n work_flow_process_record = order and order.auto_workflow_process_id\n delivery_lines = picking.move_line_ids.filtered(lambda l: l.prod...
<|body_start_0|> result = super(StockPicking, self)._action_done() for picking in self: if picking.sale_id.invoice_status == 'invoiced': continue order = picking.sale_id work_flow_process_record = order and order.auto_workflow_process_id de...
StockPicking
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StockPicking: def _action_done(self): """Added comment by Udit create and paid invoice on the basis of auto invoice work flow when invoicing policy is 'delivery'.""" <|body_0|> def send_to_shipper(self): """usage: If auto_processed_orders_ept = True passed in Context...
stack_v2_sparse_classes_75kplus_train_006533
1,518
no_license
[ { "docstring": "Added comment by Udit create and paid invoice on the basis of auto invoice work flow when invoicing policy is 'delivery'.", "name": "_action_done", "signature": "def _action_done(self)" }, { "docstring": "usage: If auto_processed_orders_ept = True passed in Context then we can no...
2
null
Implement the Python class `StockPicking` described below. Class description: Implement the StockPicking class. Method signatures and docstrings: - def _action_done(self): Added comment by Udit create and paid invoice on the basis of auto invoice work flow when invoicing policy is 'delivery'. - def send_to_shipper(se...
Implement the Python class `StockPicking` described below. Class description: Implement the StockPicking class. Method signatures and docstrings: - def _action_done(self): Added comment by Udit create and paid invoice on the basis of auto invoice work flow when invoicing policy is 'delivery'. - def send_to_shipper(se...
6b64f0dfbeae0610605de9321d736f6f09768bb3
<|skeleton|> class StockPicking: def _action_done(self): """Added comment by Udit create and paid invoice on the basis of auto invoice work flow when invoicing policy is 'delivery'.""" <|body_0|> def send_to_shipper(self): """usage: If auto_processed_orders_ept = True passed in Context...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StockPicking: def _action_done(self): """Added comment by Udit create and paid invoice on the basis of auto invoice work flow when invoicing policy is 'delivery'.""" result = super(StockPicking, self)._action_done() for picking in self: if picking.sale_id.invoice_status == ...
the_stack_v2_python_sparse
common_connector_library/models/stock_picking.py
marandagroup/sh_v14_addons
train
0
4a457293ce1f4ac991c3af30f11fa96b5b5c56d1
[ "bundle = sorted(((val, i) for i, val in enumerate(nums)))\nfor i in xrange(len(bundle)):\n j = i + 1\n while j < len(bundle) and bundle[j][0] - bundle[i][0] <= t:\n if abs(bundle[i][1] - bundle[j][1]) <= k:\n return True\n j += 1\nreturn False", "if t < 0:\n return False\nbucket...
<|body_start_0|> bundle = sorted(((val, i) for i, val in enumerate(nums))) for i in xrange(len(bundle)): j = i + 1 while j < len(bundle) and bundle[j][0] - bundle[i][0] <= t: if abs(bundle[i][1] - bundle[j][1]) <= k: return True ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def containsNearbyAlmostDuplicate(self, nums, k, t): """Bacially the solution is brutal force. The array can be sorted by the value, using tuple to bind the value and index together to preserve information. Then the loop will stop when value diff is larger than t. Sorting will ...
stack_v2_sparse_classes_75kplus_train_006534
2,672
no_license
[ { "docstring": "Bacially the solution is brutal force. The array can be sorted by the value, using tuple to bind the value and index together to preserve information. Then the loop will stop when value diff is larger than t. Sorting will help in terms of reducing time complexity but the big O is same as without...
2
stack_v2_sparse_classes_30k_train_017680
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsNearbyAlmostDuplicate(self, nums, k, t): Bacially the solution is brutal force. The array can be sorted by the value, using tuple to bind the value and index together...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsNearbyAlmostDuplicate(self, nums, k, t): Bacially the solution is brutal force. The array can be sorted by the value, using tuple to bind the value and index together...
33c623f226981942780751554f0593f2c71cf458
<|skeleton|> class Solution: def containsNearbyAlmostDuplicate(self, nums, k, t): """Bacially the solution is brutal force. The array can be sorted by the value, using tuple to bind the value and index together to preserve information. Then the loop will stop when value diff is larger than t. Sorting will ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def containsNearbyAlmostDuplicate(self, nums, k, t): """Bacially the solution is brutal force. The array can be sorted by the value, using tuple to bind the value and index together to preserve information. Then the loop will stop when value diff is larger than t. Sorting will help in terms ...
the_stack_v2_python_sparse
arr/leetcode_Contains_Duplicate_III.py
monkeylyf/interviewjam
train
59
ca5b86fc5ad32d750086aaac8187f3b9f12bc8a3
[ "if len(args) >= 2 and isinstance(args[0], str):\n value = args[1]\n for key in reversed(args[0].split('.')):\n value = {key: value}\n self.data = value\nelse:\n super().__init__(*args, **kwargs)", "for k, v in other.items():\n if isinstance(v, collections.abc.Mapping):\n self[k] = WD...
<|body_start_0|> if len(args) >= 2 and isinstance(args[0], str): value = args[1] for key in reversed(args[0].split('.')): value = {key: value} self.data = value else: super().__init__(*args, **kwargs) <|end_body_0|> <|body_start_1|> ...
WDict
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WDict: def __init__(self, *args, **kwargs): """permet d'initialiser un dict sous forme nested WDict("aaa.bbb.ccc", 2) => {"aaa":{"bbb":{"ccc":2}}}""" <|body_0|> def update(self, other): """Recursively update nested dict :param other: some Mapping :return: self, updat...
stack_v2_sparse_classes_75kplus_train_006535
6,173
no_license
[ { "docstring": "permet d'initialiser un dict sous forme nested WDict(\"aaa.bbb.ccc\", 2) => {\"aaa\":{\"bbb\":{\"ccc\":2}}}", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Recursively update nested dict :param other: some Mapping :return: self, updated...
2
stack_v2_sparse_classes_30k_train_011964
Implement the Python class `WDict` described below. Class description: Implement the WDict class. Method signatures and docstrings: - def __init__(self, *args, **kwargs): permet d'initialiser un dict sous forme nested WDict("aaa.bbb.ccc", 2) => {"aaa":{"bbb":{"ccc":2}}} - def update(self, other): Recursively update n...
Implement the Python class `WDict` described below. Class description: Implement the WDict class. Method signatures and docstrings: - def __init__(self, *args, **kwargs): permet d'initialiser un dict sous forme nested WDict("aaa.bbb.ccc", 2) => {"aaa":{"bbb":{"ccc":2}}} - def update(self, other): Recursively update n...
8bd37e89cff02cf0366ef66d30d7ebab38205759
<|skeleton|> class WDict: def __init__(self, *args, **kwargs): """permet d'initialiser un dict sous forme nested WDict("aaa.bbb.ccc", 2) => {"aaa":{"bbb":{"ccc":2}}}""" <|body_0|> def update(self, other): """Recursively update nested dict :param other: some Mapping :return: self, updat...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WDict: def __init__(self, *args, **kwargs): """permet d'initialiser un dict sous forme nested WDict("aaa.bbb.ccc", 2) => {"aaa":{"bbb":{"ccc":2}}}""" if len(args) >= 2 and isinstance(args[0], str): value = args[1] for key in reversed(args[0].split('.')): ...
the_stack_v2_python_sparse
src/mycartable/utils.py
jgirardet/MyCartable
train
3
e9ee9f9afcb5ec4266e57963e3065a2b9d2cf24e
[ "self.encode_type = hyper_parameters['model'].get('encode_type', 'MAX')\nself.n_win = hyper_parameters['model'].get('n_win', 3)\nsuper().__init__(hyper_parameters)", "super().create_model(hyper_parameters)\nembedding = self.word_embedding.output\n\ndef win_mean(x):\n res_list = []\n for i in range(self.len_...
<|body_start_0|> self.encode_type = hyper_parameters['model'].get('encode_type', 'MAX') self.n_win = hyper_parameters['model'].get('n_win', 3) super().__init__(hyper_parameters) <|end_body_0|> <|body_start_1|> super().create_model(hyper_parameters) embedding = self.word_embeddin...
SWEMGraph
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SWEMGraph: def __init__(self, hyper_parameters): """初始化 :param hyper_parameters: json,超参""" <|body_0|> def create_model(self, hyper_parameters): """构建神经网络 :param hyper_parameters:json, hyper parameters of network :return: tensor, moedl""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_75kplus_train_006536
2,341
permissive
[ { "docstring": "初始化 :param hyper_parameters: json,超参", "name": "__init__", "signature": "def __init__(self, hyper_parameters)" }, { "docstring": "构建神经网络 :param hyper_parameters:json, hyper parameters of network :return: tensor, moedl", "name": "create_model", "signature": "def create_mod...
2
stack_v2_sparse_classes_30k_train_046572
Implement the Python class `SWEMGraph` described below. Class description: Implement the SWEMGraph class. Method signatures and docstrings: - def __init__(self, hyper_parameters): 初始化 :param hyper_parameters: json,超参 - def create_model(self, hyper_parameters): 构建神经网络 :param hyper_parameters:json, hyper parameters of ...
Implement the Python class `SWEMGraph` described below. Class description: Implement the SWEMGraph class. Method signatures and docstrings: - def __init__(self, hyper_parameters): 初始化 :param hyper_parameters: json,超参 - def create_model(self, hyper_parameters): 构建神经网络 :param hyper_parameters:json, hyper parameters of ...
640e3f44f90d9d8046546f7e1a93a29ebe5c8d30
<|skeleton|> class SWEMGraph: def __init__(self, hyper_parameters): """初始化 :param hyper_parameters: json,超参""" <|body_0|> def create_model(self, hyper_parameters): """构建神经网络 :param hyper_parameters:json, hyper parameters of network :return: tensor, moedl""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SWEMGraph: def __init__(self, hyper_parameters): """初始化 :param hyper_parameters: json,超参""" self.encode_type = hyper_parameters['model'].get('encode_type', 'MAX') self.n_win = hyper_parameters['model'].get('n_win', 3) super().__init__(hyper_parameters) def create_model(sel...
the_stack_v2_python_sparse
keras_textclassification/m15_SWEM/graph.py
wzjames/Keras-TextClassification
train
1
7264f7018531a0b39d2eefdcc4aec3aa42e1b040
[ "super(AttentionEncoder, self).__init__()\nself.lookup = nn.Embedding(vocab_size, emb_size)\nif pretrained_emb is None:\n xavier_uniform(self.lookup.weight.data)\nelse:\n assert pretrained_emb.size() == (vocab_size, emb_size), 'Word embedding matrix has incorrect size: {} instead of {}'.format(w_emb.size(), (...
<|body_start_0|> super(AttentionEncoder, self).__init__() self.lookup = nn.Embedding(vocab_size, emb_size) if pretrained_emb is None: xavier_uniform(self.lookup.weight.data) else: assert pretrained_emb.size() == (vocab_size, emb_size), 'Word embedding matrix has i...
Segment encoder that produces segment vectors as the weighted average of word embeddings.
AttentionEncoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AttentionEncoder: """Segment encoder that produces segment vectors as the weighted average of word embeddings.""" def __init__(self, vocab_size, emb_size, bias=True, M=None, b=None, pretrained_emb=None, fix_w_emb=False): """Initializes the encoder using a [vocab_size x emb_size] embe...
stack_v2_sparse_classes_75kplus_train_006537
22,149
permissive
[ { "docstring": "Initializes the encoder using a [vocab_size x emb_size] embedding matrix. The encoder learns a matrix M, which may be initialized explicitely or randomly. Parameters: vocab_size (int): the vocabulary size emb_size (int): dimensionality of embeddings bias (bool): whether or not to use a bias vect...
2
stack_v2_sparse_classes_30k_train_008363
Implement the Python class `AttentionEncoder` described below. Class description: Segment encoder that produces segment vectors as the weighted average of word embeddings. Method signatures and docstrings: - def __init__(self, vocab_size, emb_size, bias=True, M=None, b=None, pretrained_emb=None, fix_w_emb=False): Ini...
Implement the Python class `AttentionEncoder` described below. Class description: Segment encoder that produces segment vectors as the weighted average of word embeddings. Method signatures and docstrings: - def __init__(self, vocab_size, emb_size, bias=True, M=None, b=None, pretrained_emb=None, fix_w_emb=False): Ini...
41452f447284491cf8ade8e09f3bc4e314ec64f7
<|skeleton|> class AttentionEncoder: """Segment encoder that produces segment vectors as the weighted average of word embeddings.""" def __init__(self, vocab_size, emb_size, bias=True, M=None, b=None, pretrained_emb=None, fix_w_emb=False): """Initializes the encoder using a [vocab_size x emb_size] embe...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AttentionEncoder: """Segment encoder that produces segment vectors as the weighted average of word embeddings.""" def __init__(self, vocab_size, emb_size, bias=True, M=None, b=None, pretrained_emb=None, fix_w_emb=False): """Initializes the encoder using a [vocab_size x emb_size] embedding matrix....
the_stack_v2_python_sparse
iswd/model_library.py
gkaramanolakis/ISWD
train
7
5bda1b4c9a27b594cc3de26783741ed119dd7412
[ "log_info(prm)\nself.default_solver = default_solver\nN_IW = sb_qmc.N_IW\niw_points = matsubara_frequencies(np.arange(N_IW), prm.beta)\ndata = get_initial_condition(prm, kind=starting_point, iw_points=iw_points, output_dir=output_dir)\ndata_T = data.temperature\niw_points = matsubara_frequencies(np.arange(N_IW), 1....
<|body_start_0|> log_info(prm) self.default_solver = default_solver N_IW = sb_qmc.N_IW iw_points = matsubara_frequencies(np.arange(N_IW), prm.beta) data = get_initial_condition(prm, kind=starting_point, iw_points=iw_points, output_dir=output_dir) data_T = data.temperature...
Run r-DMFT loop using `Runner.iteration`.
Runner
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Runner: """Run r-DMFT loop using `Runner.iteration`.""" def __init__(self, prm: Hubbard_Parameters, starting_point='auto', output_dir=None, default_solver=sb_qmc.solve) -> None: """Create runner for the model `prm`. Parameters ---------- prm : Hubbard_Parameters Parameters of the Ham...
stack_v2_sparse_classes_75kplus_train_006538
24,309
no_license
[ { "docstring": "Create runner for the model `prm`. Parameters ---------- prm : Hubbard_Parameters Parameters of the Hamiltonian. starting_point : {'auto', 'resume', 'Hartree', 'Hubbard-I'}, optional What kind of starting point is used. 'resume' loads previous iteration (layer data with largest iteration number)...
3
stack_v2_sparse_classes_30k_train_004302
Implement the Python class `Runner` described below. Class description: Run r-DMFT loop using `Runner.iteration`. Method signatures and docstrings: - def __init__(self, prm: Hubbard_Parameters, starting_point='auto', output_dir=None, default_solver=sb_qmc.solve) -> None: Create runner for the model `prm`. Parameters ...
Implement the Python class `Runner` described below. Class description: Run r-DMFT loop using `Runner.iteration`. Method signatures and docstrings: - def __init__(self, prm: Hubbard_Parameters, starting_point='auto', output_dir=None, default_solver=sb_qmc.solve) -> None: Create runner for the model `prm`. Parameters ...
18dba6f322f27733307b4d0679e7629d69689415
<|skeleton|> class Runner: """Run r-DMFT loop using `Runner.iteration`.""" def __init__(self, prm: Hubbard_Parameters, starting_point='auto', output_dir=None, default_solver=sb_qmc.solve) -> None: """Create runner for the model `prm`. Parameters ---------- prm : Hubbard_Parameters Parameters of the Ham...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Runner: """Run r-DMFT loop using `Runner.iteration`.""" def __init__(self, prm: Hubbard_Parameters, starting_point='auto', output_dir=None, default_solver=sb_qmc.solve) -> None: """Create runner for the model `prm`. Parameters ---------- prm : Hubbard_Parameters Parameters of the Hamiltonian. sta...
the_stack_v2_python_sparse
layer_dmft/layer_dmft.py
DerWeh/layer_dmft
train
0
83d10a260d7fbb82f3a2307cc5fc2da1e3e7ea06
[ "is_valid = True\ntry:\n fips = item[0]\n name = item[2]\n geoid = int(item[3])\nexcept:\n is_valid = False\nif is_valid and fips and name:\n return is_valid\nlogger.warning('Invalid Record: ({item})'.format(item=item))\nreturn False", "division = self._get_division_cache(data['division_fips'])\nif...
<|body_start_0|> is_valid = True try: fips = item[0] name = item[2] geoid = int(item[3]) except: is_valid = False if is_valid and fips and name: return is_valid logger.warning('Invalid Record: ({item})'.format(item=item)...
Command
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Command: def is_entry_valid(self, item): """Checks for minimum subdivision requirements.""" <|body_0|> def get_query_fields(self, data): """Fields to identify a subdivision record.""" <|body_1|> def record_to_dict(self, item): """Given a division...
stack_v2_sparse_classes_75kplus_train_006539
2,957
permissive
[ { "docstring": "Checks for minimum subdivision requirements.", "name": "is_entry_valid", "signature": "def is_entry_valid(self, item)" }, { "docstring": "Fields to identify a subdivision record.", "name": "get_query_fields", "signature": "def get_query_fields(self, data)" }, { "d...
4
stack_v2_sparse_classes_30k_train_050244
Implement the Python class `Command` described below. Class description: Implement the Command class. Method signatures and docstrings: - def is_entry_valid(self, item): Checks for minimum subdivision requirements. - def get_query_fields(self, data): Fields to identify a subdivision record. - def record_to_dict(self,...
Implement the Python class `Command` described below. Class description: Implement the Command class. Method signatures and docstrings: - def is_entry_valid(self, item): Checks for minimum subdivision requirements. - def get_query_fields(self, data): Fields to identify a subdivision record. - def record_to_dict(self,...
cd7c51e358e5b2d2c3ca92626edbdd7e4f573ab8
<|skeleton|> class Command: def is_entry_valid(self, item): """Checks for minimum subdivision requirements.""" <|body_0|> def get_query_fields(self, data): """Fields to identify a subdivision record.""" <|body_1|> def record_to_dict(self, item): """Given a division...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Command: def is_entry_valid(self, item): """Checks for minimum subdivision requirements.""" is_valid = True try: fips = item[0] name = item[2] geoid = int(item[3]) except: is_valid = False if is_valid and fips and name: ...
the_stack_v2_python_sparse
geoware/management/commands/subdivision.py
un33k/django-geoware
train
4
f2574cdff829c35b966d5a960426aaf591d565ff
[ "if files is None:\n files = ['meta.yaml', 'build.sh']\nchanged = set()\nfor path in self.list_changed_files(ref, other):\n if not path.startswith(self.recipes_folder):\n continue\n for fname in files:\n if os.path.basename(path) == fname:\n changed.add(os.path.dirname(path))\nretu...
<|body_start_0|> if files is None: files = ['meta.yaml', 'build.sh'] changed = set() for path in self.list_changed_files(ref, other): if not path.startswith(self.recipes_folder): continue for fname in files: if os.path.basename(...
Githandler with logic specific to Bioconda Repo
BiocondaRepoMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BiocondaRepoMixin: """Githandler with logic specific to Bioconda Repo""" def get_changed_recipes(self, ref=None, other=None, files=None): """Returns list of modified recipes Args: ref: See `get_merge_base`. Defaults to HEAD other: See `get_merge_base`. Defaults to origin/master files...
stack_v2_sparse_classes_75kplus_train_006540
25,216
permissive
[ { "docstring": "Returns list of modified recipes Args: ref: See `get_merge_base`. Defaults to HEAD other: See `get_merge_base`. Defaults to origin/master files: List of files to consider. Defaults to ``meta.yaml`` and ``build.sh`` Result: List of unique recipe folders with changes. Path is from repo root (e.g. ...
4
stack_v2_sparse_classes_30k_train_046241
Implement the Python class `BiocondaRepoMixin` described below. Class description: Githandler with logic specific to Bioconda Repo Method signatures and docstrings: - def get_changed_recipes(self, ref=None, other=None, files=None): Returns list of modified recipes Args: ref: See `get_merge_base`. Defaults to HEAD oth...
Implement the Python class `BiocondaRepoMixin` described below. Class description: Githandler with logic specific to Bioconda Repo Method signatures and docstrings: - def get_changed_recipes(self, ref=None, other=None, files=None): Returns list of modified recipes Args: ref: See `get_merge_base`. Defaults to HEAD oth...
9a85115ae306f58c8b4e65e5f92f6cbdb5b68f04
<|skeleton|> class BiocondaRepoMixin: """Githandler with logic specific to Bioconda Repo""" def get_changed_recipes(self, ref=None, other=None, files=None): """Returns list of modified recipes Args: ref: See `get_merge_base`. Defaults to HEAD other: See `get_merge_base`. Defaults to origin/master files...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BiocondaRepoMixin: """Githandler with logic specific to Bioconda Repo""" def get_changed_recipes(self, ref=None, other=None, files=None): """Returns list of modified recipes Args: ref: See `get_merge_base`. Defaults to HEAD other: See `get_merge_base`. Defaults to origin/master files: List of fil...
the_stack_v2_python_sparse
bioconda_utils/githandler.py
bioconda/bioconda-utils
train
106
6e496121999f5a37a17d3e184866cc98b9a7d96e
[ "if not matrix:\n return\nn = matrix.__len__()\nrotate = [[0 for _ in range(n)] for _ in range(n)]\nfor i in range(n):\n for j in range(n):\n rotate[j][n - 1 - i] = matrix[i][j]\nmatrix[:] = rotate[:]", "if not matrix:\n return\nn = matrix.__len__()\nmatrix.reverse()\nfor i in range(n):\n for j...
<|body_start_0|> if not matrix: return n = matrix.__len__() rotate = [[0 for _ in range(n)] for _ in range(n)] for i in range(n): for j in range(n): rotate[j][n - 1 - i] = matrix[i][j] matrix[:] = rotate[:] <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rotate(self, matrix): """:type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.""" <|body_0|> def rotate1(self, matrix): """:type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-p...
stack_v2_sparse_classes_75kplus_train_006541
1,454
no_license
[ { "docstring": ":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.", "name": "rotate", "signature": "def rotate(self, matrix)" }, { "docstring": ":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.", ...
2
stack_v2_sparse_classes_30k_train_038497
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate(self, matrix): :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead. - def rotate1(self, matrix): :type matrix: List[List[...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate(self, matrix): :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead. - def rotate1(self, matrix): :type matrix: List[List[...
472f780c3214aab5c713612812d834ccbe589434
<|skeleton|> class Solution: def rotate(self, matrix): """:type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.""" <|body_0|> def rotate1(self, matrix): """:type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-p...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def rotate(self, matrix): """:type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.""" if not matrix: return n = matrix.__len__() rotate = [[0 for _ in range(n)] for _ in range(n)] for i in range(n): ...
the_stack_v2_python_sparse
2/48-Rotate_Image.py
ChangXiaodong/Leetcode-solutions
train
4
74287659e00de320b5cca17a048fd0f1914775ec
[ "chans = self._get_chans(spec_data.metadata.chans)\nlogger.info(f'Calibrating channels {chans}')\nmessages = [f'Calibrating channels {chans}']\ndata = {x: np.array(y) for x, y in spec_data.data.items()}\nfor chan in chans:\n logger.info(f'Looking for sensor calibration data for channel {chan}')\n cal_data = s...
<|body_start_0|> chans = self._get_chans(spec_data.metadata.chans) logger.info(f'Calibrating channels {chans}') messages = [f'Calibrating channels {chans}'] data = {x: np.array(y) for x, y in spec_data.data.items()} for chan in chans: logger.info(f'Looking for sensor ...
SensorCalibrator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SensorCalibrator: def run(self, dir_path: Path, spec_data: SpectraData) -> SpectraData: """Calibrate Spectra data""" <|body_0|> def _get_cal_data(self, dir_path: Path, metadata: SpectraMetadata, chan: str) -> Union[CalibrationData, None]: """Get the calibration data"...
stack_v2_sparse_classes_75kplus_train_006542
18,607
permissive
[ { "docstring": "Calibrate Spectra data", "name": "run", "signature": "def run(self, dir_path: Path, spec_data: SpectraData) -> SpectraData" }, { "docstring": "Get the calibration data", "name": "_get_cal_data", "signature": "def _get_cal_data(self, dir_path: Path, metadata: SpectraMetada...
2
stack_v2_sparse_classes_30k_train_012236
Implement the Python class `SensorCalibrator` described below. Class description: Implement the SensorCalibrator class. Method signatures and docstrings: - def run(self, dir_path: Path, spec_data: SpectraData) -> SpectraData: Calibrate Spectra data - def _get_cal_data(self, dir_path: Path, metadata: SpectraMetadata, ...
Implement the Python class `SensorCalibrator` described below. Class description: Implement the SensorCalibrator class. Method signatures and docstrings: - def run(self, dir_path: Path, spec_data: SpectraData) -> SpectraData: Calibrate Spectra data - def _get_cal_data(self, dir_path: Path, metadata: SpectraMetadata, ...
cba60747803b6c582eaaf1a670a7f455f5724ebd
<|skeleton|> class SensorCalibrator: def run(self, dir_path: Path, spec_data: SpectraData) -> SpectraData: """Calibrate Spectra data""" <|body_0|> def _get_cal_data(self, dir_path: Path, metadata: SpectraMetadata, chan: str) -> Union[CalibrationData, None]: """Get the calibration data"...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SensorCalibrator: def run(self, dir_path: Path, spec_data: SpectraData) -> SpectraData: """Calibrate Spectra data""" chans = self._get_chans(spec_data.metadata.chans) logger.info(f'Calibrating channels {chans}') messages = [f'Calibrating channels {chans}'] data = {x: np...
the_stack_v2_python_sparse
resistics/calibrate.py
resistics/resistics
train
47
90c3fe5de5e014f36260d94e850e5cf3a5b679c5
[ "producer = Producer()\nrecord_metadata = producer.send_message(TOPIC, URL, REGEX, TEST_DATA).get(timeout=5)\nassert record_metadata.topic == TOPIC, 'Stats should be sent properly to topic {}.'.format(TOPIC)", "producer = Producer()\nwith pytest.raises(KafkaTimeoutError):\n producer.send_message('topic_not_exi...
<|body_start_0|> producer = Producer() record_metadata = producer.send_message(TOPIC, URL, REGEX, TEST_DATA).get(timeout=5) assert record_metadata.topic == TOPIC, 'Stats should be sent properly to topic {}.'.format(TOPIC) <|end_body_0|> <|body_start_1|> producer = Producer() wit...
This is to Producer.
TestProducer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestProducer: """This is to Producer.""" def test_send_message(self): """Verify producer should send message properly.""" <|body_0|> def test_send_message_to_non_existing_topic(self): """Verify exception should occur is producer tries to send message to non exist...
stack_v2_sparse_classes_75kplus_train_006543
2,132
no_license
[ { "docstring": "Verify producer should send message properly.", "name": "test_send_message", "signature": "def test_send_message(self)" }, { "docstring": "Verify exception should occur is producer tries to send message to non existing topic.", "name": "test_send_message_to_non_existing_topic...
3
stack_v2_sparse_classes_30k_train_001176
Implement the Python class `TestProducer` described below. Class description: This is to Producer. Method signatures and docstrings: - def test_send_message(self): Verify producer should send message properly. - def test_send_message_to_non_existing_topic(self): Verify exception should occur is producer tries to send...
Implement the Python class `TestProducer` described below. Class description: This is to Producer. Method signatures and docstrings: - def test_send_message(self): Verify producer should send message properly. - def test_send_message_to_non_existing_topic(self): Verify exception should occur is producer tries to send...
4f86f5695b853d4a7871e7b90acf36f5bc6dd21f
<|skeleton|> class TestProducer: """This is to Producer.""" def test_send_message(self): """Verify producer should send message properly.""" <|body_0|> def test_send_message_to_non_existing_topic(self): """Verify exception should occur is producer tries to send message to non exist...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestProducer: """This is to Producer.""" def test_send_message(self): """Verify producer should send message properly.""" producer = Producer() record_metadata = producer.send_message(TOPIC, URL, REGEX, TEST_DATA).get(timeout=5) assert record_metadata.topic == TOPIC, 'Stat...
the_stack_v2_python_sparse
testcases/test_producer.py
anujkumar21/monitoring
train
0
159419af10996331a0a880ef0493a1d4d3129850
[ "super().__init__(ordered_dict)\nself.__verify(required_keys)\nself.__fill(optional_keys)", "keys = set(self.keys())\nrequired_keys = set(required_keys)\nif not required_keys <= keys:\n missing_keys = required_keys - keys\n raise KeyError('Missing required keys: ' + str(missing_keys))", "for optional_key ...
<|body_start_0|> super().__init__(ordered_dict) self.__verify(required_keys) self.__fill(optional_keys) <|end_body_0|> <|body_start_1|> keys = set(self.keys()) required_keys = set(required_keys) if not required_keys <= keys: missing_keys = required_keys - key...
MagicDict
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MagicDict: def __init__(self, ordered_dict, required_keys, optional_keys): """Initializes a magic dict instance. This method is similar to the OrderedDict constructor, but it also verifies all keys we expect in the data are there and adds any optional ones into the data as None. :param o...
stack_v2_sparse_classes_75kplus_train_006544
3,535
no_license
[ { "docstring": "Initializes a magic dict instance. This method is similar to the OrderedDict constructor, but it also verifies all keys we expect in the data are there and adds any optional ones into the data as None. :param ordered_dict: The ordered dictionary we'd like to format :param required_keys: The keys...
6
stack_v2_sparse_classes_30k_train_036164
Implement the Python class `MagicDict` described below. Class description: Implement the MagicDict class. Method signatures and docstrings: - def __init__(self, ordered_dict, required_keys, optional_keys): Initializes a magic dict instance. This method is similar to the OrderedDict constructor, but it also verifies a...
Implement the Python class `MagicDict` described below. Class description: Implement the MagicDict class. Method signatures and docstrings: - def __init__(self, ordered_dict, required_keys, optional_keys): Initializes a magic dict instance. This method is similar to the OrderedDict constructor, but it also verifies a...
1cfbdc0f4967b809bda5c0406d9baf344990f481
<|skeleton|> class MagicDict: def __init__(self, ordered_dict, required_keys, optional_keys): """Initializes a magic dict instance. This method is similar to the OrderedDict constructor, but it also verifies all keys we expect in the data are there and adds any optional ones into the data as None. :param o...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MagicDict: def __init__(self, ordered_dict, required_keys, optional_keys): """Initializes a magic dict instance. This method is similar to the OrderedDict constructor, but it also verifies all keys we expect in the data are there and adds any optional ones into the data as None. :param ordered_dict: T...
the_stack_v2_python_sparse
billserve/api/networking/models/MagicDict.py
BtLutz/billserve-container
train
0
61c0b19cb779d608ca7ddd34b11481d5992f78fb
[ "with catch(self):\n if not self.params['code']:\n self.error('缺少code')\n return\n info = (yield self.company_service.fetch_with_code(self.params['code']))\n self.success(info)", "with catch(self):\n self.guarantee('mobile')\n validate_mobile(self.params['mobile'])\n info = (yield ...
<|body_start_0|> with catch(self): if not self.params['code']: self.error('缺少code') return info = (yield self.company_service.fetch_with_code(self.params['code'])) self.success(info) <|end_body_0|> <|body_start_1|> with catch(self): ...
CompanyApplicationHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CompanyApplicationHandler: def get(self): """@api {get} /api/company/application 员工申请加入的初始条件 @apiName CompanyApplicationGetHandler @apiGroup Company @apiParam {String} code @apiSuccessExample {json} Success-Response: HTTP/1.1 200 OK { "status": 0, "msg": "success", "data": { "cid": 1, "c...
stack_v2_sparse_classes_75kplus_train_006545
27,125
no_license
[ { "docstring": "@api {get} /api/company/application 员工申请加入的初始条件 @apiName CompanyApplicationGetHandler @apiGroup Company @apiParam {String} code @apiSuccessExample {json} Success-Response: HTTP/1.1 200 OK { \"status\": 0, \"msg\": \"success\", \"data\": { \"cid\": 1, \"company_name\": \"十全\", \"contact\": \"1390...
2
stack_v2_sparse_classes_30k_train_025822
Implement the Python class `CompanyApplicationHandler` described below. Class description: Implement the CompanyApplicationHandler class. Method signatures and docstrings: - def get(self): @api {get} /api/company/application 员工申请加入的初始条件 @apiName CompanyApplicationGetHandler @apiGroup Company @apiParam {String} code @...
Implement the Python class `CompanyApplicationHandler` described below. Class description: Implement the CompanyApplicationHandler class. Method signatures and docstrings: - def get(self): @api {get} /api/company/application 员工申请加入的初始条件 @apiName CompanyApplicationGetHandler @apiGroup Company @apiParam {String} code @...
0b09280afe5b764a485b3bf6e760aaf9a68bc4d5
<|skeleton|> class CompanyApplicationHandler: def get(self): """@api {get} /api/company/application 员工申请加入的初始条件 @apiName CompanyApplicationGetHandler @apiGroup Company @apiParam {String} code @apiSuccessExample {json} Success-Response: HTTP/1.1 200 OK { "status": 0, "msg": "success", "data": { "cid": 1, "c...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CompanyApplicationHandler: def get(self): """@api {get} /api/company/application 员工申请加入的初始条件 @apiName CompanyApplicationGetHandler @apiGroup Company @apiParam {String} code @apiSuccessExample {json} Success-Response: HTTP/1.1 200 OK { "status": 0, "msg": "success", "data": { "cid": 1, "company_name": ...
the_stack_v2_python_sparse
handler/company/company.py
pickCloud/TenCloud_Backend
train
0
f65cfbcebe6877a956f8814b8f9cd80e0b528cc0
[ "self.userTweetlistDict = {}\nself.graphAdjDict = {}\nself.timeStamp = 0", "self.timeStamp = self.timeStamp + 1\nif userId not in self.userTweetlistDict:\n temp = []\n temp.append((tweetId, self.timeStamp))\n self.userTweetlistDict[userId] = temp\nelse:\n temp = self.userTweetlistDict[userId]\n tem...
<|body_start_0|> self.userTweetlistDict = {} self.graphAdjDict = {} self.timeStamp = 0 <|end_body_0|> <|body_start_1|> self.timeStamp = self.timeStamp + 1 if userId not in self.userTweetlistDict: temp = [] temp.append((tweetId, self.timeStamp)) ...
Twitter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Twitter: def __init__(self): """Initialize your data structure here.""" <|body_0|> def postTweet(self, userId, tweetId): """Compose a new tweet. :type userId: int :type tweetId: int :rtype: void""" <|body_1|> def getNewsFeed(self, userId): """Ret...
stack_v2_sparse_classes_75kplus_train_006546
3,785
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Compose a new tweet. :type userId: int :type tweetId: int :rtype: void", "name": "postTweet", "signature": "def postTweet(self, userId, tweetId)" }, { "...
5
null
Implement the Python class `Twitter` described below. Class description: Implement the Twitter class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def postTweet(self, userId, tweetId): Compose a new tweet. :type userId: int :type tweetId: int :rtype: void - def getNew...
Implement the Python class `Twitter` described below. Class description: Implement the Twitter class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def postTweet(self, userId, tweetId): Compose a new tweet. :type userId: int :type tweetId: int :rtype: void - def getNew...
0a2e0e4a5176c02910d7718c42903d10a6c47a5f
<|skeleton|> class Twitter: def __init__(self): """Initialize your data structure here.""" <|body_0|> def postTweet(self, userId, tweetId): """Compose a new tweet. :type userId: int :type tweetId: int :rtype: void""" <|body_1|> def getNewsFeed(self, userId): """Ret...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Twitter: def __init__(self): """Initialize your data structure here.""" self.userTweetlistDict = {} self.graphAdjDict = {} self.timeStamp = 0 def postTweet(self, userId, tweetId): """Compose a new tweet. :type userId: int :type tweetId: int :rtype: void""" ...
the_stack_v2_python_sparse
design_twitter.py
baichuan/Leetcode
train
0
e4200a907d477d8145c14bd32f2bc7e5a2df4fb3
[ "asserts.type_of(account_dto, AccountDto)\naccount_ndb = Account()\nmap_props(account_ndb, account_dto, cls._props)\nreturn account_ndb", "asserts.type_of(account_ndb, Account)\naccount_dto = AccountDto()\nmap_props(account_dto, account_ndb, cls._props)\nreturn account_dto" ]
<|body_start_0|> asserts.type_of(account_dto, AccountDto) account_ndb = Account() map_props(account_ndb, account_dto, cls._props) return account_ndb <|end_body_0|> <|body_start_1|> asserts.type_of(account_ndb, Account) account_dto = AccountDto() map_props(account...
AccountDto
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccountDto: def to_account_ndb(cls, account_dto): """Translates the given AccountDto to Account NDB model. :param account_dto: (dto.accounts.AccountDto) :return: (kinds.accounts.Account)""" <|body_0|> def from_account_ndb(cls, account_ndb): """Translates the given Ac...
stack_v2_sparse_classes_75kplus_train_006547
4,124
no_license
[ { "docstring": "Translates the given AccountDto to Account NDB model. :param account_dto: (dto.accounts.AccountDto) :return: (kinds.accounts.Account)", "name": "to_account_ndb", "signature": "def to_account_ndb(cls, account_dto)" }, { "docstring": "Translates the given Account NDB to AccountDto....
2
stack_v2_sparse_classes_30k_train_021838
Implement the Python class `AccountDto` described below. Class description: Implement the AccountDto class. Method signatures and docstrings: - def to_account_ndb(cls, account_dto): Translates the given AccountDto to Account NDB model. :param account_dto: (dto.accounts.AccountDto) :return: (kinds.accounts.Account) - ...
Implement the Python class `AccountDto` described below. Class description: Implement the AccountDto class. Method signatures and docstrings: - def to_account_ndb(cls, account_dto): Translates the given AccountDto to Account NDB model. :param account_dto: (dto.accounts.AccountDto) :return: (kinds.accounts.Account) - ...
1d6522069da3e5a6de41ce948b04872d0a994cca
<|skeleton|> class AccountDto: def to_account_ndb(cls, account_dto): """Translates the given AccountDto to Account NDB model. :param account_dto: (dto.accounts.AccountDto) :return: (kinds.accounts.Account)""" <|body_0|> def from_account_ndb(cls, account_ndb): """Translates the given Ac...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AccountDto: def to_account_ndb(cls, account_dto): """Translates the given AccountDto to Account NDB model. :param account_dto: (dto.accounts.AccountDto) :return: (kinds.accounts.Account)""" asserts.type_of(account_dto, AccountDto) account_ndb = Account() map_props(account_ndb, ...
the_stack_v2_python_sparse
models/dto/accounts.py
venvadlamani/HumanLink
train
0
48f1522337e0c96dcfa1ce7627c658e4ff7c7d66
[ "user = User.from_db(username)\nif not user:\n api.abort(404, 'No such user')\nreturn (user, 200)", "user = User.from_db(username)\nif not user:\n api.abort(404, 'No such user')\nargs = user_modify_parser.parse_args()\ntry:\n user.modify(args.changes)\nexcept json.decoder.JSONDecodeError:\n api.abort(...
<|body_start_0|> user = User.from_db(username) if not user: api.abort(404, 'No such user') return (user, 200) <|end_body_0|> <|body_start_1|> user = User.from_db(username) if not user: api.abort(404, 'No such user') args = user_modify_parser.parse...
SpecificUser
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpecificUser: def get(self, username): """Get a specific user""" <|body_0|> def patch(self, username): """Modify a specific user""" <|body_1|> def delete(self, username): """Delete a specific user""" <|body_2|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_75kplus_train_006548
12,864
no_license
[ { "docstring": "Get a specific user", "name": "get", "signature": "def get(self, username)" }, { "docstring": "Modify a specific user", "name": "patch", "signature": "def patch(self, username)" }, { "docstring": "Delete a specific user", "name": "delete", "signature": "de...
3
stack_v2_sparse_classes_30k_train_031983
Implement the Python class `SpecificUser` described below. Class description: Implement the SpecificUser class. Method signatures and docstrings: - def get(self, username): Get a specific user - def patch(self, username): Modify a specific user - def delete(self, username): Delete a specific user
Implement the Python class `SpecificUser` described below. Class description: Implement the SpecificUser class. Method signatures and docstrings: - def get(self, username): Get a specific user - def patch(self, username): Modify a specific user - def delete(self, username): Delete a specific user <|skeleton|> class ...
ab8c722673d5c43e5bd40c4747c374a73ea56ccc
<|skeleton|> class SpecificUser: def get(self, username): """Get a specific user""" <|body_0|> def patch(self, username): """Modify a specific user""" <|body_1|> def delete(self, username): """Delete a specific user""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SpecificUser: def get(self, username): """Get a specific user""" user = User.from_db(username) if not user: api.abort(404, 'No such user') return (user, 200) def patch(self, username): """Modify a specific user""" user = User.from_db(username) ...
the_stack_v2_python_sparse
kovaak_stats_back/kovaak_stats/api/users.py
ftsn/kovaak-stats-viewer
train
0
b331b82d4ea7ac8cc3d7ca4d257317286937b6fe
[ "if isinstance(type, str):\n type = getattr(DiskType, type)\nvolume = Volume()\nvolume.size = size\nvolume.type = type\nvolume.info.node_id = node_id\nvolume.info.pool_id = pool_id\nvolume.info.workload_type = WorkloadType.Volume\nreturn volume", "if isinstance(volume_id, Volume):\n if not volume_id.id:\n ...
<|body_start_0|> if isinstance(type, str): type = getattr(DiskType, type) volume = Volume() volume.size = size volume.type = type volume.info.node_id = node_id volume.info.pool_id = pool_id volume.info.workload_type = WorkloadType.Volume return...
VolumesGenerator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VolumesGenerator: def create(self, node_id: str, pool_id: int, size: int=5, type: Union[str, DiskType]=DiskType.HDD) -> Volume: """add a volume to the reservation Args: node_id(str): id of the node where to reserve the volume pool_id(int) the capacity pool ID size(int, optional): size in...
stack_v2_sparse_classes_75kplus_train_006549
1,932
permissive
[ { "docstring": "add a volume to the reservation Args: node_id(str): id of the node where to reserve the volume pool_id(int) the capacity pool ID size(int, optional): size in GiB. Defaults to 5. type(Union[str,DiskType], optional): type of disk to use. Can be SSD or HDD. Defaults to \"HDD\". Returns: Volume: the...
2
stack_v2_sparse_classes_30k_train_027155
Implement the Python class `VolumesGenerator` described below. Class description: Implement the VolumesGenerator class. Method signatures and docstrings: - def create(self, node_id: str, pool_id: int, size: int=5, type: Union[str, DiskType]=DiskType.HDD) -> Volume: add a volume to the reservation Args: node_id(str): ...
Implement the Python class `VolumesGenerator` described below. Class description: Implement the VolumesGenerator class. Method signatures and docstrings: - def create(self, node_id: str, pool_id: int, size: int=5, type: Union[str, DiskType]=DiskType.HDD) -> Volume: add a volume to the reservation Args: node_id(str): ...
e44e950daeced3a6713b39f0d6dae1fa681e1d11
<|skeleton|> class VolumesGenerator: def create(self, node_id: str, pool_id: int, size: int=5, type: Union[str, DiskType]=DiskType.HDD) -> Volume: """add a volume to the reservation Args: node_id(str): id of the node where to reserve the volume pool_id(int) the capacity pool ID size(int, optional): size in...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VolumesGenerator: def create(self, node_id: str, pool_id: int, size: int=5, type: Union[str, DiskType]=DiskType.HDD) -> Volume: """add a volume to the reservation Args: node_id(str): id of the node where to reserve the volume pool_id(int) the capacity pool ID size(int, optional): size in GiB. Defaults...
the_stack_v2_python_sparse
jumpscale/sals/zos/volumes.py
xmonader/js-sdk
train
0
3a57da770d749e5f44098e7398b089517e2d9395
[ "assert gamma >= 1, 'gamma must be >= 1 (E^(-gamma))'\nassert 0 <= e_min <= e_max, 'energy limits must be 0 <= e_min <= e_max'\nmsg = 'direction must be None or direction in [0, 2pi)'\nassert direction is None or 0 <= direction < 2 * np.pi, msg\nself.name = name\nself.e_min = e_min\nself.e_max = e_max\nself.gamma =...
<|body_start_0|> assert gamma >= 1, 'gamma must be >= 1 (E^(-gamma))' assert 0 <= e_min <= e_max, 'energy limits must be 0 <= e_min <= e_max' msg = 'direction must be None or direction in [0, 2pi)' assert direction is None or 0 <= direction < 2 * np.pi, msg self.name = name ...
Base particle generator class. This class is intended as a base class for particle generators. Each particle type must create their own generator class if the particle has new parameters other than the ones sampled here. A derived class must implement: __init__ generate(num, random_seed) Attributes ---------- direction...
BaseParticleGenerator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseParticleGenerator: """Base particle generator class. This class is intended as a base class for particle generators. Each particle type must create their own generator class if the particle has new parameters other than the ones sampled here. A derived class must implement: __init__ generate(...
stack_v2_sparse_classes_75kplus_train_006550
7,692
no_license
[ { "docstring": "Initialize base particle generator. Parameters ---------- e_min : float The minimium particle energy to generate. This must be greater equal zero and not greater than e_max. e_max : float The maximum particle energy to generate. This must be greater equal zero and not less than e_min. gamma : fl...
5
stack_v2_sparse_classes_30k_train_035824
Implement the Python class `BaseParticleGenerator` described below. Class description: Base particle generator class. This class is intended as a base class for particle generators. Each particle type must create their own generator class if the particle has new parameters other than the ones sampled here. A derived c...
Implement the Python class `BaseParticleGenerator` described below. Class description: Base particle generator class. This class is intended as a base class for particle generators. Each particle type must create their own generator class if the particle has new parameters other than the ones sampled here. A derived c...
0d7442bd78f9899536a109e87a4c4639ade82a58
<|skeleton|> class BaseParticleGenerator: """Base particle generator class. This class is intended as a base class for particle generators. Each particle type must create their own generator class if the particle has new parameters other than the ones sampled here. A derived class must implement: __init__ generate(...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaseParticleGenerator: """Base particle generator class. This class is intended as a base class for particle generators. Each particle type must create their own generator class if the particle has new parameters other than the ones sampled here. A derived class must implement: __init__ generate(num, random_s...
the_stack_v2_python_sparse
project_a5/simulation/generator/base_generator.py
yungsalami/linuxtest
train
0
8d5f2e5f279a28e46143e65199a4b1ba6a5068fd
[ "s3 = chrono.perf_counter()\nitems = list(data.keys())\nn = len(data.columns)\ninit = 0\ne = pd.DataFrame(dtype=float)\ne = self._around_event_recur_(n, data, e, reward, items, init)\nself.around_event = e\ns4 = chrono.perf_counter()\nlogging.debug(f'Fin Event, durée all via map: {s4 - s3}')\nreturn self.around_eve...
<|body_start_0|> s3 = chrono.perf_counter() items = list(data.keys()) n = len(data.columns) init = 0 e = pd.DataFrame(dtype=float) e = self._around_event_recur_(n, data, e, reward, items, init) self.around_event = e s4 = chrono.perf_counter() loggi...
PreFormatData
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PreFormatData: def make_event_around(self, data: DataFrame, reward: Series): """Pour utiliser cette methode il faut que la series des event soit indexé sur la base de temps des data pour en extraire les valeurs correctement calcul pour toutes les colonnes d'un dataframe :param data: :par...
stack_v2_sparse_classes_75kplus_train_006551
2,213
no_license
[ { "docstring": "Pour utiliser cette methode il faut que la series des event soit indexé sur la base de temps des data pour en extraire les valeurs correctement calcul pour toutes les colonnes d'un dataframe :param data: :param reward: c'est les temps des event en ms sur lesquel on ce calle :return:", "name"...
2
stack_v2_sparse_classes_30k_test_002399
Implement the Python class `PreFormatData` described below. Class description: Implement the PreFormatData class. Method signatures and docstrings: - def make_event_around(self, data: DataFrame, reward: Series): Pour utiliser cette methode il faut que la series des event soit indexé sur la base de temps des data pour...
Implement the Python class `PreFormatData` described below. Class description: Implement the PreFormatData class. Method signatures and docstrings: - def make_event_around(self, data: DataFrame, reward: Series): Pour utiliser cette methode il faut que la series des event soit indexé sur la base de temps des data pour...
82f9c78828a1e1fb6c3d60d91777638720129e1a
<|skeleton|> class PreFormatData: def make_event_around(self, data: DataFrame, reward: Series): """Pour utiliser cette methode il faut que la series des event soit indexé sur la base de temps des data pour en extraire les valeurs correctement calcul pour toutes les colonnes d'un dataframe :param data: :par...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PreFormatData: def make_event_around(self, data: DataFrame, reward: Series): """Pour utiliser cette methode il faut que la series des event soit indexé sur la base de temps des data pour en extraire les valeurs correctement calcul pour toutes les colonnes d'un dataframe :param data: :param reward: c'e...
the_stack_v2_python_sparse
build/lib/py_NPClab_Package/utilitaire_traitement/PreFormatData.py
NPC-lab-python/py_NPC-Lab_Packages
train
0
db4cc6e0b0b73a8322049990eed24a3f0439f549
[ "usuario_actual = LoginControlador.token_requerido_grpc(token)\nif usuario_actual is None:\n error = ManejadorDeArchivos_pb2.Error.TOKEN_INVALIDO\n ValidacionServiciosGrpc.logger.info(ip + ' -- Error autenticacion: TOKEN_INVALIDO')\n return error", "if token is None or token == '':\n error = Manejador...
<|body_start_0|> usuario_actual = LoginControlador.token_requerido_grpc(token) if usuario_actual is None: error = ManejadorDeArchivos_pb2.Error.TOKEN_INVALIDO ValidacionServiciosGrpc.logger.info(ip + ' -- Error autenticacion: TOKEN_INVALIDO') return error <|end_body_0...
ValidacionServiciosGrpc
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ValidacionServiciosGrpc: def validar_token_valido(token, ip): """Valida que el token es un token valido :param token: El token a validar :param ip: El ip del cliente del cual se le realizara la validación de su solicitud :return: None si el token es valido o un ManejadorDeArchivos_pb2.Er...
stack_v2_sparse_classes_75kplus_train_006552
3,065
no_license
[ { "docstring": "Valida que el token es un token valido :param token: El token a validar :param ip: El ip del cliente del cual se le realizara la validación de su solicitud :return: None si el token es valido o un ManejadorDeArchivos_pb2.Error.TOKEN_INVALIDO", "name": "validar_token_valido", "signature":...
4
stack_v2_sparse_classes_30k_train_030736
Implement the Python class `ValidacionServiciosGrpc` described below. Class description: Implement the ValidacionServiciosGrpc class. Method signatures and docstrings: - def validar_token_valido(token, ip): Valida que el token es un token valido :param token: El token a validar :param ip: El ip del cliente del cual s...
Implement the Python class `ValidacionServiciosGrpc` described below. Class description: Implement the ValidacionServiciosGrpc class. Method signatures and docstrings: - def validar_token_valido(token, ip): Valida que el token es un token valido :param token: El token a validar :param ip: El ip del cliente del cual s...
49bbaaf0bd4d1bec2d81eb35882e5f073b1c149f
<|skeleton|> class ValidacionServiciosGrpc: def validar_token_valido(token, ip): """Valida que el token es un token valido :param token: El token a validar :param ip: El ip del cliente del cual se le realizara la validación de su solicitud :return: None si el token es valido o un ManejadorDeArchivos_pb2.Er...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ValidacionServiciosGrpc: def validar_token_valido(token, ip): """Valida que el token es un token valido :param token: El token a validar :param ip: El ip del cliente del cual se le realizara la validación de su solicitud :return: None si el token es valido o un ManejadorDeArchivos_pb2.Error.TOKEN_INVA...
the_stack_v2_python_sparse
app/util/validaciones/servicios_grpc/ValidacionServiciosGrpc.py
codeChinoUV/EspotifeiAPI
train
0
98c13f6904e9569bae18bb2f8cd49abdf5f98cc2
[ "count = 0\nwhile n:\n if n & 1 == 1:\n count += 1\n n = n >> 1\n if count > 1:\n return False\nif count == 0:\n return False\nreturn True", "if n == 0:\n return False\ncount = 0\nfor i in range(2):\n count += 1\n n = n & n - 1\n if n == 0:\n break\nif count != 1:\n ...
<|body_start_0|> count = 0 while n: if n & 1 == 1: count += 1 n = n >> 1 if count > 1: return False if count == 0: return False return True <|end_body_0|> <|body_start_1|> if n == 0: retu...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isPowerOfTwo3(self, n: int) -> bool: """位运算 1 2 10 2 100 4 1000 8 10000 16 如上所述,2的幂的二进制仅包含一个1. 计算1的个数是否为1""" <|body_0|> def isPowerOfTwo2(self, n: int) -> bool: """位运算(推荐) 1 2 10 2 100 4 1000 8 10000 16 如上所述,2的幂的二进制仅包含一个1。 计算1的个数是否为1""" <|body_1...
stack_v2_sparse_classes_75kplus_train_006553
1,448
no_license
[ { "docstring": "位运算 1 2 10 2 100 4 1000 8 10000 16 如上所述,2的幂的二进制仅包含一个1. 计算1的个数是否为1", "name": "isPowerOfTwo3", "signature": "def isPowerOfTwo3(self, n: int) -> bool" }, { "docstring": "位运算(推荐) 1 2 10 2 100 4 1000 8 10000 16 如上所述,2的幂的二进制仅包含一个1。 计算1的个数是否为1", "name": "isPowerOfTwo2", "signatu...
3
stack_v2_sparse_classes_30k_train_040887
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPowerOfTwo3(self, n: int) -> bool: 位运算 1 2 10 2 100 4 1000 8 10000 16 如上所述,2的幂的二进制仅包含一个1. 计算1的个数是否为1 - def isPowerOfTwo2(self, n: int) -> bool: 位运算(推荐) 1 2 10 2 100 4 1000 ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPowerOfTwo3(self, n: int) -> bool: 位运算 1 2 10 2 100 4 1000 8 10000 16 如上所述,2的幂的二进制仅包含一个1. 计算1的个数是否为1 - def isPowerOfTwo2(self, n: int) -> bool: 位运算(推荐) 1 2 10 2 100 4 1000 ...
c0dd577481b46129d950354d567d332a4d091137
<|skeleton|> class Solution: def isPowerOfTwo3(self, n: int) -> bool: """位运算 1 2 10 2 100 4 1000 8 10000 16 如上所述,2的幂的二进制仅包含一个1. 计算1的个数是否为1""" <|body_0|> def isPowerOfTwo2(self, n: int) -> bool: """位运算(推荐) 1 2 10 2 100 4 1000 8 10000 16 如上所述,2的幂的二进制仅包含一个1。 计算1的个数是否为1""" <|body_1...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def isPowerOfTwo3(self, n: int) -> bool: """位运算 1 2 10 2 100 4 1000 8 10000 16 如上所述,2的幂的二进制仅包含一个1. 计算1的个数是否为1""" count = 0 while n: if n & 1 == 1: count += 1 n = n >> 1 if count > 1: return False if c...
the_stack_v2_python_sparse
leetcode/231_2的幂.py
tenqaz/crazy_arithmetic
train
0
f2d8bce1b2e6f5f4b03aa36fc9250c3a3ea68e63
[ "if request.user.is_authenticated:\n user_object = get_object_or_404(UserSet.queryset, pk=request.user.pk)\n return JsonResponse(UserSerializer(user_object).data, status=status.HTTP_200_OK)\nreturn JsonResponse(data={'error': 'forbidden'}, status=status.HTTP_403_FORBIDDEN)", "if not request.user.is_authenti...
<|body_start_0|> if request.user.is_authenticated: user_object = get_object_or_404(UserSet.queryset, pk=request.user.pk) return JsonResponse(UserSerializer(user_object).data, status=status.HTTP_200_OK) return JsonResponse(data={'error': 'forbidden'}, status=status.HTTP_403_FORBID...
UserSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserSet: def list(self, request, *args, **kwargs): """Function display only current user, not full list, like a retrieve, but without "pk" argument. :return JSON: string with object or error message""" <|body_0|> def retrieve(self, request, pk): """Function display o...
stack_v2_sparse_classes_75kplus_train_006554
13,687
no_license
[ { "docstring": "Function display only current user, not full list, like a retrieve, but without \"pk\" argument. :return JSON: string with object or error message", "name": "list", "signature": "def list(self, request, *args, **kwargs)" }, { "docstring": "Function display only current user, if y...
5
stack_v2_sparse_classes_30k_train_048122
Implement the Python class `UserSet` described below. Class description: Implement the UserSet class. Method signatures and docstrings: - def list(self, request, *args, **kwargs): Function display only current user, not full list, like a retrieve, but without "pk" argument. :return JSON: string with object or error m...
Implement the Python class `UserSet` described below. Class description: Implement the UserSet class. Method signatures and docstrings: - def list(self, request, *args, **kwargs): Function display only current user, not full list, like a retrieve, but without "pk" argument. :return JSON: string with object or error m...
e4f7aab834c01de6f20d8bac85ede83fbca3a846
<|skeleton|> class UserSet: def list(self, request, *args, **kwargs): """Function display only current user, not full list, like a retrieve, but without "pk" argument. :return JSON: string with object or error message""" <|body_0|> def retrieve(self, request, pk): """Function display o...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserSet: def list(self, request, *args, **kwargs): """Function display only current user, not full list, like a retrieve, but without "pk" argument. :return JSON: string with object or error message""" if request.user.is_authenticated: user_object = get_object_or_404(UserSet.querys...
the_stack_v2_python_sparse
executor/api/views.py
pywebexecutorgb/main
train
0
6664ed44dceba73c1b378f4a7d9931d6710bcbe0
[ "self.Slack = namedtuple('Slack', ['api_token', 'channel', 'user', 'mecab'])\nself.config_file = 'enviroment_slack.yml'\nself.slack_channel = ''\nself.chan = ''\nself.user = ''\nself.mecab_dict = ''\nself.parameter_dict = {}\ntrain_path = '../data/'\nself.parameter_dict['source'] = train_path + 'player_1_wakati'\ns...
<|body_start_0|> self.Slack = namedtuple('Slack', ['api_token', 'channel', 'user', 'mecab']) self.config_file = 'enviroment_slack.yml' self.slack_channel = '' self.chan = '' self.user = '' self.mecab_dict = '' self.parameter_dict = {} train_path = '../data...
SlackModel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SlackModel: def __init__(self): """setting paramater Slack model :return:""" <|body_0|> def read_config(self): """read config file for slack""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.Slack = namedtuple('Slack', ['api_token', 'channel', 'u...
stack_v2_sparse_classes_75kplus_train_006555
1,799
permissive
[ { "docstring": "setting paramater Slack model :return:", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "read config file for slack", "name": "read_config", "signature": "def read_config(self)" } ]
2
stack_v2_sparse_classes_30k_train_029367
Implement the Python class `SlackModel` described below. Class description: Implement the SlackModel class. Method signatures and docstrings: - def __init__(self): setting paramater Slack model :return: - def read_config(self): read config file for slack
Implement the Python class `SlackModel` described below. Class description: Implement the SlackModel class. Method signatures and docstrings: - def __init__(self): setting paramater Slack model :return: - def read_config(self): read config file for slack <|skeleton|> class SlackModel: def __init__(self): ...
2ea8bf0168ea53c804412b40fdb4d9b70b043073
<|skeleton|> class SlackModel: def __init__(self): """setting paramater Slack model :return:""" <|body_0|> def read_config(self): """read config file for slack""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SlackModel: def __init__(self): """setting paramater Slack model :return:""" self.Slack = namedtuple('Slack', ['api_token', 'channel', 'user', 'mecab']) self.config_file = 'enviroment_slack.yml' self.slack_channel = '' self.chan = '' self.user = '' self....
the_stack_v2_python_sparse
slack/slack_model.py
SnowMasaya/Chainer-Slack-Twitter-Dialogue
train
56
4109b0a3748f7d5d98c91fd5f9cadfed173c5270
[ "self.BATT_SIZE = 50\nself.FULL_CHAR = '+'\nself.EMPTY_CHAR = '.'\nself.empty = empty\nself.full = full\nself.charge = None", "if self.charge is None:\n return None\nreturn saturate(self.charge, self.empty, self.full, 0, 100)", "level = self.get_level()\nif level is None:\n return 'Awaiting data...'\nasse...
<|body_start_0|> self.BATT_SIZE = 50 self.FULL_CHAR = '+' self.EMPTY_CHAR = '.' self.empty = empty self.full = full self.charge = None <|end_body_0|> <|body_start_1|> if self.charge is None: return None return saturate(self.charge, self.empty,...
Represents a battery and defines its analog port and charge limits (eg, full, empty).
Battery
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Battery: """Represents a battery and defines its analog port and charge limits (eg, full, empty).""" def __init__(self, empty=120, full=150): """Constructor. @param empty: the raw signal value that indicates empty battery @param full: the raw signal value that indicates full battery"...
stack_v2_sparse_classes_75kplus_train_006556
5,209
no_license
[ { "docstring": "Constructor. @param empty: the raw signal value that indicates empty battery @param full: the raw signal value that indicates full battery", "name": "__init__", "signature": "def __init__(self, empty=120, full=150)" }, { "docstring": "@return: the current charge of the battery as...
3
stack_v2_sparse_classes_30k_train_011618
Implement the Python class `Battery` described below. Class description: Represents a battery and defines its analog port and charge limits (eg, full, empty). Method signatures and docstrings: - def __init__(self, empty=120, full=150): Constructor. @param empty: the raw signal value that indicates empty battery @para...
Implement the Python class `Battery` described below. Class description: Represents a battery and defines its analog port and charge limits (eg, full, empty). Method signatures and docstrings: - def __init__(self, empty=120, full=150): Constructor. @param empty: the raw signal value that indicates empty battery @para...
52bacd9f58524090e0ab421a47714629249ca273
<|skeleton|> class Battery: """Represents a battery and defines its analog port and charge limits (eg, full, empty).""" def __init__(self, empty=120, full=150): """Constructor. @param empty: the raw signal value that indicates empty battery @param full: the raw signal value that indicates full battery"...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Battery: """Represents a battery and defines its analog port and charge limits (eg, full, empty).""" def __init__(self, empty=120, full=150): """Constructor. @param empty: the raw signal value that indicates empty battery @param full: the raw signal value that indicates full battery""" se...
the_stack_v2_python_sparse
src/09-10/ubc-tbird-ros-pkg/sb_util/scripts/battery_monitor.py
jpearkes/snowbots
train
0
53b2dfd733cf264e13684fe707facabe6a5eeaa7
[ "super().__init__(r_cut, **kwargs)\nself.grid_eam = grid_eam\nself.alpha = alpha\nself.r0 = r0", "super().calculate(atoms, properties, system_changes)\nforces = np.zeros((len(self.atoms), 3))\npotential_energies = np.zeros((len(self.atoms), 1))\nfor i in range(len(self.atoms)):\n inds, pos, dists2 = self.nl.ge...
<|body_start_0|> super().__init__(r_cut, **kwargs) self.grid_eam = grid_eam self.alpha = alpha self.r0 = r0 <|end_body_0|> <|body_start_1|> super().calculate(atoms, properties, system_changes) forces = np.zeros((len(self.atoms), 3)) potential_energies = np.zeros(...
A mapped Eam calculator for ase Attributes: grid_eam (object): 1D Spline interpolator for the eam mapped grid results(dict): energy and forces calculated on the atoms object
EamSingleSpecies
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EamSingleSpecies: """A mapped Eam calculator for ase Attributes: grid_eam (object): 1D Spline interpolator for the eam mapped grid results(dict): energy and forces calculated on the atoms object""" def __init__(self, r_cut, grid_eam, alpha, r0, **kwargs): """Args: grid_eam (object): ...
stack_v2_sparse_classes_75kplus_train_006557
25,108
permissive
[ { "docstring": "Args: grid_eam (object): 1D Spline interpolator for the eam mapped grid r_cut (float): cutoff radius alpha (float): Exponential prefactor of the eam Descriptor r0 (float): Radius in the exponent of the eam Descriptor", "name": "__init__", "signature": "def __init__(self, r_cut, grid_eam,...
2
null
Implement the Python class `EamSingleSpecies` described below. Class description: A mapped Eam calculator for ase Attributes: grid_eam (object): 1D Spline interpolator for the eam mapped grid results(dict): energy and forces calculated on the atoms object Method signatures and docstrings: - def __init__(self, r_cut, ...
Implement the Python class `EamSingleSpecies` described below. Class description: A mapped Eam calculator for ase Attributes: grid_eam (object): 1D Spline interpolator for the eam mapped grid results(dict): energy and forces calculated on the atoms object Method signatures and docstrings: - def __init__(self, r_cut, ...
cd1b22b606dfd64d91dc94fece72ad6a707212af
<|skeleton|> class EamSingleSpecies: """A mapped Eam calculator for ase Attributes: grid_eam (object): 1D Spline interpolator for the eam mapped grid results(dict): energy and forces calculated on the atoms object""" def __init__(self, r_cut, grid_eam, alpha, r0, **kwargs): """Args: grid_eam (object): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EamSingleSpecies: """A mapped Eam calculator for ase Attributes: grid_eam (object): 1D Spline interpolator for the eam mapped grid results(dict): energy and forces calculated on the atoms object""" def __init__(self, r_cut, grid_eam, alpha, r0, **kwargs): """Args: grid_eam (object): 1D Spline int...
the_stack_v2_python_sparse
mff/calculators.py
kcl-tscm/mff
train
16
ce19eec972183543148b9ab60222eb0a5357d071
[ "if Question.objects.filter(pk=kwargs['pk']).exists():\n qu = Question.objects.get(pk=kwargs['pk'])\n if qu.user != self.request.user:\n return HttpResponseForbidden('Access Denied')\nelse:\n return HttpResponseForbidden('Access Denied')\nreturn super(EditQuestionView, self).get(*args, **kwargs)", ...
<|body_start_0|> if Question.objects.filter(pk=kwargs['pk']).exists(): qu = Question.objects.get(pk=kwargs['pk']) if qu.user != self.request.user: return HttpResponseForbidden('Access Denied') else: return HttpResponseForbidden('Access Denied') ...
Edit Question View
EditQuestionView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EditQuestionView: """Edit Question View""" def get(self, *args, **kwargs): """user can't edit the other users question""" <|body_0|> def form_valid(self, form): """Edit the update date of question""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_006558
7,882
no_license
[ { "docstring": "user can't edit the other users question", "name": "get", "signature": "def get(self, *args, **kwargs)" }, { "docstring": "Edit the update date of question", "name": "form_valid", "signature": "def form_valid(self, form)" } ]
2
stack_v2_sparse_classes_30k_train_020577
Implement the Python class `EditQuestionView` described below. Class description: Edit Question View Method signatures and docstrings: - def get(self, *args, **kwargs): user can't edit the other users question - def form_valid(self, form): Edit the update date of question
Implement the Python class `EditQuestionView` described below. Class description: Edit Question View Method signatures and docstrings: - def get(self, *args, **kwargs): user can't edit the other users question - def form_valid(self, form): Edit the update date of question <|skeleton|> class EditQuestionView: """...
d89a811c5c928921a6ffac9120fd1d8d14dd4ac6
<|skeleton|> class EditQuestionView: """Edit Question View""" def get(self, *args, **kwargs): """user can't edit the other users question""" <|body_0|> def form_valid(self, form): """Edit the update date of question""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EditQuestionView: """Edit Question View""" def get(self, *args, **kwargs): """user can't edit the other users question""" if Question.objects.filter(pk=kwargs['pk']).exists(): qu = Question.objects.get(pk=kwargs['pk']) if qu.user != self.request.user: ...
the_stack_v2_python_sparse
forum/views.py
suman1oct/stack_overflow
train
0
038f6697ae97aee0be2915251e6f5c966ad62680
[ "arg_parser.add_argument('-i', '--input_file', type=Path, metavar='<input.hyper>', required=True, help='Input .hyper file')\narg_parser.add_argument('-o', '--output_file', type=Path, metavar='<output.hyper>', required=True, help='Output .hyper file')\narg_parser.add_argument('-m', '--mode', type=AdjustVertexOrderMo...
<|body_start_0|> arg_parser.add_argument('-i', '--input_file', type=Path, metavar='<input.hyper>', required=True, help='Input .hyper file') arg_parser.add_argument('-o', '--output_file', type=Path, metavar='<output.hyper>', required=True, help='Output .hyper file') arg_parser.add_argument('-m', ...
Command to adjust vertex order of all polygons in a .hyper file
AdjustVertexOrder
[ "LicenseRef-scancode-generic-cla", "MIT", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdjustVertexOrder: """Command to adjust vertex order of all polygons in a .hyper file""" def define_args(self, arg_parser): """Adds arguments for the command :param arg_parser: The argparse.ArgumentParser to add arguments to""" <|body_0|> def run(self, args): """...
stack_v2_sparse_classes_75kplus_train_006559
8,875
permissive
[ { "docstring": "Adds arguments for the command :param arg_parser: The argparse.ArgumentParser to add arguments to", "name": "define_args", "signature": "def define_args(self, arg_parser)" }, { "docstring": "Runs the command :param args: Arguments from argparse.Namespace", "name": "run", ...
2
null
Implement the Python class `AdjustVertexOrder` described below. Class description: Command to adjust vertex order of all polygons in a .hyper file Method signatures and docstrings: - def define_args(self, arg_parser): Adds arguments for the command :param arg_parser: The argparse.ArgumentParser to add arguments to - ...
Implement the Python class `AdjustVertexOrder` described below. Class description: Command to adjust vertex order of all polygons in a .hyper file Method signatures and docstrings: - def define_args(self, arg_parser): Adds arguments for the command :param arg_parser: The argparse.ArgumentParser to add arguments to - ...
382e66481ec8339407cf9cfa5d41fcdcf3f6a0fb
<|skeleton|> class AdjustVertexOrder: """Command to adjust vertex order of all polygons in a .hyper file""" def define_args(self, arg_parser): """Adds arguments for the command :param arg_parser: The argparse.ArgumentParser to add arguments to""" <|body_0|> def run(self, args): """...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AdjustVertexOrder: """Command to adjust vertex order of all polygons in a .hyper file""" def define_args(self, arg_parser): """Adds arguments for the command :param arg_parser: The argparse.ArgumentParser to add arguments to""" arg_parser.add_argument('-i', '--input_file', type=Path, meta...
the_stack_v2_python_sparse
Community-Supported/adjust-vertex-order/adjust_vertex_order.py
turner-anderson/hyper-api-samples
train
0
e6d205a790c772bd68e34c76e9d4efd28dc9666e
[ "input_file = self.open_input_file(args)\nrequired_total_fuel = 0\nfor line in input_file:\n mass_of_module = int(line.rstrip())\n required_total_fuel += _calculate_fuel(mass_of_module)\nprint('What is the sum of the fuel requirements for all of the modules on your spacecraft?\\n{}'.format(required_total_fuel...
<|body_start_0|> input_file = self.open_input_file(args) required_total_fuel = 0 for line in input_file: mass_of_module = int(line.rstrip()) required_total_fuel += _calculate_fuel(mass_of_module) print('What is the sum of the fuel requirements for all of the modul...
The class to solve this level (both parts)
Level01
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Level01: """The class to solve this level (both parts)""" def solve_part1(self, args): """Override to solve part 1 of the puzzle""" <|body_0|> def solve_part2(self, args): """Override to solve part 2 of the puzzle""" <|body_1|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_75kplus_train_006560
1,926
no_license
[ { "docstring": "Override to solve part 1 of the puzzle", "name": "solve_part1", "signature": "def solve_part1(self, args)" }, { "docstring": "Override to solve part 2 of the puzzle", "name": "solve_part2", "signature": "def solve_part2(self, args)" } ]
2
stack_v2_sparse_classes_30k_train_025282
Implement the Python class `Level01` described below. Class description: The class to solve this level (both parts) Method signatures and docstrings: - def solve_part1(self, args): Override to solve part 1 of the puzzle - def solve_part2(self, args): Override to solve part 2 of the puzzle
Implement the Python class `Level01` described below. Class description: The class to solve this level (both parts) Method signatures and docstrings: - def solve_part1(self, args): Override to solve part 1 of the puzzle - def solve_part2(self, args): Override to solve part 2 of the puzzle <|skeleton|> class Level01:...
56bf8831fe936271e415c68ac8d2cf6ab9adfe11
<|skeleton|> class Level01: """The class to solve this level (both parts)""" def solve_part1(self, args): """Override to solve part 1 of the puzzle""" <|body_0|> def solve_part2(self, args): """Override to solve part 2 of the puzzle""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Level01: """The class to solve this level (both parts)""" def solve_part1(self, args): """Override to solve part 1 of the puzzle""" input_file = self.open_input_file(args) required_total_fuel = 0 for line in input_file: mass_of_module = int(line.rstrip()) ...
the_stack_v2_python_sparse
2019/python/level01.py
istvans/AdventOfCode
train
0
7c9b922bed58fed469de68f1637c1fe99df4a27e
[ "subject = self.cleaned_data['subject']\nif not subject:\n raise forms.ValidationError('This is required')\nreturn subject", "text = self.cleaned_data['text']\nif not text:\n raise forms.ValidationError('This is required')\nreturn text" ]
<|body_start_0|> subject = self.cleaned_data['subject'] if not subject: raise forms.ValidationError('This is required') return subject <|end_body_0|> <|body_start_1|> text = self.cleaned_data['text'] if not text: raise forms.ValidationError('This is requi...
invoice form for send email
InvoiceEmailForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InvoiceEmailForm: """invoice form for send email""" def clean_subject(self): """subject validation""" <|body_0|> def clean_text(self): """text validation""" <|body_1|> <|end_skeleton|> <|body_start_0|> subject = self.cleaned_data['subject'] ...
stack_v2_sparse_classes_75kplus_train_006561
3,109
no_license
[ { "docstring": "subject validation", "name": "clean_subject", "signature": "def clean_subject(self)" }, { "docstring": "text validation", "name": "clean_text", "signature": "def clean_text(self)" } ]
2
stack_v2_sparse_classes_30k_train_039786
Implement the Python class `InvoiceEmailForm` described below. Class description: invoice form for send email Method signatures and docstrings: - def clean_subject(self): subject validation - def clean_text(self): text validation
Implement the Python class `InvoiceEmailForm` described below. Class description: invoice form for send email Method signatures and docstrings: - def clean_subject(self): subject validation - def clean_text(self): text validation <|skeleton|> class InvoiceEmailForm: """invoice form for send email""" def cle...
17615ea9bfb1edebe41d60dbf2e977f0018d5339
<|skeleton|> class InvoiceEmailForm: """invoice form for send email""" def clean_subject(self): """subject validation""" <|body_0|> def clean_text(self): """text validation""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InvoiceEmailForm: """invoice form for send email""" def clean_subject(self): """subject validation""" subject = self.cleaned_data['subject'] if not subject: raise forms.ValidationError('This is required') return subject def clean_text(self): """tex...
the_stack_v2_python_sparse
invoices/forms.py
Swiftkind/invoice
train
0
ff32188867c6b3d36233a6712447587976c47349
[ "payload = {'email': user.email}\npayload.update(kwargs)\ntoken = jwt.encode(payload, cls.secret, algorithm=algorithm_used)\nreturn token", "try:\n return jwt.decode(token, cls.secret, algorithms=algorithms_used, **kwargs)\nexcept:\n return None" ]
<|body_start_0|> payload = {'email': user.email} payload.update(kwargs) token = jwt.encode(payload, cls.secret, algorithm=algorithm_used) return token <|end_body_0|> <|body_start_1|> try: return jwt.decode(token, cls.secret, algorithms=algorithms_used, **kwargs) ...
Class for Generating JWT token and decode them.
TokenGenerator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TokenGenerator: """Class for Generating JWT token and decode them.""" def generate_token(cls, user, algorithm_used='HS256', **kwargs): """Method for generating token.""" <|body_0|> def decode_token(cls, token, algorithms_used=['HS256'], **kwargs): """Method for d...
stack_v2_sparse_classes_75kplus_train_006562
2,861
no_license
[ { "docstring": "Method for generating token.", "name": "generate_token", "signature": "def generate_token(cls, user, algorithm_used='HS256', **kwargs)" }, { "docstring": "Method for decoding token.", "name": "decode_token", "signature": "def decode_token(cls, token, algorithms_used=['HS2...
2
null
Implement the Python class `TokenGenerator` described below. Class description: Class for Generating JWT token and decode them. Method signatures and docstrings: - def generate_token(cls, user, algorithm_used='HS256', **kwargs): Method for generating token. - def decode_token(cls, token, algorithms_used=['HS256'], **...
Implement the Python class `TokenGenerator` described below. Class description: Class for Generating JWT token and decode them. Method signatures and docstrings: - def generate_token(cls, user, algorithm_used='HS256', **kwargs): Method for generating token. - def decode_token(cls, token, algorithms_used=['HS256'], **...
6bcf64c03f0e47f2c11e5dbbf36c87a0ba8a36e6
<|skeleton|> class TokenGenerator: """Class for Generating JWT token and decode them.""" def generate_token(cls, user, algorithm_used='HS256', **kwargs): """Method for generating token.""" <|body_0|> def decode_token(cls, token, algorithms_used=['HS256'], **kwargs): """Method for d...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TokenGenerator: """Class for Generating JWT token and decode them.""" def generate_token(cls, user, algorithm_used='HS256', **kwargs): """Method for generating token.""" payload = {'email': user.email} payload.update(kwargs) token = jwt.encode(payload, cls.secret, algorith...
the_stack_v2_python_sparse
backend/backend/apps/accounts/utils.py
faizalsha/symptom-checker
train
0
312f87f2fde251181b6f6e7c0f3fb42655c6f018
[ "def backtrack(i, tmp_num, tmp):\n if tmp_num == target:\n tmp = sorted(tmp)\n if tmp not in res:\n res.append(tmp)\n return\n return\n if i == n or tmp_num > target:\n return\n backtrack(i + 1, tmp_num + candidates[i], tmp + [candidates[i]])\n backtrack...
<|body_start_0|> def backtrack(i, tmp_num, tmp): if tmp_num == target: tmp = sorted(tmp) if tmp not in res: res.append(tmp) return return if i == n or tmp_num > target: return ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def combinationSum21(self, candidates, target): """:type candidates: List[int] :type target: int :rtype: List[List[int]]""" <|body_0|> def combinationSum2(self, candidates, target): """:param candidates: :param target: :return:""" <|body_1|> <|end_...
stack_v2_sparse_classes_75kplus_train_006563
1,580
no_license
[ { "docstring": ":type candidates: List[int] :type target: int :rtype: List[List[int]]", "name": "combinationSum21", "signature": "def combinationSum21(self, candidates, target)" }, { "docstring": ":param candidates: :param target: :return:", "name": "combinationSum2", "signature": "def c...
2
stack_v2_sparse_classes_30k_train_013270
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def combinationSum21(self, candidates, target): :type candidates: List[int] :type target: int :rtype: List[List[int]] - def combinationSum2(self, candidates, target): :param cand...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def combinationSum21(self, candidates, target): :type candidates: List[int] :type target: int :rtype: List[List[int]] - def combinationSum2(self, candidates, target): :param cand...
a91a758ab52d8615366a46b168181c04a92a793b
<|skeleton|> class Solution: def combinationSum21(self, candidates, target): """:type candidates: List[int] :type target: int :rtype: List[List[int]]""" <|body_0|> def combinationSum2(self, candidates, target): """:param candidates: :param target: :return:""" <|body_1|> <|end_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def combinationSum21(self, candidates, target): """:type candidates: List[int] :type target: int :rtype: List[List[int]]""" def backtrack(i, tmp_num, tmp): if tmp_num == target: tmp = sorted(tmp) if tmp not in res: res.a...
the_stack_v2_python_sparse
算法/40. 组合总和 II.py
Confucius-hui/LeetCode
train
0
5cfd1037c434e94fb43c99cbe696634bbc5ed8c6
[ "self.method = method\nself.M = M\nself.snr = snr\nself.dt = dt\nself.z = z\nself.mirror = mirror\nself.p = p\nself.like = 0.0\nA = fstat.snr_f_to_a(self.z, event.get_fsig(mirror))\nself.D, self.cosi, _, _ = fstat.a_to_params(A)\nif method is not 'time' and method is not 'marg':\n self.approx_like(event, Dmax)\n...
<|body_start_0|> self.method = method self.M = M self.snr = snr self.dt = dt self.z = z self.mirror = mirror self.p = p self.like = 0.0 A = fstat.snr_f_to_a(self.z, event.get_fsig(mirror)) self.D, self.cosi, _, _ = fstat.a_to_params(A) ...
class to hold the details of a localization method
localization
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class localization: """class to hold the details of a localization method""" def __init__(self, method, M, snr, dt, z, event, mirror=False, p=0.9, Dmax=1000, area=0): """Initialization :param method: how we do localization, one of "time", "coh", "left, "right", "marg" :param M: localizatio...
stack_v2_sparse_classes_75kplus_train_006564
29,171
no_license
[ { "docstring": "Initialization :param method: how we do localization, one of \"time\", \"coh\", \"left, \"right\", \"marg\" :param M: localization matrix :param snr: snr of event :param dt: time offset :param z: complex snr :param event: details of event :param mirror: are we looking in the mirror location :par...
4
stack_v2_sparse_classes_30k_train_027044
Implement the Python class `localization` described below. Class description: class to hold the details of a localization method Method signatures and docstrings: - def __init__(self, method, M, snr, dt, z, event, mirror=False, p=0.9, Dmax=1000, area=0): Initialization :param method: how we do localization, one of "t...
Implement the Python class `localization` described below. Class description: class to hold the details of a localization method Method signatures and docstrings: - def __init__(self, method, M, snr, dt, z, event, mirror=False, p=0.9, Dmax=1000, area=0): Initialization :param method: how we do localization, one of "t...
22342a3bc81e4a12ff506c76f24167d5d29b26d1
<|skeleton|> class localization: """class to hold the details of a localization method""" def __init__(self, method, M, snr, dt, z, event, mirror=False, p=0.9, Dmax=1000, area=0): """Initialization :param method: how we do localization, one of "time", "coh", "left, "right", "marg" :param M: localizatio...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class localization: """class to hold the details of a localization method""" def __init__(self, method, M, snr, dt, z, event, mirror=False, p=0.9, Dmax=1000, area=0): """Initialization :param method: how we do localization, one of "time", "coh", "left, "right", "marg" :param M: localization matrix :par...
the_stack_v2_python_sparse
simple_pe/localize.py
grferna/GW150914_phase
train
0
d2478bf7780aa015a8d60e209b9e6684fa6a9346
[ "self.glacier_retrieval_type = glacier_retrieval_type\nself.restore_objects = restore_objects\nself.search_job_uid = search_job_uid\nself.task_name = task_name\nself.vault_id = vault_id", "if dictionary is None:\n return None\nglacier_retrieval_type = dictionary.get('glacierRetrievalType')\nrestore_objects = N...
<|body_start_0|> self.glacier_retrieval_type = glacier_retrieval_type self.restore_objects = restore_objects self.search_job_uid = search_job_uid self.task_name = task_name self.vault_id = vault_id <|end_body_0|> <|body_start_1|> if dictionary is None: return...
Implementation of the 'CreateRemoteVaultRestoreTaskParameters' model. Specifies settings required to create a task that restores the index and/or the Snapshots of a Protection Job from a remote Vault to the current Cluster. Attributes: glacier_retrieval_type (GlacierRetrievalTypeEnum): Specifies the way data needs to b...
CreateRemoteVaultRestoreTaskParameters
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreateRemoteVaultRestoreTaskParameters: """Implementation of the 'CreateRemoteVaultRestoreTaskParameters' model. Specifies settings required to create a task that restores the index and/or the Snapshots of a Protection Job from a remote Vault to the current Cluster. Attributes: glacier_retrieval_...
stack_v2_sparse_classes_75kplus_train_006565
4,811
permissive
[ { "docstring": "Constructor for the CreateRemoteVaultRestoreTaskParameters class", "name": "__init__", "signature": "def __init__(self, glacier_retrieval_type=None, restore_objects=None, search_job_uid=None, task_name=None, vault_id=None)" }, { "docstring": "Creates an instance of this model fro...
2
stack_v2_sparse_classes_30k_train_004226
Implement the Python class `CreateRemoteVaultRestoreTaskParameters` described below. Class description: Implementation of the 'CreateRemoteVaultRestoreTaskParameters' model. Specifies settings required to create a task that restores the index and/or the Snapshots of a Protection Job from a remote Vault to the current ...
Implement the Python class `CreateRemoteVaultRestoreTaskParameters` described below. Class description: Implementation of the 'CreateRemoteVaultRestoreTaskParameters' model. Specifies settings required to create a task that restores the index and/or the Snapshots of a Protection Job from a remote Vault to the current ...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class CreateRemoteVaultRestoreTaskParameters: """Implementation of the 'CreateRemoteVaultRestoreTaskParameters' model. Specifies settings required to create a task that restores the index and/or the Snapshots of a Protection Job from a remote Vault to the current Cluster. Attributes: glacier_retrieval_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CreateRemoteVaultRestoreTaskParameters: """Implementation of the 'CreateRemoteVaultRestoreTaskParameters' model. Specifies settings required to create a task that restores the index and/or the Snapshots of a Protection Job from a remote Vault to the current Cluster. Attributes: glacier_retrieval_type (Glacier...
the_stack_v2_python_sparse
cohesity_management_sdk/models/create_remote_vault_restore_task_parameters.py
cohesity/management-sdk-python
train
24
997cb47e5216f9d14f0ebc265fc1730636cdf7d2
[ "paths = files_conf.get('paths')\nfields = {f.name: f for f in dataclasses.fields(cls)}\ninclude = files_conf.get('include', fields['include'].default_factory())\nexclude = files_conf.get('exclude', fields['exclude'].default_factory())\nif not paths:\n raise ValueError('You must define the paths when using scrip...
<|body_start_0|> paths = files_conf.get('paths') fields = {f.name: f for f in dataclasses.fields(cls)} include = files_conf.get('include', fields['include'].default_factory()) exclude = files_conf.get('exclude', fields['exclude'].default_factory()) if not paths: raise...
Configure files passed to the script. This section allows you to inject a set of files into the script as the ``{{ files }}`` expression. This configuration allows you to flexibly define what files are collected by specifying the *paths* of interest and further refining the list by *include* and *exclude* which act as ...
FilesCollection
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FilesCollection: """Configure files passed to the script. This section allows you to inject a set of files into the script as the ``{{ files }}`` expression. This configuration allows you to flexibly define what files are collected by specifying the *paths* of interest and further refining the li...
stack_v2_sparse_classes_75kplus_train_006566
3,452
permissive
[ { "docstring": "Load from config dict", "name": "from_config", "signature": "def from_config(cls: Type['FilesCollection'], files_conf: YamlConf) -> 'FilesCollection'" }, { "docstring": "Return a full whitelist for use with `fs.filtered_walk()`", "name": "whitelist", "signature": "def whi...
3
stack_v2_sparse_classes_30k_train_046534
Implement the Python class `FilesCollection` described below. Class description: Configure files passed to the script. This section allows you to inject a set of files into the script as the ``{{ files }}`` expression. This configuration allows you to flexibly define what files are collected by specifying the *paths* ...
Implement the Python class `FilesCollection` described below. Class description: Configure files passed to the script. This section allows you to inject a set of files into the script as the ``{{ files }}`` expression. This configuration allows you to flexibly define what files are collected by specifying the *paths* ...
3b4242ace18e73eb0298b4a7a677425f5eac6a68
<|skeleton|> class FilesCollection: """Configure files passed to the script. This section allows you to inject a set of files into the script as the ``{{ files }}`` expression. This configuration allows you to flexibly define what files are collected by specifying the *paths* of interest and further refining the li...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FilesCollection: """Configure files passed to the script. This section allows you to inject a set of files into the script as the ``{{ files }}`` expression. This configuration allows you to flexibly define what files are collected by specifying the *paths* of interest and further refining the list by *includ...
the_stack_v2_python_sparse
src/peltak/core/types.py
novopl/peltak
train
7
14f4f745de1a0f5b90ab3b87677839c01b1150bf
[ "Instruction.__init__(self, input)\nself.device = input[self.start]\nself.device_name = input[self.start + 1]\nself.device_info = input[self.start + 1:]", "if self.device == 'host':\n new_device = Host(self.device_info)\nelif self.device == 'hub':\n new_device = Hub(self.device_info)\nelif self.device == 's...
<|body_start_0|> Instruction.__init__(self, input) self.device = input[self.start] self.device_name = input[self.start + 1] self.device_info = input[self.start + 1:] <|end_body_0|> <|body_start_1|> if self.device == 'host': new_device = Host(self.device_info) ...
Create
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Create: def __init__(self, input): """Init create instruction information""" <|body_0|> def execute(self, net_stat: Status): """Execute create Instruction""" <|body_1|> <|end_skeleton|> <|body_start_0|> Instruction.__init__(self, input) self...
stack_v2_sparse_classes_75kplus_train_006567
1,193
no_license
[ { "docstring": "Init create instruction information", "name": "__init__", "signature": "def __init__(self, input)" }, { "docstring": "Execute create Instruction", "name": "execute", "signature": "def execute(self, net_stat: Status)" } ]
2
stack_v2_sparse_classes_30k_val_001111
Implement the Python class `Create` described below. Class description: Implement the Create class. Method signatures and docstrings: - def __init__(self, input): Init create instruction information - def execute(self, net_stat: Status): Execute create Instruction
Implement the Python class `Create` described below. Class description: Implement the Create class. Method signatures and docstrings: - def __init__(self, input): Init create instruction information - def execute(self, net_stat: Status): Execute create Instruction <|skeleton|> class Create: def __init__(self, i...
b15d9e8c511c9a78c469e30f597e08504d2969c7
<|skeleton|> class Create: def __init__(self, input): """Init create instruction information""" <|body_0|> def execute(self, net_stat: Status): """Execute create Instruction""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Create: def __init__(self, input): """Init create instruction information""" Instruction.__init__(self, input) self.device = input[self.start] self.device_name = input[self.start + 1] self.device_info = input[self.start + 1:] def execute(self, net_stat: Status): ...
the_stack_v2_python_sparse
instructions/create.py
University-Projects-UH/physical-layer
train
0
56eeab54fb6d4321ce648423f995a933bbec8eda
[ "self.city = city\nself.state = state\nself.country = country\nself.postal_code = postal_code\nself.address_line_1 = address_line_1\nself.address_line_2 = address_line_2\nself.additional_properties = additional_properties", "if dictionary is None:\n return None\ncity = dictionary.get('city')\nstate = dictionar...
<|body_start_0|> self.city = city self.state = state self.country = country self.postal_code = postal_code self.address_line_1 = address_line_1 self.address_line_2 = address_line_2 self.additional_properties = additional_properties <|end_body_0|> <|body_start_1|>...
Implementation of the 'Institution Address' model. The address for the financial institution Attributes: city (string): The city of the institution’s headquarters state (string): Two-letter code for the state of the institution’s headquarters country (string): The country of the institution’s headquarters postal_code (...
InstitutionAddress
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InstitutionAddress: """Implementation of the 'Institution Address' model. The address for the financial institution Attributes: city (string): The city of the institution’s headquarters state (string): Two-letter code for the state of the institution’s headquarters country (string): The country o...
stack_v2_sparse_classes_75kplus_train_006568
3,105
permissive
[ { "docstring": "Constructor for the InstitutionAddress class", "name": "__init__", "signature": "def __init__(self, city=None, state=None, country=None, postal_code=None, address_line_1=None, address_line_2=None, additional_properties={})" }, { "docstring": "Creates an instance of this model fro...
2
stack_v2_sparse_classes_30k_train_013978
Implement the Python class `InstitutionAddress` described below. Class description: Implementation of the 'Institution Address' model. The address for the financial institution Attributes: city (string): The city of the institution’s headquarters state (string): Two-letter code for the state of the institution’s headq...
Implement the Python class `InstitutionAddress` described below. Class description: Implementation of the 'Institution Address' model. The address for the financial institution Attributes: city (string): The city of the institution’s headquarters state (string): Two-letter code for the state of the institution’s headq...
b2ab1ded435db75c78d42261f5e4acd2a3061487
<|skeleton|> class InstitutionAddress: """Implementation of the 'Institution Address' model. The address for the financial institution Attributes: city (string): The city of the institution’s headquarters state (string): Two-letter code for the state of the institution’s headquarters country (string): The country o...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InstitutionAddress: """Implementation of the 'Institution Address' model. The address for the financial institution Attributes: city (string): The city of the institution’s headquarters state (string): Two-letter code for the state of the institution’s headquarters country (string): The country of the institu...
the_stack_v2_python_sparse
finicityapi/models/institution_address.py
monarchmoney/finicity-python
train
0
f5aeacbf3509ee7c4a8ec0445f76c7bd00ac0551
[ "roman_int = {'I': 1, 'IV': 4, 'V': 5, 'IX': 9, 'X': 10, 'XL': 40, 'L': 50, 'XC': 90, 'C': 100, 'CD': 400, 'D': 500, 'CM': 900, 'M': 1000}\nresult = 0\ni = 0\nn = len(string)\nwhile i < n:\n if i < n - 1 and roman_int[string[i]] < roman_int[string[i + 1]]:\n result += roman_int[string[i:i + 2]]\n i...
<|body_start_0|> roman_int = {'I': 1, 'IV': 4, 'V': 5, 'IX': 9, 'X': 10, 'XL': 40, 'L': 50, 'XC': 90, 'C': 100, 'CD': 400, 'D': 500, 'CM': 900, 'M': 1000} result = 0 i = 0 n = len(string) while i < n: if i < n - 1 and roman_int[string[i]] < roman_int[string[i + 1]]: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def roman_to_int(self, string): """Converts Roman numerals to decimal integer. Intuitive algorithm. Algorithm description: 1) Scan the string from left to right. 2) If the value of current Roman character is less than the value of next Roman character, it means that we need to ...
stack_v2_sparse_classes_75kplus_train_006569
2,904
no_license
[ { "docstring": "Converts Roman numerals to decimal integer. Intuitive algorithm. Algorithm description: 1) Scan the string from left to right. 2) If the value of current Roman character is less than the value of next Roman character, it means that we need to take 2 characters to evaluate number. 3) Otherwise, w...
2
stack_v2_sparse_classes_30k_train_042082
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def roman_to_int(self, string): Converts Roman numerals to decimal integer. Intuitive algorithm. Algorithm description: 1) Scan the string from left to right. 2) If the value of ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def roman_to_int(self, string): Converts Roman numerals to decimal integer. Intuitive algorithm. Algorithm description: 1) Scan the string from left to right. 2) If the value of ...
71b722ddfe8da04572e527b055cf8723d5c87bbf
<|skeleton|> class Solution: def roman_to_int(self, string): """Converts Roman numerals to decimal integer. Intuitive algorithm. Algorithm description: 1) Scan the string from left to right. 2) If the value of current Roman character is less than the value of next Roman character, it means that we need to ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def roman_to_int(self, string): """Converts Roman numerals to decimal integer. Intuitive algorithm. Algorithm description: 1) Scan the string from left to right. 2) If the value of current Roman character is less than the value of next Roman character, it means that we need to take 2 charact...
the_stack_v2_python_sparse
Strings/roman_numerals/roman_to_integer.py
vladn90/Algorithms
train
0
e40652e01f68372d46216cd20139c4a9b2b49007
[ "num_of_products_optimized = 0\nnum_of_products_excluded = 0\nself._shopping_exclusion_config = config_parser.get_config_contents(_SHOPPING_EXCLUSION_OPTIMIZER_CONFIG_OVERRIDE_KEY, _SHOPPING_EXCLUSION_OPTIMIZER_CONFIG_FILE_NAME.format(language))\nself.shopping_removal_patterns_exact_match = frozenset(self._shopping...
<|body_start_0|> num_of_products_optimized = 0 num_of_products_excluded = 0 self._shopping_exclusion_config = config_parser.get_config_contents(_SHOPPING_EXCLUSION_OPTIMIZER_CONFIG_OVERRIDE_KEY, _SHOPPING_EXCLUSION_OPTIMIZER_CONFIG_FILE_NAME.format(language)) self.shopping_removal_patter...
An optimizer that detects and excludes products from Shopping Ads.
ShoppingExclusionOptimizer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShoppingExclusionOptimizer: """An optimizer that detects and excludes products from Shopping Ads.""" def _optimize(self, product_batch: Dict[str, Any], language: str, country: str, currency: str) -> optimization_result_counts.OptimizationResultCounts: """Runs the optimization. Args: ...
stack_v2_sparse_classes_75kplus_train_006570
6,253
permissive
[ { "docstring": "Runs the optimization. Args: product_batch: A batch of product data. language: The language to use for this optimizer. country: The country to use for this optimizer. currency: The currency to use for this optimizer. Returns: The number of products affected by this optimization.", "name": "_...
2
null
Implement the Python class `ShoppingExclusionOptimizer` described below. Class description: An optimizer that detects and excludes products from Shopping Ads. Method signatures and docstrings: - def _optimize(self, product_batch: Dict[str, Any], language: str, country: str, currency: str) -> optimization_result_count...
Implement the Python class `ShoppingExclusionOptimizer` described below. Class description: An optimizer that detects and excludes products from Shopping Ads. Method signatures and docstrings: - def _optimize(self, product_batch: Dict[str, Any], language: str, country: str, currency: str) -> optimization_result_count...
58588ce54f8ea065fdc7501398b1b2e10f8adc41
<|skeleton|> class ShoppingExclusionOptimizer: """An optimizer that detects and excludes products from Shopping Ads.""" def _optimize(self, product_batch: Dict[str, Any], language: str, country: str, currency: str) -> optimization_result_counts.OptimizationResultCounts: """Runs the optimization. Args: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ShoppingExclusionOptimizer: """An optimizer that detects and excludes products from Shopping Ads.""" def _optimize(self, product_batch: Dict[str, Any], language: str, country: str, currency: str) -> optimization_result_counts.OptimizationResultCounts: """Runs the optimization. Args: product_batch...
the_stack_v2_python_sparse
shoptimizer_api/optimizers_builtin/shopping_exclusion_optimizer.py
google/shoptimizer
train
43
de9d082a826973ed1716e46a5ca31eecf880bb8d
[ "assert os.path.exists(path)\ndata = np.load(path, allow_pickle=True).tolist()\nreturn data", "assert isinstance(info1, dict) and isinstance(info2, dict)\ncheck_data(info1, info2)\nself.diff_dict = compute_diff(info1, info2)", "logger = init_logger(path)\npassed = check_print_diff(self.diff_dict, diff_method=di...
<|body_start_0|> assert os.path.exists(path) data = np.load(path, allow_pickle=True).tolist() return data <|end_body_0|> <|body_start_1|> assert isinstance(info1, dict) and isinstance(info2, dict) check_data(info1, info2) self.diff_dict = compute_diff(info1, info2) <|end...
ReprodDiffHelper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReprodDiffHelper: def load_info(self, path: str): """加载字典文件 :param path: :return:""" <|body_0|> def compare_info(self, info1: dict, info2: dict): """对比diff :param info1: :param info2: :return:""" <|body_1|> def report(self, diff_method='mean', diff_thres...
stack_v2_sparse_classes_75kplus_train_006571
1,970
permissive
[ { "docstring": "加载字典文件 :param path: :return:", "name": "load_info", "signature": "def load_info(self, path: str)" }, { "docstring": "对比diff :param info1: :param info2: :return:", "name": "compare_info", "signature": "def compare_info(self, info1: dict, info2: dict)" }, { "docstri...
3
null
Implement the Python class `ReprodDiffHelper` described below. Class description: Implement the ReprodDiffHelper class. Method signatures and docstrings: - def load_info(self, path: str): 加载字典文件 :param path: :return: - def compare_info(self, info1: dict, info2: dict): 对比diff :param info1: :param info2: :return: - def...
Implement the Python class `ReprodDiffHelper` described below. Class description: Implement the ReprodDiffHelper class. Method signatures and docstrings: - def load_info(self, path: str): 加载字典文件 :param path: :return: - def compare_info(self, info1: dict, info2: dict): 对比diff :param info1: :param info2: :return: - def...
8042c21b690ffc0162095e749a41b94dd38732da
<|skeleton|> class ReprodDiffHelper: def load_info(self, path: str): """加载字典文件 :param path: :return:""" <|body_0|> def compare_info(self, info1: dict, info2: dict): """对比diff :param info1: :param info2: :return:""" <|body_1|> def report(self, diff_method='mean', diff_thres...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ReprodDiffHelper: def load_info(self, path: str): """加载字典文件 :param path: :return:""" assert os.path.exists(path) data = np.load(path, allow_pickle=True).tolist() return data def compare_info(self, info1: dict, info2: dict): """对比diff :param info1: :param info2: :re...
the_stack_v2_python_sparse
tutorials/reprod_log/reprod_log/ReprodDiffHelper.py
PaddlePaddle/models
train
7,633
fd71f9c39517076c0db12ecd825d1cc34e751ca1
[ "cli = self.client\nresp = cli.get('/beeswax/report_gen')\nassert_true(resp.status_code, 200)\nresp = cli.post('/beeswax/report_gen', {'columns-next_form_id': '1', 'columns-0-_exists': 'True', 'columns-0-col': '*', 'columns-0-display': 'on', 'columns-0-source': 'table', 'columns-0-table': 'test', 'union.conds-next_...
<|body_start_0|> cli = self.client resp = cli.get('/beeswax/report_gen') assert_true(resp.status_code, 200) resp = cli.post('/beeswax/report_gen', {'columns-next_form_id': '1', 'columns-0-_exists': 'True', 'columns-0-col': '*', 'columns-0-display': 'on', 'columns-0-source': 'table', 'col...
Tests for report generator that require a running Hadoop
TestReportGenWithHadoop
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestReportGenWithHadoop: """Tests for report generator that require a running Hadoop""" def test_report_gen_view(self): """Test report gen view logic and query generation. It requires Hive because report gen automatically gathers all the table names.""" <|body_0|> def te...
stack_v2_sparse_classes_75kplus_train_006572
8,139
permissive
[ { "docstring": "Test report gen view logic and query generation. It requires Hive because report gen automatically gathers all the table names.", "name": "test_report_gen_view", "signature": "def test_report_gen_view(self)" }, { "docstring": "Test report design view and interaction", "name":...
2
null
Implement the Python class `TestReportGenWithHadoop` described below. Class description: Tests for report generator that require a running Hadoop Method signatures and docstrings: - def test_report_gen_view(self): Test report gen view logic and query generation. It requires Hive because report gen automatically gathe...
Implement the Python class `TestReportGenWithHadoop` described below. Class description: Tests for report generator that require a running Hadoop Method signatures and docstrings: - def test_report_gen_view(self): Test report gen view logic and query generation. It requires Hive because report gen automatically gathe...
82f2de44789ff5a981ed725175bae7944832d1e9
<|skeleton|> class TestReportGenWithHadoop: """Tests for report generator that require a running Hadoop""" def test_report_gen_view(self): """Test report gen view logic and query generation. It requires Hive because report gen automatically gathers all the table names.""" <|body_0|> def te...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestReportGenWithHadoop: """Tests for report generator that require a running Hadoop""" def test_report_gen_view(self): """Test report gen view logic and query generation. It requires Hive because report gen automatically gathers all the table names.""" cli = self.client resp = cl...
the_stack_v2_python_sparse
apps/beeswax/src/beeswax/report/tests.py
civascu/hue
train
0
d8efa965b2c94d7618bd9fafe511a61f0614a385
[ "if not filepath:\n raise Exception('ERROR: Invalid dataset path.')\nself.type = type\nself.filepath = filepath\nself.up_sites = up_sites\nself.down_sites = down_sites\nself.donor_site = []\nself.acceptor_site = []\nself.neg_donor_site = []\nself.neg_acceptor_site = []\nif self.type not in {'train', 'test'}:\n ...
<|body_start_0|> if not filepath: raise Exception('ERROR: Invalid dataset path.') self.type = type self.filepath = filepath self.up_sites = up_sites self.down_sites = down_sites self.donor_site = [] self.acceptor_site = [] self.neg_donor_site =...
Sequence
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Sequence: def __init__(self, filepath: str, type: str='train', up_sites: int=5, down_sites: int=5) -> None: """All kinds of splice site sequences for training. Parameters ---------- filepath: str or path-like The directory path of the dataset. Files in which are txts containing one seque...
stack_v2_sparse_classes_75kplus_train_006573
5,098
no_license
[ { "docstring": "All kinds of splice site sequences for training. Parameters ---------- filepath: str or path-like The directory path of the dataset. Files in which are txts containing one sequence each. type: str (one of \"train\", \"test\") Set the data type. Way of reading would be different. up_sites: int, d...
4
stack_v2_sparse_classes_30k_train_037771
Implement the Python class `Sequence` described below. Class description: Implement the Sequence class. Method signatures and docstrings: - def __init__(self, filepath: str, type: str='train', up_sites: int=5, down_sites: int=5) -> None: All kinds of splice site sequences for training. Parameters ---------- filepath:...
Implement the Python class `Sequence` described below. Class description: Implement the Sequence class. Method signatures and docstrings: - def __init__(self, filepath: str, type: str='train', up_sites: int=5, down_sites: int=5) -> None: All kinds of splice site sequences for training. Parameters ---------- filepath:...
3302ff7222d191f632695f0b9465ec2555f1b0af
<|skeleton|> class Sequence: def __init__(self, filepath: str, type: str='train', up_sites: int=5, down_sites: int=5) -> None: """All kinds of splice site sequences for training. Parameters ---------- filepath: str or path-like The directory path of the dataset. Files in which are txts containing one seque...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Sequence: def __init__(self, filepath: str, type: str='train', up_sites: int=5, down_sites: int=5) -> None: """All kinds of splice site sequences for training. Parameters ---------- filepath: str or path-like The directory path of the dataset. Files in which are txts containing one sequence each. type...
the_stack_v2_python_sparse
Utils/extract.py
Newiz430/SplicePredictor
train
1
d7d224999ff7b83f88102ec8180b88ff057bb825
[ "start_row, start_column, number_of_rows, number_of_columns = bounds\nself.array = array\nself.bounds = bounds\nself.start_row = start_row\nself.start_column = start_column\nself.number_of_rows = number_of_rows\nself.number_of_columns = number_of_columns", "r, c = location\nif not (0 <= r and r < self.number_of_r...
<|body_start_0|> start_row, start_column, number_of_rows, number_of_columns = bounds self.array = array self.bounds = bounds self.start_row = start_row self.start_column = start_column self.number_of_rows = number_of_rows self.number_of_columns = number_of_columns...
A class representing an instance of a peak-finding problem.
PeakProblem
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PeakProblem: """A class representing an instance of a peak-finding problem.""" def __init__(self, array, bounds): """A method for initializing an instance of the PeakProblem class. Takes an array and an argument indicating which rows to include. RUNTIME: O(1)""" <|body_0|> ...
stack_v2_sparse_classes_75kplus_train_006574
2,953
permissive
[ { "docstring": "A method for initializing an instance of the PeakProblem class. Takes an array and an argument indicating which rows to include. RUNTIME: O(1)", "name": "__init__", "signature": "def __init__(self, array, bounds)" }, { "docstring": "@brief Returns value of the array at the given ...
2
stack_v2_sparse_classes_30k_train_028026
Implement the Python class `PeakProblem` described below. Class description: A class representing an instance of a peak-finding problem. Method signatures and docstrings: - def __init__(self, array, bounds): A method for initializing an instance of the PeakProblem class. Takes an array and an argument indicating whic...
Implement the Python class `PeakProblem` described below. Class description: A class representing an instance of a peak-finding problem. Method signatures and docstrings: - def __init__(self, array, bounds): A method for initializing an instance of the PeakProblem class. Takes an array and an argument indicating whic...
ad067fd4e605c230ea87bdc36cc38341e681a1e0
<|skeleton|> class PeakProblem: """A class representing an instance of a peak-finding problem.""" def __init__(self, array, bounds): """A method for initializing an instance of the PeakProblem class. Takes an array and an argument indicating which rows to include. RUNTIME: O(1)""" <|body_0|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PeakProblem: """A class representing an instance of a peak-finding problem.""" def __init__(self, array, bounds): """A method for initializing an instance of the PeakProblem class. Takes an array and an argument indicating which rows to include. RUNTIME: O(1)""" start_row, start_column, n...
the_stack_v2_python_sparse
Voltron/Voltron/Algorithms/PeakFinding/PeakProblem.py
ernestyalumni/HrdwCCppCUDA
train
3
4ec37c35833213991d066b04dbe89192f9678f6d
[ "self.year = kwargs.pop('year')\nself.proyectos = []\nself.vol_total_inv_prev_proy = {}\nself.ayudas_prv_proy = {}\nself.financiacion_prv_proy = {}\nself.vpi_retribuible_prv_proy = {}\nself.generated_proy = []\nself.ids = {}\nsuper(PRO, self).__init__(**kwargs)", "ids_resums = get_resum_any_id(self.connection, se...
<|body_start_0|> self.year = kwargs.pop('year') self.proyectos = [] self.vol_total_inv_prev_proy = {} self.ayudas_prv_proy = {} self.financiacion_prv_proy = {} self.vpi_retribuible_prv_proy = {} self.generated_proy = [] self.ids = {} super(PRO, sel...
Class to generate proyectos of 4667
PRO
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PRO: """Class to generate proyectos of 4667""" def __init__(self, **kwargs): """Class constructor :param kwargs: :type kwargs: dict""" <|body_0|> def get_sequence(self): """Generates the sequence of ids to make the report :return: List of ids :rtype: list""" ...
stack_v2_sparse_classes_75kplus_train_006575
3,866
no_license
[ { "docstring": "Class constructor :param kwargs: :type kwargs: dict", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "Generates the sequence of ids to make the report :return: List of ids :rtype: list", "name": "get_sequence", "signature": "def get_sequ...
3
null
Implement the Python class `PRO` described below. Class description: Class to generate proyectos of 4667 Method signatures and docstrings: - def __init__(self, **kwargs): Class constructor :param kwargs: :type kwargs: dict - def get_sequence(self): Generates the sequence of ids to make the report :return: List of ids...
Implement the Python class `PRO` described below. Class description: Class to generate proyectos of 4667 Method signatures and docstrings: - def __init__(self, **kwargs): Class constructor :param kwargs: :type kwargs: dict - def get_sequence(self): Generates the sequence of ids to make the report :return: List of ids...
c8b1ede6cb55dff4385efbe1b8a0afe8c4a4f48d
<|skeleton|> class PRO: """Class to generate proyectos of 4667""" def __init__(self, **kwargs): """Class constructor :param kwargs: :type kwargs: dict""" <|body_0|> def get_sequence(self): """Generates the sequence of ids to make the report :return: List of ids :rtype: list""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PRO: """Class to generate proyectos of 4667""" def __init__(self, **kwargs): """Class constructor :param kwargs: :type kwargs: dict""" self.year = kwargs.pop('year') self.proyectos = [] self.vol_total_inv_prev_proy = {} self.ayudas_prv_proy = {} self.financ...
the_stack_v2_python_sparse
libcnmc/res_4667/PRO.py
gisce/libCNMC
train
7
1dd8840793332f3881cebaa3f1442f2d61a55931
[ "self.TIDAL_CLIENT_VERSION = '1.9.1'\nself.TIDAL_API_BASE = 'https://api.tidalhifi.com/v1/'\nself.username = username\nself.token = token\nself.unique_id = str(uuid.uuid4()).replace('-', '')[16:]\nself.auth(password)\npassword = None", "postParams = {'username': self.username, 'password': password, 'token': self....
<|body_start_0|> self.TIDAL_CLIENT_VERSION = '1.9.1' self.TIDAL_API_BASE = 'https://api.tidalhifi.com/v1/' self.username = username self.token = token self.unique_id = str(uuid.uuid4()).replace('-', '')[16:] self.auth(password) password = None <|end_body_0|> <|bo...
Tidal session object which can be used to communicate with Tidal servers
TidalSession
[ "ISC" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TidalSession: """Tidal session object which can be used to communicate with Tidal servers""" def __init__(self, username, password, token='4zx46pyr9o8qZNRw'): """Initiate a new session""" <|body_0|> def auth(self, password): """Attempts to authorize and create a ...
stack_v2_sparse_classes_75kplus_train_006576
8,327
permissive
[ { "docstring": "Initiate a new session", "name": "__init__", "signature": "def __init__(self, username, password, token='4zx46pyr9o8qZNRw')" }, { "docstring": "Attempts to authorize and create a new valid session", "name": "auth", "signature": "def auth(self, password)" }, { "doc...
4
stack_v2_sparse_classes_30k_val_000360
Implement the Python class `TidalSession` described below. Class description: Tidal session object which can be used to communicate with Tidal servers Method signatures and docstrings: - def __init__(self, username, password, token='4zx46pyr9o8qZNRw'): Initiate a new session - def auth(self, password): Attempts to au...
Implement the Python class `TidalSession` described below. Class description: Tidal session object which can be used to communicate with Tidal servers Method signatures and docstrings: - def __init__(self, username, password, token='4zx46pyr9o8qZNRw'): Initiate a new session - def auth(self, password): Attempts to au...
2a7e339b97f173efa319abc5e4ec8fc9172f1505
<|skeleton|> class TidalSession: """Tidal session object which can be used to communicate with Tidal servers""" def __init__(self, username, password, token='4zx46pyr9o8qZNRw'): """Initiate a new session""" <|body_0|> def auth(self, password): """Attempts to authorize and create a ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TidalSession: """Tidal session object which can be used to communicate with Tidal servers""" def __init__(self, username, password, token='4zx46pyr9o8qZNRw'): """Initiate a new session""" self.TIDAL_CLIENT_VERSION = '1.9.1' self.TIDAL_API_BASE = 'https://api.tidalhifi.com/v1/' ...
the_stack_v2_python_sparse
bin/redsea/tidal_api.py
SultanSGillani/dotfiles
train
7
63595358a0cadb80b9cb932b540e470864ea69d2
[ "self.zero = LinkedList(0)\nself.one = LinkedList(1)\nself.two = LinkedList(2)\nself.three = LinkedList(3)\nself.four = LinkedList(4)\nself.five = LinkedList(5)\nself.six = LinkedList(6)\nself.seven = LinkedList(7)\nself.eight = LinkedList(8)\nself.nine = LinkedList(9)\nself.zero.next = self.one\nself.one.next = se...
<|body_start_0|> self.zero = LinkedList(0) self.one = LinkedList(1) self.two = LinkedList(2) self.three = LinkedList(3) self.four = LinkedList(4) self.five = LinkedList(5) self.six = LinkedList(6) self.seven = LinkedList(7) self.eight = LinkedList(...
Class with unittests for RemoveKthNodeFromEnd.py
test_RemoveKthNodeFromEnd
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class test_RemoveKthNodeFromEnd: """Class with unittests for RemoveKthNodeFromEnd.py""" def SetUp(self): """Set Up input list.""" <|body_0|> def test_RemoveKthNodeFromEnd(self): """Checks if output is correct.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_006577
1,607
no_license
[ { "docstring": "Set Up input list.", "name": "SetUp", "signature": "def SetUp(self)" }, { "docstring": "Checks if output is correct.", "name": "test_RemoveKthNodeFromEnd", "signature": "def test_RemoveKthNodeFromEnd(self)" } ]
2
stack_v2_sparse_classes_30k_train_010898
Implement the Python class `test_RemoveKthNodeFromEnd` described below. Class description: Class with unittests for RemoveKthNodeFromEnd.py Method signatures and docstrings: - def SetUp(self): Set Up input list. - def test_RemoveKthNodeFromEnd(self): Checks if output is correct.
Implement the Python class `test_RemoveKthNodeFromEnd` described below. Class description: Class with unittests for RemoveKthNodeFromEnd.py Method signatures and docstrings: - def SetUp(self): Set Up input list. - def test_RemoveKthNodeFromEnd(self): Checks if output is correct. <|skeleton|> class test_RemoveKthNode...
3aa62ad36c3b06b2a3b05f1f8e2a9e21d68b371f
<|skeleton|> class test_RemoveKthNodeFromEnd: """Class with unittests for RemoveKthNodeFromEnd.py""" def SetUp(self): """Set Up input list.""" <|body_0|> def test_RemoveKthNodeFromEnd(self): """Checks if output is correct.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class test_RemoveKthNodeFromEnd: """Class with unittests for RemoveKthNodeFromEnd.py""" def SetUp(self): """Set Up input list.""" self.zero = LinkedList(0) self.one = LinkedList(1) self.two = LinkedList(2) self.three = LinkedList(3) self.four = LinkedList(4) ...
the_stack_v2_python_sparse
AlgoExpert_algorithms/Medium/RemoveKthNodeFromEnd/test_RemoveKthNodeFromEnd.py
JakubKazimierski/PythonPortfolio
train
9
475b88a9100055bf82b2084ad2cd78b5ac91437a
[ "assert len(input_list) > 0\nassert number_samples <= len(input_list)\nsuper().__init__(self.PROBLEM_NAME)\nself.input_list = input_list\nself.number_samples = number_samples", "print('Solving {} problem ...'.format(self.PROBLEM_NAME))\ni = 0\nreservoir = [0] * self.number_samples\nfor i in range(self.number_samp...
<|body_start_0|> assert len(input_list) > 0 assert number_samples <= len(input_list) super().__init__(self.PROBLEM_NAME) self.input_list = input_list self.number_samples = number_samples <|end_body_0|> <|body_start_1|> print('Solving {} problem ...'.format(self.PROBLEM_N...
Reservoir Sampling
ReservoirSampling
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReservoirSampling: """Reservoir Sampling""" def __init__(self, input_list, number_samples): """Reservoir Sampling Args: input_list: Contains a list of integers number_samples: Number of elements to sample Returns: None Raises: None""" <|body_0|> def solve(self): ...
stack_v2_sparse_classes_75kplus_train_006578
2,073
no_license
[ { "docstring": "Reservoir Sampling Args: input_list: Contains a list of integers number_samples: Number of elements to sample Returns: None Raises: None", "name": "__init__", "signature": "def __init__(self, input_list, number_samples)" }, { "docstring": "Solve the problem Note: O(n) (runtime) s...
2
stack_v2_sparse_classes_30k_train_048364
Implement the Python class `ReservoirSampling` described below. Class description: Reservoir Sampling Method signatures and docstrings: - def __init__(self, input_list, number_samples): Reservoir Sampling Args: input_list: Contains a list of integers number_samples: Number of elements to sample Returns: None Raises: ...
Implement the Python class `ReservoirSampling` described below. Class description: Reservoir Sampling Method signatures and docstrings: - def __init__(self, input_list, number_samples): Reservoir Sampling Args: input_list: Contains a list of integers number_samples: Number of elements to sample Returns: None Raises: ...
11f4d25cb211740514c119a60962d075a0817abd
<|skeleton|> class ReservoirSampling: """Reservoir Sampling""" def __init__(self, input_list, number_samples): """Reservoir Sampling Args: input_list: Contains a list of integers number_samples: Number of elements to sample Returns: None Raises: None""" <|body_0|> def solve(self): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ReservoirSampling: """Reservoir Sampling""" def __init__(self, input_list, number_samples): """Reservoir Sampling Args: input_list: Contains a list of integers number_samples: Number of elements to sample Returns: None Raises: None""" assert len(input_list) > 0 assert number_sampl...
the_stack_v2_python_sparse
python/problems/sampling/reservoir.py
santhosh-kumar/AlgorithmsAndDataStructures
train
2
eb1858df1d21c2c47a2677f8d4e9c69460929b95
[ "self.failure_time_series = failure_time_series\nself.num_failed_runs = num_failed_runs\nself.num_in_progress_runs = num_in_progress_runs\nself.num_queued_runs = num_queued_runs\nself.num_successful_runs = num_successful_runs\nself.success_time_series = success_time_series", "if dictionary is None:\n return No...
<|body_start_0|> self.failure_time_series = failure_time_series self.num_failed_runs = num_failed_runs self.num_in_progress_runs = num_in_progress_runs self.num_queued_runs = num_queued_runs self.num_successful_runs = num_successful_runs self.success_time_series = success...
Implementation of the 'VaultRunStatsSummary' model. Specifies the stats by run type for each vault run. Attributes: failure_time_series (list of VaultRunInfo): Specifies the time series for the failed runs that ended in the given time frame. num_failed_runs (long|int): Specifies the number of runs that ended in failure...
VaultRunStatsSummary
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VaultRunStatsSummary: """Implementation of the 'VaultRunStatsSummary' model. Specifies the stats by run type for each vault run. Attributes: failure_time_series (list of VaultRunInfo): Specifies the time series for the failed runs that ended in the given time frame. num_failed_runs (long|int): Sp...
stack_v2_sparse_classes_75kplus_train_006579
3,977
permissive
[ { "docstring": "Constructor for the VaultRunStatsSummary class", "name": "__init__", "signature": "def __init__(self, failure_time_series=None, num_failed_runs=None, num_in_progress_runs=None, num_queued_runs=None, num_successful_runs=None, success_time_series=None)" }, { "docstring": "Creates a...
2
null
Implement the Python class `VaultRunStatsSummary` described below. Class description: Implementation of the 'VaultRunStatsSummary' model. Specifies the stats by run type for each vault run. Attributes: failure_time_series (list of VaultRunInfo): Specifies the time series for the failed runs that ended in the given tim...
Implement the Python class `VaultRunStatsSummary` described below. Class description: Implementation of the 'VaultRunStatsSummary' model. Specifies the stats by run type for each vault run. Attributes: failure_time_series (list of VaultRunInfo): Specifies the time series for the failed runs that ended in the given tim...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class VaultRunStatsSummary: """Implementation of the 'VaultRunStatsSummary' model. Specifies the stats by run type for each vault run. Attributes: failure_time_series (list of VaultRunInfo): Specifies the time series for the failed runs that ended in the given time frame. num_failed_runs (long|int): Sp...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VaultRunStatsSummary: """Implementation of the 'VaultRunStatsSummary' model. Specifies the stats by run type for each vault run. Attributes: failure_time_series (list of VaultRunInfo): Specifies the time series for the failed runs that ended in the given time frame. num_failed_runs (long|int): Specifies the n...
the_stack_v2_python_sparse
cohesity_management_sdk/models/vault_run_stats_summary.py
cohesity/management-sdk-python
train
24
5ee5989f9c06c31628e40f28e0d52ce62308b1ac
[ "url = [op_config['server'], 'apis/ads/publisher', op_config['version'], self.__class__.__name__]\nself.__service = DfpWebService(headers, config, op_config, '/'.join(url), lock, logger)\nsuper(PublisherQueryLanguageService, self).__init__(headers, config, op_config, url, 'adspygoogle.dfp', lock, logger)", "metho...
<|body_start_0|> url = [op_config['server'], 'apis/ads/publisher', op_config['version'], self.__class__.__name__] self.__service = DfpWebService(headers, config, op_config, '/'.join(url), lock, logger) super(PublisherQueryLanguageService, self).__init__(headers, config, op_config, url, 'adspygoo...
Wrapper for PublisherQueryLanguageService. The PublisherQueryLanguage Service provides operations for executing a PQL statement to retrieve information from the system.
PublisherQueryLanguageService
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PublisherQueryLanguageService: """Wrapper for PublisherQueryLanguageService. The PublisherQueryLanguage Service provides operations for executing a PQL statement to retrieve information from the system.""" def __init__(self, headers, config, op_config, lock, logger): """Inits Publish...
stack_v2_sparse_classes_75kplus_train_006580
3,065
permissive
[ { "docstring": "Inits PublisherQueryLanguageService. Args: headers: dict Dictionary object with populated authentication credentials. config: dict Dictionary object with populated configuration values. op_config: dict Dictionary object with additional configuration values for this operation. lock: thread.lock T...
2
stack_v2_sparse_classes_30k_train_025584
Implement the Python class `PublisherQueryLanguageService` described below. Class description: Wrapper for PublisherQueryLanguageService. The PublisherQueryLanguage Service provides operations for executing a PQL statement to retrieve information from the system. Method signatures and docstrings: - def __init__(self,...
Implement the Python class `PublisherQueryLanguageService` described below. Class description: Wrapper for PublisherQueryLanguageService. The PublisherQueryLanguage Service provides operations for executing a PQL statement to retrieve information from the system. Method signatures and docstrings: - def __init__(self,...
efa82a8d85cbdc90f030db9d168790c55bd8b12a
<|skeleton|> class PublisherQueryLanguageService: """Wrapper for PublisherQueryLanguageService. The PublisherQueryLanguage Service provides operations for executing a PQL statement to retrieve information from the system.""" def __init__(self, headers, config, op_config, lock, logger): """Inits Publish...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PublisherQueryLanguageService: """Wrapper for PublisherQueryLanguageService. The PublisherQueryLanguage Service provides operations for executing a PQL statement to retrieve information from the system.""" def __init__(self, headers, config, op_config, lock, logger): """Inits PublisherQueryLangua...
the_stack_v2_python_sparse
adspygoogle/dfp/PublisherQueryLanguageService.py
hockeyprincess/google-api-dfp-python
train
0
3c875d131c594ef952aa23bbd6e2681ff12ba75d
[ "r = self.client.put('/api/company/', LOGIN_COMPANY_OBJECT_SUCCESS, content_type='application/json')\nself.assertTrue(r.data['success'])\nself.assertEqual(r.status_code, status.HTTP_202_ACCEPTED)", "r = self.client.put('/api/company/', LOGIN_COMPANY_OBJECT_FAILURE, content_type='application/json')\nself.assertFal...
<|body_start_0|> r = self.client.put('/api/company/', LOGIN_COMPANY_OBJECT_SUCCESS, content_type='application/json') self.assertTrue(r.data['success']) self.assertEqual(r.status_code, status.HTTP_202_ACCEPTED) <|end_body_0|> <|body_start_1|> r = self.client.put('/api/company/', LOGIN_CO...
This test is for login API
Login
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Login: """This test is for login API""" def test_success(self): """Test Success""" <|body_0|> def test_failure(self): """Test Failure""" <|body_1|> <|end_skeleton|> <|body_start_0|> r = self.client.put('/api/company/', LOGIN_COMPANY_OBJECT_SUCCE...
stack_v2_sparse_classes_75kplus_train_006581
11,905
permissive
[ { "docstring": "Test Success", "name": "test_success", "signature": "def test_success(self)" }, { "docstring": "Test Failure", "name": "test_failure", "signature": "def test_failure(self)" } ]
2
stack_v2_sparse_classes_30k_train_020909
Implement the Python class `Login` described below. Class description: This test is for login API Method signatures and docstrings: - def test_success(self): Test Success - def test_failure(self): Test Failure
Implement the Python class `Login` described below. Class description: This test is for login API Method signatures and docstrings: - def test_success(self): Test Success - def test_failure(self): Test Failure <|skeleton|> class Login: """This test is for login API""" def test_success(self): """Test...
c667e1bc2163ba49591e367bd5c882fe1b1f8df0
<|skeleton|> class Login: """This test is for login API""" def test_success(self): """Test Success""" <|body_0|> def test_failure(self): """Test Failure""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Login: """This test is for login API""" def test_success(self): """Test Success""" r = self.client.put('/api/company/', LOGIN_COMPANY_OBJECT_SUCCESS, content_type='application/json') self.assertTrue(r.data['success']) self.assertEqual(r.status_code, status.HTTP_202_ACCEPTE...
the_stack_v2_python_sparse
service_area/tests.py
jinayshah86/service-provider-locator
train
0
338efbda77c256534607e00a3fd209eef6d62c93
[ "kwargs = self.filter_sk_params(Model.predict, kwargs)\nprobas = self.model.predict(x, **kwargs)\nreturn probas", "kwargs = self.filter_sk_params(Model.predict, kwargs)\nprobas = self.model.predict(x, **kwargs)\nreturn np.argmax(probas, axis=1)" ]
<|body_start_0|> kwargs = self.filter_sk_params(Model.predict, kwargs) probas = self.model.predict(x, **kwargs) return probas <|end_body_0|> <|body_start_1|> kwargs = self.filter_sk_params(Model.predict, kwargs) probas = self.model.predict(x, **kwargs) return np.argmax(p...
Helper scikit-learn wrapper for a Keras model. The default KerasClassifier's predict() method does not work for functional Keras models (https://github.com/fchollet/keras/issues/2524); this breaks using this wrapper with the scikit-learn framework (e.g., search methods).
FunctionalKerasClassifier
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FunctionalKerasClassifier: """Helper scikit-learn wrapper for a Keras model. The default KerasClassifier's predict() method does not work for functional Keras models (https://github.com/fchollet/keras/issues/2524); this breaks using this wrapper with the scikit-learn framework (e.g., search metho...
stack_v2_sparse_classes_75kplus_train_006582
7,877
permissive
[ { "docstring": "Predict classes from features. Args: x: np.array or scipy.sparse.*matrix array of features **kwargs: additional keyword arguments Returns: y_pred: np.array 2-D array of class predicted probabilities", "name": "predict_proba", "signature": "def predict_proba(self, x, **kwargs)" }, { ...
2
stack_v2_sparse_classes_30k_train_017737
Implement the Python class `FunctionalKerasClassifier` described below. Class description: Helper scikit-learn wrapper for a Keras model. The default KerasClassifier's predict() method does not work for functional Keras models (https://github.com/fchollet/keras/issues/2524); this breaks using this wrapper with the sci...
Implement the Python class `FunctionalKerasClassifier` described below. Class description: Helper scikit-learn wrapper for a Keras model. The default KerasClassifier's predict() method does not work for functional Keras models (https://github.com/fchollet/keras/issues/2524); this breaks using this wrapper with the sci...
dea327aa9e7ef7f7bca5a6c225dbdca1077a06e9
<|skeleton|> class FunctionalKerasClassifier: """Helper scikit-learn wrapper for a Keras model. The default KerasClassifier's predict() method does not work for functional Keras models (https://github.com/fchollet/keras/issues/2524); this breaks using this wrapper with the scikit-learn framework (e.g., search metho...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FunctionalKerasClassifier: """Helper scikit-learn wrapper for a Keras model. The default KerasClassifier's predict() method does not work for functional Keras models (https://github.com/fchollet/keras/issues/2524); this breaks using this wrapper with the scikit-learn framework (e.g., search methods).""" ...
the_stack_v2_python_sparse
sparse_data/exp_framework/dnn.py
Tarkiyah/googleResearch
train
11
f9644d058a74c6fbc4fbda121318a27bd44e21f5
[ "diff_pro = [[difficulty[i], profit[i]] for i in range(len(difficulty))]\ndiff_pro.sort(key=lambda k: k[0])\nmax_p = 0\nfor i, v in enumerate(diff_pro):\n max_p = max(max_p, v[1])\n diff_pro[i][1] = max_p\nans = 0\ndifficulty = [k[0] for k in diff_pro]\nfor w in worker:\n i = bisect.bisect(difficulty, w) -...
<|body_start_0|> diff_pro = [[difficulty[i], profit[i]] for i in range(len(difficulty))] diff_pro.sort(key=lambda k: k[0]) max_p = 0 for i, v in enumerate(diff_pro): max_p = max(max_p, v[1]) diff_pro[i][1] = max_p ans = 0 difficulty = [k[0] for k i...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfitAssignment_1(self, difficulty, profit, worker): """:type difficulty: List[int] :type profit: List[int] :type worker: List[int] :rtype: int""" <|body_0|> def maxProfitAssignment_two_pointer(self, difficulty, profit, worker): """:type difficulty:...
stack_v2_sparse_classes_75kplus_train_006583
2,163
no_license
[ { "docstring": ":type difficulty: List[int] :type profit: List[int] :type worker: List[int] :rtype: int", "name": "maxProfitAssignment_1", "signature": "def maxProfitAssignment_1(self, difficulty, profit, worker)" }, { "docstring": ":type difficulty: List[int] :type profit: List[int] :type worke...
2
stack_v2_sparse_classes_30k_train_023408
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfitAssignment_1(self, difficulty, profit, worker): :type difficulty: List[int] :type profit: List[int] :type worker: List[int] :rtype: int - def maxProfitAssignment_two...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfitAssignment_1(self, difficulty, profit, worker): :type difficulty: List[int] :type profit: List[int] :type worker: List[int] :rtype: int - def maxProfitAssignment_two...
0e99f9a5226507706b3ee66fd04bae813755ef40
<|skeleton|> class Solution: def maxProfitAssignment_1(self, difficulty, profit, worker): """:type difficulty: List[int] :type profit: List[int] :type worker: List[int] :rtype: int""" <|body_0|> def maxProfitAssignment_two_pointer(self, difficulty, profit, worker): """:type difficulty:...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def maxProfitAssignment_1(self, difficulty, profit, worker): """:type difficulty: List[int] :type profit: List[int] :type worker: List[int] :rtype: int""" diff_pro = [[difficulty[i], profit[i]] for i in range(len(difficulty))] diff_pro.sort(key=lambda k: k[0]) max_p =...
the_stack_v2_python_sparse
medium/arrayandstring/test_826_Most_Profit_Assigning_Work.py
wuxu1019/leetcode_sophia
train
1
e749338b98c7e4b7670befecc77b7f99c8ad85b6
[ "gym.ObservationWrapper.__init__(self, env)\nself.width = 84\nself.height = 84\nself.observation_space = spaces.Box(low=0, high=255, shape=(self.height, self.width, 1), dtype=env.observation_space.dtype)", "frame = cv2.cvtColor(frame, cv2.COLOR_RGB2GRAY)\nframe = cv2.resize(frame, (self.width, self.height), inter...
<|body_start_0|> gym.ObservationWrapper.__init__(self, env) self.width = 84 self.height = 84 self.observation_space = spaces.Box(low=0, high=255, shape=(self.height, self.width, 1), dtype=env.observation_space.dtype) <|end_body_0|> <|body_start_1|> frame = cv2.cvtColor(frame, cv...
WarpFrame
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WarpFrame: def __init__(self, env): """Warp frames to 84x84 as done in the Nature paper and later work. :param env: (Gym Environment) the environment""" <|body_0|> def observation(self, frame): """returns the current observation from a frame :param frame: ([int] or [...
stack_v2_sparse_classes_75kplus_train_006584
8,857
permissive
[ { "docstring": "Warp frames to 84x84 as done in the Nature paper and later work. :param env: (Gym Environment) the environment", "name": "__init__", "signature": "def __init__(self, env)" }, { "docstring": "returns the current observation from a frame :param frame: ([int] or [float]) environment...
2
stack_v2_sparse_classes_30k_train_005198
Implement the Python class `WarpFrame` described below. Class description: Implement the WarpFrame class. Method signatures and docstrings: - def __init__(self, env): Warp frames to 84x84 as done in the Nature paper and later work. :param env: (Gym Environment) the environment - def observation(self, frame): returns ...
Implement the Python class `WarpFrame` described below. Class description: Implement the WarpFrame class. Method signatures and docstrings: - def __init__(self, env): Warp frames to 84x84 as done in the Nature paper and later work. :param env: (Gym Environment) the environment - def observation(self, frame): returns ...
ee6dd27bdbddd2cad32b85981a70a4db0e4cf1ee
<|skeleton|> class WarpFrame: def __init__(self, env): """Warp frames to 84x84 as done in the Nature paper and later work. :param env: (Gym Environment) the environment""" <|body_0|> def observation(self, frame): """returns the current observation from a frame :param frame: ([int] or [...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WarpFrame: def __init__(self, env): """Warp frames to 84x84 as done in the Nature paper and later work. :param env: (Gym Environment) the environment""" gym.ObservationWrapper.__init__(self, env) self.width = 84 self.height = 84 self.observation_space = spaces.Box(low=0...
the_stack_v2_python_sparse
rl/envs/atari.py
DeepKhantwal/rl
train
0
e0cfcac258f71173b2928e5b9a051d6277354935
[ "adgroup_objs = AdGroup.objects.all().order_by('-id')\nserializer = GetAdGroupSerializer(adgroup_objs, many=True)\nreturn Response(create_response(serializer.data))", "categories = request.data.pop('category', None)\nserializer = AdGroupSerializer(data=request.data)\nif serializer.is_valid():\n data = serializ...
<|body_start_0|> adgroup_objs = AdGroup.objects.all().order_by('-id') serializer = GetAdGroupSerializer(adgroup_objs, many=True) return Response(create_response(serializer.data)) <|end_body_0|> <|body_start_1|> categories = request.data.pop('category', None) serializer = AdGroup...
this view is used to create,update,list and delete AdGroup's
AdGroupView
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdGroupView: """this view is used to create,update,list and delete AdGroup's""" def get(self, request): """get list of all adgroups""" <|body_0|> def post(self, request): """create new campaign""" <|body_1|> def put(self, request): """update ...
stack_v2_sparse_classes_75kplus_train_006585
48,154
permissive
[ { "docstring": "get list of all adgroups", "name": "get", "signature": "def get(self, request)" }, { "docstring": "create new campaign", "name": "post", "signature": "def post(self, request)" }, { "docstring": "update existing adGroup", "name": "put", "signature": "def pu...
3
stack_v2_sparse_classes_30k_test_001671
Implement the Python class `AdGroupView` described below. Class description: this view is used to create,update,list and delete AdGroup's Method signatures and docstrings: - def get(self, request): get list of all adgroups - def post(self, request): create new campaign - def put(self, request): update existing adGrou...
Implement the Python class `AdGroupView` described below. Class description: this view is used to create,update,list and delete AdGroup's Method signatures and docstrings: - def get(self, request): get list of all adgroups - def post(self, request): create new campaign - def put(self, request): update existing adGrou...
590d8f6d597b9bafa1d0263edb95490f16570c37
<|skeleton|> class AdGroupView: """this view is used to create,update,list and delete AdGroup's""" def get(self, request): """get list of all adgroups""" <|body_0|> def post(self, request): """create new campaign""" <|body_1|> def put(self, request): """update ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AdGroupView: """this view is used to create,update,list and delete AdGroup's""" def get(self, request): """get list of all adgroups""" adgroup_objs = AdGroup.objects.all().order_by('-id') serializer = GetAdGroupSerializer(adgroup_objs, many=True) return Response(create_res...
the_stack_v2_python_sparse
newscout_web/api/v1/views.py
rsqwerty/newscout_web
train
0
f1c0ad746fccb04199952c4bee8fde4fafa792a4
[ "self.err = None\nself.out = None\nself.outFile = f'{path.dirname(argv[0])}/.outLogger.txt'\nself.errFile = f'{path.dirname(argv[0])}/.errLogger.txt'", "if not path.exists(self.outFile):\n open(self.outFile, 'w+').close()\nif not path.exists(self.errFile):\n open(self.errFile, 'w+').close()\ncurrentTime = d...
<|body_start_0|> self.err = None self.out = None self.outFile = f'{path.dirname(argv[0])}/.outLogger.txt' self.errFile = f'{path.dirname(argv[0])}/.errLogger.txt' <|end_body_0|> <|body_start_1|> if not path.exists(self.outFile): open(self.outFile, 'w+').close() ...
A class dedicated to loggin the stdout and stderr from the wtc-lms-GUI program. Attributes ---------- err : file descriptor The file descriptor for stderr for this program. out : file descriptor The file descriptor for stdout for this program. errFile : string The file location to save the for stderr for this program. ...
logger
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class logger: """A class dedicated to loggin the stdout and stderr from the wtc-lms-GUI program. Attributes ---------- err : file descriptor The file descriptor for stderr for this program. out : file descriptor The file descriptor for stdout for this program. errFile : string The file location to save...
stack_v2_sparse_classes_75kplus_train_006586
2,097
permissive
[ { "docstring": "The constructor for the logger class, sets up the needed variables.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Start redirecting all stdout and stderr to logger files for each.", "name": "open", "signature": "def open(self)" }, { "d...
3
stack_v2_sparse_classes_30k_train_013161
Implement the Python class `logger` described below. Class description: A class dedicated to loggin the stdout and stderr from the wtc-lms-GUI program. Attributes ---------- err : file descriptor The file descriptor for stderr for this program. out : file descriptor The file descriptor for stdout for this program. err...
Implement the Python class `logger` described below. Class description: A class dedicated to loggin the stdout and stderr from the wtc-lms-GUI program. Attributes ---------- err : file descriptor The file descriptor for stderr for this program. out : file descriptor The file descriptor for stdout for this program. err...
e65f5aa64919649690059da37f7bd608b823ca6a
<|skeleton|> class logger: """A class dedicated to loggin the stdout and stderr from the wtc-lms-GUI program. Attributes ---------- err : file descriptor The file descriptor for stderr for this program. out : file descriptor The file descriptor for stdout for this program. errFile : string The file location to save...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class logger: """A class dedicated to loggin the stdout and stderr from the wtc-lms-GUI program. Attributes ---------- err : file descriptor The file descriptor for stderr for this program. out : file descriptor The file descriptor for stdout for this program. errFile : string The file location to save the for stde...
the_stack_v2_python_sparse
logger/loggerClass.py
GingerNinja2962/wtc-lms-GUI
train
2
11bcab4df6cbb6d9aed5c19a2dc4189a5cf1d808
[ "self._renderer = renderer\nself._width = self._renderer.width\nself._height = self._renderer.height\nself._small = int(self._height / 20)\nself._lines = []", "nickname = information['nickname']\nprogress = information['progress']\nnumber_of_levels = information['number_of_levels']\nself._lines.append([f'GAME: {n...
<|body_start_0|> self._renderer = renderer self._width = self._renderer.width self._height = self._renderer.height self._small = int(self._height / 20) self._lines = [] <|end_body_0|> <|body_start_1|> nickname = information['nickname'] progress = information['pro...
A class to represent start view of UI. Attributes: renderer: Renderer object.
StartView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StartView: """A class to represent start view of UI. Attributes: renderer: Renderer object.""" def __init__(self, renderer): """Constructs all the necessary attributes for finish view. Args: renderer (Renderer): Renderer object which renders the display.""" <|body_0|> de...
stack_v2_sparse_classes_75kplus_train_006587
2,905
no_license
[ { "docstring": "Constructs all the necessary attributes for finish view. Args: renderer (Renderer): Renderer object which renders the display.", "name": "__init__", "signature": "def __init__(self, renderer)" }, { "docstring": "Prepares all information to show for the renderer object. Informatio...
2
stack_v2_sparse_classes_30k_train_018832
Implement the Python class `StartView` described below. Class description: A class to represent start view of UI. Attributes: renderer: Renderer object. Method signatures and docstrings: - def __init__(self, renderer): Constructs all the necessary attributes for finish view. Args: renderer (Renderer): Renderer object...
Implement the Python class `StartView` described below. Class description: A class to represent start view of UI. Attributes: renderer: Renderer object. Method signatures and docstrings: - def __init__(self, renderer): Constructs all the necessary attributes for finish view. Args: renderer (Renderer): Renderer object...
29cd15dddff620de068a479595a5cb9aba855343
<|skeleton|> class StartView: """A class to represent start view of UI. Attributes: renderer: Renderer object.""" def __init__(self, renderer): """Constructs all the necessary attributes for finish view. Args: renderer (Renderer): Renderer object which renders the display.""" <|body_0|> de...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StartView: """A class to represent start view of UI. Attributes: renderer: Renderer object.""" def __init__(self, renderer): """Constructs all the necessary attributes for finish view. Args: renderer (Renderer): Renderer object which renders the display.""" self._renderer = renderer ...
the_stack_v2_python_sparse
src/ui/start_view.py
TopiasHarjunpaa/ot-harjoitustyo
train
0
3b2de93dde6067a53a07372b751a86c7c2211d08
[ "n = len(matrix)\nfor i in range(n // 2):\n for j in range(n):\n matrix[i][j], matrix[n - 1 - i][j] = (matrix[n - 1 - i][j], matrix[i][j])\nfor i in range(n):\n for j in range(i):\n matrix[i][j], matrix[j][i] = (matrix[j][i], matrix[i][j])", "n = len(matrix)\nfor i in range(n // 2):\n for j...
<|body_start_0|> n = len(matrix) for i in range(n // 2): for j in range(n): matrix[i][j], matrix[n - 1 - i][j] = (matrix[n - 1 - i][j], matrix[i][j]) for i in range(n): for j in range(i): matrix[i][j], matrix[j][i] = (matrix[j][i], matrix[i...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rotate(self, matrix: List[List[int]]) -> None: """两次翻转:水平 + 主对角线""" <|body_0|> def rotateonce(self, matrix: List[List[int]]) -> None: """一次旋转""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(matrix) for i in range(n // 2...
stack_v2_sparse_classes_75kplus_train_006588
1,239
no_license
[ { "docstring": "两次翻转:水平 + 主对角线", "name": "rotate", "signature": "def rotate(self, matrix: List[List[int]]) -> None" }, { "docstring": "一次旋转", "name": "rotateonce", "signature": "def rotateonce(self, matrix: List[List[int]]) -> None" } ]
2
stack_v2_sparse_classes_30k_train_045611
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate(self, matrix: List[List[int]]) -> None: 两次翻转:水平 + 主对角线 - def rotateonce(self, matrix: List[List[int]]) -> None: 一次旋转
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate(self, matrix: List[List[int]]) -> None: 两次翻转:水平 + 主对角线 - def rotateonce(self, matrix: List[List[int]]) -> None: 一次旋转 <|skeleton|> class Solution: def rotate(self...
52756b30e9d51794591aca030bc918e707f473f1
<|skeleton|> class Solution: def rotate(self, matrix: List[List[int]]) -> None: """两次翻转:水平 + 主对角线""" <|body_0|> def rotateonce(self, matrix: List[List[int]]) -> None: """一次旋转""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def rotate(self, matrix: List[List[int]]) -> None: """两次翻转:水平 + 主对角线""" n = len(matrix) for i in range(n // 2): for j in range(n): matrix[i][j], matrix[n - 1 - i][j] = (matrix[n - 1 - i][j], matrix[i][j]) for i in range(n): for ...
the_stack_v2_python_sparse
48.旋转图像/solution.py
QtTao/daily_leetcode
train
0
4c8a10ece7f2349ce117d535e4e7090da2150d20
[ "fields = OrderedDict()\nvalidator_functions = {}\noptions_members = {}\nfor base in reversed(bases):\n if hasattr(base, '_schema'):\n fields.update(deepcopy(base._schema.fields))\n options_members.update(dict(base._schema.options))\n validator_functions.update(base._schema.validators)\nfor ...
<|body_start_0|> fields = OrderedDict() validator_functions = {} options_members = {} for base in reversed(bases): if hasattr(base, '_schema'): fields.update(deepcopy(base._schema.fields)) options_members.update(dict(base._schema.options)) ...
Metaclass for Models.
ModelMeta
[ "BSD-3-Clause", "BSD-2-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModelMeta: """Metaclass for Models.""" def __new__(mcs, name, bases, attrs): """This metaclass parses the declarative Model into a corresponding Schema, then adding it as the `_schema` attribute to the host class.""" <|body_0|> def _read_options(mcs, name, bases, attrs, ...
stack_v2_sparse_classes_75kplus_train_006589
15,133
permissive
[ { "docstring": "This metaclass parses the declarative Model into a corresponding Schema, then adding it as the `_schema` attribute to the host class.", "name": "__new__", "signature": "def __new__(mcs, name, bases, attrs)" }, { "docstring": "Parses model `Options` class into a `SchemaOptions` in...
2
stack_v2_sparse_classes_30k_train_026551
Implement the Python class `ModelMeta` described below. Class description: Metaclass for Models. Method signatures and docstrings: - def __new__(mcs, name, bases, attrs): This metaclass parses the declarative Model into a corresponding Schema, then adding it as the `_schema` attribute to the host class. - def _read_o...
Implement the Python class `ModelMeta` described below. Class description: Metaclass for Models. Method signatures and docstrings: - def __new__(mcs, name, bases, attrs): This metaclass parses the declarative Model into a corresponding Schema, then adding it as the `_schema` attribute to the host class. - def _read_o...
5c0edaac0bc8b040fda638845f24e39b6c324888
<|skeleton|> class ModelMeta: """Metaclass for Models.""" def __new__(mcs, name, bases, attrs): """This metaclass parses the declarative Model into a corresponding Schema, then adding it as the `_schema` attribute to the host class.""" <|body_0|> def _read_options(mcs, name, bases, attrs, ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ModelMeta: """Metaclass for Models.""" def __new__(mcs, name, bases, attrs): """This metaclass parses the declarative Model into a corresponding Schema, then adding it as the `_schema` attribute to the host class.""" fields = OrderedDict() validator_functions = {} options_...
the_stack_v2_python_sparse
bin/jamf_pro_addon_for_splunk/aob_py3/solnlib/packages/schematics/models.py
jamf/SplunkBase
train
5
b5558d4c02340a7240356d68b7833e1dcf71dda0
[ "self._graph = graph\nself._type = t\nself._batch_size = batch_size\nself._strategy = strategy\nself._client = self._graph.get_client()\nself._node_from = node_from\nif self._node_from == pywrap.NodeFrom.NODE:\n if self._type not in self._graph.get_node_decoders().keys():\n raise ValueError('Graph has no ...
<|body_start_0|> self._graph = graph self._type = t self._batch_size = batch_size self._strategy = strategy self._client = self._graph.get_client() self._node_from = node_from if self._node_from == pywrap.NodeFrom.NODE: if self._type not in self._graph...
Sampling nodes from graph.
NodeSampler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NodeSampler: """Sampling nodes from graph.""" def __init__(self, graph, t, batch_size, strategy='by_order', node_from=pywrap.NodeFrom.NODE): """Create a Base NodeSampler.. Args: graph (`Graph` object): The graph which sample from. t (string): type of node or egde. If t is a type of n...
stack_v2_sparse_classes_75kplus_train_006590
4,632
permissive
[ { "docstring": "Create a Base NodeSampler.. Args: graph (`Graph` object): The graph which sample from. t (string): type of node or egde. If t is a type of node, then `NodeSampler` will sample from node source. Else if `t` is a type of edge, then `node_from=EDGE_SRC` indicates that the nodes will be sampled from...
2
stack_v2_sparse_classes_30k_train_051701
Implement the Python class `NodeSampler` described below. Class description: Sampling nodes from graph. Method signatures and docstrings: - def __init__(self, graph, t, batch_size, strategy='by_order', node_from=pywrap.NodeFrom.NODE): Create a Base NodeSampler.. Args: graph (`Graph` object): The graph which sample fr...
Implement the Python class `NodeSampler` described below. Class description: Sampling nodes from graph. Method signatures and docstrings: - def __init__(self, graph, t, batch_size, strategy='by_order', node_from=pywrap.NodeFrom.NODE): Create a Base NodeSampler.. Args: graph (`Graph` object): The graph which sample fr...
1827c28c570c355e513f24b6a61a88457cfecdaf
<|skeleton|> class NodeSampler: """Sampling nodes from graph.""" def __init__(self, graph, t, batch_size, strategy='by_order', node_from=pywrap.NodeFrom.NODE): """Create a Base NodeSampler.. Args: graph (`Graph` object): The graph which sample from. t (string): type of node or egde. If t is a type of n...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NodeSampler: """Sampling nodes from graph.""" def __init__(self, graph, t, batch_size, strategy='by_order', node_from=pywrap.NodeFrom.NODE): """Create a Base NodeSampler.. Args: graph (`Graph` object): The graph which sample from. t (string): type of node or egde. If t is a type of node, then `No...
the_stack_v2_python_sparse
graphlearn/python/sampler/node_sampler.py
lorinlee/graph-learn
train
0
9512ac65ee120de771f37f2dc6182ea6f5e88231
[ "similarity_calc = region_similarity_calculator.IouSimilarity()\nmatcher = argmax_matcher.ArgMaxMatcher(match_threshold, unmatched_threshold=match_threshold, negatives_lower_than_unmatched=True, force_match_for_each_row=True)\nbox_coder = faster_rcnn_box_coder.FasterRcnnBoxCoder()\nself._target_assigner = target_as...
<|body_start_0|> similarity_calc = region_similarity_calculator.IouSimilarity() matcher = argmax_matcher.ArgMaxMatcher(match_threshold, unmatched_threshold=match_threshold, negatives_lower_than_unmatched=True, force_match_for_each_row=True) box_coder = faster_rcnn_box_coder.FasterRcnnBoxCoder() ...
Labeler for multiscale anchor boxes.
AnchorLabeler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnchorLabeler: """Labeler for multiscale anchor boxes.""" def __init__(self, anchors, num_classes, match_threshold=0.5): """Constructs anchor labeler to assign labels to anchors. Args: anchors: an instance of class Anchors. num_classes: integer number representing number of classes i...
stack_v2_sparse_classes_75kplus_train_006591
10,735
permissive
[ { "docstring": "Constructs anchor labeler to assign labels to anchors. Args: anchors: an instance of class Anchors. num_classes: integer number representing number of classes in the dataset. match_threshold: float number between 0 and 1 representing the threshold to assign positive labels for anchors.", "na...
3
stack_v2_sparse_classes_30k_train_031724
Implement the Python class `AnchorLabeler` described below. Class description: Labeler for multiscale anchor boxes. Method signatures and docstrings: - def __init__(self, anchors, num_classes, match_threshold=0.5): Constructs anchor labeler to assign labels to anchors. Args: anchors: an instance of class Anchors. num...
Implement the Python class `AnchorLabeler` described below. Class description: Labeler for multiscale anchor boxes. Method signatures and docstrings: - def __init__(self, anchors, num_classes, match_threshold=0.5): Constructs anchor labeler to assign labels to anchors. Args: anchors: an instance of class Anchors. num...
a5388a45f71a949639b35cc5b990bd130d2d8164
<|skeleton|> class AnchorLabeler: """Labeler for multiscale anchor boxes.""" def __init__(self, anchors, num_classes, match_threshold=0.5): """Constructs anchor labeler to assign labels to anchors. Args: anchors: an instance of class Anchors. num_classes: integer number representing number of classes i...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AnchorLabeler: """Labeler for multiscale anchor boxes.""" def __init__(self, anchors, num_classes, match_threshold=0.5): """Constructs anchor labeler to assign labels to anchors. Args: anchors: an instance of class Anchors. num_classes: integer number representing number of classes in the dataset...
the_stack_v2_python_sparse
TensorFlow2/Detection/Efficientdet/model/anchors.py
NVIDIA/DeepLearningExamples
train
11,838
70886b5a9bf15a63b83284bd395a3ece9eed85e7
[ "self.projectFileName_ = projectFileName\nself.resultProjectFileName_ = resultProjectFileName\nself.projectExtension_ = projectExtension\nself.braCustomProjectInfo_ = myBraCustomProjectInfo", "projTokenizer = ProjTokenizerFactory.createProjectsTokenizer(self.projectExtension_)\nwith open(self.resultProjectFileNam...
<|body_start_0|> self.projectFileName_ = projectFileName self.resultProjectFileName_ = resultProjectFileName self.projectExtension_ = projectExtension self.braCustomProjectInfo_ = myBraCustomProjectInfo <|end_body_0|> <|body_start_1|> projTokenizer = ProjTokenizerFactory.createP...
Project parser to add BRA custom information. This is the class to be called from client code.
ProjectParser
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProjectParser: """Project parser to add BRA custom information. This is the class to be called from client code.""" def __init__(self, projectFileName, resultProjectFileName, projectExtension, myBraCustomProjectInfo): """Constructor.""" <|body_0|> def parseProject(self):...
stack_v2_sparse_classes_75kplus_train_006592
30,925
permissive
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self, projectFileName, resultProjectFileName, projectExtension, myBraCustomProjectInfo)" }, { "docstring": "Parse the project indicated in the constructor, adding BRA custom info in the result file.", "name": "pars...
2
null
Implement the Python class `ProjectParser` described below. Class description: Project parser to add BRA custom information. This is the class to be called from client code. Method signatures and docstrings: - def __init__(self, projectFileName, resultProjectFileName, projectExtension, myBraCustomProjectInfo): Constr...
Implement the Python class `ProjectParser` described below. Class description: Project parser to add BRA custom information. This is the class to be called from client code. Method signatures and docstrings: - def __init__(self, projectFileName, resultProjectFileName, projectExtension, myBraCustomProjectInfo): Constr...
a29aaa36b73292c14f3f0c83598c0d8991b0295a
<|skeleton|> class ProjectParser: """Project parser to add BRA custom information. This is the class to be called from client code.""" def __init__(self, projectFileName, resultProjectFileName, projectExtension, myBraCustomProjectInfo): """Constructor.""" <|body_0|> def parseProject(self):...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProjectParser: """Project parser to add BRA custom information. This is the class to be called from client code.""" def __init__(self, projectFileName, resultProjectFileName, projectExtension, myBraCustomProjectInfo): """Constructor.""" self.projectFileName_ = projectFileName self...
the_stack_v2_python_sparse
Python/gui/parse_project.py
GervasioCalderon/bug-reproducer-assistant
train
1
ae6b2b217988405a4e08f87d6d05e3e78946531a
[ "try:\n if not token:\n return False\n if token['server_nonce'] != nonce:\n return False\n now = int(time.mktime(time.gmtime()))\n return now <= token['valid_until']\nexcept:\n return False", "if Token.is_valid():\n return token['token']\nelse:\n return None", "if not token:\n...
<|body_start_0|> try: if not token: return False if token['server_nonce'] != nonce: return False now = int(time.mktime(time.gmtime())) return now <= token['valid_until'] except: return False <|end_body_0|> <|bod...
Secure token which is used for authentication and authorization purposes
Token
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Token: """Secure token which is used for authentication and authorization purposes""" def is_valid(token): """Verifies whether the token is valid: (i) Checks whether the server nonce which is found in token is the same as in configuration file (ii) Checks wether the validity time in ...
stack_v2_sparse_classes_75kplus_train_006593
2,725
no_license
[ { "docstring": "Verifies whether the token is valid: (i) Checks whether the server nonce which is found in token is the same as in configuration file (ii) Checks wether the validity time in token grater than the current system time For the correct operation of the token verification the system clock MUST be syn...
5
null
Implement the Python class `Token` described below. Class description: Secure token which is used for authentication and authorization purposes Method signatures and docstrings: - def is_valid(token): Verifies whether the token is valid: (i) Checks whether the server nonce which is found in token is the same as in co...
Implement the Python class `Token` described below. Class description: Secure token which is used for authentication and authorization purposes Method signatures and docstrings: - def is_valid(token): Verifies whether the token is valid: (i) Checks whether the server nonce which is found in token is the same as in co...
75ec52a4d002215a67cefc9c83ad98b5f9e1487c
<|skeleton|> class Token: """Secure token which is used for authentication and authorization purposes""" def is_valid(token): """Verifies whether the token is valid: (i) Checks whether the server nonce which is found in token is the same as in configuration file (ii) Checks wether the validity time in ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Token: """Secure token which is used for authentication and authorization purposes""" def is_valid(token): """Verifies whether the token is valid: (i) Checks whether the server nonce which is found in token is the same as in configuration file (ii) Checks wether the validity time in token grater ...
the_stack_v2_python_sparse
backend/tokens.py
dmitriykuptsov/radwi
train
0
57fcbee6fcb7903b6bc15062ddcea300c5b89a3b
[ "SphericalPotential.__init__(self, amp=amp, ro=ro, vo=vo, amp_units='mass')\na = conversion.parse_length(a, ro=self._ro)\nself.a = a\nself.a2 = a ** 2\nif normalize or (isinstance(normalize, (int, float)) and (not isinstance(normalize, bool))):\n if self.a > 1.0:\n raise ValueError('SphericalShellPotentia...
<|body_start_0|> SphericalPotential.__init__(self, amp=amp, ro=ro, vo=vo, amp_units='mass') a = conversion.parse_length(a, ro=self._ro) self.a = a self.a2 = a ** 2 if normalize or (isinstance(normalize, (int, float)) and (not isinstance(normalize, bool))): if self.a >...
Class that implements the potential of an infinitesimally-thin, spherical shell .. math:: \\rho(r) = \\frac{\\mathrm{amp}}{4\\pi\\,a^2}\\,\\delta(r-a) with :math:`\\mathrm{amp} = GM` the mass of the shell.
SphericalShellPotential
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SphericalShellPotential: """Class that implements the potential of an infinitesimally-thin, spherical shell .. math:: \\rho(r) = \\frac{\\mathrm{amp}}{4\\pi\\,a^2}\\,\\delta(r-a) with :math:`\\mathrm{amp} = GM` the mass of the shell.""" def __init__(self, amp=1.0, a=0.75, normalize=False, ro...
stack_v2_sparse_classes_75kplus_train_006594
3,427
permissive
[ { "docstring": "NAME: __init__ PURPOSE: initialize a spherical shell potential INPUT: amp - mass of the shell (default: 1); can be a Quantity with units of mass or Gxmass a= (0.75) radius of the shell (can be Quantity) normalize - if True, normalize such that vc(1.,0.)=1., or, if given as a number, such that th...
6
stack_v2_sparse_classes_30k_train_014001
Implement the Python class `SphericalShellPotential` described below. Class description: Class that implements the potential of an infinitesimally-thin, spherical shell .. math:: \\rho(r) = \\frac{\\mathrm{amp}}{4\\pi\\,a^2}\\,\\delta(r-a) with :math:`\\mathrm{amp} = GM` the mass of the shell. Method signatures and d...
Implement the Python class `SphericalShellPotential` described below. Class description: Class that implements the potential of an infinitesimally-thin, spherical shell .. math:: \\rho(r) = \\frac{\\mathrm{amp}}{4\\pi\\,a^2}\\,\\delta(r-a) with :math:`\\mathrm{amp} = GM` the mass of the shell. Method signatures and d...
9654e2e181d26abaac4a4fba49375887fb290d36
<|skeleton|> class SphericalShellPotential: """Class that implements the potential of an infinitesimally-thin, spherical shell .. math:: \\rho(r) = \\frac{\\mathrm{amp}}{4\\pi\\,a^2}\\,\\delta(r-a) with :math:`\\mathrm{amp} = GM` the mass of the shell.""" def __init__(self, amp=1.0, a=0.75, normalize=False, ro...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SphericalShellPotential: """Class that implements the potential of an infinitesimally-thin, spherical shell .. math:: \\rho(r) = \\frac{\\mathrm{amp}}{4\\pi\\,a^2}\\,\\delta(r-a) with :math:`\\mathrm{amp} = GM` the mass of the shell.""" def __init__(self, amp=1.0, a=0.75, normalize=False, ro=None, vo=Non...
the_stack_v2_python_sparse
galpy/potential/SphericalShellPotential.py
davidhendel/galpy
train
0
04df1bcc0f6aafc6c8ddccff3a222b7e0bac594e
[ "super(BrowserProxyGrid, self).__init__()\nself._capabilities = capabilities\nself._grid_url = grid_url", "proxy_ip = self._get_browsermobproxy_docker_ip()\nproxy_port = '9090'\nself._client = Client('{0}:{1}'.format(proxy_ip, proxy_port))", "proxy_container = os.popen(\"docker ps --format {{.Names}} | grep 'pr...
<|body_start_0|> super(BrowserProxyGrid, self).__init__() self._capabilities = capabilities self._grid_url = grid_url <|end_body_0|> <|body_start_1|> proxy_ip = self._get_browsermobproxy_docker_ip() proxy_port = '9090' self._client = Client('{0}:{1}'.format(proxy_ip, pro...
Run browsermob-proxy and browser instance in docker mode first. Use to capture and analyse traffic. Useful for a CI setup Please refer to https://hub.docker.com/r/qautomatron/docker-browsermob-proxy/ Example: capabilities = { "browserName": "chrome", "platform": 'LINUX', "version": '', "javascriptEnabled": True } bprox...
BrowserProxyGrid
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BrowserProxyGrid: """Run browsermob-proxy and browser instance in docker mode first. Use to capture and analyse traffic. Useful for a CI setup Please refer to https://hub.docker.com/r/qautomatron/docker-browsermob-proxy/ Example: capabilities = { "browserName": "chrome", "platform": 'LINUX', "ver...
stack_v2_sparse_classes_75kplus_train_006595
9,587
permissive
[ { "docstring": "Initialises Browsermob-proxy grid instance :param dict capabilities: Browser/Device capabilities :param str grid_url: Selenium grid url", "name": "__init__", "signature": "def __init__(self, capabilities, grid_url='http://localhost:4444/wd/hub')" }, { "docstring": "Assumes browse...
5
null
Implement the Python class `BrowserProxyGrid` described below. Class description: Run browsermob-proxy and browser instance in docker mode first. Use to capture and analyse traffic. Useful for a CI setup Please refer to https://hub.docker.com/r/qautomatron/docker-browsermob-proxy/ Example: capabilities = { "browserNam...
Implement the Python class `BrowserProxyGrid` described below. Class description: Run browsermob-proxy and browser instance in docker mode first. Use to capture and analyse traffic. Useful for a CI setup Please refer to https://hub.docker.com/r/qautomatron/docker-browsermob-proxy/ Example: capabilities = { "browserNam...
7175edbf625e46ce1489c97f171a8717eaf0be7e
<|skeleton|> class BrowserProxyGrid: """Run browsermob-proxy and browser instance in docker mode first. Use to capture and analyse traffic. Useful for a CI setup Please refer to https://hub.docker.com/r/qautomatron/docker-browsermob-proxy/ Example: capabilities = { "browserName": "chrome", "platform": 'LINUX', "ver...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BrowserProxyGrid: """Run browsermob-proxy and browser instance in docker mode first. Use to capture and analyse traffic. Useful for a CI setup Please refer to https://hub.docker.com/r/qautomatron/docker-browsermob-proxy/ Example: capabilities = { "browserName": "chrome", "platform": 'LINUX', "version": '', "j...
the_stack_v2_python_sparse
nzme_skynet/core/proxy/browserproxy.py
MilindThakur/nzme-skynet
train
4
4dc9a0bbf7a145253bd145f8e3010881bacc9016
[ "if max(idf.values()) > documents:\n raise ValueError(f'The number of documents ({documents}) must be greater or equal to the most common term ({max(idf.values())})')\nif min(idf.values()) < 0:\n raise ValueError('The IDF values must be non-negative')\nif documents < 0:\n raise ValueError('The number of do...
<|body_start_0|> if max(idf.values()) > documents: raise ValueError(f'The number of documents ({documents}) must be greater or equal to the most common term ({max(idf.values())})') if min(idf.values()) < 0: raise ValueError('The IDF values must be non-negative') if docume...
The TF-IDF scorer assigns a score the candidate participants similarly to the :class:`~nlp.weighting.tfidf.TFIDF` term-weighting scheme. Therefore the scorer depends on an IDF table, given as a dictionary, and the number of documents in it. :ivar ~.idf: The IDF table used in conjunction with term weighting. The keys ar...
TFIDFScorer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TFIDFScorer: """The TF-IDF scorer assigns a score the candidate participants similarly to the :class:`~nlp.weighting.tfidf.TFIDF` term-weighting scheme. Therefore the scorer depends on an IDF table, given as a dictionary, and the number of documents in it. :ivar ~.idf: The IDF table used in conju...
stack_v2_sparse_classes_75kplus_train_006596
4,002
no_license
[ { "docstring": "Create the term-weighting scheme with the IDF table and the number of documents in that scheme. :param idf: The IDF table used in conjunction with term weighting. The keys are the terms, and the corresponding values are the number of documents in which they appear. :type idf: dict :param documen...
3
null
Implement the Python class `TFIDFScorer` described below. Class description: The TF-IDF scorer assigns a score the candidate participants similarly to the :class:`~nlp.weighting.tfidf.TFIDF` term-weighting scheme. Therefore the scorer depends on an IDF table, given as a dictionary, and the number of documents in it. :...
Implement the Python class `TFIDFScorer` described below. Class description: The TF-IDF scorer assigns a score the candidate participants similarly to the :class:`~nlp.weighting.tfidf.TFIDF` term-weighting scheme. Therefore the scorer depends on an IDF table, given as a dictionary, and the number of documents in it. :...
6320913c6adf31347d4b1f8d398bd65b61428cfb
<|skeleton|> class TFIDFScorer: """The TF-IDF scorer assigns a score the candidate participants similarly to the :class:`~nlp.weighting.tfidf.TFIDF` term-weighting scheme. Therefore the scorer depends on an IDF table, given as a dictionary, and the number of documents in it. :ivar ~.idf: The IDF table used in conju...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TFIDFScorer: """The TF-IDF scorer assigns a score the candidate participants similarly to the :class:`~nlp.weighting.tfidf.TFIDF` term-weighting scheme. Therefore the scorer depends on an IDF table, given as a dictionary, and the number of documents in it. :ivar ~.idf: The IDF table used in conjunction with t...
the_stack_v2_python_sparse
lib/apd/scorers/local/tfidf_scorer.py
TianhaoFu/eld-data
train
0
0fbd5d643901bf376d0ad3778ea2531bdc618f33
[ "obj = self._get_by_name(name)\nif obj is not None:\n raise ValueError('l4 mapping with name {0} already exists'.format(name))\nself.data.append({'name': name, 'uri': uri})", "obj = self._get_by_name(name)\nif obj is not None:\n self.data.remove(obj)\nelse:\n raise ValueError('The rule with name {0} does...
<|body_start_0|> obj = self._get_by_name(name) if obj is not None: raise ValueError('l4 mapping with name {0} already exists'.format(name)) self.data.append({'name': name, 'uri': uri}) <|end_body_0|> <|body_start_1|> obj = self._get_by_name(name) if obj is not None: ...
Wrapper class around custom application definitions.
CustomApplications
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomApplications: """Wrapper class around custom application definitions.""" def add(self, name, uri): """Add a custom application rule :param str name: the name of the rule :param str uri: a string representing a uri""" <|body_0|> def remove(self, name): """Re...
stack_v2_sparse_classes_75kplus_train_006597
13,335
permissive
[ { "docstring": "Add a custom application rule :param str name: the name of the rule :param str uri: a string representing a uri", "name": "add", "signature": "def add(self, name, uri)" }, { "docstring": "Remove a custom application rule :param str name: the name of the rule", "name": "remove...
2
stack_v2_sparse_classes_30k_train_022488
Implement the Python class `CustomApplications` described below. Class description: Wrapper class around custom application definitions. Method signatures and docstrings: - def add(self, name, uri): Add a custom application rule :param str name: the name of the rule :param str uri: a string representing a uri - def r...
Implement the Python class `CustomApplications` described below. Class description: Wrapper class around custom application definitions. Method signatures and docstrings: - def add(self, name, uri): Add a custom application rule :param str name: the name of the rule :param str uri: a string representing a uri - def r...
a944f18ad79c775ab6c072924b0bbb613d7462d2
<|skeleton|> class CustomApplications: """Wrapper class around custom application definitions.""" def add(self, name, uri): """Add a custom application rule :param str name: the name of the rule :param str uri: a string representing a uri""" <|body_0|> def remove(self, name): """Re...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CustomApplications: """Wrapper class around custom application definitions.""" def add(self, name, uri): """Add a custom application rule :param str name: the name of the rule :param str uri: a string representing a uri""" obj = self._get_by_name(name) if obj is not None: ...
the_stack_v2_python_sparse
steelscript/netshark/core/_settings5.py
riverbed/steelscript-netshark
train
0
b4fd9bffee583db8cc45237db4c0604fa3a2c574
[ "super(StopVehicle, self).__init__(name)\nself.logger.debug('%s.__init__()' % self.__class__.__name__)\nself._control, self._type = get_actor_control(actor)\nif self._type == 'walker':\n self._control.speed = 0\nself._actor = actor\nself._brake_value = brake_value", "new_status = py_trees.common.Status.RUNNING...
<|body_start_0|> super(StopVehicle, self).__init__(name) self.logger.debug('%s.__init__()' % self.__class__.__name__) self._control, self._type = get_actor_control(actor) if self._type == 'walker': self._control.speed = 0 self._actor = actor self._brake_value ...
This class contains an atomic stopping behavior. The controlled traffic participant will decelerate with _bake_value_ until reaching a full stop. Important parameters: - actor: CARLA actor to execute the behavior - brake_value: Brake value in [0,1] applied The behavior terminates when the actor stopped moving
StopVehicle
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StopVehicle: """This class contains an atomic stopping behavior. The controlled traffic participant will decelerate with _bake_value_ until reaching a full stop. Important parameters: - actor: CARLA actor to execute the behavior - brake_value: Brake value in [0,1] applied The behavior terminates ...
stack_v2_sparse_classes_75kplus_train_006598
39,839
permissive
[ { "docstring": "Setup _actor and maximum braking value", "name": "__init__", "signature": "def __init__(self, actor, brake_value, name='Stopping')" }, { "docstring": "Set brake to brake_value until reaching full stop", "name": "update", "signature": "def update(self)" } ]
2
stack_v2_sparse_classes_30k_train_038762
Implement the Python class `StopVehicle` described below. Class description: This class contains an atomic stopping behavior. The controlled traffic participant will decelerate with _bake_value_ until reaching a full stop. Important parameters: - actor: CARLA actor to execute the behavior - brake_value: Brake value in...
Implement the Python class `StopVehicle` described below. Class description: This class contains an atomic stopping behavior. The controlled traffic participant will decelerate with _bake_value_ until reaching a full stop. Important parameters: - actor: CARLA actor to execute the behavior - brake_value: Brake value in...
8ab0894b92e1f994802a218002021ee075c405bf
<|skeleton|> class StopVehicle: """This class contains an atomic stopping behavior. The controlled traffic participant will decelerate with _bake_value_ until reaching a full stop. Important parameters: - actor: CARLA actor to execute the behavior - brake_value: Brake value in [0,1] applied The behavior terminates ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StopVehicle: """This class contains an atomic stopping behavior. The controlled traffic participant will decelerate with _bake_value_ until reaching a full stop. Important parameters: - actor: CARLA actor to execute the behavior - brake_value: Brake value in [0,1] applied The behavior terminates when the acto...
the_stack_v2_python_sparse
carla_rllib/carla_rllib-prak_evaluator-carla_rllib-prak_evaluator/carla_rllib/prak_evaluator/srunner/scenarioconfigs/scenariomanager/scenarioatomics/atomic_behaviors.py
TinaMenke/Deep-Reinforcement-Learning
train
9
a7d373b2abeaa9c74fa7dea5b67d3117692bc2ce
[ "return_type = WorkbookFunctionResult(self.context)\npayload = {'number': number}\nqry = ServiceOperationQuery(self, 'abs', None, payload, None, return_type)\nself.context.add_query(qry)\nreturn return_type", "return_type = WorkbookFunctionResult(self.context)\npayload = {'issue': issue, 'firstInterest': first_in...
<|body_start_0|> return_type = WorkbookFunctionResult(self.context) payload = {'number': number} qry = ServiceOperationQuery(self, 'abs', None, payload, None, return_type) self.context.add_query(qry) return return_type <|end_body_0|> <|body_start_1|> return_type = Workbo...
Used as a container for Microsoft Excel worksheet function
WorkbookFunctions
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkbookFunctions: """Used as a container for Microsoft Excel worksheet function""" def abs(self, number): """Returns the absolute value of a number. The absolute value of a number is the number without its sign :param float number: The real number of which you want the absolute valu...
stack_v2_sparse_classes_75kplus_train_006599
2,700
permissive
[ { "docstring": "Returns the absolute value of a number. The absolute value of a number is the number without its sign :param float number: The real number of which you want the absolute value.", "name": "abs", "signature": "def abs(self, number)" }, { "docstring": "Returns the accrued interest f...
3
stack_v2_sparse_classes_30k_train_013297
Implement the Python class `WorkbookFunctions` described below. Class description: Used as a container for Microsoft Excel worksheet function Method signatures and docstrings: - def abs(self, number): Returns the absolute value of a number. The absolute value of a number is the number without its sign :param float nu...
Implement the Python class `WorkbookFunctions` described below. Class description: Used as a container for Microsoft Excel worksheet function Method signatures and docstrings: - def abs(self, number): Returns the absolute value of a number. The absolute value of a number is the number without its sign :param float nu...
cbd245d1af8d69e013c469cfc2a9851f51c91417
<|skeleton|> class WorkbookFunctions: """Used as a container for Microsoft Excel worksheet function""" def abs(self, number): """Returns the absolute value of a number. The absolute value of a number is the number without its sign :param float number: The real number of which you want the absolute valu...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WorkbookFunctions: """Used as a container for Microsoft Excel worksheet function""" def abs(self, number): """Returns the absolute value of a number. The absolute value of a number is the number without its sign :param float number: The real number of which you want the absolute value.""" ...
the_stack_v2_python_sparse
office365/onedrive/workbooks/functions/functions.py
vgrem/Office365-REST-Python-Client
train
1,006