blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
c7e36edd24db6319dd4e0d8dcf0c2dd532a7ca9d
[ "req_parser = RequestParser()\nreq_parser.add_argument('target', type=parser.article_id, required=True, location='json')\nreq_parser.add_argument('Trace', type=inputs.regex('^.+$'), required=False, location='headers')\nargs = req_parser.parse_args()\ntarget = args.target\nif args.Trace:\n article = cache_article...
<|body_start_0|> req_parser = RequestParser() req_parser.add_argument('target', type=parser.article_id, required=True, location='json') req_parser.add_argument('Trace', type=inputs.regex('^.+$'), required=False, location='headers') args = req_parser.parse_args() target = args.tar...
文章收藏
CollectionListResource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CollectionListResource: """文章收藏""" def post(self): """用户收藏文章""" <|body_0|> def get(self): """获取用户的收藏历史""" <|body_1|> <|end_skeleton|> <|body_start_0|> req_parser = RequestParser() req_parser.add_argument('target', type=parser.article_id,...
stack_v2_sparse_classes_36k_train_003800
3,971
no_license
[ { "docstring": "用户收藏文章", "name": "post", "signature": "def post(self)" }, { "docstring": "获取用户的收藏历史", "name": "get", "signature": "def get(self)" } ]
2
stack_v2_sparse_classes_30k_train_014144
Implement the Python class `CollectionListResource` described below. Class description: 文章收藏 Method signatures and docstrings: - def post(self): 用户收藏文章 - def get(self): 获取用户的收藏历史
Implement the Python class `CollectionListResource` described below. Class description: 文章收藏 Method signatures and docstrings: - def post(self): 用户收藏文章 - def get(self): 获取用户的收藏历史 <|skeleton|> class CollectionListResource: """文章收藏""" def post(self): """用户收藏文章""" <|body_0|> def get(self):...
12b52f21a4ec20b4853870468c28d2385dc185a8
<|skeleton|> class CollectionListResource: """文章收藏""" def post(self): """用户收藏文章""" <|body_0|> def get(self): """获取用户的收藏历史""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CollectionListResource: """文章收藏""" def post(self): """用户收藏文章""" req_parser = RequestParser() req_parser.add_argument('target', type=parser.article_id, required=True, location='json') req_parser.add_argument('Trace', type=inputs.regex('^.+$'), required=False, location='head...
the_stack_v2_python_sparse
flask_prj/tbd_42/toutiao/resources/news/collection.py
123wuyu/demo_prj
train
1
f929426df3250d243e1f3ca8f9d89dfdc19ea536
[ "Model = model_admin.model\nmeta_name = '%smetadata' % Model._meta.object_name\nct = ContentType.objects.get(app_label='django_models_from_csv', model=meta_name)\ntags = Tag.objects.filter(taggit_taggeditem_items__content_type=ct).values_list('name', 'slug').distinct()\nreturn tags", "value = self.value()\nif not...
<|body_start_0|> Model = model_admin.model meta_name = '%smetadata' % Model._meta.object_name ct = ContentType.objects.get(app_label='django_models_from_csv', model=meta_name) tags = Tag.objects.filter(taggit_taggeditem_items__content_type=ct).values_list('name', 'slug').distinct() ...
A custom filterable for tags. Restricts the displayed tags by the current data source, even though tags are global.
TagListFilter
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TagListFilter: """A custom filterable for tags. Restricts the displayed tags by the current data source, even though tags are global.""" def lookups(self, request, model_admin): """Returns a list of tuples. The first element in each tuple is the coded value for the option that will a...
stack_v2_sparse_classes_36k_train_003801
1,641
permissive
[ { "docstring": "Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the URL query. The second element is the human-readable name for the option that will appear in the right sidebar.", "name": "lookups", "signature": "def lookups(self, request,...
2
stack_v2_sparse_classes_30k_train_011105
Implement the Python class `TagListFilter` described below. Class description: A custom filterable for tags. Restricts the displayed tags by the current data source, even though tags are global. Method signatures and docstrings: - def lookups(self, request, model_admin): Returns a list of tuples. The first element in...
Implement the Python class `TagListFilter` described below. Class description: A custom filterable for tags. Restricts the displayed tags by the current data source, even though tags are global. Method signatures and docstrings: - def lookups(self, request, model_admin): Returns a list of tuples. The first element in...
6fa1592a83100fe414b84e4dab58e90d7855309b
<|skeleton|> class TagListFilter: """A custom filterable for tags. Restricts the displayed tags by the current data source, even though tags are global.""" def lookups(self, request, model_admin): """Returns a list of tuples. The first element in each tuple is the coded value for the option that will a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TagListFilter: """A custom filterable for tags. Restricts the displayed tags by the current data source, even though tags are global.""" def lookups(self, request, model_admin): """Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the ...
the_stack_v2_python_sparse
collaborative/filters.py
propublica/django-collaborative
train
94
60d04075d4949389c17eef2588fc43b016cc6be9
[ "if isinstance(value, (str, type(None))):\n return value\nassert isinstance(value, bytes)\ntry:\n return str(value, 'utf8')\nexcept:\n return value.encode('utf8').decode('utf8')", "if self.table:\n return\nself.table = {}\nfp = open(os.path.join(os.path.dirname(__file__), 'Mandarin.dat'))\nlines = fp....
<|body_start_0|> if isinstance(value, (str, type(None))): return value assert isinstance(value, bytes) try: return str(value, 'utf8') except: return value.encode('utf8').decode('utf8') <|end_body_0|> <|body_start_1|> if self.table: ...
docstring for Pinyin
Pinyin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Pinyin: """docstring for Pinyin""" def to_unicode(self, value): """Converts a string argument to a unicode string. If the argument is already a unicode string or None, it is returned unchanged. Otherwise it must be a byte string and is decoded as utf8.""" <|body_0|> def ...
stack_v2_sparse_classes_36k_train_003802
1,930
no_license
[ { "docstring": "Converts a string argument to a unicode string. If the argument is already a unicode string or None, it is returned unchanged. Otherwise it must be a byte string and is decoded as utf8.", "name": "to_unicode", "signature": "def to_unicode(self, value)" }, { "docstring": "docstrin...
4
stack_v2_sparse_classes_30k_train_012273
Implement the Python class `Pinyin` described below. Class description: docstring for Pinyin Method signatures and docstrings: - def to_unicode(self, value): Converts a string argument to a unicode string. If the argument is already a unicode string or None, it is returned unchanged. Otherwise it must be a byte strin...
Implement the Python class `Pinyin` described below. Class description: docstring for Pinyin Method signatures and docstrings: - def to_unicode(self, value): Converts a string argument to a unicode string. If the argument is already a unicode string or None, it is returned unchanged. Otherwise it must be a byte strin...
49c31d9cce6ca451ff069697913b33fe55028a46
<|skeleton|> class Pinyin: """docstring for Pinyin""" def to_unicode(self, value): """Converts a string argument to a unicode string. If the argument is already a unicode string or None, it is returned unchanged. Otherwise it must be a byte string and is decoded as utf8.""" <|body_0|> def ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Pinyin: """docstring for Pinyin""" def to_unicode(self, value): """Converts a string argument to a unicode string. If the argument is already a unicode string or None, it is returned unchanged. Otherwise it must be a byte string and is decoded as utf8.""" if isinstance(value, (str, type(N...
the_stack_v2_python_sparse
PaiDuiGuanJia/yiyun/libs/pinyin.py
haoweiking/image_tesseract_private
train
0
06c057d823f465f35db05fe4c4e5371cbcf74dca
[ "self.subarray_beam_id = subarray_beam_id\nself.station_ids = station_ids\nself.channels = channels\nself.update_rate = update_rate\nself.target = target\nself.antenna_weights = antenna_weights\nself.phase_centre = phase_centre", "if not isinstance(other, SubarrayBeamConfiguration):\n return False\nreturn self...
<|body_start_0|> self.subarray_beam_id = subarray_beam_id self.station_ids = station_ids self.channels = channels self.update_rate = update_rate self.target = target self.antenna_weights = antenna_weights self.phase_centre = phase_centre <|end_body_0|> <|body_sta...
A class to hold subarray_beam configuration attributes
SubarrayBeamConfiguration
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubarrayBeamConfiguration: """A class to hold subarray_beam configuration attributes""" def __init__(self, subarray_beam_id: int, station_ids: List[int], channels: List[List[int]], update_rate: float, target: SubarrayBeamTarget, antenna_weights: List[float], phase_centre: List[float]): ...
stack_v2_sparse_classes_36k_train_003803
5,858
permissive
[ { "docstring": "Initialise the station beam configuration. :param subarray_beam_id: stationbeam's id :type subarray_beam_id: int :param station_ids: station id's :type station_ids: List[int] :param channels: channels to form station beam :type channels: List[Tuple] :param update_rate: frequency of new Az/El dur...
2
stack_v2_sparse_classes_30k_val_000913
Implement the Python class `SubarrayBeamConfiguration` described below. Class description: A class to hold subarray_beam configuration attributes Method signatures and docstrings: - def __init__(self, subarray_beam_id: int, station_ids: List[int], channels: List[List[int]], update_rate: float, target: SubarrayBeamTar...
Implement the Python class `SubarrayBeamConfiguration` described below. Class description: A class to hold subarray_beam configuration attributes Method signatures and docstrings: - def __init__(self, subarray_beam_id: int, station_ids: List[int], channels: List[List[int]], update_rate: float, target: SubarrayBeamTar...
87083655aca8f8f53a26dba253a0189d8519714b
<|skeleton|> class SubarrayBeamConfiguration: """A class to hold subarray_beam configuration attributes""" def __init__(self, subarray_beam_id: int, station_ids: List[int], channels: List[List[int]], update_rate: float, target: SubarrayBeamTarget, antenna_weights: List[float], phase_centre: List[float]): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SubarrayBeamConfiguration: """A class to hold subarray_beam configuration attributes""" def __init__(self, subarray_beam_id: int, station_ids: List[int], channels: List[List[int]], update_rate: float, target: SubarrayBeamTarget, antenna_weights: List[float], phase_centre: List[float]): """Initial...
the_stack_v2_python_sparse
src/ska_tmc_cdm/messages/subarray_node/configure/mccs.py
ska-telescope/cdm-shared-library
train
0
5e53856906b22ba704b770636f090eef27fa3426
[ "q = [root]\nhead = 0\ntail = 1\nresult = []\nwhile head < tail:\n node = q[head]\n if node == None:\n result.append('null')\n else:\n result.append(node.val)\n q.append(node.left)\n q.append(node.right)\n tail += 2\n head += 1\nreturn ','.join(result)", "s = data.sp...
<|body_start_0|> q = [root] head = 0 tail = 1 result = [] while head < tail: node = q[head] if node == None: result.append('null') else: result.append(node.val) q.append(node.left) ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_003804
1,642
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_003909
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
6ce22264a9c34d6addf4eff4c196105eec12b113
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" q = [root] head = 0 tail = 1 result = [] while head < tail: node = q[head] if node == None: result.append('null') ...
the_stack_v2_python_sparse
Serialize_and_Deserialize_Binary_Tree.py
zhubw91/Leetcode
train
0
d26c3ef7075b4c7478bad9dfad44236f97461082
[ "assert isinstance(min_bound, float) or isinstance(min_bound, int) or isinstance(min_bound, torch.Tensor) or (min_bound is None)\nassert isinstance(max_bound, float) or isinstance(max_bound, int) or isinstance(max_bound, torch.Tensor) or (max_bound is None)\nself.min_bound = min_bound\n' (float) Minimum bound. '\ns...
<|body_start_0|> assert isinstance(min_bound, float) or isinstance(min_bound, int) or isinstance(min_bound, torch.Tensor) or (min_bound is None) assert isinstance(max_bound, float) or isinstance(max_bound, int) or isinstance(max_bound, torch.Tensor) or (max_bound is None) self.min_bound = min_bo...
Projection onto a box defined by minimum and maximum.
BoxProjection
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BoxProjection: """Projection onto a box defined by minimum and maximum.""" def __init__(self, min_bound=0, max_bound=1): """Constructor. :param min_bound: minimum bound :param min_bound: float :param max_bound: maximum bound :type: max_bound: float""" <|body_0|> def __ca...
stack_v2_sparse_classes_36k_train_003805
6,999
no_license
[ { "docstring": "Constructor. :param min_bound: minimum bound :param min_bound: float :param max_bound: maximum bound :type: max_bound: float", "name": "__init__", "signature": "def __init__(self, min_bound=0, max_bound=1)" }, { "docstring": "Projection. :param images: images :type images: torch....
2
stack_v2_sparse_classes_30k_train_001244
Implement the Python class `BoxProjection` described below. Class description: Projection onto a box defined by minimum and maximum. Method signatures and docstrings: - def __init__(self, min_bound=0, max_bound=1): Constructor. :param min_bound: minimum bound :param min_bound: float :param max_bound: maximum bound :t...
Implement the Python class `BoxProjection` described below. Class description: Projection onto a box defined by minimum and maximum. Method signatures and docstrings: - def __init__(self, min_bound=0, max_bound=1): Constructor. :param min_bound: minimum bound :param min_bound: float :param max_bound: maximum bound :t...
736c99b55a77d0c650eae5ced2d8312d13af0baf
<|skeleton|> class BoxProjection: """Projection onto a box defined by minimum and maximum.""" def __init__(self, min_bound=0, max_bound=1): """Constructor. :param min_bound: minimum bound :param min_bound: float :param max_bound: maximum bound :type: max_bound: float""" <|body_0|> def __ca...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BoxProjection: """Projection onto a box defined by minimum and maximum.""" def __init__(self, min_bound=0, max_bound=1): """Constructor. :param min_bound: minimum bound :param min_bound: float :param max_bound: maximum bound :type: max_bound: float""" assert isinstance(min_bound, float) o...
the_stack_v2_python_sparse
attacks/projections.py
Adversarial-Intelligence-Group/color-adversarial-training
train
0
29d08c57f2f54c97aa5b92fb5f0cd831617452ff
[ "valid, message = json_validate(enum, {'type': 'object', 'properties': {'enumeration': {'type': 'array', 'items': {'anyOf': [{'type': 'string'}, {'$ref': '#/pScheduler/Number'}]}}, 'invert': {'$ref': '#/pScheduler/Boolean'}}, 'additionalProperties': False, 'required': ['enumeration']})\nif not valid:\n raise Val...
<|body_start_0|> valid, message = json_validate(enum, {'type': 'object', 'properties': {'enumeration': {'type': 'array', 'items': {'anyOf': [{'type': 'string'}, {'$ref': '#/pScheduler/Number'}]}}, 'invert': {'$ref': '#/pScheduler/Boolean'}}, 'additionalProperties': False, 'required': ['enumeration']}) i...
Class that matches an enumeration.
EnumMatcher
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EnumMatcher: """Class that matches an enumeration.""" def __init__(self, enum): """Construct a matcher. The 'enum' argument is a dict that conforms to an EnumMatch as described in the pScheduler JSON Style Guide and Type Dictionary.""" <|body_0|> def __contains(self, enu...
stack_v2_sparse_classes_36k_train_003806
2,562
permissive
[ { "docstring": "Construct a matcher. The 'enum' argument is a dict that conforms to an EnumMatch as described in the pScheduler JSON Style Guide and Type Dictionary.", "name": "__init__", "signature": "def __init__(self, enum)" }, { "docstring": "Scan each element in the input enumeration and ma...
3
stack_v2_sparse_classes_30k_test_000875
Implement the Python class `EnumMatcher` described below. Class description: Class that matches an enumeration. Method signatures and docstrings: - def __init__(self, enum): Construct a matcher. The 'enum' argument is a dict that conforms to an EnumMatch as described in the pScheduler JSON Style Guide and Type Dictio...
Implement the Python class `EnumMatcher` described below. Class description: Class that matches an enumeration. Method signatures and docstrings: - def __init__(self, enum): Construct a matcher. The 'enum' argument is a dict that conforms to an EnumMatch as described in the pScheduler JSON Style Guide and Type Dictio...
f6d04c0455e5be4d490df16ec1acb377f9025d9f
<|skeleton|> class EnumMatcher: """Class that matches an enumeration.""" def __init__(self, enum): """Construct a matcher. The 'enum' argument is a dict that conforms to an EnumMatch as described in the pScheduler JSON Style Guide and Type Dictionary.""" <|body_0|> def __contains(self, enu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EnumMatcher: """Class that matches an enumeration.""" def __init__(self, enum): """Construct a matcher. The 'enum' argument is a dict that conforms to an EnumMatch as described in the pScheduler JSON Style Guide and Type Dictionary.""" valid, message = json_validate(enum, {'type': 'object...
the_stack_v2_python_sparse
python-pscheduler/pscheduler/pscheduler/enummatcher.py
perfsonar/pscheduler
train
53
f6a3506943dd703d7b939753a76a658da9e7cc5c
[ "argument_group.add_argument('--virustotal-api-key', '--virustotal_api_key', dest='virustotal_api_key', type=str, action='store', default=None, metavar='API_KEY', help='Specify the API key for use with VirusTotal.')\nargument_group.add_argument('--virustotal-free-rate-limit', '--virustotal_free_rate_limit', dest='v...
<|body_start_0|> argument_group.add_argument('--virustotal-api-key', '--virustotal_api_key', dest='virustotal_api_key', type=str, action='store', default=None, metavar='API_KEY', help='Specify the API key for use with VirusTotal.') argument_group.add_argument('--virustotal-free-rate-limit', '--virustota...
VirusTotal analysis plugin CLI arguments helper.
VirusTotalAnalysisArgumentsHelper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VirusTotalAnalysisArgumentsHelper: """VirusTotal analysis plugin CLI arguments helper.""" def AddArguments(cls, argument_group): """Adds command line arguments the helper supports to an argument group. This function takes an argument parser or an argument group object and adds to it ...
stack_v2_sparse_classes_36k_train_003807
3,424
permissive
[ { "docstring": "Adds command line arguments the helper supports to an argument group. This function takes an argument parser or an argument group object and adds to it all the command line arguments this helper supports. Args: argument_group (argparse._ArgumentGroup|argparse.ArgumentParser): argparse group.", ...
2
null
Implement the Python class `VirusTotalAnalysisArgumentsHelper` described below. Class description: VirusTotal analysis plugin CLI arguments helper. Method signatures and docstrings: - def AddArguments(cls, argument_group): Adds command line arguments the helper supports to an argument group. This function takes an ar...
Implement the Python class `VirusTotalAnalysisArgumentsHelper` described below. Class description: VirusTotal analysis plugin CLI arguments helper. Method signatures and docstrings: - def AddArguments(cls, argument_group): Adds command line arguments the helper supports to an argument group. This function takes an ar...
d6022f8cfebfddf2d08ab2d300a41b61f3349933
<|skeleton|> class VirusTotalAnalysisArgumentsHelper: """VirusTotal analysis plugin CLI arguments helper.""" def AddArguments(cls, argument_group): """Adds command line arguments the helper supports to an argument group. This function takes an argument parser or an argument group object and adds to it ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VirusTotalAnalysisArgumentsHelper: """VirusTotal analysis plugin CLI arguments helper.""" def AddArguments(cls, argument_group): """Adds command line arguments the helper supports to an argument group. This function takes an argument parser or an argument group object and adds to it all the comma...
the_stack_v2_python_sparse
plaso/cli/helpers/virustotal_analysis.py
log2timeline/plaso
train
1,506
b643c161634586c58279fe7d882cae44c8e131ae
[ "if root is None:\n return ''\nq = []\n\ndef preorder(root):\n if root is None:\n return None\n else:\n q.append(root.val)\n for child in (root, children):\n preorder(child)\n q.append('#')\npreorder(root)\nreturn ','.join(map(str, q))", "if data == '':\n return ...
<|body_start_0|> if root is None: return '' q = [] def preorder(root): if root is None: return None else: q.append(root.val) for child in (root, children): preorder(child) q.a...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: Node :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: Node""" <|body_1|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_36k_train_003808
1,377
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: Node :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: Node", "name": "deserialize", "signature": "def deserialize(self, ...
2
stack_v2_sparse_classes_30k_train_007572
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: Node :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype: Nod...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: Node :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype: Nod...
48ba21799f63225c104f649c3871444a29ab978a
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: Node :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: Node""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: Node :rtype: str""" if root is None: return '' q = [] def preorder(root): if root is None: return None else: q.append(root.va...
the_stack_v2_python_sparse
archive/428. Serialize and Deserialize N-ary Tree.py
doraemon1293/Leetcode
train
0
91f0b1ad868614320f65d62713e4db67ec6b3fda
[ "self.structure = structure\nself.element = element\nframework = list(self.structure.symbol_set)\nget_voronoi = TopographyAnalyzer(self.structure, framework, [], check_volume=False)\nget_voronoi.cluster_nodes()\nget_voronoi.remove_collisions()\nstruct_to_trim = self.structure.copy()\nfor poss_inter in get_voronoi.v...
<|body_start_0|> self.structure = structure self.element = element framework = list(self.structure.symbol_set) get_voronoi = TopographyAnalyzer(self.structure, framework, [], check_volume=False) get_voronoi.cluster_nodes() get_voronoi.remove_collisions() struct_to...
Generator for interstitials based on a simple Voronoi analysis
VoronoiInterstitialGenerator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VoronoiInterstitialGenerator: """Generator for interstitials based on a simple Voronoi analysis""" def __init__(self, structure, element): """Initializes an Interstitial generator using Voronoi sites Args: structure (Structure): pymatgen structure object element (str or Element or Sp...
stack_v2_sparse_classes_36k_train_003809
10,935
permissive
[ { "docstring": "Initializes an Interstitial generator using Voronoi sites Args: structure (Structure): pymatgen structure object element (str or Element or Specie): element for the interstitial", "name": "__init__", "signature": "def __init__(self, structure, element)" }, { "docstring": "Returns...
2
stack_v2_sparse_classes_30k_train_018102
Implement the Python class `VoronoiInterstitialGenerator` described below. Class description: Generator for interstitials based on a simple Voronoi analysis Method signatures and docstrings: - def __init__(self, structure, element): Initializes an Interstitial generator using Voronoi sites Args: structure (Structure)...
Implement the Python class `VoronoiInterstitialGenerator` described below. Class description: Generator for interstitials based on a simple Voronoi analysis Method signatures and docstrings: - def __init__(self, structure, element): Initializes an Interstitial generator using Voronoi sites Args: structure (Structure)...
62ecae1c7382a41861e3a5d9b9c8dd1207472409
<|skeleton|> class VoronoiInterstitialGenerator: """Generator for interstitials based on a simple Voronoi analysis""" def __init__(self, structure, element): """Initializes an Interstitial generator using Voronoi sites Args: structure (Structure): pymatgen structure object element (str or Element or Sp...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VoronoiInterstitialGenerator: """Generator for interstitials based on a simple Voronoi analysis""" def __init__(self, structure, element): """Initializes an Interstitial generator using Voronoi sites Args: structure (Structure): pymatgen structure object element (str or Element or Specie): elemen...
the_stack_v2_python_sparse
pymatgen/analysis/defects/generators.py
montoyjh/pymatgen
train
2
08d97da13f5f408795f39aeec6c8fff88bf7139a
[ "R = math.log(frecuencia_final / frecuencia_inicial)\nL = duracion / R\nK = 2 * math.pi * frecuencia_inicial * L\ndominio_temporal = list(numpy.arange(0, duracion, 1 / fs))\nvalores = []\nfor t in dominio_temporal:\n valores.append(math.sin(K * (math.exp(t / L) - 1)))\nreturn SenalAudio(fs, dominio_temporal, val...
<|body_start_0|> R = math.log(frecuencia_final / frecuencia_inicial) L = duracion / R K = 2 * math.pi * frecuencia_inicial * L dominio_temporal = list(numpy.arange(0, duracion, 1 / fs)) valores = [] for t in dominio_temporal: valores.append(math.sin(K * (math....
GeneradorESS
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GeneradorESS: def generar_senal_ess(self, fs, duracion, frecuencia_inicial, frecuencia_final): """La señal ESS está dada por la expresión: s(t) = sin[K.(exp(t/L) - 1)] = sin[(2pi.f1.T/R).(exp(tR/T) - 1)] Las constantes K, L, R son como sigue: K = 2pi.f1.L L = T/R R = ln(f2/f1) Se indican...
stack_v2_sparse_classes_36k_train_003810
2,292
no_license
[ { "docstring": "La señal ESS está dada por la expresión: s(t) = sin[K.(exp(t/L) - 1)] = sin[(2pi.f1.T/R).(exp(tR/T) - 1)] Las constantes K, L, R son como sigue: K = 2pi.f1.L L = T/R R = ln(f2/f1) Se indican las dos notaciones equivalentes porque en distintas fuentes aparecen ambas. Esta señal es una senoide cuy...
2
stack_v2_sparse_classes_30k_test_000181
Implement the Python class `GeneradorESS` described below. Class description: Implement the GeneradorESS class. Method signatures and docstrings: - def generar_senal_ess(self, fs, duracion, frecuencia_inicial, frecuencia_final): La señal ESS está dada por la expresión: s(t) = sin[K.(exp(t/L) - 1)] = sin[(2pi.f1.T/R)....
Implement the Python class `GeneradorESS` described below. Class description: Implement the GeneradorESS class. Method signatures and docstrings: - def generar_senal_ess(self, fs, duracion, frecuencia_inicial, frecuencia_final): La señal ESS está dada por la expresión: s(t) = sin[K.(exp(t/L) - 1)] = sin[(2pi.f1.T/R)....
6ad8569d065038dab11f3ee472998d2c77f8f90b
<|skeleton|> class GeneradorESS: def generar_senal_ess(self, fs, duracion, frecuencia_inicial, frecuencia_final): """La señal ESS está dada por la expresión: s(t) = sin[K.(exp(t/L) - 1)] = sin[(2pi.f1.T/R).(exp(tR/T) - 1)] Las constantes K, L, R son como sigue: K = 2pi.f1.L L = T/R R = ln(f2/f1) Se indican...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GeneradorESS: def generar_senal_ess(self, fs, duracion, frecuencia_inicial, frecuencia_final): """La señal ESS está dada por la expresión: s(t) = sin[K.(exp(t/L) - 1)] = sin[(2pi.f1.T/R).(exp(tR/T) - 1)] Las constantes K, L, R son como sigue: K = 2pi.f1.L L = T/R R = ln(f2/f1) Se indican las dos notac...
the_stack_v2_python_sparse
Python/medidor_acustico/src/core/domain/generadores_de_senales/generador_ess.py
GabrielPenaU3F/TrabajoTesis
train
0
d65a7d4a0546c6543dbacbd13b00d6c60eac5083
[ "if node.block_items is None:\n return node\nself.remove_list = []\nfor index, child in enumerate(node.block_items):\n if isinstance(child, (AST.For, AST.While, AST.DoWhile)):\n child.stmt = self.ensure_compound(node, index, child.stmt)\n elif isinstance(child, AST.If):\n child.iftrue = self....
<|body_start_0|> if node.block_items is None: return node self.remove_list = [] for index, child in enumerate(node.block_items): if isinstance(child, (AST.For, AST.While, AST.DoWhile)): child.stmt = self.ensure_compound(node, index, child.stmt) ...
Put compound blocks where needed in order to have pragma's properly be before what they were meant to
CorrectPragmaPlacement
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CorrectPragmaPlacement: """Put compound blocks where needed in order to have pragma's properly be before what they were meant to""" def visit_Compound(self, node): """Search compound for pragma nodes to transform""" <|body_0|> def ensure_compound(self, compound, index, i...
stack_v2_sparse_classes_36k_train_003811
2,247
no_license
[ { "docstring": "Search compound for pragma nodes to transform", "name": "visit_Compound", "signature": "def visit_Compound(self, node)" }, { "docstring": "If pragma grap next and make compound, if compound do nothing alse make compound", "name": "ensure_compound", "signature": "def ensur...
2
null
Implement the Python class `CorrectPragmaPlacement` described below. Class description: Put compound blocks where needed in order to have pragma's properly be before what they were meant to Method signatures and docstrings: - def visit_Compound(self, node): Search compound for pragma nodes to transform - def ensure_c...
Implement the Python class `CorrectPragmaPlacement` described below. Class description: Put compound blocks where needed in order to have pragma's properly be before what they were meant to Method signatures and docstrings: - def visit_Compound(self, node): Search compound for pragma nodes to transform - def ensure_c...
51bd9de9f264545d78c03e3cb75fe1aa2a421444
<|skeleton|> class CorrectPragmaPlacement: """Put compound blocks where needed in order to have pragma's properly be before what they were meant to""" def visit_Compound(self, node): """Search compound for pragma nodes to transform""" <|body_0|> def ensure_compound(self, compound, index, i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CorrectPragmaPlacement: """Put compound blocks where needed in order to have pragma's properly be before what they were meant to""" def visit_Compound(self, node): """Search compound for pragma nodes to transform""" if node.block_items is None: return node self.remove_...
the_stack_v2_python_sparse
transforms/correct_pragma_placement.py
mrchristensen/Censor
train
0
75445e21e6d41735e67d31598f565f9b56c5ef5a
[ "addr_space = utils.load_as(self._config)\nresult = None\nadrs = addr_space\nwhile adrs:\n if adrs.__class__.__name__ == 'WindowsHiberFileSpace32':\n sr = adrs.ProcState.SpecialRegisters\n peb = obj.NoneObject('Cannot locate a valid PEB')\n for task in tasks.pslist(addr_space):\n ...
<|body_start_0|> addr_space = utils.load_as(self._config) result = None adrs = addr_space while adrs: if adrs.__class__.__name__ == 'WindowsHiberFileSpace32': sr = adrs.ProcState.SpecialRegisters peb = obj.NoneObject('Cannot locate a valid PEB'...
Dump hibernation file information
HibInfo
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HibInfo: """Dump hibernation file information""" def calculate(self): """Determines the address space""" <|body_0|> def render_text(self, outfd, data): """Renders the hiberfil header as text""" <|body_1|> <|end_skeleton|> <|body_start_0|> addr_s...
stack_v2_sparse_classes_36k_train_003812
3,041
no_license
[ { "docstring": "Determines the address space", "name": "calculate", "signature": "def calculate(self)" }, { "docstring": "Renders the hiberfil header as text", "name": "render_text", "signature": "def render_text(self, outfd, data)" } ]
2
stack_v2_sparse_classes_30k_train_020940
Implement the Python class `HibInfo` described below. Class description: Dump hibernation file information Method signatures and docstrings: - def calculate(self): Determines the address space - def render_text(self, outfd, data): Renders the hiberfil header as text
Implement the Python class `HibInfo` described below. Class description: Dump hibernation file information Method signatures and docstrings: - def calculate(self): Determines the address space - def render_text(self, outfd, data): Renders the hiberfil header as text <|skeleton|> class HibInfo: """Dump hibernatio...
addbc8c73e7e6fb9e4fcadcec022fa1d3da4b96d
<|skeleton|> class HibInfo: """Dump hibernation file information""" def calculate(self): """Determines the address space""" <|body_0|> def render_text(self, outfd, data): """Renders the hiberfil header as text""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HibInfo: """Dump hibernation file information""" def calculate(self): """Determines the address space""" addr_space = utils.load_as(self._config) result = None adrs = addr_space while adrs: if adrs.__class__.__name__ == 'WindowsHiberFileSpace32': ...
the_stack_v2_python_sparse
我手敲的代码(中文注释)/chapter11/volatility/plugins/hibinfo.py
giantbranch/python-hacker-code
train
400
7f43f15cf9e55c8a9c3151392086d821effb23ff
[ "self.task = task\nself.orchestrator = orchestrator\nself.state_manager = state_manager\nself.logger = logging.getLogger(config.config_mgr.conf.logging.global_logger_name)", "task_futures = dict()\nwith concurrent.futures.ThreadPoolExecutor(max_workers=64) as te:\n for t in subtask_id_list:\n task_futur...
<|body_start_0|> self.task = task self.orchestrator = orchestrator self.state_manager = state_manager self.logger = logging.getLogger(config.config_mgr.conf.logging.global_logger_name) <|end_body_0|> <|body_start_1|> task_futures = dict() with concurrent.futures.ThreadPo...
The base class for actions starts by the orchestrator.
BaseAction
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseAction: """The base class for actions starts by the orchestrator.""" def __init__(self, task, orchestrator, state_manager): """Object initializer. :param task: objects.Task instance this action will execute against :param orchestrator: orchestrator.Orchestrator instance :param st...
stack_v2_sparse_classes_36k_train_003813
47,038
permissive
[ { "docstring": "Object initializer. :param task: objects.Task instance this action will execute against :param orchestrator: orchestrator.Orchestrator instance :param state_manager: state.DrydockState instnace used to access task state", "name": "__init__", "signature": "def __init__(self, task, orchest...
6
null
Implement the Python class `BaseAction` described below. Class description: The base class for actions starts by the orchestrator. Method signatures and docstrings: - def __init__(self, task, orchestrator, state_manager): Object initializer. :param task: objects.Task instance this action will execute against :param o...
Implement the Python class `BaseAction` described below. Class description: The base class for actions starts by the orchestrator. Method signatures and docstrings: - def __init__(self, task, orchestrator, state_manager): Object initializer. :param task: objects.Task instance this action will execute against :param o...
f99abfa4337f8cbb591513aac404b11208d4187c
<|skeleton|> class BaseAction: """The base class for actions starts by the orchestrator.""" def __init__(self, task, orchestrator, state_manager): """Object initializer. :param task: objects.Task instance this action will execute against :param orchestrator: orchestrator.Orchestrator instance :param st...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseAction: """The base class for actions starts by the orchestrator.""" def __init__(self, task, orchestrator, state_manager): """Object initializer. :param task: objects.Task instance this action will execute against :param orchestrator: orchestrator.Orchestrator instance :param state_manager: ...
the_stack_v2_python_sparse
python/drydock_provisioner/orchestrator/actions/orchestrator.py
airshipit/drydock
train
13
34f9358fb97fa396e17a005ccdf8c9075facbd0d
[ "self.parent = parent\nself.stages = [ConnectSqlStage(self), SqlScriptStage(self, 'demo_script'), DisconnectSqlStage(self)]\nself.stages_dict = {stage.name: stage for stage in self.stages}\nself.stages_executed = {stage.name: False for stage in self.stages}", "parents = [stage.get_argument_parser() for stage in s...
<|body_start_0|> self.parent = parent self.stages = [ConnectSqlStage(self), SqlScriptStage(self, 'demo_script'), DisconnectSqlStage(self)] self.stages_dict = {stage.name: stage for stage in self.stages} self.stages_executed = {stage.name: False for stage in self.stages} <|end_body_0|> <...
A class for the whole data pipeline / workflow
Pipeline
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Pipeline: """A class for the whole data pipeline / workflow""" def __init__(self, parent=None): """Init function for the pipeline. Args: parent: parent stage.""" <|body_0|> def get_argument_parser(self): """Returns argument parser for the pipeline / workflow.""" ...
stack_v2_sparse_classes_36k_train_003814
3,017
no_license
[ { "docstring": "Init function for the pipeline. Args: parent: parent stage.", "name": "__init__", "signature": "def __init__(self, parent=None)" }, { "docstring": "Returns argument parser for the pipeline / workflow.", "name": "get_argument_parser", "signature": "def get_argument_parser(...
4
stack_v2_sparse_classes_30k_train_014236
Implement the Python class `Pipeline` described below. Class description: A class for the whole data pipeline / workflow Method signatures and docstrings: - def __init__(self, parent=None): Init function for the pipeline. Args: parent: parent stage. - def get_argument_parser(self): Returns argument parser for the pip...
Implement the Python class `Pipeline` described below. Class description: A class for the whole data pipeline / workflow Method signatures and docstrings: - def __init__(self, parent=None): Init function for the pipeline. Args: parent: parent stage. - def get_argument_parser(self): Returns argument parser for the pip...
70bf124944125cb04e046b19ed6cb4c6ff599812
<|skeleton|> class Pipeline: """A class for the whole data pipeline / workflow""" def __init__(self, parent=None): """Init function for the pipeline. Args: parent: parent stage.""" <|body_0|> def get_argument_parser(self): """Returns argument parser for the pipeline / workflow.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Pipeline: """A class for the whole data pipeline / workflow""" def __init__(self, parent=None): """Init function for the pipeline. Args: parent: parent stage.""" self.parent = parent self.stages = [ConnectSqlStage(self), SqlScriptStage(self, 'demo_script'), DisconnectSqlStage(self...
the_stack_v2_python_sparse
The Blue Spiders/checkpoint_1/src/pipeline.py
amcheyre-nw/Invisible-Institute-Chicago-Reporter-Collaboration-Public
train
0
531253f34177ff3fe2dc5e89bee8abfd9deaa15c
[ "super().__init__(**kwargs)\nif not self.port:\n self.port = self.default_port\nself.priority = NotifyGrowl.template_args['priority']['default'] if not priority else next((v for k, v in GROWL_PRIORITY_MAP.items() if str(priority).lower().startswith(k)), NotifyGrowl.template_args['priority']['default'])\nself.gro...
<|body_start_0|> super().__init__(**kwargs) if not self.port: self.port = self.default_port self.priority = NotifyGrowl.template_args['priority']['default'] if not priority else next((v for k, v in GROWL_PRIORITY_MAP.items() if str(priority).lower().startswith(k)), NotifyGrowl.templa...
A wrapper to Growl Notifications
NotifyGrowl
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NotifyGrowl: """A wrapper to Growl Notifications""" def __init__(self, priority=None, version=2, include_image=True, sticky=False, **kwargs): """Initialize Growl Object""" <|body_0|> def register(self): """Registers with the Growl server""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_003815
14,228
permissive
[ { "docstring": "Initialize Growl Object", "name": "__init__", "signature": "def __init__(self, priority=None, version=2, include_image=True, sticky=False, **kwargs)" }, { "docstring": "Registers with the Growl server", "name": "register", "signature": "def register(self)" }, { "d...
5
stack_v2_sparse_classes_30k_train_014068
Implement the Python class `NotifyGrowl` described below. Class description: A wrapper to Growl Notifications Method signatures and docstrings: - def __init__(self, priority=None, version=2, include_image=True, sticky=False, **kwargs): Initialize Growl Object - def register(self): Registers with the Growl server - de...
Implement the Python class `NotifyGrowl` described below. Class description: A wrapper to Growl Notifications Method signatures and docstrings: - def __init__(self, priority=None, version=2, include_image=True, sticky=False, **kwargs): Initialize Growl Object - def register(self): Registers with the Growl server - de...
be3baed7e3d33bae973f1714df4ebbf65aa33f85
<|skeleton|> class NotifyGrowl: """A wrapper to Growl Notifications""" def __init__(self, priority=None, version=2, include_image=True, sticky=False, **kwargs): """Initialize Growl Object""" <|body_0|> def register(self): """Registers with the Growl server""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NotifyGrowl: """A wrapper to Growl Notifications""" def __init__(self, priority=None, version=2, include_image=True, sticky=False, **kwargs): """Initialize Growl Object""" super().__init__(**kwargs) if not self.port: self.port = self.default_port self.priority ...
the_stack_v2_python_sparse
apprise/plugins/NotifyGrowl.py
caronc/apprise
train
8,426
e4bb20e18af12f6f40e4bee612b1e2c60a09fa1a
[ "self._guesses = set()\nself._answer = get_random_number()\nself._win = False\npass", "usernumber = input(f'Guess a number between {START} and {END}: ')\nif usernumber == '' or usernumber == None:\n raise ValueError('Please enter a number')\ntry:\n usernumber = int(usernumber)\nexcept:\n raise ValueError...
<|body_start_0|> self._guesses = set() self._answer = get_random_number() self._win = False pass <|end_body_0|> <|body_start_1|> usernumber = input(f'Guess a number between {START} and {END}: ') if usernumber == '' or usernumber == None: raise ValueError('Ple...
Number guess class, make it callable to initiate game
Game
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Game: """Number guess class, make it callable to initiate game""" def __init__(self): """Init _guesses, _answer, _win to set(), get_random_number(), False""" <|body_0|> def guess(self): """Ask user for input, convert to int, raise ValueError outputting the follow...
stack_v2_sparse_classes_36k_train_003816
2,768
permissive
[ { "docstring": "Init _guesses, _answer, _win to set(), get_random_number(), False", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Ask user for input, convert to int, raise ValueError outputting the following errors when applicable: 'Please enter a number' 'Should be a ...
4
stack_v2_sparse_classes_30k_val_000619
Implement the Python class `Game` described below. Class description: Number guess class, make it callable to initiate game Method signatures and docstrings: - def __init__(self): Init _guesses, _answer, _win to set(), get_random_number(), False - def guess(self): Ask user for input, convert to int, raise ValueError ...
Implement the Python class `Game` described below. Class description: Number guess class, make it callable to initiate game Method signatures and docstrings: - def __init__(self): Init _guesses, _answer, _win to set(), get_random_number(), False - def guess(self): Ask user for input, convert to int, raise ValueError ...
e5738f4f685bad4c8fb140cbc057faa441d4b34c
<|skeleton|> class Game: """Number guess class, make it callable to initiate game""" def __init__(self): """Init _guesses, _answer, _win to set(), get_random_number(), False""" <|body_0|> def guess(self): """Ask user for input, convert to int, raise ValueError outputting the follow...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Game: """Number guess class, make it callable to initiate game""" def __init__(self): """Init _guesses, _answer, _win to set(), get_random_number(), False""" self._guesses = set() self._answer = get_random_number() self._win = False pass def guess(self): ...
the_stack_v2_python_sparse
guess.py
rayjustinhuang/BitesofPy
train
0
6ec325db885ed7f373cc1b6abb2403697c1ea06c
[ "arguments.AddCopyBackupResourceArgs(parser)\ngroup_parser = parser.add_argument_group(mutex=True, required=True)\ngroup_parser.add_argument('--expiration-date', help='Expiration time of the backup, must be at least 6 hours and at most 30 days from the time the source backup is created. See `$ gcloud topic datetime...
<|body_start_0|> arguments.AddCopyBackupResourceArgs(parser) group_parser = parser.add_argument_group(mutex=True, required=True) group_parser.add_argument('--expiration-date', help='Expiration time of the backup, must be at least 6 hours and at most 30 days from the time the source backup is cre...
Copy a Cloud Bigtable backup to a new backup.
Copy
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Copy: """Copy a Cloud Bigtable backup to a new backup.""" def Args(parser): """Register flags for this command.""" <|body_0|> def Run(self, args): """This is what gets called when the user runs this command. Args: args: an argparse namespace. All the arguments th...
stack_v2_sparse_classes_36k_train_003817
4,326
permissive
[ { "docstring": "Register flags for this command.", "name": "Args", "signature": "def Args(parser)" }, { "docstring": "This is what gets called when the user runs this command. Args: args: an argparse namespace. All the arguments that were provided to this command invocation. Returns: Some value ...
2
null
Implement the Python class `Copy` described below. Class description: Copy a Cloud Bigtable backup to a new backup. Method signatures and docstrings: - def Args(parser): Register flags for this command. - def Run(self, args): This is what gets called when the user runs this command. Args: args: an argparse namespace....
Implement the Python class `Copy` described below. Class description: Copy a Cloud Bigtable backup to a new backup. Method signatures and docstrings: - def Args(parser): Register flags for this command. - def Run(self, args): This is what gets called when the user runs this command. Args: args: an argparse namespace....
392abf004b16203030e6efd2f0af24db7c8d669e
<|skeleton|> class Copy: """Copy a Cloud Bigtable backup to a new backup.""" def Args(parser): """Register flags for this command.""" <|body_0|> def Run(self, args): """This is what gets called when the user runs this command. Args: args: an argparse namespace. All the arguments th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Copy: """Copy a Cloud Bigtable backup to a new backup.""" def Args(parser): """Register flags for this command.""" arguments.AddCopyBackupResourceArgs(parser) group_parser = parser.add_argument_group(mutex=True, required=True) group_parser.add_argument('--expiration-date',...
the_stack_v2_python_sparse
lib/surface/bigtable/backups/copy.py
google-cloud-sdk-unofficial/google-cloud-sdk
train
9
35ba8c7480032f3e5c249f11b5daad33273ee74a
[ "if is_dataverse_app_to_route(model._meta.app_label):\n return DB_REFERENCE_NAME\nreturn None", "if is_dataverse_app_to_route(model._meta.app_label):\n return DB_REFERENCE_NAME\nreturn None", "if is_dataverse_app_to_route(obj1._meta.app_label) or is_dataverse_app_to_route(obj2._meta.app_label):\n retur...
<|body_start_0|> if is_dataverse_app_to_route(model._meta.app_label): return DB_REFERENCE_NAME return None <|end_body_0|> <|body_start_1|> if is_dataverse_app_to_route(model._meta.app_label): return DB_REFERENCE_NAME return None <|end_body_1|> <|body_start_2|> ...
A router to control all database operations on models in the auth application.
DataverseRouter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataverseRouter: """A router to control all database operations on models in the auth application.""" def db_for_read(self, model, **hints): """Attempts to read auth models go to auth_db.""" <|body_0|> def db_for_write(self, model, **hints): """Attempts to write ...
stack_v2_sparse_classes_36k_train_003818
2,258
no_license
[ { "docstring": "Attempts to read auth models go to auth_db.", "name": "db_for_read", "signature": "def db_for_read(self, model, **hints)" }, { "docstring": "Attempts to write auth models go to auth_db.", "name": "db_for_write", "signature": "def db_for_write(self, model, **hints)" }, ...
4
stack_v2_sparse_classes_30k_val_000861
Implement the Python class `DataverseRouter` described below. Class description: A router to control all database operations on models in the auth application. Method signatures and docstrings: - def db_for_read(self, model, **hints): Attempts to read auth models go to auth_db. - def db_for_write(self, model, **hints...
Implement the Python class `DataverseRouter` described below. Class description: A router to control all database operations on models in the auth application. Method signatures and docstrings: - def db_for_read(self, model, **hints): Attempts to read auth models go to auth_db. - def db_for_write(self, model, **hints...
2a17e5ba918d6d1c7d38c192e0504e6cd96b32d2
<|skeleton|> class DataverseRouter: """A router to control all database operations on models in the auth application.""" def db_for_read(self, model, **hints): """Attempts to read auth models go to auth_db.""" <|body_0|> def db_for_write(self, model, **hints): """Attempts to write ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DataverseRouter: """A router to control all database operations on models in the auth application.""" def db_for_read(self, model, **hints): """Attempts to read auth models go to auth_db.""" if is_dataverse_app_to_route(model._meta.app_label): return DB_REFERENCE_NAME ...
the_stack_v2_python_sparse
miniverse/db_routers/db_dataverse_router.py
IQSS/miniverse
train
3
e9a06b1443a9c5ec7a1550a213732db49206d75c
[ "hashset = set()\nfor num in nums:\n if num in hashset:\n return num\n else:\n hashset.add(num)\nreturn -1", "nums = nums.copy()\ni = 0\nwhile i < len(nums):\n if nums[i] == i:\n i += 1\n continue\n if nums[nums[i]] == nums[i]:\n return nums[i]\n temp = nums[nums[...
<|body_start_0|> hashset = set() for num in nums: if num in hashset: return num else: hashset.add(num) return -1 <|end_body_0|> <|body_start_1|> nums = nums.copy() i = 0 while i < len(nums): if nums[i] =...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findRepeatNumber_1(self, nums: List[int]) -> int: """方法一:哈希表 / Set 时间复杂度 O(N) : 遍历数组使用 O(N) ,HashSet 添加与查找元素皆为 O(1) 。 空间复杂度 O(N) : HashSet 占用 O(N) 大小的额外空间。 :param nums: :return:""" <|body_0|> def findRepeatNumber_2(self, nums: [int]) -> int: """方法二:原地交换...
stack_v2_sparse_classes_36k_train_003819
2,011
no_license
[ { "docstring": "方法一:哈希表 / Set 时间复杂度 O(N) : 遍历数组使用 O(N) ,HashSet 添加与查找元素皆为 O(1) 。 空间复杂度 O(N) : HashSet 占用 O(N) 大小的额外空间。 :param nums: :return:", "name": "findRepeatNumber_1", "signature": "def findRepeatNumber_1(self, nums: List[int]) -> int" }, { "docstring": "方法二:原地交换 时间复杂度 O(N) : 遍历数组使用 O(N) ,每...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findRepeatNumber_1(self, nums: List[int]) -> int: 方法一:哈希表 / Set 时间复杂度 O(N) : 遍历数组使用 O(N) ,HashSet 添加与查找元素皆为 O(1) 。 空间复杂度 O(N) : HashSet 占用 O(N) 大小的额外空间。 :param nums: :return:...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findRepeatNumber_1(self, nums: List[int]) -> int: 方法一:哈希表 / Set 时间复杂度 O(N) : 遍历数组使用 O(N) ,HashSet 添加与查找元素皆为 O(1) 。 空间复杂度 O(N) : HashSet 占用 O(N) 大小的额外空间。 :param nums: :return:...
62419b49000e79962bcdc99cd98afd2fb82ea345
<|skeleton|> class Solution: def findRepeatNumber_1(self, nums: List[int]) -> int: """方法一:哈希表 / Set 时间复杂度 O(N) : 遍历数组使用 O(N) ,HashSet 添加与查找元素皆为 O(1) 。 空间复杂度 O(N) : HashSet 占用 O(N) 大小的额外空间。 :param nums: :return:""" <|body_0|> def findRepeatNumber_2(self, nums: [int]) -> int: """方法二:原地交换...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findRepeatNumber_1(self, nums: List[int]) -> int: """方法一:哈希表 / Set 时间复杂度 O(N) : 遍历数组使用 O(N) ,HashSet 添加与查找元素皆为 O(1) 。 空间复杂度 O(N) : HashSet 占用 O(N) 大小的额外空间。 :param nums: :return:""" hashset = set() for num in nums: if num in hashset: return num ...
the_stack_v2_python_sparse
剑指 Offer(第 2 版)/findRepeatNumber.py
MaoningGuan/LeetCode
train
3
d74496e1b176070fcd5d91b200a480c79cf17240
[ "self.pairs = pairs\nself.change_types = change_types\nself.func = None\nself.funcname = None", "assert isinstance(func, FunctionType), 'func must be a function'\nself.func = func\nreturn self", "clone = type(self)(self.pairs, self.change_types)\nclone.func = self.func\nreturn clone" ]
<|body_start_0|> self.pairs = pairs self.change_types = change_types self.func = None self.funcname = None <|end_body_0|> <|body_start_1|> assert isinstance(func, FunctionType), 'func must be a function' self.func = func return self <|end_body_1|> <|body_start_2...
An object used to temporarily store observe decorator state.
ObserveHandler
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObserveHandler: """An object used to temporarily store observe decorator state.""" def __init__(self, pairs: List[Tuple[str, Optional[str]]], change_types: ChangeType=ChangeType.ANY) -> None: """Initialize an ObserveHandler. Parameters ---------- pairs : list The list of 2-tuples whi...
stack_v2_sparse_classes_36k_train_003820
5,816
permissive
[ { "docstring": "Initialize an ObserveHandler. Parameters ---------- pairs : list The list of 2-tuples which stores the pair information for the observers.", "name": "__init__", "signature": "def __init__(self, pairs: List[Tuple[str, Optional[str]]], change_types: ChangeType=ChangeType.ANY) -> None" },...
3
null
Implement the Python class `ObserveHandler` described below. Class description: An object used to temporarily store observe decorator state. Method signatures and docstrings: - def __init__(self, pairs: List[Tuple[str, Optional[str]]], change_types: ChangeType=ChangeType.ANY) -> None: Initialize an ObserveHandler. Pa...
Implement the Python class `ObserveHandler` described below. Class description: An object used to temporarily store observe decorator state. Method signatures and docstrings: - def __init__(self, pairs: List[Tuple[str, Optional[str]]], change_types: ChangeType=ChangeType.ANY) -> None: Initialize an ObserveHandler. Pa...
761a52821d8c77b5718216256963682d11599c1e
<|skeleton|> class ObserveHandler: """An object used to temporarily store observe decorator state.""" def __init__(self, pairs: List[Tuple[str, Optional[str]]], change_types: ChangeType=ChangeType.ANY) -> None: """Initialize an ObserveHandler. Parameters ---------- pairs : list The list of 2-tuples whi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ObserveHandler: """An object used to temporarily store observe decorator state.""" def __init__(self, pairs: List[Tuple[str, Optional[str]]], change_types: ChangeType=ChangeType.ANY) -> None: """Initialize an ObserveHandler. Parameters ---------- pairs : list The list of 2-tuples which stores the...
the_stack_v2_python_sparse
atom/meta/observation.py
nucleic/atom
train
251
c1ce0248beb8436e7a53924ce5884e5c28f299f9
[ "wb = load_workbook(file, read_only=True, data_only=True)\nlogger.debug('In parse(). workbook has %d sheets' % len(wb.worksheets))\nif len(wb.worksheets) > 1:\n reporting.warnings(self.import_uuid, exceptions.IgnoredWorksheetWarning(processed_title=wb.sheetnames[0], ignored_sheet_count=len(wb.worksheets) - 1))\n...
<|body_start_0|> wb = load_workbook(file, read_only=True, data_only=True) logger.debug('In parse(). workbook has %d sheets' % len(wb.worksheets)) if len(wb.worksheets) > 1: reporting.warnings(self.import_uuid, exceptions.IgnoredWorksheetWarning(processed_title=wb.sheetnames[0], ignor...
ExcelParserMixin
[ "BSD-3-Clause", "BSD-3-Clause-LBNL" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExcelParserMixin: def parse(self, file): """Parses the input as an Excel workbook. :param file: a file-like object :return: the ParseResult read from file, otherwise None :raises OSError: if the file can't be opened :raises EDDImportError: if the file format or content is bad""" ...
stack_v2_sparse_classes_36k_train_003821
28,563
permissive
[ { "docstring": "Parses the input as an Excel workbook. :param file: a file-like object :return: the ParseResult read from file, otherwise None :raises OSError: if the file can't be opened :raises EDDImportError: if the file format or content is bad", "name": "parse", "signature": "def parse(self, file)"...
2
stack_v2_sparse_classes_30k_train_012913
Implement the Python class `ExcelParserMixin` described below. Class description: Implement the ExcelParserMixin class. Method signatures and docstrings: - def parse(self, file): Parses the input as an Excel workbook. :param file: a file-like object :return: the ParseResult read from file, otherwise None :raises OSEr...
Implement the Python class `ExcelParserMixin` described below. Class description: Implement the ExcelParserMixin class. Method signatures and docstrings: - def parse(self, file): Parses the input as an Excel workbook. :param file: a file-like object :return: the ParseResult read from file, otherwise None :raises OSEr...
271a7041c90572d5d197fba01effde164bc96ca7
<|skeleton|> class ExcelParserMixin: def parse(self, file): """Parses the input as an Excel workbook. :param file: a file-like object :return: the ParseResult read from file, otherwise None :raises OSError: if the file can't be opened :raises EDDImportError: if the file format or content is bad""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExcelParserMixin: def parse(self, file): """Parses the input as an Excel workbook. :param file: a file-like object :return: the ParseResult read from file, otherwise None :raises OSError: if the file can't be opened :raises EDDImportError: if the file format or content is bad""" wb = load_work...
the_stack_v2_python_sparse
server/edd/load/parsers/core.py
JBEI/edd
train
13
0f9a5e2a890d221659cd3f87b76f6e5396da7d6e
[ "self.frameDelay = frameDelay\nself.T = pc_rotx(rx / 180 * 3.14159)\nself.storeV = np.zeros((frameDelay, 3))\nself.fi = 0\nself.lastpc = np.zeros((1, 3))\nself.dt = TimeRecord()", "pc = transxy(joint, imgd)\ndv = (pc - self.lastpc) / self.dt.timePass()\ndv = pc_trans(self.T, dv)\nself.storeV[self.fi] = dv[0]\nsel...
<|body_start_0|> self.frameDelay = frameDelay self.T = pc_rotx(rx / 180 * 3.14159) self.storeV = np.zeros((frameDelay, 3)) self.fi = 0 self.lastpc = np.zeros((1, 3)) self.dt = TimeRecord() <|end_body_0|> <|body_start_1|> pc = transxy(joint, imgd) dv = (pc...
CalMeanSpeed
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CalMeanSpeed: def __init__(self, frameDelay=4, rx=-30): """:param frameDelay: 计算平均速度的帧数 :param rx: 角度,相机位姿""" <|body_0|> def meanSpeed(self, joint, imgd): """# 计算平均速度 # 图像坐标转换为真实空间xyz坐标 # 与上一帧作差/时间,计算速度并存储 # 计算平均速度 :param joint: 关节坐标 :param imgd: 深度图像 :return: 平均速度""...
stack_v2_sparse_classes_36k_train_003822
11,252
no_license
[ { "docstring": ":param frameDelay: 计算平均速度的帧数 :param rx: 角度,相机位姿", "name": "__init__", "signature": "def __init__(self, frameDelay=4, rx=-30)" }, { "docstring": "# 计算平均速度 # 图像坐标转换为真实空间xyz坐标 # 与上一帧作差/时间,计算速度并存储 # 计算平均速度 :param joint: 关节坐标 :param imgd: 深度图像 :return: 平均速度", "name": "meanSpeed", ...
2
null
Implement the Python class `CalMeanSpeed` described below. Class description: Implement the CalMeanSpeed class. Method signatures and docstrings: - def __init__(self, frameDelay=4, rx=-30): :param frameDelay: 计算平均速度的帧数 :param rx: 角度,相机位姿 - def meanSpeed(self, joint, imgd): # 计算平均速度 # 图像坐标转换为真实空间xyz坐标 # 与上一帧作差/时间,计算速度...
Implement the Python class `CalMeanSpeed` described below. Class description: Implement the CalMeanSpeed class. Method signatures and docstrings: - def __init__(self, frameDelay=4, rx=-30): :param frameDelay: 计算平均速度的帧数 :param rx: 角度,相机位姿 - def meanSpeed(self, joint, imgd): # 计算平均速度 # 图像坐标转换为真实空间xyz坐标 # 与上一帧作差/时间,计算速度...
5d4c8209732ffa7d50dd7235ad50c4dc708a47cc
<|skeleton|> class CalMeanSpeed: def __init__(self, frameDelay=4, rx=-30): """:param frameDelay: 计算平均速度的帧数 :param rx: 角度,相机位姿""" <|body_0|> def meanSpeed(self, joint, imgd): """# 计算平均速度 # 图像坐标转换为真实空间xyz坐标 # 与上一帧作差/时间,计算速度并存储 # 计算平均速度 :param joint: 关节坐标 :param imgd: 深度图像 :return: 平均速度""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CalMeanSpeed: def __init__(self, frameDelay=4, rx=-30): """:param frameDelay: 计算平均速度的帧数 :param rx: 角度,相机位姿""" self.frameDelay = frameDelay self.T = pc_rotx(rx / 180 * 3.14159) self.storeV = np.zeros((frameDelay, 3)) self.fi = 0 self.lastpc = np.zeros((1, 3)) ...
the_stack_v2_python_sparse
ch7/7.4/clor.py
WeihangWANG/3DWorld
train
5
4622c1a5c2e40cf57298b5f0f6a15c2fc60b69b5
[ "if klass is not None and pattern is not None:\n return [pattern % {'class': k} for k in klass.split()]\nreturn []", "classes = []\nif klass is not None:\n kls = klass\nelse:\n kls = self.css\nif error is None:\n error = kls\nif required is None:\n required = kls\nif self.error is not None:\n cl...
<|body_start_0|> if klass is not None and pattern is not None: return [pattern % {'class': k} for k in klass.split()] return [] <|end_body_0|> <|body_start_1|> classes = [] if klass is not None: kls = klass else: kls = self.css if erro...
Widget layout support mix-in class
WidgetLayoutSupport
[ "ZPL-2.1" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WidgetLayoutSupport: """Widget layout support mix-in class""" def wrap_css_class(klass, pattern='%(class)s'): """Return a list of css class names wrapped with given pattern""" <|body_0|> def get_css_class(self, klass=None, error=None, required=None, class_pattern='%(clas...
stack_v2_sparse_classes_36k_train_003823
8,027
permissive
[ { "docstring": "Return a list of css class names wrapped with given pattern", "name": "wrap_css_class", "signature": "def wrap_css_class(klass, pattern='%(class)s')" }, { "docstring": "Setup given css class (klass) with error and required postfix If no klass name is given the widget.wrapper clas...
2
stack_v2_sparse_classes_30k_train_008178
Implement the Python class `WidgetLayoutSupport` described below. Class description: Widget layout support mix-in class Method signatures and docstrings: - def wrap_css_class(klass, pattern='%(class)s'): Return a list of css class names wrapped with given pattern - def get_css_class(self, klass=None, error=None, requ...
Implement the Python class `WidgetLayoutSupport` described below. Class description: Widget layout support mix-in class Method signatures and docstrings: - def wrap_css_class(klass, pattern='%(class)s'): Return a list of css class names wrapped with given pattern - def get_css_class(self, klass=None, error=None, requ...
e83e2ce314355f98eaf66e90ad6feccbda7934f9
<|skeleton|> class WidgetLayoutSupport: """Widget layout support mix-in class""" def wrap_css_class(klass, pattern='%(class)s'): """Return a list of css class names wrapped with given pattern""" <|body_0|> def get_css_class(self, klass=None, error=None, required=None, class_pattern='%(clas...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WidgetLayoutSupport: """Widget layout support mix-in class""" def wrap_css_class(klass, pattern='%(class)s'): """Return a list of css class names wrapped with given pattern""" if klass is not None and pattern is not None: return [pattern % {'class': k} for k in klass.split()] ...
the_stack_v2_python_sparse
src/pyams_form/browser/widget.py
Py-AMS/pyams-form
train
0
6ad1b647fb85a1c6260e9b8833bd72085dd1f4f7
[ "securityPartitions = zoneManager.getDevicesByType(AlarmPartition)\nif len(securityPartitions) > 0:\n if AlarmPartition.STATE_ARM_AWAY == securityPartitions[0].getArmMode():\n return True\nreturn False", "securityPartitions = zoneManager.getDevicesByType(AlarmPartition)\nif len(securityPartitions) > 0:\...
<|body_start_0|> securityPartitions = zoneManager.getDevicesByType(AlarmPartition) if len(securityPartitions) > 0: if AlarmPartition.STATE_ARM_AWAY == securityPartitions[0].getArmMode(): return True return False <|end_body_0|> <|body_start_1|> securityPartiti...
Provide quick access to the alarm partition of the zones.
SecurityManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SecurityManager: """Provide quick access to the alarm partition of the zones.""" def isArmedAway(zoneManager): """:return: True if at least one zone is armed-away""" <|body_0|> def isArmedStay(zoneManager): """:return: True if at least one zone is armed-stay""" ...
stack_v2_sparse_classes_36k_train_003824
2,333
no_license
[ { "docstring": ":return: True if at least one zone is armed-away", "name": "isArmedAway", "signature": "def isArmedAway(zoneManager)" }, { "docstring": ":return: True if at least one zone is armed-stay", "name": "isArmedStay", "signature": "def isArmedStay(zoneManager)" } ]
2
stack_v2_sparse_classes_30k_train_000426
Implement the Python class `SecurityManager` described below. Class description: Provide quick access to the alarm partition of the zones. Method signatures and docstrings: - def isArmedAway(zoneManager): :return: True if at least one zone is armed-away - def isArmedStay(zoneManager): :return: True if at least one zo...
Implement the Python class `SecurityManager` described below. Class description: Provide quick access to the alarm partition of the zones. Method signatures and docstrings: - def isArmedAway(zoneManager): :return: True if at least one zone is armed-away - def isArmedStay(zoneManager): :return: True if at least one zo...
c64c9e109173277b6b4b2473adaac9d2da623cdb
<|skeleton|> class SecurityManager: """Provide quick access to the alarm partition of the zones.""" def isArmedAway(zoneManager): """:return: True if at least one zone is armed-away""" <|body_0|> def isArmedStay(zoneManager): """:return: True if at least one zone is armed-stay""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SecurityManager: """Provide quick access to the alarm partition of the zones.""" def isArmedAway(zoneManager): """:return: True if at least one zone is armed-away""" securityPartitions = zoneManager.getDevicesByType(AlarmPartition) if len(securityPartitions) > 0: if Al...
the_stack_v2_python_sparse
legacy-jython-code/aaa_modules/security_manager.py
yfaway/openhab-rules
train
10
99a26e8c24ac601a004a388ef112efe993191dc6
[ "form_kwargs = super().get_form_kwargs()\nform_kwargs['user'] = self.request.user\nreturn form_kwargs", "try:\n workflow = services.do_import_workflow(self.request.user, form.cleaned_data['name'], self.request.FILES['wf_file'])\n messages.success(self.request, _('Workflow {0} successfully imported.'.format(...
<|body_start_0|> form_kwargs = super().get_form_kwargs() form_kwargs['user'] = self.request.user return form_kwargs <|end_body_0|> <|body_start_1|> try: workflow = services.do_import_workflow(self.request.user, form.cleaned_data['name'], self.request.FILES['wf_file']) ...
View to request information to export a workflow.
WorkflowImportView
[ "LGPL-2.0-or-later", "BSD-3-Clause", "MIT", "Apache-2.0", "LGPL-2.1-only", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkflowImportView: """View to request information to export a workflow.""" def get_form_kwargs(self): """Store user in form_kwargs.""" <|body_0|> def form_valid(self, form): """Upload the file.""" <|body_1|> <|end_skeleton|> <|body_start_0|> fo...
stack_v2_sparse_classes_36k_train_003825
3,538
permissive
[ { "docstring": "Store user in form_kwargs.", "name": "get_form_kwargs", "signature": "def get_form_kwargs(self)" }, { "docstring": "Upload the file.", "name": "form_valid", "signature": "def form_valid(self, form)" } ]
2
null
Implement the Python class `WorkflowImportView` described below. Class description: View to request information to export a workflow. Method signatures and docstrings: - def get_form_kwargs(self): Store user in form_kwargs. - def form_valid(self, form): Upload the file.
Implement the Python class `WorkflowImportView` described below. Class description: View to request information to export a workflow. Method signatures and docstrings: - def get_form_kwargs(self): Store user in form_kwargs. - def form_valid(self, form): Upload the file. <|skeleton|> class WorkflowImportView: """...
c432745dfff932cbe7397100422d49df78f0a882
<|skeleton|> class WorkflowImportView: """View to request information to export a workflow.""" def get_form_kwargs(self): """Store user in form_kwargs.""" <|body_0|> def form_valid(self, form): """Upload the file.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WorkflowImportView: """View to request information to export a workflow.""" def get_form_kwargs(self): """Store user in form_kwargs.""" form_kwargs = super().get_form_kwargs() form_kwargs['user'] = self.request.user return form_kwargs def form_valid(self, form): ...
the_stack_v2_python_sparse
ontask/workflow/views/import_export.py
abelardopardo/ontask_b
train
43
7b616cd071b16f41de26c0a60f9e7fd2dc2b9d12
[ "res = self.__class__()\nfor key in self.keys():\n if isinstance(self[key], self.__class__):\n res.update(self[key].flatten())\n else:\n res[key] = self[key]\nreturn res.sorted()", "res = self.__class__()\nfor key in keys:\n if key in self.keys():\n res[key] = self[key]\nreturn res",...
<|body_start_0|> res = self.__class__() for key in self.keys(): if isinstance(self[key], self.__class__): res.update(self[key].flatten()) else: res[key] = self[key] return res.sorted() <|end_body_0|> <|body_start_1|> res = self.__c...
Collection of :class:`.TweezersData`. Inherits from :class:`.IndexedOrderedDict` with keys being ID names.
TweezersCollection
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TweezersCollection: """Collection of :class:`.TweezersData`. Inherits from :class:`.IndexedOrderedDict` with keys being ID names.""" def flatten(self): """Flatten a data collection, i.e. remove nested collections. Returns a copy of the collection. Returns: :class:`.TweezersCollection...
stack_v2_sparse_classes_36k_train_003826
12,590
permissive
[ { "docstring": "Flatten a data collection, i.e. remove nested collections. Returns a copy of the collection. Returns: :class:`.TweezersCollection`", "name": "flatten", "signature": "def flatten(self)" }, { "docstring": "Select all items with a key that is in the provided iterable `keys`. Args: k...
3
stack_v2_sparse_classes_30k_train_018482
Implement the Python class `TweezersCollection` described below. Class description: Collection of :class:`.TweezersData`. Inherits from :class:`.IndexedOrderedDict` with keys being ID names. Method signatures and docstrings: - def flatten(self): Flatten a data collection, i.e. remove nested collections. Returns a cop...
Implement the Python class `TweezersCollection` described below. Class description: Collection of :class:`.TweezersData`. Inherits from :class:`.IndexedOrderedDict` with keys being ID names. Method signatures and docstrings: - def flatten(self): Flatten a data collection, i.e. remove nested collections. Returns a cop...
7c9b3d781c53f7728526a8242aa9e1d671f15688
<|skeleton|> class TweezersCollection: """Collection of :class:`.TweezersData`. Inherits from :class:`.IndexedOrderedDict` with keys being ID names.""" def flatten(self): """Flatten a data collection, i.e. remove nested collections. Returns a copy of the collection. Returns: :class:`.TweezersCollection...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TweezersCollection: """Collection of :class:`.TweezersData`. Inherits from :class:`.IndexedOrderedDict` with keys being ID names.""" def flatten(self): """Flatten a data collection, i.e. remove nested collections. Returns a copy of the collection. Returns: :class:`.TweezersCollection`""" ...
the_stack_v2_python_sparse
tweezers/collections.py
DollSimon/tweezers
train
0
8880157ee9fb7ee6556d28e23c128b8f8c09f201
[ "assert reduction in ('none', 'mean', 'sum'), reduction\nsuper().__init__()\nself.temperature = temperature\nself.use_double_scores = use_double_scores\nself.reduction = reduction", "nbest = k2.Nbest.from_lattice(lattice=lattice, num_paths=num_paths, use_double_scores=self.use_double_scores, nbest_scale=nbest_sca...
<|body_start_0|> assert reduction in ('none', 'mean', 'sum'), reduction super().__init__() self.temperature = temperature self.use_double_scores = use_double_scores self.reduction = reduction <|end_body_0|> <|body_start_1|> nbest = k2.Nbest.from_lattice(lattice=lattice, ...
Minimum Word Error Rate Loss compuration in k2. See equation 2 of https://arxiv.org/pdf/2106.02302.pdf about its definition.
MWERLoss
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MWERLoss: """Minimum Word Error Rate Loss compuration in k2. See equation 2 of https://arxiv.org/pdf/2106.02302.pdf about its definition.""" def __init__(self, temperature: float=1.0, use_double_scores: bool=True, reduction: Literal['none', 'mean', 'sum']='sum'): """Args: temperature...
stack_v2_sparse_classes_36k_train_003827
7,465
permissive
[ { "docstring": "Args: temperature: For long utterances, the dynamic range of scores will be too large and the posteriors will be mostly 0 or 1. To prevent this it might be a good idea to have an extra argument that functions like a temperature. We scale the logprobs by before doing the normalization. use_double...
2
stack_v2_sparse_classes_30k_train_018230
Implement the Python class `MWERLoss` described below. Class description: Minimum Word Error Rate Loss compuration in k2. See equation 2 of https://arxiv.org/pdf/2106.02302.pdf about its definition. Method signatures and docstrings: - def __init__(self, temperature: float=1.0, use_double_scores: bool=True, reduction:...
Implement the Python class `MWERLoss` described below. Class description: Minimum Word Error Rate Loss compuration in k2. See equation 2 of https://arxiv.org/pdf/2106.02302.pdf about its definition. Method signatures and docstrings: - def __init__(self, temperature: float=1.0, use_double_scores: bool=True, reduction:...
2b2ac14b326d61d79d04e53fbd69b1ff6d630411
<|skeleton|> class MWERLoss: """Minimum Word Error Rate Loss compuration in k2. See equation 2 of https://arxiv.org/pdf/2106.02302.pdf about its definition.""" def __init__(self, temperature: float=1.0, use_double_scores: bool=True, reduction: Literal['none', 'mean', 'sum']='sum'): """Args: temperature...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MWERLoss: """Minimum Word Error Rate Loss compuration in k2. See equation 2 of https://arxiv.org/pdf/2106.02302.pdf about its definition.""" def __init__(self, temperature: float=1.0, use_double_scores: bool=True, reduction: Literal['none', 'mean', 'sum']='sum'): """Args: temperature: For long ut...
the_stack_v2_python_sparse
k2/python/k2/mwer_loss.py
k2-fsa/k2
train
851
88b23e6f6b3c86fe828971037e4b04b86530f855
[ "uid = request.cookies.get('uid')\nassert uid and len(uid) > 10\nfee = int(request.args.get('fee', 300))\nif uid == 'o31RHuPslKvzzBccwwoXv_GKmfEA':\n fee = 1\norder_url = self.make_order_url(fee, '招标123-VIP会员', request.url, uid)\nimg = qrcode.make(order_url, border=2)\nbs = io.BytesIO()\nimg.save(bs, 'png')\nres...
<|body_start_0|> uid = request.cookies.get('uid') assert uid and len(uid) > 10 fee = int(request.args.get('fee', 300)) if uid == 'o31RHuPslKvzzBccwwoXv_GKmfEA': fee = 1 order_url = self.make_order_url(fee, '招标123-VIP会员', request.url, uid) img = qrcode.make(ord...
微信支付
WxPayApi
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WxPayApi: """微信支付""" def get(self, request: Request): """生成订单二维码""" <|body_0|> def make_order_url(self, fee: int, title: str, url: str, uid: str) -> str: """生成订单网址""" <|body_1|> def post(self, request: Request): """微信支付回调""" <|body_2|...
stack_v2_sparse_classes_36k_train_003828
5,207
no_license
[ { "docstring": "生成订单二维码", "name": "get", "signature": "def get(self, request: Request)" }, { "docstring": "生成订单网址", "name": "make_order_url", "signature": "def make_order_url(self, fee: int, title: str, url: str, uid: str) -> str" }, { "docstring": "微信支付回调", "name": "post", ...
4
null
Implement the Python class `WxPayApi` described below. Class description: 微信支付 Method signatures and docstrings: - def get(self, request: Request): 生成订单二维码 - def make_order_url(self, fee: int, title: str, url: str, uid: str) -> str: 生成订单网址 - def post(self, request: Request): 微信支付回调 - def sign_order_params(self, param...
Implement the Python class `WxPayApi` described below. Class description: 微信支付 Method signatures and docstrings: - def get(self, request: Request): 生成订单二维码 - def make_order_url(self, fee: int, title: str, url: str, uid: str) -> str: 生成订单网址 - def post(self, request: Request): 微信支付回调 - def sign_order_params(self, param...
7316880e2444a8af02e2f44af38dd7ae708ccbb6
<|skeleton|> class WxPayApi: """微信支付""" def get(self, request: Request): """生成订单二维码""" <|body_0|> def make_order_url(self, fee: int, title: str, url: str, uid: str) -> str: """生成订单网址""" <|body_1|> def post(self, request: Request): """微信支付回调""" <|body_2|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WxPayApi: """微信支付""" def get(self, request: Request): """生成订单二维码""" uid = request.cookies.get('uid') assert uid and len(uid) > 10 fee = int(request.args.get('fee', 300)) if uid == 'o31RHuPslKvzzBccwwoXv_GKmfEA': fee = 1 order_url = self.make_ord...
the_stack_v2_python_sparse
web_sanic/apis/pay.py
aiportal/zb123
train
0
e92b934674eb1f0a260a6c0a85bf0a6b8fea6ed2
[ "res = [[0 for _ in range(max_weight + 1)] for _ in range(len(weight) + 1)]\nfor i in range(1, len(res)):\n cur_value = value[i - 1]\n cur_weight = weight[i - 1]\n for j in range(1, len(res[0])):\n if cur_weight <= j:\n res[i][j] = max(res[i - 1][j], cur_value + res[i - 1][j - cur_weight]...
<|body_start_0|> res = [[0 for _ in range(max_weight + 1)] for _ in range(len(weight) + 1)] for i in range(1, len(res)): cur_value = value[i - 1] cur_weight = weight[i - 1] for j in range(1, len(res[0])): if cur_weight <= j: res[i][...
Bag01
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Bag01: def bag01(self, weight, value, max_weight): """:param weight: 物品重量 :param value: 物品价值 :param max_weight: 背包最大重量 :return: 最大价值""" <|body_0|> def show(self, res, weight): """装入背包的物品索引(索引从0开始) :param res: :param weight: :return: 返回物品索引""" <|body_1|> <|en...
stack_v2_sparse_classes_36k_train_003829
2,438
no_license
[ { "docstring": ":param weight: 物品重量 :param value: 物品价值 :param max_weight: 背包最大重量 :return: 最大价值", "name": "bag01", "signature": "def bag01(self, weight, value, max_weight)" }, { "docstring": "装入背包的物品索引(索引从0开始) :param res: :param weight: :return: 返回物品索引", "name": "show", "signature": "def ...
2
stack_v2_sparse_classes_30k_train_004162
Implement the Python class `Bag01` described below. Class description: Implement the Bag01 class. Method signatures and docstrings: - def bag01(self, weight, value, max_weight): :param weight: 物品重量 :param value: 物品价值 :param max_weight: 背包最大重量 :return: 最大价值 - def show(self, res, weight): 装入背包的物品索引(索引从0开始) :param res: ...
Implement the Python class `Bag01` described below. Class description: Implement the Bag01 class. Method signatures and docstrings: - def bag01(self, weight, value, max_weight): :param weight: 物品重量 :param value: 物品价值 :param max_weight: 背包最大重量 :return: 最大价值 - def show(self, res, weight): 装入背包的物品索引(索引从0开始) :param res: ...
3eddc77d2f3dafffd177f2a9ee28e9850da2f020
<|skeleton|> class Bag01: def bag01(self, weight, value, max_weight): """:param weight: 物品重量 :param value: 物品价值 :param max_weight: 背包最大重量 :return: 最大价值""" <|body_0|> def show(self, res, weight): """装入背包的物品索引(索引从0开始) :param res: :param weight: :return: 返回物品索引""" <|body_1|> <|en...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Bag01: def bag01(self, weight, value, max_weight): """:param weight: 物品重量 :param value: 物品价值 :param max_weight: 背包最大重量 :return: 最大价值""" res = [[0 for _ in range(max_weight + 1)] for _ in range(len(weight) + 1)] for i in range(1, len(res)): cur_value = value[i - 1] ...
the_stack_v2_python_sparse
DP/0-1Bag.py
ii0/algorithms-6
train
0
39d2f089b78a06dace27d01b34255e4a8b47e77c
[ "tempList = ListNode(0)\ncur = head\nwhile cur:\n p = cur\n cur = cur.next\n p.next = tempList.next\n tempList.next = p\nreturn tempList.next", "if head is None or head.next is None:\n return head\np = head.next\nq = self.reverseList2(p)\nhead.next = None\np.next = head\nreturn q" ]
<|body_start_0|> tempList = ListNode(0) cur = head while cur: p = cur cur = cur.next p.next = tempList.next tempList.next = p return tempList.next <|end_body_0|> <|body_start_1|> if head is None or head.next is None: re...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseList(self, head): """非递归 :type head: ListNode :rtype: ListNode""" <|body_0|> def reverseList2(self, head): """递归 :type head: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> tempList = ListNode(0) ...
stack_v2_sparse_classes_36k_train_003830
1,088
no_license
[ { "docstring": "非递归 :type head: ListNode :rtype: ListNode", "name": "reverseList", "signature": "def reverseList(self, head)" }, { "docstring": "递归 :type head: ListNode :rtype: ListNode", "name": "reverseList2", "signature": "def reverseList2(self, head)" } ]
2
stack_v2_sparse_classes_30k_train_012140
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head): 非递归 :type head: ListNode :rtype: ListNode - def reverseList2(self, head): 递归 :type head: ListNode :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head): 非递归 :type head: ListNode :rtype: ListNode - def reverseList2(self, head): 递归 :type head: ListNode :rtype: ListNode <|skeleton|> class Solution: ...
65226cdd7ac68e63991a02d09341a17043664281
<|skeleton|> class Solution: def reverseList(self, head): """非递归 :type head: ListNode :rtype: ListNode""" <|body_0|> def reverseList2(self, head): """递归 :type head: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reverseList(self, head): """非递归 :type head: ListNode :rtype: ListNode""" tempList = ListNode(0) cur = head while cur: p = cur cur = cur.next p.next = tempList.next tempList.next = p return tempList.next ...
the_stack_v2_python_sparse
leetcode-python/206_Reverse_Linked_List.py
inzy/leetcode
train
0
a693ee13a12971f43b5c557b350f99a4e6863fb3
[ "self.dic = dictionary\nself.abb = {}\nfor x in dictionary:\n if len(x) <= 2:\n if x not in self.abb:\n self.abb[x] = self.abb.get(x, 0) + 1\n else:\n self.abb[x[0] + str(len(x) - 2) + x[-1]] = self.abb.get(x[0] + str(len(x) - 2) + x[-1], 0) + 1", "if len(word) <= 2:\n abb = word...
<|body_start_0|> self.dic = dictionary self.abb = {} for x in dictionary: if len(x) <= 2: if x not in self.abb: self.abb[x] = self.abb.get(x, 0) + 1 else: self.abb[x[0] + str(len(x) - 2) + x[-1]] = self.abb.get(x[0] + st...
ValidWordAbbr
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ValidWordAbbr: def __init__(self, dictionary): """:type dictionary: List[str]""" <|body_0|> def isUnique(self, word): """:type word: str :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.dic = dictionary self.abb = {} ...
stack_v2_sparse_classes_36k_train_003831
1,061
no_license
[ { "docstring": ":type dictionary: List[str]", "name": "__init__", "signature": "def __init__(self, dictionary)" }, { "docstring": ":type word: str :rtype: bool", "name": "isUnique", "signature": "def isUnique(self, word)" } ]
2
null
Implement the Python class `ValidWordAbbr` described below. Class description: Implement the ValidWordAbbr class. Method signatures and docstrings: - def __init__(self, dictionary): :type dictionary: List[str] - def isUnique(self, word): :type word: str :rtype: bool
Implement the Python class `ValidWordAbbr` described below. Class description: Implement the ValidWordAbbr class. Method signatures and docstrings: - def __init__(self, dictionary): :type dictionary: List[str] - def isUnique(self, word): :type word: str :rtype: bool <|skeleton|> class ValidWordAbbr: def __init_...
e9e74a81a7f10888c2c342c70b1ba32b09a16ab2
<|skeleton|> class ValidWordAbbr: def __init__(self, dictionary): """:type dictionary: List[str]""" <|body_0|> def isUnique(self, word): """:type word: str :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ValidWordAbbr: def __init__(self, dictionary): """:type dictionary: List[str]""" self.dic = dictionary self.abb = {} for x in dictionary: if len(x) <= 2: if x not in self.abb: self.abb[x] = self.abb.get(x, 0) + 1 else:...
the_stack_v2_python_sparse
python/leetcode288.py
mhhuang95/LeetCode
train
2
c64dc9524aa34e4d557f683da728a4a9cc88a442
[ "super().__init__()\nif isinstance(modules, list):\n self.module_list = nn.ModuleList(modules)\nelse:\n self.module_list = modules", "if aux is not None:\n return torch.cat(tuple((self.module_list[d](x[:, (d,)], aux) for d in range(x.shape[1]))), dim=1)\nelse:\n return torch.cat(tuple((self.module_lis...
<|body_start_0|> super().__init__() if isinstance(modules, list): self.module_list = nn.ModuleList(modules) else: self.module_list = modules <|end_body_0|> <|body_start_1|> if aux is not None: return torch.cat(tuple((self.module_list[d](x[:, (d,)], au...
A neural network module to represent trainable dimension-wise transformation.
ComponentwiseTransform
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ComponentwiseTransform: """A neural network module to represent trainable dimension-wise transformation.""" def __init__(self, modules: Union[List[nn.Module], nn.ModuleList]): """Parameters: modules: list of neural networks each of which is a univariate function (or additionally it c...
stack_v2_sparse_classes_36k_train_003832
6,687
permissive
[ { "docstring": "Parameters: modules: list of neural networks each of which is a univariate function (or additionally it can take an auxiliary input variable).", "name": "__init__", "signature": "def __init__(self, modules: Union[List[nn.Module], nn.ModuleList])" }, { "docstring": "Perform forwar...
2
stack_v2_sparse_classes_30k_train_016233
Implement the Python class `ComponentwiseTransform` described below. Class description: A neural network module to represent trainable dimension-wise transformation. Method signatures and docstrings: - def __init__(self, modules: Union[List[nn.Module], nn.ModuleList]): Parameters: modules: list of neural networks eac...
Implement the Python class `ComponentwiseTransform` described below. Class description: A neural network module to represent trainable dimension-wise transformation. Method signatures and docstrings: - def __init__(self, modules: Union[List[nn.Module], nn.ModuleList]): Parameters: modules: list of neural networks eac...
2878ced51cfe473aad8fbc1886e2b65dfc9fc060
<|skeleton|> class ComponentwiseTransform: """A neural network module to represent trainable dimension-wise transformation.""" def __init__(self, modules: Union[List[nn.Module], nn.ModuleList]): """Parameters: modules: list of neural networks each of which is a univariate function (or additionally it c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ComponentwiseTransform: """A neural network module to represent trainable dimension-wise transformation.""" def __init__(self, modules: Union[List[nn.Module], nn.ModuleList]): """Parameters: modules: list of neural networks each of which is a univariate function (or additionally it can take an au...
the_stack_v2_python_sparse
causal_da/components/ica_torch/gcl_model.py
SoldierY/few-shot-domain-adaptation-by-causal-mechanism-transfer
train
0
8878bf1772e30bc79e2c67ec0c2157c0a24307b1
[ "self.window = window\nworkspace = window.application.get_service(IWorkspace)\ncsp = ContainerSelectionPage(id='container_page', workspace=workspace)\nfwp = FilePage(id='file_page', csp=csp)\nself.pages = [csp, fwp]\nsuper(NewFileWizard, self).__init__(**traits)", "csp = self.pages[0]\nfwp = self.pages[1]\nfile =...
<|body_start_0|> self.window = window workspace = window.application.get_service(IWorkspace) csp = ContainerSelectionPage(id='container_page', workspace=workspace) fwp = FilePage(id='file_page', csp=csp) self.pages = [csp, fwp] super(NewFileWizard, self).__init__(**traits...
A wizard for file creation.
NewFileWizard
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NewFileWizard: """A wizard for file creation.""" def __init__(self, window, **traits): """Returns a NewFileWizard""" <|body_0|> def _finished_fired(self): """Performs the file resource creation if the wizard is finished successfully.""" <|body_1|> <|end_...
stack_v2_sparse_classes_36k_train_003833
7,361
permissive
[ { "docstring": "Returns a NewFileWizard", "name": "__init__", "signature": "def __init__(self, window, **traits)" }, { "docstring": "Performs the file resource creation if the wizard is finished successfully.", "name": "_finished_fired", "signature": "def _finished_fired(self)" } ]
2
stack_v2_sparse_classes_30k_train_020180
Implement the Python class `NewFileWizard` described below. Class description: A wizard for file creation. Method signatures and docstrings: - def __init__(self, window, **traits): Returns a NewFileWizard - def _finished_fired(self): Performs the file resource creation if the wizard is finished successfully.
Implement the Python class `NewFileWizard` described below. Class description: A wizard for file creation. Method signatures and docstrings: - def __init__(self, window, **traits): Returns a NewFileWizard - def _finished_fired(self): Performs the file resource creation if the wizard is finished successfully. <|skele...
e8fc0b2d6b9b08e60389fc4714a5cf51f628b57f
<|skeleton|> class NewFileWizard: """A wizard for file creation.""" def __init__(self, window, **traits): """Returns a NewFileWizard""" <|body_0|> def _finished_fired(self): """Performs the file resource creation if the wizard is finished successfully.""" <|body_1|> <|end_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NewFileWizard: """A wizard for file creation.""" def __init__(self, window, **traits): """Returns a NewFileWizard""" self.window = window workspace = window.application.get_service(IWorkspace) csp = ContainerSelectionPage(id='container_page', workspace=workspace) f...
the_stack_v2_python_sparse
puddle/python_editor/new_file_wizard.py
rwl/puddle
train
2
36d68f5a360e7ee68991dafdd2b4b270e30a3e5b
[ "super().__init__(*args, **kwargs)\nself.value_shape = value_shape or ()\nself.num_values = int(np.prod(self.value_shape))\nself.iblt_values_shape = (self.repetitions, self.table_size) + self.value_shape\nif len(self.value_shape) > 1:\n self._tile_shape = [1] + [1 for _ in self.value_shape]\n self._tile_shape...
<|body_start_0|> super().__init__(*args, **kwargs) self.value_shape = value_shape or () self.num_values = int(np.prod(self.value_shape)) self.iblt_values_shape = (self.repetitions, self.table_size) + self.value_shape if len(self.value_shape) > 1: self._tile_shape = [1...
Encodes the strings into an IBLT data structure.
IbltTensorEncoder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IbltTensorEncoder: """Encodes the strings into an IBLT data structure.""" def __init__(self, value_shape: Sequence[int], *args, **kwargs): """Initializes internal IBLT parameters. Args: value_shape: Shape of the values. *args: See IbltEncoder. **kwargs: See IbltEncoder.""" <|...
stack_v2_sparse_classes_36k_train_003834
17,202
permissive
[ { "docstring": "Initializes internal IBLT parameters. Args: value_shape: Shape of the values. *args: See IbltEncoder. **kwargs: See IbltEncoder.", "name": "__init__", "signature": "def __init__(self, value_shape: Sequence[int], *args, **kwargs)" }, { "docstring": "Returns SparseTensor with tenso...
3
stack_v2_sparse_classes_30k_train_020808
Implement the Python class `IbltTensorEncoder` described below. Class description: Encodes the strings into an IBLT data structure. Method signatures and docstrings: - def __init__(self, value_shape: Sequence[int], *args, **kwargs): Initializes internal IBLT parameters. Args: value_shape: Shape of the values. *args: ...
Implement the Python class `IbltTensorEncoder` described below. Class description: Encodes the strings into an IBLT data structure. Method signatures and docstrings: - def __init__(self, value_shape: Sequence[int], *args, **kwargs): Initializes internal IBLT parameters. Args: value_shape: Shape of the values. *args: ...
ad4bca66f4b483e09d8396e9948630813a343d27
<|skeleton|> class IbltTensorEncoder: """Encodes the strings into an IBLT data structure.""" def __init__(self, value_shape: Sequence[int], *args, **kwargs): """Initializes internal IBLT parameters. Args: value_shape: Shape of the values. *args: See IbltEncoder. **kwargs: See IbltEncoder.""" <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IbltTensorEncoder: """Encodes the strings into an IBLT data structure.""" def __init__(self, value_shape: Sequence[int], *args, **kwargs): """Initializes internal IBLT parameters. Args: value_shape: Shape of the values. *args: See IbltEncoder. **kwargs: See IbltEncoder.""" super().__init_...
the_stack_v2_python_sparse
tensorflow_federated/python/analytics/heavy_hitters/iblt/iblt_tensor.py
tensorflow/federated
train
2,297
f58d1b68ab886f550d675d7ae72f6ae49f7e4a4e
[ "try:\n file_id = request.args.get('file_id') if request.args.get('file_id') else None\n file = ProjectFiles.get_file(project_id, file_id)\n return (file.to_primitive(), 200)\nexcept NotFound:\n return ({'Error': 'No project files found for project'}, 404)\nexcept Exception as e:\n error_msg = f'File...
<|body_start_0|> try: file_id = request.args.get('file_id') if request.args.get('file_id') else None file = ProjectFiles.get_file(project_id, file_id) return (file.to_primitive(), 200) except NotFound: return ({'Error': 'No project files found for project'...
ProjectFileAPI
[ "BSD-2-Clause", "JSON", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProjectFileAPI: def get(self, project_id): """Get one file for a project --- tags: - project-admin produces: - application/json parameters: - name: project_id in: path description: The unique project ID required: true type: integer default: 1 - name: file_id in: query description: The un...
stack_v2_sparse_classes_36k_train_003835
9,437
permissive
[ { "docstring": "Get one file for a project --- tags: - project-admin produces: - application/json parameters: - name: project_id in: path description: The unique project ID required: true type: integer default: 1 - name: file_id in: query description: The unique file ID required: true type: integer default: 1 r...
3
stack_v2_sparse_classes_30k_val_000758
Implement the Python class `ProjectFileAPI` described below. Class description: Implement the ProjectFileAPI class. Method signatures and docstrings: - def get(self, project_id): Get one file for a project --- tags: - project-admin produces: - application/json parameters: - name: project_id in: path description: The ...
Implement the Python class `ProjectFileAPI` described below. Class description: Implement the ProjectFileAPI class. Method signatures and docstrings: - def get(self, project_id): Get one file for a project --- tags: - project-admin produces: - application/json parameters: - name: project_id in: path description: The ...
6c567ff02c316bc1f1429c11c60dc72f450d1c57
<|skeleton|> class ProjectFileAPI: def get(self, project_id): """Get one file for a project --- tags: - project-admin produces: - application/json parameters: - name: project_id in: path description: The unique project ID required: true type: integer default: 1 - name: file_id in: query description: The un...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProjectFileAPI: def get(self, project_id): """Get one file for a project --- tags: - project-admin produces: - application/json parameters: - name: project_id in: path description: The unique project ID required: true type: integer default: 1 - name: file_id in: query description: The unique file ID r...
the_stack_v2_python_sparse
server/api/project_files_api.py
KaartGroup/tasking-manager
train
2
6b9711afb9dfe4c2623942eb01f67400b45a0864
[ "username = self.cleaned_data.get('username')\nis_exist = models.UserInfo.objects.filter(username=username)\nif is_exist.exists():\n raise ValidationError('用户名已经存在')\nelse:\n return username", "pwd = self.cleaned_data.get('password')\nre_pwd = self.cleaned_data.get('re_password')\nif pwd == re_pwd:\n ret...
<|body_start_0|> username = self.cleaned_data.get('username') is_exist = models.UserInfo.objects.filter(username=username) if is_exist.exists(): raise ValidationError('用户名已经存在') else: return username <|end_body_0|> <|body_start_1|> pwd = self.cleaned_data...
用户注册校验 使用form组件 字段名称必须和数据库对应 re_password在数据库不存在,在存储数据前会删掉 RegexValidator forms中使用正则过滤
RegisterForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegisterForm: """用户注册校验 使用form组件 字段名称必须和数据库对应 re_password在数据库不存在,在存储数据前会删掉 RegexValidator forms中使用正则过滤""" def clean_username(self): """局部钩子 clean_username 对username字段进行校验 检测用户名唯一性 ValidationError 弹出异常 :return: 成功:用户名 失败:错误信息""" <|body_0|> def clean(self): """全局钩子...
stack_v2_sparse_classes_36k_train_003836
5,228
no_license
[ { "docstring": "局部钩子 clean_username 对username字段进行校验 检测用户名唯一性 ValidationError 弹出异常 :return: 成功:用户名 失败:错误信息", "name": "clean_username", "signature": "def clean_username(self)" }, { "docstring": "全局钩子 获取cleaned_data中的所有数据 检测两次输入的密码是否一致 :return: 成功: 返回cleaned_data 数据 失败:返回错误信息,并指定那个input返回错误信息", ...
3
stack_v2_sparse_classes_30k_train_008271
Implement the Python class `RegisterForm` described below. Class description: 用户注册校验 使用form组件 字段名称必须和数据库对应 re_password在数据库不存在,在存储数据前会删掉 RegexValidator forms中使用正则过滤 Method signatures and docstrings: - def clean_username(self): 局部钩子 clean_username 对username字段进行校验 检测用户名唯一性 ValidationError 弹出异常 :return: 成功:用户名 失败:错误信息 - ...
Implement the Python class `RegisterForm` described below. Class description: 用户注册校验 使用form组件 字段名称必须和数据库对应 re_password在数据库不存在,在存储数据前会删掉 RegexValidator forms中使用正则过滤 Method signatures and docstrings: - def clean_username(self): 局部钩子 clean_username 对username字段进行校验 检测用户名唯一性 ValidationError 弹出异常 :return: 成功:用户名 失败:错误信息 - ...
d7fc68d3d23345df5bfb09d4a84686c8b49a5ad7
<|skeleton|> class RegisterForm: """用户注册校验 使用form组件 字段名称必须和数据库对应 re_password在数据库不存在,在存储数据前会删掉 RegexValidator forms中使用正则过滤""" def clean_username(self): """局部钩子 clean_username 对username字段进行校验 检测用户名唯一性 ValidationError 弹出异常 :return: 成功:用户名 失败:错误信息""" <|body_0|> def clean(self): """全局钩子...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RegisterForm: """用户注册校验 使用form组件 字段名称必须和数据库对应 re_password在数据库不存在,在存储数据前会删掉 RegexValidator forms中使用正则过滤""" def clean_username(self): """局部钩子 clean_username 对username字段进行校验 检测用户名唯一性 ValidationError 弹出异常 :return: 成功:用户名 失败:错误信息""" username = self.cleaned_data.get('username') is_exist...
the_stack_v2_python_sparse
day21/homework/CMS/fault_reporting/forms.py
214031230/Python21
train
0
2c098de81b15cc4f5fbadce22c067bdf2320bd46
[ "_logger.info('sync var')\nif not isinstance(ids, list):\n ids = [ids]\nsync_date = datetime.now().strftime('%Y-%m-%d %H:%M:%S')\nproduct_model = self.pool.get('product.product')\npartner_model = self.pool.get('res.partner')\nproduct_lines = []\nfor ebiz_stock in self.read(cr, uid, ids, ['product_id', 'var_qty',...
<|body_start_0|> _logger.info('sync var') if not isinstance(ids, list): ids = [ids] sync_date = datetime.now().strftime('%Y-%m-%d %H:%M:%S') product_model = self.pool.get('product.product') partner_model = self.pool.get('res.partner') product_lines = [] ...
ebiz_stock
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ebiz_stock: def sync_stock_var(self, cr, uid, ids, context=None): """库存增量同步""" <|body_0|> def sync_stock_qty(self, cr, uid, ids, context=None): """库存全量同步""" <|body_1|> <|end_skeleton|> <|body_start_0|> _logger.info('sync var') if not isinsta...
stack_v2_sparse_classes_36k_train_003837
3,970
no_license
[ { "docstring": "库存增量同步", "name": "sync_stock_var", "signature": "def sync_stock_var(self, cr, uid, ids, context=None)" }, { "docstring": "库存全量同步", "name": "sync_stock_qty", "signature": "def sync_stock_qty(self, cr, uid, ids, context=None)" } ]
2
null
Implement the Python class `ebiz_stock` described below. Class description: Implement the ebiz_stock class. Method signatures and docstrings: - def sync_stock_var(self, cr, uid, ids, context=None): 库存增量同步 - def sync_stock_qty(self, cr, uid, ids, context=None): 库存全量同步
Implement the Python class `ebiz_stock` described below. Class description: Implement the ebiz_stock class. Method signatures and docstrings: - def sync_stock_var(self, cr, uid, ids, context=None): 库存增量同步 - def sync_stock_qty(self, cr, uid, ids, context=None): 库存全量同步 <|skeleton|> class ebiz_stock: def sync_stoc...
96186dfac9a10cd47079de226f6f1d0761928a84
<|skeleton|> class ebiz_stock: def sync_stock_var(self, cr, uid, ids, context=None): """库存增量同步""" <|body_0|> def sync_stock_qty(self, cr, uid, ids, context=None): """库存全量同步""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ebiz_stock: def sync_stock_var(self, cr, uid, ids, context=None): """库存增量同步""" _logger.info('sync var') if not isinstance(ids, list): ids = [ids] sync_date = datetime.now().strftime('%Y-%m-%d %H:%M:%S') product_model = self.pool.get('product.product') ...
the_stack_v2_python_sparse
bysun_stock_product_V2/models/ebiz.py
luohuayong/addons8
train
0
552a13a1ce1e7cd938b45c94e91ae7585f5443eb
[ "super().__init__(kind=FRAGMENT)\nif start and stop:\n self[FRAGMENT_START] = start\n self[FRAGMENT_STOP] = stop\nelse:\n self[FRAGMENT_MISSING] = '?'\nif description:\n self[FRAGMENT_DESCRIPTION] = description", "if FRAGMENT_MISSING in self:\n return '?'\nreturn '{}_{}'.format(self[FRAGMENT_START]...
<|body_start_0|> super().__init__(kind=FRAGMENT) if start and stop: self[FRAGMENT_START] = start self[FRAGMENT_STOP] = stop else: self[FRAGMENT_MISSING] = '?' if description: self[FRAGMENT_DESCRIPTION] = description <|end_body_0|> <|body_s...
Represent the information about a protein fragment.
Fragment
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Fragment: """Represent the information about a protein fragment.""" def __init__(self, start: Union[None, int, str]=None, stop: Union[None, int, str]=None, description: Optional[str]=None) -> None: """Build a protein fragment data dictionary. :param start: The starting position :para...
stack_v2_sparse_classes_36k_train_003838
34,684
permissive
[ { "docstring": "Build a protein fragment data dictionary. :param start: The starting position :param stop: The stopping position :param description: An optional description Example of specified fragment: >>> from pybel.dsl import Protein, Fragment >>> Protein(name='APP', namespace='HGNC', variants=[Fragment(sta...
3
null
Implement the Python class `Fragment` described below. Class description: Represent the information about a protein fragment. Method signatures and docstrings: - def __init__(self, start: Union[None, int, str]=None, stop: Union[None, int, str]=None, description: Optional[str]=None) -> None: Build a protein fragment d...
Implement the Python class `Fragment` described below. Class description: Represent the information about a protein fragment. Method signatures and docstrings: - def __init__(self, start: Union[None, int, str]=None, stop: Union[None, int, str]=None, description: Optional[str]=None) -> None: Build a protein fragment d...
ed66f013a77f9cbc513892b0dad1025b8f68bb46
<|skeleton|> class Fragment: """Represent the information about a protein fragment.""" def __init__(self, start: Union[None, int, str]=None, stop: Union[None, int, str]=None, description: Optional[str]=None) -> None: """Build a protein fragment data dictionary. :param start: The starting position :para...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Fragment: """Represent the information about a protein fragment.""" def __init__(self, start: Union[None, int, str]=None, stop: Union[None, int, str]=None, description: Optional[str]=None) -> None: """Build a protein fragment data dictionary. :param start: The starting position :param stop: The s...
the_stack_v2_python_sparse
src/pybel/dsl/node_classes.py
pybel/pybel
train
133
d74548cae2c7de2c0dbac01bcf6f9beb4b72553d
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn AccessPackageAssignmentReviewSettings()", "from .access_review_expiration_behavior import AccessReviewExpirationBehavior\nfrom .entitlement_management_schedule import EntitlementManagementSchedule\nfrom .subject_set import SubjectSet\n...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return AccessPackageAssignmentReviewSettings() <|end_body_0|> <|body_start_1|> from .access_review_expiration_behavior import AccessReviewExpirationBehavior from .entitlement_management_schedul...
AccessPackageAssignmentReviewSettings
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccessPackageAssignmentReviewSettings: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessPackageAssignmentReviewSettings: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the d...
stack_v2_sparse_classes_36k_train_003839
5,820
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: AccessPackageAssignmentReviewSettings", "name": "create_from_discriminator_value", "signature": "def create_...
3
null
Implement the Python class `AccessPackageAssignmentReviewSettings` described below. Class description: Implement the AccessPackageAssignmentReviewSettings class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessPackageAssignmentReviewSettings: Crea...
Implement the Python class `AccessPackageAssignmentReviewSettings` described below. Class description: Implement the AccessPackageAssignmentReviewSettings class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessPackageAssignmentReviewSettings: Crea...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class AccessPackageAssignmentReviewSettings: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessPackageAssignmentReviewSettings: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AccessPackageAssignmentReviewSettings: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessPackageAssignmentReviewSettings: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator v...
the_stack_v2_python_sparse
msgraph/generated/models/access_package_assignment_review_settings.py
microsoftgraph/msgraph-sdk-python
train
135
c9dcaf594759f452499c06ef3cabc2c2e7d25385
[ "self.__r = r\nself.__order = order\nself.__mu = np.random.random()\nself.__sigma = np.random.random()\nself.__cor = np.random.random(self.__order + 1) / 100.0", "assert len(sub_sequence) >= self.__order, 'the length of sub-sequence must be order or more'\nsub_sequence = np.array(sub_sequence)\nself.__mu = self._...
<|body_start_0|> self.__r = r self.__order = order self.__mu = np.random.random() self.__sigma = np.random.random() self.__cor = np.random.random(self.__order + 1) / 100.0 <|end_body_0|> <|body_start_1|> assert len(sub_sequence) >= self.__order, 'the length of sub-sequen...
Sequential discounting algorithm
_SDAR_1Dim
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _SDAR_1Dim: """Sequential discounting algorithm""" def __init__(self, r, order): """Args: r: sequential discounting coefficient order: AR model's dimension""" <|body_0|> def update(self, x, sub_sequence): """update the SDAR model Args: x: a datum sub_sequence: su...
stack_v2_sparse_classes_36k_train_003840
7,176
permissive
[ { "docstring": "Args: r: sequential discounting coefficient order: AR model's dimension", "name": "__init__", "signature": "def __init__(self, r, order)" }, { "docstring": "update the SDAR model Args: x: a datum sub_sequence: sub-time-series data Returns: (float, ndarray): outlier score", "n...
3
stack_v2_sparse_classes_30k_train_004626
Implement the Python class `_SDAR_1Dim` described below. Class description: Sequential discounting algorithm Method signatures and docstrings: - def __init__(self, r, order): Args: r: sequential discounting coefficient order: AR model's dimension - def update(self, x, sub_sequence): update the SDAR model Args: x: a d...
Implement the Python class `_SDAR_1Dim` described below. Class description: Sequential discounting algorithm Method signatures and docstrings: - def __init__(self, r, order): Args: r: sequential discounting coefficient order: AR model's dimension - def update(self, x, sub_sequence): update the SDAR model Args: x: a d...
7faf99f36ac012799602f32b359dcda089bcd119
<|skeleton|> class _SDAR_1Dim: """Sequential discounting algorithm""" def __init__(self, r, order): """Args: r: sequential discounting coefficient order: AR model's dimension""" <|body_0|> def update(self, x, sub_sequence): """update the SDAR model Args: x: a datum sub_sequence: su...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _SDAR_1Dim: """Sequential discounting algorithm""" def __init__(self, r, order): """Args: r: sequential discounting coefficient order: AR model's dimension""" self.__r = r self.__order = order self.__mu = np.random.random() self.__sigma = np.random.random() ...
the_stack_v2_python_sparse
changefinder/changefinder.py
IbarakikenYukishi/two-stage-MDL
train
4
54d84764b1124c5e03849ccd88b5c172ae192aac
[ "self._host = host\nself._username = username\nself._shell_client = ShellClientFactory.create(host, username)", "parent_dest_dir = os.path.dirname(dest_dir)\nself._shell_client.exec_command('rm -rf {0}; mkdir -p {0}'.format(dest_dir), error_on_failure=True)\nself._shell_client.copy(source_tar, '{}/clusterrunner.t...
<|body_start_0|> self._host = host self._username = username self._shell_client = ShellClientFactory.create(host, username) <|end_body_0|> <|body_start_1|> parent_dest_dir = os.path.dirname(dest_dir) self._shell_client.exec_command('rm -rf {0}; mkdir -p {0}'.format(dest_dir), er...
A "deploy target" is the host to which clusterrunner will be deployed to. Deployment entails putting in place the clusterrunner binaries and configuration only. This class is not responsible for manipulating processes and stopping/starting services.
DeployTarget
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeployTarget: """A "deploy target" is the host to which clusterrunner will be deployed to. Deployment entails putting in place the clusterrunner binaries and configuration only. This class is not responsible for manipulating processes and stopping/starting services.""" def __init__(self, hos...
stack_v2_sparse_classes_36k_train_003841
2,695
permissive
[ { "docstring": ":param host: the fully qualified hostname of the host to deploy to :type host: str :param username: the user who is executing this process and whose ssh credentials will be used :type username: str", "name": "__init__", "signature": "def __init__(self, host, username)" }, { "docs...
3
stack_v2_sparse_classes_30k_train_001870
Implement the Python class `DeployTarget` described below. Class description: A "deploy target" is the host to which clusterrunner will be deployed to. Deployment entails putting in place the clusterrunner binaries and configuration only. This class is not responsible for manipulating processes and stopping/starting s...
Implement the Python class `DeployTarget` described below. Class description: A "deploy target" is the host to which clusterrunner will be deployed to. Deployment entails putting in place the clusterrunner binaries and configuration only. This class is not responsible for manipulating processes and stopping/starting s...
55d18016f2c7d2dbb8aec5879459cae654edb045
<|skeleton|> class DeployTarget: """A "deploy target" is the host to which clusterrunner will be deployed to. Deployment entails putting in place the clusterrunner binaries and configuration only. This class is not responsible for manipulating processes and stopping/starting services.""" def __init__(self, hos...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DeployTarget: """A "deploy target" is the host to which clusterrunner will be deployed to. Deployment entails putting in place the clusterrunner binaries and configuration only. This class is not responsible for manipulating processes and stopping/starting services.""" def __init__(self, host, username):...
the_stack_v2_python_sparse
app/deployment/deploy_target.py
box/ClusterRunner
train
168
9e554a6b34a19d27eb6e87249053bf7add02e2d9
[ "self.head, self.tail = (Node(0, 0), Node(0, 0))\nself.head.next = self.tail\nself.tail.prev = self.head\nself.size = 0", "x.next = self.head.next\nx.prev = self.head\nself.head.next.prev = x\nself.head.next = x\nself.size += 1", "x.prev.next = x.next\nx.next.prev = x.prev\nself.size -= 1", "last = self.tail....
<|body_start_0|> self.head, self.tail = (Node(0, 0), Node(0, 0)) self.head.next = self.tail self.tail.prev = self.head self.size = 0 <|end_body_0|> <|body_start_1|> x.next = self.head.next x.prev = self.head self.head.next.prev = x self.head.next = x ...
DoubleLinked
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DoubleLinked: def __init__(self): """初始化首尾节点""" <|body_0|> def addFrist(self, x: Node) -> None: """把新节点加入到头部""" <|body_1|> def remove(self, x: Node) -> None: """删除该节点""" <|body_2|> def removeLast(self) -> Node: """删除尾节点,并返回这个...
stack_v2_sparse_classes_36k_train_003842
3,328
no_license
[ { "docstring": "初始化首尾节点", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "把新节点加入到头部", "name": "addFrist", "signature": "def addFrist(self, x: Node) -> None" }, { "docstring": "删除该节点", "name": "remove", "signature": "def remove(self, x: Node) -> No...
4
stack_v2_sparse_classes_30k_train_018309
Implement the Python class `DoubleLinked` described below. Class description: Implement the DoubleLinked class. Method signatures and docstrings: - def __init__(self): 初始化首尾节点 - def addFrist(self, x: Node) -> None: 把新节点加入到头部 - def remove(self, x: Node) -> None: 删除该节点 - def removeLast(self) -> Node: 删除尾节点,并返回这个节点
Implement the Python class `DoubleLinked` described below. Class description: Implement the DoubleLinked class. Method signatures and docstrings: - def __init__(self): 初始化首尾节点 - def addFrist(self, x: Node) -> None: 把新节点加入到头部 - def remove(self, x: Node) -> None: 删除该节点 - def removeLast(self) -> Node: 删除尾节点,并返回这个节点 <|s...
0cc970aaa03aa9300319a1e39e052e4beeec6698
<|skeleton|> class DoubleLinked: def __init__(self): """初始化首尾节点""" <|body_0|> def addFrist(self, x: Node) -> None: """把新节点加入到头部""" <|body_1|> def remove(self, x: Node) -> None: """删除该节点""" <|body_2|> def removeLast(self) -> Node: """删除尾节点,并返回这个...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DoubleLinked: def __init__(self): """初始化首尾节点""" self.head, self.tail = (Node(0, 0), Node(0, 0)) self.head.next = self.tail self.tail.prev = self.head self.size = 0 def addFrist(self, x: Node) -> None: """把新节点加入到头部""" x.next = self.head.next ...
the_stack_v2_python_sparse
leetcode.146. LRU缓存机制.py
NonCover/-
train
2
0231692cc20d662f02f1c475ae7d6f398306d9ae
[ "super().__init__()\nself.encoder = Encoder(N, dm, h, hidden, input_vocab, max_seq_input, drop_rate)\nself.decoder = Decoder(N, dm, h, hidden, target_vocab, max_seq_input, drop_rate)\nself.linear = tf.keras.layers.Dense(units=target_vocab)", "enc_output = self.encoder(inp, training, enc_padding_mask)\ndec_output,...
<|body_start_0|> super().__init__() self.encoder = Encoder(N, dm, h, hidden, input_vocab, max_seq_input, drop_rate) self.decoder = Decoder(N, dm, h, hidden, target_vocab, max_seq_input, drop_rate) self.linear = tf.keras.layers.Dense(units=target_vocab) <|end_body_0|> <|body_start_1|> ...
DecoderBlock class
Transformer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Transformer: """DecoderBlock class""" def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): """Initializer. Args: dm: (int) the dimensionality of the model. h: (int) the number of heads. hidden: (int) the number of hidden units...
stack_v2_sparse_classes_36k_train_003843
13,062
no_license
[ { "docstring": "Initializer. Args: dm: (int) the dimensionality of the model. h: (int) the number of heads. hidden: (int) the number of hidden units in the fully connected layer. drop_rate: (float) the dropout rate.", "name": "__init__", "signature": "def __init__(self, N, dm, h, hidden, input_vocab, ta...
2
null
Implement the Python class `Transformer` described below. Class description: DecoderBlock class Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): Initializer. Args: dm: (int) the dimensionality of the model. h: (int) the ...
Implement the Python class `Transformer` described below. Class description: DecoderBlock class Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): Initializer. Args: dm: (int) the dimensionality of the model. h: (int) the ...
75274394adb52d740f6cd4000cc00bbde44b9b72
<|skeleton|> class Transformer: """DecoderBlock class""" def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): """Initializer. Args: dm: (int) the dimensionality of the model. h: (int) the number of heads. hidden: (int) the number of hidden units...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Transformer: """DecoderBlock class""" def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): """Initializer. Args: dm: (int) the dimensionality of the model. h: (int) the number of heads. hidden: (int) the number of hidden units in the fully...
the_stack_v2_python_sparse
supervised_learning/0x12-transformer_apps/5-transformer.py
jdarangop/holbertonschool-machine_learning
train
2
7dc86f9a5c2776f95b88f881a3d9c87f21e5642e
[ "while p.ltag == 0:\n p = p.lchild\nreturn p", "if p.rtag == 0:\n return self.findFirstNode(p.rchild)\nelse:\n return p.rchild", "result = list()\np = self.findFirstNode(t)\nwhile p is not None:\n result.append(p.data)\n p = self.findNextNode(p)\nreturn result" ]
<|body_start_0|> while p.ltag == 0: p = p.lchild return p <|end_body_0|> <|body_start_1|> if p.rtag == 0: return self.findFirstNode(p.rchild) else: return p.rchild <|end_body_1|> <|body_start_2|> result = list() p = self.findFirstNode...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findFirstNode(self, p: ThreadNode) -> ThreadNode: """中序线索二叉树中中序序列的第一个节点 :param p: :return:""" <|body_0|> def findNextNode(self, p: ThreadNode) -> ThreadNode: """中序线索二叉树中节点p在中序序列下的后继 :param p: :return:""" <|body_1|> def Inorder(self, t: Thre...
stack_v2_sparse_classes_36k_train_003844
1,190
no_license
[ { "docstring": "中序线索二叉树中中序序列的第一个节点 :param p: :return:", "name": "findFirstNode", "signature": "def findFirstNode(self, p: ThreadNode) -> ThreadNode" }, { "docstring": "中序线索二叉树中节点p在中序序列下的后继 :param p: :return:", "name": "findNextNode", "signature": "def findNextNode(self, p: ThreadNode) ->...
3
stack_v2_sparse_classes_30k_test_000531
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findFirstNode(self, p: ThreadNode) -> ThreadNode: 中序线索二叉树中中序序列的第一个节点 :param p: :return: - def findNextNode(self, p: ThreadNode) -> ThreadNode: 中序线索二叉树中节点p在中序序列下的后继 :param p: ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findFirstNode(self, p: ThreadNode) -> ThreadNode: 中序线索二叉树中中序序列的第一个节点 :param p: :return: - def findNextNode(self, p: ThreadNode) -> ThreadNode: 中序线索二叉树中节点p在中序序列下的后继 :param p: ...
cded97a52c422f98b55f2b3527a054d23541d5a4
<|skeleton|> class Solution: def findFirstNode(self, p: ThreadNode) -> ThreadNode: """中序线索二叉树中中序序列的第一个节点 :param p: :return:""" <|body_0|> def findNextNode(self, p: ThreadNode) -> ThreadNode: """中序线索二叉树中节点p在中序序列下的后继 :param p: :return:""" <|body_1|> def Inorder(self, t: Thre...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findFirstNode(self, p: ThreadNode) -> ThreadNode: """中序线索二叉树中中序序列的第一个节点 :param p: :return:""" while p.ltag == 0: p = p.lchild return p def findNextNode(self, p: ThreadNode) -> ThreadNode: """中序线索二叉树中节点p在中序序列下的后继 :param p: :return:""" if p....
the_stack_v2_python_sparse
chapter5/中序线索二叉树的遍历.py
AnJian2020/Leetcode
train
1
d567b5c3e72135d65625a3ba3fe07e0318393cc2
[ "try:\n user = CustomUser.objects.get(email=username)\n print('Abc', user)\n if user.check_password(password):\n print('entered here')\n return user\nexcept User.DoesNotExist:\n return None", "try:\n return User.objects.get(pk=user_id)\nexcept User.DoesNotExist:\n return None" ]
<|body_start_0|> try: user = CustomUser.objects.get(email=username) print('Abc', user) if user.check_password(password): print('entered here') return user except User.DoesNotExist: return None <|end_body_0|> <|body_start_1|...
Email Authentication Backend Allows a user to sign in using an email/password pair rather than a username/password pair.
EmailAuthBackend
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmailAuthBackend: """Email Authentication Backend Allows a user to sign in using an email/password pair rather than a username/password pair.""" def authenticate(cls, username=None, password=None, **kwargs): """Authenticate a user based on email address as the user name.""" <...
stack_v2_sparse_classes_36k_train_003845
3,512
no_license
[ { "docstring": "Authenticate a user based on email address as the user name.", "name": "authenticate", "signature": "def authenticate(cls, username=None, password=None, **kwargs)" }, { "docstring": "Get a User object from the user_id.", "name": "get_user", "signature": "def get_user(self...
2
null
Implement the Python class `EmailAuthBackend` described below. Class description: Email Authentication Backend Allows a user to sign in using an email/password pair rather than a username/password pair. Method signatures and docstrings: - def authenticate(cls, username=None, password=None, **kwargs): Authenticate a u...
Implement the Python class `EmailAuthBackend` described below. Class description: Email Authentication Backend Allows a user to sign in using an email/password pair rather than a username/password pair. Method signatures and docstrings: - def authenticate(cls, username=None, password=None, **kwargs): Authenticate a u...
53fd97bd17f36ce14b2be28bb08d5b65abde8d82
<|skeleton|> class EmailAuthBackend: """Email Authentication Backend Allows a user to sign in using an email/password pair rather than a username/password pair.""" def authenticate(cls, username=None, password=None, **kwargs): """Authenticate a user based on email address as the user name.""" <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EmailAuthBackend: """Email Authentication Backend Allows a user to sign in using an email/password pair rather than a username/password pair.""" def authenticate(cls, username=None, password=None, **kwargs): """Authenticate a user based on email address as the user name.""" try: ...
the_stack_v2_python_sparse
valentisHealth/backends.py
surajit003/valentis
train
1
d3100a2c8a3e8f2d20b3cf391a4385c249935fd2
[ "self.hp = nums\nheapq.heapify(self.hp)\nself.ind = k", "heapq.heappush(self.hp, val)\nwhile len(self.hp) > self.ind:\n heapq.heappop(self.hp)\nreturn self.hp[0]" ]
<|body_start_0|> self.hp = nums heapq.heapify(self.hp) self.ind = k <|end_body_0|> <|body_start_1|> heapq.heappush(self.hp, val) while len(self.hp) > self.ind: heapq.heappop(self.hp) return self.hp[0] <|end_body_1|>
KthLargest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.hp = nums heapq.heapify(self.hp) self...
stack_v2_sparse_classes_36k_train_003846
1,066
no_license
[ { "docstring": ":type k: int :type nums: List[int]", "name": "__init__", "signature": "def __init__(self, k, nums)" }, { "docstring": ":type val: int :rtype: int", "name": "add", "signature": "def add(self, val)" } ]
2
stack_v2_sparse_classes_30k_train_020255
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int <|skeleton|> class KthLargest: def __init__(self, k, nu...
ee59b82125f100970c842d5e1245287c484d6649
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" self.hp = nums heapq.heapify(self.hp) self.ind = k def add(self, val): """:type val: int :rtype: int""" heapq.heappush(self.hp, val) while len(self.hp) > self.ind: ...
the_stack_v2_python_sparse
_CodeTopics/LeetCode/601-800/000703/000703_algo2.py
BIAOXYZ/variousCodes
train
0
9a77187cc02f156b6a88a364f9370afb37d2fd25
[ "if cls.__instance is None:\n cls.__instance = super(Database, cls).__new__(cls)\nreturn cls.__instance", "conf = configparser.ConfigParser()\nconf.read('./database/database.cfg')\nself.host = conf['DATABASE_INFO']['host']\nself.port = int(conf['DATABASE_INFO']['port'])\nself.user = conf['DATABASE_INFO']['user...
<|body_start_0|> if cls.__instance is None: cls.__instance = super(Database, cls).__new__(cls) return cls.__instance <|end_body_0|> <|body_start_1|> conf = configparser.ConfigParser() conf.read('./database/database.cfg') self.host = conf['DATABASE_INFO']['host'] ...
数据库类.
Database
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Database: """数据库类.""" def __new__(cls, *args, **kwargs): """单例模式实现.""" <|body_0|> def __init__(self): """数据库配置.""" <|body_1|> def connect_database(self): """数据库连接方法. return: pool: 返回连接池""" <|body_2|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_36k_train_003847
1,725
no_license
[ { "docstring": "单例模式实现.", "name": "__new__", "signature": "def __new__(cls, *args, **kwargs)" }, { "docstring": "数据库配置.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "数据库连接方法. return: pool: 返回连接池", "name": "connect_database", "signature": "def ...
3
stack_v2_sparse_classes_30k_test_000206
Implement the Python class `Database` described below. Class description: 数据库类. Method signatures and docstrings: - def __new__(cls, *args, **kwargs): 单例模式实现. - def __init__(self): 数据库配置. - def connect_database(self): 数据库连接方法. return: pool: 返回连接池
Implement the Python class `Database` described below. Class description: 数据库类. Method signatures and docstrings: - def __new__(cls, *args, **kwargs): 单例模式实现. - def __init__(self): 数据库配置. - def connect_database(self): 数据库连接方法. return: pool: 返回连接池 <|skeleton|> class Database: """数据库类.""" def __new__(cls, *ar...
773d86b88f7e48c21b44d897fa0e41a07952f21f
<|skeleton|> class Database: """数据库类.""" def __new__(cls, *args, **kwargs): """单例模式实现.""" <|body_0|> def __init__(self): """数据库配置.""" <|body_1|> def connect_database(self): """数据库连接方法. return: pool: 返回连接池""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Database: """数据库类.""" def __new__(cls, *args, **kwargs): """单例模式实现.""" if cls.__instance is None: cls.__instance = super(Database, cls).__new__(cls) return cls.__instance def __init__(self): """数据库配置.""" conf = configparser.ConfigParser() c...
the_stack_v2_python_sparse
database/connect_database.py
itsNinety/XAPI
train
0
8e15159a1d1f72f24f04bba85111ed10c5f38789
[ "try:\n return KnowImage.objects.filter(knowledge=int(self.kwargs['pk']))\nexcept:\n return KnowImage.objects.all()", "instance = self.get_queryset()\nserializer = self.get_serializer(instance, many=True)\nreturn Response(serializer.data)" ]
<|body_start_0|> try: return KnowImage.objects.filter(knowledge=int(self.kwargs['pk'])) except: return KnowImage.objects.all() <|end_body_0|> <|body_start_1|> instance = self.get_queryset() serializer = self.get_serializer(instance, many=True) return Resp...
知识点图片
KnowledgeImageViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KnowledgeImageViewSet: """知识点图片""" def get_queryset(self): """获取知识点图片 根据知识点id查询图片 :return:""" <|body_0|> def retrieve(self, request, *args, **kwargs): """url请求 http://127.0.0.1:8000/know_image/1/ 其中的1代表知识点的id号 返回该知识点对应的所有图片 :param request: :param args: :param kwa...
stack_v2_sparse_classes_36k_train_003848
7,211
no_license
[ { "docstring": "获取知识点图片 根据知识点id查询图片 :return:", "name": "get_queryset", "signature": "def get_queryset(self)" }, { "docstring": "url请求 http://127.0.0.1:8000/know_image/1/ 其中的1代表知识点的id号 返回该知识点对应的所有图片 :param request: :param args: :param kwargs: :return:", "name": "retrieve", "signature": "d...
2
stack_v2_sparse_classes_30k_train_017358
Implement the Python class `KnowledgeImageViewSet` described below. Class description: 知识点图片 Method signatures and docstrings: - def get_queryset(self): 获取知识点图片 根据知识点id查询图片 :return: - def retrieve(self, request, *args, **kwargs): url请求 http://127.0.0.1:8000/know_image/1/ 其中的1代表知识点的id号 返回该知识点对应的所有图片 :param request: :p...
Implement the Python class `KnowledgeImageViewSet` described below. Class description: 知识点图片 Method signatures and docstrings: - def get_queryset(self): 获取知识点图片 根据知识点id查询图片 :return: - def retrieve(self, request, *args, **kwargs): url请求 http://127.0.0.1:8000/know_image/1/ 其中的1代表知识点的id号 返回该知识点对应的所有图片 :param request: :p...
9205dfd8dd0c822a9f5352db845fc12c319db3e3
<|skeleton|> class KnowledgeImageViewSet: """知识点图片""" def get_queryset(self): """获取知识点图片 根据知识点id查询图片 :return:""" <|body_0|> def retrieve(self, request, *args, **kwargs): """url请求 http://127.0.0.1:8000/know_image/1/ 其中的1代表知识点的id号 返回该知识点对应的所有图片 :param request: :param args: :param kwa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KnowledgeImageViewSet: """知识点图片""" def get_queryset(self): """获取知识点图片 根据知识点id查询图片 :return:""" try: return KnowImage.objects.filter(knowledge=int(self.kwargs['pk'])) except: return KnowImage.objects.all() def retrieve(self, request, *args, **kwargs): ...
the_stack_v2_python_sparse
apps/library/views.py
bbright3493/gz_v1.0.0
train
0
5bb7d761e08fd0c0af2d6a3bc672e97838a4f6e2
[ "total = 0\nfor counter in SimpleCounterShard.objects.all():\n total += counter.count\nreturn total", "index = random.randint(0, SimpleCounterShard.NUM_SHARDS - 1)\nshard_name = 'shard' + str(index)\ncounter = SimpleCounterShard.objects.get_or_create(pk=shard_name)[0]\ncounter.count += 1\ncounter.save()" ]
<|body_start_0|> total = 0 for counter in SimpleCounterShard.objects.all(): total += counter.count return total <|end_body_0|> <|body_start_1|> index = random.randint(0, SimpleCounterShard.NUM_SHARDS - 1) shard_name = 'shard' + str(index) counter = SimpleCoun...
Shards for the counter
SimpleCounterShard
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimpleCounterShard: """Shards for the counter""" def get_count(cls): """Retrieve the value for a given sharded counter.""" <|body_0|> def increment(cls): """Increment the value for a given sharded counter.""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_36k_train_003849
4,135
no_license
[ { "docstring": "Retrieve the value for a given sharded counter.", "name": "get_count", "signature": "def get_count(cls)" }, { "docstring": "Increment the value for a given sharded counter.", "name": "increment", "signature": "def increment(cls)" } ]
2
stack_v2_sparse_classes_30k_train_002862
Implement the Python class `SimpleCounterShard` described below. Class description: Shards for the counter Method signatures and docstrings: - def get_count(cls): Retrieve the value for a given sharded counter. - def increment(cls): Increment the value for a given sharded counter.
Implement the Python class `SimpleCounterShard` described below. Class description: Shards for the counter Method signatures and docstrings: - def get_count(cls): Retrieve the value for a given sharded counter. - def increment(cls): Increment the value for a given sharded counter. <|skeleton|> class SimpleCounterSha...
2e3f1bdce124738e1bed2e648826ca819e0bcc57
<|skeleton|> class SimpleCounterShard: """Shards for the counter""" def get_count(cls): """Retrieve the value for a given sharded counter.""" <|body_0|> def increment(cls): """Increment the value for a given sharded counter.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SimpleCounterShard: """Shards for the counter""" def get_count(cls): """Retrieve the value for a given sharded counter.""" total = 0 for counter in SimpleCounterShard.objects.all(): total += counter.count return total def increment(cls): """Increme...
the_stack_v2_python_sparse
sharded_counters/models.py
WAYbetter/waybetter
train
2
3a616a8998906e15aaf0fbd321de8ddd69f2cd94
[ "query_params = {'query': ''.join((f'\"{item}\"' for item in query)), 'tweet.fields': 'id,text,attachments,author_id,conversation_id,created_at,public_metrics', 'expansions': 'attachments.media_keys,author_id', 'media.fields': 'media_key,type,url,public_metrics,alt_text', 'user.fields': 'id,name,username,created_at...
<|body_start_0|> query_params = {'query': ''.join((f'"{item}"' for item in query)), 'tweet.fields': 'id,text,attachments,author_id,conversation_id,created_at,public_metrics', 'expansions': 'attachments.media_keys,author_id', 'media.fields': 'media_key,type,url,public_metrics,alt_text', 'user.fields': 'id,name,u...
Client
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Client: def tweet_search(self, query: str, start_time: Optional[str], end_time: Optional[str], limit: Optional[int], next_token: Optional[str]) -> dict: """Gets tweets according to the query. Args: query: str - The query from the user. start_time: str - Start date from which the Tweets w...
stack_v2_sparse_classes_36k_train_003850
15,516
permissive
[ { "docstring": "Gets tweets according to the query. Args: query: str - The query from the user. start_time: str - Start date from which the Tweets will be provided. end_time: str - The most recent date to which the Tweets will be provided. limit: int - Maximum number of results to return. next_token: str - A va...
2
null
Implement the Python class `Client` described below. Class description: Implement the Client class. Method signatures and docstrings: - def tweet_search(self, query: str, start_time: Optional[str], end_time: Optional[str], limit: Optional[int], next_token: Optional[str]) -> dict: Gets tweets according to the query. A...
Implement the Python class `Client` described below. Class description: Implement the Client class. Method signatures and docstrings: - def tweet_search(self, query: str, start_time: Optional[str], end_time: Optional[str], limit: Optional[int], next_token: Optional[str]) -> dict: Gets tweets according to the query. A...
890def5a0e0ae8d6eaa538148249ddbc851dbb6b
<|skeleton|> class Client: def tweet_search(self, query: str, start_time: Optional[str], end_time: Optional[str], limit: Optional[int], next_token: Optional[str]) -> dict: """Gets tweets according to the query. Args: query: str - The query from the user. start_time: str - Start date from which the Tweets w...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Client: def tweet_search(self, query: str, start_time: Optional[str], end_time: Optional[str], limit: Optional[int], next_token: Optional[str]) -> dict: """Gets tweets according to the query. Args: query: str - The query from the user. start_time: str - Start date from which the Tweets will be provide...
the_stack_v2_python_sparse
Packs/Twitter/Integrations/Twitterv2/Twitterv2.py
demisto/content
train
1,023
97f992c43987d5bd4ccb1516bf0a4e7b15986bf7
[ "issue_tracker = helpers.get_issue_tracker_for_testcase(testcase)\nuser_email = helpers.get_user_email()\nif severity is not None:\n severity = helpers.cast(severity, int, 'Invalid value for security severity (%s).' % severity)\nadditional_ccs = []\nif cc_me:\n additional_ccs.append(user_email)\nissue_id, _ =...
<|body_start_0|> issue_tracker = helpers.get_issue_tracker_for_testcase(testcase) user_email = helpers.get_user_email() if severity is not None: severity = helpers.cast(severity, int, 'Invalid value for security severity (%s).' % severity) additional_ccs = [] if cc_me...
Handler that creates an issue.
Handler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Handler: """Handler that creates an issue.""" def create_issue(testcase, severity, cc_me): """Create an issue.""" <|body_0|> def post(self, testcase): """Create an issue.""" <|body_1|> <|end_skeleton|> <|body_start_0|> issue_tracker = helpers.ge...
stack_v2_sparse_classes_36k_train_003851
1,941
permissive
[ { "docstring": "Create an issue.", "name": "create_issue", "signature": "def create_issue(testcase, severity, cc_me)" }, { "docstring": "Create an issue.", "name": "post", "signature": "def post(self, testcase)" } ]
2
stack_v2_sparse_classes_30k_train_000330
Implement the Python class `Handler` described below. Class description: Handler that creates an issue. Method signatures and docstrings: - def create_issue(testcase, severity, cc_me): Create an issue. - def post(self, testcase): Create an issue.
Implement the Python class `Handler` described below. Class description: Handler that creates an issue. Method signatures and docstrings: - def create_issue(testcase, severity, cc_me): Create an issue. - def post(self, testcase): Create an issue. <|skeleton|> class Handler: """Handler that creates an issue.""" ...
6501a839b27a264500244f32bace8bee4d5cb9a2
<|skeleton|> class Handler: """Handler that creates an issue.""" def create_issue(testcase, severity, cc_me): """Create an issue.""" <|body_0|> def post(self, testcase): """Create an issue.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Handler: """Handler that creates an issue.""" def create_issue(testcase, severity, cc_me): """Create an issue.""" issue_tracker = helpers.get_issue_tracker_for_testcase(testcase) user_email = helpers.get_user_email() if severity is not None: severity = helpers....
the_stack_v2_python_sparse
src/appengine/handlers/testcase_detail/create_issue.py
google/clusterfuzz
train
5,420
de6d7857c25a32012dd9126a63611e5a27762f95
[ "if n == 2:\n return 1\nif n == 3:\n return 2\ndp = [0] * 60\ndp[2] = 2\ndp[3] = 3\nfor i in range(4, n + 1):\n dp[i] = max((dp[j] * dp[i - j] for j in range(2, i)))\nreturn dp[n]", "if n == 2:\n return 1\nif n == 3:\n return 2\nif n % 3 == 0:\n return 3 ** (n // 3)\nif n % 3 == 1:\n return 3...
<|body_start_0|> if n == 2: return 1 if n == 3: return 2 dp = [0] * 60 dp[2] = 2 dp[3] = 3 for i in range(4, n + 1): dp[i] = max((dp[j] * dp[i - j] for j in range(2, i))) return dp[n] <|end_body_0|> <|body_start_1|> if ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def integerBreak(self, n): """dp :type n: int :rtype: int""" <|body_0|> def integerBreak2(self, n): """找规律发现,尽可能多拆一点3值最大 如果n%3是1,最后的3凑成4 :param n: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> if n == 2: return 1 ...
stack_v2_sparse_classes_36k_train_003852
1,411
no_license
[ { "docstring": "dp :type n: int :rtype: int", "name": "integerBreak", "signature": "def integerBreak(self, n)" }, { "docstring": "找规律发现,尽可能多拆一点3值最大 如果n%3是1,最后的3凑成4 :param n: :return:", "name": "integerBreak2", "signature": "def integerBreak2(self, n)" } ]
2
stack_v2_sparse_classes_30k_train_004263
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def integerBreak(self, n): dp :type n: int :rtype: int - def integerBreak2(self, n): 找规律发现,尽可能多拆一点3值最大 如果n%3是1,最后的3凑成4 :param n: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def integerBreak(self, n): dp :type n: int :rtype: int - def integerBreak2(self, n): 找规律发现,尽可能多拆一点3值最大 如果n%3是1,最后的3凑成4 :param n: :return: <|skeleton|> class Solution: def i...
5d3574ccd282d0146c83c286ae28d8baaabd4910
<|skeleton|> class Solution: def integerBreak(self, n): """dp :type n: int :rtype: int""" <|body_0|> def integerBreak2(self, n): """找规律发现,尽可能多拆一点3值最大 如果n%3是1,最后的3凑成4 :param n: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def integerBreak(self, n): """dp :type n: int :rtype: int""" if n == 2: return 1 if n == 3: return 2 dp = [0] * 60 dp[2] = 2 dp[3] = 3 for i in range(4, n + 1): dp[i] = max((dp[j] * dp[i - j] for j in range(2...
the_stack_v2_python_sparse
343_整数拆分.py
lovehhf/LeetCode
train
0
5418483303258c33b77b5e3f9eb7e07baf3a4053
[ "self.min = np.array([[8.05502, 9.66459], [-8.05502, 9.66459], [8.05502, -9.66459], [-8.05502, -9.66459]])\nself.value = np.array([-19.2085, -19.2085, -19.2085, -19.2085])\nself.domain = np.array([[-10, 10], [-10, 10]])\nself.n = 2\nself.smooth = False\nself.info = [True, False, False]\nself.latex_name = 'Holder Ta...
<|body_start_0|> self.min = np.array([[8.05502, 9.66459], [-8.05502, 9.66459], [8.05502, -9.66459], [-8.05502, -9.66459]]) self.value = np.array([-19.2085, -19.2085, -19.2085, -19.2085]) self.domain = np.array([[-10, 10], [-10, 10]]) self.n = 2 self.smooth = False self.in...
Holder Table Function.
HolderTable
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HolderTable: """Holder Table Function.""" def __init__(self): """Constructor.""" <|body_0|> def cost(self, x): """Cost function.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.min = np.array([[8.05502, 9.66459], [-8.05502, 9.66459], [8.055...
stack_v2_sparse_classes_36k_train_003853
1,303
no_license
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Cost function.", "name": "cost", "signature": "def cost(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_017722
Implement the Python class `HolderTable` described below. Class description: Holder Table Function. Method signatures and docstrings: - def __init__(self): Constructor. - def cost(self, x): Cost function.
Implement the Python class `HolderTable` described below. Class description: Holder Table Function. Method signatures and docstrings: - def __init__(self): Constructor. - def cost(self, x): Cost function. <|skeleton|> class HolderTable: """Holder Table Function.""" def __init__(self): """Constructor...
f2a74df3ab01ac35ea8d80569da909ffa1e86af3
<|skeleton|> class HolderTable: """Holder Table Function.""" def __init__(self): """Constructor.""" <|body_0|> def cost(self, x): """Cost function.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HolderTable: """Holder Table Function.""" def __init__(self): """Constructor.""" self.min = np.array([[8.05502, 9.66459], [-8.05502, 9.66459], [8.05502, -9.66459], [-8.05502, -9.66459]]) self.value = np.array([-19.2085, -19.2085, -19.2085, -19.2085]) self.domain = np.array...
the_stack_v2_python_sparse
ctf/functions2d/holder_table.py
cntaylor/ctf
train
1
4a0ccd1db8edefb3234530c7d6ce1595e21c3a8e
[ "self.mode = mode\nif self.mode == 'interp':\n if nrb is None:\n nrb = 20\n if kind is None:\n kind = 'linear'\nelif self.mode == 'extrap':\n if nrb is None:\n nrb = 20\n if kind is None:\n kind = 'cubic'\nelse:\n raise NotImplementedError()\nself.kind = kind\nls_pre = np....
<|body_start_0|> self.mode = mode if self.mode == 'interp': if nrb is None: nrb = 20 if kind is None: kind = 'linear' elif self.mode == 'extrap': if nrb is None: nrb = 20 if kind is None: ...
ClInterpolator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClInterpolator: def __init__(self, lb, lmax, mode='interp', nrb=None, nb_dex_extrap_lo=10, kind=None): """Interpolator for angular power spectra lb : central bandpower ells nrb : re-binning factor for ells within the range of the bandpowers nb_dex_extrap_lo : number of ells per decade fo...
stack_v2_sparse_classes_36k_train_003854
3,247
no_license
[ { "docstring": "Interpolator for angular power spectra lb : central bandpower ells nrb : re-binning factor for ells within the range of the bandpowers nb_dex_extrap_lo : number of ells per decade for ells below the range of the bandpowers kind : interpolation type Extrapolation at high ell will be done assuming...
2
stack_v2_sparse_classes_30k_train_017906
Implement the Python class `ClInterpolator` described below. Class description: Implement the ClInterpolator class. Method signatures and docstrings: - def __init__(self, lb, lmax, mode='interp', nrb=None, nb_dex_extrap_lo=10, kind=None): Interpolator for angular power spectra lb : central bandpower ells nrb : re-bin...
Implement the Python class `ClInterpolator` described below. Class description: Implement the ClInterpolator class. Method signatures and docstrings: - def __init__(self, lb, lmax, mode='interp', nrb=None, nb_dex_extrap_lo=10, kind=None): Interpolator for angular power spectra lb : central bandpower ells nrb : re-bin...
724b3fa28fa68d21ea006ee9d2620b4ecd4b6107
<|skeleton|> class ClInterpolator: def __init__(self, lb, lmax, mode='interp', nrb=None, nb_dex_extrap_lo=10, kind=None): """Interpolator for angular power spectra lb : central bandpower ells nrb : re-binning factor for ells within the range of the bandpowers nb_dex_extrap_lo : number of ells per decade fo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClInterpolator: def __init__(self, lb, lmax, mode='interp', nrb=None, nb_dex_extrap_lo=10, kind=None): """Interpolator for angular power spectra lb : central bandpower ells nrb : re-binning factor for ells within the range of the bandpowers nb_dex_extrap_lo : number of ells per decade for ells below t...
the_stack_v2_python_sparse
theory/theory_util.py
LBJ-Wade/GSKY
train
0
13adbd71a8d284731cb1b1e8db73a33285274c77
[ "from IPython import get_ipython\nif mode == 'new':\n text = '\\n{\"activity\": \"poll\",\\n \"instructors\": [\"YOUR ID HERE\"],\\n \"items\": [\\n {\"id\": \"1\",\\n \"question\": \"\"\"When it comes to learning, metacognition (e.g., thinking about thinking) can be just as important as intelligence...
<|body_start_0|> from IPython import get_ipython if mode == 'new': text = '\n{"activity": "poll",\n "instructors": ["YOUR ID HERE"],\n "items": [\n {"id": "1",\n "question": """When it comes to learning, metacognition (e.g., thinking about thinking) can be just as important as in...
ActivityMagic
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ActivityMagic: def line_activity(self, filename, mode=None): """%activity FILENAME - run a widget-based activity (poll, classroom response, clicker-like activity) This magic will load the JSON in the filename. Examples: %activity /home/teacher/activity1 %activity /home/teacher/activity1 ...
stack_v2_sparse_classes_36k_train_003855
12,898
permissive
[ { "docstring": "%activity FILENAME - run a widget-based activity (poll, classroom response, clicker-like activity) This magic will load the JSON in the filename. Examples: %activity /home/teacher/activity1 %activity /home/teacher/activity1 new %activity /home/teacher/activity1 edit", "name": "line_activity"...
2
stack_v2_sparse_classes_30k_train_017098
Implement the Python class `ActivityMagic` described below. Class description: Implement the ActivityMagic class. Method signatures and docstrings: - def line_activity(self, filename, mode=None): %activity FILENAME - run a widget-based activity (poll, classroom response, clicker-like activity) This magic will load th...
Implement the Python class `ActivityMagic` described below. Class description: Implement the ActivityMagic class. Method signatures and docstrings: - def line_activity(self, filename, mode=None): %activity FILENAME - run a widget-based activity (poll, classroom response, clicker-like activity) This magic will load th...
3f80af24033ccb8fabe930d8c25a88a3c891f3e0
<|skeleton|> class ActivityMagic: def line_activity(self, filename, mode=None): """%activity FILENAME - run a widget-based activity (poll, classroom response, clicker-like activity) This magic will load the JSON in the filename. Examples: %activity /home/teacher/activity1 %activity /home/teacher/activity1 ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ActivityMagic: def line_activity(self, filename, mode=None): """%activity FILENAME - run a widget-based activity (poll, classroom response, clicker-like activity) This magic will load the JSON in the filename. Examples: %activity /home/teacher/activity1 %activity /home/teacher/activity1 new %activity ...
the_stack_v2_python_sparse
metakernel/magics/activity_magic.py
Calysto/metakernel
train
326
435f48322403ca8e571f3bccfe8cc3a0a1677b7e
[ "super().__init__()\nself.frequency = frequency\nself.length = length\nself.type = type", "mother_wavelet = self.type\nspread = np.arange(1, self.length + 1, 1)\nscales = central_frequency(mother_wavelet) * self.frequency / spread\ncoeffs, _ = cwt(signal, scales, mother_wavelet, 1.0 / self.frequency)\ncoeffs = np...
<|body_start_0|> super().__init__() self.frequency = frequency self.length = length self.type = type <|end_body_0|> <|body_start_1|> mother_wavelet = self.type spread = np.arange(1, self.length + 1, 1) scales = central_frequency(mother_wavelet) * self.frequency /...
Generate continuous wavelet transform of a signal
SignalContinuousWavelet
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SignalContinuousWavelet: """Generate continuous wavelet transform of a signal""" def __init__(self, type: str='mexh', length: float=125.0, frequency: float=500.0) -> None: """Args: type: mother wavelet type. Available options are: {``"mexh"``, ``"morl"``, ``"cmorB-C"``, , ``"gausP"``...
stack_v2_sparse_classes_36k_train_003856
16,322
permissive
[ { "docstring": "Args: type: mother wavelet type. Available options are: {``\"mexh\"``, ``\"morl\"``, ``\"cmorB-C\"``, , ``\"gausP\"``} see : https://pywavelets.readthedocs.io/en/latest/ref/cwt.html length: expected length, default ``125.0`` frequency: signal frequency, default ``500.0``", "name": "__init__"...
2
stack_v2_sparse_classes_30k_test_000223
Implement the Python class `SignalContinuousWavelet` described below. Class description: Generate continuous wavelet transform of a signal Method signatures and docstrings: - def __init__(self, type: str='mexh', length: float=125.0, frequency: float=500.0) -> None: Args: type: mother wavelet type. Available options a...
Implement the Python class `SignalContinuousWavelet` described below. Class description: Generate continuous wavelet transform of a signal Method signatures and docstrings: - def __init__(self, type: str='mexh', length: float=125.0, frequency: float=500.0) -> None: Args: type: mother wavelet type. Available options a...
e48c3e2c741fa3fc705c4425d17ac4a5afac6c47
<|skeleton|> class SignalContinuousWavelet: """Generate continuous wavelet transform of a signal""" def __init__(self, type: str='mexh', length: float=125.0, frequency: float=500.0) -> None: """Args: type: mother wavelet type. Available options are: {``"mexh"``, ``"morl"``, ``"cmorB-C"``, , ``"gausP"``...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SignalContinuousWavelet: """Generate continuous wavelet transform of a signal""" def __init__(self, type: str='mexh', length: float=125.0, frequency: float=500.0) -> None: """Args: type: mother wavelet type. Available options are: {``"mexh"``, ``"morl"``, ``"cmorB-C"``, , ``"gausP"``} see : https...
the_stack_v2_python_sparse
monai/transforms/signal/array.py
Project-MONAI/MONAI
train
4,805
dc0f5903b7938032e112e360f545c1ca8c817e15
[ "self.interval = interval\nself.packetizer = packetizer\nthread = threading.Thread(target=self.run, args=())\nthread.daemon = True\nthread.start()", "Handler = WebServerHandler\nhttpd = SocketServer.TCPServer(('', 8099), WebServerHandler)\nhttpd.packetizer = self.packetizer\nhttpd.serve_forever()" ]
<|body_start_0|> self.interval = interval self.packetizer = packetizer thread = threading.Thread(target=self.run, args=()) thread.daemon = True thread.start() <|end_body_0|> <|body_start_1|> Handler = WebServerHandler httpd = SocketServer.TCPServer(('', 8099), We...
WebServer class Run as thread
WebServer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WebServer: """WebServer class Run as thread""" def __init__(self, packetizer, interval=1): """Constructor :type interval: int :param interval: Check interval, in seconds""" <|body_0|> def run(self): """Method that runs forever""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_36k_train_003857
3,280
permissive
[ { "docstring": "Constructor :type interval: int :param interval: Check interval, in seconds", "name": "__init__", "signature": "def __init__(self, packetizer, interval=1)" }, { "docstring": "Method that runs forever", "name": "run", "signature": "def run(self)" } ]
2
stack_v2_sparse_classes_30k_train_014627
Implement the Python class `WebServer` described below. Class description: WebServer class Run as thread Method signatures and docstrings: - def __init__(self, packetizer, interval=1): Constructor :type interval: int :param interval: Check interval, in seconds - def run(self): Method that runs forever
Implement the Python class `WebServer` described below. Class description: WebServer class Run as thread Method signatures and docstrings: - def __init__(self, packetizer, interval=1): Constructor :type interval: int :param interval: Check interval, in seconds - def run(self): Method that runs forever <|skeleton|> c...
8a22b175e394f56bbb28b29baec9c046ccc8e7e2
<|skeleton|> class WebServer: """WebServer class Run as thread""" def __init__(self, packetizer, interval=1): """Constructor :type interval: int :param interval: Check interval, in seconds""" <|body_0|> def run(self): """Method that runs forever""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WebServer: """WebServer class Run as thread""" def __init__(self, packetizer, interval=1): """Constructor :type interval: int :param interval: Check interval, in seconds""" self.interval = interval self.packetizer = packetizer thread = threading.Thread(target=self.run, arg...
the_stack_v2_python_sparse
libwavesync/webserver.py
ddimension/WaveSync
train
0
50b1da5d007440d99f76fc1609e9bd2a2968b7ed
[ "if len(nums) == 0:\n return []\nif len(nums) == 1:\n return ['Gold Medal']\nif len(nums) == 2:\n if nums[0] > nums[1]:\n return ['Gold Medal', 'Silver Medal']\n else:\n return ['Silver Medal', 'Gold Medal']\nnum1 = sorted(nums)[::-1]\ndic = {num: str(i + 1) for i, num in enumerate(num1)}\...
<|body_start_0|> if len(nums) == 0: return [] if len(nums) == 1: return ['Gold Medal'] if len(nums) == 2: if nums[0] > nums[1]: return ['Gold Medal', 'Silver Medal'] else: return ['Silver Medal', 'Gold Medal'] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findRelativeRanks(self, nums): """:type nums: List[int] :rtype: List[str]""" <|body_0|> def findRelativeRanks2(self, nums): """:type nums: List[int] :rtype: List[str]""" <|body_1|> def findRelativeRanks_work(self, nums): """:type nu...
stack_v2_sparse_classes_36k_train_003858
3,026
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[str]", "name": "findRelativeRanks", "signature": "def findRelativeRanks(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[str]", "name": "findRelativeRanks2", "signature": "def findRelativeRanks2(self, nums)" }, { ...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findRelativeRanks(self, nums): :type nums: List[int] :rtype: List[str] - def findRelativeRanks2(self, nums): :type nums: List[int] :rtype: List[str] - def findRelativeRanks_w...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findRelativeRanks(self, nums): :type nums: List[int] :rtype: List[str] - def findRelativeRanks2(self, nums): :type nums: List[int] :rtype: List[str] - def findRelativeRanks_w...
3f0ffd519404165fd1a735441b212c801fd1ad1e
<|skeleton|> class Solution: def findRelativeRanks(self, nums): """:type nums: List[int] :rtype: List[str]""" <|body_0|> def findRelativeRanks2(self, nums): """:type nums: List[int] :rtype: List[str]""" <|body_1|> def findRelativeRanks_work(self, nums): """:type nu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findRelativeRanks(self, nums): """:type nums: List[int] :rtype: List[str]""" if len(nums) == 0: return [] if len(nums) == 1: return ['Gold Medal'] if len(nums) == 2: if nums[0] > nums[1]: return ['Gold Medal', 'S...
the_stack_v2_python_sparse
Problems/0500_0599/0506_Relative_Ranks/Project_Python3/Relative_Ranks.py
NobuyukiInoue/LeetCode
train
0
a691369c1cb1bf714c508b7daafb7694cee28f18
[ "if not root:\n return []\nqueue = collections.deque([root])\nres = []\nwhile queue:\n size = len(queue)\n for i in range(size):\n node = queue.pop()\n if node:\n res.append(node.val)\n queue.appendleft(node.left)\n queue.appendleft(node.right)\n else:\...
<|body_start_0|> if not root: return [] queue = collections.deque([root]) res = [] while queue: size = len(queue) for i in range(size): node = queue.pop() if node: res.append(node.val) ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_003859
1,777
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
1d8821da01c9c200732a6b7037b8631689e2f7e7
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return [] queue = collections.deque([root]) res = [] while queue: size = len(queue) for i in range(size): ...
the_stack_v2_python_sparse
Leetcode0297_Queue.py
xiaojinghu/Leetcode
train
0
54f12e29aa7069ad830d167e997a4436f1016a5c
[ "self.filename = filename\nf = open(self.filename)\nline = f.readline()\nadditional_parameters = {}\nif '.' not in line:\n additional_parameters['dtype'] = np.int32\nself.data = np.loadtxt(self.filename, **additional_parameters)\nif len(self.data.shape) == 1:\n self.data = self.data[:, np.newaxis]", "if col...
<|body_start_0|> self.filename = filename f = open(self.filename) line = f.readline() additional_parameters = {} if '.' not in line: additional_parameters['dtype'] = np.int32 self.data = np.loadtxt(self.filename, **additional_parameters) if len(self.da...
Class for reading an ASCII file containing multiple columns of data.
ColumnIO
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ColumnIO: """Class for reading an ASCII file containing multiple columns of data.""" def __init__(self, filename): """filename: string, path to ASCII file to read.""" <|body_0|> def get_columns(self, column_ids='all', condition=None, condition_column=None, sorting_column...
stack_v2_sparse_classes_36k_train_003860
31,911
permissive
[ { "docstring": "filename: string, path to ASCII file to read.", "name": "__init__", "signature": "def __init__(self, filename)" }, { "docstring": "column_ids : 'all' or list of int, the ids of columns to extract. condition : None or function, which is applied to each row to evaluate if it should...
2
stack_v2_sparse_classes_30k_train_010360
Implement the Python class `ColumnIO` described below. Class description: Class for reading an ASCII file containing multiple columns of data. Method signatures and docstrings: - def __init__(self, filename): filename: string, path to ASCII file to read. - def get_columns(self, column_ids='all', condition=None, condi...
Implement the Python class `ColumnIO` described below. Class description: Class for reading an ASCII file containing multiple columns of data. Method signatures and docstrings: - def __init__(self, filename): filename: string, path to ASCII file to read. - def get_columns(self, column_ids='all', condition=None, condi...
354c8d9d5fbc4daad3547773d2f281f8c163d208
<|skeleton|> class ColumnIO: """Class for reading an ASCII file containing multiple columns of data.""" def __init__(self, filename): """filename: string, path to ASCII file to read.""" <|body_0|> def get_columns(self, column_ids='all', condition=None, condition_column=None, sorting_column...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ColumnIO: """Class for reading an ASCII file containing multiple columns of data.""" def __init__(self, filename): """filename: string, path to ASCII file to read.""" self.filename = filename f = open(self.filename) line = f.readline() additional_parameters = {} ...
the_stack_v2_python_sparse
neo/io/nestio.py
NeuralEnsemble/python-neo
train
265
b13c9679d7530c4726ac8fc28454fecd4e7b538f
[ "n = np.real(n)\nd = 4 * np.sin(th / 2) ** 2 / (3 * (n - 1) ** 2)\nd_180 = 4 * np.sin(np.pi / 2) / (3 * (n - 1) ** 2)\nv = (3 - mu) / 2\ndv = d ** v\nd_180v = d_180 ** v\nd1 = 1 - d\ndv1 = 1 - dv\na = 1 / (4 * np.pi * dv * d1 ** 2)\nb = v * d1 - dv1 + (d * dv1 - v * d1) * np.sin(th / 2) ** (-2)\nc = (1 - d_180v) * ...
<|body_start_0|> n = np.real(n) d = 4 * np.sin(th / 2) ** 2 / (3 * (n - 1) ** 2) d_180 = 4 * np.sin(np.pi / 2) / (3 * (n - 1) ** 2) v = (3 - mu) / 2 dv = d ** v d_180v = d_180 ** v d1 = 1 - d dv1 = 1 - dv a = 1 / (4 * np.pi * dv * d1 ** 2) ...
Scattering
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Scattering: def vspf_fournier(th, n, mu): """Volume scattering phase function, Fournier & Forand (1999), Fournier & Jonasz (1999) Parameters: th = scattering angle n = index of refraction of particle, only the real part is used mu = slope of hyperbolic distribution of particle sizes, typ...
stack_v2_sparse_classes_36k_train_003861
14,976
no_license
[ { "docstring": "Volume scattering phase function, Fournier & Forand (1999), Fournier & Jonasz (1999) Parameters: th = scattering angle n = index of refraction of particle, only the real part is used mu = slope of hyperbolic distribution of particle sizes, typically 3-5", "name": "vspf_fournier", "signat...
2
stack_v2_sparse_classes_30k_train_011886
Implement the Python class `Scattering` described below. Class description: Implement the Scattering class. Method signatures and docstrings: - def vspf_fournier(th, n, mu): Volume scattering phase function, Fournier & Forand (1999), Fournier & Jonasz (1999) Parameters: th = scattering angle n = index of refraction o...
Implement the Python class `Scattering` described below. Class description: Implement the Scattering class. Method signatures and docstrings: - def vspf_fournier(th, n, mu): Volume scattering phase function, Fournier & Forand (1999), Fournier & Jonasz (1999) Parameters: th = scattering angle n = index of refraction o...
bb86d8408741750266eda4c88ef3211e9dfb7caa
<|skeleton|> class Scattering: def vspf_fournier(th, n, mu): """Volume scattering phase function, Fournier & Forand (1999), Fournier & Jonasz (1999) Parameters: th = scattering angle n = index of refraction of particle, only the real part is used mu = slope of hyperbolic distribution of particle sizes, typ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Scattering: def vspf_fournier(th, n, mu): """Volume scattering phase function, Fournier & Forand (1999), Fournier & Jonasz (1999) Parameters: th = scattering angle n = index of refraction of particle, only the real part is used mu = slope of hyperbolic distribution of particle sizes, typically 3-5""" ...
the_stack_v2_python_sparse
polarization.py
GuangyuanZhao/ee239as
train
1
ff62a00479ce55ad8b065a4c0d727dc50b63ba66
[ "if len(args) == 1 and isinstance(args[0], (list, tuple)):\n return self.find(*args[0])\nelif not all((isinstance(predicate, six.string_types) for predicate in args)):\n raise TypeError('predicates must all be strings')\nnew_list = copy.deepcopy(self)\nfor predicate in args:\n try:\n key, operator, ...
<|body_start_0|> if len(args) == 1 and isinstance(args[0], (list, tuple)): return self.find(*args[0]) elif not all((isinstance(predicate, six.string_types) for predicate in args)): raise TypeError('predicates must all be strings') new_list = copy.deepcopy(self) fo...
_LazyList
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _LazyList: def find(self, *args): """Gets the results from this collection that match input predicates. A predicate is a string containing a simple boolean expression consisting of: - a dot-delimited property such as ``metrics.accuracy`` - a Python boolean operator such as ``>=`` - a lit...
stack_v2_sparse_classes_36k_train_003862
5,162
permissive
[ { "docstring": "Gets the results from this collection that match input predicates. A predicate is a string containing a simple boolean expression consisting of: - a dot-delimited property such as ``metrics.accuracy`` - a Python boolean operator such as ``>=`` - a literal value such as ``.8`` Parameters --------...
2
stack_v2_sparse_classes_30k_train_014190
Implement the Python class `_LazyList` described below. Class description: Implement the _LazyList class. Method signatures and docstrings: - def find(self, *args): Gets the results from this collection that match input predicates. A predicate is a string containing a simple boolean expression consisting of: - a dot-...
Implement the Python class `_LazyList` described below. Class description: Implement the _LazyList class. Method signatures and docstrings: - def find(self, *args): Gets the results from this collection that match input predicates. A predicate is a string containing a simple boolean expression consisting of: - a dot-...
ec9ac7712500adb13fd815dfd476ce9f536c6921
<|skeleton|> class _LazyList: def find(self, *args): """Gets the results from this collection that match input predicates. A predicate is a string containing a simple boolean expression consisting of: - a dot-delimited property such as ``metrics.accuracy`` - a Python boolean operator such as ``>=`` - a lit...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _LazyList: def find(self, *args): """Gets the results from this collection that match input predicates. A predicate is a string containing a simple boolean expression consisting of: - a dot-delimited property such as ``metrics.accuracy`` - a Python boolean operator such as ``>=`` - a literal value suc...
the_stack_v2_python_sparse
client/verta/verta/_bases/_lazy_list.py
VertaAI/modeldb
train
844
50b676de636bbed5272c4c0fea2f790feea5fc4c
[ "t = self.observation['t']\nx, y = model.get_x_y(t)\nreturn {'t': t, 'x': x, 'y': y}", "delta_x = observation['x'] - prediction['x']\ndelta_y = observation['y'] - prediction['y']\nerror = np.sqrt(delta_x ** 2 + delta_y ** 2)\npassing = bool(error < 100000.0 * pq.kilometer)\nscore = self.score_type(passing)\nscore...
<|body_start_0|> t = self.observation['t'] x, y = model.get_x_y(t) return {'t': t, 'x': x, 'y': y} <|end_body_0|> <|body_start_1|> delta_x = observation['x'] - prediction['x'] delta_y = observation['y'] - prediction['y'] error = np.sqrt(delta_x ** 2 + delta_y ** 2) ...
A test of a planetary position at some specified time.
PositionTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PositionTest: """A test of a planetary position at some specified time.""" def generate_prediction(self, model): """Generate a prediction from a model.""" <|body_0|> def compute_score(self, observation, prediction): """Compute a test score based on the agreement ...
stack_v2_sparse_classes_36k_train_003863
4,646
no_license
[ { "docstring": "Generate a prediction from a model.", "name": "generate_prediction", "signature": "def generate_prediction(self, model)" }, { "docstring": "Compute a test score based on the agreement between the observation (data) and prediction (model).", "name": "compute_score", "signa...
2
stack_v2_sparse_classes_30k_train_009085
Implement the Python class `PositionTest` described below. Class description: A test of a planetary position at some specified time. Method signatures and docstrings: - def generate_prediction(self, model): Generate a prediction from a model. - def compute_score(self, observation, prediction): Compute a test score ba...
Implement the Python class `PositionTest` described below. Class description: A test of a planetary position at some specified time. Method signatures and docstrings: - def generate_prediction(self, model): Generate a prediction from a model. - def compute_score(self, observation, prediction): Compute a test score ba...
624bf82ce5c610c2ca83a0c4c49d3f4d0b92a1e2
<|skeleton|> class PositionTest: """A test of a planetary position at some specified time.""" def generate_prediction(self, model): """Generate a prediction from a model.""" <|body_0|> def compute_score(self, observation, prediction): """Compute a test score based on the agreement ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PositionTest: """A test of a planetary position at some specified time.""" def generate_prediction(self, model): """Generate a prediction from a model.""" t = self.observation['t'] x, y = model.get_x_y(t) return {'t': t, 'x': x, 'y': y} def compute_score(self, observa...
the_stack_v2_python_sparse
unittest/sciunittest.py
HussainAther/neuroscience
train
9
f7ae175e4469df13a6fc6f4f6b73c5c421e34edc
[ "l = len(nums)\nr = []\ni = 0\nwhile i < l:\n j = i + 1\n t = -1\n while j < l + i:\n if nums[j % l] > nums[i]:\n t = nums[j % l]\n break\n j += 1\n r.append(t)\n i += 1\nreturn r", "s = []\nl = len(nums)\nr = [-1] * l\ni = 2 * l - 1\nwhile i >= 0:\n while len...
<|body_start_0|> l = len(nums) r = [] i = 0 while i < l: j = i + 1 t = -1 while j < l + i: if nums[j % l] > nums[i]: t = nums[j % l] break j += 1 r.append(t) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def nextGreaterElements1(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def nextGreaterElements(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> l = len(nums) ...
stack_v2_sparse_classes_36k_train_003864
905
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "nextGreaterElements1", "signature": "def nextGreaterElements1(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "nextGreaterElements", "signature": "def nextGreaterElements(self, nums)" }...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nextGreaterElements1(self, nums): :type nums: List[int] :rtype: List[int] - def nextGreaterElements(self, nums): :type nums: List[int] :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nextGreaterElements1(self, nums): :type nums: List[int] :rtype: List[int] - def nextGreaterElements(self, nums): :type nums: List[int] :rtype: List[int] <|skeleton|> class S...
e5b018493bbd12edcdcd0434f35d9c358106d391
<|skeleton|> class Solution: def nextGreaterElements1(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def nextGreaterElements(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def nextGreaterElements1(self, nums): """:type nums: List[int] :rtype: List[int]""" l = len(nums) r = [] i = 0 while i < l: j = i + 1 t = -1 while j < l + i: if nums[j % l] > nums[i]: t = ...
the_stack_v2_python_sparse
py/leetcode/503.py
wfeng1991/learnpy
train
0
5e9809d1bb25870b5ceb87f6e946ee0685ee3177
[ "self.validate_parameters(country_code=country_code)\n_query_builder = Configuration.get_base_uri()\n_query_builder += '/information/geodata/countries/{countryCode}/subdivisions'\n_query_builder = APIHelper.append_url_with_template_parameters(_query_builder, {'countryCode': country_code})\n_query_parameters = {'lan...
<|body_start_0|> self.validate_parameters(country_code=country_code) _query_builder = Configuration.get_base_uri() _query_builder += '/information/geodata/countries/{countryCode}/subdivisions' _query_builder = APIHelper.append_url_with_template_parameters(_query_builder, {'countryCode': ...
A Controller to access Endpoints in the idfy_rest_client API.
GeoDataController
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GeoDataController: """A Controller to access Endpoints in the idfy_rest_client API.""" def list_country_subdivisions(self, country_code, lang=None): """Does a GET request to /information/geodata/countries/{countryCode}/subdivisions. Retrieves a list over top level administrative subd...
stack_v2_sparse_classes_36k_train_003865
6,016
permissive
[ { "docstring": "Does a GET request to /information/geodata/countries/{countryCode}/subdivisions. Retrieves a list over top level administrative subdivisions for a country with name and ISO 3166-2 region code Args: country_code (string): ISO 3166-1 country code to look up lang (string, optional): Language for re...
3
stack_v2_sparse_classes_30k_train_020063
Implement the Python class `GeoDataController` described below. Class description: A Controller to access Endpoints in the idfy_rest_client API. Method signatures and docstrings: - def list_country_subdivisions(self, country_code, lang=None): Does a GET request to /information/geodata/countries/{countryCode}/subdivis...
Implement the Python class `GeoDataController` described below. Class description: A Controller to access Endpoints in the idfy_rest_client API. Method signatures and docstrings: - def list_country_subdivisions(self, country_code, lang=None): Does a GET request to /information/geodata/countries/{countryCode}/subdivis...
fa3918a6c54ea0eedb9146578645b7eb1755b642
<|skeleton|> class GeoDataController: """A Controller to access Endpoints in the idfy_rest_client API.""" def list_country_subdivisions(self, country_code, lang=None): """Does a GET request to /information/geodata/countries/{countryCode}/subdivisions. Retrieves a list over top level administrative subd...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GeoDataController: """A Controller to access Endpoints in the idfy_rest_client API.""" def list_country_subdivisions(self, country_code, lang=None): """Does a GET request to /information/geodata/countries/{countryCode}/subdivisions. Retrieves a list over top level administrative subdivisions for ...
the_stack_v2_python_sparse
idfy_rest_client/controllers/geo_data_controller.py
dealflowteam/Idfy
train
0
9a68fd46635c7eaf7791ea603f811d3cd2016cf1
[ "if not prices:\n return 0\nINT_MAX = 2147483647\nmaxPro = 0\nminPrice = INT_MAX\nfor i in range(len(prices)):\n minPrice = min(minPrice, prices[i])\n maxPro = max(maxPro, prices[i] - minPrice)\nreturn maxPro", "result = 0\nINF = float('inf')\nmin_price = INF\nfor p in prices:\n min_price = min(min_pr...
<|body_start_0|> if not prices: return 0 INT_MAX = 2147483647 maxPro = 0 minPrice = INT_MAX for i in range(len(prices)): minPrice = min(minPrice, prices[i]) maxPro = max(maxPro, prices[i] - minPrice) return maxPro <|end_body_0|> <|body...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfit_self(self, prices): """:type prices: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not prices: return 0 ...
stack_v2_sparse_classes_36k_train_003866
736
no_license
[ { "docstring": ":type prices: List[int] :rtype: int", "name": "maxProfit", "signature": "def maxProfit(self, prices)" }, { "docstring": ":type prices: List[int] :rtype: int", "name": "maxProfit_self", "signature": "def maxProfit_self(self, prices)" } ]
2
stack_v2_sparse_classes_30k_train_021519
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices): :type prices: List[int] :rtype: int - def maxProfit_self(self, prices): :type prices: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices): :type prices: List[int] :rtype: int - def maxProfit_self(self, prices): :type prices: List[int] :rtype: int <|skeleton|> class Solution: def ma...
ea492ec864b50547214ecbbb2cdeeac21e70229b
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfit_self(self, prices): """:type prices: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" if not prices: return 0 INT_MAX = 2147483647 maxPro = 0 minPrice = INT_MAX for i in range(len(prices)): minPrice = min(minPrice, prices[i]) maxPr...
the_stack_v2_python_sparse
121_best_time_to_buy_and_sell_stock/sol.py
lianke123321/leetcode_sol
train
0
f4889128b9464fb50f0ede0735e8a6124924cd0a
[ "master = Tk()\nmaster.title('CsvViewer')\nmaster.geometry('1000x400')\nself.view = CSVView(master)\nself.logic = CSVLogic()\nself.view.setReadButtonCommand(self.readButtonCommand)\nmaster.mainloop()", "columns, datas = self.readCsv()\nself.view.setNewColumnAndData(columns, datas)\nself.view.setSaveButtonCommand(...
<|body_start_0|> master = Tk() master.title('CsvViewer') master.geometry('1000x400') self.view = CSVView(master) self.logic = CSVLogic() self.view.setReadButtonCommand(self.readButtonCommand) master.mainloop() <|end_body_0|> <|body_start_1|> columns, data...
csvViewerのコントローラー
CSVControl
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CSVControl: """csvViewerのコントローラー""" def __init__(self): """アプリの立ち上げとイベント登録""" <|body_0|> def readButtonCommand(self): """csv読み込みボタン用コマンド csvから取得した列名、データをViewに反映する。 csvが変更されるごとにRowDataフレームがリロードされるので、 保存ボタンコマンドも再設定""" <|body_1|> def saveButtonCommand(s...
stack_v2_sparse_classes_36k_train_003867
3,655
no_license
[ { "docstring": "アプリの立ち上げとイベント登録", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "csv読み込みボタン用コマンド csvから取得した列名、データをViewに反映する。 csvが変更されるごとにRowDataフレームがリロードされるので、 保存ボタンコマンドも再設定", "name": "readButtonCommand", "signature": "def readButtonCommand(self)" }, { "d...
4
stack_v2_sparse_classes_30k_train_007684
Implement the Python class `CSVControl` described below. Class description: csvViewerのコントローラー Method signatures and docstrings: - def __init__(self): アプリの立ち上げとイベント登録 - def readButtonCommand(self): csv読み込みボタン用コマンド csvから取得した列名、データをViewに反映する。 csvが変更されるごとにRowDataフレームがリロードされるので、 保存ボタンコマンドも再設定 - def saveButtonCommand(self)...
Implement the Python class `CSVControl` described below. Class description: csvViewerのコントローラー Method signatures and docstrings: - def __init__(self): アプリの立ち上げとイベント登録 - def readButtonCommand(self): csv読み込みボタン用コマンド csvから取得した列名、データをViewに反映する。 csvが変更されるごとにRowDataフレームがリロードされるので、 保存ボタンコマンドも再設定 - def saveButtonCommand(self)...
5c8d345ac83a908e9513ba21fc8164a3575d4ce6
<|skeleton|> class CSVControl: """csvViewerのコントローラー""" def __init__(self): """アプリの立ち上げとイベント登録""" <|body_0|> def readButtonCommand(self): """csv読み込みボタン用コマンド csvから取得した列名、データをViewに反映する。 csvが変更されるごとにRowDataフレームがリロードされるので、 保存ボタンコマンドも再設定""" <|body_1|> def saveButtonCommand(s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CSVControl: """csvViewerのコントローラー""" def __init__(self): """アプリの立ち上げとイベント登録""" master = Tk() master.title('CsvViewer') master.geometry('1000x400') self.view = CSVView(master) self.logic = CSVLogic() self.view.setReadButtonCommand(self.readButtonComma...
the_stack_v2_python_sparse
CsvViewer/csvcontrol.py
SuzuTakahiro/SampleProject
train
0
fdda69ad1936bf4ab96633eab342d3d044c13bbe
[ "self.bucket_info = bucket_info\nself.cluster_info = cluster_info\nself.name = name\nself.mtype = mtype\nself.uuid = uuid", "if dictionary is None:\n return None\nbucket_info = cohesity_management_sdk.models.couchbase_bucket.CouchbaseBucket.from_dictionary(dictionary.get('bucketInfo')) if dictionary.get('bucke...
<|body_start_0|> self.bucket_info = bucket_info self.cluster_info = cluster_info self.name = name self.mtype = mtype self.uuid = uuid <|end_body_0|> <|body_start_1|> if dictionary is None: return None bucket_info = cohesity_management_sdk.models.couch...
Implementation of the 'CouchbaseProtectionSource' model. Specifies an Object representing Couchbase. Attributes: bucket_info (CouchbaseBucket): Information of a Couchbase Bucket, only valid for an entity of type kBucket. cluster_info (CouchbaseCluster): Information of a couchbase cluster, only valid for an entity of ty...
CouchbaseProtectionSource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CouchbaseProtectionSource: """Implementation of the 'CouchbaseProtectionSource' model. Specifies an Object representing Couchbase. Attributes: bucket_info (CouchbaseBucket): Information of a Couchbase Bucket, only valid for an entity of type kBucket. cluster_info (CouchbaseCluster): Information o...
stack_v2_sparse_classes_36k_train_003868
3,036
permissive
[ { "docstring": "Constructor for the CouchbaseProtectionSource class", "name": "__init__", "signature": "def __init__(self, bucket_info=None, cluster_info=None, name=None, mtype=None, uuid=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary):...
2
stack_v2_sparse_classes_30k_train_018125
Implement the Python class `CouchbaseProtectionSource` described below. Class description: Implementation of the 'CouchbaseProtectionSource' model. Specifies an Object representing Couchbase. Attributes: bucket_info (CouchbaseBucket): Information of a Couchbase Bucket, only valid for an entity of type kBucket. cluster...
Implement the Python class `CouchbaseProtectionSource` described below. Class description: Implementation of the 'CouchbaseProtectionSource' model. Specifies an Object representing Couchbase. Attributes: bucket_info (CouchbaseBucket): Information of a Couchbase Bucket, only valid for an entity of type kBucket. cluster...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class CouchbaseProtectionSource: """Implementation of the 'CouchbaseProtectionSource' model. Specifies an Object representing Couchbase. Attributes: bucket_info (CouchbaseBucket): Information of a Couchbase Bucket, only valid for an entity of type kBucket. cluster_info (CouchbaseCluster): Information o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CouchbaseProtectionSource: """Implementation of the 'CouchbaseProtectionSource' model. Specifies an Object representing Couchbase. Attributes: bucket_info (CouchbaseBucket): Information of a Couchbase Bucket, only valid for an entity of type kBucket. cluster_info (CouchbaseCluster): Information of a couchbase...
the_stack_v2_python_sparse
cohesity_management_sdk/models/couchbase_protection_source.py
cohesity/management-sdk-python
train
24
11475faad8630a53794bddbb026a9bcedc1d8f2b
[ "data = self.get_json()\nwith self.Session() as session:\n run_id = post_observing_run(data, self.associated_user_object.id, session)\n return self.success(data={'id': run_id})", "with self.Session() as session:\n if run_id is not None:\n options = [joinedload(ObservingRun.assignments).joinedload(...
<|body_start_0|> data = self.get_json() with self.Session() as session: run_id = post_observing_run(data, self.associated_user_object.id, session) return self.success(data={'id': run_id}) <|end_body_0|> <|body_start_1|> with self.Session() as session: if run_...
ObservingRunHandler
[ "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObservingRunHandler: def post(self): """--- description: Add a new observing run tags: - observing_runs requestBody: content: application/json: schema: ObservingRunPost responses: 200: content: application/json: schema: allOf: - $ref: '#/components/schemas/Success' - type: object propert...
stack_v2_sparse_classes_36k_train_003869
8,999
permissive
[ { "docstring": "--- description: Add a new observing run tags: - observing_runs requestBody: content: application/json: schema: ObservingRunPost responses: 200: content: application/json: schema: allOf: - $ref: '#/components/schemas/Success' - type: object properties: data: type: object properties: id: type: in...
4
stack_v2_sparse_classes_30k_train_005660
Implement the Python class `ObservingRunHandler` described below. Class description: Implement the ObservingRunHandler class. Method signatures and docstrings: - def post(self): --- description: Add a new observing run tags: - observing_runs requestBody: content: application/json: schema: ObservingRunPost responses: ...
Implement the Python class `ObservingRunHandler` described below. Class description: Implement the ObservingRunHandler class. Method signatures and docstrings: - def post(self): --- description: Add a new observing run tags: - observing_runs requestBody: content: application/json: schema: ObservingRunPost responses: ...
161d3532ba3ba059446addcdac58ca96f39e9636
<|skeleton|> class ObservingRunHandler: def post(self): """--- description: Add a new observing run tags: - observing_runs requestBody: content: application/json: schema: ObservingRunPost responses: 200: content: application/json: schema: allOf: - $ref: '#/components/schemas/Success' - type: object propert...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ObservingRunHandler: def post(self): """--- description: Add a new observing run tags: - observing_runs requestBody: content: application/json: schema: ObservingRunPost responses: 200: content: application/json: schema: allOf: - $ref: '#/components/schemas/Success' - type: object properties: data: typ...
the_stack_v2_python_sparse
skyportal/handlers/api/observingrun.py
skyportal/skyportal
train
80
50f6f3c62eca747fe5faf434fc4c9a19b0b795d3
[ "if any(nums):\n from functools import cmp_to_key\n nums = sorted([str(x) for x in nums], key=cmp_to_key(lambda x, y: int(x + y) - int(y + x)), reverse=True)\n return ''.join(nums)\nreturn '0'", "def quickSort(nums):\n if not nums:\n return []\n l = quickSort([x for x in nums if int(x + nums...
<|body_start_0|> if any(nums): from functools import cmp_to_key nums = sorted([str(x) for x in nums], key=cmp_to_key(lambda x, y: int(x + y) - int(y + x)), reverse=True) return ''.join(nums) return '0' <|end_body_0|> <|body_start_1|> def quickSort(nums): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def largestNumber(self, nums): """python使用sorted的cmp_to_key参数自定义排序规则,python2可以直接用cmp参数。 :type nums: List[int] :rtype: str""" <|body_0|> def largestNumber2(self, nums): """三路快排 :type nums: List[int] :rtype: str""" <|body_1|> <|end_skeleton|> <|body...
stack_v2_sparse_classes_36k_train_003870
1,648
no_license
[ { "docstring": "python使用sorted的cmp_to_key参数自定义排序规则,python2可以直接用cmp参数。 :type nums: List[int] :rtype: str", "name": "largestNumber", "signature": "def largestNumber(self, nums)" }, { "docstring": "三路快排 :type nums: List[int] :rtype: str", "name": "largestNumber2", "signature": "def largestN...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestNumber(self, nums): python使用sorted的cmp_to_key参数自定义排序规则,python2可以直接用cmp参数。 :type nums: List[int] :rtype: str - def largestNumber2(self, nums): 三路快排 :type nums: List[int...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestNumber(self, nums): python使用sorted的cmp_to_key参数自定义排序规则,python2可以直接用cmp参数。 :type nums: List[int] :rtype: str - def largestNumber2(self, nums): 三路快排 :type nums: List[int...
5d3574ccd282d0146c83c286ae28d8baaabd4910
<|skeleton|> class Solution: def largestNumber(self, nums): """python使用sorted的cmp_to_key参数自定义排序规则,python2可以直接用cmp参数。 :type nums: List[int] :rtype: str""" <|body_0|> def largestNumber2(self, nums): """三路快排 :type nums: List[int] :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def largestNumber(self, nums): """python使用sorted的cmp_to_key参数自定义排序规则,python2可以直接用cmp参数。 :type nums: List[int] :rtype: str""" if any(nums): from functools import cmp_to_key nums = sorted([str(x) for x in nums], key=cmp_to_key(lambda x, y: int(x + y) - int(y + x...
the_stack_v2_python_sparse
179_最大数.py
lovehhf/LeetCode
train
0
29e45e41330a187e501662ae57fd30b54002cbdf
[ "super(EncoderDecoderReconstructor, self).__init__(conf, output_dim, name)\nself.encoder = encoder_factory.factory(conf)\nself.decoder = asr_decoder_factory.factory(conf, self.output_dim[0])\nself.reconstructor = reconstructor_factory.factory(conf, self.output_dim[1])", "std_input_noise = float(self.conf['std_inp...
<|body_start_0|> super(EncoderDecoderReconstructor, self).__init__(conf, output_dim, name) self.encoder = encoder_factory.factory(conf) self.decoder = asr_decoder_factory.factory(conf, self.output_dim[0]) self.reconstructor = reconstructor_factory.factory(conf, self.output_dim[1]) <|end_...
a general class for an encoder decoder reconstructor system
EncoderDecoderReconstructor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncoderDecoderReconstructor: """a general class for an encoder decoder reconstructor system""" def __init__(self, conf, output_dim, name=None): """Constructor for this kind of object Args: conf: The classifier configuration output_dim: the classifier output dimension as a tuple of th...
stack_v2_sparse_classes_36k_train_003871
4,738
permissive
[ { "docstring": "Constructor for this kind of object Args: conf: The classifier configuration output_dim: the classifier output dimension as a tuple of the dimension of the actual outputs and the dimension of the quantized reconstructed audio samples name: the classifier name", "name": "__init__", "signa...
2
stack_v2_sparse_classes_30k_train_011166
Implement the Python class `EncoderDecoderReconstructor` described below. Class description: a general class for an encoder decoder reconstructor system Method signatures and docstrings: - def __init__(self, conf, output_dim, name=None): Constructor for this kind of object Args: conf: The classifier configuration out...
Implement the Python class `EncoderDecoderReconstructor` described below. Class description: a general class for an encoder decoder reconstructor system Method signatures and docstrings: - def __init__(self, conf, output_dim, name=None): Constructor for this kind of object Args: conf: The classifier configuration out...
09586e57bf4c6d29a6679e9bb3a488e09451f08e
<|skeleton|> class EncoderDecoderReconstructor: """a general class for an encoder decoder reconstructor system""" def __init__(self, conf, output_dim, name=None): """Constructor for this kind of object Args: conf: The classifier configuration output_dim: the classifier output dimension as a tuple of th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EncoderDecoderReconstructor: """a general class for an encoder decoder reconstructor system""" def __init__(self, conf, output_dim, name=None): """Constructor for this kind of object Args: conf: The classifier configuration output_dim: the classifier output dimension as a tuple of the dimension o...
the_stack_v2_python_sparse
nabu/neuralnetworks/classifiers/asr/encoder_decoder_reconstructor.py
chenxinglili/nabu
train
0
e642a4f58a4ce4b28524aa4b0a6ca77da752a42d
[ "try:\n import annoy\nexcept ImportError:\n raise ValueError('Using `AnnoyNearestNeighbors` requires installing the annoy module. If pip is installed, this can be done with `pip install --user annoy`.')\nself.num_trees = num_trees", "import annoy\ndata = data.view((len(data), -1))\nprojection_dim = data.sha...
<|body_start_0|> try: import annoy except ImportError: raise ValueError('Using `AnnoyNearestNeighbors` requires installing the annoy module. If pip is installed, this can be done with `pip install --user annoy`.') self.num_trees = num_trees <|end_body_0|> <|body_start_1|...
This is an implementation of `NearestNeighbors` that uses the Annoy module. At a high level, Annoy finds nearest neighbors by constructing binary trees in which vectors reside at leaf nodes. Vectors near each other will tend to be in the same leaf node. See https://tinyurl.com/2p89sb2h and https://github.com/spotify/an...
AnnoyNearestNeighbors
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnnoyNearestNeighbors: """This is an implementation of `NearestNeighbors` that uses the Annoy module. At a high level, Annoy finds nearest neighbors by constructing binary trees in which vectors reside at leaf nodes. Vectors near each other will tend to be in the same leaf node. See https://tinyu...
stack_v2_sparse_classes_36k_train_003872
10,067
permissive
[ { "docstring": "Args: num_trees (int): The number of trees to use. Increasing this number gives more accurate computation of nearest neighbors, but requires longer setup time to create the trees, as well as memory.", "name": "__init__", "signature": "def __init__(self, num_trees: int=10) -> None" }, ...
3
null
Implement the Python class `AnnoyNearestNeighbors` described below. Class description: This is an implementation of `NearestNeighbors` that uses the Annoy module. At a high level, Annoy finds nearest neighbors by constructing binary trees in which vectors reside at leaf nodes. Vectors near each other will tend to be i...
Implement the Python class `AnnoyNearestNeighbors` described below. Class description: This is an implementation of `NearestNeighbors` that uses the Annoy module. At a high level, Annoy finds nearest neighbors by constructing binary trees in which vectors reside at leaf nodes. Vectors near each other will tend to be i...
945c582cc0b08885c4e2bfecb020abdfac0122f3
<|skeleton|> class AnnoyNearestNeighbors: """This is an implementation of `NearestNeighbors` that uses the Annoy module. At a high level, Annoy finds nearest neighbors by constructing binary trees in which vectors reside at leaf nodes. Vectors near each other will tend to be in the same leaf node. See https://tinyu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AnnoyNearestNeighbors: """This is an implementation of `NearestNeighbors` that uses the Annoy module. At a high level, Annoy finds nearest neighbors by constructing binary trees in which vectors reside at leaf nodes. Vectors near each other will tend to be in the same leaf node. See https://tinyurl.com/2p89sb...
the_stack_v2_python_sparse
captum/influence/_utils/nearest_neighbors.py
pytorch/captum
train
4,230
7199bee165bcb0a6ae55af40f28adaf8bc0bd30b
[ "current_app.logger.info('<Transaction.post')\nrequest_json = request.get_json()\nvalid_format, errors = schema_utils.validate(request_json, 'transaction_request')\nif not valid_format:\n return error_to_response(Error.INVALID_REQUEST, invalid_params=schema_utils.serialize(errors))\ntry:\n if invoice_id:\n ...
<|body_start_0|> current_app.logger.info('<Transaction.post') request_json = request.get_json() valid_format, errors = schema_utils.validate(request_json, 'transaction_request') if not valid_format: return error_to_response(Error.INVALID_REQUEST, invalid_params=schema_utils.s...
Endpoint resource to create transaction.
Transaction
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Transaction: """Endpoint resource to create transaction.""" def post(invoice_id: int=None, payment_id: int=None): """Create the Transaction records.""" <|body_0|> def get(invoice_id): """Get all transaction records for a invoice.""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_36k_train_003873
4,955
permissive
[ { "docstring": "Create the Transaction records.", "name": "post", "signature": "def post(invoice_id: int=None, payment_id: int=None)" }, { "docstring": "Get all transaction records for a invoice.", "name": "get", "signature": "def get(invoice_id)" } ]
2
null
Implement the Python class `Transaction` described below. Class description: Endpoint resource to create transaction. Method signatures and docstrings: - def post(invoice_id: int=None, payment_id: int=None): Create the Transaction records. - def get(invoice_id): Get all transaction records for a invoice.
Implement the Python class `Transaction` described below. Class description: Endpoint resource to create transaction. Method signatures and docstrings: - def post(invoice_id: int=None, payment_id: int=None): Create the Transaction records. - def get(invoice_id): Get all transaction records for a invoice. <|skeleton|...
0d71d37b0e08d11f6b6d9f59a4b202dfabc98fc1
<|skeleton|> class Transaction: """Endpoint resource to create transaction.""" def post(invoice_id: int=None, payment_id: int=None): """Create the Transaction records.""" <|body_0|> def get(invoice_id): """Get all transaction records for a invoice.""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Transaction: """Endpoint resource to create transaction.""" def post(invoice_id: int=None, payment_id: int=None): """Create the Transaction records.""" current_app.logger.info('<Transaction.post') request_json = request.get_json() valid_format, errors = schema_utils.valida...
the_stack_v2_python_sparse
pay-api/src/pay_api/resources/transaction.py
bcgov/sbc-pay
train
6
96e55455c6562b5899bcb84444ae5e1c1984f772
[ "job = get_object_or_404(models.ImportJob, id=job_id)\nif job.user != request.user:\n raise PermissionDenied()\nitems = job.items.order_by('index')\nitem_count = items.count() or 1\npaginated = Paginator(items, PAGE_LENGTH)\npage = paginated.get_page(request.GET.get('page'))\nmanual_review_count = items.filter(f...
<|body_start_0|> job = get_object_or_404(models.ImportJob, id=job_id) if job.user != request.user: raise PermissionDenied() items = job.items.order_by('index') item_count = items.count() or 1 paginated = Paginator(items, PAGE_LENGTH) page = paginated.get_page(...
status of an existing import
ImportStatus
[ "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImportStatus: """status of an existing import""" def get(self, request, job_id): """status of an import job""" <|body_0|> def post(self, request, job_id): """bring a legacy import into the latest format""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_003874
3,101
no_license
[ { "docstring": "status of an import job", "name": "get", "signature": "def get(self, request, job_id)" }, { "docstring": "bring a legacy import into the latest format", "name": "post", "signature": "def post(self, request, job_id)" } ]
2
null
Implement the Python class `ImportStatus` described below. Class description: status of an existing import Method signatures and docstrings: - def get(self, request, job_id): status of an import job - def post(self, request, job_id): bring a legacy import into the latest format
Implement the Python class `ImportStatus` described below. Class description: status of an existing import Method signatures and docstrings: - def get(self, request, job_id): status of an import job - def post(self, request, job_id): bring a legacy import into the latest format <|skeleton|> class ImportStatus: "...
0f8da5b738047f3c34d60d93f59bdedd8f797224
<|skeleton|> class ImportStatus: """status of an existing import""" def get(self, request, job_id): """status of an import job""" <|body_0|> def post(self, request, job_id): """bring a legacy import into the latest format""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImportStatus: """status of an existing import""" def get(self, request, job_id): """status of an import job""" job = get_object_or_404(models.ImportJob, id=job_id) if job.user != request.user: raise PermissionDenied() items = job.items.order_by('index') ...
the_stack_v2_python_sparse
bookwyrm/views/imports/import_status.py
bookwyrm-social/bookwyrm
train
1,398
e446bed81a01a6377b4e128dec58edb1ee8b71e1
[ "filename = self._input_filename = self.getTmpFilename(self.WorkingDir)\ndata_file = open(filename, 'w')\ndata_to_file = '\\n'.join([str(d).strip('\\n') for d in data])\ndata_file.write(data_to_file)\ndata_file.write('\\n')\ndata_file.close()\nself.Parameters['-i'].on(filename)\nreturn ''", "if data:\n self.Pa...
<|body_start_0|> filename = self._input_filename = self.getTmpFilename(self.WorkingDir) data_file = open(filename, 'w') data_to_file = '\n'.join([str(d).strip('\n') for d in data]) data_file.write(data_to_file) data_file.write('\n') data_file.close() self.Paramete...
Application controller for Knetfold v1.4.4b application
Knetfold
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Knetfold: """Application controller for Knetfold v1.4.4b application""" def _input_as_lines(self, data): """Infile needs to be set with parameter -i""" <|body_0|> def _input_as_string(self, data): """Makes data the value of a specific parameter This method return...
stack_v2_sparse_classes_36k_train_003875
3,585
permissive
[ { "docstring": "Infile needs to be set with parameter -i", "name": "_input_as_lines", "signature": "def _input_as_lines(self, data)" }, { "docstring": "Makes data the value of a specific parameter This method returns the empty string. The parameter will be printed automatically once set.", "...
3
null
Implement the Python class `Knetfold` described below. Class description: Application controller for Knetfold v1.4.4b application Method signatures and docstrings: - def _input_as_lines(self, data): Infile needs to be set with parameter -i - def _input_as_string(self, data): Makes data the value of a specific paramet...
Implement the Python class `Knetfold` described below. Class description: Application controller for Knetfold v1.4.4b application Method signatures and docstrings: - def _input_as_lines(self, data): Infile needs to be set with parameter -i - def _input_as_string(self, data): Makes data the value of a specific paramet...
fe6f8c8dfed86d39c80f2804a753c05bb2e485b4
<|skeleton|> class Knetfold: """Application controller for Knetfold v1.4.4b application""" def _input_as_lines(self, data): """Infile needs to be set with parameter -i""" <|body_0|> def _input_as_string(self, data): """Makes data the value of a specific parameter This method return...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Knetfold: """Application controller for Knetfold v1.4.4b application""" def _input_as_lines(self, data): """Infile needs to be set with parameter -i""" filename = self._input_filename = self.getTmpFilename(self.WorkingDir) data_file = open(filename, 'w') data_to_file = '\n...
the_stack_v2_python_sparse
scripts/venv/lib/python2.7/site-packages/cogent/app/knetfold.py
sauloal/cnidaria
train
3
b2c7cb2e3a39b0ca119793252a8961784f4e3dfe
[ "serialazer = EmailAuthSerialazer(data=request.data)\nserialazer.is_valid(raise_exception=True)\nif serialazer.validated_data['password'] != request.user.password:\n return Response({'status': 'неправильный пароль'})\nserialazer.email_auth(validated_data=serialazer.validated_data, request=request)\nreturn Respon...
<|body_start_0|> serialazer = EmailAuthSerialazer(data=request.data) serialazer.is_valid(raise_exception=True) if serialazer.validated_data['password'] != request.user.password: return Response({'status': 'неправильный пароль'}) serialazer.email_auth(validated_data=serialazer...
EmailAuth
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmailAuth: def create(self, request): """При введении пароля пользователя и email отправляет сообщение на email""" <|body_0|> def get(self, request): """Принимает запрос и привязывает email при совпадении ключей""" <|body_1|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_36k_train_003876
1,409
no_license
[ { "docstring": "При введении пароля пользователя и email отправляет сообщение на email", "name": "create", "signature": "def create(self, request)" }, { "docstring": "Принимает запрос и привязывает email при совпадении ключей", "name": "get", "signature": "def get(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_018543
Implement the Python class `EmailAuth` described below. Class description: Implement the EmailAuth class. Method signatures and docstrings: - def create(self, request): При введении пароля пользователя и email отправляет сообщение на email - def get(self, request): Принимает запрос и привязывает email при совпадении ...
Implement the Python class `EmailAuth` described below. Class description: Implement the EmailAuth class. Method signatures and docstrings: - def create(self, request): При введении пароля пользователя и email отправляет сообщение на email - def get(self, request): Принимает запрос и привязывает email при совпадении ...
124ca4b088329c7539e43d25b639a68f925bdf4c
<|skeleton|> class EmailAuth: def create(self, request): """При введении пароля пользователя и email отправляет сообщение на email""" <|body_0|> def get(self, request): """Принимает запрос и привязывает email при совпадении ключей""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EmailAuth: def create(self, request): """При введении пароля пользователя и email отправляет сообщение на email""" serialazer = EmailAuthSerialazer(data=request.data) serialazer.is_valid(raise_exception=True) if serialazer.validated_data['password'] != request.user.password: ...
the_stack_v2_python_sparse
users/views/email_auth.py
aobcvr/Petfinder
train
0
4eb0def291095514d2f87e39a39345fa87b0d8c3
[ "super().__init__(config, {})\nself.save_memory()\nself.fc_projector = nn.Sequential(nn.Linear(512, 128), nn.ReLU(), nn.Linear(128, 128))", "embeddings = torch.cat((self.fc_subject(subj_embs), self.fc_object(obj_embs)), dim=1)\nfeatures = self.fc_projector(embeddings)\nclassifiers = self.get_classifiers(subj_embs...
<|body_start_0|> super().__init__(config, {}) self.save_memory() self.fc_projector = nn.Sequential(nn.Linear(512, 128), nn.ReLU(), nn.Linear(128, 128)) <|end_body_0|> <|body_start_1|> embeddings = torch.cat((self.fc_subject(subj_embs), self.fc_object(obj_embs)), dim=1) features ...
Extends PyTorch nn.Module.
LanguageProjector
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LanguageProjector: """Extends PyTorch nn.Module.""" def __init__(self, config): """Initialize layers.""" <|body_0|> def _forward(self, subj_embs, obj_embs): """Forward pass, returns output scores.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_003877
1,246
no_license
[ { "docstring": "Initialize layers.", "name": "__init__", "signature": "def __init__(self, config)" }, { "docstring": "Forward pass, returns output scores.", "name": "_forward", "signature": "def _forward(self, subj_embs, obj_embs)" } ]
2
null
Implement the Python class `LanguageProjector` described below. Class description: Extends PyTorch nn.Module. Method signatures and docstrings: - def __init__(self, config): Initialize layers. - def _forward(self, subj_embs, obj_embs): Forward pass, returns output scores.
Implement the Python class `LanguageProjector` described below. Class description: Extends PyTorch nn.Module. Method signatures and docstrings: - def __init__(self, config): Initialize layers. - def _forward(self, subj_embs, obj_embs): Forward pass, returns output scores. <|skeleton|> class LanguageProjector: ""...
810c79541a8584de3fe37943d244af366d361689
<|skeleton|> class LanguageProjector: """Extends PyTorch nn.Module.""" def __init__(self, config): """Initialize layers.""" <|body_0|> def _forward(self, subj_embs, obj_embs): """Forward pass, returns output scores.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LanguageProjector: """Extends PyTorch nn.Module.""" def __init__(self, config): """Initialize layers.""" super().__init__(config, {}) self.save_memory() self.fc_projector = nn.Sequential(nn.Linear(512, 128), nn.ReLU(), nn.Linear(128, 128)) def _forward(self, subj_embs...
the_stack_v2_python_sparse
common/models/sg_projector/language_projector.py
bgzu/zs-vrd-bmvc20
train
0
fef7a5bb5d2dc68d2b30e988409be8e327ebb812
[ "farm.launch()\nnode = discovery.run_server_in_cloud(cloud)\nlocation = CONF.feature.platform.location\ninstance_id = node.id\nif CONF.feature.platform.is_gce:\n location = node.extra['zone'].name\n instance_id = node.name\nrole_id = IMPL.discovery_manager.get_system_role_id(node.cloud._name, location, CONF.f...
<|body_start_0|> farm.launch() node = discovery.run_server_in_cloud(cloud) location = CONF.feature.platform.location instance_id = node.id if CONF.feature.platform.is_gce: location = node.extra['zone'].name instance_id = node.name role_id = IMPL.di...
TestDiscoveryManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestDiscoveryManager: def test_import_server(self, context: dict, cloud: Cloud, farm: Farm): """Import cloud server to Scalr""" <|body_0|> def test_deploy_agent(self, context: dict, cloud: Cloud, farm: Farm): """Deploy Agent to imported server""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_003878
2,557
no_license
[ { "docstring": "Import cloud server to Scalr", "name": "test_import_server", "signature": "def test_import_server(self, context: dict, cloud: Cloud, farm: Farm)" }, { "docstring": "Deploy Agent to imported server", "name": "test_deploy_agent", "signature": "def test_deploy_agent(self, co...
2
stack_v2_sparse_classes_30k_train_021457
Implement the Python class `TestDiscoveryManager` described below. Class description: Implement the TestDiscoveryManager class. Method signatures and docstrings: - def test_import_server(self, context: dict, cloud: Cloud, farm: Farm): Import cloud server to Scalr - def test_deploy_agent(self, context: dict, cloud: Cl...
Implement the Python class `TestDiscoveryManager` described below. Class description: Implement the TestDiscoveryManager class. Method signatures and docstrings: - def test_import_server(self, context: dict, cloud: Cloud, farm: Farm): Import cloud server to Scalr - def test_deploy_agent(self, context: dict, cloud: Cl...
87b212e5b35a328b0a3c4d502847989a4d4fd897
<|skeleton|> class TestDiscoveryManager: def test_import_server(self, context: dict, cloud: Cloud, farm: Farm): """Import cloud server to Scalr""" <|body_0|> def test_deploy_agent(self, context: dict, cloud: Cloud, farm: Farm): """Deploy Agent to imported server""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestDiscoveryManager: def test_import_server(self, context: dict, cloud: Cloud, farm: Farm): """Import cloud server to Scalr""" farm.launch() node = discovery.run_server_in_cloud(cloud) location = CONF.feature.platform.location instance_id = node.id if CONF.feat...
the_stack_v2_python_sparse
scalarizr/lifecycle/test_discovery_manager.py
Scalr/revizor-tests
train
0
a6343d35f35e0f2342d4f3e8d28dbe6aa407c43c
[ "if not root:\n return True\nqueue = [root]\nwhile queue:\n num_nodes = len(queue)\n vals = []\n for i in range(num_nodes):\n node = queue.pop(0)\n if node.left:\n queue.append(node.left)\n vals.append(node.left.val)\n else:\n vals.append(None)\n ...
<|body_start_0|> if not root: return True queue = [root] while queue: num_nodes = len(queue) vals = [] for i in range(num_nodes): node = queue.pop(0) if node.left: queue.append(node.left) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isSymmetric_v1(self, root: TreeNode) -> bool: """Iterative bread-first search.""" <|body_0|> def isSymmetric_v2(self, root: TreeNode) -> bool: """Bread-first search with recurssion.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if no...
stack_v2_sparse_classes_36k_train_003879
3,138
no_license
[ { "docstring": "Iterative bread-first search.", "name": "isSymmetric_v1", "signature": "def isSymmetric_v1(self, root: TreeNode) -> bool" }, { "docstring": "Bread-first search with recurssion.", "name": "isSymmetric_v2", "signature": "def isSymmetric_v2(self, root: TreeNode) -> bool" }...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isSymmetric_v1(self, root: TreeNode) -> bool: Iterative bread-first search. - def isSymmetric_v2(self, root: TreeNode) -> bool: Bread-first search with recurssion.
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isSymmetric_v1(self, root: TreeNode) -> bool: Iterative bread-first search. - def isSymmetric_v2(self, root: TreeNode) -> bool: Bread-first search with recurssion. <|skeleto...
97a2386f5e3adbd7138fd123810c3232bdf7f622
<|skeleton|> class Solution: def isSymmetric_v1(self, root: TreeNode) -> bool: """Iterative bread-first search.""" <|body_0|> def isSymmetric_v2(self, root: TreeNode) -> bool: """Bread-first search with recurssion.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isSymmetric_v1(self, root: TreeNode) -> bool: """Iterative bread-first search.""" if not root: return True queue = [root] while queue: num_nodes = len(queue) vals = [] for i in range(num_nodes): node ...
the_stack_v2_python_sparse
python3/trees_and_graphs/symmetric_tree.py
victorchu/algorithms
train
0
9d5ee497391326c719306c3c4c0c02b16c544220
[ "try:\n datatable_server_processing = query_super_users_by_args(request, **request.query_params)\n serializer = StaffDataTableSerializer(datatable_server_processing['items'], many=True)\n result = dict()\n result['data'] = serializer.data\n result['draw'] = datatable_server_processing['draw']\n re...
<|body_start_0|> try: datatable_server_processing = query_super_users_by_args(request, **request.query_params) serializer = StaffDataTableSerializer(datatable_server_processing['items'], many=True) result = dict() result['data'] = serializer.data resul...
SuperUserView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SuperUserView: def get(self, request): """Get all staff users""" <|body_0|> def post(self, request): """Create staff""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: datatable_server_processing = query_super_users_by_args(request, **...
stack_v2_sparse_classes_36k_train_003880
7,575
no_license
[ { "docstring": "Get all staff users", "name": "get", "signature": "def get(self, request)" }, { "docstring": "Create staff", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_014797
Implement the Python class `SuperUserView` described below. Class description: Implement the SuperUserView class. Method signatures and docstrings: - def get(self, request): Get all staff users - def post(self, request): Create staff
Implement the Python class `SuperUserView` described below. Class description: Implement the SuperUserView class. Method signatures and docstrings: - def get(self, request): Get all staff users - def post(self, request): Create staff <|skeleton|> class SuperUserView: def get(self, request): """Get all s...
367cccca72f0eae6c3ccb70fabb371dc905f915e
<|skeleton|> class SuperUserView: def get(self, request): """Get all staff users""" <|body_0|> def post(self, request): """Create staff""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SuperUserView: def get(self, request): """Get all staff users""" try: datatable_server_processing = query_super_users_by_args(request, **request.query_params) serializer = StaffDataTableSerializer(datatable_server_processing['items'], many=True) result = dic...
the_stack_v2_python_sparse
staff/views/sup_user_view.py
vshaladhav97/first_kick
train
0
4c33e26c7ee7c6df32fec96b2742115bd6ab2c53
[ "source = 'balloon'\nself.add_class(source, 1, 'balloon')\nassert subset in ['train', 'val']\nimage_dir = os.path.join(dataset_dir, subset, 'images')\nanno_dir = os.path.join(dataset_dir, subset, 'annotations')\nimage_list = os.listdir(image_dir)\nimage_names = []\nfor img in image_list:\n image_names.append(img...
<|body_start_0|> source = 'balloon' self.add_class(source, 1, 'balloon') assert subset in ['train', 'val'] image_dir = os.path.join(dataset_dir, subset, 'images') anno_dir = os.path.join(dataset_dir, subset, 'annotations') image_list = os.listdir(image_dir) image_...
MyDataSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyDataSet: def load_balloon(self, dataset_dir, subset): """Load a subset of the Balloon dataset. dataset_dir: Root directory of the dataset. subset: Subset to load: train or val""" <|body_0|> def load_mask(self, image_id): """Generate instance masks for an image. ind...
stack_v2_sparse_classes_36k_train_003881
3,634
no_license
[ { "docstring": "Load a subset of the Balloon dataset. dataset_dir: Root directory of the dataset. subset: Subset to load: train or val", "name": "load_balloon", "signature": "def load_balloon(self, dataset_dir, subset)" }, { "docstring": "Generate instance masks for an image. index for id in the...
2
stack_v2_sparse_classes_30k_train_009805
Implement the Python class `MyDataSet` described below. Class description: Implement the MyDataSet class. Method signatures and docstrings: - def load_balloon(self, dataset_dir, subset): Load a subset of the Balloon dataset. dataset_dir: Root directory of the dataset. subset: Subset to load: train or val - def load_m...
Implement the Python class `MyDataSet` described below. Class description: Implement the MyDataSet class. Method signatures and docstrings: - def load_balloon(self, dataset_dir, subset): Load a subset of the Balloon dataset. dataset_dir: Root directory of the dataset. subset: Subset to load: train or val - def load_m...
19143afb18b16122bc92e224b8bb601e23efd2e0
<|skeleton|> class MyDataSet: def load_balloon(self, dataset_dir, subset): """Load a subset of the Balloon dataset. dataset_dir: Root directory of the dataset. subset: Subset to load: train or val""" <|body_0|> def load_mask(self, image_id): """Generate instance masks for an image. ind...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MyDataSet: def load_balloon(self, dataset_dir, subset): """Load a subset of the Balloon dataset. dataset_dir: Root directory of the dataset. subset: Subset to load: train or val""" source = 'balloon' self.add_class(source, 1, 'balloon') assert subset in ['train', 'val'] ...
the_stack_v2_python_sparse
datasets/my_dataset.py
Sparknzz/mrcnn_tf2.0
train
0
845f88e7a84aaa52a676c0e94fbde2b43b1cbfab
[ "super(GCN, self).__init__()\nself.W = torch.nn.Linear(n_input, n_hidden, bias=False)\nself.activation = torch.nn.PReLU()\ntorch.nn.init.xavier_uniform_(self.W.weight.data)", "X_THETA = self.W(input_arr)\nX_THETA = torch.squeeze(X_THETA)\ngcn_result = torch.mm(A_hat, X_THETA)\nreturn self.activation(gcn_result)" ...
<|body_start_0|> super(GCN, self).__init__() self.W = torch.nn.Linear(n_input, n_hidden, bias=False) self.activation = torch.nn.PReLU() torch.nn.init.xavier_uniform_(self.W.weight.data) <|end_body_0|> <|body_start_1|> X_THETA = self.W(input_arr) X_THETA = torch.squeeze(X...
GCN
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GCN: def __init__(self, n_input, n_hidden): """:param n_input: 1433 :param n_hidden: 512""" <|body_0|> def forward(self, input_arr, A_hat, n_node): """:param input_arr: 1 X Node X Features :return patch representation, # Node X # Hidden layer""" <|body_1|> <...
stack_v2_sparse_classes_36k_train_003882
738
no_license
[ { "docstring": ":param n_input: 1433 :param n_hidden: 512", "name": "__init__", "signature": "def __init__(self, n_input, n_hidden)" }, { "docstring": ":param input_arr: 1 X Node X Features :return patch representation, # Node X # Hidden layer", "name": "forward", "signature": "def forwa...
2
stack_v2_sparse_classes_30k_train_014906
Implement the Python class `GCN` described below. Class description: Implement the GCN class. Method signatures and docstrings: - def __init__(self, n_input, n_hidden): :param n_input: 1433 :param n_hidden: 512 - def forward(self, input_arr, A_hat, n_node): :param input_arr: 1 X Node X Features :return patch represen...
Implement the Python class `GCN` described below. Class description: Implement the GCN class. Method signatures and docstrings: - def __init__(self, n_input, n_hidden): :param n_input: 1433 :param n_hidden: 512 - def forward(self, input_arr, A_hat, n_node): :param input_arr: 1 X Node X Features :return patch represen...
9396979f69d17c80f02c0069a9d7e9a317294136
<|skeleton|> class GCN: def __init__(self, n_input, n_hidden): """:param n_input: 1433 :param n_hidden: 512""" <|body_0|> def forward(self, input_arr, A_hat, n_node): """:param input_arr: 1 X Node X Features :return patch representation, # Node X # Hidden layer""" <|body_1|> <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GCN: def __init__(self, n_input, n_hidden): """:param n_input: 1433 :param n_hidden: 512""" super(GCN, self).__init__() self.W = torch.nn.Linear(n_input, n_hidden, bias=False) self.activation = torch.nn.PReLU() torch.nn.init.xavier_uniform_(self.W.weight.data) def ...
the_stack_v2_python_sparse
Graph/DGI/GCN.py
rlqja1107/Recommender_System
train
1
7e03eef5ac2d06e4b25b98ecdeca770a61411876
[ "public = optometre_public_page.OptometrePublicPage(self.driver)\npublic.to_sale_order()\ntime.sleep(1)\nself.click(self.another_bill_button)\ntime.sleep(1)\nself.click(self.add_pro)\ntime.sleep(2)\nself.click(self.custom_made_goods)\ntime.sleep(3)\nself.click(self.choose)\ntime.sleep(2)\nself.click(self.sure)\ntim...
<|body_start_0|> public = optometre_public_page.OptometrePublicPage(self.driver) public.to_sale_order() time.sleep(1) self.click(self.another_bill_button) time.sleep(1) self.click(self.add_pro) time.sleep(2) self.click(self.custom_made_goods) time....
视光销售页面相关元素
SalesOrderPage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SalesOrderPage: """视光销售页面相关元素""" def another_bill(self): """再开一单""" <|body_0|> def submi_bill(self): """提交订单""" <|body_1|> def choose_discount(self): """再开一单--选择优惠券""" <|body_2|> def bill_amount_wrong(self): """再开一单--订单金额...
stack_v2_sparse_classes_36k_train_003883
4,860
no_license
[ { "docstring": "再开一单", "name": "another_bill", "signature": "def another_bill(self)" }, { "docstring": "提交订单", "name": "submi_bill", "signature": "def submi_bill(self)" }, { "docstring": "再开一单--选择优惠券", "name": "choose_discount", "signature": "def choose_discount(self)" ...
5
stack_v2_sparse_classes_30k_train_011614
Implement the Python class `SalesOrderPage` described below. Class description: 视光销售页面相关元素 Method signatures and docstrings: - def another_bill(self): 再开一单 - def submi_bill(self): 提交订单 - def choose_discount(self): 再开一单--选择优惠券 - def bill_amount_wrong(self): 再开一单--订单金额不能为0 - def replace_prescription(self): 更换处方
Implement the Python class `SalesOrderPage` described below. Class description: 视光销售页面相关元素 Method signatures and docstrings: - def another_bill(self): 再开一单 - def submi_bill(self): 提交订单 - def choose_discount(self): 再开一单--选择优惠券 - def bill_amount_wrong(self): 再开一单--订单金额不能为0 - def replace_prescription(self): 更换处方 <|skel...
8616e6a320462747006a8ed9a7066e367660a7c5
<|skeleton|> class SalesOrderPage: """视光销售页面相关元素""" def another_bill(self): """再开一单""" <|body_0|> def submi_bill(self): """提交订单""" <|body_1|> def choose_discount(self): """再开一单--选择优惠券""" <|body_2|> def bill_amount_wrong(self): """再开一单--订单金额...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SalesOrderPage: """视光销售页面相关元素""" def another_bill(self): """再开一单""" public = optometre_public_page.OptometrePublicPage(self.driver) public.to_sale_order() time.sleep(1) self.click(self.another_bill_button) time.sleep(1) self.click(self.add_pro) ...
the_stack_v2_python_sparse
uitest/pages/optometry/sale_management/sales_order_page.py
QWJ77/big
train
0
d84822256e6e6a6bc84abe09278c9ec38b38fb8d
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')" ]
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Missing associated documentation comment in .proto file.
AuthzAppServiceServicer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuthzAppServiceServicer: """Missing associated documentation comment in .proto file.""" def is_allowed(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def hash_keys(self, request, context): """Missing associated ...
stack_v2_sparse_classes_36k_train_003884
4,577
no_license
[ { "docstring": "Missing associated documentation comment in .proto file.", "name": "is_allowed", "signature": "def is_allowed(self, request, context)" }, { "docstring": "Missing associated documentation comment in .proto file.", "name": "hash_keys", "signature": "def hash_keys(self, requ...
2
null
Implement the Python class `AuthzAppServiceServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def is_allowed(self, request, context): Missing associated documentation comment in .proto file. - def hash_keys(self, request, context)...
Implement the Python class `AuthzAppServiceServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def is_allowed(self, request, context): Missing associated documentation comment in .proto file. - def hash_keys(self, request, context)...
55d36c068e26e13ee5bae5c033e2e17784c63feb
<|skeleton|> class AuthzAppServiceServicer: """Missing associated documentation comment in .proto file.""" def is_allowed(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def hash_keys(self, request, context): """Missing associated ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AuthzAppServiceServicer: """Missing associated documentation comment in .proto file.""" def is_allowed(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemente...
the_stack_v2_python_sparse
src/resource/proto/_generated/identity/authz_app_service_pb2_grpc.py
arkanmgerges/cafm.identity
train
0
abadff1a2a56eb06f28f63634569d01455d0dd32
[ "def height(root):\n \"\"\"Return height of the tree if the tree is height-balanced,\n -1 if the tree is not height-balanced\"\"\"\n if not root:\n return 0\n left_height = height(root.left)\n if left_height == -1:\n return -1\n right_height = height(root.right)\n if right...
<|body_start_0|> def height(root): """Return height of the tree if the tree is height-balanced, -1 if the tree is not height-balanced""" if not root: return 0 left_height = height(root.left) if left_height == -1: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isBalanced(self, root): """Bottom up approach, O(n) :type root: TreeNode :rtype: bool""" <|body_0|> def isBalanced1(self, root): """Top down approach, O(n^2)""" <|body_1|> <|end_skeleton|> <|body_start_0|> def height(root): ...
stack_v2_sparse_classes_36k_train_003885
1,840
no_license
[ { "docstring": "Bottom up approach, O(n) :type root: TreeNode :rtype: bool", "name": "isBalanced", "signature": "def isBalanced(self, root)" }, { "docstring": "Top down approach, O(n^2)", "name": "isBalanced1", "signature": "def isBalanced1(self, root)" } ]
2
stack_v2_sparse_classes_30k_test_001021
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isBalanced(self, root): Bottom up approach, O(n) :type root: TreeNode :rtype: bool - def isBalanced1(self, root): Top down approach, O(n^2)
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isBalanced(self, root): Bottom up approach, O(n) :type root: TreeNode :rtype: bool - def isBalanced1(self, root): Top down approach, O(n^2) <|skeleton|> class Solution: ...
b18786c06417a2781662805a7e0e984ee7fa5240
<|skeleton|> class Solution: def isBalanced(self, root): """Bottom up approach, O(n) :type root: TreeNode :rtype: bool""" <|body_0|> def isBalanced1(self, root): """Top down approach, O(n^2)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isBalanced(self, root): """Bottom up approach, O(n) :type root: TreeNode :rtype: bool""" def height(root): """Return height of the tree if the tree is height-balanced, -1 if the tree is not height-balanced""" if not root: ...
the_stack_v2_python_sparse
data_structures/110. Balanced Binary Tree.py
YuriiPaziuk/leetcode
train
0
c188c7d5519946c0894cc0465caf51a6f79290c6
[ "self.n_points = n_points\nself.invert_cmap = invert_cmap\nself.xlim = (None, None)\nself.ylim = (None, None)\ndefault_bokeh_opts = {'height': 350, 'width': 400, 'tools': ['hover'], 'shared_axes': False}\ndefault_mpl_opts = {}\nmpl_opts, bokeh_opts = self.update_default_opts(default_mpl_opts, mpl_opts, default_boke...
<|body_start_0|> self.n_points = n_points self.invert_cmap = invert_cmap self.xlim = (None, None) self.ylim = (None, None) default_bokeh_opts = {'height': 350, 'width': 400, 'tools': ['hover'], 'shared_axes': False} default_mpl_opts = {} mpl_opts, bokeh_opts = sel...
Plots the interpolated landscaped of values of a set of points. The data is visualized creating a :class:`holoviews.QuadMesh` with a :class:`holoviews.Contours` plot with the original data points displayed as a :class:`holoviews.Scatter`.
Landscape2D
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Landscape2D: """Plots the interpolated landscaped of values of a set of points. The data is visualized creating a :class:`holoviews.QuadMesh` with a :class:`holoviews.Contours` plot with the original data points displayed as a :class:`holoviews.Scatter`.""" def __init__(self, n_points: int=5...
stack_v2_sparse_classes_36k_train_003886
22,669
permissive
[ { "docstring": "Initialize a :class:`Landscape2d`. Args: n_points: Number of points per dimension used to create the meshgrid grid that will be used to interpolate the data. data: Initial data for the plot. bokeh_opts: Default options for the plot when rendered using the \"bokeh\" backend. mpl_opts: Default opt...
4
stack_v2_sparse_classes_30k_train_004669
Implement the Python class `Landscape2D` described below. Class description: Plots the interpolated landscaped of values of a set of points. The data is visualized creating a :class:`holoviews.QuadMesh` with a :class:`holoviews.Contours` plot with the original data points displayed as a :class:`holoviews.Scatter`. Me...
Implement the Python class `Landscape2D` described below. Class description: Plots the interpolated landscaped of values of a set of points. The data is visualized creating a :class:`holoviews.QuadMesh` with a :class:`holoviews.Contours` plot with the original data points displayed as a :class:`holoviews.Scatter`. Me...
5e69c50e5b220859d65406d803086406b50a8e78
<|skeleton|> class Landscape2D: """Plots the interpolated landscaped of values of a set of points. The data is visualized creating a :class:`holoviews.QuadMesh` with a :class:`holoviews.Contours` plot with the original data points displayed as a :class:`holoviews.Scatter`.""" def __init__(self, n_points: int=5...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Landscape2D: """Plots the interpolated landscaped of values of a set of points. The data is visualized creating a :class:`holoviews.QuadMesh` with a :class:`holoviews.Contours` plot with the original data points displayed as a :class:`holoviews.Scatter`.""" def __init__(self, n_points: int=50, data=None,...
the_stack_v2_python_sparse
fragile/dataviz/streaming.py
sergio-hcsoft/fragile-1
train
0
08dbdbabc7f3d86e78704da64e02ddd164c4e4bb
[ "illiness = self.env['zakat.illness'].search([])\nfor illi in illiness:\n if illi.sector_id.id in self.ids:\n raise exceptions.ValidationError(_('Diagnosis Sector Cannot Be Removed'))\nreturn super(ZakatDiagnosticSectors, self).unlink()", "num_pattern = re.compile('\\\\d', re.I | re.M)\nwhite_space = re...
<|body_start_0|> illiness = self.env['zakat.illness'].search([]) for illi in illiness: if illi.sector_id.id in self.ids: raise exceptions.ValidationError(_('Diagnosis Sector Cannot Be Removed')) return super(ZakatDiagnosticSectors, self).unlink() <|end_body_0|> <|bod...
ZakatDiagnosticSectors
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZakatDiagnosticSectors: def unlink(self): """If sector hase an Illness should not be removed :raise exception""" <|body_0|> def fields_check(self): """Check if name field contain an invalid value :raise exception""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_36k_train_003887
47,323
no_license
[ { "docstring": "If sector hase an Illness should not be removed :raise exception", "name": "unlink", "signature": "def unlink(self)" }, { "docstring": "Check if name field contain an invalid value :raise exception", "name": "fields_check", "signature": "def fields_check(self)" } ]
2
null
Implement the Python class `ZakatDiagnosticSectors` described below. Class description: Implement the ZakatDiagnosticSectors class. Method signatures and docstrings: - def unlink(self): If sector hase an Illness should not be removed :raise exception - def fields_check(self): Check if name field contain an invalid va...
Implement the Python class `ZakatDiagnosticSectors` described below. Class description: Implement the ZakatDiagnosticSectors class. Method signatures and docstrings: - def unlink(self): If sector hase an Illness should not be removed :raise exception - def fields_check(self): Check if name field contain an invalid va...
0b997095c260d58b026440967fea3a202bef7efb
<|skeleton|> class ZakatDiagnosticSectors: def unlink(self): """If sector hase an Illness should not be removed :raise exception""" <|body_0|> def fields_check(self): """Check if name field contain an invalid value :raise exception""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ZakatDiagnosticSectors: def unlink(self): """If sector hase an Illness should not be removed :raise exception""" illiness = self.env['zakat.illness'].search([]) for illi in illiness: if illi.sector_id.id in self.ids: raise exceptions.ValidationError(_('Diagn...
the_stack_v2_python_sparse
v_11/zakat-project/branches/dzc_1/models/dzc_1_config.py
musabahmed/baba
train
0
6506a93b442c3691a49b3e707735a837a9786236
[ "try:\n body = self.json_body()\n return validate(self.jsonapi_body_schema, body)['data']\nexcept json.JSONDecodeError:\n raise JSONAPIError(400, [{'title': 'The request body must be valid JSON.'}])", "error_type, error_instance, tb = kwargs['exc_info']\nif isinstance(error_instance, JSONAPIError):\n ...
<|body_start_0|> try: body = self.json_body() return validate(self.jsonapi_body_schema, body)['data'] except json.JSONDecodeError: raise JSONAPIError(400, [{'title': 'The request body must be valid JSON.'}]) <|end_body_0|> <|body_start_1|> error_type, error_i...
Base class for all JSONAPI requests.
JSONAPIHandler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JSONAPIHandler: """Base class for all JSONAPI requests.""" async def jsonapi_body(self: 'JSONAPIHandler') -> None: """Get the JSON body. Raises JSONAPIError if it isn't a valid JSONAPI body.""" <|body_0|> def write_error(self: 'JSONAPIHandler', status_code: int, **kwargs...
stack_v2_sparse_classes_36k_train_003888
8,382
permissive
[ { "docstring": "Get the JSON body. Raises JSONAPIError if it isn't a valid JSONAPI body.", "name": "jsonapi_body", "signature": "async def jsonapi_body(self: 'JSONAPIHandler') -> None" }, { "docstring": "Write an error message.", "name": "write_error", "signature": "def write_error(self:...
2
stack_v2_sparse_classes_30k_train_001683
Implement the Python class `JSONAPIHandler` described below. Class description: Base class for all JSONAPI requests. Method signatures and docstrings: - async def jsonapi_body(self: 'JSONAPIHandler') -> None: Get the JSON body. Raises JSONAPIError if it isn't a valid JSONAPI body. - def write_error(self: 'JSONAPIHand...
Implement the Python class `JSONAPIHandler` described below. Class description: Base class for all JSONAPI requests. Method signatures and docstrings: - async def jsonapi_body(self: 'JSONAPIHandler') -> None: Get the JSON body. Raises JSONAPIError if it isn't a valid JSONAPI body. - def write_error(self: 'JSONAPIHand...
1402bce4b52fcc1804b6b3c357b96f6369e1885f
<|skeleton|> class JSONAPIHandler: """Base class for all JSONAPI requests.""" async def jsonapi_body(self: 'JSONAPIHandler') -> None: """Get the JSON body. Raises JSONAPIError if it isn't a valid JSONAPI body.""" <|body_0|> def write_error(self: 'JSONAPIHandler', status_code: int, **kwargs...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JSONAPIHandler: """Base class for all JSONAPI requests.""" async def jsonapi_body(self: 'JSONAPIHandler') -> None: """Get the JSON body. Raises JSONAPIError if it isn't a valid JSONAPI body.""" try: body = self.json_body() return validate(self.jsonapi_body_schema, ...
the_stack_v2_python_sparse
toja/server/handlers/base.py
scmmmh/the-old-joke-archive
train
0
224b6a9b58d06e8efff273ed5952ca27e045022a
[ "for line in self:\n line.overdue_amount = 0\n if line.type == 'out_invoice':\n payments_obj = self.env['account.payment'].search([('partner_id', '=', line.partner_id.id), ('state', '=', 'posted'), ('bulk_payment_id.state', 'in', ['cheque_on_hand', 'deposited']), ('payment_type_name', '=', 'Cheque')])\...
<|body_start_0|> for line in self: line.overdue_amount = 0 if line.type == 'out_invoice': payments_obj = self.env['account.payment'].search([('partner_id', '=', line.partner_id.id), ('state', '=', 'posted'), ('bulk_payment_id.state', 'in', ['cheque_on_hand', 'deposited'])...
AccountInvoiceInherit
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccountInvoiceInherit: def _compute_overdue_amount(self): """Calculating Real outstanding by excluding all draft cheque payments""" <|body_0|> def _compute_stored_overdue_amount(self): """Calculating Real outstanding by excluding all draft cheque payments""" ...
stack_v2_sparse_classes_36k_train_003889
3,962
no_license
[ { "docstring": "Calculating Real outstanding by excluding all draft cheque payments", "name": "_compute_overdue_amount", "signature": "def _compute_overdue_amount(self)" }, { "docstring": "Calculating Real outstanding by excluding all draft cheque payments", "name": "_compute_stored_overdue_...
3
stack_v2_sparse_classes_30k_train_002609
Implement the Python class `AccountInvoiceInherit` described below. Class description: Implement the AccountInvoiceInherit class. Method signatures and docstrings: - def _compute_overdue_amount(self): Calculating Real outstanding by excluding all draft cheque payments - def _compute_stored_overdue_amount(self): Calcu...
Implement the Python class `AccountInvoiceInherit` described below. Class description: Implement the AccountInvoiceInherit class. Method signatures and docstrings: - def _compute_overdue_amount(self): Calculating Real outstanding by excluding all draft cheque payments - def _compute_stored_overdue_amount(self): Calcu...
b6b32366d966aa550af1de50fd4dd1f1e9daefd0
<|skeleton|> class AccountInvoiceInherit: def _compute_overdue_amount(self): """Calculating Real outstanding by excluding all draft cheque payments""" <|body_0|> def _compute_stored_overdue_amount(self): """Calculating Real outstanding by excluding all draft cheque payments""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AccountInvoiceInherit: def _compute_overdue_amount(self): """Calculating Real outstanding by excluding all draft cheque payments""" for line in self: line.overdue_amount = 0 if line.type == 'out_invoice': payments_obj = self.env['account.payment'].search...
the_stack_v2_python_sparse
invoice_outstanding/models/account_invoice.py
EshangAllion/rts-payroll
train
2
89091c6db1d9b90f868019331266b75d885c2120
[ "class MyGenerator:\n\n def __init__(self, gen):\n self._gen = gen\n\n def __next__(self):\n return next(self._gen)\n\ndef inner_callback(item, *args, **kwargs):\n return MyGenerator(callback(item, inner_callback, *args, **kwargs))\nto_call = list()\nto_call.append(inner_callback(root, *args,...
<|body_start_0|> class MyGenerator: def __init__(self, gen): self._gen = gen def __next__(self): return next(self._gen) def inner_callback(item, *args, **kwargs): return MyGenerator(callback(item, inner_callback, *args, **kwargs)) ...
Class that aggregates functions to traverse the parsed tree.
Traversing
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Traversing: """Class that aggregates functions to traverse the parsed tree.""" def traverse(root, callback, *args, **kwargs): """Traverse AST based on callback. :param root: Root element of the parsed tree. :param callback: Function that accepts current node, callback `c_2` and param...
stack_v2_sparse_classes_36k_train_003890
8,160
permissive
[ { "docstring": "Traverse AST based on callback. :param root: Root element of the parsed tree. :param callback: Function that accepts current node, callback `c_2` and parameters from the parent. Function must yield individual values. Its possible to yield callback c_2 **call** on any node to call the recursion. ...
5
stack_v2_sparse_classes_30k_train_012426
Implement the Python class `Traversing` described below. Class description: Class that aggregates functions to traverse the parsed tree. Method signatures and docstrings: - def traverse(root, callback, *args, **kwargs): Traverse AST based on callback. :param root: Root element of the parsed tree. :param callback: Fun...
Implement the Python class `Traversing` described below. Class description: Class that aggregates functions to traverse the parsed tree. Method signatures and docstrings: - def traverse(root, callback, *args, **kwargs): Traverse AST based on callback. :param root: Root element of the parsed tree. :param callback: Fun...
8308a1fd349bf9ea0d267360cc9a4ab20d1629e8
<|skeleton|> class Traversing: """Class that aggregates functions to traverse the parsed tree.""" def traverse(root, callback, *args, **kwargs): """Traverse AST based on callback. :param root: Root element of the parsed tree. :param callback: Function that accepts current node, callback `c_2` and param...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Traversing: """Class that aggregates functions to traverse the parsed tree.""" def traverse(root, callback, *args, **kwargs): """Traverse AST based on callback. :param root: Root element of the parsed tree. :param callback: Function that accepts current node, callback `c_2` and parameters from th...
the_stack_v2_python_sparse
grammpy/transforms/Traversing.py
PatrikValkovic/grammpy
train
2
32b6de486afefd7a73feece8ef8ba6a7ecf7ec6f
[ "params = base.get_params(None, locals())\nrequest = http.Request('GET', self.get_url(), params)\nreturn (request, parsers.parse_json)", "params = base.get_params(None, locals())\nurl = '{0}/{1}'.format(self.get_url(), 'search')\nreturn (http.Request('GET', url, params), parsers.parse_json)" ]
<|body_start_0|> params = base.get_params(None, locals()) request = http.Request('GET', self.get_url(), params) return (request, parsers.parse_json) <|end_body_0|> <|body_start_1|> params = base.get_params(None, locals()) url = '{0}/{1}'.format(self.get_url(), 'search') ...
ForumSuggestions
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ForumSuggestions: def get(self, page=None, per_page=None, category=None, filter=None, sort=None, updated_after_date=None): """Fetch suggestions from this forum. :var page: Where should paging start. If left as `None`, the first page is returned. :vartype page: int :var per_page: How many...
stack_v2_sparse_classes_36k_train_003891
8,533
permissive
[ { "docstring": "Fetch suggestions from this forum. :var page: Where should paging start. If left as `None`, the first page is returned. :vartype page: int :var per_page: How many objects sould be returned. If left as `None`, 10 objects are returned. :vartype per_page: int :var category: Either a category ID, `a...
2
null
Implement the Python class `ForumSuggestions` described below. Class description: Implement the ForumSuggestions class. Method signatures and docstrings: - def get(self, page=None, per_page=None, category=None, filter=None, sort=None, updated_after_date=None): Fetch suggestions from this forum. :var page: Where shoul...
Implement the Python class `ForumSuggestions` described below. Class description: Implement the ForumSuggestions class. Method signatures and docstrings: - def get(self, page=None, per_page=None, category=None, filter=None, sort=None, updated_after_date=None): Fetch suggestions from this forum. :var page: Where shoul...
25caa745a104c8dc209584fa359294c65dbf88bb
<|skeleton|> class ForumSuggestions: def get(self, page=None, per_page=None, category=None, filter=None, sort=None, updated_after_date=None): """Fetch suggestions from this forum. :var page: Where should paging start. If left as `None`, the first page is returned. :vartype page: int :var per_page: How many...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ForumSuggestions: def get(self, page=None, per_page=None, category=None, filter=None, sort=None, updated_after_date=None): """Fetch suggestions from this forum. :var page: Where should paging start. If left as `None`, the first page is returned. :vartype page: int :var per_page: How many objects sould...
the_stack_v2_python_sparse
libsaas/services/uservoice/suggestions.py
piplcom/libsaas
train
1
f7cf100b364894018a7f8e5bcc36ed3cf2c344f9
[ "original_id = request.json.get('original_id')\nown_id_list = request.json.get('own_id_list')\noriginal = self.db.session.query(File).filter_by(id=original_id).first()\nfor own_id in own_id_list:\n create_data = {'object_name': original.object_name, 'object_type': original.object_type, 'object_size': original.ob...
<|body_start_0|> original_id = request.json.get('original_id') own_id_list = request.json.get('own_id_list') original = self.db.session.query(File).filter_by(id=original_id).first() for own_id in own_id_list: create_data = {'object_name': original.object_name, 'object_type': ...
ShareCreate
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShareCreate: def post(self): """创建分享文件""" <|body_0|> def get(self): """列出分享文件""" <|body_1|> <|end_skeleton|> <|body_start_0|> original_id = request.json.get('original_id') own_id_list = request.json.get('own_id_list') original = self...
stack_v2_sparse_classes_36k_train_003892
3,233
no_license
[ { "docstring": "创建分享文件", "name": "post", "signature": "def post(self)" }, { "docstring": "列出分享文件", "name": "get", "signature": "def get(self)" } ]
2
null
Implement the Python class `ShareCreate` described below. Class description: Implement the ShareCreate class. Method signatures and docstrings: - def post(self): 创建分享文件 - def get(self): 列出分享文件
Implement the Python class `ShareCreate` described below. Class description: Implement the ShareCreate class. Method signatures and docstrings: - def post(self): 创建分享文件 - def get(self): 列出分享文件 <|skeleton|> class ShareCreate: def post(self): """创建分享文件""" <|body_0|> def get(self): """...
c0ec16c0144d3754e67e295babef4417703102dc
<|skeleton|> class ShareCreate: def post(self): """创建分享文件""" <|body_0|> def get(self): """列出分享文件""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ShareCreate: def post(self): """创建分享文件""" original_id = request.json.get('original_id') own_id_list = request.json.get('own_id_list') original = self.db.session.query(File).filter_by(id=original_id).first() for own_id in own_id_list: create_data = {'object_n...
the_stack_v2_python_sparse
nemi_flask/Api_v1_0/namespace_share/views.py
Athrun1027/Nemi
train
1
c191ffad197cbef0e833252b837318915672e4c0
[ "self.type = atype\nself.bq = bq\nself.score = None\nself.children = None\nself.current = cplayer\nself.target = tplayer", "if not self.children:\n self.children = []\nself.children.append(state)" ]
<|body_start_0|> self.type = atype self.bq = bq self.score = None self.children = None self.current = cplayer self.target = tplayer <|end_body_0|> <|body_start_1|> if not self.children: self.children = [] self.children.append(state) <|end_body...
A state node class.
StateNode
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StateNode: """A state node class.""" def __init__(self, atype: str, cplayer: 'Character', tplayer: 'Character', bq: 'BattleQueue') -> None: """Init this state node.""" <|body_0|> def add_child(self, state: 'StateNode') -> None: """Add a child to this state. >>> f...
stack_v2_sparse_classes_36k_train_003893
11,109
no_license
[ { "docstring": "Init this state node.", "name": "__init__", "signature": "def __init__(self, atype: str, cplayer: 'Character', tplayer: 'Character', bq: 'BattleQueue') -> None" }, { "docstring": "Add a child to this state. >>> from a2_battle_queue import BattleQueue >>> from a2_characters import...
2
stack_v2_sparse_classes_30k_train_005008
Implement the Python class `StateNode` described below. Class description: A state node class. Method signatures and docstrings: - def __init__(self, atype: str, cplayer: 'Character', tplayer: 'Character', bq: 'BattleQueue') -> None: Init this state node. - def add_child(self, state: 'StateNode') -> None: Add a child...
Implement the Python class `StateNode` described below. Class description: A state node class. Method signatures and docstrings: - def __init__(self, atype: str, cplayer: 'Character', tplayer: 'Character', bq: 'BattleQueue') -> None: Init this state node. - def add_child(self, state: 'StateNode') -> None: Add a child...
9a777677d0b11fe8b920abf63dde4e03d2347ab0
<|skeleton|> class StateNode: """A state node class.""" def __init__(self, atype: str, cplayer: 'Character', tplayer: 'Character', bq: 'BattleQueue') -> None: """Init this state node.""" <|body_0|> def add_child(self, state: 'StateNode') -> None: """Add a child to this state. >>> f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StateNode: """A state node class.""" def __init__(self, atype: str, cplayer: 'Character', tplayer: 'Character', bq: 'BattleQueue') -> None: """Init this state node.""" self.type = atype self.bq = bq self.score = None self.children = None self.current = cpla...
the_stack_v2_python_sparse
summer 2018/A2/a2_playstyle.py
Yangfan999/csc148-assignments
train
3
0eec3fc54e993c2984c11d1ea7dd9763b509714b
[ "\"\"\"\n Constructor\n \"\"\"\nself.log = LoggingService(logfile=logfile, msg_identifier=f'chop_spectrograms')\nif not os.path.exists(snippet_outdir):\n os.makedirs(snippet_outdir)\n'\\n Open the spect file and corresponding label and then CHOP, CHOP, CHOP\\n '\ntry:\n spectro...
<|body_start_0|> """ Constructor """ self.log = LoggingService(logfile=logfile, msg_identifier=f'chop_spectrograms') if not os.path.exists(snippet_outdir): os.makedirs(snippet_outdir) '\n Open the spect file and corresponding label a...
Given a single spectrogram and the corresponding labeling, chop the spectrograms into the specified window size! NOTE: For now avoid doing any parallelization to just get this done functionality wise
SpectrogramChopper
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpectrogramChopper: """Given a single spectrogram and the corresponding labeling, chop the spectrograms into the specified window size! NOTE: For now avoid doing any parallelization to just get this done functionality wise""" def __init__(self, spect_file, spect_label_file, snippet_outdir, w...
stack_v2_sparse_classes_36k_train_003894
6,601
no_license
[ { "docstring": "@param spect_file: The spectrogram file we want to chop @type spect_file: str @param spect_label_file: The spectrogram label file with 0/1 binary labels @type spect_label_file: str @param snippet_outdir: where the snippets are to be placed. This is likely to be either in the training / test fold...
2
stack_v2_sparse_classes_30k_train_016340
Implement the Python class `SpectrogramChopper` described below. Class description: Given a single spectrogram and the corresponding labeling, chop the spectrograms into the specified window size! NOTE: For now avoid doing any parallelization to just get this done functionality wise Method signatures and docstrings: ...
Implement the Python class `SpectrogramChopper` described below. Class description: Given a single spectrogram and the corresponding labeling, chop the spectrograms into the specified window size! NOTE: For now avoid doing any parallelization to just get this done functionality wise Method signatures and docstrings: ...
e513df821a5261913be677023ab1e0e65099f0b9
<|skeleton|> class SpectrogramChopper: """Given a single spectrogram and the corresponding labeling, chop the spectrograms into the specified window size! NOTE: For now avoid doing any parallelization to just get this done functionality wise""" def __init__(self, spect_file, spect_label_file, snippet_outdir, w...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SpectrogramChopper: """Given a single spectrogram and the corresponding labeling, chop the spectrograms into the specified window size! NOTE: For now avoid doing any parallelization to just get this done functionality wise""" def __init__(self, spect_file, spect_label_file, snippet_outdir, window_size=25...
the_stack_v2_python_sparse
src/Refactored/spectrogram_chopper.py
jonathangomesselman/ElephantCallAI
train
0
abe63f9aa466b4d1cff570cff8aceede68f93805
[ "self.res = 0\nself.nums = sorted(nums, reverse=True)\n\ndef deeper(target_sum, current_index):\n print(target_sum, current_index)\n if current_index == len(self.nums):\n if target_sum == 0:\n self.res += 1\n cache[target_sum, current_index] = True\n return True\n ...
<|body_start_0|> self.res = 0 self.nums = sorted(nums, reverse=True) def deeper(target_sum, current_index): print(target_sum, current_index) if current_index == len(self.nums): if target_sum == 0: self.res += 1 cach...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findTargetSumWays1(self, nums, S): """:type nums: List[int] :type S: int :rtype: int""" <|body_0|> def findTargetSumWays(self, nums, S): """第二次做的时候发现上面那个结果不对了是什么鬼""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.res = 0 sel...
stack_v2_sparse_classes_36k_train_003895
2,364
no_license
[ { "docstring": ":type nums: List[int] :type S: int :rtype: int", "name": "findTargetSumWays1", "signature": "def findTargetSumWays1(self, nums, S)" }, { "docstring": "第二次做的时候发现上面那个结果不对了是什么鬼", "name": "findTargetSumWays", "signature": "def findTargetSumWays(self, nums, S)" } ]
2
stack_v2_sparse_classes_30k_val_001195
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findTargetSumWays1(self, nums, S): :type nums: List[int] :type S: int :rtype: int - def findTargetSumWays(self, nums, S): 第二次做的时候发现上面那个结果不对了是什么鬼
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findTargetSumWays1(self, nums, S): :type nums: List[int] :type S: int :rtype: int - def findTargetSumWays(self, nums, S): 第二次做的时候发现上面那个结果不对了是什么鬼 <|skeleton|> class Solution:...
97533d53c8892b6519e99f344489fa4fd4c9ab93
<|skeleton|> class Solution: def findTargetSumWays1(self, nums, S): """:type nums: List[int] :type S: int :rtype: int""" <|body_0|> def findTargetSumWays(self, nums, S): """第二次做的时候发现上面那个结果不对了是什么鬼""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findTargetSumWays1(self, nums, S): """:type nums: List[int] :type S: int :rtype: int""" self.res = 0 self.nums = sorted(nums, reverse=True) def deeper(target_sum, current_index): print(target_sum, current_index) if current_index == len(sel...
the_stack_v2_python_sparse
2. DFS/494.py
proTao/leetcode
train
0
0b75e97702de68484088a375f0deafb0428a4c10
[ "lens = len(cost)\nf = [0] * lens\nf[:2] = cost[:2]\nfor i in range(2, lens):\n f[i] = min(f[i - 1], f[i - 2]) + cost[i]\nm = min(f[-1], f[-2])\nreturn m", "lens = len(cost)\nm1 = cost[0]\nm2 = cost[1]\nfor i in range(2, lens):\n m1, m2 = (m2, cost[i] + min(m1, m2))\nreturn min(m1, m2)" ]
<|body_start_0|> lens = len(cost) f = [0] * lens f[:2] = cost[:2] for i in range(2, lens): f[i] = min(f[i - 1], f[i - 2]) + cost[i] m = min(f[-1], f[-2]) return m <|end_body_0|> <|body_start_1|> lens = len(cost) m1 = cost[0] m2 = cost[...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minCostClimbingStairs(self, cost): """:type cost: List[int] :rtype: int 32ms, beats: 98.72%""" <|body_0|> def minCostClimbingStairs2(self, cost): """:type cost: List[int] :rtype: int 32ms, beats: 98.72%""" <|body_1|> <|end_skeleton|> <|body_st...
stack_v2_sparse_classes_36k_train_003896
692
no_license
[ { "docstring": ":type cost: List[int] :rtype: int 32ms, beats: 98.72%", "name": "minCostClimbingStairs", "signature": "def minCostClimbingStairs(self, cost)" }, { "docstring": ":type cost: List[int] :rtype: int 32ms, beats: 98.72%", "name": "minCostClimbingStairs2", "signature": "def min...
2
stack_v2_sparse_classes_30k_train_018408
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minCostClimbingStairs(self, cost): :type cost: List[int] :rtype: int 32ms, beats: 98.72% - def minCostClimbingStairs2(self, cost): :type cost: List[int] :rtype: int 32ms, bea...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minCostClimbingStairs(self, cost): :type cost: List[int] :rtype: int 32ms, beats: 98.72% - def minCostClimbingStairs2(self, cost): :type cost: List[int] :rtype: int 32ms, bea...
624975f767f6efa1d7361cc077eaebc344d57210
<|skeleton|> class Solution: def minCostClimbingStairs(self, cost): """:type cost: List[int] :rtype: int 32ms, beats: 98.72%""" <|body_0|> def minCostClimbingStairs2(self, cost): """:type cost: List[int] :rtype: int 32ms, beats: 98.72%""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minCostClimbingStairs(self, cost): """:type cost: List[int] :rtype: int 32ms, beats: 98.72%""" lens = len(cost) f = [0] * lens f[:2] = cost[:2] for i in range(2, lens): f[i] = min(f[i - 1], f[i - 2]) + cost[i] m = min(f[-1], f[-2]) ...
the_stack_v2_python_sparse
746. 使用最小花费爬楼梯.py
dx19910707/LeetCode
train
0
463ef791225c225cde13a3c88c80e1896fce1606
[ "data = {'id': str(user_id), 'first_name': '', 'last_name': '', 'fullname': '', 'email': '', 'internal': False}\ntry:\n _ = UUID(user_id)\nexcept (ValueError, AttributeError):\n logger.error(f'Actor id is not a valid UUID: {user_id}')\nelse:\n if user_id == SystemUser.id:\n raw_data = SystemUser\n ...
<|body_start_0|> data = {'id': str(user_id), 'first_name': '', 'last_name': '', 'fullname': '', 'email': '', 'internal': False} try: _ = UUID(user_id) except (ValueError, AttributeError): logger.error(f'Actor id is not a valid UUID: {user_id}') else: i...
Stub implementation of the IUserProfileQuery interface.
BaseUserProfileQuery
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseUserProfileQuery: """Stub implementation of the IUserProfileQuery interface.""" def get_data(self, user_id: str) -> dict: """Get a map with user data.""" <|body_0|> def update_wf_history(self, state_history: list) -> list: """Update workflow history with user...
stack_v2_sparse_classes_36k_train_003897
1,795
no_license
[ { "docstring": "Get a map with user data.", "name": "get_data", "signature": "def get_data(self, user_id: str) -> dict" }, { "docstring": "Update workflow history with user data.", "name": "update_wf_history", "signature": "def update_wf_history(self, state_history: list) -> list" } ]
2
stack_v2_sparse_classes_30k_train_004156
Implement the Python class `BaseUserProfileQuery` described below. Class description: Stub implementation of the IUserProfileQuery interface. Method signatures and docstrings: - def get_data(self, user_id: str) -> dict: Get a map with user data. - def update_wf_history(self, state_history: list) -> list: Update workf...
Implement the Python class `BaseUserProfileQuery` described below. Class description: Stub implementation of the IUserProfileQuery interface. Method signatures and docstrings: - def get_data(self, user_id: str) -> dict: Get a map with user data. - def update_wf_history(self, state_history: list) -> list: Update workf...
0f27d5de4b04fe1d0ce2c2c9ccd3f2893b833128
<|skeleton|> class BaseUserProfileQuery: """Stub implementation of the IUserProfileQuery interface.""" def get_data(self, user_id: str) -> dict: """Get a map with user data.""" <|body_0|> def update_wf_history(self, state_history: list) -> list: """Update workflow history with user...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseUserProfileQuery: """Stub implementation of the IUserProfileQuery interface.""" def get_data(self, user_id: str) -> dict: """Get a map with user data.""" data = {'id': str(user_id), 'first_name': '', 'last_name': '', 'fullname': '', 'email': '', 'internal': False} try: ...
the_stack_v2_python_sparse
src/briefy/common/utilities/userprofile.py
BriefyHQ/briefy.common
train
0
cc741e45350e53e8777c31456edc4e3a5ee3e882
[ "super().at_object_creation()\nself.db.hit = 0.4\nself.db.parry = 0.8\nself.db.damage = 1.0\nself.db.magic = False\nself.cmdset.add_default(CmdSetWeapon, persistent=True)", "if self.location.has_account and self.home == self.location:\n self.location.msg_contents('%s suddenly and magically fades into nothingne...
<|body_start_0|> super().at_object_creation() self.db.hit = 0.4 self.db.parry = 0.8 self.db.damage = 1.0 self.db.magic = False self.cmdset.add_default(CmdSetWeapon, persistent=True) <|end_body_0|> <|body_start_1|> if self.location.has_account and self.home == sel...
This defines a bladed weapon. Important attributes (set at creation): hit - chance to hit (0-1) parry - chance to parry (0-1) damage - base damage given (modified by hit success and type of attack) (0-10)
TutorialWeapon
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TutorialWeapon: """This defines a bladed weapon. Important attributes (set at creation): hit - chance to hit (0-1) parry - chance to parry (0-1) damage - base damage given (modified by hit success and type of attack) (0-10)""" def at_object_creation(self): """Called at first creation...
stack_v2_sparse_classes_36k_train_003898
42,155
permissive
[ { "docstring": "Called at first creation of the object", "name": "at_object_creation", "signature": "def at_object_creation(self)" }, { "docstring": "When reset, the weapon is simply deleted, unless it has a place to return to.", "name": "reset", "signature": "def reset(self)" } ]
2
null
Implement the Python class `TutorialWeapon` described below. Class description: This defines a bladed weapon. Important attributes (set at creation): hit - chance to hit (0-1) parry - chance to parry (0-1) damage - base damage given (modified by hit success and type of attack) (0-10) Method signatures and docstrings:...
Implement the Python class `TutorialWeapon` described below. Class description: This defines a bladed weapon. Important attributes (set at creation): hit - chance to hit (0-1) parry - chance to parry (0-1) damage - base damage given (modified by hit success and type of attack) (0-10) Method signatures and docstrings:...
b3ca58b5c1325a3bf57051dfe23560a08d2947b7
<|skeleton|> class TutorialWeapon: """This defines a bladed weapon. Important attributes (set at creation): hit - chance to hit (0-1) parry - chance to parry (0-1) damage - base damage given (modified by hit success and type of attack) (0-10)""" def at_object_creation(self): """Called at first creation...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TutorialWeapon: """This defines a bladed weapon. Important attributes (set at creation): hit - chance to hit (0-1) parry - chance to parry (0-1) damage - base damage given (modified by hit success and type of attack) (0-10)""" def at_object_creation(self): """Called at first creation of the objec...
the_stack_v2_python_sparse
evennia/contrib/tutorials/tutorial_world/objects.py
evennia/evennia
train
1,781
85cf91748ee8194693d7ffae9111cdc5624b24df
[ "serializer = CreateShareLinkSerializer(data=request.data, context=self.get_serializer_context())\nif not serializer.is_valid():\n return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)\nlink_id = serializer.validated_data.get('link_id')\nshare_id = serializer.validated_data.get('share_id')\npare...
<|body_start_0|> serializer = CreateShareLinkSerializer(data=request.data, context=self.get_serializer_context()) if not serializer.is_valid(): return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) link_id = serializer.validated_data.get('link_id') share_id =...
Check the REST Token and the object permissions and returns own share right if the necessary access rights are granted and the user is the user of the share right Accept the following GET parameters: share_id (optional) Return a list of the shares or the share and the access rights or a message for an update of rights
ShareLinkView
[ "BSD-3-Clause", "MIT", "Apache-2.0", "BSD-2-Clause", "CC0-1.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShareLinkView: """Check the REST Token and the object permissions and returns own share right if the necessary access rights are granted and the user is the user of the share right Accept the following GET parameters: share_id (optional) Return a list of the shares or the share and the access rig...
stack_v2_sparse_classes_36k_train_003899
4,042
permissive
[ { "docstring": "Insert share link in share tree Necessary Rights: - grant on share - write on parent_share :param request: :param args: :param kwargs: :return: 201 / 400", "name": "put", "signature": "def put(self, request, *args, **kwargs)" }, { "docstring": "Update share link in share tree Nec...
3
null
Implement the Python class `ShareLinkView` described below. Class description: Check the REST Token and the object permissions and returns own share right if the necessary access rights are granted and the user is the user of the share right Accept the following GET parameters: share_id (optional) Return a list of the...
Implement the Python class `ShareLinkView` described below. Class description: Check the REST Token and the object permissions and returns own share right if the necessary access rights are granted and the user is the user of the share right Accept the following GET parameters: share_id (optional) Return a list of the...
8936aa8ccdee8b9617ef7d894cb9a9a9f6f473cf
<|skeleton|> class ShareLinkView: """Check the REST Token and the object permissions and returns own share right if the necessary access rights are granted and the user is the user of the share right Accept the following GET parameters: share_id (optional) Return a list of the shares or the share and the access rig...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ShareLinkView: """Check the REST Token and the object permissions and returns own share right if the necessary access rights are granted and the user is the user of the share right Accept the following GET parameters: share_id (optional) Return a list of the shares or the share and the access rights or a mess...
the_stack_v2_python_sparse
psono/restapi/views/share_link.py
psono/psono-server
train
76